chore: exempt .claude/worktrees/ from protect-files hook

Isolated subagents (frontend/backend-implementer) run in a git worktree
created under .claude/worktrees/. The protect-files PreToolUse hook blocked
all edits to any .claude/ path, making every worktree-isolated agent unable
to edit its own checkout. Exempt .claude/worktrees/ (ephemeral agent scratch
space) while still protecting the real tooling config under .claude/.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
2026-06-03 03:33:11 +02:00
parent 1ba5d5bb9b
commit eb2104ada4

View File

@@ -36,8 +36,8 @@ if echo "$path" | grep -Eq '(^|/)apps/admin/'; then
block "apps/admin/ was deleted in WS-3 and must not return" "Use apps/app/ (Organizer SPA, includes Platform Admin under /platform/*)"
fi
# .claude/ tooling self-modification
if echo "$path" | grep -Eq '(^|/)\.claude/'; then
# .claude/ tooling self-modification (allow ephemeral agent worktrees under .claude/worktrees/)
if echo "$path" | grep -Eq '(^|/)\.claude/' && ! echo "$path" | grep -Eq '(^|/)\.claude/worktrees/'; then
block "tooling self-modification — Bert reviews .claude/ changes by hand" "Open the file in an editor outside Claude Code, or ask Bert to authorize the change explicitly"
fi