Ten rules for catching conflicts between coding agents
How ten deterministic rules detect when parallel AI agents' changes collide, from renamed functions to overlapping migrations, measured on 187 scenarios.
Lanekeeper compares every pair of lanes (git worktrees or branches) in a repository and reports clashes: places where one agent’s changes would break another’s. It does this with ten rules, each covering a different kind of cross-lane conflict.
Every rule is deterministic — the same changes always produce the same result. No language model is involved. The rules are measured against 187 clash scenarios, 33 of them derived from real changes in open-source projects including FastAPI, Requests, Hono, Express and Zod.
Key takeaways:
- Ten rules cover the most common cross-agent conflicts: same-symbol edits, signature changes, removed definitions, merge conflicts, claimed regions, type changes, migrations, lockfiles, routes, and combined CI failures.
- Always-high rules: R3 (removed definition used elsewhere) and R10 (PRs that fail together). Rules R1, R2, R4, R5 and R7 are high or warn depending on context. R6, R8 and R9 are always warn.
- Every rule is deterministic and measured against real open-source changes. High-severity precision is 100% on the realistic subset.
- Languages: TypeScript, JavaScript and Python get deep analysis; Go, Rust, Java, Kotlin, Swift, Ruby, C# and PHP get name-level detection capped at warn.
The rules
R1 — Same symbol modified
Both lanes change the same function, class or type in different ways. Neither is necessarily wrong on its own, but the combination may not make sense — two different rewrites of the same logic. Severity: high or warn.
R2 — Incompatible signature change
One lane changes a function’s signature (adds a required parameter, removes one, changes the return type). Another lane adds a call that matches the old signature. Severity: high when the call would fail; warn when the call might still work (for example, the new parameter has a default value).
R3 — Removed definition used elsewhere
One lane removes or renames a function, class, type, or constant. Another lane starts using it. Severity: high.
This is the most dangerous clash. The removed symbol no longer exists, but the new code expects it. Git merges silently because the two changes are in different files.
R4 — Textual merge conflict predicted
Both lanes edit the same lines of a file; Lanekeeper confirms with an in-memory git merge-tree. Severity:
high or warn depending on the overlap.
R5 — Claimed region edited
A lane edits code that another lane has claimed for a refactor (via lk claim). Severity: high or warn. This
rule is local only — it doesn’t apply in CI.
R6 — Breaking type or shape change
One lane changes the shape of a type, interface, or return value (removes a field, changes a field’s type). Another lane uses the old shape. Severity: warn, because static analysis of types across files is approximate.
R7 — Competing migrations or timestamps
Both lanes add a database migration with the same sequence number, or both add an entry to a file that’s ordered by timestamp or version. Severity: high or warn.
R8 — Lockfile conflict
Both lanes change the same dependency lockfile (package-lock.json, yarn.lock, pnpm-lock.yaml, Cargo.lock,
and others). Lockfile merges are notoriously fragile: git merges the JSON or YAML, but the result may silently
drop one side’s packages. Severity: warn.
R9 — Route or endpoint collision
Both lanes add or modify the same HTTP route, API endpoint, or the same environment variable with different values. Severity: warn.
R10 — Combined CI failure
Two pull requests each pass CI alone but fail when merged together. This is the strongest signal — the conflict is confirmed by an actual build — but it requires the GitHub Action and a build command. Severity: high.
How they’re measured
Each rule is tested against positive scenarios (a clash should fire) and negative scenarios (similar-looking changes that are not a clash). Precision and recall are reported per rule and per severity tier. A release doesn’t ship if high-severity precision drops below 95%.
The realistic scenarios come from real changes in open-source projects. For example, a FastAPI scenario where one branch renames a dependency-injection function and another branch adds a route that uses it. These are harder than synthetic tests because real code has aliases, re-exports, and patterns the rules weren’t written for.
The full benchmark report is generated by pnpm bench and published with every release.
What the rules don’t do
The rules compare code structure, not intent. They don’t know whether two agents are working toward the same goal
or different goals. A rule can tell you that lane A removed processPayment and lane B calls it; it can’t tell
you whether that’s a problem or whether lane A is about to add a replacement that lane B should wait for.
The rules also don’t cover every language equally. TypeScript, JavaScript and Python get deep analysis (imports, arity, keyword arguments). Go, Rust, Java, Kotlin, Swift, Ruby, C# and PHP get name-level analysis, so their clashes are capped at warn severity. Adding deeper analysis for more languages is ongoing work.
See the rules reference for the full specification of each rule, with examples.
Further reading
- Your agents are breaking each other’s code: the problem Lanekeeper solves.
- How to run multiple AI coding agents: the worktree pattern and coordination strategies.
- Quick start: install and see your first clash in two minutes.
- Claude Code integration: warn mode, block mode and the plugin.
- MCP server: how agents discover clashes through MCP tools.