DEV Community

Cover image for Claude Code vs Codex: How I Use Both on One Repo
Papan Sarkar
Papan Sarkar

Posted on Originally published at papansarkar.com

Claude Code vs Codex: How I Use Both on One Repo

Claude Code leads the coding-agent tools in Stack Overflow's 2026 survey at 66%, ahead of GitHub Copilot at 59% (Stack Overflow 2026). Codex passed 5 million weekly active users in June, by OpenAI's own count (Constellation Research). Most "Claude Code vs Codex" posts try to name a winner. I run both on the same repo, and I've found it more useful to ask which job goes to which agent, and how to keep the two from drifting apart.

This post covers what each tool does better as of late October 2026, one instruction file both of them read, and the loop where one agent writes and the other reviews. The general habits (context, prompts, model choice) are in Use AI Coding Agents Like a Pro, so I won't repeat them here.

TL;DR

  • Same entry price, different defaults. Both are included in their vendor's $20/month individual plan (Claude pricing, Codex pricing).
  • Claude Code drives my interactive work. You can switch permission modes mid-session, hooks enforce hard rules, and its review runs in the background.
  • Codex is my second opinion and my scripted worker. It sandboxes at the OS level by default, its scripted mode starts read-only, and its GitHub reviews flag only P0 and P1 issues.
  • One AGENTS.md serves both. Codex reads it natively. Claude Code reads it too, or imports it from CLAUDE.md with one line.
  • Have the agent that didn't write the code review it. Models favour their own output, and that bias does the most damage when the model got it wrong.

Claude Code vs Codex at a glance

I checked every row against both vendors' docs on 30 October 2026. Both products ship changes weekly, so confirm a detail on the linked page before you rely on it.

Claude Code Codex
Where it runs Terminal, VS Code, JetBrains, desktop app, web (docs) CLI, IDE extension, ChatGPT desktop, web and mobile, Codex Cloud (docs)
Cheapest plan with it Pro: $20/month, or $17/month billed annually (pricing) Included from ChatGPT Free upward; Go is $8/month, Plus $20/month (pricing)
Heavy-use tier Max, from $100/month (pricing) Pro, from $100/month, currently with no five-hour limit (pricing)
Instruction file CLAUDE.md; reads AGENTS.md if there's no CLAUDE.md (docs) AGENTS.md, merged from the repo root down to your folder (docs)
Safety default Auto mode, where a classifier checks actions; the OS-level Bash sandbox is opt-in (docs) OS-level sandbox in workspace-write mode (docs)
Scripted mode claude -p (docs) codex exec, read-only by default (docs)
Local review /code-review, on any plan (docs) /review, or codex review --base main (docs)
GitHub PR review Managed Code Review, Team and Enterprise plans only (docs) @codex review or automatic reviews (docs)
Open source No CLI is Apache-2.0 (GitHub)

I left benchmark scores and model names out on purpose. Both lineups have changed several times this year, and published comparisons disagree with each other by wide margins. Test both on a real ticket from your own codebase instead.

Both are safe bets now

If you're a founder or CTO deciding which one your team should pay for, the market data says neither is a fringe pick:

  • 73% of respondents in Stack Overflow's 2026 survey use coding assistants and agents daily (Stack Overflow 2026).
  • Anthropic said in February that Claude Code's run-rate revenue had passed $2.5 billion and that weekly users had doubled since January 1 (Anthropic).
  • OpenAI said in June that Codex had more than 5 million weekly active users, up more than 6x since its desktop app launched in February (Constellation Research).
  • The open-source Codex CLI repo has more than 130,000 GitHub stars (GitHub).

Both companies report their own numbers, and they measure different things (revenue versus weekly users), so don't read them as a head-to-head. The point is simpler: both tools will be around, so choose by how your team works, not by which vendor might fold.

Where Claude Code wins for me

Steering while it works. Shift+Tab cycles permission modes mid-session: manual approval, auto-accept edits, and plan (permission modes). On code I don't know yet, I start in plan mode, read the plan, then let it edit. That back-and-forth is where Claude Code feels best.

Rules that are actually enforced. An instruction file is a suggestion. Anthropic's docs say it plainly: Claude treats CLAUDE.md "as context, not enforced configuration," and to block an action no matter what, you use a PreToolUse hook (memory docs). "Never edit the migrations folder" belongs in a hook, not in a paragraph.

Review that doesn't flood the session. /code-review runs as a background subagent with its own context window, so the findings arrive without filling your conversation (code review docs).

One config across surfaces. The terminal, IDE, desktop and web surfaces share one engine, so the same CLAUDE.md, settings and MCP servers work in all of them (overview).

