start
what agentmash is
agentmash (AgentMash) is a coordination layer for teams whose developers each run AI coding agents, such as Claude Code and Cursor, on the same repository.
When several people work on the same repository, their edits collide: two of them touch the same file, one breaks the interface the other is building against, both write the same helper. AgentMash reports every edit to a small coordination server and warns an agent before it walks into one — no fork, no wrapper.
The Claude Code hooks are the deepest integration, and they are not the only way in:
- A PostToolUse hook reports every
Write/Edit/MultiEditto a coordination server, along with the exported symbols the edit changed. - A PreToolUse hook checks that server before an edit. If a teammate's agent touched the same file — or changed a symbol your file depends on, anywhere in the repo — the heads-up is injected into your agent's context window, mid-task, so it adapts on its own — graded by severity, and worded so the agent knows what to do without leaving its task. See What your agent actually sees.
- A UserPromptSubmit hook captures your prompt as a task hint, so every event says what a teammate is doing, not just which files they touched. A SessionStart hook gives your agent a short heads-up when a teammate's agent is at work on your branch or in a file your session changed — a few lines, whenever a session starts or its context is cleared or compacted — and a second prompt hook gives it again when that changes: at most once every ten minutes, and only when it is news.
- A SessionEnd hook reports a session that ends in an orderly way, and the server ages out the ones that don't — so the board says gone when someone is gone.
- An MCP server lets an agent ask the same room "who is working on what?" while it is still planning — before it has picked the files it will change.
- A git post-commit hook reports what landed in a commit, so a teammate on Cursor, on vim, or on nothing at all stops being invisible.
- A Cursor adapter reports edits live from Cursor's
afterFileEdithook, and at user level warns Cursor's agent by refusing its first edit of a file a teammate is in, with the advisory as the reason. Codex, GitHub Copilot and Devin run the same hooks as Claude Code;npx agentmash loginconnects every one it finds. - A generic hook (
hooks/agent_hook.mjs) runs the same scripts for every other agent with hooks, and answers in each one's own format: Amp, Cline, Crush, Factory Droid, Gemini CLI, goose, Junie, Kilo Code, Kiro, OpenCode, OpenHands and Qwen Code, and Antigravity when you ask for it. Continue and Zed have no hooks, and get the MCP server alone. A tool of your own can run the generic hook too, or call the public API.
A room that sees half a team gives advice based on half the truth, and that reads as authoritative — so what each client can and cannot see is written down plainly in docs/ADAPTERS.md, along with what every other agent tool offers today. The wire contract itself is PROTOCOL.md: write a client against that and it joins the room like any other.
Reliability contract: every client caps every network call with a hard timeout and exits
0 silently on any failure — server down, slow, misconfigured, garbage input. A broken
coordination server can never block anyone's coding, or anyone's git commit. The cap is per
path, because the paths cost different people different things:
| Path | Cap | Who waits |
|---|---|---|
The advisory before an edit (PreToolUse) | 1500 ms, AGENTMASH_TIMEOUT_MS | The agent, on every edit — this is the only number a team feels |
Reporting an edit or a prompt (PostToolUse, user_prompt_submit.mjs, the git and Cursor clients) | 2500 ms | Nobody: these are registered async: true in every install, and the git client backgrounds itself |
The heads-up on teammates at work on your branch or your files (SessionStart, and prompt_note.mjs on UserPromptSubmit) | 1500 ms at a prompt, whatever timeout_ms says, and in a login install the room lookup before it when this machine has not looked that checkout up lately, all inside a 2500 ms exit guard; the advisory budget at a session's start | The agent, at most once in ten minutes per session: every other prompt costs a node start and no network, and no prompt waits on the report |
Saying goodbye (SessionEnd) | 1500 ms, 2500 ms exit guard | The session that is already ending, once, under Claude Code's own 4 s hook timeout |
Inside that cap, each connection attempt gets half of it. Node's own default is 250 ms per
resolved address, which is shorter than a TCP handshake from far enough away: every attempt
was abandoned and the hooks failed in ~300 ms, silently, against a server curl reached
fine.
One number is not enough here, and 1500 ms is not a guess: npm run bench:budget measures
what a cold hook costs against a server at a given distance, and Where the 1500 ms
goes has the table. A refused connection fails in milliseconds,
not at the cap, and a server that is merely unreachable — a firewall, a hung instance, which
answers neither way — is abandoned by the pre-edit hook at its own budget rather than at a
flat 4 s exit guard that used to apply whatever the budget was. That is ~1.6 s at the
1500 ms default, and ~4.1 s on a link distant enough that init wrote timeout_ms: 4000
— the budget plus process start, measured, in both cases (npm run bench:budget, section D).
A bigger budget buys a longer wait on the one path where nothing comes back; the exit is 0
and stderr is empty either way. The MCP tools can't exit silently, because silence there reads
as "nobody is working on anything" — the one answer that must never be a guess. They say
"coordination server unreachable — treat this as unknown" instead. All of it is tested,
including against a deliberately slow server and an unreachable one.