# Claude Code and Codex Together: 3 Work Patterns

> Working together with Claude Code and Codex: writing and reviewing code, drafting and architecture, separating infrastructure and business logic, synchronizing instructions.

Source: https://ailoot.ai/blog/en/claude-code-codex-together/
Canonical: https://ailoot.ai/blog/en/claude-code-codex-together/
Language: en
Publisher: Ailoot (https://ailoot.ai/)
Translation: guide-047
Revision: sha256-79f1cdace556e8d8e203a1d9b550ccb8911ef7e58e97e794a328a5e1a36c1615


<div class="aside" data-semantic="key-takeaway" role="note" aria-label="Key takeaways">

Key takeaways

One agent, one pace: either carefully work through the architecture or quickly churn out drafts. The Claude Code + Codex pairing covers both modes. Claude Code thinks things through, asks questions, and is careful. Codex pushes through to results in a sandbox. In 2026, most strong teams keep both and switch between them depending on the scenario.

</div>

Practical materials on working with agents and vibe coding: [Ailoot documentation](https://ailoot.ai/docs/).



## Why Is One Tool No Longer Enough in 2026?

<div class="aside" data-semantic="key-takeaway" role="note" aria-label="Key takeaways">

Key takeaways

By June 2026, the myth that “one right agent can handle everything” had fallen apart. Claude Code leads on architecture tasks and long refactors. Codex handles autonomous PRs and parallel sandbox tasks faster.

</div>

In May 2026, OpenAI entered Anthropic's territory with the GPT-5.5 model in Codex CLI. In recent benchmarks, Codex has a clear lead on terminal tasks and in SWE-bench Verified mode. Anthropic responded with Opus 4.8 and Dynamic Workflows, maintaining its lead on SWE-bench Pro (a test designed to prevent data leakage, where training a model on the benchmark does not help). A detailed head-to-head comparison is covered in the [Codex vs Claude Code guide](https://ailoot.ai/blog/en/codex-vs-claude-code-choice/)—here, let's go straight to the pairing.

In 2026, there is no single winner. One pattern dominates—teams keep Codex for inexpensive autonomous work and Claude Code for risky architectural decisions.

The key difference that determines how to divide the work:

- **Claude Code is the researcher.** It sustains a long, in-depth dialogue, questions assumptions, and considers several approaches before choosing a solution. It suits situations where the right action is not obvious from the outset.
- **Codex is the executor.** It gets a task and pushes through to results in a sandbox. It suits clear tasks that need a fast “give-and-get” cycle.

If you have both tools at hand, you don't have to choose between “thinking” and “doing.” You delegate based on the type of task. If you haven't decided which of the two to install first, there's a head-to-head comparison in the [Codex vs Claude Code guide](https://ailoot.ai/blog/en/codex-vs-claude-code-choice/).

## Pattern 1: Claude Code Writes the Code, Codex Reviews It

<div class="aside" data-semantic="key-takeaway" role="note" aria-label="Key takeaways">

Key takeaways

The easiest pattern to start with. Claude Code works through the architecture in Plan Mode and writes the feature with an understanding of the context. Codex gets the diff in a pull request, runs tests, checks edge cases, and finds bugs Claude missed because of hallucinations. Suited to situations where you need quality plus a second set of eyes.

</div>

In this pattern, Claude Code remains the lead editor. Codex comes in only at the PR level through its cloud mode (Codex runs directly from ChatGPT or the GitHub App, so you don't need a second terminal).

**What this looks like in practice:**

1.  ### Step 1: Write the feature in Claude Code

    Open the repository in VS Code, launch Claude Code, switch to [Plan Mode](https://ailoot.ai/blog/en/claude-code-plan-mode/), and discuss the feature architecture. You get draft code, tests, and migrations. Commit to a feature branch.

2.  ### Step 2: Create a PR in GitHub

    Open a pull request from the feature branch to main. In the description, enter `@codex review this PR for edge cases, security issues, and test coverage gaps`.

3.  ### Step 3: Codex reviews asynchronously

    In cloud mode, Codex clones the repository into its sandbox, reads the diff, runs tests, runs the linter, and looks for vulnerabilities. After 5-15 minutes, it leaves comments directly on the PR.

4.  ### Step 4: Make changes in Claude Code

    Go back to Claude Code and give it Codex's comments as context: “Here's what the review found; fix items 1, 3, and 5.” Claude makes the changes and publishes them to the repository.

This pattern works because Claude and Codex were trained on different datasets and have different philosophies. Codex sees what Claude missed due to its model's blind spot, and vice versa.



**Risks of pattern 1:**

- Codex may close a PR with approval while missing an architectural problem. Review important decisions yourself.
- Double token costs: Claude and Codex analyze the same code. It pays off on complex features and is expensive for small ones.
- Codex in cloud mode can't see your local environment—environment variables or local databases. If the feature touches them, switch to a manual run.

## Pattern 2: Codex Drafts, Claude Code Fixes the Architecture

<div class="aside" data-semantic="key-takeaway" role="note" aria-label="Key takeaways">

Key takeaways

The mirror-image pattern. Codex quickly writes a rough draft—a model, form, or endpoint. You get it in minutes. Then you open the file in Claude Code and ask it to tidy up the architecture, separate the layers, add typing, and fix the naming. Suited to situations where speed to get started matters more than initial polish.

</div>

This pattern was used in the project described in 2026, when a registration funnel prototype with email notifications had to be built in one evening. In this scenario, you could spend an hour discussing the architecture with Claude Code. Codex produced a working draft in 12 minutes.

**How it works:**

| Stage | Who does it | Time | What you get |
|----|----|----|----|
| Specification | Task author | 5 min | 1 paragraph: what I want, which fields, what constraints |
| Rough draft | Codex | 5-15 min | Working code, tests, documentation |
| Architectural cleanup | Claude Code | 20-30 min | Layers separated, strict types, lively names |
| Final tests | Claude Code | 10 min | Full coverage, no gaps |

It works like this: Codex does the grunt work for the first 15 minutes, then Claude brings it up to production quality.



Ask Codex to make it polished right away, and it will get stuck on ambiguity. Ask Claude Code to make it fast right away, and it will start second-guessing. Give each one the work it was made for.

**Risks of pattern 2:**

- Codex generates a draft with assumptions that can be hard to clean up later. If the draft goes in the wrong direction, it's cheaper to throw it out and start over than to fix it.
- Claude Code may spend half an hour renaming variables and forget about the real architectural problem. Give it specific changes, not “tidy this up.”
- Context is lost between sessions. For Claude Code to understand what Codex intended, you need an `AGENTS.md` (see pattern 5) or a detailed comment at the start of the file.

## Pattern 3: Codex for Infrastructure, Claude Code for Business Logic

<div class="aside" data-semantic="key-takeaway" role="note" aria-label="Key takeaways">

Key takeaways

The most advanced pattern for teams of 2-5 people. Codex handles infrastructure—CI/CD, tests, migrations, infrastructure as code, and configurations. Claude Code handles business logic—models, product features, and user scenario handling. Each tool operates within its own area of responsibility.

</div>

The idea is simple: different parts of a codebase call for different ways of working.

This pattern complements the approach of [running multiple Claude Code instances in parallel](https://ailoot.ai/blog/en/claude-code-parallel-worktree-agents/)—there, the same model handles different tasks through git worktrees; here, two different agents divide areas of responsibility.

**Infrastructure layer** (Codex):

- GitHub Actions: add a new job, adjust caching, speed up CI.
- Tests: write a suite of integration tests after a refactor.
- Prisma migrations: generate a migration and check that it can be rolled back.
- Docker / Coolify configs: add environment variables, update the health check.
- Cron jobs: write a set of cron handlers.

Codex wins here because infrastructure tasks are often **many small files with boilerplate code**. Codex doesn't get hung up on “needing to think it through”; it pushes all the way to the end.

**Business logic** (Claude Code):

- Registration funnel: what to show the user at each step.
- Price calculation accounting for discounts, installments, and gift promo codes.
- Automated notification workflows: which triggers and conditions.
- External API integrations: error handling, retries, caching.
- Financial models: unit economics calculations and income forecasts.

Claude Code wins here because these tasks require **extended dialogue with product thinking**. Without discussing scenarios, you end up with a technical solution that doesn't account for the user's real pain points.

**How work is divided in the repo:**

```
project/
├── .github/workflows/      ← Codex (CI, tests)
├── infra/                  ← Codex (Docker, Coolify, migrations)
├── scripts/                ← Codex (task scripts)
├── tests/                  ← Codex (integration tests)
├── src/
│   ├── lib/                ← Claude Code (business logic)
│   ├── app/                ← Claude Code (routes, forms, pages)
│   └── components/         ← Claude Code (UI)
└── prisma/
    └── schema.prisma       ← Claude Code (data models—product decision)
```

This isn't a hard rule. There can be overlap—for example, Claude Code can edit a GitHub Action if the action has product meaning (sending a notification after publication). But 80% of tasks fit this division well.





## How Do You Synchronize CLAUDE.md and AGENTS.md?

<div class="aside" data-semantic="key-takeaway" role="note" aria-label="Key takeaways">

Key takeaways

The main risk of the pairing is two tools with different rules. Claude Code reads CLAUDE.md as conversational preferences. Codex reads AGENTS.md as an operational guide: test commands, lint, forbidden directories, commit format. Shared technical rules can be reused in both files. Review copied text for tool-specific commands and configuration; copying Markdown does not inherently break Codex. One option is a canonical source in `/context/` from which both files are generated.

</div>

An unexpected problem came up in the described experience of using Claude Code and Codex in parallel. Claude Code followed the rules in `CLAUDE.md` (“don't touch migrations without confirmation”). Codex couldn't see these rules and ran migrations in a working environment without hesitation. After the third broken database, it became necessary to figure out how to keep both files in sync properly.

Both files can contain project context, conversational preferences, test commands, directory exclusions, and commit standards. Reuse rules that apply to both tools, then keep each tool’s specific commands and configuration separate. For example, a prohibition on changing migrations belongs in both sets of instructions if it applies to both agents.

**What is the same in both files:**

- Stack: which frameworks, which database, which ORM.
- Project description: what it is, who it's for, and its main entities.
- Prohibitions: which folders not to touch and which commands not to run.

**What is different:**

- Claude Code-specific hooks, settings layers, and MCP configuration belong in the relevant Claude Code configuration files. Prose describing those conventions may be referenced from `CLAUDE.md`; it does not become portable configuration merely by copying it.
- `AGENTS.md` is an open standard. Codex, Cursor, Aider, Continue, Cline, and Factory Droid read it—25+ agents. The [separate guide](https://ailoot.ai/blog/en/agents-md-guide-template/) covers the AGENTS.md format in more detail. Codex MCP configurations are stored in `~/.codex/config.toml` (TOML, not JSON as with Claude).

A common pattern in 2026 is a canonical source of rules in the monorepo's `/context/` folder, from which a sync script generates `CLAUDE.md`, `.cursor/rules/*.mdc`, and `AGENTS.md`. The tool-specific files are marked read-only; only the source is edited.



Run the sync script through a pre-commit hook or through a GitHub Action. If changes are made directly to `CLAUDE.md`, CI fails. This guards against rule drift between tools.

**Another option is the official Codex Plugin for Claude Code** (announced on March 30, 2026, version 1.0.4). It adds the `/codex:review`, `/codex:adversarial-review`, and `/codex:rescue` commands to Claude Code. Codex runs as a sub-agent, using its own `~/.codex/config.toml` and `AGENTS.md`. This removes the need for a second terminal, but `AGENTS.md` is still required.

## How Much Does It Cost to Keep Both, and Where Are the Savings?

<div class="aside" data-semantic="key-takeaway" role="note" aria-label="Key takeaways">

Key takeaways

Roughly: Claude Code Max (5x) is \$100/month. Codex Plus is \$20/month, and Codex Pro is \$200/month. For one person, Claude Max + Codex Plus = \$120/month. It pays off with just one hour of work saved. The main savings come from reaching the right solution faster; tokens are secondary here.

</div>

Here are the figures for June 2026 ([data from the official Anthropic and OpenAI subscription pages](https://www.anthropic.com/pricing) and [the official Codex page](https://openai.com/codex/)):

| Subscription | Price | What's included |
|-----------------|-----------|--------------------------------------|
| Claude Pro | \$20/month | Claude.ai + Claude Code (Pro limits) |
| Claude Max 5x | \$100/month | Claude Code with 5x Pro limits |
| Claude Max 20x | \$200/month | Claude Code with 20x Pro limits |
| ChatGPT Plus | \$20/month | Codex CLI + cloud (Plus limits) |
| ChatGPT Pro 5x | \$100/month | Codex CLI + cloud, 5x Plus limits |
| ChatGPT Pro 20x | \$200/month | Codex CLI + cloud, 20x Plus limits |

**Minimum working pairing:** Claude Pro (\$20) + ChatGPT Plus (\$20) = \$40/month. Enough for solo projects with a couple of sessions a day.

**A real pairing for an active vibe coder:** Claude Max 5x (\$100) + ChatGPT Plus (\$20) = \$120/month. In the experience described, this pairing was used for the last 2 months: during that time, three projects went live, and the Claude limits were never reached.

**A pairing for a team:** Claude Max 20x (\$200) + Codex Pro (\$200) = \$400/month. It makes sense when you have a steady flow of PR reviews and cloud tasks running in parallel with local work.

Where the savings come from:

- **Less time per feature.** The author's measurement: across 12 features in May-June, the time from “an idea came up” to “in production” fell from 4 hours (one Claude Code) to 2.5 hours (the pairing). Measured on the author's tasks; your profile will show different figures.
- **Fewer defects.** According to the observations described, Codex PR reviews catch 2-3 issues out of 10 that Claude misses. Each such production issue means an hour or two to fix, plus potential downtime.
- **Parallelism.** Codex works on feature A in cloud mode while the user works with Claude on feature B. This doubles throughput.

It doesn't pay off if you write 1-2 features a week. In that case, one Claude Code Pro is enough.

## When Don't You Need a Second Tool?

<div class="aside" data-semantic="key-takeaway" role="note" aria-label="Key takeaways">

Key takeaways

Four scenarios where the pairing is overkill: solo projects with 1-2 features a week, a strict \$20/month budget, architecturally simple projects without CI/CD, and teams where Claude Code already handles all tasks reliably. In these cases, adding Codex means spending time on synchronization for a speculative benefit.

</div>

The pairing isn't for everyone. Often, it just adds noise. Here are four situations where a second tool isn't needed:

1.  **Solo project at the start.** If you have one idea and are only testing it, one Claude Code + Plan Mode will be enough for a month. Add the pairing when you hit a speed bottleneck.

2.  **Strict budget.** If \$20/month is the ceiling, get Claude Pro and don't worry about it. Claude on its own covers 80% of a vibe coder's tasks.

3.  **Simple architecture.** A website with a form, a bot with a couple of scenarios, an API wrapper script—dividing by layers adds nothing here. One Claude Code can handle it.

4.  **Everything is already working.** If you've already been using Claude Code and haven't had a single task it got stuck on or failed at in the past month, don't fix what works. Add Codex when the need becomes obvious.

And the reverse—clear signs that it's time to bring in a second tool:

- Claude Code has become a bottleneck: you're waiting for it instead of working.
- A lot of boilerplate infrastructure work has appeared (migrations, CI, tests) that you hate running through Claude.
- Different people on the team are already using different tools—one shared language is needed.
- Benchmarks show Codex handles your type of tasks faster (for example, terminal operations).

## How to Set Up the Pairing in an Evening

<div class="aside" data-semantic="key-takeaway" role="note" aria-label="Key takeaways">

Key takeaways

Step by step over one evening: install Codex CLI alongside Claude Code, reuse shared technical rules in AGENTS.md while separating tool-specific instructions, choose one of the 3 patterns for your current project, work on 3-5 features with it, and compare with your previous pace. Then iterate: change the pattern, synchronize the rules, and add MCP servers.

</div>

A concrete plan for your first evening:

1.  ### Step 1: Install Codex CLI

    In the terminal: `npm install -g @openai/codex`. Log in with `codex login`—a browser will open, and you'll sign in with your ChatGPT account. Codex will see your subscription (Plus / Pro) and use its limits.

2.  ### Step 2: Write AGENTS.md as an operational document

    Review `CLAUDE.md` and reuse the rules that apply to both tools in `AGENTS.md`: test and lint commands, commit format, forbidden folders, and a description of the stack. Conversational preferences can also be shared. Adapt tool-specific command references and keep executable hook and MCP settings in each tool’s own configuration; a copied Markdown file alone does not configure them.

3.  ### Step 3: Choose a pattern for your project

    If you're a solo coder with CI, use pattern 1 (Claude writes, Codex reviews). If it's a new project and you need speed, use pattern 2 (Codex drafts, Claude cleans it up). If it's an established project with an infrastructure layer, use pattern 3 (split by layers).

4.  ### Step 4: Experiment for one week

    Work with the chosen pattern on 5-7 features. Track the time. Record which tool handled each one better. After a week, you'll have a real profile of your usage.

5.  ### Step 5: Set up rule sync

    Add a `scripts/sync-agent-rules.sh` script (see the section on synchronization). Connect it as a pre-commit hook or through a GitHub Action. After that, the rules will propagate to both files automatically.

The pairing isn't magic. It's simply two minds instead of one, each covering the other's weak spots. The key is not to get stuck debating “Claude or Codex” when the right answer has long been “both Claude and Codex—for different types of tasks.”

Practical materials on working with agents: [Ailoot documentation](https://ailoot.ai/docs/).



<div class="section" role="doc-bibliography" aria-label="Sources">

### Sources










- [Anthropic - Claude Pro and Max pricing](https://www.anthropic.com/pricing)
- [OpenAI - Codex pricing](https://openai.com/codex/)
- [Codex changelog - OpenAI Developers](https://developers.openai.com/codex/changelog)
- [Claude Code docs - CLAUDE.md format](https://code.claude.com/docs/en/memory)
- [AGENTS.md open standard](https://agents.md/)

</div>





More materials and tools: [Ailoot](https://ailoot.ai/).

## Questions about Claude Code and Codex Together: 3 Work Patterns | Ailoot

### Can I reuse CLAUDE.md content in AGENTS.md?

Yes. Reuse shared project facts, test commands, coding rules, and restrictions after checking that they apply to both tools. Adapt tool-specific commands and configuration references; copying Markdown itself does not inherently break Codex.

### How do I compare a two-agent workflow with my current process?

Choose one collaboration pattern and use it on several real features for a week. Record elapsed time and defects caught, then compare with similar work done with one tool before adding synchronization or more agents.


## Ailoot · The company and its project portfolio

Ailoot combines established operating experience, a large client base, stable service and ongoing KPI control.

The company and its project portfolio: millions of customers; monthly sales in the billions.

Ailoot brings that operating experience to API access for AI features in customer products, agents, applications and automations.
