17856cac32
Multiple sessions sharing this one checkout clobbered each other (branch switches, edits landing on the wrong branch). Enforce per-session isolation: - worktree.bgIsolation=worktree + baseRef=fresh (native bg-session isolation) - PreToolUse(Edit|Write|NotebookEdit) hook DENIES edits while in the main checkout - SessionStart hook directs each session to EnterWorktree (fresh worktree, off main) .claude/hooks/worktree-guard.sh detects main-vs-worktree via git-dir != git-common-dir. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
31 lines
643 B
JSON
31 lines
643 B
JSON
{
|
|
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
"worktree": {
|
|
"bgIsolation": "worktree",
|
|
"baseRef": "fresh"
|
|
},
|
|
"hooks": {
|
|
"SessionStart": [
|
|
{
|
|
"hooks": [
|
|
{
|
|
"type": "command",
|
|
"command": "bash \"$CLAUDE_PROJECT_DIR/.claude/hooks/worktree-guard.sh\" notice"
|
|
}
|
|
]
|
|
}
|
|
],
|
|
"PreToolUse": [
|
|
{
|
|
"matcher": "Edit|Write|NotebookEdit",
|
|
"hooks": [
|
|
{
|
|
"type": "command",
|
|
"command": "bash \"$CLAUDE_PROJECT_DIR/.claude/hooks/worktree-guard.sh\" block"
|
|
}
|
|
]
|
|
}
|
|
]
|
|
}
|
|
}
|