Short answer

Codex vs Claude Code is mostly the wrong question. Both are capable terminal agents with hooks, headless modes and code review. The bigger gain comes from using them together: one writes, the other reviews. In my public benchmark, two independent positions cut a task from 3.7 hours and 389 M tokens to 1.5 hours and 34.3 M.

Every few weeks someone asks me which one to buy: Claude Code or Codex. They have read three comparison posts, each crowning a different winner, and each one is already out of date because both tools ship changes every week.

My answer is boring and, I think, correct. Pick either one as your main agent and you will be fine. Then add the other one as a reviewer, because the thing that limits an agent’s work is rarely the agent’s skill. It is the fact that nobody independent checks it.

What Claude Code and Codex have in common now

The two products have converged a lot. As of November 2026, both of them:

  • run in the terminal, in IDEs, in a desktop app and in the cloud;
  • read a project instructions file (CLAUDE.md for Claude Code, AGENTS.md for Codex, and Claude Code can read an existing AGENTS.md too);
  • have hooks that run your own scripts at points in the agent’s loop;
  • run headless for scripts and CI (claude -p and codex exec);
  • can review a diff or a pull request.

So “can it do X” comparisons mostly come out even. If an article tells you one of them lacks hooks or a non-interactive mode, check its date.

Where they differ, side by side

The differences that matter for automation are in the details of control: how you stop the agent, how you sandbox it, and how you pay for it. Here is what the official docs say today.

Claude Code Codex
Hook events 33 events, from SessionStart to PreCompact and TaskCompleted 14 events, including PreToolUse, Stop, SubagentStop and Interrupt
Hook setup Settings files at user, project and managed level; a hook can be a shell command, an HTTP call, an MCP tool, a prompt to a model or an agent hooks.json or config.toml; new or changed hooks are skipped until a person trusts them with /hooks
Keep the agent working A Stop hook returns "decision": "block" with a reason Same shape: "decision": "block" on Stop turns the reason into a continuation prompt
Safety model Permission modes from plan to auto (a classifier reviews actions) and bypassPermissions, plus an OS-level Bash sandbox Sandbox modes read-only, workspace-write, danger-full-access, using Seatbelt on macOS and bubblewrap on Linux
Headless default claude -p with your configured permissions codex exec runs in a read-only sandbox unless you pass --sandbox
Built-in review GitHub code review, GitHub Actions, GitLab CI /review in the CLI with an optional separate review_model, and automatic GitHub PR reviews
Billing Claude subscription seats (Pro, Max, Ultra, Team, Enterprise) or per-token API and cloud providers Included in ChatGPT plans from Free to Enterprise, or an API key at API rates
Licence Proprietary CLI is open source under Apache-2.0

Two rows deserve a comment. Claude Code’s hook system is wider: more events, and hook types that can call a model or a subagent to make the decision. That makes it the easier base for building a pipeline around an agent, which I cover in Claude Code hooks: turning an assistant into a pipeline. Codex’s defaults are stricter: a headless run can’t write files until you say so, and hooks don’t run until a person trusts them. That is a good property for the tool you put in the reviewer’s chair.

On cost, Anthropic’s own docs put the average enterprise spend on Claude Code at about $13 per developer per active day, and below $30 for 90% of users. OpenAI’s pricing page describes allowances per five hours and per week, with credits after that. Neither tells you what a full pipeline costs, because that depends on how long your runs go on, which I unpack in the true cost of AI coding.

Why “which is better” is the wrong question

Benchmarks and vibes swing between the two every release. That race matters less than it looks, for a simple reason. An agent that wrote the code is the worst-placed party to judge it. It reads its own plan as the requirement, it remembers why each shortcut seemed fine, and it reports “done” in the same confident voice whether the work is done or not.

A second instance of the same model helps a bit. A different model, trained differently, helps more, because its blind spots don’t line up with the writer’s. In my pipelines the reviewer is always a different model from the writer. Claude Code writes, Codex reviews. The reverse would also work. What matters is the independence, and I argue the general case in the writer can’t be the reviewer.

What happened when the two worked together

I ran one public benchmark on this in September 2026: rebuild a mobile game from a video of someone playing it, with no hints after the first prompt. Three setups got the same task. Claude Code alone. Claude Code with one Codex review at the end. And a setup where Claude and Codex each wrote an independent position on the approach before any code existed, and Codex listed only the material disagreements.

Tokens processed on the same task

Rebuild a mobile game from a gameplay video, one prompt, no hints

