Hookify warnings don't reach the model (only shown to user)

Open 💬 4 comments Opened Jan 25, 2026 by santiagolgzz

Summary

Hookify warn action messages are only shown to the user, not injected into the model's context. This means the model cannot learn from or respond to warnings - it never sees them.

Root Cause

In plugins/hookify/core/rule_engine.py, warnings only use systemMessage:

# If only warnings, show them but allow operation
if warning_rules:
    messages = [f"**[{r.name}]**\n{r.message}" for r in warning_rules]
    return {
        "systemMessage": "\n\n".join(messages)
    }

According to the Claude Code hooks documentation:

  • systemMessage → shown to user only
  • hookSpecificOutput.additionalContext → injected into model context

Proposed Fix

# If only warnings, show them but allow operation
# Use additionalContext so the model sees the warning (not just the user)
if warning_rules:
    messages = [f"**[{r.name}]**\n{r.message}" for r in warning_rules]
    combined_message = "\n\n".join(messages)
    return {
        "systemMessage": combined_message,
        "hookSpecificOutput": {
            "hookEventName": hook_event or "PreToolUse",
            "permissionDecision": "allow",
            "additionalContext": combined_message
        }
    }

Impact

Without this fix, hookify warnings are effectively useless for guiding model behavior. The user sees them, but Claude doesn't, so Claude keeps making the same mistakes.

Tested

I applied this fix locally and confirmed that warnings now appear in the model's context as PreToolUse:Bash hook additional context: ...

View original on GitHub ↗

This issue has 4 comments on GitHub. Read the full discussion on GitHub ↗