Three ways to make Claude Code and Codex work together: a shared AGENTS.md, OpenAI's Codex plugin, and counterpoint for cross-review.
swanbase cover for the guide to making Claude Code and Codex work together

Claude Code and Codex can work on the same codebase, and there are three setups for bringing them together.

The first is a shared instructions file: an AGENTS.md that both agents read at startup. The second is OpenAI's official Codex plugin, which adds review and delegation commands to Claude Code. The third is counterpoint, an open source tool that has Codex review every Claude task, with an executable test for each serious bug.

Start with the AGENTS.md in any repo where both tools run. Use the plugin for a one-off review before a commit, and install counterpoint if every task should go through a second model. All three setups run on your Claude and ChatGPT subscriptions, with no OpenAI API key billed per token.

The three setups for making Claude Code and Codex work together: a shared AGENTS.md, the official Codex plugin and counterpoint, with how each one starts and what it costs

Why make Claude Code and Codex work together

"Claude Code vs Codex" comparisons fill almost the entire first page of Google on this topic. For a team that already pays for both subscriptions, they ask the wrong question: the value comes from having one review the other's work.

Two labs, two kinds of mistakes

A model reviewing its own work keeps its blind spots. It wrote the code with the same weights that are now reviewing it, so it misses the same errors. A model trained by a different lab makes mistakes in different places, and it sees what the first one misses.

A study published in July 2026 quantifies this gain, and the direction matters. Zuodong Xiang and three co-authors measured cross-review between Claude and Codex on 116 coding tasks of medium and hard difficulty:

  • Claude reviewing Codex's drafts raises the success rate from 71.6% to 89.7%.
  • Codex reviewing its own drafts brings them to 84.5%.
  • Codex reviewing Claude's drafts drops the rate from 91.4% to 82.8%.
  • Claude reviewing its own work leaves the rate at 91.4%.

Success rates on 116 coding tasks by reviewer: Claude reviewing Codex raises the rate from 71.6% to 89.7%, Codex reviewing Claude lowers it from 91.4% to 82.8%

In this study, the reviewer saw the problem and the draft but could not run tests. Its advice was applied as is. An unverified critique can therefore degrade correct code. The right setup verifies each Codex comment before acting on it, and that is the principle behind counterpoint.

The cost of collaboration: two subscriptions and time

Running both agents requires a Claude account for Claude Code and a ChatGPT account for Codex. The official plugin also accepts the ChatGPT Free plan or an OpenAI API key, and every call counts against your Codex usage limits. The real cost is measured in minutes: a Codex review takes anywhere from a few dozen seconds to several minutes depending on the size of the change.

When one agent is enough

A question, a code explanation, or a variable rename doesn't warrant a second opinion. Save cross-review for changes that are expensive to get wrong: a data migration, authentication, a billing calculation, a script that runs unattended in production.

One AGENTS.md for Claude Code and Codex

Both agents read an instructions file at the start of each session. If your guidelines live in two separate files, one of them eventually drifts, and Codex ends up reviewing Claude's code without knowing the rules Claude followed.

How Codex reads AGENTS.md

Codex first reads ~/.codex/AGENTS.md for your global guidelines, then every AGENTS.md from the repo root down to the current directory. Files closest to the current directory come last, so their guidelines win. By default, Codex stops at 32 KiB of combined guidelines (the project_doc_max_bytes setting).

To make it read a CLAUDE.md too, add that name to the fallback list in ~/.codex/config.toml:

project_doc_fallback_filenames = ["CLAUDE.md"]

Codex reads only one file per directory: an existing AGENTS.md takes precedence over a CLAUDE.md in the same directory.

How Claude Code reads AGENTS.md

Since version 2.1.277, Claude Code reads an AGENTS.md directly when the repo has no CLAUDE.md, according to the Claude Code memory documentation. A repo already set up for Codex works as is. In an interactive session, Claude Code shows a line like no CLAUDE.md found; AGENTS.md loaded.

