claude-code icon indicating copy to clipboard operation
claude-code copied to clipboard

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

Open filter-tiago opened this issue 1 month ago • 1 comments

Summary

The hookify plugin's Python hook scripts fail with No module named 'hookify' because the import statements don't match the package structure.

Steps to Reproduce

  1. Install hookify plugin via marketplace
  2. Create any hookify rule (e.g., in .claude/hookify.pretooluse.local.md)
  3. Trigger any hook event (PreToolUse, PostToolUse, Stop, UserPromptSubmit)
  4. Observe error: Hookify import error: No module named 'hookify'

Root Cause

The hook scripts use absolute imports like:

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

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

plugins/hookify/
├── core/           # ← directly here
├── hooks/
├── utils/
└── ...

For the imports to work, the structure should be:

plugins/hookify/
├── hookify/        # ← package folder needed
│   ├── __init__.py
│   ├── core/
│   ├── utils/
│   └── ...

Affected Files

All hook scripts have this issue:

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

Also core/rule_engine.py imports from hookify.core.config_loader.

Workaround

Create a symlink in the plugin directory:

cd ~/.claude/plugins/cache/claude-code-plugins/hookify/0.1.0
ln -sf . hookify

Suggested Fix

Either:

  1. Restructure: Move modules into a hookify/ subfolder
  2. Or use relative imports: Change from hookify.core... to from core... (with appropriate sys.path setup)

Environment

  • macOS
  • Claude Code (latest)
  • hookify plugin v0.1.0 (installed via marketplace)

filter-tiago avatar Dec 29 '25 10:12 filter-tiago