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 pr-hijack-via-stale-worktree-branch-refgit 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/pr-hijack-via-stale-worktree-branch-ref)<a href="https://agentmods.dev/skills/wan-huiyan/agent-traffic-control/pr-hijack-via-stale-worktree-branch-ref"><img src="https://agentmods.dev/badge/skills/wan-huiyan/agent-traffic-control/pr-hijack-via-stale-worktree-branch-ref/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/pr-hijack-via-stale-worktree-branch-ref"><img src="https://agentmods.dev/badge/skills/wan-huiyan/agent-traffic-control/pr-hijack-via-stale-worktree-branch-ref.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.00305 | $0.02724 |
| Opus 5.5 | $0.00122 | $0.01090 |
| Sonnet 5.5 | $0.00061 | $0.00545 |
| Haiku 4.5 | $0.00030 | $0.00272 |
Grade A, and why
pr-hijack-via-stale-worktree-branch-ref 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 10d 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 — 257 lines — stays where its author put it; the contents beside it link to each section on GitHub.
PR-Hijack via Stale Worktree Branch Ref
Problem
In a long-lived git worktree (especially .claude/worktrees/<name>/ patterns
created by a parallel-session harness), a same-named local branch can be
created via git checkout -b X origin/main even when branch X already
exists upstream with an open PR. Pushing that local branch with
git push -u origin X succeeds — git reports * [new branch] — and
silently replaces the remote ref. The result:
- The remote branch ref now points at YOUR commit
- The open PR (call it #N) on that branch now lists YOUR commit
- PR #N's title and body still describe the ORIGINAL author's work
- The original author's commit is orphaned on the remote but still reachable in YOUR local reflog (because the worktree's reflog captured it earlier)
gh pr createfails witha pull request for branch "X" into "main" already existsand surfaces PR #N — which is now an artefact of two unrelated commits
The hijack is silent on both sides: git's push output doesn't warn, gh doesn't either, and the PR's web view shows a perfectly plausible (but wrong) state.
Context / Trigger Conditions
Surfaces when ALL of:
- You are working in a worktree (typically
.claude/worktrees/<name>/) that has been used by a previous session - The session-start git status banner shows a branch name that does NOT
match
git status -sbonce you actually run it (stale banner) - A prior session in the same worktree opened a PR on a generically-named
feature branch (e.g.,
feat/drivers-headline-and-stripe-removal,feat/refactor-foo,fix/bar-bug) - The worktree's local refs were reset between sessions (
git reset --hard, branch deletion, or worktree-recreation) WITHOUT a correspondinggit push --forceto clean up the remote - You create a local branch by the same generic name
Exact failure-signature triad:
# Symptom 1 — push reports new-branch despite upstream existing
$ git push -u origin feat/<name>
* [new branch] feat/<name> -> feat/<name>
# Symptom 2 — gh pr create rejects with already-exists
$ gh pr create ...
a pull request for branch "feat/<name>" into branch "main" already exists:
https://github.com/<org>/<repo>/pull/N
# Symptom 3 — that PR's commits don't match its title/body
$ gh pr view N --json commits
{ "commits": [{ "oid": "<YOUR-SHA>", "messageHeadline": "<YOUR WORK>" }] }
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.
- 10d ago Changed a8dbe9fc8d3c
- 3mo ago First seen · 257 lines · 305 tokens per session scan A 4c12739ca0e0
pr-hijack-via-stale-worktree-branch-ref is a skill published in the GitHub repository wan-huiyan/agent-traffic-control (5 stars, last pushed yesterday), licensed MIT. It adds 305 tokens to every session and 2,724 once invoked, about $0.0012 per session on Opus 5.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-08-31.
pr-hijack-via-stale-worktree-branch-ref compared with skills from other repositories
| Mod | Type | Stars | Last push | Licence | Scan | Tokens | Works with |
|---|---|---|---|---|---|---|---|
| pr-hijack-via-stale-worktree-branch-refwan-huiyan/agent-traffic-control | Skill | 5 | yesterday | MIT | A | 305 | Claude Code |
| ql-housekeepandyzengmath/quantum-loop | Skill | 24 | 5mo ago | MIT | A | 57 | Claude Code |
| nazgul:doctorOrodruinLabs/nazgul | Skill | 7 | 3mo ago | none | A | 151 | Claude Code |
| hotfixIdoCohen560/claude-unity-game-studio | Skill | 30 | 5mo ago | MIT | A | 35 | Claude Code |
| cloudflare-workers-ci-cdsecondsky/claude-skills | Skill | 257 | 5d ago | MIT | A | 50 | Claude Code |
| cybersecuritysecondsky/claude-skills | Skill | 257 | 5d ago | MIT | A | 79 | Claude Code |
| cloudflare-workers-observabilitysecondsky/claude-skills | Skill | 257 | 5d ago | MIT | A | 47 | Claude Code |