Skip to content

CLI

ka-agent with no subcommand opens the chat (or the first-run setup wizard on a fresh install). Everything else lives below. Every command takes -p/--profile <name> (or $KA_AGENT_PROFILE, or the one ka-agent profile use set); -c/--config <path> points at a specific ka-agent.toml where it applies.

Command What it does
ka-agent setup [section] The first-run wizard. Sections: all | model | telegram | matrix | service | search | briefing | voice | web. --yes takes every default; --no-service skips the service offer; --provider, --model, --key-stdin, --timezone, --workspace, --no-verify script it.
ka-agent chat Local chat surface over the runtime. On a TTY it is an inline client: transcript above, one live area below (activity row, status line, soft-wrapped draft), Markdown-rendered answers, Tab completion for /commands, @paths and the model selectors right after /model (vendors first, then that vendor’s models with the recommended one flagged; Tab again cycles the candidates), Ctrl-R history search, Ctrl-Y yank, Ctrl-G editor, Ctrl-O tool detail, Ctrl-E expand the last finished tool, Ctrl-T streamed thinking, Esc to stop the running turn, Ctrl-L to clear the screen and repaint the live area (visual only: session state untouched), /keys to print the key table, and y/n/s/a answers on approval cards (s allows for the session, a makes a durable rule). NO_COLOR turns the TUI’s own styling plain. Without a TTY (scripts, tests) the plain line reader takes over.
ka-agent dashboard Print and open a one-shot web login URL (10 min TTL); --no-open prints only.
ka-agent status [--json] One-glance report over the admin endpoint: model, spend, queue, next task, pauses, crashes, and a rate-limit throttle while the engine is retrying in-engine (throttled_since_ms in the JSON).
ka-agent run The foreground daemon: runtime, channels, admin endpoint, web UI. Invalid config exits 1.
ka-agent restart Ask a running daemon to exit gracefully; the service brings it back.
ka-agent notify <text> Post a notice to the running agent’s surfaces (a script or editor reaching the operator’s agent; - reads stdin). No model turn.
ka-agent ask <text> A question through the normal message path (queue, budget, approvals all apply). --wait holds until the turn finishes and prints the reply; on a terminal without it the question is submitted and the reply lands in your chat surfaces. When stdout is not a TTY (a pipe, CI), waiting is the default. --background runs it on the background model.
ka-agent hooks list · hooks test <event> Introspect [[hooks]]: every configured hook with its class (engine or agent), or run the matching agent hooks against a synthetic event.
ka-agent logs [-f] [-n <lines>] The daemon’s journal, followable.
ka-agent usage [--days N] [--json] What Ka spent, per day (default 30 days back).
Command What it does
ka-agent model [provider/model] Show the current model and key state, or switch.
ka-agent models [provider] List models per provider, merged with the live models.dev registry (24 h cache; --refresh refetches). --probe [vendor/model] sends one minimal real request: answers, or the gateway’s own error verbatim; without a key the model is not probed.
ka-agent config path | show | get <key> The config’s path, verbatim contents, or one value; an unset key names the default that will apply. config schema [--json | --json-schema] prints the key registry as rows, as JSON, or the editor-facing JSON Schema (the document committed at docs/schema/ka-agent.schema.json).
ka-agent config set <key> <value> · config edit Format-preserving edits: comments and key order survive; safe changes apply live, the rest says ka-agent restart.
ka-agent key set <NAME> Provider key (0600, in the engine’s .env tier: exactly what ka’s own key prompt writes).
ka-agent secret set|list|rm <name> Channel and connector secrets (0600 files under <data>/secrets/).
ka-agent persona [show|edit|reset] The assistant’s persona (<data>/memory/persona.md, compiled into the engine’s IDENTITY.md); an edit applies on the next turn without a restart. reset restores the default body and keeps the name.
Command What it does
ka-agent pair telegram|matrix Issue a one-time pairing code; the sender sends it to the bot. Telegram also prints a one-tap t.me/<bot>?start=<code> link. (pair web is gone: panel accounts come from user invite.)
ka-agent identity link|list|unlink · identity role <channel> <address> <role> · identity pending Manage linked channel identities and the user each binds to (link --role <r> writes the binding to the user that role maps to, default admin; role reassigns, audited); list shows user and role columns; pending shows unknown senders with the exact link command. A role must be defined in the config; a removed role fails the identity closed (read-only, engine-muted).

