Plugin cache accumulates orphaned `temp_git_*` clones after installs/updates
Summary
~/.claude/plugins/cache/ accumulates orphaned temp_git_<timestamp>_<hash> directories — one per plugin install/update — that are never cleaned up. This causes disk bloat and pollutes the skill listing with bogus entries.
Observed behavior
On my machine I found 7 orphaned temp_git_* directories in ~/.claude/plugins/cache/, created across 3 days (Apr 8–11, 2026), totaling ~10.5 MB. Each contains a full clone of the same plugin repository (in my case, superpowers), with identical skills/, .github/, tests/ subdirectories. They are independent of the authoritative installed plugin at ~/.claude/plugins/cache/claude-plugins-official/superpowers/5.0.7/ and are not referenced by installed_plugins.json.
Downstream effect on skill listing
Claude Code's skill discovery appears to walk into subdirectories of the orphaned clones and surface their contents as skills. This registers bogus entries in the session-start skill listing like:
.github:CONTRIBUTING.github:CODE_OF_CONDUCTexamples:tdd-examplesstream-chain:pipelinestream-chain:runtruth:startREADME
None of these are real skills — they're repo scaffolding inside the stale clones' .github/, examples/, tests/ subdirectories being treated as namespaced skills (<parent-dir>:<sub-dir>). They cost ~67 tokens in the session-start system prompt budget for no benefit, and their presence is confusing when inspecting /context or the skill list.
Reproduction
- Install or update a plugin (e.g.
/plugin install superpowers@claude-plugins-official) ls ~/.claude/plugins/cache/ | grep temp_git— observe a newtemp_git_<timestamp>_<hash>directory- Update the plugin again — another temp dir appears; the previous one remains
Environment
- macOS (darwin 25.4.0)
- Claude Code (current release as of 2026-04-11)
- Installed plugins: superpowers 5.0.7, feature-dev, github, frontend-design, code-review, code-simplifier, context7, greptile, typescript-lsp, claude-md-management, claude-mem (
installed_plugins.jsonversion 2)
Observed orphans (from my cache before cleanup)
temp_git_1775652472167_8bp378 Apr 8 14:47
temp_git_1775658669041_l8bzqo Apr 8 16:31
temp_git_1775716716563_cn1quj Apr 9 08:38
temp_git_1775718037372_c6moan Apr 9 09:00
temp_git_1775735352402_t9khma Apr 9 13:49
temp_git_1775743722165_ohz9jo Apr 9 16:58
temp_git_1775891622772_myn65x Apr 11 09:37
Each is ~1.5 MB. At 7 orphans in 3 days, the growth rate is meaningful for users who update plugins frequently.
Workaround
rm -rf ~/.claude/plugins/cache/temp_git_* — safe because the authoritative plugin install at ~/.claude/plugins/cache/<marketplace>/<plugin>/<version>/ is referenced by installed_plugins.json and is not affected.
Suggested fix
Whichever code creates temp_git_* during plugin install should clean it up on success — e.g. wrap the temp dir creation in a defer/finally cleanup, or use an OS-managed temp location with a self-cleaning lifecycle. As a belt-and-suspenders measure, a startup check could remove any temp_git_* whose creation time is more than ~1 minute old and which is not referenced by installed_plugins.json.
---
Filed via gh issue create from Claude Code itself, after a context-engineering cleanup pass surfaced the issue.
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