/agent-traffic-control:multi-worktree-file-url-stale-contentfrom agent-traffic-control
When a user opens a `file://` URL bookmark to a file in a repo with multiple git worktrees, the browser shows whatever the targeted worktree's branch contains — NOT main, NOT the latest merge. Use when: (1) user reports "I don't see my change" or "the fix isn't there" right after a PR was merged, (2) you've confirmed via `git show origin/main:<path>` that main has the fix but the user-visible file:// view doesn't, (3) the file path mentioned by the user contains `.claude/worktrees/<name>/`, `worktrees/`, or any other multi-checkout root, (4) `git worktree list` shows 2+ paths and the bookmarked one is on a feature branch. Distinguishes from: `worktree-outer-ls-mistaken-for-main-state` (about `ls` outside any worktree), `flask-debug-cross-worktree-edit-stale` (about Flask debug reload reading wrong worktree). This skill specifically covers the user-bookmarks-a-file-URL variant where neither `ls` nor a server reload is in play — the browser opens whatever exists on disk in that worktree at that path.
Trending skills
7-day visitors to each skill page
Ships in agent-traffic-control. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description, though model invocation is off: only you can start it.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
file:// URL stale contentThe user opens a file:// URL pointing to a deliverable / static HTML / docs file in the repo. They see old content. They report "the fix isn't there" or "I still see the thing we removed". They are correct about what they see — but the file IS fixed on origin/main. The disconnect is that the file:// URL doesn't know what git branch is checked out at that path. The browser just reads whatever bytes are on disk.
In a repo with multiple git worktree checkouts, each worktree is on a different branch. The primary checkout at the repo root is also on a branch — usually the last feature branch someone was working on, NOT main. After a PR merges to main, none of the on-disk paths automatically update. The user's bookmark keeps showing the same stale content.
All of:
git worktree list shows 2+ entries)file:// URL bookmark (not via a running web server, not via VSCode preview)Smoking-gun signal: the user-reported file path contains .claude/worktrees/<name>/, worktrees/, .git/worktrees/, or you can see 2+ worktrees via git worktree list and the bookmarked path is one of them.
# 1. Fresh fetch (don't trust cached refs)
git fetch origin main --quiet
# 2. Read the file as it exists on origin/main
git show origin/main:<path-relative-to-repo-root> | grep -c "<the-string-the-user-says-is-still-there>"
# Expect 0 if the fix is in
If the fix IS on main but the user's view doesn't show it → confirmed stale-worktree problem.
The URL contains the on-disk path. Match it against git worktree list:
git worktree list
The matching worktree's branch (column 3) is what the user is actually looking at. Frequently NOT main.
Pick ONE worktree to be canonical. The primary repo checkout is the natural choice (no .claude/worktrees/... in the path = a friendlier bookmark).
Hazard: if main is currently held by ANOTHER worktree (common — the user may have an old worktree like chatbox-with-data or main-viewer parked there), git will refuse to check out main in two places. Resolve by either:
(a) Pulling main on whichever worktree currently holds it. If that worktree's only job is being a "main viewer", this is sufficient — just update the user's bookmark to that path.
(b) Removing that worktree if it's stale. Audit first to confirm no work is lost:
# Check clean status + no unpushed commits + identify any uncommitted/tracked content
git -C <worktree-path> status # clean?
git -C <worktree-path> log origin/main..HEAD --oneline # any unpushed commits? expect empty
git -C <worktree-path> stash list # stashes are repo-wide; not lost on removal
ls -la <worktree-path>/.claude-memory <worktree-path>/.claude 2>/dev/null # session metadata?
git -C <worktree-path> ls-files .claude-memory/ | wc -l # tracked in git? if yes, safe
If audit is clean, remove + reclaim main:
git -C <repo-root> worktree remove .claude/worktrees/<name>
git -C <repo-root> checkout main
git -C <repo-root> pull origin main --ff-only
file://<absolute-path-to-the-now-main-worktree>/<path-to-file>
After every future merge, they (or you) run git -C <repo-root> pull origin main and the bookmark stays current.
In your end-of-session handoff doc, note "primary checkout is on main as of " so the next session knows the invariant. If the primary checkout drifts (gets parked on a feature branch again), the user's bookmark goes stale again silently.
After the switch:
grep -c "<the-string-the-user-says-is-still-there>" <absolute-path-on-primary-checkout>
# Expect 0
git -C <repo-root> log --oneline -1
# Should show the merge commit that landed the fix
The user re-opens their bookmark → sees the corrected content.
Session 206 of the the-project-repo repo (2026-05-19):
PR #911 merged the removal of a Feature Shifts card from a PM stakeholder walkthrough HTML deliverable. The user opened a file:// URL bookmark and saw the card still present:
file:///Users/<user>/Documents/the-project-repo/.claude/worktrees/quick-verify/docs/deliverables/2026-05-19_pm_stakeholder_walkthrough.html
That path resolved to the quick-verify worktree, which was on docs/s205-pm-walkthrough-review-handoff — a stale branch from before the removal. Investigation also surfaced that the primary repo checkout was itself on docs/s204b-shap-waterfall-handoff (from a session two days earlier, never reset to main). Three local paths to the same logical file all showed different content depending on which branch each worktree happened to be parked on.
Fix:
git fetch origin main + git show origin/main:docs/deliverables/2026-05-19_pm_stakeholder_walkthrough.html | grep -c "Feature Shift" → 0 (confirmed fix is on main)git worktree list → main was held by a chatbox-with-data worktree, 11 commits behind, clean statuschatbox-with-data for work-to-lose: clean tree, no unpushed commits, .claude-memory/ files all tracked, stashes are repo-wide. Safe to remove.git worktree remove .claude/worktrees/chatbox-with-data → git checkout main → git pull (11 commits fast-forwarded)file:///Users/<user>/Documents/the-project-repo/docs/deliverables/2026-05-19_pm_stakeholder_walkthrough.htmlUser confirmed: the Feature Shifts card was gone in the browser.
gh pr merge --delete-branch from a worktree often throws fatal: 'main' is already used by worktree at <other-path>. Benign — the merge already succeeded remotely; only the local branch-delete failed. See sister skill gh-pr-merge-worktree-checkout-trap.https://github.com/<owner>/<repo>/blob/main/<path>). Always reflects main, no local sync needed, but loses any local-only styling rendering and is slower to open.flask-debug-cross-worktree-edit-stale for that variant. The diagnostic difference is whether the user is opening a file directly (file://) or visiting a service URL (http://localhost:N/...).worktree-outer-ls-mistaken-for-main-state — variant where the user runs ls outside any worktree and thinks they see main stateflask-debug-cross-worktree-edit-stale — variant where a running Flask debug server reads the wrong worktreegh-pr-merge-worktree-checkout-trap — companion footgun on gh pr merge --delete-branch in multi-worktree repossuperpowers:using-git-worktrees — general worktree hygiene skillWhat SKILL.md sets; muted values are Claude Code's defaults
npx claudepluginhub wan-huiyan/agent-traffic-control --plugin agent-traffic-control118 skills in this plugin
/agent-refusal-with-evidence-beats-literal-complianceA dispatched agent that does exactly what you asked can ship a defect you would
have stopped yourself, because it can see something at the worksite that you
could not see when you wrote the brief. Use when: (1) you are writing a brief
that prescribes a specific fix, threshold, wording or value rather than the
outcome you want; (2) an agent reports that it did not do what you asked and
you are deciding whether that is insubordination or judgement; (3) an agent
asserts "this is fine" or "not needed" with no measurement behind it; (4) you
are reviewing overnight output and want to know which decisions were checked
and which were assumed. Two halves, and both are needed: give the agent
explicit permission to satisfy the INTENT of an instruction while refusing its
letter, and REQUIRE the evidence with the refusal — what it built or measured,
what that showed, what it did instead. Evidence is the whole difference between
a refusal you can bank and one you have to re-litigate. Four agents correctly
declined an instruction in a single run; one built the suggested fix, measured
that it turned a silent safe refusal into a permanently red pipeline, and
reverted it unpushed.
/auto-merge-rearms-while-agent-live-kill-then-disarm-verifyDisarming auto-merge on a PR whose agent is still running does not hold it —
the agent re-arms within minutes and the PR merges, because arming is a step in
the agent's brief and disarming is not an instruction to the agent at all. Use
when: (1) you want to STOP a pull request from merging that an agent opened and
armed, for review, for a rethink, or because it is landing into a queue you are
trying to drain; (2) a PR you disarmed merged anyway; (3) you are telling agents
which PRs are on hold and want the hold to be enforced rather than announced;
(4) you are about to run `gh pr merge --disable-auto` and have not decided what
to do about the agent. The order is KILL THE AGENT FIRST, THEN DISARM, THEN
VERIFY the disarm by reading `autoMergeRequest` back — a disarm you did not read
back is not a hold. The stronger form needs no ordering at all: convert the PR
to a draft with `gh pr ready --undo`. A draft cannot merge whatever any agent
does to it, so the hold survives an agent you missed, an agent that restarts,
and an agent you did not know about.
/batch-member-cites-a-path-only-a-non-member-addsYou wrote something correct that the default reader cannot reach: a batch member citing a
path only a NON-member adds, or a rule, ruling or ledger sitting on an unlanded branch.
/batch-merge-subject-is-not-evidence-a-member-landedYou are about to close, delete the branch of, or mark as landed a pull
request because a batch, roll-up or merge-train commit on the target branch
names it in the subject line, and because the member's own commits all
predate that merge by wall clock. Neither of those is evidence. A batch
branch is assembled at some moment BEFORE it merges, so anything the member
pushed after assembly is outside it, and the subject records INTENT at
assembly time rather than CONTENT at merge time. Use before closing a
member, when an ancestry check against a squashed batch says no, or when a
member's branch still shows commits ahead of the target. Compare file
content against the target branch instead, expecting exactly one legitimate
difference: the shared aggregate file every member appends to.
/check-a-stale-branch-is-not-undoing-newer-main-workA branch built on an out-of-date main is about to merge, or has merged, and may undo work
that landed since. Use when a green, conflict-free PR deletes files you never touched,
newer values or a whole redesign vanish after a sibling PR merged, rows of a shared ledger
(tracker, registry, CHANGELOG) disappear or revert, or when `git diff main...HEAD` or a
reviewer says your small PR touches dozens of files you did not change.
/ci-leg-skipping-moves-minutes-it-does-not-remove-themYou are about to propose, price or approve a CI cost saving that works by
making a job or matrix leg SKIP on pull requests — a path filter, a safe
list, a changed-files gate, an exemption list. Check first whether the
pipeline runs a complement or backstop on merge, on push, or nightly:
many do, and then the legs a pull request skipped are exactly the legs some
later run executes, so a branch that goes green once and merges bills the
same total either way and the wall clock does not move at all. Use when
pricing a filter change, when a percentage saving is quoted with no basis,
or when choosing between filtering legs and batching pull requests. The
question that separates money from bookkeeping is whether the change
removes RUNS or merely moves LEGS.