Hookify plugin: Python import fails due to version directory naming

Resolved 💬 3 comments Opened Jan 7, 2026 by JR-Morton Closed Jan 11, 2026

Description

The hookify plugin fails to import its Python modules when running hooks, producing this error:

Hookify import error: No module named 'hookify'

Root Cause

The plugin's Python scripts (e.g., hooks/pretooluse.py) use this import logic:

PLUGIN_ROOT = os.environ.get('CLAUDE_PLUGIN_ROOT')
if PLUGIN_ROOT:
    parent_dir = os.path.dirname(PLUGIN_ROOT)
    sys.path.insert(0, parent_dir)

from hookify.core.config_loader import load_rules

This expects the directory structure to be:

.../hookify/           <- parent_dir added to sys.path
    hookify/           <- package Python looks for
        core/
            config_loader.py

But the actual cached plugin structure is:

.../hookify/           <- parent_dir added to sys.path
    0.1.0/             <- version folder, not "hookify"
        core/
            config_loader.py

Python looks for .../hookify/hookify/core/config_loader.py but the file is at .../hookify/0.1.0/core/config_loader.py.

Workaround

Create a symlink:

ln -s 0.1.0 ~/.claude/plugins/cache/claude-code-plugins/hookify/hookify

Suggested Fix

Option 1: Add PLUGIN_ROOT directly to sys.path and use relative imports:

if PLUGIN_ROOT not in sys.path:
    sys.path.insert(0, PLUGIN_ROOT)

from core.config_loader import load_rules

Option 2: Dynamically determine the package name from PLUGIN_ROOT:

package_name = os.path.basename(PLUGIN_ROOT)
# Then use importlib to import dynamically

Environment

  • Platform: Linux (WSL2)
  • Claude Code version: Latest
  • Plugin version: hookify 0.1.0

View original on GitHub ↗

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