From 40e80bcc614ecee23a55a39112437be432ef1617 Mon Sep 17 00:00:00 2001 From: Maohua Zhu Date: Sun, 15 Feb 2026 08:49:15 +0800 Subject: [PATCH] fix: whitelist .claude/plans/ in doc file creation hook The PreToolUse Write hook blocks creation of .md files to prevent unnecessary documentation sprawl. However, it also blocks Claude Code's built-in plan mode from writing plan files to .claude/plans/*.md, causing "BLOCKED: Unnecessary documentation file creation" errors every time a plan is created or updated. Add .claude/plans/ path to the whitelist so plan files are not blocked. --- hooks/hooks.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hooks/hooks.json b/hooks/hooks.json index bfaf2dcd..d8c8c2d7 100644 --- a/hooks/hooks.json +++ b/hooks/hooks.json @@ -37,7 +37,7 @@ "hooks": [ { "type": "command", - "command": "node -e \"const fs=require('fs');let d='';process.stdin.on('data',c=>d+=c);process.stdin.on('end',()=>{try{const i=JSON.parse(d);const p=i.tool_input?.file_path||'';if(/\\.(md|txt)$/.test(p)&&!/(README|CLAUDE|AGENTS|CONTRIBUTING)\\.md$/.test(p)){console.error('[Hook] BLOCKED: Unnecessary documentation file creation');console.error('[Hook] File: '+p);console.error('[Hook] Use README.md for documentation instead');process.exit(2)}}catch{}console.log(d)})\"" + "command": "node -e \"const fs=require('fs');let d='';process.stdin.on('data',c=>d+=c);process.stdin.on('end',()=>{try{const i=JSON.parse(d);const p=i.tool_input?.file_path||'';if(/\\.(md|txt)$/.test(p)&&!/(README|CLAUDE|AGENTS|CONTRIBUTING)\\.md$/.test(p)&&!/\\.claude\\/plans\\//.test(p)){console.error('[Hook] BLOCKED: Unnecessary documentation file creation');console.error('[Hook] File: '+p);console.error('[Hook] Use README.md for documentation instead');process.exit(2)}}catch{}console.log(d)})\"" } ], "description": "Block creation of random .md files - keeps docs consolidated"