If the repo also contains a CLAUDE.md or a CLAUDE.local.md, Claude Code reads only those by default. The Project instructions setting in /config changes this behavior: the value claude-md-and-agents-md loads both sets of files.

Table of the instruction files Claude Code and Codex read depending on the repo: AGENTS.md only, AGENTS.md and CLAUDE.md, CLAUDE.md importing AGENTS.md, CLAUDE.md only

A repo with a CLAUDE.md: the @AGENTS.md import

Keep AGENTS.md as the single source of truth and reduce CLAUDE.md to an import, followed by any Claude-specific guidelines:

@AGENTS.md

## Claude Code

Use plan mode for any change under src/billing/.

If you have no Claude-specific guidelines, a symlink is enough: ln -s AGENTS.md CLAUDE.md. This shared file also serves as the foundation for the other two setups, since Codex reviews Claude's work against the same rules. To go further, read our guide to Claude Code skills and our method for turning AGENTS.md into the index of an AI second brain.

Calling Codex manually with codex exec

Before you install anything, Claude Code can already run Codex like any other terminal command. codex exec runs a task without a UI and returns the final answer on standard output.

A read-only review pass

By default, codex exec runs in a read-only sandbox: Codex reads files and can't modify anything. Keep that setting for a review. The --sandbox workspace-write option allows changes when you delegate a fix.

For example, ask Claude:

Run codex exec to review the current branch's diff against main,
write its answer to review.md, then verify each comment before fixing anything.

Codex also has a dedicated command, codex review, which reviews a change without a UI.

Prompt via stdin, answer to a file

Pass long instructions to Codex through standard input rather than as an argument: codex exec - < prompt.md. A prompt several hundred lines long quickly exceeds the maximum command-line length. The -o review.md option (--output-last-message) writes the final answer to a file that Claude then reads. The --json option outputs each Codex step as JSON Lines, which is handy for scripting.

The limitation: context you have to copy over

With codex exec, Codex only knows what you pass it. If it reviews a diff without the original request or the project guidelines, it judges the code by its own taste and suggests off-topic changes. On every call, give it the request exactly as you wrote it, the AGENTS.md, and the diff. The next two setups handle this for you.

The official Codex plugin for Claude Code

On March 30, 2026, OpenAI released codex-plugin-cc, a plugin that calls Codex from a Claude Code session. The repo, licensed under Apache 2.0, had passed 34,000 GitHub stars by early November 2026. The plugin goes through the Codex CLI installed on your machine: it reuses your login, your configuration, and your Codex MCP servers.

Install the plugin in four commands

The plugin requires Node.js 18.18 or newer. In Claude Code, type:

/plugin marketplace add openai/codex-plugin-cc
/plugin install codex@openai-codex
/reload-plugins
/codex:setup

/codex:setup checks that Codex is installed and logged in, and offers to install it with npm if it's missing. If you installed Codex without logging in, run !codex login from Claude Code.

/codex:review and /codex:adversarial-review

According to the plugin's README, /codex:review runs the same review as /review in Codex, on your uncommitted changes or on a branch with --base main. This review doesn't take instructions: it looks for defects in general.

/codex:adversarial-review accepts free text after the options, so you can target a specific risk:

/codex:adversarial-review --base main check concurrent access on the queue and challenge the retry strategy

Both commands stay read-only. On a change spanning several files, add --background, then follow along with /codex:status and /codex:result.

The eight Codex plugin commands in Claude Code, from /codex:review to /codex:setup, grouped by use

/codex:rescue and /codex:transfer for delegation

/codex:rescue hands a task to Codex through a subagent, codex:codex-rescue, visible in /agents. Use it for a bug Claude can't pin down, a flaky test, or a quick pass with a lighter model (--model gpt-5.4-mini --effort medium). The --resume option picks up the last task handed to Codex in the repo.

/codex:transfer creates a Codex thread from the current Claude Code session and prints a codex resume <id> command. You continue the same conversation in Codex, history included.

