← ClaudeAtlas

shared-checkoutlisted

Use before dispatching more than one agent that runs git in the same repo, or when a commit or rebase lands on a branch nobody targeted. They share one HEAD, which a file-overlap check cannot see.
MrBinnacle/skills · ★ 0 · AI & Automation · score 62
Install: claude install-skill MrBinnacle/skills
# Concurrent subagents share one checkout and contend on HEAD ## Problem You dispatch two agents to do independent work in the same repository. You check for collisions by asking whether they touch the same files. They do not, so you launch both and tell the user they cannot collide. They collide anyway. A working directory has exactly one HEAD, one index, and one set of refs. Two agents running `git checkout`, `git commit` and `git rebase` in that directory are writing to shared mutable state that no file manifest describes. Observed failure, S308: agent A created its branch and wrote a file. Before it committed, the parent session ran `git checkout main` then `git checkout -b` in the same directory. Agent A's commit landed on the **parent's** new branch. Agent A then ran `git rebase origin/main`, believing it was on its own branch, and rebased a branch it did not own. Both pieces of work survived, but for a while one agent's commit existed only inside a branch belonging to unrelated work, and the parent pushed it there. ## Context / Trigger conditions - More than one agent will run git in the same repository, concurrently. - A dispatch names a repository by absolute path with no isolation set. - You reasoned about collision risk in terms of files, directories, or "different repos" and concluded the agents are independent. - `git status -sb` reports ahead/behind numbers inconsistent with what you just pushed. - `git log --oneline origin/main..<your-branch>` lists a