Where Codex wins for me

Sandbox first. Codex enforces its sandbox at the OS level: Seatbelt on macOS, bubblewrap on Linux and WSL2, and a native sandbox on Windows. The default mode lets it edit files and run routine commands inside the workspace, and nothing outside it (sandboxing). Since I was handed a Next.js repo wired to run malware on every npm run dev, I want an agent that runs unfamiliar code inside an OS boundary from the start. Claude Code can do this too with /sandbox; it just doesn't start that way.

Safe scripting by default. codex exec starts in a read-only sandbox unless you pass --sandbox workspace-write, and --output-schema makes it return JSON that matches a schema you give it (non-interactive mode). That makes it a good fit for CI jobs like triage reports.

Quiet PR reviews. On GitHub, Codex flags only P0 and P1 issues (Codex GitHub docs). Reviews with less noise are reviews people actually read.

A cheap way in for teams already on ChatGPT. Every ChatGPT plan from Free upward includes Codex, and Business costs $25 per user per month billed monthly (Codex pricing). If a client's team already pays for ChatGPT Business, trying Codex costs them nothing extra.

One AGENTS.md for both agents

The fastest way to get inconsistent code from two agents is to give them two sets of rules. You don't need two copies:

  • Codex reads AGENTS.md files from the repo root down to your working folder, one file per folder. Files closer to you override earlier ones, and the combined size caps at 32 KiB by default (Codex AGENTS.md docs).
  • Claude Code reads AGENTS.md when there is no CLAUDE.md. If both exist, it reads only CLAUDE.md, unless CLAUDE.md imports the other file (Claude Code memory docs).

That second rule is how most repos drift: someone adds a CLAUDE.md and Claude quietly stops reading the shared rules. My setup keeps AGENTS.md as the source of truth and makes CLAUDE.md a thin wrapper.

The shape of a good AGENTS.md (commands, non-obvious conventions, "done means") is in my habits post. The part that matters for two agents is a review section. Codex's GitHub reviews look for a ## Code Review Rules heading in the nearest AGENTS.md (Codex GitHub docs):

## Code Review Rules
- Flag any API route that skips the auth middleware
- Flag money math done in floats; amounts are integer cents
- Flag new env vars that aren't added to src/env.ts
- Ignore formatting and import order; the linter owns those
Enter fullscreen mode Exit fullscreen mode

And the whole CLAUDE.md:

@AGENTS.md

## Claude Code only
- For schema changes, use the /db-migration skill instead of editing models by hand
Enter fullscreen mode Exit fullscreen mode

Claude reads the imported file first, then the lines below it (memory docs). The import also works on older Claude Code versions that can't read AGENTS.md directly. Claude's /code-review follows your CLAUDE.md (docs), so with the import, both reviewers check the same rules.

The loop: one agent writes, the other reviews

In the habits post I argued for reviewing in a fresh context. Here I go one step further and use a different vendor's model.

The research reason: Panickssery, Bowman and Feng found that LLM evaluators recognise and favour their own outputs, and that the stronger the self-recognition, the stronger the bias (arXiv 2404.13076). A 2025 follow-up complicates this. For stronger models, most of that self-preference turned out to be justified, because their answers really were better. The harmful kind persisted when the model was wrong, and "stronger models struggle more to recognize when they are wrong" (arXiv 2504.03846). You need a review for exactly the times the writer is wrong. Neither paper tested coding agents reviewing diffs, so take this as a good reason to try the loop, not as proof that it works.

My loop:

  1. Claude Code writes the feature on a branch, interactively, starting in plan mode.
  2. Cheap checks run first. Typecheck and tests. An agent review is not a test suite, and I don't pay an agent to find type errors.
  3. Codex reviews the branch against main without changing the working tree (Codex code review).
  4. The findings go back to Claude with a triage prompt (below).
  5. Swap roles when Codex wrote the branch: Claude's /code-review runs non-interactively with claude -p (headless docs).

The script I keep in the repo:

#!/usr/bin/env bash
# Usage: scripts/cross-review.sh [codex|claude] [base-branch]
# Ask the agent that did NOT write this branch to review it. Neither command edits files.
set -euo pipefail

reviewer="${1:-codex}"
base="${2:-main}"

# Cheap checks first; an agent review is not a test suite.
pnpm tsc --noEmit
pnpm vitest run

case "$reviewer" in
  codex)
    codex review --base "$base"
    ;;
  claude)
    # dontAsk denies anything that would need approval, so the review can read but not write.
    claude -p "/code-review ${base}...HEAD" --permission-mode dontAsk
    ;;
  *)
    echo "reviewer must be codex or claude" >&2
    exit 1
    ;;