The review gate and its Stop hook

/codex:setup --enable-review-gate adds a Stop hook. At the end of each Claude response, Codex runs a targeted review, and Claude has to address any issues found before handing control back. The README warns that this loop can run for a long time and drain your usage limits quickly. Only turn it on during a session you're actively watching. Our article on Claude Code hooks explains how they work.

counterpoint: automatic cross-review

counterpoint is an open source Claude Code skill, licensed under MIT, that runs every task through Claude and then Codex. Version 3.0, released on November 3, 2026, builds on the finding from the study above: Codex reviews, but Claude verifies each comment before touching anything.

Claude writes, Codex reviews, Claude decides

In small mode, the default, Claude does the task as usual. Codex reviews the work in the background while Claude runs its own tests. Each issue raised comes with a precise location, evidence, and a proposed fix. Claude checks each comment against the code and tests, then applies it or rejects it with a reason. The turn ends with one decision line per comment:

F1 applied (bug test now passes)
F2 rejected: the cited input is rejected earlier by parse_args (line 40)

Run it with /counterpoint followed by the task: /counterpoint fix the timeout parsing in config.sh.

A test for every serious bug

For serious issues in executable code, Codex writes a small test that fails as long as the bug exists. counterpoint runs this test in a few seconds on a copy of the project. A REPRODUCED result proves the bug. NOT reproduced flags a likely false alarm, or a badly written test. After the fix, counterpoint verify reruns the tests, and the turn can't close while a proven bug still has a failing test.

The study above denied its reviewer any tests. counterpoint fixes that gap: a Codex comment becomes either a verified fact or a false alarm, instead of an opinion you take on faith.

Small mode and full mode

The repo publishes its timings, measured with Codex on November 3, 2026:

Mode Flow Measured time
small, bug tests off Claude produces, Codex reviews 22 to 31 s
small, bug tests on same, 3 bugs found and 3 tests written 40 to 47 s
full two plans, two judges, production, review, cross-check 349 s on a complete task

In full mode (/counterpoint full <task>), Claude and Codex each write a plan without seeing the other's.

Two judges score both plans blind on five criteria: Codex, and a fresh Claude session with no tools and no memory of the plans. The plans arrive labeled A and B, in random order.

If Codex's plan leads by 2 points with each judge, Codex writes and Claude reviews, the direction the study found most useful. Otherwise, Claude writes and Codex reviews with its bug tests. Finally, Codex cross-checks the fixes in its review thread.

Save full mode for work where the wrong approach is expensive: an architecture, a long document, a multi-step refactor.

The counterpoint 3.0 loop: in small mode Claude produces and Codex reviews with a test for each serious bug, in full mode two plans and two blind judges

Context parity

counterpoint gives Codex the original request word for word, the constraint files (--context AGENTS.md, the skill, the spec), and the work to review. A reviewer that has never read a constraint can't check it. That's the weakness of a manual review with codex exec, and counterpoint solves it on every call.

Memory of false alarms

Every rejected comment is remembered for the project, outside the repo, in ~/.counterpoint/projects/. Later reviews receive the recent rejections, and Codex stops raising the same false issues. counterpoint stats shows the share of comments accepted per category, and counterpoint forget clears the history.

Installing counterpoint

You need Claude Code and the Codex CLI logged in to your ChatGPT account (npm i -g @openai/codex, then codex login). Then:

git clone https://github.com/tns-research/counterpoint
mkdir -p ~/.claude/skills
ln -s "$PWD/counterpoint/skills/counterpoint" ~/.claude/skills/counterpoint
counterpoint/skills/counterpoint/bin/counterpoint doctor

doctor checks the installation. To run every turn through counterpoint without typing the command, register the repo's two hooks (hooks/prompt.sh and hooks/stop.sh) in ~/.claude/settings.json, then pick counterpoint mode small, full, or off. The Stop hook refuses, once, to end a turn that was neither reviewed nor waived with counterpoint skip. The second attempt goes through and is logged in ~/.counterpoint/escapes.log, so a session never stays stuck.

