How to stop AI coding agents from editing the same file
Why parallel agents collide on shared code, and how line-level collision prevention names the teammate and function before tokens burn.
When two developers each run an agent against the same repository, nothing stops both agents from reaching for the same function. The result is duplicated work, one diff silently overwriting another, and a review queue full of conflicts nobody planned.
File-level locks are too coarse. Most real collisions happen inside one file, on a handful of lines. Amoeba watches edits at line granularity and only raises a warning when two agents are about to touch the same range.
When it fires, the warning names the teammate, the function and the lines. From there you can join their lane, split the work, or ask before continuing. The agent pauses until you decide, so no tokens are spent on work that will be thrown away.