claude code for teams
published · updated
a team on Claude Code commits CLAUDE.md, .claude/settings.json, .claude/agents/ and .mcp.json, keeps CLAUDE.local.md and .claude/settings.local.json out of git, and gives each session a worktree. none of that tells one developer’s agent what a teammate’s is changing. agentmash’s hooks report each edit to one room per repository and warn an agent before it edits a file a teammate’s agent just changed.
what goes wrong when several developers run claude code
edits collide: two agents touch the same file, one breaks the interface the other is building against, both write the same helper.
- on one branch, a teammate’s write lands in a file after your agent read it. a stale
old_stringeither fails to match or quietly reverts their change. - on two branches, both agents change the same file, and the conflict shows up only when someone merges.
- across files, one agent changes an exported function’s signature while another, in a file that imports it, keeps building against the old one.
claude code team setup: what to commit and what stays personal
besides what an organization deploys or a --settings flag passes, Claude Code reads its files from three places: your home directory, for every project; the project, shared with everyone who clones it; and personal files inside the project. a team commits the shared ones and keeps the rest out of git. each file, as Anthropic’s docs describe it on :
| file | what it holds | in git |
|---|---|---|
CLAUDE.md or .claude/CLAUDE.md | the project’s instructions: build and test commands, coding standards, naming, the workflows everyone follows | commit it |
AGENTS.md | instructions a repository keeps for other coding agents. by default, Claude Code 2.1.277 or later reads it only when there’s no CLAUDE.md, .claude/CLAUDE.md or CLAUDE.local.md in the working directory or above it. a repository that commits both puts @AGENTS.md in its CLAUDE.md, as does any session that can’t read AGENTS.md | commit it |
.claude/settings.json | the team’s shared settings: permissions, hooks, plugins and the environment variables the project needs | commit it |
.claude/agents/ | the project’s subagents, a file each | commit them |
.mcp.json | the project’s MCP servers, which each developer approves once | commit it |
.claude/settings.local.json | your overrides for this one project | never: Claude Code keeps it out of git when it writes the file; one you make by hand goes in .gitignore |
CLAUDE.local.md | your own notes for this project. in a repository that relies on AGENTS.md, having one stops Claude Code reading AGENTS.md for you, unless /config says to read both | never: add it to .gitignore |
~/.claude/settings.json and ~/.claude/CLAUDE.md | your settings and instructions for every project | outside the repository |
.claude/worktrees/ | the checkouts claude --worktree makes | add it to .gitignore |
for work in parallel, give each session its own worktree. claude --worktree feature-auth starts one in .claude/worktrees/feature-auth/, on a new branch, worktree-feature-auth, and a .worktreeinclude file at the root lists the gitignored files to copy into each new one, such as .env (Claude Code’s worktrees). every worktree reports to the same agentmash room, on its own branch; git worktrees and agentmash says what each one catches.
agentmash’s warning before an edit, and its reports, need nothing committed: npx agentmash login puts its hooks in each developer’s own ~/.claude/settings.json and leaves the repository’s .claude/settings.json alone. claims and the MCP tools in Claude Code come where the repository registers agentmash’s MCP server, a committed install made with npx agentmash init, which adds the hooks to that file without disturbing what’s already there and registers the MCP server in .mcp.json. in a repository connected at agentmash.dev/install, init stops and says how to commit one anyway. agentmash doesn’t write to CLAUDE.md or AGENTS.md: what it tells an agent arrives when it applies, before an edit, at a prompt or when a session starts.
the crew is optional. a crew team is files you commit: some of the crew’s 22 ready-made Claude Code agents, with mash on every team, an agent file each under .claude/agents/, the crew’s shared skills, a skill for the team, one guard hook in .claude/settings.json and .claude/agentmash-crew/teams.json, which records what it wrote. when one of them edits a file, the live view draws its cursor as that agent.
what claude code doesn’t do across developers
as Anthropic’s docs describe them on , agent teams are experimental, and off unless you set CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS=1. one session leads, its teammate sessions message each other and, where the Task tools are on, share a task list, and the team is kept on your machine, its config under ~/.claude/teams/ (removed when the session ends) and its tasks under ~/.claude/tasks/, one team per session, which no other session can share. the docs advise giving each teammate session its own files, since two of them editing one file overwrite each other; claude code agent teams vs agentmash puts the two side by side.
with cross-session messaging, in Claude Code 2.1.224 or later (2.1.234 on native Windows), Claude lists and messages your other sessions on the same machine, and, from a session connected to Remote Control, which needs a claude.ai sign-in, your cloud sessions and your sessions on other machines that run with Remote Control too. every session it reaches is yours: on one machine, a session’s inbox is open to your own operating-system user only, so on a shared machine another user’s sessions can’t deliver to it. multiple claude code instances on one repo covers one developer’s sessions and a team’s.
agentmash covers the part between developers. it compares each developer’s edits with their teammates’, so before your agent edits a file a teammate’s agent just changed, it’s told, without either agent choosing to send anything. by default it doesn’t warn one developer’s own agents about each other; AGENTMASH_WARN_SELF=1 turns that on.
what each hook adds
PreToolUse- before each edit, it checks the room. if, within the conflict window (30 minutes by default), a teammate’s agent touched the same file or, in JavaScript and TypeScript, changed a symbol your file depends on anywhere in the repo, or touched the file on a branch of theirs that isn’t merged yet, the advisory goes into your agent’s context, graded by severity.
PostToolUse- reports every
Write,EditandMultiEditto the room, with the exported symbols the edit changed. it runs in the background, so the edit doesn’t wait for it. UserPromptSubmit- sends the first 500 characters of your prompt as a task hint, so every event says what a teammate is doing, not only which files. at a prompt, your agent also gets a short heads-up when a teammate’s agent is on your branch or in a file your session changed: at most once every ten minutes, and only when that’s news.
SessionStart- the same heads-up when a session starts, or its context is cleared or compacted.
Stop- if a file this session edited was also edited by someone else, the person is told once, as the session finishes, with whose change it meets. it only advises: the agent finishes as it would have, and a person decides what happens to the two changes.
SessionEnd- says the session ended, so the board says gone when someone is gone.
- the MCP server
- lets an agent ask the room while it plans, before it has picked its files: who is working on what, whether anyone has touched a file, which files are contested, and claims, to divide the work before anyone writes. a repository registers it with a committed install.
what the agent reads
this is what bob’s agent is told before it edits a file alice’s agent changed two minutes earlier, word for word:
[AgentMash: ACTIVE COLLISION] alice's agent is working in src/models/user.ts — last write 2 min ago on your branch (main), while working on 'add soft deletes to the user model' (+12/-3 lines, touching deletedAt). Their write is already in your working tree, so whatever you read from this file earlier is out of date. Re-read src/models/user.ts now and rebuild this edit against what is actually there: a stale old_string either fails to match or quietly reverts their change. Leave deletedAt named and shaped as alice left it — that is what they just changed. If your task genuinely needs those same lines, change them and say so in your reply, so the overlap is visible.
it re-reads the file, adapts, and says so in its reply. that’s the loudest of five levels; a change on another branch, or one older than five minutes, is worded more quietly.
set up agentmash, in three steps
- someone who can push to the repository connects it once, at agentmash.dev/install: they sign in with GitHub and pick it. nothing is committed to it and there is no pull request.
- each developer runs
npx agentmash loginonce on each machine and signs in with GitHub in the browser it opens. it puts the hooks in their own Claude Code settings,~/.claude/settings.json, never in a repository. - each developer restarts Claude Code. from the next prompt on, their prompts and edits go to the room.
setting up Claude Code and the other coding agents has the steps for each, and a prompt that runs the login for you and tells you what is left. to see it first, how it works plays a made-up team of four in your browser, with nothing to set up.
what it doesn’t do
- it informs; it doesn’t lock.
AGENTMASH_STRICT=1blocks instead, and its acknowledge step needs a POSIX shell. - it compares your agents with your teammates’, and not with each other unless you set
AGENTMASH_WARN_SELF=1. whatever your own sessions report, in two worktrees or in one checkout, counts as you, and by default none is warned about another. - the first 500 characters of each prompt are visible to everyone in the room, and quoted into their agents’ context. don’t paste secrets into prompts;
AGENTMASH_HINTS=0keeps yours on your machine, except in a session you share live from the lobby, which goes to the teammates you share it with, end to end encrypted. - symbols are read from JavaScript and TypeScript only. files in other languages are matched by path.
- a check that runs past its budget, 1500 ms by default, lets the edit go ahead unwarned.
setup →the five levels →the MCP server →reconciliation →known limitations →