Input
Bash command
Session project-dir branch
main (protected)
feat/regular
Shell cwd (tracked by CwdChanged hook → session-state shell_cwd)
— same as project dir —
.worktrees/agent-x → branch fix/2360-ship-hook-bundles
.worktrees/agent-y → branch main
/nonexistent → branch unresolvable
Scenarios
🟢 The #2363 false positive: worktree commit, session on main
🟢 Leading cd into a feature worktree
🟢 git -C explicit path
🔴 Old under-blocking evasion — now caught
🔴 env-prefixed push on main — now caught
⚪ Prose mentioning git commit — stays silent
🔴 Worktree itself on main — still blocked