Codex vs Claude Code: How Each Company Says to Work With It
Published · 7 min read
By Cong Le · Pocket Grove
Original research brief: . Sources reviewed: .
Quick answer: Codex vs Claude Code is less a contest than two dialects of the same workflow. OpenAI and Anthropic both say: keep a short instruction file (AGENTS.md or CLAUDE.md), plan before complex work, give the agent tests to run, keep permissions tight, use separate worktrees for parallel tasks, and review with a fresh pair of eyes.
People often ask which AI coding agent is better. That is not what this post is about. Instead, we read what each company officially recommends and lined the advice up side by side. If you use both tools, as we do, it helps to know where the habits match and where the controls differ.
For the bigger picture of where these tools fit in the software development lifecycle, start with our series hub.
What are Codex and Claude Code?
Both are AI coding agents: tools that read your code, edit files and run commands for you, rather than just suggesting snippets.
- Codex is OpenAI's coding agent. It runs as a command-line tool, in your editor, in a desktop app, and in the cloud.
- Claude Code is Anthropic's coding agent. It runs in the terminal, in VS Code, in a desktop app and in scripts.
Our sources are OpenAI's Codex best practices and Agent approvals and security pages (the old developers.openai.com links now redirect there), and Anthropic's Best practices for Claude Code.
Codex vs Claude Code: how do the instruction files compare?
An instruction file is a plain text file in your repo that the agent reads at the start of every session.
Codex uses AGENTS.md. OpenAI calls it "an open-format README for agents". Its guide says to cover repo layout, build and test commands, conventions, things not to do, and what "done" means. You can have a global file in ~/.codex, one per repo, and more in subfolders; the closest file wins. /init gives you a starter. OpenAI's advice is to keep it short and only add rules after you see the same mistake repeat.
Claude Code uses CLAUDE.md. Anthropic says to keep it short and include only what Claude cannot see from the code: exact test and lint commands, misleading parts of the codebase, decisions made outside the repo, and anything you have had to correct twice. It also has /init for a first draft, and its memory guide suggests staying under 200 lines.
Same idea, different filename. We go deeper in AGENTS.md vs CLAUDE.md and Stop putting everything in CLAUDE.md.
Both tools also support skills: a SKILL.md file that packages a repeatable procedure. OpenAI's rule of thumb is that if you keep repeating the same prompt or correction, make it a skill. Anthropic says team procedures such as a release process belong in skills, which the agent only reads in full when the task calls for it.
How does each tool say to plan?
Codex has a plan mode (/plan or Shift+Tab). It gathers context, asks clarifying questions and proposes a plan before writing code. OpenAI recommends planning for complex, ambiguous or hard-to-describe tasks. For long, multi-step work it suggests a PLANS.md template, and for a fuzzy idea you can ask Codex to interview you.
Claude Code's best-practices page suggests the same interview trick: ask Claude to question you until it could write the spec, save it as SPEC.md, then start a fresh session to build from it. That gives the build a clean context and a written definition of done.
Sandbox and approvals: how do the safety controls differ?
This is where the two tools look most different on the surface.
Codex separates two controls:
- Sandbox mode sets what Codex can technically touch:
read-only,workspace-write(the default "Auto" preset in version-controlled folders), ordanger-full-access, which OpenAI does not recommend. - Approval policy sets when it must ask you: for example
on-request, where edits outside the workspace and network access need your approval.
Network access is off by default. OpenAI's guide says to start with tight permissions and loosen them only for trusted repos.
Claude Code layers its controls differently:
- Permission modes. New terminal and VS Code sessions start in auto mode, where a classifier reviews risky actions before they run. Manual mode asks about every edit and non-read-only command.
bypassPermissionsapproves almost everything and, Anthropic says, only makes sense in a disposable container. - Permission rules and the sandbox. Deny rules block specific tools or files; the OS-level sandbox (
/sandbox) confines shell commands' file and network access. - Hooks. Scripts that run at set moments, for steps that must always or never happen.
Anthropic's key point is that a prompt cannot guarantee a rule. If something must never happen, use a deny rule, the sandbox or a hook.
How do you run tasks in parallel?
Both recommend Git worktrees: a separate checkout of the same repo, so two tasks cannot overwrite each other's files.
- OpenAI warns not to run live tasks on the same files without worktrees, and says subagents can take bounded jobs like exploration, tests or triage off the main thread.
- Anthropic recommends giving each separate piece of work its own checkout, for example
claude -w feature-auth. It notes a worktree is a fresh checkout, so gitignored files like.envand installed dependencies are not there by default. It also covers subagents, which run in the background and keep long output out of your main conversation.
How does each tool review code?
Both companies say not to stop at "the agent says it's done".
Codex: OpenAI says to have Codex write or update tests, run the suites, run lint and type checks, then review the diff. The /review command can review against a base branch, uncommitted changes or a specific commit. You can keep review standards in a code_review.md referenced from AGENTS.md.
Claude Code: Anthropic's headline advice is to give Claude a check to run, such as a test file, build exit code or linter. /code-review reviews the diff in a fresh subagent that never saw your conversation, so the reasoning that produced the code does not sway it. A Stop hook can refuse to let Claude finish until your check passes.
Choose by situation
No verdict here, just which documented feature fits which job.
| Your situation | In Codex | In Claude Code |
|---|---|---|
| Teaching the agent your repo's rules | AGENTS.md, global plus repo plus subfolder |
Short CLAUDE.md, scoped rules for parts of the codebase |
| A vague or large feature | Plan mode or PLANS.md |
Interview into SPEC.md, then a fresh session |
| A repeated procedure | A skill in .agents/skills |
A skill in .claude/skills |
| A rule that must never be broken | Sandbox mode plus approval policy | Deny rules, sandbox, hooks |
| Several tasks at once | Worktrees, subagents | claude -w worktrees, background subagents |
| Checking finished work | Tests plus /review |
A check to run, /code-review, Stop hook |
| Running unattended | Approvals set to never inside the sandbox |
Headless claude -p with pre-approved tools |
What we do at Pocket Grove
In our studio we use both tools across about 53 iOS and Android apps. The way we stop them drifting apart is simple: one real AGENTS.md file, with CLAUDE.md as a symlink to it, so Codex and Claude Code read identical rules. Each app has its own TASKS.md as the plan, shared skills for repeatable work, headless tests the agent can run, and a human approval gate before any store release.
Our honest takeaway: once the instruction file, tests and approval gate are in place, switching between the two tools matters far less than we expected.
Sources
- Codex best practices — OpenAI — https://learn.chatgpt.com/guides/best-practices
- Agent approvals and security — OpenAI — https://learn.chatgpt.com/docs/agent-approvals-security
- Best practices for Claude Code — Anthropic — https://code.claude.com/docs/en/best-practices
Frequently asked questions
- What is the main difference between how Codex and Claude Code want you to work?
- The workflows are very similar: a short instruction file, a plan first for complex work, a check the agent can run, and a separate review. The differences are mostly in names and controls, such as AGENTS.md versus CLAUDE.md and Codex's sandbox modes versus Claude Code's permission modes and hooks.
- Does Codex use AGENTS.md and Claude Code use CLAUDE.md?
- Yes. OpenAI describes AGENTS.md as a README for agents that loads automatically, with global, repo and subfolder levels. Anthropic recommends a short CLAUDE.md holding only what Claude cannot work out from the code.
- How do I review an agent's code in each tool?
- Codex has a /review command that can check against a base branch, uncommitted changes or a specific commit. Claude Code has /code-review, which reviews the diff in a fresh subagent that never saw the conversation.
- Can I run several agent tasks at once safely?
- Both companies recommend separate Git worktrees so parallel tasks do not edit the same files. Claude Code can start a session in a new worktree, and OpenAI warns against running live tasks on the same files without worktrees.
Apps from the studio
All appsThese practices come from shipping Pocket Grove's active apps. If you came here looking for something to install, start with one of these.
Related guides
AGENTS.md vs CLAUDE.md: What They Are and How to Use Both
AGENTS.md vs CLAUDE.md explained: what each file is, how Codex and Claude Code load them, which wins, and how to keep one shared file with a symlink or import.
AI Evals for Beginners: How to Test an AI Feature
AI evals for beginners: how to test an AI feature with clear success criteria, a small test set, code, model and human graders, and regression checks.
The AI Software Development Lifecycle (SDLC), Simply Explained
The AI software development lifecycle in plain English: what AI agents do at each phase from plan to deploy, and what humans still own.