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 Simone ZampariniUpdated 11 min read

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 A | Agent B |
|---|---|
| Builds the feature | Investigates an unrelated bug |
| Writes the change | Reviews the diff and lists problems |
| Works on the app code | Writes tests for it |
| Refactors one module | Updates 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:
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.
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-authAdd
.claude/worktrees/to your.gitignore. In the Codex CLI, type/worktreein 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 thereTake 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_reviewCan 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.

A review loop catches problems before you merge: one agent writes, the other reviews, read-only.
Agent A finishes a step and commits
Small commits make the review easier.
Codex reviews Claude’s work
codex review --base main # this branch against main codex review --uncommitted # staged, unstaged and untracked changesOr run
/reviewin a Codex session, or/codex:reviewinside Claude Code with the plugin.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."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 Code | Codex | |
|---|---|---|
| Project instructions | CLAUDE.md, or AGENTS.md when there’s no CLAUDE.md (v2.1.277+) | AGENTS.md (plus ~/.codex/AGENTS.md) |
| Start in a new worktree | claude --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 in | Claude 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 yearly | Plus: $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.

Open your repo
Download Concors and open the repo as a workspace. No account is needed on your own computer.
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.
Add the terminals
Open terminals for the tests and the dev server in the same workspace. Running servers appear under Previews.
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
Sources
- Claude Code docs: run parallel sessions with worktrees
- Claude Code docs: CLAUDE.md, AGENTS.md and imports
- Claude Code docs: commands (/code-review, /import)
- Codex docs: AGENTS.md
- Codex docs: developer commands (/worktree, codex review)
- Codex docs: Git worktrees
- Codex docs: import
- OpenAI: Codex plugin for Claude Code
- agents.md
- Next.js CLI (PORT)
- Git documentation: git-worktree
- Claude pricing
- Codex pricing



