Codex vs Claude Code: which agent suits your work?

Two terminal windows side by side: one with a cloud icon and progress bar, one with a cursor

The short answer

Codex and Claude Code are agentic coding tools that read a repository, edit files and run commands. Codex runs in the ChatGPT apps, a command line interface (CLI), editor extensions and a cloud sandbox, and ChatGPT Plus includes it. Claude Code runs in a terminal, editors, a desktop app and the web, and Claude Pro includes it.

How do Codex and Claude Code compare at a glance?

Codex and Claude Code compare as two agentic coding tools that read a repository, edit files and run commands, sold inside the ChatGPT and Claude paid plans. Codex is OpenAI's agent and Claude Code is Anthropic's, and the table lists what each vendor's own pages said on 18 November 2026.

Codex and Claude Code at a glance, from each vendor's pages
QuestionCodexClaude Code
MakerOpenAIAnthropic
Where it runsChatGPT desktop, mobile and web apps, Codex command line interface (CLI), Codex integrated development environment (IDE) extension, Codex CloudTerminal, IDEs such as VS Code and JetBrains, desktop app, web
Instruction fileAGENTS.mdCLAUDE.md, or AGENTS.md when no CLAUDE.md exists
Entry plan with accessIncluded in ChatGPT Plus; Free and Go get limited useIncluded in Claude Pro
Tool connectionsAgent configuration in the Codex docsModel Context Protocol (MCP) servers, hooks and skills

On claude.com/pricing, Claude Code comes with Pro, which costs 17 dollars a month on annual billing and 20 dollars on monthly billing. OpenAI's pricing page names the ChatGPT plans but didn't show amounts on the check date, so this page doesn't quote a Plus price; look at chatgpt.com/pricing before you subscribe.

How do Codex and Claude Code work differently?

Codex and Claude Code work differently in their default mode: Codex leans on delegated cloud tasks you review later, Claude Code on a live terminal session you steer. That split comes from where each tool started, and it isn't a hard line any more.

A Codex Cloud task runs away from your machine in a sandbox and reports back with a diff. A Claude Code terminal session runs where you can watch every command and approve each edit. Claude Code now starts sessions on the web and in a desktop app, and Codex runs in a terminal through its CLI, so both tools can work either way. Both read your code, propose a plan, edit several files and run your tests.

What goes in AGENTS.md and CLAUDE.md?

AGENTS.md and CLAUDE.md hold the same kind of content: build and test commands, code style rules and the folders the agent may touch. Codex reads AGENTS.md from the repository, and Claude Code reads CLAUDE.md, or an AGENTS.md when the repository has no CLAUDE.md. Put these 5 things in the file:

  • Commands to build, test and lint, written exactly as you'd type them.
  • Folders the agent mustn't touch, such as generated code and anything holding secrets.
  • Code style rules that a linter can't enforce.
  • A definition of done, such as passing tests and a diff under 200 changed lines.
  • Names of the services and branches the project uses.

Never put secrets in the file. To start from a form, the system prompt generator and the custom instructions generator draft the same kind of standing text.

What do benchmarks say about Codex vs Claude Code?

Benchmarks on Codex vs Claude Code conflict between sources, so the page shows two dated results side by side and names no overall winner. Each test fixes its own task set, test setup and model version, and these two don't agree.

Two benchmark sources, checked on 18 November 2026
SourceWhat it measuresBest Claude resultBest OpenAI result
Terminal-Bench 4.1 leaderboardThe agents themselves on terminal tasksClaude Code with Fable 5.2: 65.8% (entry dated 9 November 2026)Codex with GPT-6.2 Astra: 62.1% (entry dated 17 November 2026)
SWE-Bench Pro public leaderboard (Scale AI)Models in one shared scaffold, not the two agents; the page shows no entry datesclaude-opus-4-6 (thinking): 51.90%gpt-5.4 (xHigh): 59.10%

The first source puts Claude Code ahead and the second puts the OpenAI model ahead, and neither one tested your repository. That's the test that counts, and it takes 5 steps:

  1. Choose 3 real tasks from your backlog: 1 small fix, 1 multi-file change and 1 bug with a failing test.
  2. Give Codex and Claude Code the same brief, with the same files named and the same stop condition.
  3. Run each task once per tool on a clean Git branch.
  4. Record 3 numbers: whether the tests pass, the files changed and how long your review took.
  5. Repeat the losing task once, since one run can't prove much.

Which jobs suit Codex and which suit Claude Code?

Codex suits queued background jobs such as CI fixes, and Claude Code suits interactive refactors where you approve each step. Continuous Integration (CI) work runs without you, so a delegated task fits it, while a big refactor needs someone checking every stage.

  • Small fixes: use whichever tool's already open. A one-file change doesn't need delegation.
  • Big refactors: ask for a written plan first, approve it, then let the agent edit in stages with tests after each one.
  • CI jobs: Claude Code lists GitHub Actions and GitLab integrations in its docs, and the Codex CLI runs from a script, so both can sit in a pipeline.
  • New projects: generate a skeleton in each, then keep the one that's easier to maintain in your stack. You'll know within a day.

Where does your code go with Codex and Claude Code?

