Getting it into your agent
It runs from inside its repository, so the clone comes first — what it calls does not travel with the file alone.
git clone --depth 1 https://github.com/wan-huiyan/agent-traffic-controlnpx agentmods add skills/wan-huiyan/agent-traffic-control/check-a-stale-branch-is-not-undoing-newer-main-workWrote 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/check-a-stale-branch-is-not-undoing-newer-main-work)<a href="https://agentmods.dev/skills/wan-huiyan/agent-traffic-control/check-a-stale-branch-is-not-undoing-newer-main-work"><img src="https://agentmods.dev/badge/skills/wan-huiyan/agent-traffic-control/check-a-stale-branch-is-not-undoing-newer-main-work/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/check-a-stale-branch-is-not-undoing-newer-main-work"><img src="https://agentmods.dev/badge/skills/wan-huiyan/agent-traffic-control/check-a-stale-branch-is-not-undoing-newer-main-work.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.00116 | $0.07276 |
| Opus 5.5 | $0.00046 | $0.02910 |
| Sonnet 5.5 | $0.00023 | $0.01455 |
| Haiku 4.5 | $0.00012 | $0.00728 |
Grade A, and why
check-a-stale-branch-is-not-undoing-newer-main-work scanned grade A with 1 finding 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.
Runs shell commandslowCapability
Expected in a hook, worth knowing in a rule or an instructions file.
src = subprocess.run(["git", "show", f"{ref}:{LEDGER}"], How it starts
The opening of the file, as written. The whole thing — 485 lines — stays where its author put it; the contents beside it link to each section on GitHub.
Check a Stale Branch Is Not Undoing Newer Main Work
Merged from: pr-from-stale-branch-silently-reverts-newer-main-files, stale-base-pr-silently-reverts-upstream-content, stale-base-drops-rows-from-a-shared-ledger, worktree-stale-local-main-ref-inflates-pr-diff.
Problem
Sibling work lands on main all day. A branch whose content predates some of it can, on merge,
undo that work: delete files, put old values back into lines, drop or roll back rows of a
shared ledger. There is usually no merge conflict, the PR is mergeable: MERGEABLE, CI is
green and the repo's validators pass. The opposite also happens: a correct branch looks like it
undoes dozens of files because the diff was measured wrongly. Both are settled by the same check,
measured against fetched origin/main at content level.
What actually causes a silent undo, and what does not
Be precise, because the loose version ("my branch is behind, so it reverts things") is false.
- Merely being behind does not undo anything. A branch that never had files B/C/D, and never
recorded deleting them, does not delete them: GitHub diffs from the merge base
(
git diff origin/main...HEAD, three dots) and runs a three-way merge, which keeps B/C/D. And a branch that edits the same lines as a newer main commit conflicts loudly. - A stale TREE under a current parent does. The commit then genuinely records the removal,
and git applies it faithfully with nothing to conflict against. It gets that way by accident:
git reset --soft origin/main(or--mixedthengit add -A) from a branch whose base was old: the pointer lands on current main, the index still holds the old tree, so the commit records "delete everything added since";- committing a stale worktree with
git add -A; - a branch re-created or re-pointed onto a newer base while its working tree stayed old;
- a rebase or merge whose conflicts were resolved by taking the stale side.
Measured on a synthetic shared ledger where two sessions append to one file:
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 · 485 lines · 116 tokens per session scan A ead2750f1ae2
check-a-stale-branch-is-not-undoing-newer-main-work is a skill published in the GitHub repository wan-huiyan/agent-traffic-control (3 stars, last pushed 4d ago), licensed MIT. It adds 116 tokens to every session and 7,276 once invoked, about $0.0005 per session on Opus 5.5. A static security scan graded it A with 1 finding (runs shell commands). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-11-25.
check-a-stale-branch-is-not-undoing-newer-main-work compared with skills from other repositories
| Mod | Type | Stars | Last push | Licence | Scan | Tokens | Works with |
|---|---|---|---|---|---|---|---|
| check-a-stale-branch-is-not-undoing-newer-main-workwan-huiyan/agent-traffic-control | Skill | 3 | 4d ago | MIT | A | 116 | Claude Code |
| signing-preflightavelikiy/great_cto | Skill | 117 | 13d ago | MIT | A | 105 | Claude Code |
| claude-code-bash-patternssecondsky/claude-skills | Skill | 257 | 8d ago | MIT | B | 52 | Claude Code |
| committhoughtbot/rails-consultant | Skill | 39 | 9d ago | MIT | A | 20 | Claude Code |
| misuzuncaq/konoka | Skill | 3 | today | Apache-2.0 | A | 59 | Claude Code |
| commit-stylencaq/konoka | Skill | 3 | today | Apache-2.0 | A | 28 | Claude Code |
| reviewArcticFox2029/chamnan | Skill | 9 | 25d ago | MIT | A | 51 | Claude Code |