[BUG] PreToolUse/PostToolUse warn hook systemMessage silently dropped without hookSpecificOutput
Summary
systemMessage returned from a PreToolUse or PostToolUse hook without hookSpecificOutput is silently dropped — not shown to the user in the terminal and not injected into the model context. This makes warn action rules in the hookify plugin completely invisible.
Environment
- Claude Code (latest)
- Platform: Windows 11
- Hookify plugin via
claude-plugins-officialmarketplace
Steps to Reproduce
- Create a PreToolUse hook that returns only
systemMessage(nohookSpecificOutput):
``json``
{ "systemMessage": "⚠️ Warning: dangerous command detected!" }
- Trigger the matching tool call (e.g.,
rm -rf /tmp/testwith arm\s+-rfpattern rule). - Observe: the command executes, no warning appears in the terminal, and no context is injected into the model.
Expected Behavior
systemMessageshould render visibly in the terminal UI (e.g.,⎿ PreToolUse:Bash says: ⚠️ Warning...)- Or at minimum, the message should be injected into the model's context so Claude can act on it
Actual Behavior
- Message is silently dropped
- User sees nothing; model sees nothing
- The command proceeds without any indication the hook fired
Root Cause
Claude Code appears to require hookSpecificOutput to be present for tool hook events in order to process (and display) a response. Without it, the JSON output from the hook is parsed but the systemMessage has no rendering path.
For block actions, hookSpecificOutput.permissionDecision = "deny" triggers the denial UI. For warn actions, there is no equivalent trigger, so the message is orphaned.
Fix (Verified Working)
Adding hookSpecificOutput with permissionDecision: "allow" and additionalContext resolves both issues — the model receives context injection and (pending confirmation) the terminal renders systemMessage:
return {
"hookSpecificOutput": {
"hookEventName": hook_event, # "PreToolUse" or "PostToolUse"
"permissionDecision": "allow",
"additionalContext": combined_message
},
"systemMessage": combined_message
}
After applying this fix, additionalContext is confirmed injected into model context as PreToolUse:Bash hook additional context: ...
Related Issues
- #20747 — Hookify warnings don't reach the model (only shown to user) — same root cause, opposite framing
- #32624 — Hook systemMessage display prefix verbosity — confirms systemMessage does render for SessionStart events
- #17356 —
permissionDecisionReasonnot displayed in permission prompt for PreToolUse 'ask' decisions — related display gap
Suggested Fix for Hookify Plugin
Update plugins/hookify/core/rule_engine.py evaluate_rules() to include hookSpecificOutput for warn actions on tool events. PR forthcoming if helpful.
🤖 Generated with Claude Code
This issue has 5 comments on GitHub. Read the full discussion on GitHub ↗