Skip to content
Codex CLI 0.172.0 source snapshot

Codex Internals

Run a task with Codex. Then follow how the harness builds model requests, runs tools, and carries results into the next decision.

Inside one turn
  1. Model returns a tool callexec_command
  2. Codex runs the commandecho tool harness
  3. Next model request carries the resultfunction_call_output
Module Start with What you’ll trace
Model and prompt Prompt Construction · Response Streaming Request fields, tool schemas, and streamed event identity.
Tools and policy Tools and Approvals · Tool Failures Execution, argument validation, approval replies, and hook outcomes.
Turn control Steering an Active Turn How steering reaches a later request and interruption resolves a pending approval.
Context, history, and memory Compaction and Resume · Session History and Memory What survives a checkpoint, what resume restores, and how local memory contributes to a new thread.
Workflow and extensions Subagent Handoffs · Configuration and Skills · MCP Integration Child results, reusable instructions, and external tools.

Read the assertion next to the claim it supports. The Source Map points to the exact revision and gives commands for the upstream fixtures. The CLI guides record which examples were checked on the installed client.

Codex Internals is an independent handbook for the public Codex implementation.