Commit 33b06e5
committed
fix(hookify): pass warn/block messages to Claude
Warn rules previously returned only `systemMessage`, which is shown to the
user console but never injected into Claude's context. Educational messages
(the entire point of warn rules) never reached the model. Block rules
similarly returned only a generic deny without `permissionDecisionReason`.
Now:
- Warn rules on PreToolUse/PostToolUse also emit `additionalContext` inside
`hookSpecificOutput`, so Claude sees the message and can self-correct.
- Block rules on PreToolUse/PostToolUse also emit `permissionDecisionReason`,
so Claude sees why the operation was denied.
PreToolUse `additionalContext` support landed in Claude Code v2.1.9
(see anthropics/claude-code#15664, anthropics/claude-code#15345). PostToolUse
has supported it since earlier. The capability is now available; this patch
makes hookify use it.
Refs:
- anthropics/claude-code#15203 (warn — closed as duplicate)
- anthropics/claude-code#12446 (block — closed)
- anthropics/claude-code#15664, anthropics/claude-code#15345 (SDK additionalContext support)
- Prior PR attempts: anthropics/claude-code#15218, anthropics/claude-code#15219 (closed unmerged, predate v2.1.9)1 parent 48aa435 commit 33b06e5
1 file changed
+13
-4
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
73 | 73 | | |
74 | 74 | | |
75 | 75 | | |
76 | | - | |
| 76 | + | |
| 77 | + | |
77 | 78 | | |
78 | 79 | | |
79 | 80 | | |
| |||
86 | 87 | | |
87 | 88 | | |
88 | 89 | | |
89 | | - | |
90 | | - | |
91 | | - | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
92 | 101 | | |
93 | 102 | | |
94 | 103 | | |
| |||
0 commit comments