partly implementedProfileevery verb, `--on ssh:DEST`, `coder daemon`, offline bench journey; `--on cloud` not liveQualifiedmacos-arm64

23. openagents coder

Status: partly implemented. openagents coder runs run (with --detach), ls, status, log, stop, fork, route, attach, replay, bench, watch and policy, with --json and the spec's exit codes, and with no verb opens the terminal UI. trigger and router run chapter 17's Router. watch and policy work locally through that Router instead of a server. Each conversation is a session file in ~/.openagents/coder/sessions. coder mcp serves the verbs as MCP tools on stdio, and Claude Code drives Coder through it. --on ssh:DEST runs any verb on another machine, and coder daemon attaches a machine that starts queued jobs within its grant. Still to come: a live --on cloud, which waits on a pool host that can bootstrap current main.

The offline repository journey now checks the CLI through visible failure, edit, fork, input verification, stop, continuation and a reviewed local diff. The delivery sink is local; it does not qualify automatic live branch/PR delivery. See the shared guarantees for what each engine exposes.

Every chapter in this book ends in a verb. This chapter puts them into the coder domain of the openagents binary.

What this chapter covers

  • The verbs:
VerbWhat it does
coder run "TASK" [--engine E] [--on ssh:DEST|cloud] [--cwd DIR]start a task; prints its ID and streams steps unless --detach
coder lstasks with state, engine, Thread and age
coder status IDone task's state, last step and ending
coder log IDthe task's session log as text or --json lines
coder attach IDfollow a running task and send it messages
coder stop IDstop a task and its tools
coder fork ID [--at TURN]start a new task from a turn boundary
coder replay IDrebuild each submitted engine-turn input and compare its recorded digest; no model or tool rerun
coder watch THREADsubscribe Coder to a Thread such as github:owner/repo#123
coder policy list|add|rmthe trigger policies for acting without being asked
coder daemonattach this machine as an execution environment
coder queue "TASK"a job for a machine's daemon; held here while that machine does not answer
coder jobsthe daemon's heartbeat and its jobs
coder bench SUITErun a harness suite and report it
  • One command table drives the parser, help, the MCP tool list and the reference table, like every other domain.
  • Local first: run, ls, status, log, attach, stop, fork and replay work with no server. watch, policy, daemon and --on cloud need the server routes of chapters 17 and 20.
  • The same verbs as MCP tools, so Claude Code or another agent can drive Coder.

What runs

The coder domain is apps/openagents-cli/coder.coax. It finds the checkout (OPENAGENTS_SOURCE, or the one the binary was built in) and replaces itself with coder/tui/coder.sh, which rebuilds coder/tui/coder.coax when it is stale. So the terminal UI gets the terminal, and the verbs print straight to stdout. Coder owns the verbs; the CLI only passes them on.

sh
openagents coder run '$ echo via-cli' --engine echoopenagents coder lsopenagents coder log 20261102-0659
text
› $ echo via-cli
  session 20261102-065910-982
  $ echo via-cli · exit 0
    via-cli
  └ finished · 0.0s · 1 step

20261102-065910-982  echo       finished  0s ago   $ echo via-cli
20261102-065728-986  microcoder finished  1m ago   What is 2+2? Reply with only the number.

Following and replaying a session

coder attach ID prints the session's log as coder log does and keeps following it until the session ends. coder attach ID "MESSAGE" also leaves a message for the job:

  • A running job (coder run --detach) takes it as its next turn when the current turn ends, so the conversation stays on the same engine.
  • If the job has already ended, attach takes the message back and starts a fork that carries the conversation, then follows the fork.

Messages wait in sessions/ID.inbox, one file each. Whoever renames a message first owns it, so a message the job and attach both reach is taken once. Before a job ends, it removes its pid file and then looks for messages once more, so a message sent while it ends is still taken.

coder replay ID rebuilds every request the session sent an engine from the log alone, and compares bytes. Each turn logs a request line with the SHA-256 and length of exactly what the engine was sent. replay rebuilds that text from the user line, and for a fork's first turn, from the parent's log up to the at turn. It then compares digests:

text
turn 1: same bytes (226 bytes, sha256 6307ff109763…)
1 of 1 requests rebuilt with the same bytes.

A changed log fails: editing the fork's user line makes replay report DIFFERENT and exit 1.

Suites

coder bench SUITE runs a suite from the checkout and reports whether it passed and how long it took. Each report is kept in ~/.openagents/coder/bench/SUITE-ID.json:

SuiteWhat it runs
harnessChapter 21's measurement: tasks through the harness with seeds, verdicts and a receipt chain
checkscoax test coder/tui/coder.coax
smokeThe offline smoke: the terminal UI in a pseudo-terminal, then every verb
journeyThe offline repository task: visible failure, edit, fork, replay, stop, continuation and a reviewed local diff
json
{"suite":"checks","passed":true,"ms":5022,"at_us":1793605778040508,"last":"233 checks, 233 passed, 0 failed"}

The Router's verbs

coder trigger, coder router, coder watch and coder policy run the Router of chapters 17 and 20 on this machine:

  • `coder policy add NAME --mode M [--authors A,B] [--engine E] [--label L] [--channel chat|issue|pr|mail|doc] [--deliver] [--text POLICY]` writes a source's policy to router/sources.json; list and rm read and remove them.
  • coder watch THREAD makes every later event on the Thread addressed to the agent. For a GitHub Thread such as github:owner/repo#123 whose repository has no policy yet, it adds one that admits only the account gh is logged in as.

