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.
| Status | Meaning |
|---|---|
| implemented | The chapter's examples run and its done criteria pass on a named host. |
| partly implemented | Some examples run; the chapter says what remains. |
| written | A survey chapter: its claims cite files in another project at a pinned revision. |
| design draft | The chapter says what will be built and how it will be checked. Code it names may already exist. |
| planned | A title and a scope only. |
Chapters
| Chapter | Status |
|---|---|
| 1. The simplest loop | Implemented: openagents-query-loop-v1, bounded CPU; coder-owned-v1, native Linux x86_64 |
| 2. Model-visible means logged | Implemented: openagents-transcript-ajr1-v1, bounded CPU; coder-owned-v1, native Linux x86_64 |
| 3. Keep the prefix stable | Partly implemented: openagents-prompt-cache-v1, bounded CPU |
| 4. Tools as typed capabilities | Implemented: openagents-tool-capabilities-v1, bounded CPU; coder-owned-v1, native Linux x86_64 |
| 5. A sandbox and approvals | Implemented: openagents-sandbox-approvals-v1, bounded CPU; coder-owned-v1, native Linux x86_64 |
| 6. A document tries to become the system prompt | Partly implemented: openagents-trust-boundaries-v1, bounded CPU |
| 7. Condense the history | Partly implemented: openagents-compaction-v1, bounded CPU |
| 8. Programs as tool calls | Partly implemented: openagents-tool-orchestration-v1, bounded CPU |
| 9. Microcoder | Implemented: deprecated mcworker (Vertex, Gemini API, OpenRouter; recorded streams replay); superseded by coax/lib/inky/ and unified openagents/core/ (oa-worker) |
| 10. Drive Claude Code | Implemented: Claude Code 2.1.316 on the person's login; approvals by policy; Coder's tools in-process |
| 11. Drive Codex | Partly implemented: codex-cli 0.163.0 app-server |
| 12. A Psionic-served model as an engine | Partly 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 engine | Partly 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 jobs | Partly 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 lifecycles | Implemented: profiles, capabilities, draining, signed installs, Wasm plugins with admitted imports |
| 16. Speak the protocols | Partly implemented: openagents-protocols-v1 (MCP, SDK NDJSON, ACP), bounded CPU |
| 17. One agent, many tasks | Partly implemented: a Router with local, GitHub issue and CI sources, Workers, replies, issue context inline and recall through named sessions |
| 18. Consent before sharing | Partly 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 it | Partly implemented: openagents-memory-v1 (openagents/core/memory.coax + memory-log.coax); coder remember/revise/forget/recall on disk |
| 20. An agent that stays online | Partly 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 harness | Partly 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 them | Partly 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 Harness | Written: deepseek-ai/deepseek-harness@ce7073d |
| 25. Claude Code | Written: AtlantisPleb/cc@abcc009 |
| 26. Codex | Written: openai/codex@a098129 |
| 27. OpenCode | Written: anomalyco/opencode@ff90ed9 |
| 28. Goose | Written: block/goose@0909288 |
| 29. Aider | Written: Aider-AI/aider@5dc9490 |
| 30. mini-SWE-agent | Written: SWE-agent/mini-swe-agent@04d809c |
| 31. OpenHands Software Agent SDK | Written: OpenHands/software-agent-sdk@9884945 |
| 32. Hermes Agent | Written: NousResearch/hermes-agent@4d26e0c |
| 33. Toad | Written: batrachianai/toad@dd4f90e |
| 34. Background Agents | Written: ColeMurray/background-agents@80426f4 |
| 35. Flue and Agent OS | Written: withastro/flue@deee93b, rivet-dev/agent-os@c746292 |
| 36. A terminal UI | Implemented: three agents inline, themes, job status, macOS terminal |
| 37. A terminal inside the agent | Partly implemented: vt-text-v1, bounded CPU |
| 38. Drive Cursor | Partly implemented: cursor-agent 2026.10.14-941492e ACP |
| 39. Drive Antigravity | Implemented: agy ACP + openagents/workers/agyworker.coax with T3 quirk fixes, prompt-cache expiry/idle compaction, and opt-in subagent delegation |
| 40. The desktop app | Implemented: unified apps/openagents-desktop/ (OpenAgents.app, --minimal/--full, macOS Metal + Linux/Windows Vulkan, modular page/*.coax) |
| 41. Worker protocol and sub-agents | Implemented: mcworker-wire.coax JSON-lines protocol driving oa-worker, oa-subagent, inky, agyworker, claudeworker, and legacy mcworker |
| 42. Beyond the desktop app | Partly 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 Foreman | Partly 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.