Hookify plugin: ImportError due to versioned cache directory structure

Resolved 💬 4 comments Opened Apr 14, 2026 by liyoungc Closed May 27, 2026

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:

  1. Change imports to be relative — use from core.config_loader import load_rules instead of from hookify.core.config_loader
  2. 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.
  3. 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

View original on GitHub ↗

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