Hookify plugin: broken Python imports in hook scripts

Resolved 💬 3 comments Opened Feb 24, 2026 by justusaugust Closed Feb 28, 2026

Bug

All 4 hook scripts in the hookify plugin (hooks/pretooluse.py, posttooluse.py, userpromptsubmit.py, stop.py) fail with:

Hookify import error: No module named 'hookify'

This error appears on every Claude Code interaction (every prompt submit, every tool use, every stop).

Cause

The scripts do:

from hookify.core.config_loader import load_rules
from hookify.core.rule_engine import RuleEngine

But CLAUDE_PLUGIN_ROOT points to .../hookify/0.1.0/, which means core/ is a direct child of the path on sys.path — not nested under a hookify/ package. Python can't resolve hookify.core because there's no hookify/ directory inside any path on sys.path.

The path setup in each script:

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)                        # adds .../hookify/
sys.path.insert(0, PLUGIN_ROOT)                       # adds .../hookify/0.1.0/

Neither path contains a hookify/core/ subtree — the core/ dir lives directly inside 0.1.0/.

Fix

Change the imports in all 4 hook scripts 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

This works because PLUGIN_ROOT (which contains core/) is already on sys.path.

Affected files

  • plugins/hookify/hooks/pretooluse.py
  • plugins/hookify/hooks/posttooluse.py
  • plugins/hookify/hooks/userpromptsubmit.py
  • plugins/hookify/hooks/stop.py

View original on GitHub ↗

This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