Codex vs Claude Code: which should you use, and how do you use both?
Codex vs Claude Code as of November 2026: plans, AGENTS.md vs CLAUDE.md, MCP config, memory, and how to run both on one project.

Don't rely on benchmarks. Pick the agent based on what you are already paying for and how you work. Claude Code is Anthropic's terminal-first agent, available with Claude Pro, Max, Team and Enterprise, or through the Claude Console API. Codex is OpenAI's agent: an open-source CLI (Apache-2.0), an IDE extension, a desktop app and cloud tasks at chatgpt.com/codex, included with ChatGPT plans (the CLI, IDE extension and web from Plus up), or with an API key.
Many teams use both. Typically, one agent writes the change and the other reviews the diff. The real cost of running both is that each one has its own instructions, its own MCP servers and its own memory, so you end up explaining the same project twice. Below is how to give both agents one instruction file, the same tools and one memory. Checked against the official documentation of both vendors as of November 2026.
Codex vs Claude Code: what is the difference?
Both read your repository, edit files, run commands and work from the terminal. The differences that matter once you run more than one agent are in the setup, not in the chat window. A benchmark result is for one version of a model, and both vendors release new models often. So use the agent that is included in the plan you are already paying for.
If your whole team is in ChatGPT and you want to hand work off to the cloud and come back to a finished diff, start with Codex. If you want to steer an agent in the terminal and build on hooks, subagents and plugins, start with Claude Code.
If you are a founder who runs many agents, the question is not "which one should I pick", but rather "how much setup do I have to repeat for each".
Codex CLI vs Claude Code: the setup side by side
| Claude Code | Codex CLI | |
|---|---|---|
| Install | macOS, Linux, WSL: curl -fsSL https://claude.ai/install.sh | bash; Windows: irm https://claude.ai/install.ps1 | iex | npm install -g @openai/codex |
| Account | Claude Pro, Max, Ultra, Team, Enterprise, or Claude Console (not the Free plan) | Sign in with ChatGPT (Plus, Pro, Business, Edu, Enterprise), or an API key |
| Instruction file | CLAUDE.md (also reads AGENTS.md, see below) | AGENTS.md, at most one file per directory, 32 KiB in total by default |
| MCP config | claude mcp add, scopes local, project (.mcp.json) and user | ~/.codex/config.toml or codex mcp add; .codex/config.toml in trusted projects |
| Memory | Auto memory, on by default, ~/.claude/projects/<project>/memory/ | Memories, off by default, under ~/.codex |
| Resume | claude --continue, claude --resume | codex resume, codex exec resume <SESSION_ID> |
| Headless | claude -p "..." | codex exec "..." (read-only sandbox by default) |
| Guardrails | Hooks: your shell commands at fixed points of the session | Sandbox modes read-only, workspace-write, danger-full-access |
| Default model | Opus 5.5 on paid plans and the API | A recommended model, unless you set model in config.toml |
How do you share one instruction file between Codex and Claude Code?
Keep AGENTS.md as the one file and put a CLAUDE.md next to it that imports it. Codex reads AGENTS.md. Claude Code reads CLAUDE.md.
Since version 2.1.277 (2.1.281 for some sessions, such as Amazon Bedrock), Claude Code can read AGENTS.md too, but only if there is no CLAUDE.md or CLAUDE.local.md in your working directory or any directory above it. This creates a trap: if a teammate adds a CLAUDE.local.md to their copy of the project for personal notes, Claude stops reading AGENTS.md for this person, and nothing tells you.
To avoid this, create a CLAUDE.md in the same directory as AGENTS.md, with the import on the first line and Claude-only notes below it:
@AGENTS.md
## Claude Code
Use plan mode for changes under `src/billing/`.
According to the Claude Code documentation, keeping this import never makes Claude read AGENTS.md twice. You can also type /config and set Project instructions to claude-md-and-agents-md, so Claude reads both files.
The reverse does not work well. Codex reads CLAUDE.md only if you list it in project_doc_fallback_filenames in ~/.codex/config.toml, and it checks fallback names only in a directory with no AGENTS.md. Also keep in mind that Codex caps the combined instructions at 32 KiB by default (project_doc_max_bytes), so keep the file short. For what loads in Claude Code and when, see How does memory work in Claude Code?
Do MCP servers have to be added to both?
Yes. The two tools store the MCP configuration in different places and in different formats, so you add each server twice.
With Claude Code, a remote server is one command. --scope project writes a .mcp.json to the repo root, which your team shares through git; --scope user makes it available in all your projects:
claude mcp add --transport http --scope user docs https://mcp.example.com/mcp
With Codex, add it from the command line, or write it into ~/.codex/config.toml yourself. A trusted project can have its own .codex/config.toml:
codex mcp add docs --url https://mcp.example.com/mcp
codex mcp login docs
[mcp_servers.docs]
url = "https://mcp.example.com/mcp"
Both tools support remote servers over streamable HTTP and OAuth sign-in. So every server you want to use with your agents, you add to both tools, on every machine that does not share a project file. Tip: keep a short list of the servers you use and their URLs in AGENTS.md, so a new agent can use that list to set itself up. If you are still choosing a memory server, see MCP memory.
Do Codex and Claude Code share memory?
No. By default, auto memory is on for local sessions of Claude Code. It is saved in ~/.claude/projects/<project>/memory/ and is local to the machine. In Codex, memories are off by default. To enable them, add memories = true under the [features] section of your config.toml. Codex saves the memories under ~/.codex, and they are separate from the memory used by ChatGPT.
By default, neither Claude Code nor Codex can read the memory of the other. Neither can reach the memory of a teammate on another machine.
The history of a session is separate as well. You can continue or resume a session with:
claude --continueorclaude --resumecodex resumecodex exec resumewith a session id
So if you explain a decision to Claude on Monday and start a new session with Codex on Tuesday, Codex has no knowledge of it.
How do you use Claude Code and Codex together?
OpenAI publishes an official plugin that runs Codex from inside Claude Code: openai/codex-plugin-cc, licensed under Apache-2.0. Install it in a Claude Code session:
/plugin marketplace add openai/codex-plugin-cc
/plugin install codex@openai-codex
/reload-plugins
Then run /codex:setup to check that it is ready. Once installed, you can use several commands:
/codex:review: a read-only review of your current work./codex:adversarial-review: a review that challenges design choices and assumptions./codex:rescue: hands a task, such as a bug investigation or a fix, to Codex./codex:transfer: starts a Codex thread from the current Claude Code session.
To use the plugin, you need Node.js 18.18 or later, the Codex CLI installed, and either a ChatGPT sign-in (the free plan is enough) or an API key. Its runs count against your Codex usage limits.
If you run several agents in parallel, keep them isolated. A simple rule to follow is: one agent, one git worktree, one branch. This way agents do not modify the same files at the same time. Let one agent implement and the other review the diff, so the reviewer is not checking its own code.
How do you give Codex and Claude Code one memory?
The instruction file is where you tell agents how the code works. You should not use it to store customer notes, decisions or plans. Substrate is one memory that both you and your agents can read and edit. It has plugins for both Claude Code and Codex, so both agents recall the same context and save what you work on.
To install Substrate, paste this into either agent:
Install Substrate memory in this agent by following https://trysubstrate.co/install.md
You approve the connection in your browser, and you can revoke it at any time. You can also share a page with specific people by email invite, view-only, and revoke access at any time. There is a 7-day trial and you do not need a card. After that it is $20 per month for one person and all of their agents.
If you are working on your own in a single repo, AGENTS.md plus the import is enough.
Frequently asked questions
Is Codex better than Claude Code?
Neither wins outright, and benchmark results change with each model release. Start with the agent included in the plan you already pay for: Claude Code with Claude Pro, Max, Ultra, Team or Enterprise, Codex with a ChatGPT plan (the CLI from Plus up) or an API key. Many teams use both, one to implement and one to review.
Can Claude Code read AGENTS.md?
Yes, since Claude Code v2.1.277, but by default only when there is no CLAUDE.md or CLAUDE.local.md in your working directory or above it. To use both, put @AGENTS.md on the first line of a CLAUDE.md, or set Project instructions to claude-md-and-agents-md in /config.
Can I use Codex inside Claude Code?
Yes. OpenAI's official plugin openai/codex-plugin-cc adds /codex:review, /codex:adversarial-review, /codex:rescue and /codex:transfer to Claude Code. It needs the Codex CLI and a ChatGPT sign-in (the free plan is enough) or an OpenAI API key.
Do Codex and Claude Code share memory?
No. Claude Code auto memory lives in ~/.claude/projects/<project>/memory/ on one machine; Codex memories are off by default and live under ~/.codex. Neither reads the other's, so a shared memory has to come from outside both, for example an MCP server or a plugin both agents load.
Is the Codex CLI open source?
Yes. The Codex CLI repository, github.com/openai/codex, is licensed under Apache-2.0. You install it with npm install -g @openai/codex and sign in with ChatGPT or an API key.


