[hookify plugin] Import error: No module named 'hookify' due to versioned cache path
Preflight Checklist
- [x] I have searched existing issues and this hasn't been reported yet
- [x] This is a single bug report (please file separate reports for different bugs)
- [x] I am using the latest version of Claude Code
What's Wrong?
---
The hookify plugin fails with No module named 'hookify' error on every hook execution. The error appears in PostToolUse, PreToolUse, Stop, and UserPromptSubmit hooks.
The plugin's Python files use imports like:
```python
from hookify.core.config_loader import load_rules
But the sys.path setup doesn't create a valid hookify package due to Claude Code's versioned cache structure (hookify/0.1.0/ instead of hookify/core/).
---
What Should Happen?
The hookify plugin should load successfully and evaluate rules without import errors.
Error Messages/Logs
## Error Message
Hookify import error: No module named 'hookify'
Steps to Reproduce
```markdown
- Install the hookify plugin from claude-code-plugins
- Create any hookify rule file in
.claude/hookify.test.local.md - Run any Claude Code command that triggers a hook (e.g., use the Bash or Edit tool)
- Observe the error message: "Hookify import error: No module named 'hookify'"
The bug occurs because the plugin cache path is:
.claude/plugins/cache/claude-code-plugins/hookify/0.1.0/
The code adds parent_dir (which is hookify/) to sys.path, but that directory only contains 0.1.0/, not the core/ module the imports expect.
Claude Model
Opus
Is this a regression?
I don't know
Last Working Version
_No response_
Claude Code Version
2.0.64 (Claude Code)
Platform
Anthropic API
Operating System
Windows
Terminal/Shell
IntelliJ IDEA terminal
Additional Information
## Affected Files
hooks/posttooluse.py(line 22)hooks/pretooluse.py(line 26)hooks/stop.py(line 22)hooks/userpromptsubmit.py(line 22)core/rule_engine.py(lines 10, 278)
## Suggested Fix
Change all imports from:
```python
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
Since PLUGIN_ROOT is already added to sys.path, the core module can be imported directly.
Workaround
Users can manually edit the 5 files listed above in their local cache at:
~/.claude/plugins/cache/claude-code-plugins/hookify/0.1.0/
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