Use Claude Code and Codex together: one instructions file, a worktree each, and handing work across
Dmitriy Solodukha · Updated · 4 min read
Checked against Caprock v0.199.0
Run Claude Code and Codex on one project: an AGENTS.md both read, a worktree each, OpenAI's Codex plugin for Claude Code, and two separate usage limits.
Keep one instructions file both agents read — AGENTS.md, which Codex reads and Claude Code reads too — give each agent its own git worktree, and hand work across with OpenAI's Codex plugin for Claude Code (/codex:review, /codex:rescue). The two draw on separate usage limits, Anthropic's and OpenAI's, so when one runs out the other usually has room.
Caprock runs Claude Code and Codex side by side in tabs and split panes, shows both plan windows so you see which agent has room, and hands a session to the other agent with a summary you edit first. Free and open source.
One instructions file for both
| File | Claude Code | Codex |
|---|---|---|
CLAUDE.md | yes | only if listed in project_doc_fallback_filenames |
AGENTS.md | from v2.1.277, when there is no CLAUDE.md; always through @AGENTS.md or the Project instructions setting | yes |
AGENTS.override.md | no | yes, before AGENTS.md |
Write the project's rules — commands, conventions, what not to touch — in AGENTS.md. If you also need a CLAUDE.md, start it with the import so both agents read the same rules:
@AGENTS.md
# Claude only - Use the test-runner subagent for the integration suite. ```
Codex reads at most one instructions file a folder, from the repository root down to where it runs, 32 KiB in all by default; Claude Code follows imports up to four levels deep. What belongs in the file: CLAUDE.md.
Give each agent its own worktree
Two agents editing one checkout overwrite each other's work and confuse each other's view of the tree. A git worktree each keeps them apart:
- Claude Code:
claude --worktree feature-amakes.claude/worktrees/feature-a/on a branchworktree-feature-a. A.worktreeincludefile copies gitignored files such as.env. - Codex CLI:
codex exec --worktree "…",codex fork <id> --worktree, or/worktreein the terminal UI. - The Codex app puts its worktrees under
$CODEX_HOME/worktreeson a detached HEAD and keeps the 15 most recent; create a branch before you push.
Setup, cleanup and the base branch: Claude Code worktrees.
Hand work from Claude Code to Codex
OpenAI publishes a Claude Code plugin (Apache-2.0) that calls Codex from inside a Claude Code session:
- 1
/plugin marketplace add openai/codex-plugin-cc
- 2
/plugin install codex@openai-codex
- 3
/reload-plugins
- 4
/codex:setup
/codex:review— a read-only Codex review of your changes, against a base with--base <ref>;/codex:adversarial-reviewargues against them./codex:rescue— hands a task to Codex through a subagent, in the background if you ask./codex:transfer— turns the Claude session into a Codex thread and prints thecodex resumecommand to open it.
It needs a ChatGPT plan (Free included) or an OpenAI API key, and Node 18.18 or later; what it does counts against your Codex limits. Older posts add Codex to Claude Code as an MCP server with codex mcp-server: OpenAI has removed it.
The other direction, and plain files
No plugin goes from Codex to Claude Code. The plain way works both ways: one agent writes its plan to a file in the repository, the other is told to read it. A plan in a file survives either agent's context compaction, and you can read it before anything runs.
Two usage limits, not one
- Claude: Pro and Max have a 5-hour and a weekly limit, shared between claude.ai and Claude Code.
- Codex: Plus and Business have a 5-hour limit, weekly limits may also apply, and Pro currently has no 5-hour limit; they are shared with your ChatGPT plan's other uses.
So running both is also how people keep working when one stops. Prices and what each cost on one machine: Codex vs Claude Code.
What Caprock adds: both agents in one window
Caprock is a free, open-source desktop app for macOS, Windows and Linux that runs Claude Code, Codex, OpenCode and Gemini CLI in real terminal tabs:
- Side by side. Up to four panes a tab; New agent or the palette starts an agent in a new worktree when you choose.
- Two sessions, one checkout. When two live sessions work in the same folder, a chip says so, turns amber once files are touched by both, and offers Move to a worktree….
- Continue in the other agent. Continue in… starts Codex (or Claude Code, OpenCode, Gemini CLI) in the same folder with a summary of the session as its first message; you read and edit it before anything is sent.
- Which one has room. Claude's and Codex's 5-hour and weekly windows on two matching cards.
- What each cost. Both priced at list price per repository, the sessions you start in your own terminal included.
What it does not do: route a task to an agent on its own. You pick the agent; Caprock shows the windows and the cost.
Which setup to use
- AGENTS.md and two terminals — you switch now and then; nothing to install.
- The Codex plugin — Claude Code is your main agent and you want Codex's review or a second pair of hands from inside it.
- Caprock — you run both every day and want them, their limits and their cost in one window.
Questions people ask
- Can Claude Code and Codex work on the same project?
- Yes. Keep the rules in AGENTS.md, which Codex reads and Claude Code reads too (from v2.1.277, when there is no CLAUDE.md, or through an @AGENTS.md import), and give each agent its own git worktree so their edits never land in one checkout.
- Does Claude Code read AGENTS.md?
- Yes, from v2.1.277, when the folder and its parents have no CLAUDE.md. If both exist it reads only CLAUDE.md, unless CLAUDE.md imports the other with @AGENTS.md or the Project instructions setting is set to load both.
- Does Codex read CLAUDE.md?
- Not by default. Codex reads AGENTS.override.md and AGENTS.md, plus any names you list in project_doc_fallback_filenames.
- How do I call Codex from Claude Code?
- Install OpenAI's plugin: /plugin marketplace add openai/codex-plugin-cc, then /plugin install codex@openai-codex. It adds /codex:review, /codex:rescue and other commands; its use counts against your Codex limits. The old codex mcp-server route has been removed.
- Do Claude Code and Codex share a usage limit?
- No. Claude Code shares its 5-hour and weekly limits with claude.ai; Codex shares its limits with your ChatGPT plan's other uses. When one is out, the other usually has room.
Sources
- Claude Code docs — How Claude remembers your project: AGENTS.md, @imports, read 27 November 2026
- OpenAI — Custom instructions with AGENTS.md: discovery order, project_doc_fallback_filenames, read 27 November 2026
- openai/codex-plugin-cc on GitHub (Apache-2.0): Codex plugin for Claude Code, read 27 November 2026
- OpenAI — Codex CLI reference: --worktree, the removed mcp-server, read 27 November 2026
- OpenAI — Codex app: Git worktrees, read 27 November 2026
- Claude Code docs — Worktrees: --worktree, .worktreeinclude, read 27 November 2026
- Claude Help Center — Using Claude Code with your Pro or Max plan: five-hour and weekly limits, read 27 November 2026
- OpenAI — Codex pricing and limits, read 27 November 2026
- Caprock CHANGELOG — 0.63.0 Codex plan limits, 0.70.0 Continue in another agent, 0.78.0 split panes, 0.116.0 files touched by both
Try it
The record of every coding agent you run, the sessions it did not start included. Free, open source; nothing leaves your machine.
Caprock is a desktop app: it installs on your computer, not your phone.
Or email yourself the link:
macOS, Windows and Linux. Your phone pairs with it by QR code. Install options →
Notarized by Apple. One file for Apple silicon and Intel, macOS 13 or later.
Windows 10 22H2 or later, x64. Windows may ask once whether to run it: click More info, then Run anyway.
Paste it into Claude Code, Codex or any coding agent.
See what it says ▾
Install the Caprock desktop app for me. It is open source (Apache-2.0), a local app for my coding agents: https://github.com/dspv/caprock What the install does and how to remove it: https://github.com/dspv/caprock/blob/master/docs/install-agent.md Run the install script for my system: https://caprock.dev/mac.sh, /win.ps1 or /linux.sh. Read it before you run it if you like. Leave my Claude Code settings alone; the app asks me itself. Tell me when it's open.
Or run it yourself:
Paste in Terminal: it installs Caprock and opens it.Or with Homebrew: brew install --cask dspv/tap/caprock-app
Or run it yourself:
Paste in PowerShell: it installs Caprock for you and opens it.
Or run it yourself:
Paste in a terminal: it installs Caprock for you, no sudo. Or download the AppImage