claude-code
claude-code copied to clipboard
hookify plugin: broken Python imports - 'No module named hookify'
Summary
The hookify plugin's Python hook scripts fail with No module named 'hookify' because the import statements don't match the package structure.
Steps to Reproduce
- Install hookify plugin via marketplace
- Create any hookify rule (e.g., in
.claude/hookify.pretooluse.local.md) - Trigger any hook event (PreToolUse, PostToolUse, Stop, UserPromptSubmit)
- Observe error:
Hookify import error: No module named 'hookify'
Root Cause
The hook scripts use absolute imports like:
from hookify.core.config_loader import load_rules
from hookify.core.rule_engine import RuleEngine
But the package structure has core/ directly in the plugin root:
plugins/hookify/
├── core/ # ← directly here
├── hooks/
├── utils/
└── ...
For the imports to work, the structure should be:
plugins/hookify/
├── hookify/ # ← package folder needed
│ ├── __init__.py
│ ├── core/
│ ├── utils/
│ └── ...
Affected Files
All hook scripts have this issue:
-
hooks/stop.py -
hooks/pretooluse.py -
hooks/posttooluse.py -
hooks/userpromptsubmit.py
Also core/rule_engine.py imports from hookify.core.config_loader.
Workaround
Create a symlink in the plugin directory:
cd ~/.claude/plugins/cache/claude-code-plugins/hookify/0.1.0
ln -sf . hookify
Suggested Fix
Either:
-
Restructure: Move modules into a
hookify/subfolder -
Or use relative imports: Change
from hookify.core...tofrom core...(with appropriatesys.pathsetup)
Environment
- macOS
- Claude Code (latest)
- hookify plugin v0.1.0 (installed via marketplace)