Plugin cache accumulates old version directories; no pruning after update
Description
After a plugin updates (e.g. nix-sdlc from 0.29.0 → 0.29.1), the harness correctly writes the new version to cache but leaves the old version directory in place:
~/.claude/plugins/cache/nix-sdlc-marketplace/nix-sdlc/
0.27.0/ ← stale, never pruned
0.28.1/ ← stale, never pruned
0.29.0/ ← stale, never pruned
0.29.1/ ← current
Steps to Reproduce
- Install a plugin (e.g.
nix-sdlc@0.29.0) - Update the plugin to
0.29.1 - Inspect
~/.claude/plugins/cache/<marketplace>/<plugin>/— both version directories exist
Impact
Any code or AI agent that resolves the skill path by listing the cache directory (rather than reading installed_plugins.json::installPath) will silently load a stale version. In practice, this caused a failed modernization dry-run where an agent used v0.29.0 skill instructions instead of v0.29.1, missing a critical modernized-app/ isolation rule that was added in the newer version.
Expected Behavior
After a successful update, the harness should remove the previously installed version directory so only one version exists in the cache at any time. Alternatively:
- Document clearly that
installed_plugins.json::installPathis the only authoritative resolution path and that listing the cache directory is unsupported - Add
"cache": { "keepOnlyLatest": true }support toplugin.jsonso plugin authors can opt in to pruning
Workaround
Manually delete old version directories:
rm -rf ~/.claude/plugins/cache/nix-sdlc-marketplace/nix-sdlc/0.29.0
Environment
- Claude Code CLI
- Plugin cache path:
~/.claude/plugins/cache/
This issue has 1 comment on GitHub. Read the full discussion on GitHub ↗