---
title: Run Claude Code and Codex on the same repo without them clashing
description: With two agents on one repo you lose track of who is on what. What worktrees and a TODO.md fix, where they stop, and the same setup with one shared list.
url: https://hamloy.com/blog/claude-code-and-codex-on-one-repo
---

[Blog](https://hamloy.com/blog)

# Run Claude Code and Codex on the same repo without them clashing

With two agents on one repo you lose track of who is on what. What worktrees and a TODO.md fix, where they stop, and the same setup with one shared list.

12 October 2026 · Rahmakyan

Claude Code and Codex are good at different things, so sooner or later you run both on one repo. For an hour it feels like two people working for you. Then you can't say which of them is on what, which branch holds which change, or whether the task one of them called done was ever merged. You scroll two terminals to find out, and while you do, both have reached for the same file.

Neither agent did anything wrong. Each did what it was told, and neither knows the other exists. The one who is supposed to know is you, and you have two windows and no overview. This is a walk through the usual do-it-yourself fixes, where each one stops, and then the same setup with a list both agents share. You can follow it on a repo of your own. Our example is Pebble, a small habit tracker, and the replies are the ones Hamloy gives.

## What goes wrong

Four things, and they are separate problems:

1. **You lose track.** Who is on what, on which branch, and what is waiting on you? The answer is spread over two terminals, and neither agent can tell you about the other.
2. **A plan in each head.** Claude Code keeps its own checklist; Codex keeps its own. Neither sees the other's, and both are gone when the session ends.
3. **Done that isn't done.** A task ticked on a branch isn't in anyone else's hands. The other agent builds on work it can't see yet.
4. **The same task, or the same file.** You tell both "take the next thing" and both pick the streak counter. Or the tasks differ and both touch `HabitRow.swift`, and you meet it as a merge conflict.

## Fix one: a worktree each

Start here whatever else you do. Two agents in one folder overwrite each other's files as they type. Give each its own worktree and branch:

```
git worktree add ../pebble-claude -b feat-streaks
git worktree add ../pebble-codex -b feat-dots
```

Start Claude Code in one folder and Codex in the other. Now neither can change a file under the other's feet, and each commit is on its own branch.

**Where it stops.** A worktree keeps the files apart until the merge, and nothing else. Both agents can still take the same task, each in its own folder, and you find out when two branches fix one bug. Both can still rework the same file; the conflict is only put off. And you know no more than before about who is doing what. Worktrees keep the files apart for the afternoon and leave the other three problems alone.

## Fix two: a TODO.md they both read

The next idea is a list in the repo, and a rule in `CLAUDE.md` and `AGENTS.md`:

```
Before you start a task, mark it [~] with your name in TODO.md. Skip tasks marked [~].
```

In one folder with one agent, this works well. With two worktrees it breaks in a way that is easy to miss: **the file is on a branch, so each worktree has its own copy.** Claude marks the streak counter in `../pebble-claude/TODO.md`. Codex opens `../pebble-codex/TODO.md`, where nothing is marked, and takes the streak counter too. Each followed the rule to the letter.

You can keep the file outside the repo, or have both commit it to main at every step. Then two agents write to one file at once, and the mark still can't refuse anyone: it is a line of text, and the second agent to reach it has no way to know it changed a second ago.

## Fix three: you, in the middle

What most people end up doing is carrying messages. You tell Codex what Claude is on. You paste Claude's summary into Codex's window. You keep in your head which branch has what. You are the overview, and it works as long as you watch both the whole time, which is the thing you got two agents to avoid.

## The same setup with one shared list

What all three fixes lack is one place outside both sessions, which both agents write to and you can read. That is what Hamloy is: one list for the project, on a server, which both agents reach through MCP, and one page where you see all of it. The worktrees stay. The `TODO.md` and the carrying of messages go.

### 1. Connect both, once

In the repo's folder:

```
curl -fsSL https://hamloy.com/install | sh
```

Your browser opens on Hamloy; choose **Allow** and pick the project for this folder, or a new one named after it. The program sets up whichever of the two is on the computer, and says what it did (shortened here):

```
The project for ~/pebble
  ✓ linked ~/pebble to Pebble
Claude Code
  ✓ ~/.claude/settings.json: the program's hooks (quiet in folders not linked to a project)
  ✓ ~/.claude.json: the project's tools for ~/pebble, signed in through the program
Codex
  ✓ ~/.codex/hooks.json: the program's hooks (quiet in folders not linked to a project)
  ✓ ~/.codex/config.toml: your projects' tools for Codex, signed in through the program

~/pebble works on Pebble now.
  Claude Code: start it here (or restart it), and type /hamloy to see the lists.
  Codex: start it here, and approve Hamloy's hooks once with /hooks (Codex asks, by design).
```

Nothing is written into your folder, and every worktree and branch of the repo works on the same project. That last part is what the `TODO.md` couldn't do: the two worktrees from fix one now read one list. In Codex, type `/hooks` once and approve Hamloy's.

### 2. Put the work on the list

If the plan is in a `TODO.md` or a `PLAN.md` already, ask either agent to bring it into Hamloy. It comes in one call, with headings, subtasks and what waits on what:

```
⏺ hamloy - Bring in work kept elsewhere (MCP)(lists: {"task": "## Site\n- [x] Pick fonts\n- [] Order form for cakes <!-- id:T2 needs:R1 prio:high -->\n…", "request": "- [] Get the cake price list from Hana <!-- id:R1 -->", "question": "- [] Do we take deliveries? …"})
  ⎿ brought in 10 tasks, 1 request, and 1 question (3 done)
```

No plan yet? Tell one of them what you want built and to put it on the list as tasks.

### 3. See both on one page

Start Claude Code in one worktree and Codex in the other, and open the project's board. This is the overview you didn't have:

_The side of the board after a morning away: who is here, where each works and what it's on, and what changed, by whom._

**Here now** is each agent with its repo, its branch and what it is on, and **Recent changes** is what happened, newest first, with who did it. The overview's pages go further: **Right now** adds what is ready with nobody on it, **For you** holds what only you can do or decide, and **Recently done** and **History** say what happened while you were away.

In Claude Code, `hamloy statusline on` puts the task that session holds, and what waits on you, in its status line.

### 4. Tell both to take the next task

Both agents write to that page as they go, starting with what they take. Claude, in its worktree, claims the streak counter:

```
⏺ hamloy - Claim an item (MCP)(key: "B-k3f9")
  ⎿ B-k3f9@4 "Streak counter on the home screen" claimed by this session
```

A minute later Codex, in the other worktree, reaches for the same one:

```
• Called hamloy.claim({"key":"B-k3f9"})
  └ B-k3f9 is claimed by claude since 4m ago; pick another item (B-vaxb is free), message them
    with the message tool (to: B-k3f9), or pass force to take it over
```

The refusal names a task that is free, so Codex doesn't stop to ask you. It takes that one:

```
• Called hamloy.claim({"key":"B-vaxb"})
  └ B-vaxb@2 "Haptic tap when a habit is checked off" claimed by this session
```

_Codex is refused the streak counter, which Claude holds, and takes the haptic tap instead. Claude Code or Codex, the claim holds._

You didn't write a rule for this. Every session is told to claim before it starts, in the server's own instructions, and the claim is kept on the server, not in a file either of them holds a copy of.

### 5. When they meet in a file anyway

Two different tasks can still lead to one file. The program tells Hamloy the names of the files each agent edits, never what is in them. When Claude edits a file Codex changed a few minutes ago, the reply to its edit says so:

```
Hamloy: another agent is working in the same files.
- codex (session b41f06d2, on feat-dots), who is on B-25qb "Show the week as dots", also edited Sources/Habits/HabitRow.swift 4m ago. Check with them before you change it more: message them with the message tool (to: b41f06d2).
```

It is a warning, not a lock: both can go on. What usually follows is one short message. This is Codex telling Claude about a rename, and how it arrives, under Claude's next tool reply:

```
Hamloy news (what changed since you last looked):
- Message from codex (session b41f06d2) about B-j6e9: I'm renaming Habit#days to Habit#checkins on my branch; use the new name. (reply with the message tool, to: b41f06d2)
```

_Claude messages the task Codex is on. Codex hears it with its next tool reply, answers, and keeps out of the file. Nobody copies anything between windows._

That is the message you used to carry by hand.

### 6. Done means merged

Claude finishes on its branch and ticks the task. The reply says where the work is:

```
[x] B-87bd@2 Count streaks per habit (done by claude on 2026-10-10; on feat-streaks, not merged into main yet)
```

Codex, claiming the task that builds on it, is told the same:

```
B-veqj@1 "Streak badges at 7, 30 and 100 days" claimed by this session
note: it still waits on B-87bd "Count streaks per habit" (done on feat-streaks, not merged yet); do only what doesn't depend on that
```

Once you merge the branch, the task says merged, and then pushed. Delete the branch without merging and the task turns red on the board instead of staying quietly "done".

_Codex merges its branch, then pushes. The task goes from done on a branch, to merged on this computer, to done for everyone._

## What stays as it was

Claude Code and Codex keep working their own way, in their own sessions, started by you. You still merge. No file is ever locked, and Hamloy never sees your code: the program sends file names and branch names, not what is in them. What changes is that both write down what they take and finish in one place, and you read it on one page.

## Try it

One project is free, with as many agents as you like on it. The steps in full are in the docs for [Claude Code](https://hamloy.com/docs/claude-code) and [Codex](https://hamloy.com/docs/codex); the rules behind this post are in [Claims](https://hamloy.com/docs/claims), [Agents talk to each other](https://hamloy.com/docs/messages) and [Following git](https://hamloy.com/docs/git).

If you are weighing this against what the agents have built in, see [Hamloy vs Claude Code's own to-do list](https://hamloy.com/compare/hamloy-vs-claude-code-todos) and [Hamloy vs Taskmaster](https://hamloy.com/compare/hamloy-vs-taskmaster). For three sessions of the same agent, [Three Claude Code sessions, no two on the same task](https://hamloy.com/blog/no-two-sessions-on-one-task) goes through the same moments.
