Learn Codex

Learning Path

s01 to s20: Progressive Agent Harness Design

Layer Legend

Tools & Execution
Planning & Control
Memory Management
Concurrency & Automation
Multi-Agent Platform
Codex in Depth
01
s01Minimal model/tool loop over the Responses API

The Agent LoopOne Loop Is All You Need

177 lines of code1 tools

“The smallest useful agent is a loop that calls the model, runs tools, and feeds results back.”

Learn More
02
s02Tool registry & dispatch map

Tool UseStructured Tools, Not Just a Shell

438 lines of code5 tools

“The loop stays stable while capabilities register into a dispatch table.”

Learn More
03
s03approval_policy gate

Approval & PermissionsAsk Before You Act

286 lines of code3 tools

“Codex's approval modes (untrusted / on-failure / on-request / never) are a harness decision point before the shell runs.”

Learn More
04
s04sandbox_mode exec policy

SandboxRun It, But Contain It

286 lines of code4 tools

“read-only / workspace-write / danger-full-access, backed by OS isolation, decides what a command can actually touch.”

Learn More
05
s05update_plan todo manager

The Plan ToolAn Agent Without a Plan Drifts

225 lines of code2 tools

“Explicit plans keep long-running work visible and correctable — Codex exposes this as the update_plan tool.”

Learn More
06
s06Isolated subtask delegation

SubagentsDelegate With a Clean Context

199 lines of code2 tools

“Subagents give each subtask a clean message history while preserving the main thread.”

Learn More
07
s07On-demand skill loader

SkillsLoad Expertise Only When Needed

208 lines of code2 tools

“Codex skills inject specialized instructions only when the task actually needs them.”

Learn More
08
s08Auto-compaction

Context CompactionContext Will Fill Up

192 lines of code1 tools

“Compaction keeps the conversation usable when the context window gets crowded.”

Learn More
09
s09Rollout persistence & resume

Memory & SessionsDon't Lose the Details

279 lines of code1 tools

“Session rollouts let codex resume survive restarts; some facts should outlive summarization.”

Learn More
10
s10Runtime instruction assembly

Instructions & AGENTS.mdAssembled at Runtime, Never Hardcoded

230 lines of code2 tools

“The system prompt is a generated product of AGENTS.md, config.toml, profiles and built-ins.”

Learn More
11
s11Classified retry strategy

Error RecoveryErrors Are the Start of a Retry

243 lines of code1 tools

“A robust harness classifies failures (rate limit, overflow, abort) and decides what kind of retry is worthwhile.”

Learn More
12
s12Shared task board

Task SystemBreak Big Goals Into Small Tasks

234 lines of code5 tools

“A task graph turns vague goals into ordered, observable work.”

Learn More
13
s13Async background execution

Background TasksSlow Work Goes to the Background

182 lines of code3 tools

“The agent keeps reasoning while slow commands finish elsewhere — codex exec taken further.”

Learn More
14
s14Scheduled / triggered runs

AutomationsWork on a Schedule

240 lines of code1 tools

“Recurring work should be created by the harness, not remembered by the model.”

Learn More
15
s15Teammate mailboxes

Agent TeamsOne Agent Isn't Enough, Form a Team

252 lines of code4 tools

“Persistent teammates let work continue in parallel without stuffing every thought into one context.”

Learn More
16
s16Shared coordination contracts

Team ProtocolsTeammates Need Agreements

249 lines of code1 tools

“Multi-agent systems need explicit message contracts, not vibes.”

Learn More
17
s17Autonomous task claiming

Autonomous AgentsCheck the Board, Claim the Task

269 lines of code1 tools

“Teammates become useful when they can discover and claim work themselves.”

Learn More
18
s18Git worktree lifecycle

Worktree IsolationSeparate Directories, No Conflicts

205 lines of code1 tools

“Parallel agents need isolated filesystems as much as isolated conversations — the model Codex Cloud runs on.”

Learn More
19
s19MCP tool bridge

MCP ServersExternal Tools, Standard Protocol

247 lines of code4 tools

“External services become agent tools through a standard discovery and call protocol configured in config.toml.”

Learn More
20
s20Integrated harness

The Full HarnessAll Mechanisms, One Loop

263 lines of code0 tools

“The final harness is still one loop, now surrounded by the systems that make it production-shaped.”

Learn More
21
s21Command & slash-command dispatch

The Codex CLI SurfaceOne Binary, Many Doors

264 lines of code1 tools

“codex exec/resume/review/login/mcp and the /slash commands are one dispatch layer over the same harness.”

Learn More
22
s22Full config schema & precedence

config.toml in DepthEvery Knob, One Resolver

256 lines of code1 tools

“model_providers, wire_api, sandbox_workspace_write, profiles and mcp_servers all resolve through one precedence chain.”

Learn More
23
s23Review mode & headless runs

Review, CI & CloudThe Harness Leaves Your Laptop

266 lines of code2 tools

“codex review, codex exec in CI, and Codex Cloud tasks are the same loop running unattended on real work.”

Learn More
24
s24Plugin marketplace + apps + hooks + Codex-as-MCP-server

Plugins, Apps & HooksExtend Codex Beyond Skills and MCP

225 lines of code7 tools

“Plugins bundle skills/MCP/prompts into installable marketplaces, hooks run on lifecycle events, and codex mcp-server turns Codex itself into a tool.”

Learn More
25
s25web_search, image input, image_generation, browser_use, computer_use

Tools Beyond the ShellSee, Search, and Drive a Browser

237 lines of code5 tools

“Codex's built-in tools go far past the shell — it can search the live web, read images, generate them, and operate a browser or desktop.”

Learn More
26
s26--oss, ollama/lmstudio, model_providers + wire_api

Local Models & Custom ProvidersRun Without OpenAI

185 lines of code2 tools

“The same harness points at a local Ollama/LM Studio model or a compatible gateway by swapping one provider and its wire_api.”

Learn More
27
s27mcp-server, app-server, exec-server, remote TUI, desktop app, IDE, ChatGPT/GitHub

Codex as a Service & the Other SurfacesOne Engine, Many Frontends

267 lines of code3 tools

“One Codex engine serves the CLI, a desktop app, a VS Code extension, a remote app-server, and the hosted ChatGPT/GitHub integrations.”

Learn More
28
s28fork/archive lifecycle, codex sandbox, --add-dir, bypass modes, guardian approval, trusted projects, feature flags

Sessions, Sandbox & Safety in DepthFork, Trust, and the Full Safety Model

239 lines of code0 tools

“The full session lifecycle (resume/fork/archive) and the safety knobs that dial autonomy from read-only up to full bypass — gated by feature flags.”

Learn More

LOC Growth

s01
177
s02
438
s03
286
s04
286
s05
225
s06
199
s07
208
s08
192
s09
279
s10
230
s11
243
s12
234
s13
182
s14
240
s15
252
s16
249
s17
269
s18
205
s19
247
s20
263
s21
264
s22
256
s23
266
s24
225
s25
237
s26
185
s27
267
s28
239