Coder: Coding Agents From Scratch

Building OpenAgents' coding agent in Coax, and learning from every coding agent we can read.

Coder takes one repository task from start to finish: it reads the code, runs commands, edits, tests and opens the pull request. It is one kind of Worker inside OpenAgents, the general agent that people reach from the web, the terminal, the desktop and mobile apps (Episode 289). OpenAgents speaks as "we", owns identity, the wallet, the knowledge base, plugins and routing, and writes every reply in shared channels. Coder speaks as "I" and is opinionated about code. The plan sets out the split.

The book builds the harness one measured piece at a time: a simple loop, a log that rebuilds every request, typed tools, a sandbox, condensing, programs as tool calls (Part I). It then adds engines: Coder's own pure-Coax runtime (openagents/core/ + oa-worker, superseding Inky and the deprecated Microcoder loop), local and hybrid models that Psionic serves, and the Claude Code, Codex, Cursor, or Antigravity CLIs a person already uses (Part II & Part VIII). Parts III and IV turn one session into one agent across many tasks and channels that stays online, following the DeepSeek Harness team's Super-agent design. Part V builds measurement machinery, a live repository pilot, gBench, Terminal-Bench 4.1, and ATIF-v1.8 session-history evals; comparative ablations of many additions remain. Part VI collects the implemented paths into the openagents coder command line. Part VII reads other coding agents' source, one agent per chapter, and records what Coder takes from each. Part IX documents the unified native GPU desktop app (apps/openagents-desktop/), its JSON-lines worker wire, and the Foreman.

The chapters target openagents coder verbs as their product interface. The plan lists those targets; chapter status and the coverage matrix distinguish experimental components from live verbs.

Start with guarantees and authorization for the distinction between bounded experiments, live Coder behavior and engine-owned state. For a practical path, run the repository journey and coding pilot, then read chapters 1, 2, 9–11, 14 and 23. For the full architecture, follow the numbered chapters and use chapter 21 to distinguish implementation checks from measurements of real coding outcomes.

Start here

  • What you build. A coding agent's harness: the loop, the log, typed tools, a sandbox, engines, many tasks and an agent that stays online.
  • What you need. The Coax book's Parts I–III. Psionic helps for the chapters that serve a model.
  • The core path. Chapters 1, 2, 4 and 5 (the loop, the log, tools and the sandbox), 9–11 (engines), 14 (forks and jobs), 17 (many tasks), 20 (staying online), 21 (measurement) and 23 (the command line).
  • Two books in one. Parts I–VI, VIII and IX build Coder. Part VII is a field guide: it reads other coding agents' source at a pinned revision and records what Coder takes from each. Those chapters describe the other tool as it was at that revision. For a full 25-chapter bottom-up teardown of Claude Code (expanding Chapter 25's concise comparison), read the ninth book, Reverse Engineering Claude Code—including deep dives on its query loop, five-layer compaction pipeline, permission engine, subagents, context forking and worktrees, and 2.1.88-to-2.1.331 epilogue.
  • Where this book sits. Coder is the agent that reads the other books. See the OpenAgents books for the whole library.

Status

Written 2026-11-01; updated 2026-11-27. Of the 43 chapters, 11 are implemented, 20 are partly implemented, 12 are written surveys, and 0 are design drafts. Coder now maintains its own runnable example suite in coder/examples/ (coder/book/examples.json) exercising the live product runtime (openagents/core/, coder/tui/, coax/lib/agent/, coax/lib/nostr/atif/, and coax/lib/gbench/), paired with the native Linux coder-owned-v1 journaled worker profile. The registry names each chapter’s sources, qualified targets, and production adopters.

StatusMeaning
implementedThe chapter's examples run and its done criteria pass on a named host.
partly implementedSome examples run; the chapter says what remains.
writtenA survey chapter: its claims cite files in another project at a pinned revision.
design draftThe chapter says what will be built and how it will be checked. Code it names may already exist.
plannedA title and a scope only.

Chapters

