kb

command module
v1.8.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 8, 2026 License: MIT Imports: 18 Imported by: 0

README

kb

A fast, local-first kanban board for your terminal.
Use the same tasks from the TUI, CLI, scripts, and AI agents.

Build Latest release Go version MIT license Local-only storage

Illustrated preview of the kb terminal board with Todo, Doing, and Done columns

kb is one executable with no hosted account, remote mode, or build step. Your board lives in local SQLite—no signup and no service to keep running. Open it full-screen, automate it from the command line, connect a local MCP client over stdio, or view it in a browser. Only kb web opens a TCP listener; it binds to 127.0.0.1 by default, and no other command listens on a port.

Why kb

  • Terminal-native: keyboard and mouse controls, responsive columns, forms, filters, Markdown, comments, checklists, and blocker links.
  • Local-only: TUI, CLI, MCP, and the web UI all use the same SQLite database.
  • Scriptable: stable task numbers, JSON output on supported commands, and a focused task CLI.
  • Agent-ready: 12 MCP tools plus optional AI-assisted drafting and imports.
  • Safe task flow: completion guards catch open checklist items and blockers; cancellation stays reversible until you explicitly delete a task.

Get started

Install with Go

Go 1.26.5 or newer is required. Use the local toolchain so Go does not download another version during installation:

GOTOOLCHAIN=local go install github.com/RandomCodeSpace/kb@latest
kb version

Install a release binary

CGO-free binaries for Linux amd64/arm64, macOS amd64/arm64, and Windows amd64 are attached to the latest release. Download the matching binary and SHA256SUMS, then verify it before installing:

grep ' kb-linux-amd64$' SHA256SUMS | sha256sum -c -

On macOS, use shasum -a 256 -c -. On Windows, compare Get-FileHash -Algorithm SHA256 with the matching manifest entry.

Linux example after verification:

mkdir -p "$HOME/.local/bin"
install -m 0755 kb-linux-amd64 "$HOME/.local/bin/kb"

Make sure $HOME/.local/bin is on your PATH.

Create your first board

kb project use personal
kb add "Write launch notes" --prio high --tag docs
kb list
kb

That is the whole setup. A fresh task needs a project, so the first command saves personal as your default. A bare kb opens the TUI when run in an interactive terminal.

Data is stored in $KB_DATA or ~/.local/share/kb. To use another location:

kb tui --data /path/to/kb-data

Use the board

The footer always shows actions available in the current view. These are the keys worth learning first:

Key Action
j/k, arrows Select a card
h/l, Tab/Shift+Tab Move between columns
Enter Open card details
Space Lift or drop a card
n / e Create / edit
t / x / r Ship / cancel / restore
/ / f / X Text filter / label filter / clear filters
p / P Next / previous project
Ctrl+K Command palette
s Settings
? Full keyboard help
q Quit

Editors use Tab and Shift+Tab between fields and Ctrl+S or Ctrl+Enter to save. The TUI asks before discarding changed forms. Local CLI changes appear without restarting the board.

Use the CLI

A normal task lifecycle stays pleasantly boring:

kb add "Ship the docs" -p web --prio high --tag release
kb list --tag project::web
# kb add prints the new task number; #12 is an example
kb view 12
kb move 12 doing
kb comment add 12 "Ready for review"
kb done 12

Tasks receive stable per-board numbers such as #12. Use bare 12, quoted '#12', a full UUID, or a unique UUID prefix anywhere a task reference is expected.

Useful commands:

add  list  view  update  move  done  cancel  restore  rm
project  users  comment  link  unlink

Run kb help for task-command syntax and flags. Moving to Done is refused while a task is blocked, has an incomplete checklist, or has an open linked blocker. Use --force only when you mean to bypass that guard. cancel is reversible; rm ID --yes is permanent.

Work with projects

Projects are simple views inside one board:

kb project use web          # save the default project
kb project current
kb project list
kb add "Ship the docs"      # goes to web
kb add "Fix auth" -p api    # one-command override
kb update 12 -p api         # move task #12 to api

Resolution order is -p/--project, KB_PROJECT, then the saved default. Tasks from older kb versions without a project are placed in inbox when a local mode opens the store.

Use the web UI

The web UI is an optional browser view of the same board. It starts only when you ask for it:

kb web                                  # pick a free loopback port, open the browser
kb web --no-open --addr 127.0.0.1:8321  # fixed port, print the URL only
Flag Purpose
--data DIR Data directory (default $KB_DATA or ~/.local/share/kb)
--addr HOST:PORT Listen address; default 127.0.0.1:0
--no-open Do not launch a browser
--unsafe-listen Allow a non-loopback --addr

