Getting it into your agent
One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.
npx skills add wan-huiyan/agent-traffic-control --skill worktree-stale-local-main-ref-inflates-pr-diffgit clone --depth 1 https://github.com/wan-huiyan/agent-traffic-controlWrote this? Show the measurements
A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.
[](https://agentmods.dev/skills/wan-huiyan/agent-traffic-control/worktree-stale-local-main-ref-inflates-pr-diff)<a href="https://agentmods.dev/skills/wan-huiyan/agent-traffic-control/worktree-stale-local-main-ref-inflates-pr-diff"><img src="https://agentmods.dev/badge/skills/wan-huiyan/agent-traffic-control/worktree-stale-local-main-ref-inflates-pr-diff/github.svg" alt="Measured on agentmods" height="20"></a>Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.
<a href="https://agentmods.dev/skills/wan-huiyan/agent-traffic-control/worktree-stale-local-main-ref-inflates-pr-diff"><img src="https://agentmods.dev/badge/skills/wan-huiyan/agent-traffic-control/worktree-stale-local-main-ref-inflates-pr-diff.svg" alt="Reviewed on agentmods" width="80" height="20"></a>What it costs to keep this loaded
Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5.1 | $0.00398 | $0.02545 |
| Opus 5 | $0.00199 | $0.01273 |
| Sonnet 5 | $0.00080 | $0.00509 |
| Haiku 4.5 | $0.00040 | $0.00254 |
Grade A, and why
worktree-stale-local-main-ref-inflates-pr-diff scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 5d ago.
A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.
Nothing flagged
None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.
How it starts
The opening of the file, as written. The whole thing — 171 lines — stays where its author put it; the contents beside it link to each section on GitHub.
Worktree: a stale local main ref inflates git diff main...branch
Problem
In a multi-worktree repo, git diff main...<your-branch> (or --stat) reports
far more files and lines than your commit actually changed — e.g. 92 files /
8,000+ insertions when your one commit touched 6 files. The instinct is to panic
that your PR is silently reverting or re-touching a pile of upstream work (the
stale-base-pr-silently-reverts-upstream-content trap) and to block your own
merge or demand a rebase. Almost always, nothing is wrong with the PR — the
local main ref is stale.
Context / Trigger Conditions
All of:
- You're working inside a git worktree (
git rev-parse --is-inside-work-tree; path contains.claude/worktrees/<name>/orgit worktree listshows 2+ paths). git diff main...HEAD --stat(3-dot) shows tens/hundreds of files, butgit show --stat HEAD(your actual commit) shows only a few.- You branched off what you thought was current
main, andgh pr view <N>reports the PR asmergeable: MERGEABLE / mergeStateStatus: CLEAN.
Why it happens: main...branch (3-dot) diffs from the merge-base of the two
refs. The merge-base uses your LOCAL main ref. In a multi-worktree setup the
local main ref is whatever the primary worktree last checked out / pulled —
frequently many commits behind origin/main because sibling sessions merge via
GitHub (squash) and nobody runs git pull on the parked primary checkout. So the
merge-base is ancient, and the 3-dot diff includes every file that landed on
origin/main since that old point — none of which your branch is actually
reverting. (This is the REF being stale, distinct from
git-diff-2dot-vs-3dot-merge-safety, which is about 2-dot-vs-3-dot operator
semantics against a correct origin/main.)
Solution
Diff against the remote ref, not the local main ref:
git fetch origin main -q
# The TRUE PR diff (what GitHub will merge):
git diff origin/main...HEAD --stat
# Confirm divergence is small:
git rev-list --count HEAD..origin/main # commits origin/main has, your branch doesn't
git rev-list --count origin/main..HEAD # YOUR commits
# Is your branch's base actually on origin/main's history? (necessary, NOT sufficient
# — see the Verification note below; this does not rule out a revert on its own)
git merge-base --is-ancestor <your-branch-base-sha> origin/main && echo "clean base"
# The check that DOES rule out a revert — deletions, from the merge-base:
git diff --diff-filter=D --name-only origin/main...HEAD # empty ⇒ deletes nothing
# Ground truth from GitHub — the actual file list the PR will change:
gh pr view <N> --json files -q '.files[].path'
gh pr view <N> --json mergeable,mergeStateStatus
What this file has done since we first saw it
Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.
- 5d ago First seen · 171 lines · 398 tokens per session scan A 2fa875911896
worktree-stale-local-main-ref-inflates-pr-diff is a skill published in the GitHub repository wan-huiyan/agent-traffic-control (3 stars, last pushed 5d ago), licensed MIT. It adds 398 tokens to every session and 2,545 once invoked, about $0.0020 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-09-05.
Other skills, from other repositories
ql-housekeep
Detect repo-hygiene issues that accumulate during long-running autonomous development (merge-conflict markers, orphan worktrees, CPC-variant duplicates, stale branches, version-manifest drift). Detection-only by default — reports findings, never deletes or modifies without explicit user confirmation.
nazgul:doctor
Run the Nazgul read-only preflight diagnostic — checks jq/gh presence and auth, git-hooks drift, cache-vs-repo plugin version, the bash-vs-zsh hazard, the NAZGULDIR footgun, config-schema staleness, either install mode's .gitignore Nazgul-block drift (stamp and flush-left region), cross-session messaging and Remote…
hotfix
Emergency fix workflow that bypasses normal sprint processes with a full audit trail. Creates hotfix branch, tracks approvals, and ensures the fix is backported correctly.
cloudflare-workers-ci-cd
Complete CI/CD guide for Cloudflare Workers using GitHub Actions and GitLab CI. Use for automated testing, deployment pipelines, preview environments, secrets management, or encountering deployment failures, workflow errors, environment configuration issues.
cloudflare-workers-observability
Cloudflare Workers observability with logging, Analytics Engine, Tail Workers, metrics, and alerting. Use for monitoring, debugging, tracing, or encountering log parsing, metric aggregation, alert configuration errors.
cloudflare-workers-dev-experience
Cloudflare Workers local development with Wrangler, Miniflare, hot reload, debugging. Use for project setup, wrangler.jsonc configuration, or encountering local dev, HMR, binding simulation errors.