esac
Enter fullscreen mode Exit fullscreen mode

codex review takes exactly one target: --base, --commit, --uncommitted, or a custom prompt (Codex CLI reference). On the Claude side, dontAsk mode denies every call that would otherwise prompt, but reads and read-only commands still run (headless docs). Without --fix, /code-review only reports.

The triage prompt I paste into the writing agent with the findings:

Another reviewer flagged the issues below on this branch.
For each one, either fix it or reply in one line explaining why it is not a bug.
Don't change code the findings don't mention.
When you're done, run the typecheck and tests and show me the output.

<findings>
Enter fullscreen mode Exit fullscreen mode

The "explain why it isn't a bug" clause is what makes this work. Without it, the writer accepts every finding and the code bloats. With it, I read a short list of rejections and make the call myself.

On GitHub, the same idea applies at team scale. Claude's managed Code Review starts with an @claude review comment (Claude Code Review), and Codex starts with @codex review (Codex GitHub docs). Don't turn both on for every PR. That doubles the noise. Ask for a review from the agent that didn't write the PR.

Which agent for which job

Job My first pick Why
Exploring code I don't know yet Claude Code in plan mode Reads and plans before any edit; Shift+Tab to switch modes
Feature work I want to steer Claude Code Mode switching, hooks for hard rules, background review
Running an unfamiliar repo or script Codex OS-level sandbox from the first command
CI jobs: triage, reports, lint fixes codex exec Read-only by default; schema-checked JSON output
A well-scoped ticket I want back as a PR Either Both run tasks in the cloud: Codex Cloud and Claude Code on the web
Second-opinion review Whichever didn't write it Different model, different blind spots
Team PR review on GitHub The one you already pay for Claude Code Review needs a Team or Enterprise plan; Codex reviews run through the ChatGPT Codex connector

What running both costs

At entry level, Claude Pro plus ChatGPT Plus comes to $40 per developer per month, or $37 with Claude billed annually (Claude pricing, Codex pricing). Heavy users hit limits sooner, and both vendors' next tier starts at $100 a month (Claude pricing, Codex pricing).

The cost that matters more for client work is data. Running two agents means two vendors see the code. Codex Cloud and Claude Code on the web run on vendor infrastructure, and Claude's managed Code Review isn't available to organisations with Zero Data Retention enabled (Claude Code Review). Check the client's contract before you add a second vendor, not after.

When I don't bother with two agents

  • Small, obvious changes. If I can describe the diff in one sentence, one agent and the test suite are enough.
  • No tests. Two agents agreeing is not verification. In Stack Overflow's 2026 survey, 48% of respondents said they trust AI when they can easily validate its answers (Stack Overflow 2026). Make validation easy first.
  • Code the client won't share with a second vendor. Use one agent and a fresh-context review from that same vendor. My reading of the 2025 self-preference paper is that this gets you most of the benefit.

The short version

Pick one agent to drive and use the other as the reviewer. Keep AGENTS.md as the single source of truth, run your tests before any agent review, and make the writing agent justify every finding it rejects.

If you're planning a product and want it built with this kind of review loop, I build React/Next.js and Node.js products for clients. Get in touch. To keep either agent accurate and cheap, start with Use AI Coding Agents Like a Pro. If you're on Copilot, see Using AI Agents in VS Code.

Sources

  1. Stack Overflow Developer Survey 2026: AI
  2. Constellation Research: OpenAI touts broadening Codex usage with 5 million weekly active users
  3. Anthropic: Series G announcement (Claude Code run-rate revenue)
  4. GitHub: openai/codex
  5. Claude pricing
  6. Codex docs: Pricing
  7. Claude Code docs: Overview
  8. Claude Code docs: Permission modes
  9. Claude Code docs: How Claude remembers your project (CLAUDE.md and AGENTS.md)
  10. Claude Code docs: Run Claude Code programmatically
  11. Claude Code docs: Review locally with /code-review
  12. Claude Code docs: Code Review
  13. Codex docs
  14. Codex docs: Sandboxing
  15. Codex docs: Non-interactive mode
  16. Codex docs: Code review
  17. Codex docs: Command line options
  18. Codex docs: Use Codex in GitHub
  19. Codex docs: Custom instructions with AGENTS.md
  20. Panickssery, Bowman and Feng: LLM Evaluators Recognize and Favor Their Own Generations
  21. Chen et al.: Do LLM Evaluators Prefer Themselves for a Reason?

Originally published at papansarkar.com.

Top comments (0)