You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
description: "Every chidori subcommand — run, serve, resume, verify, trace, chat, branches, packages — and the approval postures that govern them."
4
+
---
5
+
6
+
# CLI reference
7
+
8
+
One binary, no runtime dependencies. This page lists every subcommand with
9
+
its job and the doc that covers it in depth.
10
+
11
+
## Scaffolding and exploring
12
+
13
+
| Command | What it does |
14
+
|---|---|
15
+
|`chidori init [dir] --template docs\|chat\|worker`| Scaffold a starter project (agent + README; the `docs` template bundles a docs corpus to chat with). Omit `--template` to pick interactively. |
16
+
|`chidori demo`| Interactive picker over the runnable examples, including no-key demos. |
17
+
|`chidori check <agent.ts>`| Validate an agent file without running it. |
18
+
|`chidori model-login`| Zero-setup OpenRouter fallback — prompts work without configuring a provider key. |
19
+
20
+
## Running
21
+
22
+
| Command | What it does |
23
+
|---|---|
24
+
|`chidori run <agent.ts> --input key=value`| One-shot run. `--input` takes `key=value` pairs or a JSON object; `--model` sets the run's default model; `--stream` emits NDJSON progress events; `--trace` prints the call log as it grows. |
25
+
|`chidori chat [agent.ts]`| Interactive multi-turn REPL backed by `conversation()`. With no file, chats with the model directly (`--system`, `--model`); with a conversational agent file, chats through it. Each turn is a durable host call; prior turns replay for free, so only the newest message reaches the provider. `--resume <session_id>` reprints the transcript for $0 and continues the same session. |
26
+
|`chidori serve <agent.ts> --port 8080`| HTTP session server: sessions, pause/resume, signals, SSE streaming ([Running Modes](./running-modes.md)). In production, set `CHIDORI_API_KEY` for bearer auth and see the [Deployment](./deployment.md) checklist. |
27
+
|`chidori serve --port 8080`| Fleet-only server (no agent file): hosts detached agents; sessions must name an agent. |
28
+
29
+
## Replay, resume, and testing
30
+
31
+
| Command | What it does |
32
+
|---|---|
33
+
|`chidori resume <agent.ts> <run_id>`| Replay a recorded run byte-for-byte with zero model calls; the run's recorded model applies automatically (`--model` overrides). A crashed run replays to the frontier of its log and continues live. |
34
+
|`chidori resume … --trusted`| Crash recovery of a trusted tool-using run — same posture flags as `run`; continuation journals into the same run dir. |
|`chidori verify <agent.ts> <run_id>`| Checkpoint-as-test: replay with **no provider** and a **deny-all policy**; asserts completion with byte-identical output. Exit 0 = pass. Built for CI. Journaled workspace writes do re-materialize on disk (same bytes, fresh mtime). |
37
+
|`chidori trace <run_id>`| Print a run's call log — every prompt, tool call, and effect, with token counts and cost (including prompt-cache read/write totals). |
38
+
|`chidori stats`| Usage and cost totals, including prompt-cache read/write tokens. |
39
+
|`chidori snapshot <run_id>`| Print `runtime.snapshot.json` metadata (never raw VM snapshot bytes). |
40
+
41
+
Run journals live under `.chidori/runs/<run_id>/` next to the agent file;
42
+
pass `--dir <path>` when tracing from elsewhere.
43
+
44
+
## Branches
45
+
46
+
| Command | What it does |
47
+
|---|---|
48
+
|`chidori branches <run-id>`| List a run's persisted branch stores. |
49
+
|`chidori branch-resume <run-id> <branch-id> --value "…"`| Answer a paused `input()` inside a branch. |
50
+
|`chidori branch-rerun <run-id> <branch-id>`| Re-run a branch's (possibly edited) `source.ts` from its fork-time anchor. |
51
+
52
+
See [Branching Execution](./branching-execution.md).
53
+
54
+
## Packages
55
+
56
+
| Command | What it does |
57
+
|---|---|
58
+
|`chidori add <pkg>`| Add an npm dependency — content-addressed store, SHA-512 verification, JSONL lockfile, no Node. |
59
+
|`chidori install`| Install dependencies from the lockfile. |
60
+
|`chidori remove <pkg>`| Remove a dependency. |
61
+
62
+
See [Package Management](./package-management.md).
63
+
64
+
## Approval postures
65
+
66
+
The posture decides what happens when an agent reaches a *powerful* effect —
67
+
network access, `chidori.tool` calls, workspace mutations. LLM prompts and
68
+
pure compute are never gated.
69
+
70
+
| Context | Default behavior |
71
+
|---|---|
72
+
|`chidori run` (interactive) |**Ask**: y/a/N approval at the terminal per gated effect (`a` allows that target for the rest of the run). |
73
+
|`chidori run` (no terminal: scripts, CI) |**Fail closed** — pass `--trusted` or configure a policy. |
74
+
|`chidori serve`|**Deny by default** (`untrusted` profile) unless `--trusted` or explicit `CHIDORI_POLICY*` configuration; read-only workspace introspection stays allowed. `--untrusted` forces the deny profile over any env configuration. |
75
+
76
+
Full model: [Running Modes](./running-modes.md) and the
0 commit comments