session-handoff-number-collision-with-unmerged-siblinglisted
Install: claude install-skill wan-huiyan/agent-traffic-control
# Session-Handoff Number Collision With Unmerged Sibling
## Problem
`session-handoff` Phase 1 Step 2 says "Write handoff doc → `docs/handoffs/session_N_handoff.md`." The implicit assumption is that you can determine N by inspecting `docs/handoffs/` on the current branch. **This assumption breaks when a parallel/sibling session ran concurrently in another worktree and its handoff PR hasn't merged into main yet.**
Concrete sequence:
1. Sibling session ran 2 hours ago in `.claude/worktrees/other/`, drafted `session_167_handoff.md`, opened PR #690 (still under review).
2. Sibling session updated MEMORY.md "Recent sessions" with an S167 entry AND appended to sessions_archive.md.
3. You fork your worktree off `origin/main` — MEMORY.md is local-user-state so you see the sibling's S167 entry, but `docs/handoffs/` on `origin/main` does NOT yet have `session_167_handoff.md` (PR pending).
4. You run `ls docs/handoffs/` → highest is S166b → you pick **S167**.
5. You write `docs/handoffs/session_167_handoff.md` + `session_168_prompt.md`.
6. Both sessions now claim S167. Disk doesn't conflict (different branches). MEMORY.md shows two S167 entries. Future readers can't tell which is canonical.
The collision is silent because:
- `ls` only sees the current branch's files.
- `git log origin/main -- docs/handoffs/session_167_handoff.md` returns empty (PR pending).
- Pre-commit hooks don't check session-number uniqueness.
- The session-handoff skill itself doesn't tell you to cross-check MEM