Five coding agents on one repo is a staffing problem, and worktrees only fix the filesystem
A near-miss in one developer's repository: an agent planned a production build from a branch that only looked authoritative. What stopped it was a peer agent, and then written rules.
The Engineer · Build desk
What happened
- A developer running 3 to 5 Claude Code sessions on the same microservices found he was managing a team rather than a toolchain.
- One session announced a frontend build of version 1.0.399 based on main, but production's authoritative branch was a separate deployment branch that main trailed badly.
- The other session warned it off; the build was halted before any push, and the changes were cherry-picked onto the deployment branch instead.
- The agents settled it between themselves over session-to-session messages, and the human read about it afterwards in the logs.
- The write-up sets out seven operating rules drawn from that run, covering worktrees, directory ownership, tag reservations and deploy state.
Why it matters
- What it limits constraint Per-session worktrees cap file collisions and leave the registry tag space, the base-branch convention and cluster state unguarded, so those namespaces set your ceiling on concurrent agents, not...
- Who's exposed exposure An agent with build and deploy rights can regress production while every line of its diff is correct, because the mistake is in the base it started from rather than the code it wrote.
- Who has to decide decision Anyone adding a fourth or fifth agent now has to decide whether coordination lives in prose the agents may or may not read, or in structure the repository enforces.
- What it sets up precedent The move that generalises beyond this stack is keeping deployed state in version control, which makes agent coordination a read of the repo rather than a conversation.
A git worktree per session buys separation of working files and not much past that [7][18]. Everything that broke, or nearly broke, sat in a namespace the worktree does not cover [18]. Container image tags are global to the registry, so two sessions building different content as 1.0.399 produce a silent overwrite, and the author reports a chained command error that pushed new content onto an old tag, so the behaviour survived the rollback [11]. Branch authority is the same class of shared fact: main looked like the base and was not, because production tracked a dedicated deployment branch that main trailed by dozens of versions [3].
Read the near-miss as an operations failure rather than an agent failure. Session B's plan was internally coherent, which is to say it announced a frontend build of 1.0.399 from main [2], and it was wrong only because of a repository convention that had never been written anywhere the agent could read it [13]. Session A caught it, B stopped before pushing and cherry-picked onto the deployment branch instead [5], and the human found out afterwards from the logs [6]. A correct diff on the wrong base would have taken weeks of shipped features out of production [4].
The arithmetic decides how far any of this scales. Coordination is pairwise: three sessions have three channels to keep straight, five have ten [17]. Going from three agents to five roughly triples the number of relationships every rule has to hold across, while the cost of adding each agent stays flat. That curve is why human teams grow process, and the recipes here are that process. Territory is assigned by directory, with talk components to the voice session, broadcast to streaming, and callgw to the phone session [8]. Shared trees get a hard check of branch and git status before any commit, adopted after one session nearly committed another session's staged changes [9].
The item I would lift out of the seven [15] is the shape of the stand-up. Sessions declare not only the files they will touch but the ones they will not, and the author credits that second half with nearly eliminating file conflicts [10][20]. Declaring intent is cheap. Declaring abstention is what lets a peer keep working without asking permission. It is also the only outcome the post reports, and it is a qualitative one [20].
The durable fix is the ledger. Put what is running where into Kubernetes manifests and commit the tag update with each deploy, and any session can read the current state out of the repository instead of querying the cluster [14]. A registry check by API before deploying does the same job for tags [12]. Both moves convert an ambient fact into a versioned one, which is the only form a peer with no memory of yesterday can be trusted to read. This is one team's operating experience, originally published in Japanese and carried on dev.to as a follow-up to an earlier piece on worktrees [16], and it comes with no collision counts on either side of the rules.
What to watch
- A published count of collisions before and after the rules, which would turn a good anecdote into something you can size a policy against.
- Whether the recipes still hold above five concurrent sessions, or whether the shared namespaces cap useful concurrency first.
- Whether declarations move from free text into a schema the repository enforces, so no session can build without naming its base branch and tag.
Clarity's read
What the record supports and how the coverage leans. The claims behind it follow.
Reality
- Evidence38
- Adoption16
- Hype gap+22
- Incentives34
- Confidence46
Claim ledger
Ranked by verification strength, evidence, and original report placement.
- [1]
The author ended up with 3 to 5 Claude Code sessions simultaneously developing the same microservices, which he describes as having become actual team development rather than parallel execution of tools.
- [2]
Session B (streaming) messaged that it was about to build the frontend as version 1.0.399 based on main, while Session A (voice) was mid-refactor.
- [3]
In that repository the authoritative branch for production was not main but a dedicated deployment branch; the latest features from the past few dozen versions existed only in the deployment branch, and main was outdated.
- [4]
Had Session B deployed an image based on main, weeks' worth of features would have been rolled back in production.
- [5]
Session A sent a warning, Session B halted the build before pushing, then cherry-picked its changes into the deployment branch and rebuilt the image.
- [6]
The exchange was handled autonomously between the agents via session-to-session messages, and the human author only learned of it later from the logs.
- [7]
Recipe: assign a dedicated Git worktree to each session.
- [8]
Recipe: explicitly define which session owns which service or directory, for example the voice session handling talk-related components, the streaming session handling broadcast-related components, and the phone session handling only the callgw directory.
- [9]
For shared worktrees the rule is to always check the branch and git status before committing, made strict after an incident where one session almost committed staged changes belonging to another session in a shared tree.
- [10]
The stand-up equivalent: before starting, a session declares which files it will work on and which it will not touch; on completion it reports base branch, commit, the changes made, and the image version reserved.
- [11]
Container image tags are a shared namespace: two sessions building different content under the same tag such as 1.0.399 causes a hard-to-detect tag overwrite, and the author describes a chained command error that overwrote an old tag with new content so the behaviour persisted even after a rollback.
- [12]
Recipes for tags: declare tag reservations between sessions, and after building verify via the registry API that the tag exists before deploying.
- [13]
The root cause of the incident was the assumption that main is the authoritative branch; the fix is to document the deployment base branch in operational notes or memory accessible to the agents, prohibit main-based builds while main and the authoritative branch diverge, and define merge timing as after major changes stabilise.
- [14]
Recipe: consolidate what is running in which environment into a declarative repository such as Kubernetes manifests and commit tag updates with each deployment, so other sessions can check current state without querying kubectl.
- [15]
The article presents seven recipes that emerged from actual operations.
- [16]
The account was originally published in Japanese at forge.workstyle.tech and carried on dev.to, as a follow-up to a previous article on an environment for parallel execution of coding agents using Git worktrees.
- [17]
At three concurrent sessions there are 3 pairwise coordination channels; at five there are 10, so moving from three agents to five roughly triples the pairwise relationships every rule must hold across.
- [18]
The reported failure and near-failure both occurred in resources that per-session worktrees do not isolate: the registry tag namespace and the identity of the authoritative deployment branch.
- [19]
The author reports that the issues arising in human teams (miscommunication, deployment conflicts, territorial overlaps) occur among parallel agents too, and that practices which work for human teams work almost identically.
- [20]
The author says declaring scope, including what will not be touched, on its own nearly eliminated file conflicts in practice.
Get this ledger inside ChatGPT. Ask about any of our stories and the answer brings its figure, each claim’s verdict and the sources. Free, no account.
Sources
1 independent publisher whose own reporting we read for this story.
- dev.toRunning Claude Code in 4 Parallel Sessions Led to 'Team Development' — 7 Recipes to Prevent Collisions
1 article · August 26, 2026
Topics and entities
Follow any of these and your For You feed starts watching them — no settings page required.