How are you keeping parallel coding agents from stepping on each other?

by•

I run several coding agents on the same repo at once. Each change looks fine on its own. The trouble shows up at merge time: one agent replaces something another is extending, and Git has nothing to say because the lines don't overlap.

What do others do. One agent per repo? Strict file ownership? A human merging everything? Something else?

10 views

Add a comment

Replies

Best

I run several Claude Code sessions on one repo too, and the fix that stuck was not a Git trick but a few rules in the notes file every session reads. Stage only your own files by name, never add all. Commit by path too, because a bare commit takes whatever another session staged. Never revert, stash or clean up a change you did not make. Before a deploy that bundles the tree, check status for foreign hunks and say so instead of shipping someone's half done work. The commit by path rule came from a real day: one session's bare commit picked up a rename and a deletion another session had staged, and main stayed unbuildable until the next commit put them back. The overlap you describe, one agent replacing what another extends, I avoid by splitting by area rather than by file. Each session owns a topic, and each topic has its own notes file where decisions and their reasons go, so the next session in that area reads why something is the way it is before touching it.

I usually assign each agent a separate task or file and let them work independently Then I review the changes before merging everything How do you handle it when two agents need to modify the same file