Claude Code aloneClaude Code alone: 389 M389 MClaude Code plus one end reviewClaude Code plus one end review: 155.6 M155.6 MTwo independent positions firstTwo independent positions first: 34.3 M34.3 MClaude Code aloneClaude Code alone: 389 M389 MClaude Code plus one end reviewClaude Code plus one end review: 155.6 M155.6 MTwo independent positions firstTwo independent positions first: 34.3 M34.3 M
Source: Ivan Stepanok, public benchmark, September 2026.
Data as a table
Value
Claude Code alone389 M
Claude Code plus one end review155.6 M
Two independent positions first34.3 M

Time went from 3.7 hours alone to 4.2 hours with a review at the end, and to 1.5 hours with two positions up front. Bugs I counted by hand went from about 13, to about 7, to no broken mechanics.

The middle result is the one to remember. Bolting a reviewer onto the end of a run halved the bugs but made the run longer, because the reviewer was pulling back a plan the writer had already built on. The disagreement paid off when it happened before code. Caveats: it is one task, the bug counts are mine, and the first run used a higher reasoning effort. The prompt and procedure are in benchmark.json if you want to rerun it, and the full write-up is in Claude Code writes, Codex reviews.

How to split the work between Claude Code and Codex

Here is a layout that works with off-the-shelf features of both tools. It needs no custom engine to start.

One writer, one independent reviewer

  • Person
  • Agent
  • Automated check
TaskacceptancecriteriaTwopositionseach modelplansaloneClaudeCodewritesdecidesand buildsChecksbuild,tests,commandsCodexreviewsdiff plusevidenceMergeor aperson onhard callsfindings go backTaskacceptance criteriaTwo positionseach model plans aloneClaude Code writesdecides and buildsChecksbuild, tests, commandsCodex reviewsdiff plus evidenceMergeor a person on hard calls
Illustrative diagram, not measured data.
Steps as text
StepWhat happens
1. TaskPerson — acceptance criteria
2. Two positionsAgent — each model plans alone
3. Claude Code writesAgent — decides and builds
4. ChecksAutomated check — build, tests, commands
5. Codex reviewsAgent — diff plus evidence
6. MergePerson — or a person on hard calls
Loopfindings go back: back from step 5 to step 3
  1. Write acceptance criteria before either agent starts. Criteria that can be checked by a command beat criteria in prose.
  2. Ask both models for a plan, separately. Give each the same context file and don’t show either the other’s answer. Then ask the reviewer for the disagreements that would change the outcome, and nothing else.
  3. Let the writer decide and build. One owner per decision keeps the run from turning into a debate.
  4. Run the checks yourself, outside the agent. A Stop hook in Claude Code can run the build and tests and refuse to let the agent stop while they fail.
  5. Hand the reviewer the diff, the check output and the criteria. codex exec in a read-only sandbox, or /review with a set review_model, is enough to start.
  6. Send findings back to the writer automatically, with a round limit. Park the run for a person after a couple of rounds with no progress.

Bad and good ways to use both

Bad: running both agents on the same task in parallel and picking the nicer diff. You pay twice and still have no review, only a beauty contest.

Bad: letting the reviewer edit code. Once it fixes things itself, nobody reviews its fixes, and the two agents start overwriting each other.

Bad: giving the reviewer the writer’s summary instead of the diff. It will review the story, and the story is always good.

Good: a reviewer that only reads, only returns findings, and judges evidence the pipeline collected rather than claims the writer made.

Good: tools kept for their strengths. I use Claude Code’s richer hooks to drive the loop and Codex’s strict sandbox defaults for the reviewer’s chair. Swap them if your team already lives in one of them; the shape matters more than the brand.

Good: hard stop rules. Three rounds of patience and a ceiling are what make a two-agent loop safe to leave running.

If you’d like this set up for your team, write to me. The rest of this site, starting with the factory page, describes how I run it day to day.

Questions

Is Codex better than Claude Code?

Neither is better across the board, and the lead changes with releases. Claude Code currently has the wider hook system, Codex has stricter sandbox defaults for headless runs, and both are strong enough that review setup matters more than the choice.

Can I use Claude Code and Codex together?

Yes. A common setup has Claude Code write the code while Codex reviews the diff in a read-only sandbox, with a hook passing findings back automatically until the reviewer accepts or a round limit is hit.

Which is cheaper, Claude Code or Codex?

Both offer subscription seats with usage allowances and pay-per-token API access, so the cheaper one depends on your plan and how long your runs go on. In my benchmark, the setup with two independent positions used about a tenth of the tokens of a single agent working alone.

Do Claude Code and Codex both support hooks?

Yes. Claude Code documents 33 hook events and Codex documents 14, and in both a Stop hook can return a block decision that sends the agent back to work with your reason as the next instruction.