The setup: two checkouts, two tasks, one review
Run Claude Code and Codex in separate Git worktrees when both will edit the same repository. Each gets its own directory and branch; you then review and integrate their changes one at a time. Two terminal tabs in the same directory still share every file and the Git index.
Start with two tasks you can review independently: Claude fixes a parser bug while Codex adds a help page, for example. If both tasks change the same public interface, agree on that interface first or do them in sequence. More agents only help when useful work can proceed independently.
1. Create both worktrees from an explicit starting commit
From your repository root, inspect the working tree and record HEAD. Commit the work you want both agents to start from. Uncommitted edits and ignored files do not become part of the new checkouts. Use unused branch and directory names; Git will refuse collisions.
git status --short
git rev-parse --short HEAD
git worktree add -b agent/claude-task ../app-claude HEAD
git worktree add -b agent/codex-task ../app-codex HEAD
git worktree listBoth commands use HEAD explicitly, so the agents begin at the same commit, including local commits on your current branch. Each worktree shares repository history but has its own checked-out files. Install dependencies using your project’s documented setup in each checkout. Create a local development configuration from the example file when needed.
Keep dev-server ports, test databases, and build output paths separate too. Worktrees isolate tracked files; they do not isolate services, credentials, the network, or the rest of your machine. Review each CLI’s permissions and repository instructions before allowing writes.
2. Launch one CLI in each checkout
cd ../app-claude
claudecodex --cd ../app-codexYou can use ordinary terminal tabs for this. In CmdBrief, open each checkout in the relevant pane or workspace. For a tool that creates and tracks the worktrees for you instead, CmdBrief vs Conductor sets out where each model fits. The development preview adds independent Claude Code and Codex Standard panes. Separate panes do not isolate files: create and manage the worktrees yourself, and review each result before merging. The downloadable release may differ from the preview.
Claude also offers claude --worktree <name> to create a checkout and launch a session together. The explicit Git setup above keeps the branch names and starting commit identical for both vendors. See multiple Claude sessions for that shortcut.
3. Give each agent an independent task contract
Copy this brief into each session, replacing the bracketed fields. Make ownership precise enough that a reviewer can tell whether an unrelated change belongs in the result. Give both agents the same shared interface notes, but a different write scope.
Outcome: [one observable result]
Working directory: [absolute worktree path]
Write scope: [specific files or component]
Shared interface: [agreed inputs and outputs]
Acceptance: [expected behavior, including a failure case]
Verify with: [the repository's documented commands]
Preserve unrelated changes. Stop if the task needs a shared interface change.
Report the diff, checks run, remaining issues, and any assumptions.
Leave committing, merging, and deployment to me.For a copy you can keep with a task, download the parallel-agent brief. For an independent review, give the reviewer a frozen commit or diff after the implementation is ready; a review of moving files becomes stale as soon as the implementation changes.
4. Review and integrate one result at a time
When a session finishes, check its worktree rather than relying on its final message. These commands show tracked changes; the status check also catches new, untracked files that a diff alone will miss. Inspect those files explicitly.
git -C ../app-claude status --short
git -C ../app-claude diff --check
git -C ../app-claude diff
git -C ../app-codex status --short
git -C ../app-codex diff --check
git -C ../app-codex diffRun the relevant checks inside each worktree. Commit only the reviewed files there. Return to a clean integration branch in the original repository and merge the first branch. Run checks, then merge the second and run the combined suite. Two individually passing branches can still conflict in behavior, even when Git merges them cleanly.
git merge --no-ff agent/claude-task
# Run the project's checks and inspect the result.
git merge --no-ff agent/codex-task
# Run the combined checks before publishing anything.5. Recover from the common failures
| Symptom | What to check | Next action |
|---|---|---|
| Changes appear in the wrong pane | Actual working directory and branch | Run pwd and git branch --show-current in both panes. |
| One dev server replaces the other | Port and output-directory settings | Assign distinct ports and temporary paths. |
| A formatter changes both tasks’ files | Write scope and repository-wide scripts | Narrow the command or sequence the shared change. |
| Both sessions stop at a usage limit | Provider account and current usage | Parallel sessions share provider capacity; inspect the account’s meter. |
| An agent waits silently | Permission or clarification prompt | Resolve the specific request before launching more work. |
To return later, enter the intended worktree and use claude --resume or codex resume. Confirm the directory and branch before continuing. Conversation history and uncommitted files are separate: resuming a chat does not replace preserving your checkout.
6. Remove only finished worktrees
After both branches are merged, stop their agents and dev servers. Check for uncommitted and ignored files you want to keep before cleanup. Git normally refuses to remove a dirty worktree; do not add a force flag just to bypass that signal.
git -C ../app-claude status --short --ignored
git -C ../app-codex status --short --ignored
git worktree remove ../app-claude
git worktree remove ../app-codex
git branch -d agent/claude-task agent/codex-taskIf review time or interruptions outweigh the saved implementation time, return to one implementation session and one later review. The useful metric is time to an accepted, verified change. The Claude Code vs Codex evaluation guide includes a scorecard for measuring it.
Questions
Can Claude Code and Codex edit the same repository at the same time?
Yes. Give each a separate worktree and branch, divide the tasks, and review the combined changes. Two tabs in one directory share files and can overwrite each other’s work.
Do Git worktrees provide a security sandbox?
No. They provide separate checkouts, not a security boundary. Permissions, services, credentials, and network access still need the appropriate configuration.
Do I need a paid workspace manager?
No. Git and two terminal tabs are sufficient. A workspace manager can make attention, diffs, and session navigation easier as the number of tasks grows.
Still unsure? Write to [email protected] or use the contact form. Contact CmdBrief →
Primary sources
Provider terms and product behavior can change. Confirm plan, pricing, model, and permission details in the current official documentation.