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.
Install
Section titled “Install”npm install -g @koda-rising/clikoda --version # prints the CLI's version and the gateway it talks toRequires Node.js 20 or later.
Sign in
Section titled “Sign in”koda login # opens your browser; approve there, and the CLI stores the key it is issuedkoda login --device # SSH, containers, remote editors: prints a code to type in a browser insteadkoda login --url <gateway> --token <key> # an API key you already have — the only unattended path (CI)koda whoami # identity, org, role, currency, balance, scopeskoda use <org-id> # switch the active orglogin --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.
The interactive agent
Section titled “The interactive agent”koda # open a session in this directory (same as `koda code`)koda code --new # start fresh instead of resuming this workspace's last sessionkoda code --resume <id> # pick up a specific session, with its transcriptkoda -p "<prompt>" # one prompt, print the answer, exit — for pipes, scripts and CIThe 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.
Headless runs — for an orchestrator
Section titled “Headless runs — for an orchestrator”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.
export KODA_API_KEY=koda_sk_… # an API key from Settings → API keys; beats the saved sign-in, writes nothingexport KODA_GATEWAY=https://api.example # optional; KODA_ORG_ID too if the key acts in a particular orgkoda -p "fix the failing test" --output-format stream-json --allow writes,commandsWhat 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 |
Project memory — KODA.md
Section titled “Project memory — KODA.md”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.
One-shot runs
Section titled “One-shot runs”koda run "<task>" [--file <path>] [--apply] [--queue] [--detach]koda run "<task>" --loop [--test "<cmd>"] [--sandbox local|docker] [--max-iters <n>] [--apply]--filesends a file with the task (up to about 25,000 tokens; a missing file is an error, not a silent no-op).--applywrites the returned edits; without it you see a preview.--loopruns plan → edit → verify → retry;--sandbox docker --test "npm test"runs your tests between turns.--detachstarts the run on the platform and returns its id; follow it withkoda 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.
Runs, offline queue and sync
Section titled “Runs, offline queue and sync”koda runs [--active] # everything the platform is doing for you: agent loops, chats, research, reviewskoda runs watch <id> # follow one from wherever it got to (survives a dropped connection)koda runs cancel <id> # stop it before its next billable turnkoda 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 twicekoda 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.
Review, research and security
Section titled “Review, research and security”koda review [--staged] [--base <ref>] # offline review of your diff — no gateway, no costkoda research "<question>" [--depth quick|standard|exhaustive] [--out <dir>]koda research followup <id> ["<question>"] # go further, re-using every source already read and paid forkoda security scan <owner/repo> --i-am-authorized [--depth …] [--out <dir>]Tools and skills
Section titled “Tools and skills”koda tools # what the model can callkoda tools run "<task>" # autonomous tool use, billed per model turnkoda skills search <query> | koda skills install <slug> | koda skills installedYour codebase index
Section titled “Your codebase index”koda repo index <file...> [--detach] # index files so the agent retrieves them (vector mode)koda repo statuskoda repo clear [path]koda wallet # balancekoda 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 balancekoda usage # your spend: totals, per model, recent dayskoda ledger # the org's credits and debits (owner/admin)koda plan [--all] # subscription, included usage left, walletKeys, projects and teams
Section titled “Keys, projects and teams”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>Language
Section titled “Language”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.