The verbs as MCP tools

coder mcp (mcp.coax) is an MCP server on standard input and output, one JSON-RPC message a line. It answers initialize, ping, tools/list and tools/call, and each tool runs the matching verb as a child process, so the tools and the verbs can't drift apart:

ToolVerb
coder_runcoder run TASK --detach [--engine E] [--cwd DIR]: returns the ID at once
coder_ls, coder_status, coder_log, coder_stop, coder_replaythe verb of the same name
coder_senda message for a session: a running job takes it as its next turn; an ended one continues in a fork
coder_forkcoder fork ID TASK --detach [--at N]
coder_decidecoder decide QUESTION --options A,B [--state S] --json
coder_remembercoder remember KEY TEXT, or coder revise when reason is given (project adds --project; it runs in cwd)
coder_recallcoder recall [QUERY] [--top N] in cwd
coder_session_readcoder session-read list|show|context [REF]: read-only Claude history and inert compaction context; also available directly in new Codex chats

coder_run always runs a background job, so a client's tool-call timeout never cuts a task short; the client follows it with coder_status and coder_log. To give Claude Code these tools:

sh
claude mcp add coder -- "$PWD/coder/tui/coder.sh" mcp

In the live check, claude -p called coder_ls through the server and answered with the number of sessions on the machine.

Running on another machine

--on ssh:DEST or --on cloud sends any verb to another machine. coder/tui/remote.coax runs it there over ssh, as cd "$HOME"/openagents && coder/tui/coder.sh VERB ..., and relays each line of output as it arrives. --remote-repo DIR names a different checkout on that machine. DEST is an ssh host or alias, made only of letters, digits and .-_@:.

  • run writes sessions/ID.remote here, with the route and the destination, so status, log, stop, attach and replay of that ID (or any unique prefix of it) go to the same machine without --on.
  • --on cloud takes a running host from openagents cloud status, or starts one with openagents cloud up --hosts 1, and reaches it through an IAP tunnel with the pool's key. The host deletes itself after its idle minutes.

In the live check, `coder run '$ uname -sm; hostname' --engine echo --on ssh:coderos-4080 answered Linux x86_64 and coderos-4080; a --detach` run there was followed with attach and listed with ls --on. A --on cloud run started a pool host, but the host's bootstrap failed: the installed openagents cloud builds the Rust sources that main has since removed. The smoke checks --on ssh: with a stand-in ssh that runs the line in a second HOME.

coder daemon, coder queue and coder jobs are chapter 20's machine daemons: a job queued --on ssh:DEST while DEST is offline is held here and sent when DEST answers.

The session log

coder/tui/session.coax writes one JSON object a line, appended as things happen:

LineFields
sessionid, version, engine, cwd, started_us
usertext
agentengine, when Shift-Tab switches
toollabel, as the transcript shows it
resulttext (cut to 4,000 bytes, with bytes when cut), error
diffpath, adds, dels: one file an edit changed
replytext: the reply since the last tool call, written before the next one and at the end
requestsha256, bytes: what the turn sent its engine, for replay
routeSystem One's engine decision, when run had no --engine (chapter 13)
hookon, plugin, run, ok, text: a plugin hook that ran (chapter 15)
endending, ms, steps, and text when it failed

An ID is the UTC start time to the millisecond, such as 20261102-065910-982, so the files sort by time and status and log take any unique prefix. /clear in the terminal UI starts a new file.

coder run --json prints exactly these lines and nothing else, so a script reads the run as it happens. Exit codes: 0 finished, 1 failed, 2 usage, 6 no such session, 130 stopped.

Dependencies

  • Every earlier chapter, for the verb it adds.

Done means

  • run, ls, status, log, stop and fork exist with --json and the spec's exit codes, and the offline smoke (`python3 coder/tui/smoke.py) runs them in a fresh HOME. fork and stop` are chapter 14's; route is chapter 13's.
  • attach, replay, bench, watch and policy exist, and the smoke checks each: a message taken by a running job and by a fork of an ended one, a fork's request rebuilt byte for byte and a changed log refused, a suite's report kept, a watched Thread's event starting a Worker, and sources added, listed and removed.
  • The verbs are MCP tools (coder mcp); the smoke starts a run and reads its log through them, and Claude Code called one live.
  • --on ssh:DEST runs a verb on another machine, and later verbs on that session follow it there; checked live on coderos-4080 and by the smoke.
  • --on cloud runs on a pool host, live.
  • coder daemon attaches this machine as an execution environment (chapter 20's machine daemons), with queue and jobs; checked by the smoke.
  • The offline repository journey runs run, log, fork, stop, status and replay on a fixture repository and checks a local reviewed diff. See the journey.
  • Each verb exists in the shared command table with --json and the spec's exit codes; the journey does not establish that catalog work.

Sibling Executor Network CLI domains

Beside openagents coder, the same CLI binary exposes the domains that close the Executor Network flywheel:

Sources

  • The openagents CLI, v1.0.0.
  • apps/openagents-cli/coder.coax, coder/tui/coder.coax (tool_main and the verbs), coder/tui/session.coax, coder/tui/remote.coax.