On the security side, Codex starts with an empty environment: your exported keys don't reach it, except the ones you list. It runs with --ignore-user-config, so without your MCP servers. Review, planning, and cross-checking stay read-only, and bug tests run in a throwaway copy of the project with a 30-second limit. counterpoint works on Linux and macOS, including stock Macs.

Official plugin or counterpoint: the decision table

Criterion codex exec Official Codex plugin counterpoint
Trigger manually, by Claude a /codex:... command /counterpoint or every turn with the hooks
Context given to Codex whatever you copy over your working tree or a branch request, constraints, and work, on every call
Comment verification up to you up to you Claude verifies each comment, backed by bug tests
Delegation to Codex --sandbox workspace-write /codex:rescue, /codex:transfer in full mode, if Codex's plan wins
End-of-turn safeguard none review gate (Stop hook), optional Stop hook, and the turn can't close without a decision
Added time varies a few seconds to several minutes 22 to 47 s in small, about 6 min in full

Pick the plugin for a pre-commit review or to hand a stuck task to Codex. Pick counterpoint when every sensitive task should go through both models, with a written decision for each comment. The two coexist in the same Claude Code installation.

Five common mistakes

Applying a Codex critique without checking it. The 116-task study shows a drop from 91.4% to 82.8% when Codex reviews Claude and its advice is applied as is. Read the cited line, run the problematic input, then decide.

Leaving the review gate running unattended. The loop between Claude and Codex can drag on and eat your limits on both sides. Turn it off with /codex:setup --disable-review-gate when you leave the session.

Reviewing without context. A review without the request or the AGENTS.md produces taste-based comments and misses the project's written constraints. Always pass both.

Keeping two guideline files. A CLAUDE.md and an AGENTS.md maintained separately end up contradicting each other. Make one an import of, or a link to, the other.

Running Codex in a container without checking its sandbox. In some containers, the Codex sandbox fails to start. Codex then reads the files and returns a "blocked" report, with no error code. Read the output, not just the exit code. counterpoint tests the sandbox before writing and refuses to write outside the sandbox without the --allow-bypass option.

Five common mistakes when making Claude Code and Codex work together, and how to fix each one

The Claude Code guide covers the basics of Anthropic's agent, and our article on ChatGPT Work explains how Work and Codex share the same engine and the same credits.

Two agents reviewing each other's work catch more errors than one, provided one of them verifies every comment before acting on it.

FAQ

Can you use Codex inside Claude Code?

Yes. OpenAI's official codex-plugin-cc plugin adds review commands (/codex:review, /codex:adversarial-review) and delegation commands (/codex:rescue, /codex:transfer) to Claude Code. Claude Code can also run codex exec like any other command, and counterpoint has Codex review every task automatically.

Do you need an OpenAI API key?

No. The plugin and counterpoint go through the Codex CLI logged in to your ChatGPT account with codex login, and usage counts against your subscription limits. The plugin also accepts an API key if you'd rather pay per token.

Can Codex read Claude Code's CLAUDE.md?

Yes, if you add project_doc_fallback_filenames = ["CLAUDE.md"] to ~/.codex/config.toml. Codex then reads a directory's CLAUDE.md when that directory has no AGENTS.md. The simplest option is still a single AGENTS.md that both agents read, with a CLAUDE.md that imports it via @AGENTS.md.

Can Codex use Claude Code plugins?

Not directly: each tool has its own plugin system. The reverse direction does exist, though. Sendbird's open source cc-plugin-codex plugin installs in Codex and calls Claude Code to review or take over a task, with commands like $cc:review and $cc:rescue.

Do you have to choose between Claude Code and Codex?

No, if you already pay for both subscriptions. According to the July 2026 study on 116 tasks, Claude reviewing Codex raises the success rate from 71.6% to 89.7%. Keep one main agent for writing and the other for reviewing, and verify every comment.