Skip to content
All guides

How-to

How to run Claude Code and Codex on the same project

Use Claude Code and Codex on one repo without them getting in each other’s way: split the work, give each agent its own worktree, port and database, share one AGENTS.md, and have each agent review the other’s changes.

By Updated 11 min read

Banner reading “Claude Code and Codex on the same project”, with the Claude Code and Codex icons.

How should I split work between Claude Code and Codex?

If you pay for both Claude and ChatGPT, you have two capable agents. Pointing both at the same task mostly gets you two answers to reconcile. Pointing them at different tasks doubles what gets done. Splits that work well:

Agent AAgent B
Builds the featureInvestigates an unrelated bug
Writes the changeReviews the diff and lists problems
Works on the app codeWrites tests for it
Refactors one moduleUpdates the docs for it

Neither OpenAI nor Anthropic publishes guidance on which agent is better at which job, so pick roles by what each has built in. Both have a review command, both run headless for work that runs while you’re away (claude -p "…" and codex exec "…"), and Claude Code subagents can each run in their own worktree. Start with the agent you use most as the builder and the other as the reviewer, then swap after a week and keep whichever split leaves you less to fix.

How do I stop the agents overwriting each other’s files?

Two agents editing the same file at the same time overwrite each other’s work. Pick one of these three approaches:

  1. Split by folder

    Tell each agent which folders it may change, for example the API for one and the UI for the other. It is the simplest option, and fine when the tasks don’t overlap.

  2. Give each agent its own worktree

    A Git worktree is a second checkout of the same repo, in its own folder and on its own branch. Each agent edits its own copy, and you merge when both are done. Both agents can create one for you. Claude Code:

    claude --worktree feature-auth   # new worktree in .claude/worktrees/feature-auth

    Add .claude/worktrees/ to your .gitignore. In the Codex CLI, type /worktree in a session, or for a one-off run:

    codex exec --worktree "write tests for src/lib/price.ts"

    In the ChatGPT desktop app, select Worktree under the composer; Codex keeps those worktrees without a branch (detached HEAD). For any agent, or a folder of your choosing, use Git directly:

    git worktree add ../my-app-review -b review   # second checkout on a new branch
    cd ../my-app-review && codex                  # start the agent there
  3. Take turns on shared files

    Let one agent finish and commit before the other touches the same module.

How do I get my .env files into a new worktree?

A worktree is a fresh checkout, so files Git ignores, like .env, aren’t in it. Claude Code and the Codex desktop app both read a file named .worktreeinclude in your repo root, written in .gitignore syntax, and copy the ignored files it lists into each worktree they create. One file covers both agents:

# .worktreeinclude
.env
  • Only files that match a pattern and are gitignored get copied.
  • Claude Code applies it to worktrees it creates; Codex to the worktrees its desktop app manages, not ones you make with git worktree add. Copy those yourself (see the script below).
  • Don’t list a file that should differ per worktree, such as one holding the dev server port.

How do I keep the agents’ dev servers and databases apart?

A worktree separates files and nothing else. Both agents still run on the same computer, so two dev servers want the same port, and two agents pointed at one local database run each other’s migrations. Give each worktree its own port and database. This script creates a sibling worktree, copies your shared .env, creates a Postgres database and writes the worktree’s own values to .env.local:

#!/bin/sh
# Usage: scripts/new-worktree.sh <branch> <port>
set -eu
branch="$1"
port="$2"
repo=$(basename "$(git rev-parse --show-toplevel)")
dir="../$repo-$branch"
db=$(printf '%s_%s' "$repo" "$branch" | tr 'A-Z' 'a-z' | tr -c 'a-z0-9_\n' '_')

git worktree add "$dir" -b "$branch"
[ -f .env ] && cp .env "$dir/.env"    # shared, gitignored settings
createdb "$db"                          # skip if you don't use Postgres
printf 'PORT=%s\nDATABASE_URL=postgresql://localhost/%s\n' "$port" "$db" > "$dir/.env.local"
echo "Ready: $dir  port $port  database $db"

Pass the port on the command line rather than relying on .env files: Next.js reads PORT from the environment or -p, but not from .env, and Vite takes --port. If the project uses Docker Compose, give each worktree its own project name with -p or COMPOSE_PROJECT_NAME, or the agents share containers and volumes. Run your install command in each worktree before the agent starts. When the branch is merged, clean up:

git worktree remove ../my-app-review   # refuses if there are uncommitted changes
git branch -d review
dropdb my_app_review

How do Claude Code and Codex share one AGENTS.md?

Codex reads AGENTS.md before it does any work. Claude Code reads it too, from v2.1.277, as long as there’s no CLAUDE.md or CLAUDE.local.md in your folder or above it; if there is one, Claude reads only the CLAUDE files. (Several popular guides still say Claude Code ignores AGENTS.md; that stopped being true with v2.1.277.) The safest setup: keep the shared rules in AGENTS.md, and if you need a CLAUDE.md, import the shared file from it:

# CLAUDE.md
@AGENTS.md

## Claude Code
Claude-only notes go here.
Claude CodeCodex
Reads AGENTS.mdWhen no CLAUDE.md or CLAUDE.local.md is in the folder or above it, or through @AGENTS.mdAlways
Personal, uncommitted rules~/.claude/CLAUDE.md (loads alongside AGENTS.md)~/.codex/AGENTS.md
Size limitNone stated32 KiB combined by default
Check what loadedRun /context allAsk it to summarize the current instructions

Keep the file short; every line costs context in both tools. An example for a repo where both agents work at the same time:

