feat: expose hook stdout/stderr to the conversation for debugging
Resolved 💬 2 comments Opened Mar 27, 2026 by Andrew-Tierno Closed Mar 27, 2026
Problem
When a PreToolUse or PostToolUse hook errors, Claude Code shows a banner like:
PreToolUse:EnterPlanMode hook error
But there's no way to see:
- What the hook's stderr/stdout was
- What exit code it returned
- Which specific hook in the array failed
The hook runs in a subprocess — its output is invisible to the conversation.
Impact
- Can't debug hook failures without manually running the hook command
- Agents can't self-diagnose hook issues
- Hook development requires trial-and-error with no feedback loop
Suggestion
- Include hook stderr in the error banner (truncated to ~200 chars)
- Add a
--debug-hooksflag or setting that pipes full hook output to the conversation - Or: a
/hooks test <tool-name>command that dry-runs hooks and shows their output - Log hook output to a file (e.g.,
~/.claude/debug/hooks.log) that agents can read
Any of these would make hook development and debugging dramatically easier.
This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