skip to content
agentmash
get started
docswhat counts as a conflict

what counts as a conflict

Two questions, asked of every edit.

Same file? The original test, and still the first one. Someone else's agent wrote this exact path inside the window (default 30 minutes), or on a branch of their own that isn't merged yet, however long ago — you should know before you touch it.

Not merged yet? Work on a teammate's own branch is in nobody else's working tree until that branch merges, which is hours or days after the window has passed. So the room remembers it, by person, branch and file, for a week (or the room's own history, when that is shorter), until the branch merges. Before an edit your hooks ask for it with memory=1, look for the commit it names in your own history (git merge-base --is-ancestor, a few ms) and say nothing when you already have it; otherwise they tell the agent whose branch changed the file, when, and that it isn't merged yet, once a session:

text
[AgentMash: PARALLEL EDIT] alim's branch alim/deal-probability changed deals/DealCard.tsx 2 h ago
(commit 3f2a1bc · +12/-3 lines), while working on 'add a deal probability badge', and isn't merged
yet. You are on damir/deal-momentum, so their version isn't in your working tree and re-reading the
file won't show it. …

It stops when the work lands: the owner's hooks find their branch merged into the default branch, its files already there (a squash, a rebase), or the branch deleted, and a teammate's hooks find a commit they were told about in the default branch; either way they say so (POST /branches/settled) and nobody is told again. mark_resolved silences it between the two people it names, and a week silences it for everyone. The hooks report a commit made in a session from the reflog, as the git client reports one, so a teammate's hooks have a commit to look for. Hooks installed before this get the newest of it (48 hours, once, never on a branch they worked on) as the parallel edit they already know, and as a note when the session ends; a room's admin can turn it off (branch_memory: off in /rooms/settings).

Same symbol? The one that costs a team an afternoon. Alice changes the signature of an exported function in src/models/user.ts. Bob's agent is three files away in src/api/handlers.ts, building against the old signature. No path matching can see that, because there is no shared path. AgentMash sees it because the hooks exchange symbols:

  • PostToolUse works out which exported declarations an edit changed. An edit inside a function body never repeats the export function line, so the hook reads the file it just wrote and walks back from the edit to the declaration that encloses it.
  • PreToolUse works out what the file you are about to edit is bound to — everything it imports, plus everything it exports — and sends that with the check, with the imports apart.
  • The server matches one against the other, so a change to createUser reaches every file that imports createUser, whatever directory it lives in. Another file is matched only by what yours imports: every Next.js route exports its own GET, and none depends on another's.

Extraction runs entirely on your machine, in the hooks, with no dependencies and no parser: comments, string bodies and template-literal bodies are blanked out, and then a careful pass over lines that begin with export reads what is left. The server never sees your code — only a list of names.

The harness behind every number below is committed, and it prints its per-file rows, every name it missed and every name it claimed wrongly, so you can check the totals against the data rather than trusting them:

bash
npm run bench:symbols            # this repo's own 51 git-tracked source files
npm run bench:symbols -- --deps  # ...plus everything in node_modules

Measured against the compiler's parse of the same files: 594 of 594 symbols on this repo's own source (100%), and 34,000 of 34,594 across 7,506 files including node_modules (98.3%) — with no false positives in either. Cost is measured cold, in a freshly spawned process per measurement, because a hook is always a fresh process and extraction is never warm: p50 2.2 ms on this repo's files, 12-14 ms on its largest (108 KB), ~19 ms on a synthetic 400 KB file, and 0.2 ms for a 9 MB file the size ceiling declines to read. The Node process the hook runs in takes ~57 ms to start and read its config before any of that (npm run bench:budget, section B).

Ground truth is the TypeScript compiler already in this repo's devDependencies — bench/ is not part of what the hooks install, which stay dependency-free.

Every holder the server returns carries a confidence:

What it means
highBoth edits touch the same exported symbol, and it is a name specific enough to mean something. The one you want to read.
mediumPaths match and at least one side sent no symbols — all v0 ever knew.
lowPaths match, both sides sent symbols, and nothing they share is evidence: two agents at opposite ends of one file, or an overlap made only of names like config.

That last row is why AGENTMASH_SCOPE=dir stopped crying wolf: a same-directory neighbour that provably shares no symbols is no longer reported at all.

When it can't tell, it says nothing extra. A language the extractor doesn't read (.py, .go, .rs), a file too large to open on the edit path, an edit it can't locate — each of these sends no symbols, and detection falls back to exactly the path matching described above. Extraction failures cost you recall, never a false alarm.

from the readme, “what counts as a conflict”