Skip to content

Conversation

@filter-tiago
Copy link

Summary

Fixes the hookify plugin's broken Python imports that cause all hooks to fail with No module named 'hookify'.

Problem

The hook scripts use absolute imports like:

from hookify.core.config_loader import load_rules

But the package structure has core/ directly in the plugin root:

plugins/hookify/
├── core/           # ← here, not in hookify/core/
├── hooks/
└── ...

Solution

Changed all imports from from hookify.core... to from core... since CLAUDE_PLUGIN_ROOT is already added to sys.path by each hook script.

Files Changed

  • hooks/stop.py
  • hooks/pretooluse.py
  • hooks/posttooluse.py
  • hooks/userpromptsubmit.py
  • core/rule_engine.py

Testing

Verified imports work correctly:

cd plugins/hookify
CLAUDE_PLUGIN_ROOT="$PWD" python3 -c "
import os, sys
sys.path.insert(0, os.environ['CLAUDE_PLUGIN_ROOT'])
from core.config_loader import load_rules
from core.rule_engine import RuleEngine
print('All imports successful!')
"

Fixes #15674

The hook scripts were using `from hookify.core...` imports, but the
package structure has `core/` directly in the plugin root, not inside
a `hookify/` folder. This caused all hooks to fail with:

    Hookify import error: No module named 'hookify'

Changed all imports from `from hookify.core...` to `from core...`
since CLAUDE_PLUGIN_ROOT is already added to sys.path.

Fixes anthropics#15674
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

hookify plugin: broken Python imports - 'No module named hookify'

1 participant