14 chapters organized into 7 parts (Part 0 through Part VI). Each part asks one question about agent runtime design; its chapters answer by reading v1 and v2 side by side.
1 — The Turn That Couldn't Crash. Follow a turn through v1's monolithic await. Kill the process mid-turn. Nothing survives. But that's not why v1 was archived — the real problem was a codebase mid-migration between two shapes, carrying another system's topology in its bones.
2 — Reading Other People's Runtimes. Before writing v2, reverse-engineer Claude Code and Codex. Decompose each into 9 dimensions. Ask: what would break if we needed to replicate this by composition? The answer — nothing needs re-shaping — is the signal to start.
3 — Contracts. Read v1's 10 seam types and v2's 5 side by side. The interesting question isn't what changed — it's what survived unchanged and why. The survivor set is the primitive.
4 — The Single Construction Seam. v1's composition root carried an event bus, a people directory, a chat-adapter registry. v2's SessionFactory is the single seam: every session origin — root, child, dispatch — flows through one function.
5 — The Turn. Both versions run the same inner loop: drive pi to idle, then decide about compaction. What changed is the envelope — v2 wraps the loop in a coordinator with a 4-phase journal, making the turn a state machine instead of an await.
6 — The Journal. Four phases, four points of no return: input committed, output received, side effects happened, history committed. v1 had the phases as bookkeeping; v2 makes each a durable checkpoint.
7 — Resume and Repair. classify_submission_state — a pure function that reads the journal and returns one of 7 top-level states; the resume state carries one of 7 resume sub-modes. The repair path marks interrupted tool calls as interrupted without re-executing them. This is the runtime's immune system.
8 — Tools as Factories. v1: tools are values passed to the session. v2: tools are factories that accept a trust-scoped context and return bound capabilities. A subagent gets narrower tools because the factory produced different tools, not because someone filtered the list.
9 — The Sandbox Boundary. v1's sandbox was coupled to Fly VM topology. v2 abstracts it into an 11-operation contract with three backends. The control server architecture: the VM runs a typed RPC server; the runtime sends structured commands instead of touching the filesystem.
10 — Workflows. v1 had delegation (one subagent at a time, depth-capped). v2 adds agent/parallel/pipeline with coordinator-driven nodes and deterministic-replay resume. Workflow scripts must be deterministic — the same property that makes turns recoverable.
11 — The Isolate. Agent-authored workflow sources run in a sandboxed subprocess with restricted builtins. Three constraints: DoS budgets, determinism enforcement, error info-flow control. Two honest gaps: the AST denylist is bypassable, and the OS hardening is targeted rather than deployed.
12 — From Runtime to Fleet. v1 baked distribution into the runtime (keepalive loops, wake logic, loopback credential injection). v2 separates distribution into its own layer: JSON-RPC transport, firewall, flycast autowake. The runtime doesn't know it's distributed.
13 — The Shape Gaps. Seven ranked gaps (G0–G6). Four are additive (G0, G1, G3, G6) — implementation catching up to a contract that already names the shape. G2 requires a new context-assembly seam that does not yet exist. G4 is a new edge the product thesis requires; G5 would reshape the subagent primitive and is deliberately deferred.
14 — Conclusion. Replay the rewrite arc in one pass. Name the three recurring design moves: the shape audit, the single seam, the durable envelope. Close with the honest tension: v2 is incomplete, and that's the point.