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.02721 |
| Opus 5 | $0.00152 | $0.01360 |
| Sonnet 5 | $0.00061 | $0.00544 |
| 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 12d 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.
- 12d 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 (3 stars, last pushed today), licensed MIT. It adds 305 tokens to every session and 2,721 once invoked, about $0.0015 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-08-31.
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.