From eb2104ada4acf503b230c91ca15affe5d6cd3eb1 Mon Sep 17 00:00:00 2001 From: "bert.hausmans" Date: Wed, 3 Jun 2026 03:33:11 +0200 Subject: [PATCH] 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 --- .claude/hooks/protect-files.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.claude/hooks/protect-files.sh b/.claude/hooks/protect-files.sh index 662bf266..48c55579 100755 --- a/.claude/hooks/protect-files.sh +++ b/.claude/hooks/protect-files.sh @@ -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