Bug Description
The hookify plugin fails to import its own modules when loaded from the plugin cache, producing this error on every PreToolUse, PostToolUse, and other hook events:
Hookify import error: No module named 'hookify'
Root Cause
The plugin cache stores hookify at:
~/.claude/plugins/cache/claude-code-plugins/hookify/0.1.0/
The hook scripts (e.g., hooks/pretooluse.py) set up sys.path like this:
PLUGIN_ROOT = os.environ.get('CLAUDE_PLUGIN_ROOT') # .../hookify/0.1.0/
parent_dir = os.path.dirname(PLUGIN_ROOT) # .../hookify/
sys.path.insert(0, parent_dir)
sys.path.insert(0, PLUGIN_ROOT)
from hookify.core.config_loader import load_rules # fails
Python's from hookify.core.config_loader expects a directory named hookify/ containing core/config_loader.py on sys.path. But:
parent_dir (…/hookify/) contains only 0.1.0/, not a hookify/ subdirectory
PLUGIN_ROOT (…/hookify/0.1.0/) also doesn't contain a hookify/ subdirectory
The version number directory (0.1.0/) breaks Python's package resolution.
Workaround
Creating a symlink inside the cache directory resolves the issue:
ln -sf "0.1.0" ~/.claude/plugins/cache/claude-code-plugins/hookify/hookify
This lets Python find hookify/core/config_loader.py via the symlink.
Suggested Fix
Either:
- Change imports to be relative — use
from core.config_loader import load_rules instead of from hookify.core.config_loader
- Add grandparent to sys.path — add
os.path.dirname(os.path.dirname(PLUGIN_ROOT)) (i.e., .../cache/claude-code-plugins/) which contains the hookify/ directory. Then create an __init__.py in the hookify/ cache directory, or adjust the versioned layout.
- Use PLUGIN_ROOT directly — since
PLUGIN_ROOT/core/ exists, change the path setup to treat PLUGIN_ROOT as the package root.
Environment
- macOS Darwin 25.4.0 (Apple Silicon)
- Claude Code (latest)
- Hookify plugin v0.1.0
- Plugin author: Daisy Hollman (daisy@anthropic.com)
Impact
The error fires on every single tool call (PreToolUse + PostToolUse), meaning 2 error messages per tool invocation. While hookify gracefully degrades (exits 0), it clutters system-reminder messages and wastes context window tokens.
🤖 Generated with Claude Code
Bug Description
The hookify plugin fails to import its own modules when loaded from the plugin cache, producing this error on every
PreToolUse,PostToolUse, and other hook events:Root Cause
The plugin cache stores hookify at:
The hook scripts (e.g.,
hooks/pretooluse.py) set upsys.pathlike this:Python's
from hookify.core.config_loaderexpects a directory namedhookify/containingcore/config_loader.pyonsys.path. But:parent_dir(…/hookify/) contains only0.1.0/, not ahookify/subdirectoryPLUGIN_ROOT(…/hookify/0.1.0/) also doesn't contain ahookify/subdirectoryThe version number directory (
0.1.0/) breaks Python's package resolution.Workaround
Creating a symlink inside the cache directory resolves the issue:
This lets Python find
hookify/core/config_loader.pyvia the symlink.Suggested Fix
Either:
from core.config_loader import load_rulesinstead offrom hookify.core.config_loaderos.path.dirname(os.path.dirname(PLUGIN_ROOT))(i.e.,.../cache/claude-code-plugins/) which contains thehookify/directory. Then create an__init__.pyin thehookify/cache directory, or adjust the versioned layout.PLUGIN_ROOT/core/exists, change the path setup to treatPLUGIN_ROOTas the package root.Environment
Impact
The error fires on every single tool call (PreToolUse + PostToolUse), meaning 2 error messages per tool invocation. While hookify gracefully degrades (exits 0), it clutters
system-remindermessages and wastes context window tokens.🤖 Generated with Claude Code