The web UI has no authentication. A non-loopback --addr is refused unless --unsafe-listen is also given, and with it anyone who can reach the address can read and change your board. Keep the default loopback bind unless you have a firewall or tunnel in front of it.

TUI, CLI, MCP, and the web UI share one SQLite database; changes made in any of them appear in the others without a restart.

Use AI and agents

AI is optional. Press s in the TUI to configure an OpenAI-compatible Chat Completions endpoint, model, and API key. The endpoint must support tool calls. Drafting, ADR splitting, and forge import show proposals for review before creating tasks.

Built-in skills:

  • story-draft turns rough notes into one card;
  • adr-split turns an ADR into reviewable cards;
  • import-transform turns GitHub or GitLab issues into reviewable cards.

Add or replace skills with direct-child Markdown files in <data>/skills. Provider and forge credentials are encrypted in the local SQLite database.

Connect an MCP client

kb mcp exposes the local board over stdio. It opens no network listener.

[mcp_servers.kb]
command = "kb"
args = ["mcp"]

The MCP process exposes task listing, creation, updates, moves, reversible cancellation, explicit permanent deletion, similarity and duplicate checks, task details, comments, and blocker links. It registers 12 tools and no MCP resources.

Exact MCP tool names
list_tasks        add_task          update_task       move_task
delete_task       search_similar    duplicate_check   get_task
add_comment       list_comments     link_tasks        unlink_tasks

Keep your data safe

Important files in the data directory:

Path Purpose
kb.db Tasks and settings
kb.db-wal, kb.db-shm Active SQLite sidecars
secret Generated key when KB_SECRET is unset
state.json CLI project preference
.kb-tui/ TUI preferences
skills/ Optional custom AI skills

Back up

  1. Quit the TUI and stop any CLI scripts or MCP clients that may be writing.
  2. Copy the entire data directory as one unit—not just kb.db. This keeps the database, any SQLite sidecars, the generated secret, preferences, and custom skills together. Copy to a fresh destination, not over an existing one.
  3. If you set KB_SECRET outside the data directory, preserve that exact value with the backup. It is part of the backup even though it is stored elsewhere.

Restore

  1. Stop every kb process that uses the destination data directory.
  2. Restore the complete directory to an empty directory. Use the original generated secret file or the exact external KB_SECRET value.
  3. Open the restored directory first with the same kb version or a newer one.
  4. Start kb normally. It validates the database schema before migration and refuses an existing database when its generated secret is missing, instead of silently creating a key that cannot decrypt the stored credentials.

Losing the generated or external key makes stored credentials unreadable. Task content remains in SQLite, but the complete directory plus the matching secret is the supported recovery unit.

Unsupported

Do not:

  • Back up live copies of the directory while kb is running anywhere.
  • Copy only kb.db without the rest of the directory.
  • Overlay a restored backup onto an existing directory.
  • Store the data directory on network filesystems or synced folders (Dropbox, iCloud, OneDrive, and similar).
  • Use the same data directory from multiple hosts.
  • Downgrade to an older kb version with an existing database.

Legacy <user>.md boards in the data directory are considered for one-time import when that owner has no tasks. Use default.md for the board visible to local modes. Source Markdown files are not deleted.

Environment variables
Variable Purpose
KB_DATA Data directory
KB_SECRET Encryption secret override
KB_PROJECT Active project override
KB_AI_ALLOW_PRIVATE Allow private AI endpoints; defaults to 1, set 0 to block them
KB_FORGE_ALLOW_PRIVATE Bypass the forge guard for named hosts or all hosts
KB_LINK_ALLOW_PRIVATE Bypass the skill-link guard for named hosts or all hosts

