Skip to content

ka.toml reference

Configuration is strict TOML: unknown keys are hard errors carrying the TOML position, so typos never silently pass. ka config set <key> <value> / ka config get <key> / ka config path read and write one scalar key (a set refreshes the ka.schema.json sidecar its #:schema header points at, so editors keep autocompleting); ka config schema emits the full JSON schema and ka config print the resolved result.

Lowest to highest; each textual layer overlays the last and set fields win:

built-in defaults
→ ~/.config/ka/ka.toml (user)
→ ~/.config/ka/profiles/<name>.toml (profile, selected with --profile <name>)
→ .ka/ka.toml (project, trust-gated)
→ extra --config files (repeatable, last wins)
→ environment (KA_MODEL, KA_MODE, plus one KA_<KEY> variable per key: __ spells the dot, so KA_TUI__MOUSE sets tui.mouse; unknown KA_* names are ignored)
→ CLI flags

Arrays merge across layers. Where order carries priority ([[rules]], [[model_pins]], [[search]], [fallback] models, project_doc_fallback_filenames), the more specific layer’s entries sort first: a project-layer deny is evaluated before a user-layer allow. The rest ([[hooks]], allow lists, [sandbox] allow_write, [[verify.lints]], [features], [[mcp]] by name) append with dedupe.

Project layers are loaded only after the trust gate accepts the directory (first use prompts; the decision is stored in ~/.local/state/ka/trust.json).

ka serve and ka acp run the same chain minus the CLI-flag layer (no CLI model/mode/feature flags on those surfaces), and only apply the project layer when the directory is already trusted: a server never prompts.

The project layer is anchored at the project root: the nearest .git ancestor of the launch directory (stopping at $HOME and the filesystem root; the launch directory itself if there is none). The whole project-scope .ka/ layer lives there (config, skills, rules, agents, commands, hooks, plus everything ka generates: plans, staged memories, always-allow saves), so sessions started in a subdirectory share one .ka.

Key Type Default Meaning
model selector none Default model (vendor/model@effort)
effort low|medium|high|max none Default reasoning effort
mode ask|accept_edits|allow|readonly|dont_ask allow Permission mode; the pre-v0.5 guarded/free/plan spellings and dont-ask/dontask aliases still parse
service_tier string none Provider service-tier passthrough, sent on all three wires where the provider supports it
max_steps integer 20 Tool-execution steps per prompt before forcing a text reply
cwd path process cwd Working directory override
project_doc_fallback_filenames string list [] Extra instruction-file names (e.g. CLAUDE.md) used where a directory has no AGENTS.md; an AGENTS.override.md replaces a directory’s layer entirely
model = "ollama/qwen3.5:9b"
mode = "accept_edits"
max_steps = 30
Key Meaning
default Selector for the main model
fast Selector for cheap work (subagents, quick lookups)
[roles.extra] Arbitrary named roles: any name is addressable as @name in --model and SetModel (@default/@fast read the built-ins)
[roles]
default = "anthropic/claude-sonnet-5"
fast = "groq/llama-3.3-70b"
[roles.extra]
reviewer = "openai/gpt-5.1@low"

Pin a model to a path glob; the first matching pin wins over the configured model.

[[model_pins]]
path = "docs/**"
model = "openai/gpt-5.1@low"

Routers addressed like ordinary selectors: [virtual_models.<name>] holds a models list and a strategy.

Key Default Meaning
models required Selector list the router draws from
strategy "round_robin" "round_robin" cycles entries; "failover" uses the first until it fails

First match wins, evaluated before mode logic.

Key Required Meaning
tool ✓ Tool the rule applies to (bash, write, mcpserver__tool, …), or the special loop domain (below)
pattern none Glob on the call’s primary argument; omitted = every call
verdict ✓ allow | ask | deny

A rule with tool = "loop" governs what happens when a call repeats with identical arguments: allow never trips, ask asks at the third repeat, deny denies at three. Without a loop rule, the shipped behavior stands: identical calls auto-error at four.

[[rules]]
tool = "bash"
pattern = "cargo *"
verdict = "allow"
Key Meaning
allow Tool names auto-allowed without asking for the session; “always” answers append here (project layer)
profile Activate a named [permissions.profiles.<name>] bundle
profiles.<name> Named rule bundle: a [[rules]]-shaped rules list plus a one-level extends (inherits another profile); profile rules evaluate before [[rules]], more specific first
prompt_policy "ask" (default) poses reviewable asks to the surface; "deny" auto-denies them, the stance for ka serve and CI

ka rules check <command> dry-runs your rules against a command line without running it.

Key Required Meaning
event ✓ pre_tool_use | post_tool_use | stop | session_start | session_end | user_prompt_submit | pre_compact | post_compact | subagent_start | subagent_stop | pre_model_switch | post_model_switch | permission_request | permission_denied
tool none Only this tool; omitted = every tool (tool events only)
command one of Shell command; tool-call JSON on stdin; exit 2 blocks; clean-exit stdout JSON can steer the mode
url one of HTTP endpoint receiving the same JSON envelope (POST)
timeout_secs none Per-hook timeout
async none true = fire-and-forget; ka does not wait for the handler
Key Meaning
name Server name; tools appear as <name>__<tool>
command + args + env stdio server to spawn
url + headers streamable-HTTP endpoint (SSE fallback)
enabled_tools / disabled_tools Per-server tool filters
approval "ask" (the normal gate, default) | "auto" (skip asks; deny-class verdicts and hardstops still apply) | "writes" (only tools advertised readOnlyHint = false ask)
tool_timeout_secs / output_limit Per-server call timeout and output cap
oauth true for OAuth against HTTP servers (dynamic client registration, CIMD, loopback callback, token cache with refresh in the data dir); oauth_client_id / oauth_scopes for pre-registered clients
bearer_token_env / headers_helper Static bearer token env, or a command whose stdout builds the auth headers
Key Default Meaning
spend_usd off Ask before the session’s cost crosses this total
context_pct off Ask when the context meter first crosses this percentage
auto_review false The fast-role model pre-screens permission asks: auto-allows only the unmistakably safe, never denies, always leaves a note. Inert in --safe-mode
auto_review_tier "exec" Which tiers auto_review pre-screens: "exec" or "exec+write" (write-tier asks, auto-allow only, every decision noted)
injection_check false Second opinion on flagged web results: a fast-role classifier on top of the always-on prompt-injection heuristic screening
Key Type Default Meaning
max integer 3 Harness continuation rounds when a turn settles while the model’s todo list still has pending items; 0 disables (see the harness loop)
Key Meaning
models Ordered selector list; on provider/auth failure after retries, the turn re-dispatches on the next entry (≤ 2 hops)

Runtime feature toggles: what the model can use, decided at startup. Same spec grammar as the --disable/--enable flags and /features; changes made mid-session are recorded on the strand and restored on resume. Precedence: flags → resumed strand → [features] → defaults (see feature toggles).

Key Default Meaning
disable [] Specs disabled at startup: agents, skills, mcp, hooks, web, lsp, debug, or one item as mcp:<server>, skill:<name>, tool:<hand>, agent:<name>. Strict: an unknown spec is a hard startup error
allow [] Positive hand allowlist: unlisted hands are hidden from the model and rejected at admit time; disable still wins
Key Default Meaning
identity_file none A file whose free-form text replaces ka’s built-in identity sentence in the system prompt; re-read every turn, capped at 8 KiB (one fallback note per session if it cannot be read). Ignored in safe mode
identity_inline none Replace the identity sentence with this string inline (identity_file still wins); --system-prompt replaces the whole prompt for one run
Key Default Meaning
mode "off" "fs" = bash children write only cwd//tmp/XDG dirs, via bwrap/firejail/landlock/macOS seatbelt, fail-closed (no backend on Windows: "fs" refuses with a platform-named error)
allow_write [] Extra writable directories; a sandbox-expansion “always” grant appends here (project layer)
net_allow_domains [] With entries set, sandboxed bash children run behind a loopback CONNECT proxy: only these domains are reachable (wildcards, deny-first, IP literals explicit; each host resolved once and pinned; private/loopback targets refused unless explicitly allowlisted)
net_deny_domains [] Domains always refused by the network filter

Controls exactly what environment bash children see.

Key Default Meaning
env "all" "all" inherits everything; "core" keeps only PATH, HOME, SHELL, TERM, TMPDIR, USER, LOGNAME, LANG; "none" starts empty
env_keep [] Extra variable names to keep under "core"/"none"
env_set {} Variables forced to given values in every bash child
Key Default Meaning
enable false Append language-server diagnostics to edit/write results (informational, ≤ 20 lines, never tool errors) and register the navigation hands (symbols, definition, references, diagnostics)
write_through false Register the write-tier hands (lsp_rename, lsp_actions, lsp_format); server-proposed edits ride ka’s write path (ledger, snapshots, caps, protected paths)
[lsp.commands] none language → stdio server command, e.g. rust = "rust-analyzer"; only configured languages spawn
Key Default Meaning
enable false Register the debug hand, which drives a DAP adapter: launch/attach, breakpoints, stepping, stack/vars/eval inspection. Inert in --safe-mode
[debug.adapters] none name → stdio launch command, merged over the embedded catalog (gdb, lldb-dap, debugpy, dlv, netcoredbg)
Key Default Meaning
[tools.bash] background_after_ms 30000 Auto-background a still-running bash into a jobs handle; 0 = never
[tools.read] max_image_mb 5 Image cap for read; 0 = unlimited
[tools.web] allow_private_hosts false Let web_fetch reach private/loopback addresses
[tools.mcp] discovery "eager" "eager" connects servers at startup; "lazy" defers to first use (strict enum)

The aider-style auto-lint / auto-test loop: after a turn that edited files, the test command runs once (test, 15-minute cap) and a failure feeds the output back to the model for one automatic fix round. Lint rules run per edited file, first matching glob wins.

Key Default Meaning
test none Test command run in cwd after an editing turn, e.g. cargo test
[[verify.lints]] pattern none Glob on the edited path (or basename)
[[verify.lints]] command ✓ Lint command; {file} substitutes the edited file, e.g. rustfmt --check {file}
Key Default Meaning
header_glyph ◆ The glyph in the TUI header
theme none Theme name; TOML files in .ka/themes/ or ~/.config/ka/themes/ (Nocturne fallback); /theme previews live
title true Set the terminal title dynamically
status_line built-in Segments to show, in order: any of model / mode / session / effort / context / cost / tokens / cache / toggles / update
notify_on built-in Which turn events fire the notify command
notify_unfocused false Suppress notifications while the terminal has focus (terminal focus reporting)
mouse "capture" "native" opts out of mouse capture: plain drag selects/pastes with the terminal’s bindings, the wheel scrolls via alternate-scroll, click affordances fall back to their keys (Ctrl+M toggles at runtime and persists)
bell true Ring the terminal bell when a turn finishes or a permission ask appears
notify none Command run when a turn finishes, JSON {event, stop} on stdin, e.g. notify-send ka "turn done"
herdr false Report the agent’s idle/working/blocked state, its resume command, and exit to the Herdr pane hosting it (requires Herdr’s pane environment, so it is inert outside Herdr)

Action-id → chord remapping for the TUI. An unknown action or a chord already bound elsewhere is a hard config error; /help shows the effective bindings.

[keybindings]
abort = "ctrl-a"
Key Default Meaning
auto_commit false After each completed turn, git add -A the worktree and commit as ka: <first prompt line>
commit_role none A [roles] name that generates the commit subject from the staged diff and the turn (silent fallback to the built-in format on any failure)
trailers [] Extra Key: value trailers appended to ka-generated commit messages
Key Default Meaning
persistence "all" "none" leaves no trace of the session on disk (--ephemeral does the same per run: temp data dir, removed at exit)
max_bytes none Stop persisting the strand past this ceiling
Key Default Meaning
promote true On context overflow, re-dispatch to a bigger-context sibling model
autocompact_pct none Context percentage that triggers a digest (also settable live with `/autocompact N
idle_minutes none With idle_compact_pct, compact a session that has been idle this long once its context crosses the threshold (off by default)
idle_compact_pct none Threshold for idle compaction
recap_minutes none When set, a cheap model writes a one-line session recap after this much idle (surfaced by ka sessions)
prewalk false Brief the model with a ≤5-bullet repo overview before the first turn (also --prewalk)
cache_warming off "idle" warms the prompt cache while the session is idle (turns ≥ $0.05)

Entries are tried in order, first success wins; duckduckgo and searxng need no API key.

Key Required Meaning
provider ✓ tavily | brave | bing | duckduckgo | searxng
api_key_env keyed providers Env var holding the API key
base_url none API base override (tests, proxies)
sites none Per-site scoping entries

The generate_image hand registers only when a provider and its key are set; otherwise it stays hidden.

Key Default Meaning
provider none Image provider id
api_key_env none Env var holding the API key
model none Model override (otherwise the provider default)
Key Default Meaning
team_max 8 Maximum concurrent agent-team members spawned through the team hand; 0 disables teams

Applies to the code hand (embedded QuickJS runtime; opt-in code cargo feature, runtime toggle tool:code).

Key Default Meaning
timeout_ms 10000 Wall-clock limit per script invocation
memory_mb 16 Memory limit for the QuickJS runtime
Key Meaning
repo GitHub owner/name releases are fetched from (default jaltez/ka-harness; set it for self-hosted forks)
check "startup" (default) or "off": the TUI checks availability once per 24 h (cached in ~/.local/state/ka/update/), never installs (ka update stays the only install path), and stays quiet offline; a newer release shows a ⤴ badge in the status bar plus one transcript line
model = "anthropic/claude-sonnet-5@high"
mode = "ask"
max_steps = 30
service_tier = "priority"
[roles]
fast = "groq/llama-3.3-70b"
[[model_pins]]
path = "docs/**"
model = "openai/gpt-5.1@low"
[[rules]]
tool = "bash"
pattern = "cargo *"
verdict = "allow"
[[hooks]]
event = "pre_tool_use"
tool = "bash"
command = "scripts/guard.sh"
[[mcp]]
name = "fs"
command = "npx"
args = ["-y", "@modelcontextprotocol/server-filesystem", "."]
[guards]
spend_usd = 2.0
context_pct = 90
[sandbox]
mode = "fs"
[lsp]
enable = true
write_through = true
[lsp.commands]
rust = "rust-analyzer"
python = "pyright-langserver --stdio"
[debug]
enable = true