Bug Fixes
-
Plugin cache self-heal — 4-layer automatic recovery for Claude Code's plugin auto-update breaking
${CLAUDE_PLUGIN_ROOT}(anthropics/claude-code#46915).When Claude Code auto-updates a plugin, it can leave
installed_plugins.jsonpointing to a non-existent directory, breaking all hooks with"Plugin directory does not exist". This affects any plugin with hooks — not just context-mode.Related Claude Code issues
- anthropics/claude-code#46915 — Plugin auto-update deletes old cache dir, breaking
${CLAUDE_PLUGIN_ROOT}in running sessions - anthropics/claude-code#29074 — Plugin cache not cleared on uninstall/reinstall, wrong version loaded
- anthropics/claude-code#36245 — Plugin cache: old versions never garbage collected on autoUpdate
- anthropics/claude-code#45997 — Plugin loader uses wrong installPath from installed_plugins array
4-layer defense
start.mjsstartup — detects registry→directory mismatch, creates symlink from broken path to our actual directoryserver.tsfirst tool call — mid-session heal catches auto-updates that happen during an active sessionpostinstall.mjs— backward symlink on new install for stale registry references- Global SessionStart hook — auto-deployed to
~/.claude/hooks/, survives total plugin cache breakage since it lives outside the plugin directory
Coverage
Scenario Fixed? Mid-session auto-update ✅ Next session after auto-update ✅ Fresh install with stale registry ✅ Global hook survives cache wipe ✅ Both old and new dirs deleted ❌ (requires /pluginreinstall) - anthropics/claude-code#46915 — Plugin auto-update deletes old cache dir, breaking
Tests
- 9 new integration tests with real filesystem fixtures
- 1805 total tests passing, 0 failures