The OpenAgents Book

Building the OpenAgents apps, and the general agent behind them, in Coax on Coax Native, one small step at a time.

Status: 45 chapters partly implemented on CPU (1–15, 17–18, 21–22, 24–26, 28, 32–33, 42–45, 54–55, 58–59, 62, 64–66, 68–72, 74, 76–77); 32 design drafts and 1 planned outline (35). Chapters 1–10, 14, 18, 21–22, 24–25, 42–45, 54–55, 58–59, 62, 64–66, 68–72, 74, and 76–77 each ship a runnable Coax example in `openagents/examples/` with verified debug/release transcripts grounded in `apps/shared/chat/screen.coax`, `apps/shared/app/history/index.coax`, `apps/shared/app/environment/select.coax`, `apps/shared/app/settings/identity.coax`, `coax/lib/agent/environment/phone-agent-policy.coax`, `coax/lib/agent/router/decide.coax`, `coax/lib/agent/journal.coax`, `openagents/knowledge/nipkb.coax`, `openagents/knowledge/embed.coax`, `openagents/core/members.coax`, `coax/lib/agent/engine/availability-policy.coax`, `coax/lib/agent/desktop/capability-author.coax`, `coax/lib/agent/desktop/capability-gate.coax`, `coax/lib/nostr/eval/report.coax`, `psionic/lib/peer/module-registry.coax`, `psionic/lib/peer/release-promote.coax`, `psionic/lib/peer/pay.coax`, `coax/web/api/auth-identity-policy.coax`, `coax/lib/nostr/relay.coax`, `coax/web/api/caller-policy.coax`, `coax/web/api/agent-wire.coax`, `coax/lib/proto/golden-keys.coax`, `coax/lib/gateway/plan.coax`, `psionic/lib/hybrid-exec.coax`, `psionic/lib/pylon/onboard.coax`, `coax/lib/agent/desktop/metaverse-route.coax`, `metaverse-engine/agent/drive.coax`, `metaverse-engine/ai/decide.coax`, `coax/web/release-set-policy.coax`, and `coax/lib/agent/desktop/os-windows.coax`. Chapters 11–13, 15, 17, 26, 28, and 32–33 are additionally backed by shipped, CPU-tested Coax modules across Coax Web / Coax UI (`components/ui/`, `apps/openagents-web/demos/docs-starter/`), the unified 24-layer pure-Coax agent core (`openagents/core/`, `coder/tui/oa-worker.coax`, `coder/tui/oa-subagent.coax`), the typed router (`coax/lib/agent/router/`), the shared knowledge base (`openagents/knowledge/`), the Desktop + Apple Breez Spark wallet and #authority money rules (`pay/`, `apps/openagents-desktop/page/walletpane.coax`), and 3-leg Executor Network author-royalty settlement (`pay/executor-settlement.coax`). Native host accessibility UI tests (macos-arm64, ios-simulator, ios-device), mobile feature parity (#14068), multi-relay NIP-KB sync and neural gateway embeddings, general sandboxed third-party plugin SDKs, and public plugin economy scale (#14060) remain open per CONTRACT.md. Where a piece already runs in the repository, the chapter cites its real paths and separates what runs today from what remains. CONTRACT.md says what moves a chapter forward. The book gives no dates.

OpenAgents builds open agents that people can own, inspect, improve and earn from, on open protocols and Bitcoin. Since November 2023 we have worked on that in public, across 290 episodes. Episode 289 says what the work adds up to: a composable general agent. One agent sits behind every surface. It answers from a shared knowledge base, hands work to Coder and to other engines, grows by plugins that anyone can write, and pays their authors in Bitcoin.

This book builds that, and it builds the app you use it through first. You start with the desktop app (`apps/openagents-desktop`) as the primary host, backed by shared Coax logic in `apps/shared/chat/` that mobile (`apps/openagents-ios`) consumes from the same codebase. Each chapter adds one visible thing to the chat page: a GPU text input, Send and serialized actions, a scrollable markdown transcript, a reply from our service, and the login card when a send needs an account. Chapter 6 runs one acceptance case through every step on the primary desktop host and on mobile. Chapters 7 to 11 add history, the environment and repository chips, settings, full mobile and other native hosts (iOS and Android), and the web. Chapter 12 puts the first agent of our own behind the chat page, and every later chapter adds one capability to an app that already runs.

Both the desktop and mobile apps are compiled Coax linked into native binaries: no JavaScript, no JavaScriptCore, no Wasm, and no over-the-air updates. The shared display-list kit in `components/` draws every component on the GPU (GPU components on native); each host platform supplies only the focused text field's native editor, accessibility, and system sheets. Desktop (macOS and Linux) is the primary host from chapter 1 onward, with mobile (iOS and Android) consuming the same shared screens, state, actions, and service. The web keeps DOM for text surfaces (chapter 11).

Each chapter cites the episodes where an idea was first tried, the old crates that implemented it in the Rust tree that ended at coder-v1.0.0, and the NIPs that carry it. Then it says what we build now, what it builds on, and how a run proves it.

Book-driven development

The book specifies, verifies, and reconciles the product on main:

  • Every capability has a chapter. Planned features start as design drafts naming their schema, refusal cases, and check; when engineering ships a subsystem on main (such as `openagents/core/`, the unified `apps/openagents-desktop/` panes, or Coax UI SSR), the corresponding chapter is reconciled to cite the real source paths and list what remains before full qualification.
  • No silent drift between book and code. A chapter never claims a target without recorded evidence (CONTRACT.md), and never cites a deleted path or pretends shipped code does not exist.
  • One small increment per check. Each chapter names a four-part check (CONTRACT.md)—source, trace, refusal, and independent check—so progress from design draft to partly implemented to implemented is audited mechanically.
  • The chapter changes with the code. When building teaches something the draft got wrong, the chapter is corrected alongside the code.

How to read it

  • To build the app, read Parts I and II in order. Chapter 6 is the first milestone: the primary desktop app (and the mobile consumer sharing the same logic) types a message, logs in when the send needs it, receives a reply, and stops a pending one, checked by one end-to-end case.
  • For the argument, read chapters 10, 12, 13, 15, 37, 43, 53, 63 and 78. They give the one app, the loop, the composition, the typed front, execution ownership, the evidence rule, the market, the protocol and what 1.0 means.
  • For the wire, read chapter 4, then chapters 62 to 67 beside the OpenAgents Protocol and `proto/`.
  • For one promise, find it in the plan's coverage table.
  • To edit, start with the open questions.

What you need first: the Coax book's Parts I to III. Other books and specs own the foundations, and this book links to them and does not repeat them:

TopicOwner
The app framework: state, components, hosts, coax driveCoax Native, Coax Web, the components spec, GPU components on native
The coding agent and its harnessCoder: Coding Agents From Scratch
Events, relays and NIPsNostr From Scratch
Keys, signatures, LightningBitcoin From Scratch
Models, decisions, serving, PylonsPsionic: ML From Scratch
The engine and realmsBuilding the OpenAgents Metaverse Engine
A whole game on the engineBuilding Everglade

This book owns what none of them does: the OpenAgents apps as a product, the composition of the agent (a front and its members), the evidence that admits a member, and the economy around it. It uses the framework and writes no second component toolkit.

The parts

Each part ends with something that runs.

PartChaptersWhat runs at the end
I. The chat page, one step at a time1–6The primary desktop app's chat page (with mobile consuming the same shared logic) on the GPU kit: a text input, Send, a transcript, a streamed reply with Stop, and the login card, with one acceptance case passing end to end.
II. What the app adds next7–11History and the sidebar, the environment and repository chips, settings, full mobile and other native host parity (iOS and Android), and the web's DOM presentation.
III. One general agent12–23The loop, members, typed plans, routing, approvals, streaming and the record, with knowledge and memory, answering the chat page.
IV. Capabilities on your devices24–33Coder and other engines, remote work, files, voice, and the wallet with payment review, from one conversation.
V. Continuity across devices34–37State that survives, reconnects, sync, background and resume, and one execution owner per task.
VI. An extensible agent and its economy38–70Plugins, evidence, adoption, the registry, paid calls, receipts, payouts, the protocol, self-hosting and compute.
VII. Worlds and delivery71–78The agent in realms, cross-host conformance, releases from one source, additional platforms and what 1.0 means.

What a chapter contains

Every chapter file has the same sections:

  • Premise. One paragraph: what this chapter adds to what came before.
  • Draft. The prose, for the owner to edit. A planned chapter has an Outline here instead: one line for each point the draft will make.
  • What we build. What the chapter will ship, the code it builds on (real paths, linked) and the paths it plans to add. A chapter that teaches code has The chapter's check: its Coax source, the exact trace a run prints, a case it must refuse, and an independent check. A chapter that sends, signs, stores or publishes a record has an "On the protocol" table: chapter 65 explains its columns.
  • Sources. The episodes behind it, the old crates at coder-v1.0.0, the related OpenAgents NIPs and the promises from the audit that it covers.
  • Open questions for the owner, where there are any.

To read the old code, run git worktree add ../oa-1.0 coder-v1.0.0.

Conventions

  • OpenAgents speaks as "we". Coder and other agents speak as "I".
  • A number from the old tree is given as a number from the old tree. The new one has to earn its own.
  • An episode shows what was said or shown on that day. It does not show that a feature exists now.
  • A planned feature is not a result. A chapter says "runs today" only for code in the repository, and names a target only with recorded evidence (CONTRACT.md).
  • Payments use Bitcoin rails only: Lightning, on-chain Bitcoin, Spark and Taproot Assets.
  • It is "Log in", never "Sign in". We never collect a phone number.
  • A record has one schema, in proto/.
  • Routing is by typed decision or by embedding search, never by keyword matching.

Status

The registry holds each chapter's status, dependencies, implemented source, qualified targets and adoption, in the shared format that python3 psionic/tests/book.py --book openagents checks. provenance.json holds the rest: part, promises, episodes, NIPs, old crates and protocol packages.

StatusMeaning
plannedAn outline. The draft is not written.
design draftThe chapter says what will be built. Owner edits are recorded in the chapter.
partly implementedSome of the chapter's checks run on a named target; the chapter says what remains.
implementedAll of the chapter's checks run on its named targets (CONTRACT.md).

Chapters

I. The chat page, one step at a time

ChapterStatus
1. A text input on the GPUPartly implemented: cpu
2. State and actionsPartly implemented: cpu
3. A transcriptPartly implemented: cpu
4. A reply from the servicePartly implemented: cpu
5. Logging in when a send needs itPartly implemented: cpu
6. One case, every stepPartly implemented: cpu

II. What the app adds next

ChapterStatus
7. History and the sidebarPartly implemented: cpu
8. Environment and repository chipsPartly implemented: cpu
9. SettingsPartly implemented: cpu
10. Mobile and other native hostsPartly implemented: cpu
11. The webPartly implemented: cpu

III. One general agent

ChapterStatus
12. The simplest agentPartly implemented: cpu
13. MembersPartly implemented: cpu
14. A typed planPartly implemented: cpu
15. Decide before you generatePartly implemented: cpu
16. Measure the frontUnimplemented: design draft
17. Grants and approvalsPartly implemented: cpu
18. On the recordPartly implemented: cpu
19. ConversationUnimplemented: design draft
20. Prepared answersUnimplemented: design draft
21. A knowledge basePartly implemented: cpu
22. Retrieval by meaningPartly implemented: cpu
23. Memory and consentUnimplemented: design draft

IV. Capabilities on your devices

ChapterStatus
24. Coder as a memberPartly implemented: cpu
25. Other enginesPartly implemented: cpu
26. Subagents you can seePartly implemented: cpu
27. ProgramsUnimplemented: design draft
28. The command line behind the agentPartly implemented: cpu
29. Where work runsUnimplemented: design draft
30. Files and device servicesUnimplemented: design draft
31. VoiceUnimplemented: design draft
32. A walletPartly implemented: cpu
33. Spending approvalPartly implemented: cpu

V. Continuity across devices

ChapterStatus
34. State that survivesUnimplemented: design draft
35. Sync across devicesPlanned
36. Background, resume and cancelUnimplemented: design draft
37. One owner per taskUnimplemented: design draft

VI. An extensible agent and its economy

ChapterStatus
38. The plugin interfaceUnimplemented: design draft
39. The sandboxUnimplemented: design draft
40. Installing grants nothingUnimplemented: design draft
41. Write a pluginUnimplemented: design draft
42. The authoring interviewPartly implemented: cpu
43. Test-time capabilitiesPartly implemented: cpu
44. Cases and gradersPartly implemented: cpu
45. A two-arm runPartly implemented: cpu
46. A claim's keyUnimplemented: design draft
47. Reproduction by another keyUnimplemented: design draft
48. External validationUnimplemented: design draft
49. Adoption is policyUnimplemented: design draft
50. CreditUnimplemented: design draft
51. RevalidationUnimplemented: design draft
52. The GymUnimplemented: design draft
53. Why an open marketUnimplemented: design draft
54. Releases as signed eventsPartly implemented: cpu
55. Everyone gets itPartly implemented: cpu
56. Paid callsUnimplemented: design draft
57. Metering and receiptsUnimplemented: design draft
58. Payouts to authorsPartly implemented: cpu
59. One identityPartly implemented: cpu
60. Reputation from reproduced claimsUnimplemented: design draft
61. Markets for workUnimplemented: design draft
62. Signed JSON over WebSocketsPartly implemented: cpu
63. Every step is an eventUnimplemented: design draft
64. The OpenAgents APIPartly implemented: cpu
65. One schema, three carriagesPartly implemented: cpu
66. The compliance rulePartly implemented: cpu
67. Host it yourselfUnimplemented: design draft
68. One gatewayPartly implemented: cpu
69. Models we servePartly implemented: cpu
70. PylonsPartly implemented: cpu

VII. Worlds and delivery

ChapterStatus
71. The Metaverse is a surfacePartly implemented: cpu
72. Agents you can meetPartly implemented: cpu
73. Realms and makersUnimplemented: design draft
74. A decision in the worldPartly implemented: cpu
75. Cross-host conformanceUnimplemented: design draft
76. Releases from one sourcePartly implemented: cpu
77. A Windows hostPartly implemented: cpu
78. What 1.0 meansUnimplemented: design draft
<!-- chapters:end -->