gh-pr-create-orchestration-cwd-wrong-head

gh-pr-create-orchestration-cwd-wrong-head is a skill for Claude Code from wan-huiyan/agent-traffic-control. It costs 217 tokens per session (1,639 once invoked), scanned A, original, MIT.

A guide for creating GitHub pull requests safely when several Git worktrees are used. A worktree is a separate working directory connected to the same repository, and a pull request proposes changes for merging into a branch.

In plain words
What is it for?
Use it to diagnose wrong-branch pull requests, check the selected head branch, and avoid mismatched pull-request diffs in parallel development workflows.
Why use it?
It prevents a pull request from using the orchestration worktree's branch instead of the feature branch that contains the intended changes.

Skill for Claude Code

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

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

Good fit Use it to diagnose wrong-branch pull requests, check the selected head branch, and avoid mismatched pull-request diffs in parallel development workflows.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/wan-huiyan/agent-traffic-control/gh-pr-create-orchestration-cwd-wrong-head
Install

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.

Any agent
npx skills add wan-huiyan/agent-traffic-control --skill gh-pr-create-orchestration-cwd-wrong-head
Clone the repo
git clone --depth 1 https://github.com/wan-huiyan/agent-traffic-control

Made for: Claude Code.

Or install agent-traffic-control, the plugin that ships this one along with the rest of its 105 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 gh-pr-create-orchestration-cwd-wrong-head

README.md
[![agentmods](https://agentmods.dev/badge/skills/wan-huiyan/agent-traffic-control/gh-pr-create-orchestration-cwd-wrong-head/github.svg)](https://agentmods.dev/skills/wan-huiyan/agent-traffic-control/gh-pr-create-orchestration-cwd-wrong-head)
Your own site
<a href="https://agentmods.dev/skills/wan-huiyan/agent-traffic-control/gh-pr-create-orchestration-cwd-wrong-head"><img src="https://agentmods.dev/badge/skills/wan-huiyan/agent-traffic-control/gh-pr-create-orchestration-cwd-wrong-head/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 gh-pr-create-orchestration-cwd-wrong-head

Your own site · 80×15
<a href="https://agentmods.dev/skills/wan-huiyan/agent-traffic-control/gh-pr-create-orchestration-cwd-wrong-head"><img src="https://agentmods.dev/badge/skills/wan-huiyan/agent-traffic-control/gh-pr-create-orchestration-cwd-wrong-head.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 217 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,639 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. 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.00217 $0.01639
Opus 5 $0.00109 $0.00820
Sonnet 5 $0.00043 $0.00328
Haiku 4.5 $0.00022 $0.00164

Measured 11d ago against content hash e9f6a50c66b4, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-11, from the pricing page.

Security

Grade A, and why

gh-pr-create-orchestration-cwd-wrong-head 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 11d 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.

plugins/agent-traffic-control/skills/gh-pr-create-orchestration-cwd-wrong-head/SKILL.md · 170 lines

How it starts

The opening of the file, as written. The whole thing — 170 lines — stays where its author put it; the contents beside it link to each section on GitHub.

gh pr create from orchestration worktree picks wrong head branch

Problem

In a parallel-execution setup, an orchestrator dispatches sub-agents to feature worktrees (<repo>/.claude/worktrees/feature-A/, feature-B/, etc.) and waits on their completion. When the orchestrator then runs gh pr create to open the PR for one of those features, it gets opened against whatever branch is currently checked out in the orchestrator's CWD — not the feature branch the subagent committed to.

Result: a PR with the right title and body but the wrong head branch (typically the orchestrator's docs/sNNN-handoff or main-tracking branch). The PR's diff is unrelated to the change description, and the actual feature work never gets a PR.

Trigger conditions

You're hitting this skill if all of:

  1. Your workflow has multiple worktrees: one orchestrator + N feature worktrees.
  2. You ran gh pr create (with title + body via heredoc) from the orchestrator's working directory.
  3. gh pr view <N> --json headRefName returns your orchestrator's branch (e.g. docs/sNNN-handoff), NOT the feature branch (e.g. fix/issue-XXX).
  4. The PR's diff in gh pr diff <N> doesn't match the body text.

Optional secondary signal:

  • A revived subagent later opens a SECOND PR on the correct branch (because it ran gh pr create from the feature worktree where its CWD was). Now you have two PRs.

Root cause

gh pr create defaults --head to the current branch in the CWD where you invoked it. The orchestrator's CWD is typically a worktree that's checked out on a different branch than the feature branch — that branch is what gets pushed/used as head. The subagent's git commits in <repo>/.claude/worktrees/feature-X/ have NO effect on the orchestrator's CWD branch.

This is an easy trap because:

  • The heredoc-supplied body looks right.
  • The branch name doesn't appear in the gh pr create invocation, so there's nothing to visually trip on.
  • The PR opens successfully and reports a URL — looks like success.

Read the full file on GitHub · 170 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. 11d ago First seen · 170 lines · 217 tokens per session scan A e9f6a50c66b4

Subscribe to this mod's changes

gh-pr-create-orchestration-cwd-wrong-head is a skill published in the GitHub repository wan-huiyan/agent-traffic-control (3 stars, last pushed 6d ago), licensed MIT. It adds 217 tokens to every session and 1,639 once invoked, about $0.0011 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.

Related

Other skills, from other repositories

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.

secondsky/claude-skills · 50 tokens

claude-code-bash-patterns

Claude Code Bash tool patterns with hooks, automation, git workflows. Use for PreToolUse hooks, command chaining, CLI orchestration, custom commands, or encountering bash permissions, command failures, security guards, hook configurations.

secondsky/claude-skills · 52 tokens

bump-sdk-version

Bump the FutureSearch SDK version across all files. Use when releasing a new SDK version, updating version numbers, or the user says bump version, release, version bump.

futuresearch/futuresearch-python · 40 tokens

pr-check

PR review compliance: fetch review comments from an open PR, categorize as resolved/unresolved/dismissed, critically evaluate fixable items, implement approved fixes, and reply inline. Pass --unattended to halt on human-judgment items (emitted as Pending-Human) instead of prompting via AskUserQuestion.

rube-de/cc-skills · 67 tokens

babysit

PR babysitter: monitors CI status, auto-rebases when behind, auto-fixes CI where possible, delegates review comment handling to dlc:pr-check, and re-requests review after fixes. Designed for /loop usage with Remote Control.

rube-de/cc-skills · 53 tokens

git-ops

Git hygiene: clean up merged branches, prune stale remotes, and verify repository state.

rube-de/cc-skills · 22 tokens