check-a-stale-branch-is-not-undoing-newer-main-work

check-a-stale-branch-is-not-undoing-newer-main-work is a skill for Claude Code from wan-huiyan/agent-traffic-control. It costs 116 tokens per session (7,276 once invoked), scanned A, original, MIT.

A Git workflow for checking whether a branch based on an old version of main would undo newer work when merged. Git is the version-control system that records changes and combines branches.

In plain words
What is it for?
Use it before or after merging a stale branch to compare it with the latest origin/main and detect silent reversions.
Why use it?
A merge can be conflict-free and still restore old files or values, so ordinary conflict checks are not enough.

Skill for Claude Code

Written for Claude Code: disable-model-invocation in frontmatter. Also seen: mentions subagents; positional $N argument.

Needs its repository: it runs a file that does not travel with it, so clone the repository first. The line is python3 scripts/apply_my_rows.py # re-run YOUR splicing script.

Part of the agent-traffic-control plugin — 118 skills shipped together

Good fit Use it before or after merging a stale branch to compare it with the latest origin/main and detect silent reversions.

Compare 6 skills from other repositories ↓
Install

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.

Clone the repo
git clone --depth 1 https://github.com/wan-huiyan/agent-traffic-control
agentmods
npx agentmods add skills/wan-huiyan/agent-traffic-control/check-a-stale-branch-is-not-undoing-newer-main-work

Made for: Claude Code.

Or install agent-traffic-control, the plugin that ships this one along with the rest of its 118 skills.

Wrote 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.

agentmods badge for check-a-stale-branch-is-not-undoing-newer-main-work

README.md
[![agentmods](https://agentmods.dev/badge/skills/wan-huiyan/agent-traffic-control/check-a-stale-branch-is-not-undoing-newer-main-work/github.svg)](https://agentmods.dev/skills/wan-huiyan/agent-traffic-control/check-a-stale-branch-is-not-undoing-newer-main-work)
Your own site
<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.

agentmods 80×15 button for check-a-stale-branch-is-not-undoing-newer-main-work

Your own site · 80×15
<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>
Per session 116 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 7,276 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 1 finding. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

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.

ModelPer sessionOnce 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

Measured 5d ago against content hash ead2750f1ae2, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

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}"],
plugins/agent-traffic-control/skills/check-a-stale-branch-is-not-undoing-newer-main-work/SKILL.md · 485 lines

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 --mixed then git 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:

Read the full file on GitHub · 485 lines

Changes

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.

  1. 5d ago First seen · 485 lines · 116 tokens per session scan A ead2750f1ae2

Subscribe to this mod's changes

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.

Related

check-a-stale-branch-is-not-undoing-newer-main-work compared with skills from other repositories

check-a-stale-branch-is-not-undoing-newer-main-work next to 6 skills from other repositories
ModTypeStarsLast pushLicenceScanTokensWorks with
check-a-stale-branch-is-not-undoing-newer-main-workwan-huiyan/agent-traffic-controlSkill34d agoMITA116Claude Code
signing-preflightavelikiy/great_ctoSkill11713d agoMITA105Claude Code
claude-code-bash-patternssecondsky/claude-skillsSkill2578d agoMITB52Claude Code
committhoughtbot/rails-consultantSkill399d agoMITA20Claude Code
misuzuncaq/konokaSkill3todayApache-2.0A59Claude Code
commit-stylencaq/konokaSkill3todayApache-2.0A28Claude Code
reviewArcticFox2029/chamnanSkill925d agoMITA51Claude Code