Run Anthropic's Claude Code and OpenAI's Codex CLI on the same repository without them getting in each other's way: one instructions file, one git worktree per agent, and each agent reviewing the other's branch. No extra tools required.
Codex reads project instructions from AGENTS.md. Claude Code reads
CLAUDE.md, and since v2.1.277 it also reads AGENTS.md when the
repo has no CLAUDE.md
(Anthropic's docs, October 2026).
So the simplest setup is a single AGENTS.md at the repo root with your build
commands, test commands, and conventions.
If you already have a CLAUDE.md, keep it and import the shared file from it, so both agents get the same rules:
# CLAUDE.md
@AGENTS.md
# Claude-only notes go below the import.
Two agents in one folder edit the same files on the same branch, and their changes get mixed together. Give each its own git worktree: a separate checkout of the same repo on its own branch.
cd ~/code/myapp
git worktree add ../myapp-claude -b search-claude
git worktree add ../myapp-codex -b search-codex
Each worktree only has tracked files, so install dependencies and copy untracked config
such as .env into each one. Then start one agent per worktree, in two terminals:
cd ~/code/myapp-claude && claude
cd ~/code/myapp-codex && codex
The details of running each agent in parallel (tmux, ports, resuming, merging) are in the guides for Claude Code and Codex.
Paste the same prompt into both sessions. When both are done and have committed, compare the two attempts from the main checkout:
cd ~/code/myapp
git diff --stat main search-claude
git diff --stat main search-codex
git diff search-claude search-codex # where the two attempts differ
Run the tests in each worktree, keep the better branch, and delete the other.
Cross-review works the same whether you raced them or split the work. In Claude's worktree,
ask Codex for a review of the branch against main:
cd ~/code/myapp-claude
codex review --base main
And in Codex's worktree, ask Claude Code with a one-off, non-interactive prompt:
cd ~/code/myapp-codex
claude -p "Review the changes on this branch against main (git diff main...HEAD). List bugs and risky changes, most serious first. Don't edit files."
Paste the findings back into the session that wrote the code and let it fix them. Then merge
or open a pull request as usual, and clean up with git worktree remove.
.claude/ for Claude Code, ~/.codex/config.toml for Codex), so set up anything both need in both places.Maestro is a free desktop app built for this. You choose the agent per workspace, and every workspace is its own git worktree and branch, so Claude Code and Codex (plus Cursor, OpenCode, Kimi Code, and Grok Build) run side by side in one window, each with its chat, terminal, and diff. Each agent uses its own CLI and your own account, as it does in the terminal.
More on each agent in Maestro: Claude Code GUI and Codex GUI.
They can, but they'll edit the same files on the same branch and you'll get one mixed diff. Give each its own worktree, as above.
No. On current Claude Code versions an AGENTS.md alone works for both agents.
Keep a CLAUDE.md only for Claude-specific notes, and import
@AGENTS.md from it.
Models change every few months, so test both on your own codebase: race them on a few real tasks (step 3) and keep notes on which one wins which kind of task.
Maestro is an independent project, not affiliated with Anthropic or OpenAI. Claude Code and Codex details above come from their public docs as of October 2026.