Account and resource administration (ADR-0004, shipped in v0.14.0):

Command What it does
ka-agent user invite [--role <r>] [--group <g>…] [--days N] Mint an invite code (24 h by default, single use, five attempts); the recipient sets a password at /invite.
ka-agent user list Accounts with role, state, groups and identities.
ka-agent user set <name> [--role <r>] [--quota <usd>] [--groups <g,g>] Change role, daily quota (0 clears it) or group membership.
ka-agent user disable|enable <name> · user reset <name> Offboard and restore: disable clears web sessions, silences identities and pauses crons; reset clears the password and drops sessions.
ka-agent user export|purge <name> Export writes a tar of the account’s data trees under backups/; purge deletes them and requires --yes (it warns when no export exists).
ka-agent kb create <name> [--group <g>…] · kb list Knowledge bases with per-group access; see knowledge.
ka-agent kb add <kb> <file> [--as-path <p>] [--title <t>] · kb rm <kb> <path> · kb delete <kb> Upload (or replace) one .md .txt .csv .json document, remove one, or delete the whole KB.
ka-agent kb grant <kb> --group <g,g> Replace a KB’s access groups.
ka-agent kb source add <kb> notion|dropbox|git <target> [--token <secret>] [--include <g1,g2>] [--every-minutes 15] · kb source list · kb source sync <kb> · kb source rm Sync connectors feeding a KB; the token resolves from the secret store, and sync forces one run now.
ka-agent agent create [name] [--persona …] [--model …] [--skills s,s] [--kbs k,k] [--owner <u>] · agent share <name> --group <g> [--level viewer|editor|owner] · agent unshare|transfer|rm|list Shared agents (hidden from --help, real): persona, skills, knowledge and model shared with a group; run state stays per user (/agent <name>). See sessions.
Command What it does
ka-agent memory show|edit|path [file] Inspect or edit the stable-memory Markdown files. file is one of facts (default), profile, persona, preferences, environment, conventions; an edit recompiles and commits.
ka-agent skills list|enable|disable <name> [--role <r>] Manage the SKILL.md library and its engine provisioning; --role provisions into (or removes from) that role’s engine home instead of the admin’s.
ka-agent mcp list · mcp add <name> [--url …|-- -- cmd…] [--env K=V] [--header K=V] · mcp rm <name> · mcp test [name] External MCP servers; secret:<name> values resolve from the secret store when the agent starts. mcp test proves a server answers (initialize plus tools/list) before you rely on it.
ka-agent grant add|remove|list [scope] Tool-scope grants (e.g. github:issues:read).
ka-agent grant path add <dir> [--access allow|ask|deny] · grant path rm <dir> · grant path list Directory grants, written to [[grants.path]] in the config (format-preserving, applied live); see approvals.
ka-agent grant rule check '<command>' · grant rule list · grant rule rm <id> Durable allow-rules (what /y <id> always persists): check dry-runs one command against the operator’s rules and grants nothing, list shows them all, rm removes one.
ka-agent plugin keygen|pack|install|enable|list|disable|rm Sandboxed plugins: sign, verify, install (never enables), toggle policy.
Command What it does
ka-agent profile create <name> [--from <profile>] [--copy-keys] [--clone-memory] [--mode <m>] [--workspace <dir>] New profile: a one-time copy of another’s config (it never tracks later changes there), minus channels; --mode and --workspace override the copied mode and workspace.
ka-agent profile use <name> Make it the default for commands without -p.
ka-agent profile list [--json] Profiles, the active one marked, running ones flagged.
ka-agent profile show [name] · rename <from> <to> · remove <name> --yes Paths and state; rename moves data, config, units; remove deletes data (never default).
Command What it does
ka-agent cron [list] [--json] Live crons, next fire first.
ka-agent cron add every day at 08:00 … Same grammar as /cron add, from the shell.
ka-agent cron rm|pause|resume|run <id> · cron runs <id> Manage a cron; runs shows its fire history.
ka-agent approvals [list] · approvals y <id> · approvals n <id> Decide pending approvals from the shell (the same router commands the surfaces use).
ka-agent briefing on 07:30 | off | now The daily briefing: calendar, reminders, what waits for you.
Command What it does
ka-agent service install|status|uninstall · service print Background service units (systemd on Linux, launchd on macOS, a Task Scheduler entry on Windows); install is idempotent and upgrade-safe.
ka-agent backup <dir> [--keep N] Consistent snapshot (state via VACUUM INTO, memory git history, notes); rotates to the newest 7, named outputs are never pruned.
ka-agent restore <dir> [--force] Unpack into the data root; refuses a non-empty root or a running daemon.
ka-agent update [check] [version] Self-update: fetch the release, verify the checksum, swap the binary, restart the installed service(s).
ka-agent import hermes|openclaw|claude|codex [--dry-run] Bring memory (as candidates) and skills from another agent.
ka-agent export <dir> Export instance data (state, memory, audit).
ka-agent purge [--confirm] Delete all instance data.
ka-agent doctor [--online] [--fix] [--json] [--bundle <path>] One line per check, each with the fix; exit 1 = fix something. --online verifies the provider key and channel tokens live and probes the configured model with one real request. --fix applies only the safe repairs (data and secrets dirs to 0700, secret files to 0600, one line per change); everything else stays advisory. --bundle <path> writes the JSON support bundle (see ops).
ka-agent completions bash|zsh|fish|elvish|powershell Shell completions (source <(ka-agent completions bash)).

