Clean up old Claude Code plugin versions
Claude Code keeps every plugin version it has ever installed, side by side. claude-plugin-cache-prune lists the old ones and deletes the ones you pick, like npkill for your plugin cache.
The problem
Old versions pile up quietly
Every plugin update lands in a new folder under cache/<marketplace>/<plugin>/<version>/, and the previous one stays where it is. Claude Code has no command that collects them, and some plugins weigh hundreds of megabytes per version.
The built-in claude plugin prune does something else: it removes plugins that were installed automatically as dependencies, and leaves old cached versions in place.
One report on the Claude Code issue tracker measured 4.77 GB of cached plugins. Read the issue
Features
Careful about what it deletes
Never touches what you use
The version listed in installed_plugins.json is never offered for deletion.
Knows what is running
A version locked by a live Claude Code process (.in_use/<pid>) is protected unless you pass --force.
Orders versions correctly
Semver ordering, so 1.10.0 is newer than 1.2.0. Hash versions fall back to modification time.
Checks again before each delete
Right before removing a folder it re-reads the install list and the lock files, and refuses any path outside the cache.
Interactive or scripted
A keyboard-driven list like npkill, or --dry-run, --yes and --json for scripts.
One file, nothing else to install
A static binary per platform. The installer checks its SHA-256 checksum and asks before it edits your PATH.
How it decides
Every version gets a status
The cache layout is cache/<marketplace>/<plugin>/<version>/. Each version folder is classified before anything is suggested.
| Status | Meaning | Deleted |
|---|---|---|
| installed | Path listed in plugins/installed_plugins.json | Never |
| in use | Locked by a live Claude Code process | Only with --force |
| old | Any other version of an installed plugin | Yes, selected by default |
| not installed | Newest version of a plugin you removed | With -u |
| temp | Leftover temp_* clone at the cache root | If older than 1 hour |
If installed_plugins.json cannot be read, the newest version of every plugin is kept.
Install
One command to install
curl -fsSL https://raw.githubusercontent.com/J2TEAM/claude-plugin-cache-prune/main/install.sh | shPicks the binary for your CPU, verifies its checksum and installs it to ~/.local/bin. If that folder is not on your PATH, it asks before adding it to your shell startup file. Set ADD_TO_PATH=yes or ADD_TO_PATH=no to answer in advance.
irm https://raw.githubusercontent.com/J2TEAM/claude-plugin-cache-prune/main/install.ps1 | iexRun it in PowerShell. Installs to %LOCALAPPDATA%\Programs\claude-plugin-cache-prune, verifies the checksum and asks before adding that folder to your user PATH.
go install github.com/J2TEAM/claude-plugin-cache-prune@latestNeeds Go. The binary goes to your Go bin folder, usually ~/go/bin.
Usage
Open the list, pick, delete
Options
-l, --dry-run- List only, delete nothing
-y, --yes- Delete suggested versions without asking
-u, --include-uninstalled- Also suggest the last version of plugins you removed
-f, --force- Allow deleting versions a running session holds
-d, --dir <path>- Use another cache folder
--json- Print the scan as JSON
Keys in the interactive list
- ↑↓jk
- Move
- PgUpPgDnHomeEnd
- Jump
- space
- Select or unselect a version
- an
- Select all suggested, or none
- enterd
- Delete the selection, after a y/N prompt
- qesc
- Quit
Old versions are selected when the list opens.
Is this the same as claude plugin prune?
No. That built-in command removes plugins that were installed automatically as dependencies. It leaves old cached versions in place, and those are what this tool cleans.
Can I run it while Claude Code is open?
Yes. A version an open session is using is marked in use and cannot be selected. Use --force only if you know no session needs it any more.
Does it send any data?
No. The tool reads and deletes folders in your plugin cache and makes no network requests. Only the install script downloads, from GitHub Releases.
Where does it look?
In $CLAUDE_CONFIG_DIR/plugins/cache, or ~/.claude/plugins/cache when that variable is not set. Pass --dir to point it somewhere else.
Is it made by Anthropic?
No. It is an unofficial, community-made tool and is not affiliated with or endorsed by Anthropic.
Start with a dry run
--dry-run lists what would be deleted and touches nothing. The interactive list also asks y/N before every delete.
claude-plugin-cache-prune --dry-run