Codex
PLOpenAI Codex is an autonomous coding agent that inspects repositories, edits code, runs commands inside a sandbox, and reviews diffs across CLI, desktop, IDE, and cloud surfaces. For developers and tech leads standardizing Codex, reliable delivery depends on four durable layers: sandbox boundaries, approval policy, concise AGENTS.md instructions, and automated verification gates.
Most teams stall when they treat the model itself as the safety net. Sessions run with overly permissive defaults, AGENTS.md omits real test and lint commands, and engineers end up auditing every changed line manually to catch regressions. This hub maps the mental models, architecture, and verification habits that move a team up the Autonomy Ladder with Codex.
Where Codex fits across your surfaces
Section titled “Where Codex fits across your surfaces”Local Codex surfaces share one configuration directory (CODEX_HOME, default ~/.codex), project AGENTS.md files, Agent Skills, and MCP servers. Codex cloud runs inside hosted containers configured separately per repository.
| Surface | Best fit | Primary trade-off |
|---|---|---|
| Interactive CLI | Plan mode (/plan), local iteration, worktrees, and live steering | Ties work to your machine’s shell and local services |
Non-interactive CLI (codex exec) | CI checks, scripts, and schema-constrained review passes | Runs unattended (never approvals), requiring strict sandboxing |
| Desktop app | Parallel local threads, each isolated in its own worktree | Local compute and environment setup still apply |
| IDE extension | Targeted edits alongside open files in VS Code-compatible editors | Narrower orchestration scope than multi-worktree or cloud runs |
| Codex cloud | Background tasks, best-of-N spikes, and @codex review on PRs | Reads only committed remote state; requires cloud environment setup |
For installation steps, authentication options, current CLI flags, and supported models, follow the official OpenAI Codex documentation and our models hub.
Separate capability from escalation
Section titled “Separate capability from escalation”Codex divides control across two orthogonal axes in the Software Factory Harness:
- Sandbox boundaries determine what a command can technically touch (
sandbox_modevaluesread-only,workspace-write,danger-full-access, or named permission profiles). - Approval policy determines when Codex asks a human before crossing a boundary (
on-requestfor interactive work,granularfor category-level controls, andneverfor tightly bounded unattended runs). Legacyapproval_policy = "untrusted"was retired and breaks startup if left in older configs.
Keep planning and review read-only, run daily implementation inside workspace-scoped writes without network access, and reserve full-access modes for disposable, network-isolated runners.
Prove Codex output without reading every line
Section titled “Prove Codex output without reading every line”Each verification layer enforces what the layer above asks for:
AGENTS.mddeclares commands and invariants, while linters, type checkers, and tests enforce them deterministically.- An independent
codex reviewpass inspects the diff before merge against team rules inAGENTS.md. - CI re-runs the full oracle on a clean runner, and a human signs off on the evidence bundle (why evidence beats diffs).
Baseline your repository before scaling Codex across the team by running npx @wondelai/harness-audit (Harness Audit).
Common failure modes when adopting Codex
Section titled “Common failure modes when adopting Codex”- Project instructions silently fail to load: untrusted repositories suppress both
.codex/config.tomland projectAGENTS.md. Trust only repositories you control. - Retired config keys break scripts: older snippets using
approval_policy = "untrusted"or removed convenience flags fail fast; migrate to explicit sandbox profiles andon-requestornever. - Parallel local sessions collide: Git worktrees isolate files, while ports, local databases, and cloud credentials remain shared unless isolated explicitly.
Navigate the Codex canon
Section titled “Navigate the Codex canon”- Start and configure: Codex quick start · Configure
config.toml - Context and design: Optimize
AGENTS.mdand skills · System design with Codex - Verification and shipping: Test generation with Codex · Code review with Codex
- Scale and governance: Isolated Git worktrees · Codex cloud environments · Enterprise governance
- Compare and go deeper: Codex vs Cursor and Claude Code · AI-native SDLC · AI Engineering Books
Did this guide help you?
One tap, no sign-in.
What will you do with it?
How did it read?
What got in the way? Pick any that apply
Your role?
Thanks. I read every answer. Michał Jaskólski
Did this guide help?
One tap each. Close whenever you like.
no sign-in