-
Notifications
You must be signed in to change notification settings - Fork 5.2k
Open
Labels
area:toolsbugSomething isn't workingSomething isn't workingduplicateThis issue or pull request already existsThis issue or pull request already existshas reproHas detailed reproduction stepsHas detailed reproduction stepsplatform:macosIssue specifically occurs on macOSIssue specifically occurs on macOS
Description
Preflight Checklist
- I have searched existing issues and this hasn't been reported yet
- This is a single bug report (please file separate reports for different bugs)
- I am using the latest version of Claude Code
What's Wrong?
hookify file rules that rely on new_text (including legacy event: file + pattern) do not trigger when the tool is Write.
In Write, content is sent via tool_input.content, but new_text resolution only checks new_string.
Result: warnings/blocks can trigger for Edit but silently fail for Write.
Affected area:
plugins/hookify/core/rule_engine.py(_extract_fieldforWrite/Edit)
What Should Happen?
For file rules, new_text should match both:
Writeviatool_input.contentEditviatool_input.new_string
So the same rule behaves consistently for new-file writes and edits.
Error Messages/Logs
No explicit runtime error is shown.
Behavioral mismatch only: rule does not trigger on Write.Steps to Reproduce
- Create a hookify rule file:
hookify.warn-console-log.local.md
---
name: warn-console-log
enabled: true
event: file
pattern: console\.log\(
action: warn
---
Console.log detected
- Trigger a
Writeoperation that includesconsole.log(...)in file content. - Observe: no hook warning is shown.
- Trigger an
Editoperation that addsconsole.log(...)vianew_string. - Observe: hook warning appears.
Claude Model
Not sure / Multiple models
Is this a regression?
No, this never worked
Last Working Version
N/A
Claude Code Version
2.1.37
Platform
Anthropic API
Operating System
macOS
Terminal/Shell
Terminal.app (macOS)
Additional Information
A minimal fix is to map new_text across both fields for file tools:
new_string(Edit)content(Write)
PR prepared from fork addresses this exact mapping -> #24321
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
area:toolsbugSomething isn't workingSomething isn't workingduplicateThis issue or pull request already existsThis issue or pull request already existshas reproHas detailed reproduction stepsHas detailed reproduction stepsplatform:macosIssue specifically occurs on macOSIssue specifically occurs on macOS