Skip to content

CLI

koda is Koda’s terminal client. Run it in a project and it works there with you: it searches, reads and edits files and — with your approval — runs commands, billed per model turn with the cost on screen. It is a thin client over the same gateway API as the SDK.

Terminal window
npm install -g @koda-rising/cli
koda --version # prints the CLI's version and the gateway it talks to

Requires Node.js 20 or later.

Terminal window
koda login # opens your browser; approve there, and the CLI stores the key it is issued
koda login --device # SSH, containers, remote editors: prints a code to type in a browser instead
koda login --url <gateway> --token <key> # an API key you already have — the only unattended path (CI)
koda whoami # identity, org, role, currency, balance, scopes
koda use <org-id> # switch the active org

login --token checks the key against the gateway before saving it, and refuses one that is not accepted. Your key is stored in ~/.koda/config.json, readable only by you (set KODA_HOME to keep it elsewhere). Revoke it any time with koda keys revoke or from Settings → API keys in the dashboard.

Terminal window
koda # open a session in this directory (same as `koda code`)
koda code --new # start fresh instead of resuming this workspace's last session
koda code --resume <id> # pick up a specific session, with its transcript
koda -p "<prompt>" # one prompt, print the answer, exit — for pipes, scripts and CI

The agent reads and searches without asking. It asks before every write and every command, and before reading a file that looks like it holds secrets (.env, keys, .npmrc, credentials). At each prompt you can allow once, for the session, or always in this project — and “always” names exactly what it allows: pnpm test in this directory, not any command. Commands that can run anything (a shell, node, npx, a path to a script) are never offered “always”. /trust reset clears this project’s grants. --yolo approves everything for one run only.

With nobody to ask (koda -p, a pipe, CI), writes, commands and secrets reads are refused.

Inside a session: /cost, /tools, /history, /verbose, /new, /sessions, /resume <id>, /trust reset, /help, /exit. Ctrl-C stops the turn in progress; only turns that ran are billed.

Search (grep, glob) honours your .gitignore in a git repository, and grep takes literal text — * matches any run of characters and ? one. The agent cannot follow a symbolic link out of the folder you opened.

koda -p with --output-format stream-json is the mode for a container or a CI job with no terminal and nobody to ask. It never prompts, and stdout carries only newline-delimited JSON events — notices go to stderr.

Terminal window
export KODA_API_KEY=koda_sk_… # an API key from Settings → API keys; beats the saved sign-in, writes nothing
export KODA_GATEWAY=https://api.example # optional; KODA_ORG_ID too if the key acts in a particular org
koda -p "fix the failing test" --output-format stream-json --allow writes,commands

What a run may do. With no flag, every write and command is denied (and the model is told so). --allow writes,commands approves those classes of call; --yolo approves everything. Standing “always” grants on disk are not read in this mode, and a secrets-file read is never covered by --allow.

Events. One JSON object per line, each with "v":1 and "t" (milliseconds since start). Ignore types and fields you do not know — they may be added without moving v.

type Fields
start sessionId, workspaceRoot, cliVersion, resumed, policy, credential (env or file), memoryFiles
text text — a fragment of the answer; concatenate in order
retract the text so far was a tool call written as prose; discard it
tool_call id, name, args — a short summary (a path, a pattern, a command’s first line), never a file body
tool_result id, name, status (ok, denied, error, skipped), detail, outputChars — never the output
cost costMinor, balanceMinor, currency, source (turn or compaction) — minor units as billed
error code (usage, auth, balance, turn_ceiling, agents_paused, network, gateway, internal), message, status
stop always the last line: reason, exitCode, gatewayReason, turns, deniedCalls, costMinor, balanceMinor, currency

Exit codes (the same number is in stop.exitCode):

Code stop.reason Meaning
0 done The model finished
1 error Anything else that went wrong
2 error Bad command line; nothing ran
3 denied It finished, but every write or command it needed was refused — the work was not done
4 balance The wallet cannot cover the next turn (402) — top up
5 turn-ceiling The session reached its turn ceiling
6 no-progress The gateway stopped a run that was going nowhere; its work is kept
7 error The key was refused, or there is no credential
8 cancelled SIGINT or SIGTERM
9 error The gateway could not be reached
10 paused The organisation’s agents are paused (409 agents_paused); nothing was billed and work done before the pause is kept. Retrying is pointless until an owner or admin resumes them

Put your project’s conventions in a KODA.md at the repository root (or in any folder; a nested file refines its parent). Every surface sends it with each request — the interactive agent, koda -p, koda run, koda chat and the VS Code extension. It guides the model; it does not change which model is used or what a run costs to route. Your machine-wide conventions can live in ~/.koda/KODA.md. AGENTS.md is read where there is no KODA.md.

Terminal window
koda run "<task>" [--file <path>] [--apply] [--queue] [--detach]
koda run "<task>" --loop [--test "<cmd>"] [--sandbox local|docker] [--max-iters <n>] [--apply]
  • --file sends a file with the task (up to about 25,000 tokens; a missing file is an error, not a silent no-op).
  • --apply writes the returned edits; without it you see a preview.
  • --loop runs plan → edit → verify → retry; --sandbox docker --test "npm test" runs your tests between turns.
  • --detach starts the run on the platform and returns its id; follow it with koda runs watch <id>.
  • Every run prints its cost — unrounded, and saying when your plan’s included usage paid for it. A run that fails says why and exits non-zero.
Terminal window
koda runs [--active] # everything the platform is doing for you: agent loops, chats, research, reviews
koda runs watch <id> # follow one from wherever it got to (survives a dropped connection)
koda runs cancel <id> # stop it before its next billable turn
koda queue # tasks waiting to be sent (written before anything goes out)
koda sync [--detach] # send them — it asks the platform first, so nothing is charged twice
Terminal window
koda chat "<message>" [--new] [--thread <id>] [--tools] [--frontier] [--raw]
koda chat list | koda chat show <id> | koda chat rm <id>

koda chat continues the last chat in this directory; --new starts another. --tools lets the model search the web and use your installed tools; --frontier asks for the frontier lane (billed at that rate); --raw sends the question with nothing of Koda’s around it, project memory included.

Terminal window
koda review [--staged] [--base <ref>] # offline review of your diff — no gateway, no cost
koda research "<question>" [--depth quick|standard|exhaustive] [--out <dir>]
koda research followup <id> ["<question>"] # go further, re-using every source already read and paid for
koda security scan <owner/repo> --i-am-authorized [--depth …] [--out <dir>]
Terminal window
koda tools # what the model can call
koda tools run "<task>" # autonomous tool use, billed per model turn
koda skills search <query> | koda skills install <slug> | koda skills installed
Terminal window
koda repo index <file...> [--detach] # index files so the agent retrieves them (vector mode)
koda repo status
koda repo clear [path]
Terminal window
koda wallet # balance
koda topup <amount> [--channel card|ussd|opay|palmpay|mpesa|mtn_momo|ozow|fawry] [--phone <number>]
koda verify <reference> # credited, already credited by the payment provider, or not yet — with the balance
koda usage # your spend: totals, per model, recent days
koda ledger # the org's credits and debits (owner/admin)
koda plan [--all] # subscription, included usage left, wallet
Terminal window
koda keys create [name] [--scopes a,b] | koda keys list | koda keys revoke <id>
koda projects | koda projects create "<name>"
koda team create <name> | koda team invite <org-id> <email> [--role admin|member] | koda team members <org-id>

Help and the common messages are available in English, French and Arabic: --lang fr, or set KODA_LANG.

Run koda help for the complete list. For programmatic use, see the SDK guide.