/agent-deconfliction:agent-deconflictionfrom agent-deconfliction
Deconflict with another agent in this same repo: message it, swap tasks and files, agree file ownership and who commits. Use on "another agent is working here".
Ships in agent-deconfliction. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
Two agents in one repository share one working tree, one git index and one branch unless they arranged otherwise. Left alone they overwrite each other's edits, commit each other's half-finished work (git add -A), or run a checkout, stash, reset, rebase or pull under the other's feet. This skill is the safeguard: as soon as anyone notices a second agent in the repo, stop, say hello, swap what each is doing, and agree a split before anything collides.
It is manual and short. It assumes agent-to-agent messaging (in Claude Code: ListAgents + SendMessage). Without it, use the fallback at the end.
Both sides run this skill: the initiator (the agent the user invoked it in) and the responder (the agent that receives a deconfliction message). If you received a message whose first line starts DECONFLICTION, you are the responder: go to "Responder".
From now until an agreement is in place, make no file edits and run no git command that changes state (add, commit, checkout, switch, stash, reset, rebase, merge, pull, push). Reading is fine. If you were midway through a multi-file edit, finish the file you are in only if leaving it half-written would break the build, and say so in the message.
Run, from the repo root:
git rev-parse --show-toplevel --abbrev-ref HEAD
git rev-parse --git-common-dir # same value for both agents = same repo, even across worktrees
git worktree list
git status --short
git diff --stat
git log --oneline @{u}..HEAD 2>/dev/null # unpushed commits
From this and your own context, write down:
package.json, pyproject.toml, README.md, CHANGELOG, generated files, migrations, config).Note: git status cannot tell you which uncommitted changes are yours and which are the other agent's. List only the files you know you changed. Unexplained changes in git status are probably the other agent's: list them separately as "not mine".
Call ListAgents. Candidates are sessions whose working directory is this repo or a worktree of it (same --git-common-dir). Then:
Send with SendMessage. The first line is all the receiving user sees until they expand it, so it must stand alone. Use this shape:
DECONFLICTION: <your name> is also working in <repo name> on <branch>; pausing writes, please reply with your scope.
Hello, I'm <your name>, working in <worktree path>. We are in the same repository, so we may collide. I have paused edits and git operations until we agree a split.
My task: <one sentence>
Files I have changed (uncommitted): <list or "none">
Files I plan to touch: <list>
Changes in git status that are not mine: <list or "none">
Git state: branch <b>, unpushed commits <yes/no>, next git step <...>
Hot spots I may need: <list or "none">
Please reply in the same shape (task, files changed, files planned, git state, next git step), and pause your own writes and git operations until we agree.
Proposed split: <your opening proposal from step 6, or "proposal once I see your scope">
Ask for an idle notice only if you need it to know when the peer has replied (notify_when_idle: true works only for sessions on the same machine). Never ask the peer to do something your own session was denied permission to do.
Do not resume writing while you wait. If the user wants you to keep going meanwhile, limit yourself to reads. If no reply arrives, tell the user and ask whether to go on (they may relay it, or the other session may be awaiting its user's approval of cross-session messages). Silence is not agreement.
Classify the overlap and pick the lightest arrangement that removes it:
| Overlap | Arrangement |
|---|---|
| None: different files, neither needs git ops soon | Partition. Each owns its file list. Each commits only its own paths. |
| Different files, but both will commit | Partition + path-only commits. git add <explicit paths> and git commit -- <paths>; never git add -A, git add . or git commit -a. Agree who pushes, and that the other pulls only once told it is safe. |
| Shared hot spot (lockfile, manifest, README, changelog) | Single owner for the hot spot. One agent makes all edits to it; the other sends what it needs added. |
| Same files, or one task depends on the other | Sequence. One goes first and finishes and commits; the other waits, then pulls in that work. Usually the one closer to done goes first. |
| Long, broad or risky work on both sides | Separate worktrees. One agent moves to its own git worktree add ../<repo>-<task> -b <branch> and merges back later. Only the agent that has nothing uncommitted should move; never move uncommitted work by stash while the other agent is in the tree. |
| Conflicting goals (one is refactoring what the other is fixing) | Escalate. Do not resolve it between the agents. Tell both users and stop. |
Branch-switching rule for every arrangement: in a shared working tree, nobody runs checkout, switch, stash, reset --hard, rebase or pull without telling the other first and getting an OK back, because it changes the files the other is editing.
Send the proposed arrangement as a short list: who owns which paths, who owns each hot spot, who commits and pushes and in what order, any sequencing. Ask the peer to reply "agreed" or with changes. The plan is in force only once both sides have said "agreed".
Then write the plan to $(git rev-parse --git-common-dir)/agent-deconfliction.md. It lives inside .git, so it is never committed, and both agents can read it (including from separate worktrees). Overwrite it with the current plan; include the date, both agent names and the arrangement.
Resume within your share. Tell the user in two or three lines: who the other agent is, what it is doing, and the split.
When a message arrives whose first line starts DECONFLICTION:
to = the message's from) in the same shape: task, files changed, files planned, changes not yours, git state, next git step, hot spots. Then accept the proposed split, propose another, or say you need your user's input.agent-deconfliction.md in the git common dir to confirm it matches, resume within your share, and tell your user the split in two or three lines.Send a short message to the peer, without being asked, when:
If you find the other agent's change in a file you own, do not revert it. Message the peer and sort it out.
If the other agent cannot be messaged (another tool, or a session that does not accept cross-session messages):
$(git rev-parse --git-common-dir)/agent-deconfliction.md.What SKILL.md sets; muted values are Claude Code's defaults
Other plugins' skills for the same job
agent-deconfliction@danielrosehill is listed by danielrosehill/claude-code-plugins — review the source before installing
npx claudepluginhub danielrosehill/claude-code-plugins --plugin agent-deconfliction