ai newsDi., 1. Dez.

How to stop your teammates' AI coding agents editing the same files

Short answer: no single thing stops it. A git worktree for each agent stops overwrites on one machine. Nothing in git tells your agent what a teammate's agent is doing on another machine. For that, each agent has to say which files it is about to touch before it edits, somewhere the other agents ca

dev.toMontag 02:13 · 30.11.3 Min. Lesezeit
Bild: dev.to

Short answer: no single thing stops it. A git worktree for each agent stops overwrites on one machine. Nothing in git tells your agent what a teammate's agent is doing on another machine. For that, each agent has to say which files it is about to touch before it edits, somewhere the other agents can see.

I'm a co-founder of KoalaFix, which works on that last part, so weigh the end of this post with that in mind. Everything before it works with plain git and costs nothing.

At my previous start-up, three of us ran AI coding agents all day, each in a different tool. For months they walked over each other's work. We found the clash at merge, or after we had shipped.

It is not only us. A study of 33,596 pull requests opened by AI coding agents took a sample of 600 rejected ones. In 142 of them, the work already existed in another pull request.

A worktree is a second checkout of the same repo, in its own folder, on its own branch. Two agents in two worktrees can't overwrite each other's files.

git worktree add../app-billing -b billing git worktree add../app-search -b search Enter fullscreen mode Exit fullscreen mode The limit: a worktree lives on one machine. It does nothing about your teammate's agent on their laptop. And two branches can still change the same function. You find that out at merge.

If you use CODEOWNERS and branch protection on GitHub, they back this up at review time.

Your agents can't follow a convention they never see. Write it once, in the repo.

The limit: a rule is advice the agent reads at the start. It can say "don't touch the billing folder without asking". It can't say that someone's agent is in the billing folder right now.

This is the part git doesn't have. There are two ways to do it.

File locks. The first agent takes the file, and other agents are turned away until it is released. Authora explains how this works, and their tool AgentSync does file locking.

Warnings and check-ins. Nothing is locked. The second agent is told who is already there before it edits, and it picks other work. Amoeba warns when two agents' work overlaps. KoalaFix, the one my team builds, does check-ins.

Locks are stricter. Check-ins are lighter. Pick by how strict your team wants it to be.

In July 2026 we made one rule. Before an agent touches anything, it says what it is about to do. If another agent is already checked in on those files, the new one is told before it starts. The collisions stopped.

That rule became KoalaFix. It is a hosted MCP server. Before its first edit, an agent tells it what it is working on and which files. Every other agent on the team can see that, and an agent about to start on the same thing is told first. It works with Claude Code, Codex, Cursor, Claude, ChatGPT, OpenCode, GitHub Copilot and any other MCP client, so each person keeps their own tool.

I wrote a longer guide with a side-by-side table. We also keep a comparison of the tools that work on this, ours included.

How does your team handle it? I'd like to hear what has worked and what hasn't.

This post was drafted with AI help. The facts and links were checked against each source on November 30, 2026, and the experience in it is my team's.

Quelle: dev.to (dev.to). Original öffnen