kbcode Commands

Every command, with what it does, why you would use it, and how — not just a one-line label. Search matches the explanations too, so “headless” or “rate limit” finds the right command even when its name says neither. Click any name to copy it.

No commands found matching "". Try another keyword.

Session & Chat23 commands

Run the conversation itself — see what you are running, what it costs, and go back when it goes wrong.

/help [command]

Show every command, or the details of one.

WhyYou forgot a flag, or want to know exactly what a command does before running it.

How/help bg

/status

Show provider, model, mode and context size.

WhyThe one-glance answer to 'what am I actually running right now?' — check it before an expensive task.

How/status

/context

Break down where the context tokens went — system prompt, per-role totals, biggest messages.

WhyThe session feels slow or expensive and you want to see WHAT is eating the window before compacting.

How/context

/compact

Summarise the earlier chat to free up context.

WhyYou are near the window limit but want to keep working in the same session. Compacting early is cheaper than letting it fill.

How/compact

/cost

One-line cost summary — model, tokens, dollars.

WhyA quick sanity check mid-task. Use /insights when you want the full breakdown.

How/cost

/usage

Token usage for this session — in, out, estimated cost.

WhyYou want the raw numbers rather than a dollar figure, e.g. to compare two models on the same task.

How/usage

/insights

Tokens and estimated cost for this chat AND every saved session.

WhyMonth-end question: what has kbcode actually cost me across all my projects?

How/insights

/sessions [query]

List past chats for this project, or full-text search them.

WhyYou remember solving this two weeks ago but not where. Search your own history instead of redoing the work.

How/sessions oauth refresh

/resume [id]

Resume a past session (no id = pick from a list).

WhyContinue yesterday's work with all its context instead of re-explaining the task.

How/resume

/export [id]

Export a session as a markdown file.

WhyYou want the transcript in a PR description, a bug report, or your notes.

How/export

/reset

Forget this chat and start a fresh saved session.

WhyThe conversation went down a wrong path and is polluting the context. Memory and kb/ are kept.

How/reset

/retry

Re-send your last message as a fresh turn.

WhyA provider error or an interrupt killed the turn — retry without retyping the whole request.

How/retry

/rerun

Re-run the last shell command — no model turn.

WhyYou just fixed the code and want the test again. Costs nothing because the model is not involved.

How/rerun

/output

Show the last run_command result again without re-running it.

WhyThe output scrolled away and re-running would be slow or destructive.

How/output

/copy [n]

Copy the last reply's code block to the clipboard.

WhyYou want to paste the snippet somewhere else without selecting it with the mouse.

How/copy 2

/view

Open the last reply in your browser.

WhyTerminals draw Telugu, Hindi and Arabic scripts broken. This renders them properly — and you can type a reply there and send it back.

How/view

/worklog

Show this session's work diary — goal, rules, state, doubts, history.

WhyLong session: check the agent still has your goal and standing rules right, before it drifts further.

How/worklog

/todo

Show the agent's current task checklist.

WhyMulti-step job — see what it thinks is done and what is left.

How/todo

/lessons

Show the durable lessons kbcode learned from past mistakes.

WhyYou wonder why the agent avoids a certain move — these are its recorded rules.

How/lessons

/mistakes [clear]

Show (or wipe) the mistake notes the model is currently bound by.

WhyThe agent got corrected earlier; this shows the rules it wrote for itself so it will not repeat it.

How/mistakes

/banner

Reprint the startup banner panel.

WhyThe screen scrolled and you want the project/model header back.

How/banner

/version

Show the kbcode version.

WhyReporting a bug, or checking whether an update actually landed.

How/version

/exit

Quit the chat and return to the terminal.

WhyEnds the session cleanly. It stays saved, so `kb -c` or /resume picks it up later with its context intact.

How/exit

Models & Providers18 commands

kbcode is not tied to one vendor. Switch model or provider mid-session, cap spend, and set a failover.

/model [id]

