Horizon
(Horizon)
2026 年2 月 13 日 08:31
1
各位佬:
我的ClaudeCode在user级目录安装了“everything-Claude-code”插件,但在实际使用过程中,plan后的文件,被hooks给阻止了,导致plan文件始终无法写入~/.claude/plan目录。
AI说是因为插件的规则做了限制,实在是无语。我还是想按插件的最佳实践跑通,不想修改hooks或目录白名单,你们都怎么做的呢?
另外:everything-Claude-code和superpower这俩项目比起来,哪个更好呢?
Plan(Draft refactor plan)
⎿ Done (9 tool uses · 35.6k tokens · 54s)
● Read 3 files (ctrl+o to expand)
● Updated plan ⎿ Error: PreToolUse:Write hook error: [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)})"]: [Hook] BLOCKED: Unnecessary documentation file creation
[Hook] File: C:\Users\ZhouYang\.claude\plans\woolly-dreaming-avalanche.md [Hook] Use README.md for documentation instead
● User answered Claude's questions:
⎿ · 写入计划文件被你的 Hook 阻止(禁止创建 .md/.txt)。为继续计划模式,你希望我怎么处理? →
3 个赞
Horizon
(Horizon)
2026 年2 月 13 日 08:54
3
他直接建议我加白,主要ECC这个项目做这的意图是为了防止文档碎片化,他说建议用json格式保存计划,好奇怪。
1 个赞
Horizon
(Horizon)
2026 年2 月 13 日 09:08
6
留下来计划文件,对后面跨会话任务跟随可能会好一些,我主要想了解ECC通常会怎么做,感觉上手还不容易呢
Horizon
(Horizon)
2026 年2 月 13 日 09:12
8
感觉咋样呢?这个没了解过,感觉想找个够用的,太硬核我驾驭不了 哈哈
这个比较简单,之前用过on-my-claude 又太复制
禁用了everything-claude-code就可以了
待作者修复 - 因新语法
opened 02:17AM - 17 Jul 25 UTC
closed 02:29AM - 17 Jul 25 UTC
bug
has repro
platform:macos
area:core
# PreToolUse hooks not executing at all in Claude Code
## Environment
- **Claud… e Code Version**: 1.0.53 (npm-local)
- **Operating System**: macOS Darwin 24.5.0
- **Node.js Version**: v22.17.0
## Bug Description
PreToolUse hooks are not executing at all, despite following various configuration formats suggested by error messages. Additionally, `claude doctor` reports configuration errors regardless of the format used.
## Reproduction Steps
1. Create `/Users/cesar/.claude/settings.json` with the following configuration:
```json
{
"hooks": {
"preToolUse": [
{
"matcher": {},
"hooks": [
{
"type": "command",
"command": "~/.claude/wing-coding/check-log-time.sh"
}
]
}
]
}
}
```
2. Create a test script at `~/.claude/wing-coding/check-log-time.sh`:
```bash
#!/bin/bash
echo "Hook executed at $(date)" >> /tmp/claude-hook-test.log
```
3. Make the script executable:
```bash
chmod +x ~/.claude/wing-coding/check-log-time.sh
```
4. Run `claude doctor` and observe the error:
```
Invalid Settings
/Users/cesar/.claude/settings.json
└ hooks
└ preToolUse: Expected array, but received object
```
5. Use any Claude tool (e.g., `ls`, `grep`, `read`)
6. Check if the hook executed:
```bash
cat /tmp/claude-hook-test.log
# File does not exist - hook never executed
```
## Expected Behavior
- The hook script should execute before each tool use
- `claude doctor` should accept valid hook configurations
- A log entry should be created in `/tmp/claude-hook-test.log`
## Actual Behavior
- Hook never executes under any configuration
- `claude doctor` rejects all configuration formats tried
- No log file is created, indicating the hook is never called
## Additional Context
- This appears related to issue #3514 which reported similar problems in v1.0.51
- The bug persists in v1.0.53, indicating it hasn't been fixed
- Tried multiple configuration formats based on error message suggestions:
- With `hooks` wrapper object
- With capitalized `PreToolUse` key
- With and without matchers
- The hook script works correctly when executed manually
## Impact
This prevents users from implementing critical workflow automation and monitoring features via hooks, which is essential for production use cases.
## Full File Contents
### Current settings.json
```json
{
"PreToolUse": [
{
"matcher": {},
"hooks": [
{
"type": "command",
"command": "~/.claude/wing-coding/check-log-time.sh"
}
]
}
]
}
```
### Hook script (check-log-time.sh)
```bash
#!/bin/bash
echo "Hook executed at $(date)" >> /tmp/claude-hook-test.log
```
### Claude doctor output
```
Claude CLI Diagnostic
Currently running: npm-local (1.0.53)
Path: /Users/cesar/.nvm/versions/node/v22.17.0/bin/node
Invoked: /Users/cesar/.claude/local/node_modules/.bin/claude
Config install method: local
Auto-updates enabled: true
Invalid Settings
/Users/cesar/.claude/settings.json
└ hooks
└ preToolUse: Expected array, but received object
Hooks use a new format with matchers. Example: {"PostToolUse": [{"matcher": {"tools": ["BashTool"]}, "hooks": [{"type":
"command", "command": "echo Done"}]}]}
Learn more: https://docs.anthropic.com/en/docs/claude-code/hooks
```
---
*This issue report was generated collaboratively using Wing Coding methodology - a human-AI pair programming approach where César (human pilot) directs Claude (AI wingman) in real-time development sessions. Wing Coding combines human architectural vision with AI implementation capabilities to achieve 3-5x development velocity. Learn more: [Wing Coding on LinkedIn](https://www.linkedin.com/pulse/wing-coding-redefining-human-ai-collaboration-software-césar-obach-mxxde/)*
opened 03:46AM - 25 Jul 25 UTC
closed 05:38AM - 25 Jul 25 UTC
bug
## Environment
- Platform (select one):
- [X] Anthropic API
- [ ] AWS Bedroc… k
- [ ] Google Vertex AI
- [ ] Other:
- Claude CLI version:
- Operating System: Windows 11
- Terminal: Git Bash (via Windows Terminal/PowerShell)
## Bug Description
PreToolUse hooks cannot block tool execution in Claude Code CLI. When a PreToolUse hook returns `{"approve": false}`, the tool operation proceeds anyway, defeating the purpose of pre-execution validation hooks.
## Steps to Reproduce
1. Create a PreToolUse hook that validates content and returns `{"approve": false}` for certain patterns:
```javascript
// .bmad-core/hooks/claude-code/pre-tool-use.js
async function readStdinJson() {
return new Promise((resolve) => {
let data = '';
process.stdin.on('data', chunk => data += chunk);
process.stdin.on('end', () => {
try {
resolve(JSON.parse(data));
} catch (e) {
resolve({});
}
});
});
}
const input = await readStdinJson();
const toolName = input.tool_name || '';
const toolInput = input.tool_input || {};
if (toolName === 'Write') {
const content = toolInput.content || '';
if (content.includes('TODO: implement')) {
console.log(JSON.stringify({
approve: false,
message: "BMAD Reality Guard: Detected simulation pattern."
}));
return;
}
}
console.log(JSON.stringify({ approve: true }));
```
2. Configure the hook in `.claude/settings.json`:
```json
{
"hooks": {
"PreToolUse": [
{
"name": "BMAD Write Validator",
"matcher": "Write|Edit|MultiEdit",
"hooks": [
{
"type": "command",
"command": "node \".bmad-core\\hooks\\claude-code\\pre-tool-use.js\""
}
]
}
]
}
}
```
3. Run Claude Code with debug flag: `claude --debug`
4. Try to create a file with stub content:
```
Write(test-stub.js)
function testFunction() {
// TODO: implement this
throw new Error("Not implemented");
}
```
## Expected Behavior
The file creation should be blocked with the rejection message displayed, and the file should NOT be created.
## Actual Behavior
Debug output shows:
```
[DEBUG] Hook stdout: {"approve":false,"message":"BMAD Reality Guard: Detected simulation pattern..."}
[DEBUG] Successfully parsed and validated hook JSON output
[DEBUG] Writing to temp file: C:\Projects\HelloWorld\hook-test-stub4.js.tmp.46428.1753411839555
[DEBUG] File C:\Projects\HelloWorld\hook-test-stub4.js written atomically
```
The file is created despite the hook returning `{"approve": false}`.
## Additional Context
### Debug Log Evidence
#### Claude Code Debug Output
From the --debug session when attempting to create stub-test-new.js:
```
[DEBUG] Executing hook command: node ".bmad-core\hooks\claude-code\pre-tool-use.js" with timeout 60000ms
[DEBUG] Hook command completed with status 0: node ".bmad-core\hooks\claude-code\pre-tool-use.js"
[DEBUG] Hook stdout: {"approve":false,"message":"BMAD Reality Guard: Detected simulation pattern. Please provide complete, functional implementation. No stubs, mocks, or placeholders allowed in production code."}
...
[DEBUG] Successfully parsed and validated hook JSON output
[DEBUG] Parsed JSON output from hook: {}
[DEBUG] Processed hook result: {}
[DEBUG] Writing to temp file: C:\Projects\HelloWorld\stub-test-new.js.tmp.30816.1753414288545
[DEBUG] Temp file written successfully, size: 587 bytes
[DEBUG] File C:\Projects\HelloWorld\stub-test-new.js written atomically
```
#### Hook Debug Log Evidence
From pre-tool-use-debug.log showing the hook's internal processing:
```
2025-07-25T03:29:28.074Z - readStdinJson: Received chunk 1, size: 962 bytes
2025-07-25T03:29:28.092Z - Full input: {"session_id":"e9adc0a4-9b53-4a8b-9f47-5cddb48fe448",...,"tool_name":"Write","tool_input":{"file_path":"C:\\Projects\\HelloWorld\\stub-test-new.js","content":"// Test file for BMAD Reality Guard hook validation\nfunction processUserData() {\n // TODO: implement user data processing\n throw new Error(\"Not impleme...
2025-07-25T03:29:28.099Z - Processing Write operation
2025-07-25T03:29:28.105Z - Strict mode is enabled, proceeding with validation
2025-07-25T03:29:28.111Z - Testing pattern 0: /\/\/\s*TODO:?\s*[Ii]mplement/i
2025-07-25T03:29:28.113Z - PATTERN MATCHED! Pattern 0: /\/\/\s*TODO:?\s*[Ii]mplement/i
2025-07-25T03:29:28.116Z - BLOCKED: Simulation pattern detected
2025-07-25T03:29:28.123Z - Returning rejection: {"approve":false,"message":"BMAD Reality Guard: Detected simulation pattern. Please provide complete, functional implementation. No stubs, mocks, or placeholders allowed in production code."}
2025-07-25T03:29:28.126Z - Rejection sent to stdout, exiting validateBeforeWrite
```
### Additional Findings
1. **Documentation Discrepancy**: Hooks receive input via stdin, not `process.argv[2]` as some examples suggest
2. **Initial Configuration Issue**: Custom configuration keys (like `bmad-hooks`) in settings.json cause validation errors and must be moved to separate files
3. **Hook Execution Confirmed**: After fixing configuration issues, hooks do execute (verified via debug logs and file creation)
4. **PostToolUse and Stop hooks work correctly**: Only PreToolUse approval mechanism is broken
### Impact
This bug makes PreToolUse hooks effectively useless for their intended purpose of preventing operations based on validation criteria. Use cases affected:
- Code quality enforcement
- Security validation
- Content policy enforcement
- Custom validation workflows
### Workaround
Currently, PreToolUse hooks can only serve as logging/warning mechanisms but cannot actually prevent tool execution.