# AGENTS.md

One-line description of the project.

## Commands
- Install: `npm install`
- Dev server: `set -a; . ./.env.local; set +a; npm run dev -- --port "$PORT"`
- Tests for one file: `npx vitest run path/to/file.test.ts`
- Full checks before committing: `npm run lint && npm test`

## Working alongside another agent
- Another agent may be working in a different worktree on another branch.
  Only change files in your own checkout.
- Your port and database are in .env.local. Don't change them.
- Only one branch adds database migrations at a time. Ask before creating one.

## Code Review Rules
- Flag changes to auth or payments that lack a test.

## Code Review Rules is a Codex convention: Codex’s GitHub code review reads that section from the AGENTS.md closest to the changed code.

Can I use Codex from inside Claude Code?

Yes. OpenAI publishes an official plugin, openai/codex-plugin-cc, that adds Codex commands to Claude Code. It needs Node.js 18.18 or later and a ChatGPT account or an OpenAI API key, and its usage counts toward your Codex limits. In Claude Code, run:

/plugin marketplace add openai/codex-plugin-cc
/plugin install codex@openai-codex
/reload-plugins
/codex:setup
  • /codex:review: a read-only Codex review of your uncommitted changes, or of your branch with --base main.
  • /codex:adversarial-review: a review that questions the design.
  • /codex:rescue: hands a task to Codex, such as investigating a failing test.

The plugin runs your local Codex CLI in the same checkout Claude is working in. A review is read-only and safe anytime; a rescue task can change files, so run it when Claude is idle. Its optional “review gate” runs a Codex review every time Claude stops, and the README warns it can drain usage limits quickly.

Can Codex use Claude Code? Not as a plugin, but Codex can bring over your Claude Code setup: type /import in the Codex CLI and choose Claude Code. Going the other way, /import codex in Claude Code brings over Codex’s setup. Both make a one-time copy, so for a repo both agents keep using, a live @AGENTS.md import stays in sync and a copy doesn’t.

How do I keep an eye on both agents?

You’ll want a terminal running the tests and one running the dev server, so you can check each agent’s change as it lands. With plain terminals that is four or more tabs: two agents, tests, server. The hard part is noticing which agent is waiting for an answer.

Two terminals side by side in one Concors tab: the Vite dev server on the left and Vitest in watch mode on the right, with all 5 tests passing.
The dev server and the test watcher side by side in one Concors tab.

A review loop catches problems before you merge: one agent writes, the other reviews, read-only.

  1. Agent A finishes a step and commits

    Small commits make the review easier.

  2. Codex reviews Claude’s work

    codex review --base main      # this branch against main
    codex review --uncommitted    # staged, unstaged and untracked changes

    Or run /review in a Codex session, or /codex:review inside Claude Code with the plugin.

  3. Claude reviews Codex’s work

    Start Claude Code in Codex’s worktree and run /code-review. From a script, pipe the diff in:

    git diff main | claude -p "Review this diff. List bugs and missing tests with file:line."
  4. Hand the findings back

    Paste them to agent A, or fix them yourself.

What’s different between Claude Code and Codex when you run both?

Claude CodeCodex
Project instructionsCLAUDE.md, or AGENTS.md when there’s no CLAUDE.md (v2.1.277+)AGENTS.md (plus ~/.codex/AGENTS.md)
Start in a new worktreeclaude --worktree <name>/worktree, codex exec --worktree, or Worktree in the desktop app
Copy ignored files into worktrees.worktreeinclude.worktreeinclude (desktop app worktrees)
Built-in code review/code-review/review, codex review
Bring over the other’s setup/import codex/import → Claude Code
Run without prompts (scripts, CI)claude -p "…"codex exec "…"
Included inClaude Pro, Max, Ultra, Team, Enterprise (not Free)ChatGPT plans, from Free
Entry paid plan (checked Nov 8, 2026)Pro: $20 a month, or $17 billed yearlyPlus: $20 a month

Prices from claude.com/pricing and OpenAI’s Codex pricing page, checked November 8, 2026. The Codex CLI is open source under Apache-2.0.

How do I set this up in Concors?

Concors is a desktop app for macOS, Windows and Linux that runs Claude Code, Codex and OpenCode as their real CLIs with your own accounts, in one window with your terminals.

The Concors app with two chats side by side in one tab: Claude Code (left) added a test for formatPrice with a negative number to src/lib/price.test.ts, and Codex (right) read src/lib/price.ts and listed two edge cases its tests don't cover, without changing files. The sidebar shows the pricing-page workspace and its dev server under Previews.
Claude Code and Codex working side by side on the same project in Concors, each in its own pane.
  1. Open your repo

    Download Concors and open the repo as a workspace. No account is needed on your own computer.

  2. Start both agents

    Start a Claude Code chat in one tab and a Codex chat in another, or split one tab into two panes to watch both.

  3. Add the terminals

    Open terminals for the tests and the dev server in the same workspace. Running servers appear under Previews.

  4. Watch the sidebar

    Each agent shows whether it is working, needs your input, is done, or hit an error, so you see who is waiting without opening every tab.

To keep both agents going after you close your laptop, run the same setup on a machine that stays on. See how to keep Claude Code running 24/7.

Questions

Written by

Simone Zamparini

Engineer at Hologram, working on Concors

GitHub

Sources

More guides

Let your agents
keep working.

Claude Code, Codex and OpenCode on a machine that stays on. Free on your own computer, no account needed.

Desktop app for macOS (Apple Silicon), Windows (x64) and