Wave 2 hook H7: never commit/merge inside a sibling worktree another
session created (burned us on #289 path-leak + the plumbing-merge
workaround). Ownership = a per-session .claude-worktree-owner marker:
- posttooluse-worktree-marker.sh stamps a worktree with session_id on
`git worktree add` (parses the <path> arg past -b/-B/--reason flags).
- pretooluse-worktree-guard.sh denies `git commit`/`git merge` whose
effective dir (resolves `git -C <p>` and leading `cd <p> &&`) is a
worktree whose marker names a DIFFERENT session. Fail-open: no marker,
unparsable, or own session -> allow. Main tree + pre-convention
worktrees are never marked, so unaffected.
Also completes Wave 1's rollout, which committed pretooluse-bash-guard.sh
but left .claude/settings.json and the agent-ram/nav-guard hooks
untracked (so nothing was actually wired). Adds the settings.json that
registers all five hooks (PreToolUse Bash x2, nav, Agent; PostToolUse
Bash) + the .gitignore worktree-marker line, screenshot-scratch rules,
and the decisions.md TOC left uncommitted last session.
All hooks pipe-tested (7 guard cases + 6 marker cases). Refs #303.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>