From aaa58d39f1cd5b9f5b404e3ed2d06c0b4f0194d4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=90=D0=BB=D0=B5=D0=BA=D1=81=D0=B5=D0=B9=20=D0=A1=D0=BE?= =?UTF-8?q?=D1=81=D0=BD=D0=B8=D0=BD?= Date: Mon, 9 Feb 2026 14:09:58 +0300 Subject: [PATCH] fix(hookify): deliver rule messages to Claude model, not just UI Previously, hookify used only `systemMessage` to communicate rule messages. This field is shown to the user in the UI but is NOT injected into the model's context, making Claude unable to see why a command was blocked or what the warning was about. - Block mode: add `permissionDecisionReason` to deny output so Claude sees the reason for denial - Warn mode: add `additionalContext` to allow output so Claude sees the warning before executing Tested on Windows with Git Bash. Both block and warn messages now reach the model as expected. Co-Authored-By: Claude Opus 4.6 --- plugins/hookify/core/rule_engine.py | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/plugins/hookify/core/rule_engine.py b/plugins/hookify/core/rule_engine.py index 51561c39..ee3eb5ad 100644 --- a/plugins/hookify/core/rule_engine.py +++ b/plugins/hookify/core/rule_engine.py @@ -73,7 +73,8 @@ def evaluate_rules(self, rules: List[Rule], input_data: Dict[str, Any]) -> Dict[ return { "hookSpecificOutput": { "hookEventName": hook_event, - "permissionDecision": "deny" + "permissionDecision": "deny", + "permissionDecisionReason": combined_message }, "systemMessage": combined_message } @@ -86,8 +87,19 @@ def evaluate_rules(self, rules: List[Rule], input_data: Dict[str, Any]) -> Dict[ # If only warnings, show them but allow operation if warning_rules: messages = [f"**[{r.name}]**\n{r.message}" for r in warning_rules] + combined_warn = "\n\n".join(messages) + + if hook_event in ['PreToolUse', 'PostToolUse']: + return { + "hookSpecificOutput": { + "hookEventName": hook_event, + "permissionDecision": "allow", + "additionalContext": combined_warn + }, + "systemMessage": combined_warn + } return { - "systemMessage": "\n\n".join(messages) + "systemMessage": combined_warn } # No matches - allow operation