CLI reference
Running ka with no subcommand starts the TUI. Everything else is a subcommand.
Global options
Section titled “Global options”| Flag | Effect |
|---|---|
-c, --continue |
Continue the newest strand (this terminal’s waypoint preferred) |
--session <ID|name> |
Resume a session by id (prefix ok), memorable name (/name), or strand file path |
--model <SEL> |
Model selector override (vendor/model@effort) |
--mode <MODE> |
Permission mode override (ask | accept_edits | allow | readonly; the pre-v0.5 guarded / free / plan spellings and the needs-approval / full-access aliases still parse) |
--disable <SPECS> |
Disable features at startup (comma-separated or repeatable): agents | skills | mcp | hooks | web | lsp | debug, or one item as mcp:<server>, skill:<name>, tool:<hand>, agent:<name> (see feature toggles) |
--enable <SPECS> |
Re-enable over a [features] disable (same grammar) |
--sandbox <off | fs> |
Sandbox mode override |
-i, --interactive-prompt <PROMPT> |
Run one prompt before the TUI opens, landed in the session; the TUI resumes on that strand (composes with -c / --session; TUI-only) |
--config <PATH> |
Extra strict-TOML config layer (repeatable) |
--dialects <PATH> |
Extra dialect catalog overlay (repeatable) |
--no-discovery |
Skip local-endpoint discovery probes |
--trust |
Trust this directory’s .ka/ka.toml (decision is stored) |
--safe-mode |
Disable all customizations (AGENTS.md, MEMORY.md, skills, agents, commands, hooks, MCP, LSP), keeping built-ins, config, and auth |
--profile <name> |
Add the config profile layer ~/.config/ka/profiles/<name>.toml |
--effort <LEVEL> |
Effort level override |
--image <PATH> |
Stage an image into the opening prompt (repeatable) |
--offline |
Run without network probes |
--system-prompt <TEXT> |
Replace the system prompt for this session |
--tools <LIST> / --exclude-tools <LIST> |
Per-session hand allowlist / denylist |
--add-dir <DIR> |
Add an extra working directory (repeatable) |
--ignore-user-config |
Start without the user config layer |
--ignore-rules |
Run without [[rules]] tables and rule files (hardstops stay) |
--ephemeral |
Use a temp data dir, removed at exit (same as [history] persistence = "none" per run) |
--prewalk |
Walk the project tree before the first turn |
--version |
Version, carries the git hash |
Subcommands
Section titled “Subcommands”Session work
Section titled “Session work”| Command | What it does |
|---|---|
ka |
TUI, fresh session |
ka -c |
TUI, continue this terminal’s latest session |
ka --session <id|name> |
TUI, resume by id prefix or session name |
ka sessions [--json] |
List sessions for this directory (ids, names, titles, cost, tokens) |
ka session rename|delete|archive|unarchive|pin|unpin <ID|name> |
Manage sessions: rename retitles; delete cascades child forks; archive hides a tree (see it with ka sessions --archived); pins show ★ and sort first |
ka rewind [N] |
Drop the last N user turns of the newest strand |
ka export [-o out.md] [--html] [--jsonl] [--session ID] |
Export a strand as readable markdown, a self-contained offline HTML page, or roundtrippable JSONL |
ka undo |
Restore the latest file snapshot of the newest session here |
ka gc [--dry-run] [--max-age-days N] |
Reclaim expired spills, orphaned/aged snapshots, and empty dirs; strands are only reported |
Headless and servers
Section titled “Headless and servers”| Command | What it does |
|---|---|
ka run [PROMPT] |
One headless turn (see headless) |
ka run --rpc |
One headless turn over the RPC event protocol (see headless) |
ka queue <prompt> |
Queue a prompt into a live ka serve session |
ka serve [--addr ADDR] [--token T] [--config PATH] |
HTTP/SSE session server (see serve) |
ka attach [ID] [--addr ADDR] [--token T] |
Observe a live ka serve session read-only over SSE (no write path) |
ka acp [--config PATH] |
Agent Client Protocol over stdio (see ACP) |
Models and providers
Section titled “Models and providers”| Command | What it does |
|---|---|
ka models [<query>] [--no-discovery] |
Catalog + local Ollama/LM Studio probes; a query filters by id substring |
ka models --update |
Refresh the runtime catalog overlay from models.dev |
ka providers |
Provider registry with API-key env status |
Configuration and health
Section titled “Configuration and health”| Command | What it does |
|---|---|
ka init [--no-import] |
Generate a starter AGENTS.md from a quick repo scan, merging cursor/copilot rule files in as marked sections |
ka config schema |
JSON schema for ka.toml layers (editor integration) |
ka config set <key> <value> / ka config get <key> / ka config path |
Write / read a config key, or print the layer path; set refreshes the ka.schema.json sidecar its #:schema header points at |
ka doctor [--net] [--json] |
Environment health checks |
ka update [--channel stable|edge] [--check] |
Check for / install a signed release update |
Extensions
Section titled “Extensions”| Command | What it does |
|---|---|
ka mcp |
Probe configured [[mcp]] servers and list their tools |
ka agents |
List discovered markdown agents (.ka/agents/*.md and friends) |
ka install <skill|agent|command|rule> <git-url | path> [--force] |
Install a customization into the user layer (ka skill install … is the skill alias; no registry, installing is the trust act) |
ka install list [kind] / ka install remove <kind> <name> |
List / remove installed customizations |
ka skill install <git-url | path> |
Install a user skill from a git URL or a local directory (needs a SKILL.md; --force overwrites) |
ka skill list / ka skill remove <name> |
List / remove installed user skills (~/.config/ka/skills) |
ka import claude <settings.json> [--project | --user] [--dry-run] |
Convert Claude Code permission rules into ka [[rules]] (prints the conversion and skips, then strict-validates the write; deny → ask → allow order preserves claude precedence) |
ka import codex|gemini <config> |
Convert permission rules into [[rules]]; untranslatable settings are printed as notes (for cursor, ka points at the right homes since cursor rules are instructions, not permissions) |
ka import-session claude|codex <file> |
Import a foreign session as a ka strand (text, tool calls, and thinking, best effort; the source file is never modified) |
ka sandbox <cmd> |
Run one command under the fs sandbox |
ka mcp-serve |
Run ka itself as a read-only stdio MCP server (read / glob / grep / sessions_search / session_info; bash is deliberately excluded) |
Automation
Section titled “Automation”| Command | What it does |
|---|---|
ka action init [--force] |
Write the vendored GitHub workflow (see automation) |
ka schedule add|list|remove [--install] |
Manage crontab entries for scheduled runs |
ka recipe <name> [--var K=V] [--dry-run] |
Run a .ka/recipes/*.toml recipe as sequential prompts in one session |
ka worktree add|list|remove [--delete-branch] |
Manage git worktrees for isolated agent work |
| Command | What it does |
|---|---|
ka completions <bash|zsh|fish> |
Shell completions, generated from the live CLI parser |
Search (when built with the index feature)
Section titled “Search (when built with the index feature)”| Command | What it does |
|---|---|
ka index |
Rebuild the full-text search index over all strands |
ka search <query> [--session ID] [--limit N] |
FTS5 query across sessions |
ka run specifics
Section titled “ka run specifics”| Flag | Effect |
|---|---|
--print text |
Final answer only (default) |
--print ndjson |
ka’s own event stream, NDJSON |
--print stream-json |
Claude-Code-compatible event shapes |
--schema <PATH> |
JSON schema the reply must satisfy (structured output) |
-c / --session <ID> |
Continue a strand headlessly |
-o FILE |
Write the final answer to a file |
--max-turns N |
Stop after N turns |
--max-budget-usd $ |
Ask to stop past a spend ceiling |
--max-cost $ / --max-time SECS |
Hard cap; exit code 3 when crossed |
--warn-cost |
Print a cost warning on stderr |
With no prompt argument, ka run reads the prompt from stdin. Exit codes: 0 ok, 1 error, 2 aborted, 3 cap crossed, 42 rejected input (e.g. a reply that failed --schema validation).
Environment
Section titled “Environment”| Variable | Effect |
|---|---|
KA_MODEL |
Model selector, overrides config layers |
KA_MODE |
Permission mode, overrides config layers |
KA_SAFEMODE |
Same as --safe-mode |
KA_DATA_DIR |
Relocate the data directory (strands, spills, snapshots) |
KA_<KEY> |
Generic layer: one variable per config key, __ spells the dot (KA_TUI__MOUSE=native sets tui.mouse); unknown KA_* names are ignored |