Environment
- Platform (select one):
- Claude CLI version: 1.0.56 (Claude Code)
- Operating System: macOS 15.5 (Darwin 24.5.0)
- Terminal: Ghostty.app
Bug Description
PostToolUse hooks that output JSON in the documented format are not being processed by Claude Code. The hook correctly outputs JSON with exit code 0, but Claude Code does not make this data available to the AI assistant as documented.
Steps to Reproduce
- Create a PostToolUse hook that outputs JSON in the documented format:
{"reason": "Hook feedback message"}
- Configure the hook in
.claude/settings.local.json:
{
"hooks": {
"postToolUse": {
"Bash": "python3 /path/to/hook_script.py"
}
}
}
- Execute a Bash command that triggers the hook (e.g.,
ls)
- Hook executes successfully with exit code 0 and outputs the JSON
- Claude Code does not receive/process the JSON output
Expected Behavior
According to the hooks documentation, when a PostToolUse hook returns exit code 0 with JSON output, Claude Code should process that JSON. The AI assistant should have access to the hook's output data.
Actual Behavior
- Hook executes correctly (verified via diagnostic logging)
- Hook outputs proper JSON format (verified by capturing stdout)
- Hook exits with code 0 (success)
- Claude Code does not process the JSON output
- The AI assistant never receives the hook data
Additional Context
This issue has been present since at least version 1.0.44. The hook implementation follows the documented specification exactly:
# Hook outputs JSON and exits with code 0
output = {"reason": "[KSI ⚡3]"}
print(json.dumps(output), flush=True)
sys.exit(0)
Diagnostic logs confirm the hook is working:
2025-07-19T10:30:59.565767 - JSON feedback output: [KSI ⚡3]
But Claude Code is not processing this output as documented. This prevents hooks from providing feedback to the AI assistant during tool execution.
Related Issues:
Workaround:
Currently forced to write diagnostic data to external log files since the documented JSON communication method doesn't work.
Environment
Bug Description
PostToolUse hooks that output JSON in the documented format are not being processed by Claude Code. The hook correctly outputs JSON with exit code 0, but Claude Code does not make this data available to the AI assistant as documented.
Steps to Reproduce
{"reason": "Hook feedback message"}.claude/settings.local.json:{ "hooks": { "postToolUse": { "Bash": "python3 /path/to/hook_script.py" } } }ls)Expected Behavior
According to the hooks documentation, when a PostToolUse hook returns exit code 0 with JSON output, Claude Code should process that JSON. The AI assistant should have access to the hook's output data.
Actual Behavior
Additional Context
This issue has been present since at least version 1.0.44. The hook implementation follows the documented specification exactly:
Diagnostic logs confirm the hook is working:
But Claude Code is not processing this output as documented. This prevents hooks from providing feedback to the AI assistant during tool execution.
Related Issues:
Workaround:
Currently forced to write diagnostic data to external log files since the documented JSON communication method doesn't work.