The three *_ALLOW_PRIVATE settings control separate network boundaries. AI allows private endpoints when unset or set to 1; set it to 0 to block them. Forge and skill links accept a host list or 1/* for all.

Build and contribute

Build the local binary:

CGO_ENABLED=0 go build -o kb .

Run the test for the package or contract you changed. After committing, the repository-owned impact calculator shows the same scope GitHub Quality will use:

base=$(git merge-base origin/main HEAD)
sh scripts/ci/impact.sh --base "$base" --head HEAD

Every pull request still reports the same nine Quality jobs. Unaffected jobs say not affected; affected jobs run only the owning packages and mapped contracts. Changes to shared migrations, terminal performance, CI, docs, or release behavior select their focused gate automatically. Node is used only by the repository's CI monitor and is not an application build or runtime dependency.

When Go, release, or CI behavior changes, a native smoke matrix builds and exercises the local task flow on Linux, macOS, and Windows.

Use conventional commit subjects and target pull requests at main.

Current release notes are in docs/releases/v1.7.2.md.

License

kb is available under the MIT License.

Documentation

Overview

Command kb opens the local terminal UI by default. Task CLI and MCP subcommands use the same SQLite store directly.

Directories

Path Synopsis
internal
ai
Package ai implements kb's model probe, skill runner, and board tools over the local store.
Package ai implements kb's model probe, skill runner, and board tools over the local store.
board
Package board holds the kanban board model and its markdown wire codec.
Package board holds the kanban board model and its markdown wire codec.
cliapp
Package cliapp implements the kb command-line interface against the local SQLite store.
Package cliapp implements the kb command-line interface against the local SQLite store.
forge
Package forge implements configured, guarded issue imports and upstream drift checks for local UI workflows.
Package forge implements configured, guarded issue imports and upstream drift checks for local UI workflows.
mcpserv
Package mcpserv exposes a user's kb board as an MCP server named "kb" over stdio, so agent harnesses can list, add, update, move, and delete tasks against the local SQLite store.
Package mcpserv exposes a user's kb board as an MCP server named "kb" over stdio, so agent harnesses can list, add, update, move, and delete tasks against the local SQLite store.
project
Package project carries the project vocabulary every kb surface shares.
Package project carries the project vocabulary every kb surface shares.
store
Package store persists kanban boards, labels, and per-user AI settings in a single SQLite database via modernc.org/sqlite (pure Go, WAL mode).
Package store persists kanban boards, labels, and per-user AI settings in a single SQLite database via modernc.org/sqlite (pure Go, WAL mode).
tui
Package tui implements kb's full-screen terminal interface.
Package tui implements kb's full-screen terminal interface.
tui/action
Package action owns kb's keyboard action registry: one table naming every action the board offers, the key that drives it, and the words that describe it.
Package action owns kb's keyboard action registry: one table naming every action the board offers, the key that drives it, and the words that describe it.
tui/adrsplit
Package adrsplit implements the direct-runner ADR-to-stories review overlay.
Package adrsplit implements the direct-runner ADR-to-stories review overlay.
tui/carddetail
Package carddetail renders the full-card overlay and its direct-store comment and blocker-link actions.
Package carddetail renders the full-card overlay and its direct-store comment and blocker-link actions.
tui/cardeditor
Package cardeditor implements the direct-store create and edit overlay.
Package cardeditor implements the direct-store create and edit overlay.
tui/cmdpalette
Package cmdpalette renders kb's ctrl+k command palette: a fuzzy search over the action registry, elevated as the overlay of spec section 4.
Package cmdpalette renders kb's ctrl+k command palette: a fuzzy search over the action registry, elevated as the overlay of spec section 4.
tui/formview
Package formview renders terminal form controls shared by TUI overlays.
Package formview renders terminal form controls shared by TUI overlays.
tui/issueimport
Package issueimport implements the direct-store forge import review overlay.
Package issueimport implements the direct-store forge import review overlay.
tui/mdparity
Package mdparity is the one grammar kb reduces a card description to before anything renders it.
Package mdparity is the one grammar kb reduces a card description to before anything renders it.
tui/pointer
Package pointer maps rendered terminal cells to pointer interactions.
Package pointer maps rendered terminal cells to pointer interactions.
tui/theme
Package theme owns kb's TUI design tokens: the semantic palette of docs/design/tui-design-spec.md section 1, the cached style factory of section 6, and the layout metrics and glyphs of section 2.
Package theme owns kb's TUI design tokens: the semantic palette of docs/design/tui-design-spec.md section 1, the cached style factory of section 6, and the layout metrics and glyphs of section 2.
tui/widget
Package widget holds kb's hand-crafted TUI elements: the last resort of the charm-first sourcing rule of map #136, allowed only for the elements charm does not ship.
Package widget holds kb's hand-crafted TUI elements: the last resort of the charm-first sourcing rule of map #136, allowed only for the elements charm does not ship.
tui/widget/spin
Package spin is the branded spinner engine of spec section 10.2.5: the gradient label that wipes in column by column while kb waits on a network round trip or a model inference.
Package spin is the branded spinner engine of spec section 10.2.5: the gradient label that wipes in column by column while kb waits on a network round trip or a model inference.
webui
Package webui serves the kb board to a local browser: a JSON API under /api/ backed by the same store the CLI uses, plus an embedded static UI.
Package webui serves the kb board to a local browser: a JSON API under /api/ backed by the same store the CLI uses, plus an embedded static UI.
scripts
ci/impactcmd command

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL