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#authoritymoney 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-relayNIP-KBsync 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 drafttopartly implementedtoimplementedis 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:
| Topic | Owner |
|---|---|
The app framework: state, components, hosts, coax drive | Coax Native, Coax Web, the components spec, GPU components on native |
| The coding agent and its harness | Coder: Coding Agents From Scratch |
| Events, relays and NIPs | Nostr From Scratch |
| Keys, signatures, Lightning | Bitcoin From Scratch |
| Models, decisions, serving, Pylons | Psionic: ML From Scratch |
| The engine and realms | Building the OpenAgents Metaverse Engine |
| A whole game on the engine | Building 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.
| Part | Chapters | What runs at the end |
|---|---|---|
| I. The chat page, one step at a time | 1–6 | The 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 next | 7–11 | History 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 agent | 12–23 | The loop, members, typed plans, routing, approvals, streaming and the record, with knowledge and memory, answering the chat page. |
| IV. Capabilities on your devices | 24–33 | Coder and other engines, remote work, files, voice, and the wallet with payment review, from one conversation. |
| V. Continuity across devices | 34–37 | State that survives, reconnects, sync, background and resume, and one execution owner per task. |
| VI. An extensible agent and its economy | 38–70 | Plugins, evidence, adoption, the registry, paid calls, receipts, payouts, the protocol, self-hosting and compute. |
| VII. Worlds and delivery | 71–78 | The 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.
| Status | Meaning |
|---|---|
| planned | An outline. The draft is not written. |
| design draft | The chapter says what will be built. Owner edits are recorded in the chapter. |
| partly implemented | Some of the chapter's checks run on a named target; the chapter says what remains. |
| implemented | All of the chapter's checks run on its named targets (CONTRACT.md). |
Chapters
I. The chat page, one step at a time
| Chapter | Status |
|---|---|
| 1. A text input on the GPU | Partly implemented: cpu |
| 2. State and actions | Partly implemented: cpu |
| 3. A transcript | Partly implemented: cpu |
| 4. A reply from the service | Partly implemented: cpu |
| 5. Logging in when a send needs it | Partly implemented: cpu |
| 6. One case, every step | Partly implemented: cpu |
II. What the app adds next
| Chapter | Status |
|---|---|
| 7. History and the sidebar | Partly implemented: cpu |
| 8. Environment and repository chips | Partly implemented: cpu |
| 9. Settings | Partly implemented: cpu |
| 10. Mobile and other native hosts | Partly implemented: cpu |
| 11. The web | Partly implemented: cpu |
III. One general agent
| Chapter | Status |
|---|---|
| 12. The simplest agent | Partly implemented: cpu |
| 13. Members | Partly implemented: cpu |
| 14. A typed plan | Partly implemented: cpu |
| 15. Decide before you generate | Partly implemented: cpu |
| 16. Measure the front | Unimplemented: design draft |
| 17. Grants and approvals | Partly implemented: cpu |
| 18. On the record | Partly implemented: cpu |
| 19. Conversation | Unimplemented: design draft |
| 20. Prepared answers | Unimplemented: design draft |
| 21. A knowledge base | Partly implemented: cpu |
| 22. Retrieval by meaning | Partly implemented: cpu |
| 23. Memory and consent | Unimplemented: design draft |
IV. Capabilities on your devices
| Chapter | Status |
|---|---|
| 24. Coder as a member | Partly implemented: cpu |
| 25. Other engines | Partly implemented: cpu |
| 26. Subagents you can see | Partly implemented: cpu |
| 27. Programs | Unimplemented: design draft |
| 28. The command line behind the agent | Partly implemented: cpu |
| 29. Where work runs | Unimplemented: design draft |
| 30. Files and device services | Unimplemented: design draft |
| 31. Voice | Unimplemented: design draft |
| 32. A wallet | Partly implemented: cpu |
| 33. Spending approval | Partly implemented: cpu |
V. Continuity across devices
| Chapter | Status |
|---|---|
| 34. State that survives | Unimplemented: design draft |
| 35. Sync across devices | Planned |
| 36. Background, resume and cancel | Unimplemented: design draft |
| 37. One owner per task | Unimplemented: design draft |
VI. An extensible agent and its economy
| Chapter | Status |
|---|---|
| 38. The plugin interface | Unimplemented: design draft |
| 39. The sandbox | Unimplemented: design draft |
| 40. Installing grants nothing | Unimplemented: design draft |
| 41. Write a plugin | Unimplemented: design draft |
| 42. The authoring interview | Partly implemented: cpu |
| 43. Test-time capabilities | Partly implemented: cpu |
| 44. Cases and graders | Partly implemented: cpu |
| 45. A two-arm run | Partly implemented: cpu |
| 46. A claim's key | Unimplemented: design draft |
| 47. Reproduction by another key | Unimplemented: design draft |
| 48. External validation | Unimplemented: design draft |
| 49. Adoption is policy | Unimplemented: design draft |
| 50. Credit | Unimplemented: design draft |
| 51. Revalidation | Unimplemented: design draft |
| 52. The Gym | Unimplemented: design draft |
| 53. Why an open market | Unimplemented: design draft |
| 54. Releases as signed events | Partly implemented: cpu |
| 55. Everyone gets it | Partly implemented: cpu |
| 56. Paid calls | Unimplemented: design draft |
| 57. Metering and receipts | Unimplemented: design draft |
| 58. Payouts to authors | Partly implemented: cpu |
| 59. One identity | Partly implemented: cpu |
| 60. Reputation from reproduced claims | Unimplemented: design draft |
| 61. Markets for work | Unimplemented: design draft |
| 62. Signed JSON over WebSockets | Partly implemented: cpu |
| 63. Every step is an event | Unimplemented: design draft |
| 64. The OpenAgents API | Partly implemented: cpu |
| 65. One schema, three carriages | Partly implemented: cpu |
| 66. The compliance rule | Partly implemented: cpu |
| 67. Host it yourself | Unimplemented: design draft |
| 68. One gateway | Partly implemented: cpu |
| 69. Models we serve | Partly implemented: cpu |
| 70. Pylons | Partly implemented: cpu |
VII. Worlds and delivery
| Chapter | Status |
|---|---|
| 71. The Metaverse is a surface | Partly implemented: cpu |
| 72. Agents you can meet | Partly implemented: cpu |
| 73. Realms and makers | Unimplemented: design draft |
| 74. A decision in the world | Partly implemented: cpu |
| 75. Cross-host conformance | Unimplemented: design draft |
| 76. Releases from one source | Partly implemented: cpu |
| 77. A Windows host | Partly implemented: cpu |
| 78. What 1.0 means | Unimplemented: design draft |
| <!-- chapters:end --> |