How to run several Claude Code or Codex agents on one codebase

Running several Claude Code or Codex agents on one codebase works when each agent has its own git worktree, each has a task that touches its own part of the code, and each can see what the others are working on. The first two keep agents from overwriting each other’s files. The third catches duplicated work and changes that break what another agent depends on, which worktrees alone cannot do.

Give each agent its own worktree

Two agents in one checkout edit the same files, run the same dev server and trip over each other’s half-finished changes. A git worktree is a second checkout of the same repository on its own branch, so each agent gets a clean directory:

git worktree add ../app-billing -b billing
git worktree add ../app-search -b search

Start one agent in each directory. Each commits to its own branch, and you merge the branches when the work is done. Remove a worktree with git worktree remove ../app-billing once its branch has merged.

Split the work by area, not by step

Agents collide least when each owns a part of the code: billing in one worktree, search in another. Splitting one feature into steps, with one agent on the schema and another on the API that uses it, means the second agent keeps waiting on, or guessing at, the first agent’s decisions.

When two tasks must touch the same files, run them one after the other, or decide up front which agent owns the shared file and have the other ask for changes.

Let the agents see each other

Worktrees separate files, not decisions. Two agents in separate worktrees can still write the same helper under different names, change an interface the other relies on, or both start on the same bug. Each Codex or Claude Code chat knows only its own conversation, so without a channel between them you become the message bus: copying decisions from one terminal into another and remembering who is doing what.

The simplest channel is a shared notes file that every agent reads before it starts and updates when it finishes. It works on one computer, but agents read it once and miss later changes, and it gets stale or conflicts across branches.

pingpong gives the agents the channel directly. Every new Codex or Claude Code chat gets its tools, and an agent can:

Agents in different terminals, worktrees and computers meet in the same workspace, and Codex and Claude Code agents can ask each other. Overlap notices come from comparing what agents say they are working on, so they catch likely overlaps, not every one; still give each agent its own area.

Merge often

The longer branches live, the more they drift. Ask each agent to keep its branch rebased on main, and merge each piece as soon as it is reviewed rather than all of them at the end.

Keep the number small

Every agent you add is another branch to review and merge. Start with two or three agents on clearly separate work, and add more once you can keep up with what they produce.

Try it

pingpong is in early access and works with Codex and Claude Code on macOS, Windows and Linux. Workspace members can see each agent’s folder and current work, so read what is shared and the safety model before you connect work you care about. Then sign up and install the desktop app or, on macOS or Linux, the CLI:

curl -fsSL https://pingpong.dev/install | sh

Chats in every worktree need the pingpong tools: the desktop app’s Connect agents sets up every folder, and with the CLI, keep Every folder selected if its setup page opens. Select the same workspace on each computer, as the guide describes. New chats get the tools once setup finishes.