session-handoff-detect-prior-orphan-prlisted
Install: claude install-skill wan-huiyan/agent-traffic-control
# /session-handoff pre-flight: detect prior orphan branch + PR before writing a new handoff doc
## Problem
You're running /session-handoff at the end of a long, multi-step session. You start drafting `docs/handoffs/session_N_handoff.md` in the main checkout. Everything looks fine — `git status` in the main checkout shows the file as untracked, you write 200 lines, you're ready to commit.
Then you go to create the PR branch and `git worktree add` fails with "branch already exists." Or worse, you don't check and silently create a duplicate PR.
Root cause: a prior orchestrator already did most of /session-handoff for this session. That orchestrator:
1. Created branch `docs/sN-handoff` off main
2. Created a worktree (often mis-labeled like `.claude/worktrees/sN+1-handoff` instead of `.claude/worktrees/sN-handoff`)
3. Wrote `docs/handoffs/session_N_handoff.md` in that worktree
4. Committed and pushed to `origin/docs/sN-handoff`
5. Opened a PR (often a thin one with just the handoff doc, missing the rest of the 7-bucket dispatch)
6. Then lost context, was interrupted, or didn't finish the rest of the workflow
The current orchestrator has no memory of that work — it's a different session instance — and sees only the fresh state. The detection signals are subtle:
- `git branch --list 'docs/sN-handoff'` shows `+ docs/sN-handoff` (the `+` means checked out in another worktree).
- `git worktree list | grep -i sN` reveals a worktree at an unfamiliar path.
- That worktree contains `