Using Claude Code and Codex Together on One Project
Claude Code and Codex can contribute to the same repository without contributing to the same working directory. The useful combination is a workflow: give each session a bounded responsibility, isolate its edits, and make one person accountable for integration. This guide develops a proposed two-agent workflow around a concrete API change, including where parallel execution helps, where it creates extra work, and what evidence to require before merging.
AI-assisted technical guide with linked primary sources. Examples are illustrative unless stated otherwise. How these guides are made.
Choose complementary work before choosing a model
Start with a dependency map, not a claim that one product always writes better code. For an invoice export feature, possible jobs include implementing a CSV serializer, adding an authenticated endpoint, updating the download interface, and checking permissions. Two agents editing the endpoint simultaneously produce competing implementations. Two agents working against an agreed response contract can produce independent artifacts.
A useful initial allocation is Claude Code on the serializer and Codex on endpoint integration, or the reverse. Make that assignment based on your repository experience and a small representative task. Keep security-sensitive interface decisions with the integration owner. A second model can supply another perspective, but two agreeable answers are not proof of correctness.
Parallelism has a price: duplicate setup, review time, context transfer, and potential conflicts. If the serializer contract is unsettled, finish that decision first. For a tightly coupled bug fix, a single implementation session plus a later independent review may be faster than concurrent editing.
Create a separate worktree for each editing session
Git worktrees provide separate working directories and indexes attached to one repository. Branch references remain shared. They isolate file edits, not operating-system permissions, network access, or services. Avoid treating a separate folder as a security sandbox.
The following example assumes an existing repository, a current local main, and unused branch names. Run it after checking for uncommitted changes and confirming the base commit you want:
git status --short
git rev-parse main
git worktree add -b agents/csv ../invoice-csv main
git worktree add -b agents/api ../invoice-api main
git worktree listOpen one terminal in each new directory, then start the intended agent there. Claude Code also documents a --worktree workflow in its official common workflows; using ordinary Git here makes the directory layout independent of either agent. Confirm the actual working directory and branch in both sessions before authorizing edits. Do not use forced checkout to make two sessions share a branch.
Give both agents the same contract and different ownership
Durable repository instructions should cover build commands, formatting conventions, test locations, and architectural constraints. Official OpenAI documentation describes how Codex discovers and layers AGENTS.md guidance. Claude Code documents persistent instructions through CLAUDE.md and supported AGENTS.md behavior in its project memory guide. Check the installed tool version and loaded instruction sources rather than assuming identical discovery behavior.
Maintain one authoritative API contract in a tracked document. For this example, specify UTF-8 output, header names, date formatting, CSV escaping, authorization requirements, and the error response. Include examples for commas, quotation marks, embedded newlines, and empty results. Each task brief links to that document and identifies an owner for every changed area.
Keep secrets and production credentials out of shared guidance. Instructions describe expected behavior; permissions and sandbox controls enforce access. If a session needs a broader capability, assess that request in the agent itself.
A worked split for an invoice export feature
| Session | Owned artifact | Acceptance evidence |
|---|---|---|
| Claude Code: CSV | Serializer module and serializer tests | Exact output for escaping, dates, empty exports |
| Codex: API | Endpoint and authorization tests | Allowed access succeeds; cross-tenant access fails |
| Human integration owner | Contract, merge order, combined behavior | Integrated tests and manual download review |
Give the API agent a documented serializer signature and a temporary test double. State explicitly that it must not implement its own serializer. Give the serializer agent no authority to change route permissions. Both sessions can investigate the repository, but only their assigned areas may be edited without an updated brief.
For example: “Implement serializeInvoices(rows) according to docs/invoice-export-contract.md. Own only the serializer and its unit tests. Do not add dependencies. Report changed files, executed checks, and unresolved assumptions. Stop for a decision if the existing data model cannot represent the contract.” This is a proposed brief, not a built-in command.
If both tasks require the same package manifest, assign that file to one owner. A lockfile conflict often signals a shared dependency decision, not merely a formatting inconvenience.
Integrate sequentially and review the combined result
Require each session to produce a focused commit and a handoff: base commit, changed files, tests actually run, limitations, and remaining decisions. “All tests pass” should include the command and environment; an unexecuted suggestion is not evidence. Inspect each branch against the agreed base before integration.
Merge the serializer first, then update the API branch against the accepted implementation. The integration owner chooses the project’s normal merge or rebase policy and resolves semantic disagreements. Do not ask an agent to resolve every conflict automatically: a conflict in authorization logic deserves a deliberate review.
Run the combined suite after integration. Unit tests from separate branches cannot show that the endpoint invokes the correct serializer, preserves tenant boundaries, or returns usable download headers. Add one end-to-end scenario that exports an authorized invoice containing a comma and a quotation mark, then verifies the parsed result. Review failures on the integrated revision rather than relying on earlier branch results.
Handle shared resources and stale assumptions explicitly
Separate worktrees can still point at one local database, one development port, or one external account. Give tests distinct database names or isolated fixtures where practical. A migration run by one session can invalidate another session’s assumptions even when no files overlap.
Watch for contract drift: the serializer accepts a date object while the API supplies a string; one branch renames a field that another expects; an agent silently broadens scope to make a test pass. Resolve the contract first and update both briefs. Do not merely make the type checker quiet.
A reviewer agent also needs independence. Ask it to identify observable failures in the diff and acceptance criteria, rather than praising the implementation summary. Human review remains necessary for product intent and high-impact decisions. If coordination takes longer than implementation, reduce the number of concurrent editors.
Keep the two local sessions visible with Purrvio
Once the work is isolated, finding the right waiting session becomes a separate problem. Purrvio’s Mac preview provides local session visibility, with its richest support for Claude Code and Codex. It reads supported local session records and processes without installing agent hooks. You can see which supported session needs attention and return to the relevant terminal.
Purrvio does not allocate worktrees, enforce file ownership, schedule agents, or validate a merge. Those responsibilities stay in your workflow. Session navigation supports Ghostty and Terminal.app; direct replies require Ghostty and Automation permission. If this local visibility fits your setup, download the free Mac preview and read its installation notes. It supports macOS 13 or later on Apple silicon and Intel; the locally signed preview is not Apple-notarized.
Use a short operating checklist for every paired task
- Confirm a shared base commit and write acceptance criteria before starting both sessions.
- Create distinct worktrees, branches, and session names that include the task.
- Assign shared files, dependencies, databases, and ports to explicit owners.
- Require evidence of executed checks and preserve unresolved questions in each handoff.
- Integrate one branch at a time and retest the combined behavior.
- Remove clean worktrees only after preserving the work and confirming they are no longer needed.
Track how much time you spend waiting, reviewing, and fixing integration mistakes across a few comparable tasks. Use that observation to adjust the split. Running two products is useful when it shortens delivery of verified work; the number of active sessions is only an input.
Frequently asked questions
Can Claude Code and Codex edit the same repository at the same time?
Yes, but use separate branches and worktrees for concurrent editing, define ownership, and integrate sequentially. Sharing one working directory makes each session vulnerable to the other session’s uncommitted changes.
Should one agent always implement and the other always review?
No fixed assignment is universally best. Choose roles using representative repository tasks. Independent review is useful when the reviewer checks the actual diff and acceptance criteria, but agreement between models does not establish correctness.
Does Purrvio orchestrate Claude Code and Codex?
Purrvio provides local session visibility and supported terminal navigation. Task allocation, isolation, permissions, integration, and completion verification remain your responsibility.
Sources and further reading
Primary references checked for this guide on 10 November 2026. Documentation can change; confirm version-specific behavior before using commands in a production workflow.
- Git worktree documentation
Verified separate working directories, shared repository references, branch restrictions, and clean worktree removal behavior.
- Claude Code common workflows
Verified documented parallel sessions with worktrees and the --worktree entry point.
- Custom instructions with AGENTS.md — official OpenAI documentation
Verified Codex instruction discovery, layering, and startup behavior.
- How Claude remembers your project
Verified persistent project instructions, CLAUDE.md, supported AGENTS.md behavior, and distinction between instruction context and enforcement.