中文

Reader Map

Reading Contract: Use this map to choose a reading path before opening chapters. Track which chapters answer architecture questions, which answer implementation questions, and which give transferable patterns.

This book is shorter and narrower than Codex From Source. It assumes you already know that Codex has a session runtime, tool execution, a TUI, and an app-server surface. It zooms in on the question those systems all depend on: what exactly does the model see, why does it see that, and how does Codex keep the answer stable after many turns?

Three reading routes through the Codex context management book for architects, implementers, and pattern readers
Choose a route before opening the chapters: the architecture path gives the boundary, the implementation path follows every owner, and the pattern path extracts the reusable moves.

Three Reading Paths

You can read this book in three ways. Pick the path that matches your goal:

PathBest forChapters
Architecture pathYou need the system shape first.Chapter 1, Chapter 2, Chapter 6, Chapter 7, epilogue
Implementation pathYou want the source-equivalent walkthrough.All chapters in order.
Pattern pathYou are borrowing design moves for another agent runtime.Preface, “Apply This” sections, source atlas, epilogue.

Each path is honest about its trade-off. The overview path skips most implementation density and finishes in under an hour. The deep-dive path is the only one that reads every section. The pattern path is the fastest way to extract transferable design moves for another runtime.

For Architecture Readers

Read Chapter 1, Chapter 2, Chapter 6, Chapter 7, and the epilogue. That path gives you the central design:

  • Context is an enforced boundary rather than a loose transcript.
  • A turn envelope freezes the runtime facts that are allowed to affect one model request.
  • Compaction is a checkpoint protocol, not just a summarizer.
  • Replay and rollback are designed around evidence, not mutable memory.

For Implementation Readers

Read all chapters in order. The ordering is deliberate:

  1. Chapter 1 defines the problem and vocabulary.
  2. Chapter 2 explains the turn envelope that gathers runtime facts.
  3. Chapter 3 explains the history ledger that becomes prompt input.
  4. Chapter 4 explains typed context fragments and diff injection.
  5. Chapter 5 explains optional context budgets.
  6. Chapter 6 explains compaction.
  7. Chapter 7 explains resume, rollback, fork, and replay.
  8. Chapter 8 explains how clients observe context without owning it.

Canonical Homes

Each concept has one home:

ConceptCanonical chapter
Context as runtime stateChapter 1
TurnContext shapeChapter 2
History normalization and token estimationChapter 3
Runtime context diffingChapter 4
Skills, plugins, memory, outputs, imagesChapter 5
Local and remote compactionChapter 6
Rollout reconstruction and truncationChapter 7
TUI/app-server/realtime/token usage surfacesChapter 8

Cross-References at a Glance

The chapters reuse a small set of vocabulary. The table below shows which chapter introduces each term and which chapters depend on it:

TermIntroduced inReused in
Prompt projectionChapter 1every later chapter
Turn envelope (TurnContext)Chapter 24, 6, 7, 8
History ledgerChapter 34, 5, 6, 7
Reference baselineChapter 34, 6, 7
Typed fragmentChapter 45, 8
Settings diffChapter 46, 7
Optional planeChapter 58
Replacement historyChapter 67
Rollback markerChapter 78

Later chapters reference earlier ideas instead of re-explaining them. If a section feels terse, follow its source atlas links after you finish the chapter; the book gives the narrative, the links give auditability.