ChapterStatus
1. The simplest loopImplemented: openagents-query-loop-v1, bounded CPU; coder-owned-v1, native Linux x86_64
2. Model-visible means loggedImplemented: openagents-transcript-ajr1-v1, bounded CPU; coder-owned-v1, native Linux x86_64
3. Keep the prefix stablePartly implemented: openagents-prompt-cache-v1, bounded CPU
4. Tools as typed capabilitiesImplemented: openagents-tool-capabilities-v1, bounded CPU; coder-owned-v1, native Linux x86_64
5. A sandbox and approvalsImplemented: openagents-sandbox-approvals-v1, bounded CPU; coder-owned-v1, native Linux x86_64
6. A document tries to become the system promptPartly implemented: openagents-trust-boundaries-v1, bounded CPU
7. Condense the historyPartly implemented: openagents-compaction-v1, bounded CPU
8. Programs as tool callsPartly implemented: openagents-tool-orchestration-v1, bounded CPU
9. MicrocoderImplemented: deprecated mcworker (Vertex, Gemini API, OpenRouter; recorded streams replay); superseded by coax/lib/inky/ and unified openagents/core/ (oa-worker)
10. Drive Claude CodeImplemented: Claude Code 2.1.316 on the person's login; approvals by policy; Coder's tools in-process
11. Drive CodexPartly implemented: codex-cli 0.163.0 app-server
12. A Psionic-served model as an enginePartly implemented: psionic-inkling-serve local Metal 4 / CUDA serving (32K KV, 21-quant/LoRA, hybrid-exec-v1, $0 local tier) plus --engine psionic
13. Choose an enginePartly implemented: openagents.router.v2alpha1 RoutePlan + coax/lib/agent/router/ (66/66 dev, 30/31 held-out) with opt-in external delegation gating
14. Forks, subagents and jobsPartly implemented: forks, jobs with deadlines and reports, CC-parity subagents (oa-subagent.coax, openagents/core/agents.coax, parallel/bg/fork, worktrees), /goal parity, and tasks.coax
15. Plugins with owned lifecyclesImplemented: profiles, capabilities, draining, signed installs, Wasm plugins with admitted imports
16. Speak the protocolsPartly implemented: openagents-protocols-v1 (MCP, SDK NDJSON, ACP), bounded CPU
17. One agent, many tasksPartly implemented: a Router with local, GitHub issue and CI sources, Workers, replies, issue context inline and recall through named sessions
18. Consent before sharingPartly implemented: cs-consent-v1 + consent-gate.coax + openagents/core/members.coax; coder consent gates System One routing and remembered facts
19. Remember a fact, then revise itPartly implemented: openagents-memory-v1 (openagents/core/memory.coax + memory-log.coax); coder remember/revise/forget/recall on disk
20. An agent that stays onlinePartly implemented: a resumable loop, a watchdog with provider rechecks, machine daemons, credential handles, a read ceiling for unnamed authors (checked live against chapter 6's attacks), channel rules and mail replies as Gmail drafts
21. Measure the harnessPartly implemented: openagents-atif-gbench-v1, coder-repository-pilot-v1, gBench, Terminal-Bench 4.1, ATIF-v1.8 session-history friction scorecard, and Gym A/B subagent bench
22. Generate candidates, then check themPartly implemented: openagents-candidate-promotion-v1 (capability-gate.coax + gbench/policy.coax), bounded CPU
23. `openagents coder`Partly implemented: every verb, --on ssh:DEST, coder daemon, offline bench journey; --on cloud not live
24. DeepSeek HarnessWritten: deepseek-ai/deepseek-harness@ce7073d
25. Claude CodeWritten: AtlantisPleb/cc@abcc009
26. CodexWritten: openai/codex@a098129
27. OpenCodeWritten: anomalyco/opencode@ff90ed9
28. GooseWritten: block/goose@0909288
29. AiderWritten: Aider-AI/aider@5dc9490
30. mini-SWE-agentWritten: SWE-agent/mini-swe-agent@04d809c
31. OpenHands Software Agent SDKWritten: OpenHands/software-agent-sdk@9884945
32. Hermes AgentWritten: NousResearch/hermes-agent@4d26e0c
33. ToadWritten: batrachianai/toad@dd4f90e
34. Background AgentsWritten: ColeMurray/background-agents@80426f4
35. Flue and Agent OSWritten: withastro/flue@deee93b, rivet-dev/agent-os@c746292
36. A terminal UIImplemented: three agents inline, themes, job status, macOS terminal
37. A terminal inside the agentPartly implemented: vt-text-v1, bounded CPU
38. Drive CursorPartly implemented: cursor-agent 2026.10.14-941492e ACP
39. Drive AntigravityImplemented: agy ACP + openagents/workers/agyworker.coax with T3 quirk fixes, prompt-cache expiry/idle compaction, and opt-in subagent delegation
40. The desktop appImplemented: unified apps/openagents-desktop/ (OpenAgents.app, --minimal/--full, macOS Metal + Linux/Windows Vulkan, modular page/*.coax)
41. Worker protocol and sub-agentsImplemented: mcworker-wire.coax JSON-lines protocol driving oa-worker, oa-subagent, inky, agyworker, claudeworker, and legacy mcworker
42. Beyond the desktop appPartly implemented: Linux/Windows Vulkan, resident coder-host (oa-worker), Universal Introspection (#14066), Claude delegation (#14104), Full Auto (#14063), capability authoring (#14059), Metaverse/Browser panes (#14040, #14105), and iOS parity (#14068); #14067 borderless control, Android parity, and UI consent/memory open
43. The ForemanPartly implemented: Foreman supervisory chat in apps/openagents-desktop/ (Foreman.swift, Window+Foreman.swift, Window+ForemanAPI.swift), feature-flagged under foreman

Contents

See SUMMARY.md for the chapter list and PLAN.md for what each chapter builds and checks.

The 2026-11-03 review and roadmap assesses the book's guarantees, live integration and measurements, with prioritized proposed work items and acceptance criteria.

The structural follow-up suite adds provider availability checks, observed Codex metadata and interruptions after real effects. It retains the v1 pilot as historical evidence.