kbcode Documentation

An AI coding agent that lives in your terminal — and actually knows your project.

1 · Installation

PowerShell (works in cmd.exe too — paste and press Enter):

powershell -NoProfile -ExecutionPolicy Bypass -Command "[Net.ServicePointManager]::SecurityProtocol='Tls12'; Invoke-Expression (Invoke-RestMethod -UseBasicParsing https://kbcode.dev/install.ps1)"

cmd.exe (Command Prompt — no PowerShell needed):

curl -fsSL https://kbcode.dev/install.bat -o "%TEMP%\kbi.bat" && "%TEMP%\kbi.bat"

This downloads kb.exe, verifies its SHA-256 hash, installs to %LOCALAPPDATA%\kbcode, and adds it to your user PATH. Open a new terminal and verify:

kb --version

2 · Sign In

kbcode is owner-approved invite-only preview. Run:

kb login

Sign in with your whitelisted Google account. Check status anytime with kb whoami, or sign out with kb logout.

3 · Model Setup

Run the interactive model wizard in any project folder:

kb model

Pick your provider (Anthropic Claude, OpenAI, Gemini, DeepSeek, Ollama, OpenRouter, or custom OpenAI-compatible endpoint), enter your API key, and select a model. Keys are Fernet-encrypted and machine-bound in ~/.kbcode.

4 · Terminal Commands

CommandWhat it does
kbStart interactive chat in current folder
kb "task"Run one task, print answer, exit
kb -y "task"Same, auto-approving all edits/commands
kb -cContinue last session for this folder
kb --resume [id]Pick an older session from history
kb --json "query"Machine-readable JSON answer
kb -C "path" "task"Work on another project without cd
kb initInitialize project (AGENT.md + kb/ notes)
kb modelRun provider + key + model wizard
kb login / logoutGoogle sign-in or sign-out
kb doctorHealth check: PATH, install, config, provider
kb updateSelf-update binary to latest version

Piping context:

git diff | kb "review this change"

5 · Slash Commands (In Chat)

Type /help inside the chat for all 88 commands. Common ones:

CategoryCommands
Undo & Review/undo /rollback /diff /review /explain
Session & Cost/status /context /compact /sessions /usage /cost
Model/model /provider /thinking /temperature /fallback
Memory & KB/kb /curate /kb-check /memory /skills /learn
Behaviour/mode /auto /todo /worklog /agents /tools
Work/commit /pr /bg /tasks /gate /open

6 · Keyboard Shortcuts

  • Shift+Tab — Toggle auto-approve mode
  • Esc — Interrupt running tool or agent response
  • Alt+V — Paste screenshot into chat
  • / — Open slash-command autocomplete

7 · Modes

Switch modes with /mode <name> to apply tool guardrails:

  • code — Full read, write, edit, and command execution (default)
  • architect — High-level design & planning
  • ask — Read-only Q&A, no editing or commands
  • debug — Triage & systematic failure analysis
  • driven — Requirements-first mode
  • pilot / orchestrator — Autonomous subagent delegation

8 · Configuration & Precedence

Configure via .env in your project or global ~/.kbcode/.env:

KBCODE_PROVIDER=anthropic
ANTHROPIC_API_KEY=sk-ant-...
KBCODE_MODEL=claude-sonnet-4-5

Precedence order: Project .kbcode/ → Launch folder → Global ~/.kbcode.

9 · MCP Tool Servers

Connect any stdio MCP server to make its tools built-in commands:

kb mcp-add <name> -- <command> [args...]
kb mcp-remove <name>

10 · Safety & Privacy

  • Checkpoints: Automated git snapshot before every edit. Run /undo to revert instantly.
  • Key Encryption: API keys encrypted with machine-bound Fernet keys.
  • Secret Redaction: Logs and feedback automatically strip API keys and credentials.
  • Untrusted Envelope: External web content wrapped to block prompt injection.

11 · Troubleshooting / FAQ

'kb' is not recognized as an internal or external command?

PATH changes require a new terminal window. Open a fresh terminal and try again. If still stuck, run:

python -m kbcode fixpath

Do I need Python installed?

No. The installer sets up everything kb needs. Python is optional.