hookify plugin: rule_engine.py _extract_field doesn't handle Write tool's content field

Resolved 💬 3 comments Opened Apr 15, 2026 by adelaidasofia Closed Apr 17, 2026

Bug

In plugins/hookify/core/rule_engine.py at line 239, the _extract_field method handles the new_text field for the Write tool by returning:

return tool_input.get('new_string', '')

But the Write tool uses content, not new_string. Only Edit uses new_string.

Impact

Hookify rules configured with field: new_text and event: file never match on Write tool operations. They only match on Edit. Any rule meant to catch patterns in newly-written files (em dashes, forbidden phrases, secrets, etc.) silently fails when the file is created via Write instead of edited via Edit.

Fix

Line 239:

return tool_input.get('new_string') or tool_input.get('content', '')

This makes new_text work as a universal "new content being written" field for both Write and Edit.

View original on GitHub ↗

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