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

Hookify plugin: Python import error - 'No module named hookify'

Open hopeoverture opened this issue 1 month ago • 2 comments

Bug Description

The hookify plugin fails with No module named 'hookify' error on every prompt submission because the Python import paths are incorrect.

Error Message

UserPromptSubmit says: Hookify import error: No module named 'hookify'

Root Cause

The Python hook scripts (e.g., hooks/userpromptsubmit.py) attempt to import modules using:

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

However, the plugin directory structure is:

.claude/plugins/cache/claude-code-plugins/hookify/0.1.0/
├── core/
│   ├── config_loader.py
│   └── rule_engine.py
├── hooks/
│   ├── userpromptsubmit.py
│   ├── pretooluse.py
│   ├── posttooluse.py
│   └── stop.py
└── ...

When CLAUDE_PLUGIN_ROOT is set to the plugin directory (.../hookify/0.1.0/), the import from hookify.core... fails because there's no hookify subdirectory - the plugin root is the hookify directory.

Fix

Change all imports 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

Files Affected

  1. hooks/userpromptsubmit.py
  2. hooks/pretooluse.py
  3. hooks/posttooluse.py
  4. hooks/stop.py
  5. core/rule_engine.py

Environment

  • OS: Windows 11
  • Python: 3.14.0
  • Claude Code version: 2.0.45+
  • Hookify plugin version: 0.1.0

Workaround

Users can manually fix the imports by running:

sed -i 's/from hookify\.core\./from core./g' ~/.claude/plugins/cache/claude-code-plugins/hookify/0.1.0/hooks/*.py
sed -i 's/from hookify\.core\./from core./g' ~/.claude/plugins/cache/claude-code-plugins/hookify/0.1.0/core/rule_engine.py

🤖 Generated with Claude Code

hopeoverture avatar Dec 09 '25 02:12 hopeoverture

Found 1 possible duplicate issue:

  1. https://github.com/anthropics/claude-code/issues/13426

This issue will be automatically closed as a duplicate in 3 days.

  • If your issue is a duplicate, please close it and 👍 the existing issue instead
  • To prevent auto-closure, add a comment or 👎 this comment

🤖 Generated with Claude Code

github-actions[bot] avatar Dec 09 '25 02:12 github-actions[bot]

Paste this to Claude Code: Fix hookify import error by running: cd ~/.claude/plugins/cache/claude-code-plugins/hookify/0.1.0 && sed -i 's/from hookify.core./from core./g' core/rule_engine.py hooks/*.py

ahlblad avatar Dec 09 '25 13:12 ahlblad

This issue has been automatically locked since it was closed and has not had any activity for 7 days. If you're experiencing a similar issue, please file a new issue and reference this one if it's relevant.

github-actions[bot] avatar Dec 17 '25 14:12 github-actions[bot]