claude-code
claude-code copied to clipboard
[BUG] Plugin Cache Not Invalidated When Files Are Deleted
Preflight Checklist
- [x] I have searched existing issues and this hasn't been reported yet
- [x] This is a single bug report (please file separate reports for different bugs)
- [x] I am using the latest version of Claude Code
What's Wrong?
Bug Report: Plugin Cache Not Invalidated on Marketplace Update
Summary
Plugin cache at ~/.claude/plugins/cache/<marketplace>/<plugin>/ is not properly invalidated when updating plugins through the marketplace, causing deleted commands to persist in the UI.
Environment
- Claude Code Version: v2.1.7
- Platform: macOS (Darwin 25.2.0)
- Marketplace Type: Custom GitLab marketplace
- Affected Plugin: plan@sekora-ai (version 0.1.0)
Steps to Reproduce
- Install a plugin from a custom marketplace with a command file (e.g.,
commands/implement-plan.md) - Verify command appears in autocomplete (e.g.,
/plan:implement-planand/implement-plan) - In the plugin repository:
- Delete the command file (
commands/implement-plan.md) - Commit and push changes to remote
- Delete the command file (
- Update the marketplace:
claude plugin marketplace update - Update the plugin through UI: Navigate to
/plugin→ Marketplaces → Select plugin → "Update now" - Restart Claude Code
- Check autocomplete for deleted command
Expected Behavior
After updating the plugin from the marketplace, deleted commands should:
- Be removed from autocomplete suggestions
- Not appear in the plugin's installed components list
- Be removed from
~/.claude/plugins/cache/<marketplace>/<plugin>/commands/
Actual Behavior
Deleted commands persist in:
- Autocomplete suggestions (
/plan:implement-planand/implement-plan (plugin:plan@sekora-ai)) - Plugin UI's "Installed components" list shows:
describe, implement-plan, implement, list, review, save - Cache directory still contains the deleted file:
~/.claude/plugins/cache/sekora-ai/plan/0.1.0/commands/implement-plan.md
The plugin update mechanism appears to preserve the cache even when files are removed from the source repository.
Attempted Solutions (All Failed)
- ✗ Updated marketplace multiple times via UI and CLI
- ✗ Updated plugin multiple times via "Update now" button
- ✗ Restarted Claude Code multiple times
- ✗ Marked plugin for update and updated
Workaround
Manually clear the plugin cache and reinstall:
# Remove the entire plugin cache
rm -rf ~/.claude/plugins/cache/sekora-ai
# Re-add marketplace
claude plugin marketplace add [email protected]:sekora-ai/claude-code/claude-code-marketplace.git
# Reinstall the plugin through UI or CLI
# The plugin now reflects the current state of the repository
Impact
- Severity: Medium
- User Impact: Users see stale commands that no longer exist, leading to confusion
- Developer Impact: Plugin developers cannot effectively remove or rename commands without users manually clearing cache
- Workaround Available: Yes (manual cache deletion)
Expected Fix
Plugin update mechanism should:
- Compare cached plugin state with marketplace version
- Remove files that no longer exist in the new version
- Update files that have changed
- Add new files
- Properly invalidate and rebuild the cache
Alternatively, provide a --clear-cache flag for plugin updates:
claude plugin update <plugin-name> --clear-cache
Additional Notes
- This issue specifically affects the
commands/directory, but may affect other plugin components (agents, etc.) - The plugin uses
"commands": ["./commands"]inplugin.jsonfor auto-discovery - Git commit removing the file:
8b8eff0- "docs: consolidate implement-plan into implement command" - Remote repository correctly shows file as deleted
- Marketplace appears to update successfully (shows "✓ Updated 1 marketplace")
What Should Happen?
Expected Fix
Plugin update mechanism should:
- Compare cached plugin state with marketplace version
- Remove files that no longer exist in the new version
- Update files that have changed
- Add new files
- Properly invalidate and rebuild the cache
Error Messages/Logs
Steps to Reproduce
Steps to Reproduce
- Install a plugin from a custom marketplace with a command file (e.g.,
commands/implement-plan.md) - Verify command appears in autocomplete (e.g.,
/plan:implement-planand/implement-plan) - In the plugin repository:
- Delete the command file (
commands/implement-plan.md) - Commit and push changes to remote
- Delete the command file (
- Update the marketplace:
claude plugin marketplace update - Update the plugin through UI: Navigate to
/plugin→ Marketplaces → Select plugin → "Update now" - Restart Claude Code
- Check autocomplete for deleted command
Claude Model
Sonnet (default)
Is this a regression?
No, this never worked
Last Working Version
No response
Claude Code Version
v2.1.7
Platform
Anthropic API
Operating System
macOS
Terminal/Shell
VS Code integrated terminal
Additional Information
No response