Hidden but real: ka-agent __worker is the supervised engine worker, and ka-agent __mcp is the thin relay the engine spawns to reach the daemon-hosted tools; you never invoke them by hand. ka-agent __guard is the engine’s pre-tool-use hook that keeps the assistant out of ka-agent’s own files.

  1. --config flag, if given;
  2. else $KA_AGENT_CONFIG, if set;
  3. else the active profile’s config: ~/.ka-agent/config.toml by default, ~/.ka-agent/profiles/<name>/config.toml for a named profile ($KA_AGENT_HOME moves the whole tree).

Data root: ~/.ka-agent/profiles/<profile>/ (or $KA_AGENT_DATA_DIR wholesale): state.db, memory/, notes/, secrets/, engine homes, workspace/, backups/, logs/, and users/<name>/ partitions for every non-operator account.

ka-agent run always binds one admin endpoint at the data root: a Unix socket (<data>/admin.sock, mode 0600, SO_PEERCRED uid check) on Linux and macOS, a named pipe on Windows whose DACL restricts it to the creating user, SYSTEM and administrators. The ops, each one line of JSON:

Op What it does
status What ka-agent status shows.
command One router command (/approvals, /status, …) run in the daemon, reply returned; that is what ka-agent approvals and ka-agent cron drive.
reload Re-read the config; safe changes apply live.
notify A notice to the surfaces, no model turn (ka-agent notify).
ask A message through the normal ingest path (ka-agent ask).
attach Attach to the live session: replayed gap plus every envelope, and say lines through the shared router (that is the terminal chat).
tool_list / tool_call The __mcp relay: list the daemon-hosted tools, or run one.

Nothing over the endpoint can change durable policy: grants, pairing, plugin state and web login stay on the local CLI plane by design, and a router command cannot settle an approval the engine no longer holds.