kahn scan
Walk a directory, produce a prompt-DAG, write it to .kahn/state/dag.json. Rejects cycles. Rejects multiply-rooted graphs unless --multi-root is given.
OPTIONS
EXIT
- 0
- DAG produced
- 2
- cycle detected
- 3
- unreadable input
- 4
- empty DAG
kahn — prompt-DAG scheduler for ClaudeCode agent fleets
kahn scan [<dir>]
kahn run [--from <node>] [--max-parallel <n>] [--dry-run]
kahn status [--run <id>] [--watch]
kahn scope [--port <n>]
kahn archive [--run <id>] [--gzip]
$ curl kahn.run | sh
Verify first:
curl https://kahn.run/install.sh > /tmp/kahn-install.sh
less /tmp/kahn-install.sh
sh /tmp/kahn-install.sh
Or download a pinned release:
gh release download v0.1.0 --repo kahn-hq/kahn
From zero to first DAG run in under 60 seconds.
Walk a directory, produce a prompt-DAG, write it to .kahn/state/dag.json. Rejects cycles. Rejects multiply-rooted graphs unless --multi-root is given.
Execute a DAG in topological order. Each node's done_when is evaluated. If it fails, Ralph (the retry loop) retries with exponential backoff. If done_when never satisfies within the node budget, fail and continue to dependents.
Query the status of a completed or running DAG execution. With --watch, poll for updates every 100ms until convergence.
Start the read-only observability dashboard. Serves on localhost:7070 by default. Scope reads .kahn/state/ and streams live updates to connected clients. Cannot write to state.
Export a completed run to `.kahn/archive/runs/<id>/`. Archives are append-only: Scope writes logs, DAG, and metadata here as runs complete.
Owned by orchestrator — do not hand-edit. Invariant I-1 enforced: Scope never writes outside .kahn/archive/.
.kahn/state/
dag.json # current DAG
runstate.json # live node statuses
locks/ # per-node atomic lock files
Owned by Scope — read-only at runtime. Append-only writes of completed runs.
.kahn/archive/
runs/<id>/ # one dir per completed run
log.jsonl # transition events
dag.json # DAG snapshot at run time
summary.json # final state summary
| 0 | success, DAG converged |
| 1 | generic failure |
| 2 | scan error: cycle in graph |
| 3 | scan error: unreadable input |
| 4 | scan error: empty DAG |
| 5 | run error: touches-conflict unresolvable within max iterations |
| 6 | run error: worker crashed non-recoverably |
| 7 | run error: done_when never satisfied within node budget |
| 126 | permission denied |
| 127 | command not found |
| 130 | interrupted (SIGINT) |
| version | date | notes |
|---|---|---|
| 0.0.1-dev | TBD | internal, pre-public |
| 0.1.0 | [pending] | first public release |
Written and maintained by Devarno out of London. Typeset in fraunces + source serif 4. kahn(1) is part of the KAHN project; see https://kahn.tools for architecture and build log. Null routes go here. exit 0.