Switch model (no id lists this provider's models).

WhyDrop to a cheap model for grunt work, or jump to a strong one for a hard problem — mid-session, without losing context.

How/model claude-sonnet-4-5

/provider [name] [model]

Switch provider (no name lists them).

WhyYour Claude quota ran out, or you want to compare the same task on OpenAI. kbcode is not locked to one vendor.

How/provider openai gpt-4o

/models

List the models available from the current provider (picker).

WhyYou are not sure of the exact model id before switching.

How/models

/providers

List every configured provider (picker).

WhySee what you can switch to — and which ones already have a key — before running /provider.

How/providers

/um

Unified model manager — change, update or delete the whole model setup in one menu.

WhyYou want to reorganise providers and keys without remembering four separate commands.

How/um

/api

Manage API keys — view or replace the current key, add rotation reserves, set another provider's key, or delete keys.

WhyYour key rotated, or you want a spare so a rate limit does not stop the session.

How/api

/integration [telegram] [action]

Configure integrations from a dedicated submenu; Telegram supports setup, status, verification, chat-ID lookup, a receive on/off switch, the message trigger, five execution modes, removal and help.

WhyYou want to connect Telegram without putting a BotFather token into a model prompt or chat history — and optionally let one verified chat start a turn in the running session.

How/integration telegram trigger

/telegram [status|restart|pair|unpair|outbox]

Show the Telegram listener — receive on/off, trigger state, chat, mode, live polling stats, checkpoints, drop counters and the last error — restart the poller, mint or revoke a pairing code, or list and retry failed deliveries.

WhyMessages stopped arriving and you want to see whether receiving is off, the poller died, or Telegram returned an error — then bring it back without restarting kbcode. Pairing a new chat and rescuing a reply Telegram refused live here too.

How/telegram status

/fallback [vision] <provider> [model]

Set a failover or image-fallback model; bare /fallback opens a menu, 'off' clears it.

WhyYour main provider errors out mid-task — the fallback finishes the turn instead of dropping it. Also gives vision to a model that has none.

How/fallback openai gpt-4o

/thinking <level>

Set reasoning effort: off, minimal, low, medium, normal, high, max, xhigh.

WhyHard architectural problem → raise it. Routine edits → lower it and stop paying for thinking tokens.

How/thinking high

/temperature <val>|none

Set sampling temperature, or 'none' for the model default.

WhyLower for deterministic refactors, higher when you want more varied ideas in a brainstorm.

How/temperature 0.2

/llm_max_output_tokens <n>|auto

Cap output tokens, or follow the model automatically.

WhyA model that rambles costs money; a cap that is too low truncates a big file write.

How/llm_max_output_tokens auto

/llm_rpm [n|off]

Limit LLM requests per rolling minute.

WhyYour provider tier rate-limits you — throttle locally instead of collecting 429s.

How/llm_rpm 20

/llm_mtpm [n|off]

Limit estimated LLM tokens per rolling minute.

WhySame idea as /llm_rpm, for providers that meter tokens per minute rather than requests.

How/llm_mtpm 100000

/repetition [freq|pres|rep <val>|off]

Manage anti-repetition penalties (OpenAI-compatible providers only).

WhyA weaker model keeps repeating the same paragraph or loops on a phrase.

How/repetition rep 1.1

/llm

LLM Test Center — test, allow, block or remove models, with custom prompts.

WhyBefore trusting a new model with real work, prove it can actually follow tool calls.

How/llm

/ping

Quick connectivity and auth check for the current provider.

WhySomething failed — is it your key, your network, or the model?

How/ping

/benchmark [args]

Run the model benchmark suite (makes real API calls).

WhyHead-to-head comparison before you commit to a model for a project.

How/benchmark

Knowledge & Memory14 commands

The reason session two is cheaper than session one: project notes, durable memory, and skills you teach once.

/init

Scan the project's code and build (or refresh) the kb/ knowledge base.

WhyThe single most valuable command in kbcode. Without kb/ notes the agent re-reads your repo every session and you pay for it. Run once per project.

How/init

/kb

List knowledge-base notes.

WhySee what the agent already knows about this project before asking it to re-explain something.

How/kb

/curate

Review the knowledge base — stale notes, oversized notes, broken pointers, stats.

WhyHousekeeping after a big refactor, so the notes do not quietly drift from the code.

How/curate

/kb-check [--fix]

Check (or auto-fix) kb/ pointers.

WhyYou moved code around and want to know which notes now point at the wrong place.

How/kb-check --fix

/kb-refresh

Batch-scan and auto-fix stale kb/ pointers.

WhyBulk version of /kb-check for after a large rename or move.

How/kb-refresh

/kb-undo <note>

Restore a kb/ note from its last pre-overwrite backup.

WhyThe agent rewrote a note and lost something you wanted. Backups live in kb/.history.

How/kb-undo architecture

/memory

Show recent long-term memory.

WhyCheck which facts and decisions the agent is carrying between sessions — including any that are now wrong.

How/memory

/memory-prune [days]

Remove duplicate and near-duplicate memories, and anything older than [days].

WhyMemory has accumulated noise and you want the signal back.

How/memory-prune 90

/learn [topic]

Save what you just did as a reusable skill.

WhyYou solved something fiddly — teach it once and re-run it later in ANY session with /<name>.

How/learn deploy-staging

/skills

List saved skills.

WhySee what you have taught it; project skills and global skills both show up.

How/skills

/skill [action] [name]

Manage skills — run, view, improve, delete, undo.

WhyA skill needs a tweak, or you deleted one by mistake (undo restores the last version).

How/skill improve deploy-staging

/explain <file> [func]

Explain what a file or function does.

WhyUnfamiliar code, and you want the explanation without opening five files yourself.

How/explain kbcode/agent.py run

/search <pattern>

Regex-search the project — instant, no model cost (alias: /grep).

WhyYou know the string you are looking for. This costs nothing because the model is not involved.

How/search TODO --path kbcode

/deadcode [dir]

Sweep for symbols defined but referenced nowhere.

WhyCleanup pass before a release — a heuristic candidate list, not a verdict.

How/deadcode kbcode

Work & Git16 commands

Turning changes into commits, PRs and reviewed branches — with an undo for every edit.

/commit [message]

Stage everything and commit; bare /commit drafts the message from the diff.

WhyYou finished a change and want a real commit message without writing it yourself. --amend folds into the previous commit, --push pushes after.

How/commit --push

/pr [title]

Push the branch and open a GitHub PR via gh; bare /pr drafts title and body.

WhyThe branch is ready. /pr comments pulls review feedback back in so the agent can address it.

How/pr

/wip

Show git work-in-progress — staged, unstaged and untracked counts.

WhyA one-line answer to 'what have I got going on here?' before switching branches.

How/wip

/diff [n]

Show what the AI changed since a checkpoint.

WhyAlways look before you accept. No n = the newest checkpoint.

How/diff

/undo [file]

Revert the last turn's edits in one step, or just one file.

WhyThe edit was wrong. Every edit is checkpointed first, so this always works.

How/undo src/app.py

/rollback

Undo AI edits by picking a checkpoint from a menu.

WhyYou want to go back further than the last turn.

How/rollback

/review [<file>|<range>]

Structured code review — bare reviews uncommitted changes.

WhySelf-review before you ask a human. Also takes a file or a commit range.

How/review @HEAD~3..HEAD

/code-review [file]

Security and correctness review of ONE file.

WhyDeep pass on the file that matters — auth, payments, parsing — rather than a broad skim.

How/code-review kbcode/auth.py

/refactor <what>

Guided multi-file refactor: blast-radius scan, plan, atomic edits, targeted tests, diff summary.

WhyA rename or API change that touches many callers, done in the safe order instead of ad hoc.

How/refactor rename Session to ChatSession

/bg <task>

Run a whole agent task in the background, in its own git worktree.

WhyLong or risky work that would block your session — the result arrives as a reviewable branch, your working tree untouched.

How/bg upgrade the test suite to pytest 9

/every <interval> <task>

Run a background task on a schedule while a session is live.

WhyRecurring chores — dependency checks, doc regeneration — without a cron job.

How/every 2h 'check for dependency updates'

/tasks

List background agent tasks and their status.

WhySee what is still running and what finished.

How/tasks

/task <id> [merge|discard|log|diff]

Review a background task — see its diff, then merge or discard.

WhyBackground work never lands silently; you decide after reading the diff.

How/task 3 diff

/gate

Run the release gate — pytest, ruff --fix, git-status guard, compileall.

WhyThe one command to run BEFORE tagging a release, not after.

How/gate

/open <folder>

Switch to working on another project folder (alias: /cd).

WhyMove to a different repo without quitting and losing your setup.

How/open C:\dev\other-project

/quality [mode]

Show or switch the quality mode (enterprise / fast product).

WhyFast product skips the strict production prompts for fast iteration; enterprise is the full bar.

How/quality

Tools, Modes & Debug26 commands

Control what the agent is allowed to do, and diagnose it when something is off.

/mode [name]

Switch mode: code, architect, ask, debug, driven, pilot, orchestrator.

WhyThe biggest single lever in kbcode. A mode decides which TOOLS the model gets — /mode ask literally cannot edit your files.

How/mode ask

/auto

Toggle auto mode — the agent works without permission prompts (alias: /auto-approve, also Shift+Tab).

WhyYou trust the task and do not want to approve every step. Remember it is full shell approval inside the workspace.

How/auto

/tools

List every tool available in the current mode.

WhySee exactly what the model can and cannot do right now — the honest answer to 'can it touch my files?'

How/tools

/agents

List available subagents (.kbcode/agents/).

WhySee which specialists exist before delegating an isolated job to one.

How/agents

/modes

List every mode with the tools it grants (picker).

WhyDecide which mode fits before switching — it shows what each one can and cannot touch.

How/modes

/subagents

Show subagent activity and configuration.

WhyA delegated job is running and you want to know what it is doing.

How/subagents

/decision-review [on|off|selective]

Turn the decision reviewer on or off — it vets risky tool calls before they run.

WhyA second pair of eyes on big or destructive actions. 'selective' reviews only the risky ones.

How/decision-review selective

/decisions

Show decision-reviewer accuracy — verdict stats, per-tool breakdown, recurring patterns.

WhyFind out whether the reviewer is actually catching things or just adding latency.

How/decisions

/hooks

Show the PreToolUse/PostToolUse/Stop hooks configured for this project.

WhyHooks can BLOCK tool calls, so you need to see what is armed (and that it is not silently broken) before trusting the run.

How/hooks

/debug [on|off]

Debug mode — kbcode records its own errors and usage, runs self-tests in the background, and fixes or reports them. /debug fix starts the self-repair turn; the hidden alias /debugfix does the same.

WhySomething in kbcode itself misbehaves and you want it diagnosed rather than guessed at.

How/debug fix

/doctor

Full health check — PATH, install, KB, provider, self-tests.

WhyFirst thing to run when anything is off. It tells you which link in the chain is broken.

How/doctor

/runtime-check

Verify this install actually works — config, model call, tool dispatch, session save/load.

WhyProves the INSTALLED build works end to end, not just that files exist.

How/runtime-check

/config [knob] [value]

Show or live-toggle advanced knobs (strict_tools, subagent_verbose, image_input_mode).

WhyTune behaviour without editing settings.json by hand; changes persist.

How/config strict_tools on

/settings [knob] [value]

Show or change everyday settings — compact trigger, resume budget, notebook location.

WhyThe knobs most people actually want; /config has the full list.

How/settings

/env

List the KBCODE_* environment variables that are set, with secret values masked.

WhyAn env var silently overrides settings.json at startup — this shows which ones are in play.

How/env

/mcp [reload]

List connected MCP servers and their tools; reload re-reads settings.json and reconnects.

WhyYou added an MCP server and want its tools available without restarting.

How/mcp reload

/plugins

List loaded plugin tools (.kbcode/tools/*.py) and any load failures.

WhyYour custom tool is not showing up — this says whether it failed to load and why.

How/plugins

/port [list]

Show the one bridge port every Chrome profile uses.

WhyBrowser automation diagnostics — every profile multiplexes over a single port.

How/port

/browser-test

Browser health check — bridge, extension connection and setup, green/red per check.

WhyA browser_* tool just failed and you want to know which link is broken before retrying.

How/browser-test

/session <save|restore|list|delete>

Browser session snapshots — save or restore the connected Chrome profile's tabs and cookies (encrypted, local only).

WhyFreeze a working browser state before a risky automation run. Note: /sessions (plural) is chat history, this is browser state.

How/session save before-checkout

/json <question>

One-shot structured answer — a single tool-less call whose output is valid JSON.

WhyYou are piping kbcode's answer into another program and need it parseable.

How/json list the top 3 slowest tests

/feedback <message>

Send the kbcode team a message, scrubbed of secrets and paths.

WhyReport a bug or ask for a feature. on/off toggles automatic debug-mode reports.

How/feedback the /diff output truncates long files

/login

Sign in with Google to activate kbcode.

WhySame as `kb login`, without leaving the chat.

How/login

/logout

Sign out and forget the stored sign-in.

WhyShared machine, or switching to a different approved account.

How/logout

/smoke

Run the curated smoke-tier tests (tests/smoke/) — middle ground between a focused test and the full suite.

WhyYou want a fast health check across key paths before committing, without burning 10+ minutes on the full pytest run.

How/smoke

/dev-audit [dir]

Scan code touched in the last 30 days for symbols with zero references (dead code, unwired helpers).

WhyYou shipped a feature and want to know what landed but is never called — the kind of code that rots and confuses the next reader.

How/dev-audit kbcode

Media & Input5 commands

Give it more than text — screenshots, video, transcripts.

/capsule

Capsule menu — back up and restore your kbcode knowledge and memory.

WhyMoving to a new machine, or protecting the notes and memory a project has accumulated.

How/capsule

/capsule-backup

Back up the capsule now (alias pair: /capsule-restore puts it back).

WhyOne-shot backup before a risky change, without going through the menu.

How/capsule-backup

/image [path]

Attach an image — clipboard or a file — to your next message (alias: /img, also Alt+V).

WhyPaste a screenshot of an error, a design, or a broken UI instead of describing it in words.

How/image screenshot.png

/video <path> [question]

Describe a local video via an auxiliary vision model.

WhyA screen recording of a bug shows what a paragraph cannot.

How/video repro.mp4 what fails at the end?

/transcribe <url> [language]

Fetch a YouTube video's transcript — no API key needed.

WhyPull the content of a talk or tutorial into the chat as text instead of watching it.

How/transcribe https://youtu.be/xyz en

Terminal Commands17 commands

Everything you type before the chat starts, plus the headless one-shot forms.

kb

Start chatting about the current folder.

WhyThe normal way in. Reads AGENT.md and kb/ so it already knows the project.

Howkb

kb "task"

Run one task, print the answer, exit.

WhyScripts and quick questions. Exit code says what happened: 0 done, 1 incomplete, 2 usage error, 130 interrupted.

Howkb "what changed in the last commit?"

kb -y "task"

Same, but auto-approve every edit and command.

WhyRequired for CI and any headless run — without it the permission prompt has nobody to answer it and every tool call is denied.

Howkb -y "fix the failing tests"

kb -c

Reopen the last chat for this folder.

WhyContinue where you left off with the context intact.

Howkb -c

kb --resume [id]

Pick an older chat from a list and reopen it.

WhyGo back to a specific past session rather than the most recent one.

Howkb --resume

kb --json "question"

One machine-readable JSON answer.

WhyFeeding kbcode's output into another tool or a pipeline step.

Howkb --json "list the failing tests"

kb -C "path" "task"

Work on another project without cd.

WhyDrive a second repo from where you already are, e.g. from a script.

Howkb -C "C:\dev\api" "run the tests"

kb init [path]

Set a folder up — AGENT.md + kb/.

WhyOne-time per project. Do this before the first real task.

Howkb init

kb model

Provider, key and model wizard.

WhyFirst-run setup, or whenever you change provider. Saves globally so every project inherits it.

Howkb model

kb login

Google sign-in (also logout, whoami).

WhyAccess is owner-approved per account; whoami tells you where you stand.

Howkb login

kb doctor

Health check — PATH, install, config, provider.

WhyAnything broken, start here. It names the failing link instead of a generic error.

Howkb doctor

kb extension

Install the Chrome extension (also doctor, fix).

WhyOne-time setup for browser automation. `kb extension doctor` reports per profile whether Chrome loaded it and the bridge is live.

Howkb extension doctor

kb update

Download and swap in the newest kb.exe.

WhySignature- and SHA-verified. --version and doctor deliberately do NOT auto-update, so run this explicitly.

Howkb update

kb mcp-add

Add or remove MCP tool servers (also mcp-remove).

WhyBring an external MCP server's tools in as ordinary kbcode tools.

Howkb mcp-add filesystem -- npx -y @modelcontextprotocol/server-filesystem .

kb uninstall

Remove kbcode and its data.

WhyClean removal, including the machine-bound key store.

Howkb uninstall

python -m kbcode fixpath

Repair "'kb' is not recognized".

WhyPATH did not take. This fixes the user PATH entry without admin rights.

Howpython -m kbcode fixpath

git diff | kb "review"

Pipe anything in as context.

Whystdin becomes context (capped, secrets redacted) — review a diff, a log, or a failing test dump.

Howgit diff origin/main... | kb "review this"

Copied to clipboard!