Your code goes to the vendor's model with every request in both Codex and Claude Code, and Codex cloud tasks copy the repository into a sandbox. Each tool sends the files it reads, your prompts and command output, so code leaves your machine in either case. For code privacy, the real split is a cloud sandbox vs local files: a local session keeps the repository on your disk, and only what the agent reads travels.

Before you point an agent at private code, check 3 things on each vendor's data controls page: whether your plan trains on your content, how long conversations are kept, and whether your employer has approved the tool. List secret files in AGENTS.md or CLAUDE.md as off limits, and don't paste secrets into the prompt.

Can you run Codex and Claude Code on one project?

Yes, you can run Codex and Claude Code on one project when each works on its own branch and both read the same instruction content. Keep one AGENTS.md in the repository root: Codex reads it by default, and Claude Code reads it while no CLAUDE.md exists.

Don't let both agents edit the same file at once; you'll get clashes that neither one can explain. Let Codex build and Claude Code review, or the reverse, and ask the reviewer to read the builder's diff and list bugs, missing tests and unclear names before anything merges. One model tends to repeat its own mistakes, and a second model reading the diff catches some of them.

Codex vs Claude Code before and after

The same request, asked two ways. Read the second one slowly. Each line does a job.

BeforeWhat most people type
Fix the login bug.
AfterThe rewrite
Goal: users with a trailing space in their email can log in again.
Files: read src/auth/login.ts and tests/auth/login.test.ts. Change only files under src/auth/.
Tests: run npm test -- auth and make sure it passes.
Stop condition: stop and ask me if the fix needs a database change or if a test fails for a reason you can't explain.

Why it works

The rewrite names the files, the proof of success and the point to stop, so the agent can't wander into unrelated code or declare victory without running the tests.

Codex vs Claude Code examples

Task brief that works in Codex and Claude Code

The four labelled lines give either agent a goal, a boundary, a proof and an exit.

Goal: {{goal}}
Files: read {{read_files}} first. You may change only {{change_scope}}.
Tests: run {{test_command}} and report the result.
Stop condition: stop and ask me if {{stop_when}}.
When you finish, list every file you changed in one line each.

How to use
  1. Copy it with the button above.
  2. Fill the blanks in {{double braces}} with your own details.
  3. Paste it into ChatGPT, Claude or Gemini and send it.
  4. Then follow up: ask for one change at a time.

Before you run “Task brief that works in Codex and Claude Code” for the first time, the lesson on how to use AI prompts step by step walks through copying, filling and sending it.

Shared AGENTS.md starter for both tools

One file in the repository root feeds both tools, so a later switch needs no rewrite.

Write an AGENTS.md for a {{stack}} project. Include these sections: build and test commands, folders that are off limits, code style rules, definition of done, and branch rules. Keep it under {{max_lines}} lines. Use short imperative sentences, and write only rules a new teammate could follow without asking me.

Ask the second tool to review the first one's diff

A different model reads the change cold, so it spots the assumptions the first model repeated.

Review the diff on branch {{branch}} against {{base_branch}}. List bugs first, then missing tests, then unclear names. For each item give the file and line, one sentence on why it matters and a one-line fix. Don't rewrite the code.

How do you write the first prompt for Codex or Claude Code?

To write the first prompt for Codex or Claude Code, state the goal, the files in scope, the test that must pass and when to stop. For a Claude session you can wrap those 4 parts in Extensible Markup Language (XML) tags with the Claude XML prompt builder, and the same brief pastes into Codex unchanged.

Task brief template

  • Goal: 1 sentence on what should be true once the work's finished.
  • Files: the paths to read first and the paths the agent may change.
  • Tests: the exact command that proves success.
  • Stop condition: when to stop and ask, such as after a failing test it can't explain.

The first worked prompt on this page fills the brief in for a real bug, and the third asks the second tool to review the first one's diff.

Codex vs Claude Code FAQ

Still stuck? Build it in Prompt Studio. It'll score each part as you go.

Is today's Codex the same as the 2021 Codex model?

No, today's Codex isn't the 2021 Codex model; the name now covers OpenAI's coding agent in the ChatGPT apps, CLI and cloud. OpenAI first used the name for a code model in 2021, and the agent edits files and runs commands instead of only completing code.

Does Claude Code upload my whole repo?

No, Claude Code doesn't upload your whole repo at once; it sends the files and command output it reads to the model as it works. A cloud session is different: it copies the repository into a hosted sandbox, so check your plan's data controls first.

Can a non-coder use Codex or Claude Code?

Yes, a non-coder can use Codex or Claude Code for small projects, but reviewing the changes still needs someone who reads code. Keep each change small, work on a Git branch and ask the agent to explain every edit before you merge.

Do Codex and Claude Code read each other's instruction files?

No, Codex and Claude Code don't read each other's instruction files by default, so keep one shared text and point both files at it. Codex skips CLAUDE.md unless you add it as a fallback filename in its config, and Claude Code reads AGENTS.md only when no CLAUDE.md exists.

Which handles a large repo better, Codex or Claude Code?

Neither handles a large repo better in every case; the result depends on the instruction file and how tightly you scope each task. Both search the repository on demand instead of loading it whole, so test them on your own code with the same brief.

Make your own in Prompt Studio

Answer a few questions. The prompt's scored as it's built. It's free, and nothing leaves your browser.