fix(hookify): deliver rule messages to Claude model, not just UI #369
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
permissionDecisionReasonfield to thedenyresponse so Claude sees why a command was blockedadditionalContextfield to theallowresponse so Claude sees the warning before executingProblem
Hookify rules define a message body that should be shown when a rule triggers. Previously, this message was only sent via
systemMessage, which is displayed in the UI to the user but is not injected into the model's context. This means Claude cannot see:This defeats the purpose of hookify messages — Claude keeps retrying blocked commands without understanding why, or ignores warnings entirely.
Fix
Two additions to
rule_engine.pyevaluate_rules():action: block(deny): addpermissionDecisionReasontohookSpecificOutput— this field is documented as "shown to Claude" for deny decisionsaction: warn(allow): addadditionalContexttohookSpecificOutput— this field injects context visible to Claude before tool executionBoth fields are part of the official Claude Code hooks API.
systemMessageis preserved for backward compatibility (still shows in UI).Test plan
action: block— verify Claude sees the reason text in the denial messageaction: warn— verify Claude sees the warning assystem-remindercontext🤖 Generated with Claude Code