Plugin hooks in settings.json not updated when plugin version changes
Description
When a plugin with hooks is updated to a new version, the hook commands in ~/.claude/settings.json retain the old versioned path, causing hooks to fail when the old version is cleaned from cache.
Steps to Reproduce
- Install a plugin with hooks (e.g.,
coach@netresearch-claude-code-marketplace) - Plugin hooks get written to
settings.jsonwith expanded paths like:
````
python3 ~/.claude/plugins/cache/.../coach/2.2.1/scripts/detect_signals.py
- Plugin updates to newer version (e.g., 2.2.4)
installed_plugins.jsonupdates correctly to new path- Old version cache directory (
coach/2.2.1/) is cleaned up - Hook fails with:
No such file or directory
Current Behavior
- Plugin's
hooks.jsonuses${CLAUDE_PLUGIN_ROOT}variable - At install time, this is expanded to absolute versioned path
- On plugin update:
installed_plugins.jsonis updated ✓- Old cache is cleaned up ✓
settings.jsonhooks are NOT updated ✗
Expected Behavior
When a plugin is updated, hooks in settings.json should be re-processed to use the new version path.
Suggested Fix
Option 1: Re-expand on update
- When a plugin version changes, re-read
hooks.jsonfrom new version - Update
settings.jsonwith newly expanded paths
Option 2: Runtime resolution
- Don't expand
${CLAUDE_PLUGIN_ROOT}at install time - Resolve it at runtime when executing hooks
- Look up current path from
installed_plugins.json
Option 3: Symlink approach
- Create
plugins/cache/.../coach/currentsymlink pointing to active version - Use symlink path in hooks
- Update symlink on version change
Workaround
The coach plugin has implemented a workaround: scripts auto-install a stable launcher to ~/.claude-coach/bin/ and update settings.json on first execution. See: https://github.com/netresearch/claude-coach-plugin/pull/3
Environment
- Claude Code CLI (latest)
- Linux (WSL2)
- Affected plugins: Any plugin using hooks with
${CLAUDE_PLUGIN_ROOT}
This issue has 5 comments on GitHub. Read the full discussion on GitHub ↗