claude code and cursor on one team
published · updated
with agentmash, each developer’s agent in Claude Code or Cursor is told before editing a file a teammate’s agent just changed. Cursor’s, as the login connects it, gets it the only way a hook can before an edit: its first edit of a file a teammate is in is refused, with the reason, and its next try goes through.
how claude code and cursor work together
- the Cursor adapter reports each edit from Cursor’s
afterFileEdithook: the file and the shape of the change, like+12/-3 lines, touching deletedAt, the same summary a Claude Code edit gets. beforeSubmitPromptsends the prompt, which becomes the task hint, andsessionEndsays when a session ended.- so a Cursor teammate’s edits show on the board, and in the advisory a Claude Code agent reads before it edits the same file.
- before an edit, Cursor’s
preToolUsehook asks the room about the file. Cursor drops what a hook adds to its agent’s context, so when a teammate is in the file, the adapter refuses the first edit with the advisory as its reason, once per conversation and file every ten minutes, and lets the retry through. - the MCP server is in Cursor’s own settings too, so its agent can ask who is working where, and claim files, before it starts.
- the
cursor-agentCLI runs the same hooks, so a teammate working in it is reported and warned the same way.
what cursor’s agent isn’t told
the warning is a refusal, not a note beside the edit: the agent meets it as an edit that failed with a reason, and tries again knowing it. it comes once per conversation and file every ten minutes, so another edit of that file in that time goes through unpaused. and a shell command the agent runs names no file, so it is never paused.
a Cursor edit is reported without the names it changed: the touching deletedAt in its summary is text that people and agents read, and it’s never matched by name. so matching by symbol runs one way. before Cursor’s agent edits src/api/handlers.ts, its check sends the names that file imports and exports, so it’s told when a Claude Code teammate’s agent changed createUser in the last half hour by default. when Cursor’s agent changes createUser, a Claude Code agent hears of it only before it edits src/models/user.ts itself, unless Cursor’s agent claimed the work first and named createUser.
the warning is about teammates. if you run Claude Code and Cursor yourself on one repository, both report as you, and by default neither is warned about the other. with AGENTMASH_WARN_SELF=1, Claude Code is told about your Cursor edits too; Cursor’s own check doesn’t do that yet. keeping your own agents apart is a worktree’s job, as git worktrees and agentmash explains.
cursor’s parallel agents, worktrees and cloud agents
Cursor runs several agents of its own. as its docs describe them on :
- worktrees. from the Agents Window, or with
/worktreein the editor, an agent works in a separate checkout of the repository, so its changes stay out of your main one./best-of-nruns one task across several models, each in a worktree of its own, and merges nothing back:/apply-worktreebrings a result into your checkout. from Cursor 3.5, past 25 worktrees per machine by default, Cursor cleans up the oldest in its worktree folder, including ones made withgit worktree add. - cloud agents, once called background agents. each runs in an isolated VM, clones the repository, works on a separate branch and pushes its changes for handoff. cloud agents need a paid Cursor plan, and several can run at once. a teammate on the same Cursor team who can reach the repository through their own source control account can open a run, read-only unless an admin turns on team follow-ups.
- subagents and
/multitask. a main agent hands parts of a task to subagents, each in its own context, and/multitaskruns them in parallel instead of queuing your requests.
worktrees keep one developer’s agents out of each other’s files, subagents keep their contexts apart, and a cloud run lets a teammate look once it’s there. none of the three pages describes telling an agent, while it works, what a teammate’s agent is changing on another machine; agentmash tells an agent before it edits. its adapter counts any worktree of the repository as the repository, so an edit Cursor’s hooks report from one goes to the same room, under that worktree’s branch, or its commit when no branch is checked out there.
a cloud agent is the exception. it runs the hooks committed in the repository’s .cursor/hooks.json, but not the ones in your ~/.cursor/hooks.json, since the VM can’t reach your home directory. that file is where npx agentmash login puts agentmash’s hooks, so with the login alone a cloud agent’s edits don’t reach the room, and no advisory reaches the cloud agent before it edits. the adapter a repository can commit instead, in .cursor/hooks.json, never answers before an edit, so it can’t warn a cloud agent either.
everyone else, through git
a git post-commit hook, installed once per checkout, reports what landed in each commit: the files, the commit subject and the line counts. it shows where someone landed, not what they’re doing, and it never warns before an edit. aider commits every change by default, so the git client sees aider users close to when they edit. for vim, Emacs or any other editor, it’s commit time only.
every tool, as of the last check
| tool | what it gives a hook | adapter |
|---|---|---|
| Claude Code | PostToolUse: the path, the prompt, the session, before and after | built |
| Cursor | afterFileEdit: the path and the edits, as fields; preToolUse before | built |
| Devin (formerly Windsurf) | Claude Code’s own hooks, which it runs | built |
| Codex CLI | PreToolUse and PostToolUse, with the path read out of the patch | built |
| GitHub Copilot | PreToolUse and PostToolUse, in VS Code and its CLI | built |
| Amp | a plugin of ours: the files Amp names for a call; the advisory as a refused first edit | built |
| Antigravity | PostToolUse after an edit, and a heads-up at the start of each turn; connected when asked for | built |
| Cline | hook files before and after a tool; the advisory arrives just after the edit | built |
| Crush | PreToolUse only: the advisory as a refused first edit, the edit reported once its file changes | built |
| Factory Droid | PreToolUse and PostToolUse: the path, or the patch; the advisory as a refused first edit | built |
| Gemini CLI | BeforeTool and AfterTool: the path; the advisory as a refused first edit | built |
| goose | a decision before a tool, AfterFileEdit after one; the advisory as a refused first edit | built |
| Junie | PreToolUse only: the advisory before the edit; the edit reported a step later | built |
| Kilo Code | a plugin of ours: the path, or the patch; the advisory as a refused first edit | built |
| Kiro | PreToolUse and PostToolUse: the advisory as a refused first edit, by exit 2 | built |
| OpenCode | a plugin of ours: the path, or the patch; the advisory as a refused first edit | built |
| OpenHands | PreToolUse and PostToolUse, and a plugin for Agent Canvas; the advisory as a refused first edit | built |
| Qwen Code | PreToolUse and PostToolUse: the advisory as a refused first edit, after the edit is approved | built |
| Continue | no hooks: the MCP tools only | built |
| Zed | no hooks: the MCP tools only | built |
| Aider | no hook, but it commits every change by default | the git client covers it |
| vim, Emacs, any editor | nothing | commit time only, through the git client |
read from each tool’s own documentation on , and the tools from Amp to Zed on , from their documentation and, where it is open, their source. every coding agent the login connects has been tested with agentmash: Claude Code, Codex, Cursor, GitHub Copilot, Devin, Amp, Antigravity, Cline, Crush, Factory Droid, Gemini CLI, goose, Junie, Kilo Code, Kiro, OpenCode, OpenHands, Qwen Code, Continue and Zed.
set it up
each developer runs npx agentmash login once. it finds Cursor and adds agentmash’s hooks to ~/.cursor/hooks.json and its MCP server to ~/.cursor/mcp.json, in the home directory and never in a repository, so nothing is committed. then restart Cursor. the repository itself is connected once, by someone who can push to it, at agentmash.dev/install.
step by step, with a prompt to paste into Cursor: setting up Cursor.
the cursor adapter →every tool, with sources →write your own →