# Using Codex and Claude Code together: how to divide work so they don't interfere

URL: https://opcaios.org/en/blog/dung-codex-va-claude-code-cung-luc
Date: 2026-11-03
Author: Lê Quốc Nghĩa

Using Codex and [Claude Code](/tien-ich/claude-code) at the same time is how one person delegates work to two programming agents from different vendors, OpenAI's Codex and Anthropic's Claude Code, on the same system, with each agent holding a clear role instead of both diving into the same task. This approach leverages different strengths and separate usage limits of each tool, and allows one agent to review the other's work. The price is having common ground rules. This post does not rank the two tools, does not promise time or money savings because we haven't measured, and the role division table in this post is just a suggestion. Features are based on official documentation and `codex --help` version 0.162.1, read on 03/11/2026. Git technical parts like worktree or line ending normalization are already in the post [multiple AI sessions editing one project](/blog/nhieu-phien-ai-cung-sua-mot-du-an), this post focuses on how to divide work.

![Diagram of using Codex and Claude Code at the same time: one shared AGENTS.md for all agents, Codex's separate CLAUDE.md and AGENTS.md files at user level, shared status file and daily log in the middle, each agent one role, commit the right file, cross-review before merging](https://opcaios.org/images/blog/dung-codex-va-claude-code-cung-luc/so-do.webp)
*Two agents, one set of rules: guidance, status, commits and cross-review. Diagram: OPCAIOS.*

## Why would one person use both Codex and Claude Code?

One person uses both Codex and Claude Code for three practical reasons: the two tools have different strengths and ways of working, each tool has its own usage limit by that vendor's plan, and an agent from a different vendor is a natural reviewer for the other agent's work. First, Codex has `codex exec` running non-interactively, `codex review` and cloud version; Claude Code has subagent, skill, hooks and its own planning mode. Second, when one tool hits its usage limit, continuing work on the other tool is possible if both read the same context. Third, different vendor models mean errors that one model misses, the other sometimes catches. This is reasoning, not measured data. Detailed comparison of the two tools, with pricing, is in the post [Claude Code, Cursor or Codex CLI](/blog/claude-code-cursor-hay-codex-cli).

## How to divide work between Codex and Claude Code by role?

Dividing work by role means each type of task has one "main" agent, the other agent only reads or reviews. The table below is a suggestion from OPCAIOS, not a rule from OpenAI or Anthropic:

| Type of work | Main agent (suggestion) | What the other agent does |
|---|---|---|
| Large feature, many files | One fixed agent for the whole feature | Review changes before merging |
| Code review | The agent who did not write that code snippet | Fix per comments |
| Work running periodically with no one watching | The agent with non-interactive mode you're familiar with | Does not participate |

General principle: one file at one time has only one main agent.

## How to structure one shared AGENTS.md and separate files for each agent?

One shared AGENTS.md is where to write once the rules that every agent must follow, and separate files contain only what is specific to each tool. According to the AGENTS.md page in Codex documentation (learn.chatgpt.com, read on 03/11/2026), Codex reads `AGENTS.md` from the Codex directory of the user, default `~/.codex`, then reads from project root down to current directory; a closer file overrides a farther file, total size default max 32 KiB per `project_doc_max_bytes` key. According to the memory page of Claude Code (code.claude.com, read on 03/11/2026), Claude Code reads `AGENTS.md` when there is no `CLAUDE.md`; if `CLAUDE.md` exists then it only reads `CLAUDE.md`, unless that file imports AGENTS.md with `@AGENTS.md`. Suggested structure has 3 levels:

1. `AGENTS.md` at project root: build command, test command, directory structure, prohibitions.
2. `CLAUDE.md` has only the line `@AGENTS.md` plus a few things specific to Claude Code.
3. Per-user file for each tool (`~/.codex/AGENTS.md` for Codex, Claude Code's user file): response language, order of reading documentation at session start.

Syntax details are in the post [What is AGENTS.md](/blog/agents-md-la-gi) and [What is CLAUDE.md](/blog/claude-md-la-gi).

## How do shared status files and logs help two agents coordinate?

A shared status file is a short document that both Codex and Claude Code read at the start of a session and update at the end, because the two agents don't share memory with each other. A good status file has four sections:

1. Service status, with the timestamp of the last real check.
2. Open incidents and who is handling them.
3. Work in progress: which agent is editing which area, so the other avoids it.
4. Recent log, one line per completed task, with a line limit to keep the file from growing.

The daily log records more detail: what was done, what remains unfinished. Rules for reading these two files go in a shared AGENTS.md. Note: the log is historical record, not current state; before using a port or a deploy result recorded there, an agent still has to verify it in reality.

## What are commit rules and "one machine one project" to avoid conflicts?

The correct commit rule means that each session, whether Codex or Claude Code, puts into a commit only the files it edited, with the list of paths written right on the commit command. The reason: when two agents use the same work directory, they share a commit staging area, and a bare commit command will sweep up the other agent's files too. Both tools have ways to separate the directory: `codex --help` version 0.162.1 has the `--worktree` flag to run a session in a new git worktree, and Claude Code has a similar flag. The post [multiple AI sessions editing one project](/blog/nhieu-phien-ai-cung-sua-mot-du-an) goes deep into git commands; here I'll just lay out the coordination rules:

1. Each agent gets one branch or one worktree when doing a long feature.
2. Commits have paths, review a commit before pushing.
3. Merge the latest main branch before deploying.
4. Edit code on only one machine for a given project, if you own multiple machines.

The fourth rule is often forgotten: an agent on Windows and one on Mac both editing a project easily create bulk fake changes due to different line endings and tool versions.

## How do Codex and Claude Code do cross-review?

Cross-review is for the agent who didn't write the code to read the changes and find bugs before merging, taking advantage of the two models from different companies seeing problems differently. Codex has a `codex review` command that runs non-interactive review, per `codex --help` version 0.162.1; Claude Code can be asked to read a diff like any other request. The suggested process has 4 steps:

1. Agent A finishes writing, commits on its own branch.
2. Agent B reads the diff of that branch, records comments only, does not edit code.
3. The owner reads the comments, drops the wrong ideas, sends the corrections back to agent A.
4. Run tests then merge.

Step 2 matters most: if the reviewing agent edits too, both sides will edit over each other. AI comments can also be wrong; the owner decides in the end.

## What are the risks of using two agents at once?

Using two agents at once has three main risks: overwriting each other's work, spending twice as much, and conflicting instructions. Specifically:

1. Overwrite: two agents edit one file, the second agent's save erases the first agent's part without reporting an error. Prevent with "one file one owner".
2. Spend twice: giving the same task to both agents "to see who does better" burns through both quotas and you have to read two results.
3. Conflicting instructions: AGENTS.md says one thing, CLAUDE.md says another, each agent follows its own way. Prevent by keeping shared rules in one place, with separate files only adding to them.

A scenario, not a real person: someone told Codex to fix the payment page and forgot to write it in the status file, the Claude Code session that opened later saw the old bug and fixed it a different way, the result being two conflicting edits.

## OPCAIOS's Experience

Using Codex and Claude Code at the same time is how OPCAIOS, the website opcaios.org run by one person, is working. These are real things, verified on 03/11/2026:

1. The main work machine has Codex CLI version 0.162.x and the Codex desktop application, used in parallel with Claude Code and [Google Antigravity](/tien-ich/google-antigravity).
2. There is a shared AGENTS.md for all agents in the user's home directory and in the Obsidian notes vault; Codex has an additional user-level AGENTS.md with content equivalent to Claude Code's user-level instructions file: respond in Vietnamese, read documentation in order at session start, log at session end.
3. The agents stay in sync through a shared state file and daily log; each session only commits its own files.
4. Some projects have a rule that code can only be edited on one specific machine. This rule came after seeing over 1,500 different files caused only by line ending differences, when one agent deployed from a Windows machine.
5. Codex configuration uses "medium" thinking level by default and delegates subagents to a smaller model to save cost.
6. OPCAIOS once had one agent review another agent's work, but hasn't measured its effectiveness yet, and doesn't regularly use Codex for code review.

We haven't compared quality or cost between the two tools on the same task, so we don't recommend fixed roles.

## Frequently Asked Questions

### Can Codex and Claude Code edit the same file?

Not at the same time. The two agents don't know what each other is editing, so whichever saves later can delete the earlier agent's work without warning. If you must share a file, do it sequentially: A finishes, commits, updates the state, then hand off to B. Better yet is to give each agent its own branch or worktree. Codex CLI has a `--worktree` flag according to `codex --help` in version 0.162.1.

### Can Claude Code read Codex's AGENTS.md?

Yes, according to Claude Code documentation read on 03/11/2026, but with conditions. Claude Code reads `AGENTS.md` when the project has no `CLAUDE.md` in the working directory or parent directory. If `CLAUDE.md` already exists, Claude Code only reads `CLAUDE.md`, unless that file has a line `@AGENTS.md` to import it. The user-level files for both tools are separate and must be written for each.

### Does using two tools cost twice as much?

It depends on how you use them and each provider's pricing; this post doesn't list prices since they change, pricing is in [Claude Code, Cursor or Codex CLI](/blog/claude-code-cursor-hay-codex-cli). Double cost really happens when you give the same task to both. With clear role division, the cost is the sum of both subscriptions, in exchange for higher quotas and a reviewer from another vendor.

### Where should the shared state file go?

Put it somewhere every agent on every machine can read it, and write its path in the shared AGENTS.md so agents know to read it at session start. It can be in the code repository, or a notes vault like Obsidian if many projects share it. Keep the file short, move old log lines to an archive file. Don't write passwords, secrets, or tokens in this file.

### Should newcomers use two agents right from the start?

No. Master one agent first, have an AGENTS.md, have the habit of committing the right files and reading diffs, then add a second agent. If rules aren't solid, two agents will only double the mess. Start the second agent in the safest role: read-only review. The post [safe process for non-coders](/blog/tac-tu-lap-trinh-cho-nguoi-khong-biet-code-quy-trinh-an-toan) has the fundamentals. Want help setting up a multi-agent process, see OPCAIOS's [AI application training course](/services/dao-tao-ung-dung-ai).

*Source: Codex documentation on learn.chatgpt.com (AGENTS.md page, redirected from developers.openai.com/codex), `codex --help` from Codex CLI 0.162.1, Claude Code documentation on code.claude.com (memory page), read on 03/11/2026. Not yet verified: effectiveness of cross-review, cost when running in parallel, how Codex desktop handles worktrees; features may change by version. The role division table is a suggestion. The experience is OPCAIOS's.*
