Hookify plugin: Python import error - 'No module named hookify'
Bug Description
The hookify plugin fails with No module named 'hookify' error on every prompt submission because the Python import paths are incorrect.
Error Message
UserPromptSubmit says: Hookify import error: No module named 'hookify'
Root Cause
The Python hook scripts (e.g., hooks/userpromptsubmit.py) attempt to import modules using:
from hookify.core.config_loader import load_rules
from hookify.core.rule_engine import RuleEngine
However, the plugin directory structure is:
.claude/plugins/cache/claude-code-plugins/hookify/0.1.0/
├── core/
│ ├── config_loader.py
│ └── rule_engine.py
├── hooks/
│ ├── userpromptsubmit.py
│ ├── pretooluse.py
│ ├── posttooluse.py
│ └── stop.py
└── ...
When CLAUDE_PLUGIN_ROOT is set to the plugin directory (.../hookify/0.1.0/), the import from hookify.core... fails because there's no hookify subdirectory - the plugin root is the hookify directory.
Fix
Change all imports from:
from hookify.core.config_loader import load_rules
from hookify.core.rule_engine import RuleEngine
To:
from core.config_loader import load_rules
from core.rule_engine import RuleEngine
Files Affected
-
hooks/userpromptsubmit.py -
hooks/pretooluse.py -
hooks/posttooluse.py -
hooks/stop.py -
core/rule_engine.py
Environment
- OS: Windows 11
- Python: 3.14.0
- Claude Code version: 2.0.45+
- Hookify plugin version: 0.1.0
Workaround
Users can manually fix the imports by running:
sed -i 's/from hookify\.core\./from core./g' ~/.claude/plugins/cache/claude-code-plugins/hookify/0.1.0/hooks/*.py
sed -i 's/from hookify\.core\./from core./g' ~/.claude/plugins/cache/claude-code-plugins/hookify/0.1.0/core/rule_engine.py
🤖 Generated with Claude Code
Found 1 possible duplicate issue:
- https://github.com/anthropics/claude-code/issues/13426
This issue will be automatically closed as a duplicate in 3 days.
- If your issue is a duplicate, please close it and 👍 the existing issue instead
- To prevent auto-closure, add a comment or 👎 this comment
🤖 Generated with Claude Code
Paste this to Claude Code: Fix hookify import error by running: cd ~/.claude/plugins/cache/claude-code-plugins/hookify/0.1.0 && sed -i 's/from hookify.core./from core./g' core/rule_engine.py hooks/*.py
This issue has been automatically locked since it was closed and has not had any activity for 7 days. If you're experiencing a similar issue, please file a new issue and reference this one if it's relevant.