Help us improve
Share bugs, ideas, or general feedback.
A second Claude Code session (or agent/person) sharing the same working directory runs `git checkout`/`git switch`, flipping the branch for the whole working tree underneath your session and clobbering your uncommitted work. Use when: (1) a file you just edited has silently reverted — often with a "file was modified, either by the user or by a linter" system reminder, (2) `git branch --show-current` shows a branch you didn't switch to, (3) `git reflog` shows a `checkout: moving from X to Y` you never ran, (4) unfamiliar files/changes appear in `git status`. Covers detecting the collision and recovering via an isolated git worktree.
npx claudepluginhub wan-huiyan/agent-traffic-control --plugin agent-traffic-controlHow this skill is triggered — by the user, by Claude, or both
Slash command
/agent-traffic-control:concurrent-session-checkout-clobbers-shared-worktreeThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
Two Claude Code sessions (or any two agents/people) operate in the **same**
Guides technical evaluation of code review feedback: read fully, restate for understanding, verify against codebase, respond with reasoning or pushback before implementing.
Share bugs, ideas, or general feedback.
git checkout clobbers your shared working directoryTwo Claude Code sessions (or any two agents/people) operate in the same
working directory on the same clone. git checkout / git switch changes
HEAD for the entire working tree — it is not per-session. When session B
switches branches, session A's tree changes underneath it:
git add -A.It is invisible until something breaks: a function you wrote is "gone", a test errors on a symbol you defined, or a harness emits "file was modified, either by the user or by a linter" for a file you didn't expect to change.
git branch --show-current is not the branch you were working on.git status lists changes or untracked files you don't recognize.git reflog shows checkout: moving from <yours> to <other>
that you never performed.Do not keep fighting inside the shared directory — you will collide again. Isolate into a git worktree.
git reflog -5 reveals the foreign checkout.
git log <your-branch> --oneline confirms your committed work is still safe
on its branch (commits survive a checkout; only uncommitted work is at risk).git worktree add /path/outside/repo/my-worktree <your-branch>
Place it outside the repo (a sibling dir) to avoid .gitignore edits that
would themselves collide.cp the new files you created).git checkout <files-you-modified> and rm your untracked
files (you copied them already).git worktree list shows your isolated worktree on your branch.git status shows only the other session's files.Session A is on team-1-iap-deploy with an uncommitted app/config.py edit.
The parallel session runs git checkout team-1-web-app in the shared repo/.
Session A's app/config.py edit vanishes; git reflog shows
checkout: moving from team-1-iap-deploy to team-1-web-app. Recovery:
git worktree add ../iap-worktree team-1-iap-deploy, copy the untracked new
files in, re-apply the lost config.py edit, git checkout app/main.py + rm
the strays in repo/, then EnterWorktree and carry on — committing each task.
using-git-worktrees skill). Shared-directory work is only safe for a
single session.EnterWorktree tool can enter an already-created worktree by path.using-git-worktrees — create an isolated workspace up front.git reflog is the source of truth for "who switched the branch."