Source Atlas
Reading Contract: Use this page as an audit index, not prerequisite reading. Open links only after a claim is clear in prose, then verify owner, function, and line-level evidence against the pinned commit.
All links point to public Codex source pinned at 569ff6a1c400bd514ff79f5f1050a684dc3afde3. The book should stand on its own; this page is for audit.
Use the atlas as an evidence boundary. A linked source line can verify a visible type, function, comment, call site, or record shape. The book’s owner/lifetime diagrams are bounded engineering interpretations of those visible contracts, not claims about provider-internal state or unpublished service behavior.
Context Boundary
- Context manager fields and ledger:
codex-rs/core/src/context_manager/history.rs - Turn envelope:
codex-rs/core/src/session/turn_context.rs - Turn loop:
codex-rs/core/src/session/turn.rs
History and Projection
- Recording model-visible history:
record_items - Preparing prompt input:
for_prompt - Paired removal:
remove_first_item - Rollback-aware dropping:
drop_last_n_user_turns
Typed Context
- Context fragment trait:
context/fragment.rs - Fragment catalog:
context/mod.rs - Settings updates:
context_manager/updates.rs - Realtime updates:
build_realtime_update_item
Optional Context
- Skill rendering and budgets:
core-skills/src/render.rs - Skill and plugin injection in the turn loop:
session/turn.rs - Memory read prompt injection:
memories/read/src/prompts.rs - Memory write truncation:
memories/write/src/prompts.rs - Image modality projection:
for_prompt - Tool image replacement:
replace_last_turn_images
Compaction
- Initial context placement modes:
InitialContextInjection - Local compaction:
compact.rs - Replacement history construction:
build_compacted_history - Remote compaction:
compact_remote.rs
Replay and Client Surfaces
- Rollout reconstruction:
session/rollout_reconstruction.rs - Rollout truncation:
thread_rollout_truncation.rs - TUI token usage:
tui/src/token_usage.rs - App-server token replay:
token_usage_replay.rs