Contracts first
Start with operations, events, threads, turns, and items before reading UI code.
Architecture, Patterns, Internals
A source-pinned architecture book that explains Codex as an event-sourced agent runtime with typed contracts, policy-gated tools, replayable state, multiple clients, extensions, cloud workflows, and executable governance.
Start with operations, events, threads, turns, and items before reading UI code.
Follow session state, turn scheduling, provider streaming, and rollout trace as one loop.
Read tools, shell, patches, approvals, hooks, sandboxes, and network policy as one authority stack.
Finish with app-server, SDKs, TUI, extensions, cloud tasks, release, and CI.
The book is designed so readers can understand architecture, data flow, contracts, and trade-offs before opening the pinned source links.
Chapters are organized as a technical book: each layer solves one problem and prepares the next.
All source links point to 569ff6a1c400bd514ff79f5f1050a684dc3afde3, so auditability does not depend on branch state.
Part 1
A complex agent becomes legible when every actor speaks typed runtime language.
Part 2
The runtime is a scheduler for context, streaming, tools, cancellation, and replay.
Part 3
The model can suggest an action. Codex decides whether it becomes an effect.
Part 4
A runtime becomes a platform when many clients share one thread model.
Part 5
Extension points are useful only when every trust boundary is explicit.
Part 6
Durable work needs graph edges, task contracts, and controlled memory.
Part 7
Architecture survives when release and CI enforce it.