Hookify plugin: Python import error due to incorrect path configuration

Status Closed — duplicate
Maintainer reply None cached
Activity 3 comments · opened Dec 30, 2025 · closed Jan 3, 2026

Bug Description

The hookify plugin fails with No module named 'hookify' error on every tool use (PreToolUse, PostToolUse).

Error Message

PostToolUse:Read says: Hookify import error: No module named 'hookify'
PreToolUse:TodoWrite says: Hookify import error: No module named 'hookify'
PostToolUse:TodoWrite says: Hookify import error: No module named 'hookify'

Root Cause

The Python hooks in hooks/pretooluse.py (and others) configure the path incorrectly:

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

from hookify.core.config_loader import load_rules  # Fails!

Directory structure:

.claude/plugins/cache/claude-code-plugins/hookify/
└── 0.1.0/          ← PLUGIN_ROOT points here
    ├── core/
    │   ├── __init__.py
    │   ├── config_loader.py
    │   └── rule_engine.py
    └── hooks/
        └── pretooluse.py

What happens:

  1. PLUGIN_ROOT = .../hookify/0.1.0/
  2. parent_dir = .../hookify/ (added to sys.path)
  3. Python tries to import hookify.core.config_loader
  4. Python looks for .../hookify/hookify/core/config_loader.pyDOESN'T EXIST
  5. The actual file is at .../hookify/0.1.0/core/config_loader.py

Workaround

Create a symlink so Python can find the module:

ln -s "/Users/$USER/.claude/plugins/cache/claude-code-plugins/hookify/0.1.0" \
      "/Users/$USER/.claude/plugins/cache/claude-code-plugins/hookify/hookify"

Suggested Fix

Either:

  1. Change directory structure so PLUGIN_ROOT is named hookify instead of version number
  2. Or fix the imports to use relative imports or correct path calculation:
# Option A: Add PLUGIN_ROOT itself and use relative imports
sys.path.insert(0, PLUGIN_ROOT)
from core.config_loader import load_rules

# Option B: Create the correct path mapping
# The parent is .../hookify/, so we need hookify/hookify → hookify/0.1.0

Environment

  • Claude Code version: Latest
  • Hookify plugin version: 0.1.0
  • Python version: 3.14.2
  • OS: macOS (Darwin 25.2.0)

View original on GitHub ↗

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