claude-code - 💡(How to fix) Fix Feature request: plugin cache garbage collection (claude plugin gc) [1 comments, 2 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
anthropics/claude-code#47966Fetched 2026-04-15 06:37:14
View on GitHub
Comments
1
Participants
2
Timeline
3
Reactions
0
Timeline (top)
labeled ×2commented ×1

Code Example

Orphaned versions:     7 directories (~1.6MB)
Temp git artifacts:   35 directories (~50MB)
Active plugin cache:  16 versions

---

$ claude plugin gc
Scanning plugin cache...

Orphaned versions:     7 (1.6 MB)
Temp clone artifacts: 35 (50.2 MB)
Total reclaimable:    51.8 MB

Remove all? [y/N]
RAW_BUFFERClick to expand / collapse

Problem

The plugin cache at ~/.claude/plugins/cache/ accumulates stale artifacts over time with no cleanup mechanism:

  1. Orphaned plugin versions — When claude plugin update installs a new version, it drops a .orphaned_at marker in the old version directory but never deletes it. Over multiple updates, these accumulate.

  2. Temp clone directoriestemp_git_* directories are created during plugin add / plugin update git clone operations but are never cleaned up. In my setup, 35 of these accumulated totaling ~50MB.

  3. Disabled plugin caches — Disabled plugins retain their full cache. No option to reclaim space.

Current state (real example)

Orphaned versions:     7 directories (~1.6MB)
Temp git artifacts:   35 directories (~50MB)
Active plugin cache:  16 versions

Proposed solution

claude plugin gc

$ claude plugin gc
Scanning plugin cache...

Orphaned versions:     7 (1.6 MB)
Temp clone artifacts: 35 (50.2 MB)
Total reclaimable:    51.8 MB

Remove all? [y/N]

Options:

  • --dry-run — show what would be removed
  • --force — skip confirmation
  • --keep-last N — retain N previous versions for rollback (default: 0)

Auto-cleanup on update

When claude plugin update succeeds, automatically remove the previous version's cache directory (or at least the temp_git_* used for the clone).

Bulk update

Also useful: claude plugin update --all to update all installed plugins in one command, rather than requiring per-plugin invocations.

extent analysis

TL;DR

Implement a garbage collection mechanism, such as the proposed claude plugin gc command, to remove stale artifacts and reclaim disk space.

Guidance

  • Introduce a claude plugin gc command with options like --dry-run, --force, and --keep-last N to manage the removal of orphaned plugin versions and temp clone directories.
  • Consider implementing auto-cleanup on update, where claude plugin update automatically removes the previous version's cache directory after a successful update.
  • Add a --all option to claude plugin update to enable bulk updates of all installed plugins.
  • Evaluate the proposed solution's effectiveness in reclaiming disk space and reducing the accumulation of stale artifacts.

Example

$ claude plugin gc --dry-run
Scanning plugin cache...

Orphaned versions:     7 (1.6 MB)
Temp clone artifacts: 35 (50.2 MB)
Total reclaimable:    51.8 MB

Notes

The proposed solution focuses on manual garbage collection, but automating the process or integrating it with the claude plugin update command could provide a more seamless experience.

Recommendation

Apply the proposed claude plugin gc command as a workaround to manage stale artifacts and reclaim disk space, as it provides a flexible and controlled approach to garbage collection.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

claude-code - 💡(How to fix) Fix Feature request: plugin cache garbage collection (claude plugin gc) [1 comments, 2 participants]