Skip to content
Projects

J2TEAM/claude-plugin-cache-prune

View on GitHub

About

Unofficial npkill-style cleaner for Claude Code's plugin cache: finds old duplicate plugin versions in ~/.claude/plugins/cache and deletes them safely. Single binary for macOS, Linux and Windows.

Developer Tools

How these counts are measured

Measured star growth

in 24h
0
in 7 days
Collecting history
in 15 days
Collecting history
in 1 month
Collecting history

Net star changes over overlapping periods, not daily totals. Missing measurements are left blank. Stars measure attention, not software quality.

README.md

Original

claude-plugin-cache-prune

claude-plugin-cache-prune: clean up old Claude Code plugin versions

Unofficial, community-made tool. Not affiliated with or endorsed by Anthropic.

Website: prune.j2team.org (Tiếng Việt)

npkill-style pruner for ~/.claude/plugins/cache. Claude Code keeps every plugin version it has ever installed side by side; this tool lists the duplicates and deletes the old ones. It also lists Claude Desktop's local Cowork VM bundle (vm_bundles, about 10–12 GB), which you can usually delete.

One self-contained binary (~3 MB) for macOS, Linux and Windows. Nothing else to install.

Not the same as Claude Code's built-in claude plugin prune, which removes auto-installed dependency plugins and leaves old cached versions in place.

What it looks like

Large plugins can take hundreds of MB per version, so a few months of updates add up to gigabytes. The interactive list (example data):

 Claude plugin cache prune  ~/.claude/plugins/cache
 Total 3.0 GB · reclaimable 2.6 GB · selected 12 (2.6 GB)
 ─────────────────────────────────────────────────────────────────────────────
 media-tools/video-studio  7 version(s)
     -  2.4.1           358.2 MB  installed · in use
  ❯ [x] 2.4.0           356.9 MB  old · orphaned 2d ago
    [x] 2.3.2           355.7 MB  old · orphaned 6d ago
    [x] 2.3.0           352.1 MB  old · orphaned 12d ago
    [x] 2.2.5           349.8 MB  old · orphaned 19d ago
    [x] 2.2.1           346.0 MB  old · orphaned 27d ago
    [x] 2.1.0           341.5 MB  old · orphaned 34d ago
 community/skill-pack  4 version(s)
     -  1.8.0            24.4 MB  installed · in use
    [x] 1.7.3            24.1 MB  old · orphaned 3d ago
    [x] 1.7.0            23.6 MB  old · orphaned 16d ago
    [x] 1.6.2            22.8 MB  old · orphaned 41d ago
 devtools/browser-mcp  3 version(s)
     -  3.2.0            15.9 MB  installed
    [x] 3.1.4            15.7 MB  old · orphaned 9d ago
    [x] 3.0.0            15.2 MB  old · orphaned 30d ago
 (temp) temp_subdir_1794812345678_qz7mnb.clone
    [x] —               349.6 MB  temp · leftover temp clone
 ─────────────────────────────────────────────────────────────────────────────
 ↑↓/jk move · space select · a select old · n none · enter/d delete · q quit

Install

macOS / Linux:

curl -fsSL https://raw.githubusercontent.com/J2TEAM/claude-plugin-cache-prune/main/install.sh | sh

Homebrew (macOS / Linux):

brew install j2team/tap/claude-plugin-cache-prune

Windows (PowerShell):

irm https://raw.githubusercontent.com/J2TEAM/claude-plugin-cache-prune/main/install.ps1 | iex

Both scripts pick the right binary for the CPU, verify its SHA-256 checksum and install it to ~/.local/bin (macOS/Linux) or %LOCALAPPDATA%\Programs\claude-plugin-cache-prune (Windows). If that folder is not on your PATH, they ask before adding it: on macOS/Linux to your shell's startup file (zsh: ~/.zshrc; bash: ~/.bashrc on Linux, and on macOS the first of ~/.bash_profile, ~/.bash_login, ~/.profile that exists; fish: config.fish; others: ~/.profile), on Windows to your user PATH. Set ADD_TO_PATH=yes or ADD_TO_PATH=no to answer in advance. With no terminal to ask on, PATH is left unchanged.

With Go installed: go install github.com/J2TEAM/claude-plugin-cache-prune@latest.

You can also download a binary from the Releases page directly.

Update

claude-plugin-cache-prune update          # download the latest release and replace this binary
claude-plugin-cache-prune update --check  # only report whether a newer version exists

update verifies the SHA-256 checksum before replacing the binary. If you installed with Homebrew, run brew upgrade claude-plugin-cache-prune instead (update and the update notice point you there). If you installed with go install, run go install github.com/J2TEAM/claude-plugin-cache-prune@latest instead. Versions up to v0.1.1 have no update command: re-run the install command once.

When run in a terminal, the tool checks GitHub for a newer release at most once a day and prints a notice after the command. That request carries only the tool's version in its User-Agent. It is skipped in CI, without a terminal (so cron jobs never make it), and when CLAUDE_PLUGIN_CACHE_PRUNE_NO_UPDATE_CHECK=1 or NO_UPDATE_NOTIFIER=1 is set.

Usage

claude-plugin-cache-prune              # interactive list
claude-plugin-cache-prune --dry-run    # print what would be deleted
claude-plugin-cache-prune --yes        # delete every suggested version, no prompt
claude-plugin-cache-prune update       # update to the latest release

Keys (interactive)

Key Action
↑ ↓ / j k, PgUp/PgDn, Home/End move
space select / unselect a version
a / n select all suggested / select none
enter / d delete selection (or the version under the cursor), asks y/N
q / esc quit

Old versions are pre-selected when the list opens.

Options

Flag
-l, --dry-run list only
-y, --yes delete suggested versions without asking
-u, --include-uninstalled also suggest the last version of plugins no longer in installed_plugins.json
-m, --include-vm also suggest Claude Desktop's local Cowork VM bundle (details)
-f, --force allow deleting versions held by a running Claude Code session, or a running VM's bundle
-d, --dir <path> cache dir (default $CLAUDE_CONFIG_DIR or ~/.claude, + /plugins/cache)
--json print the scan as JSON
-v, --version print the version

Run it on a schedule

Plugins can update themselves, and every update leaves the previous version behind in the cache. To keep it clean, run the tool regularly or schedule it with --yes, which needs no terminal. It deletes only old versions and leftover temp clones; installed versions and versions held by a running Claude Code session are kept.

macOS / Linux (crontab -e), every Sunday at 03:00:

0 3 * * 0 $HOME/.local/bin/claude-plugin-cache-prune --yes

Windows (PowerShell):

$exe = "$env:LOCALAPPDATA\Programs\claude-plugin-cache-prune\claude-plugin-cache-prune.exe"
Register-ScheduledTask -TaskName claude-plugin-cache-prune -Action (New-ScheduledTaskAction -Execute $exe -Argument '--yes') -Trigger (New-ScheduledTaskTrigger -Weekly -DaysOfWeek Sunday -At 3am)

Adjust the path if you installed elsewhere (for example ~/go/bin with go install, or with Homebrew /opt/homebrew/bin on Apple Silicon, /usr/local/bin on Intel Macs, /home/linuxbrew/.linuxbrew/bin on Linux).

How it decides

The cache layout is cache/<marketplace>/<plugin>/<version>/.

Status Meaning Deletable
installed path listed in plugins/installed_plugins.json never
in use .in_use/<pid> lock from a live Claude Code process only with --force
old any other version of an installed plugin yes, suggested
not installed newest version of a plugin missing from installed_plugins.json yes, suggested with -u
temp leftover temp_* clone at the cache root yes if older than 1 hour
Desktop VM a bundle in Claude Desktop's vm_bundles yes, suggested with -m

Versions are ordered by semver (1.10.0 > 1.2.0), or by modification time for hash versions. Right before each delete the tool re-reads installed_plugins.json and the lock files, and refuses any path outside the cache. If installed_plugins.json can't be read, the newest version of every plugin is kept.

Sizes are disk usage in decimal units, as Finder shows them.

Claude Desktop VM bundle

Claude Desktop keeps a local virtual machine for Cowork in vm_bundles, usually one claudevm.bundle of about 10–12 GB (rootfs.img plus its compressed copy):

OS Folder the tool checks
macOS ~/Library/Application Support/Claude/vm_bundles
Windows %APPDATA%\Claude\vm_bundles
Linux $XDG_CONFIG_HOME/Claude/vm_bundles (default ~/.config/Claude/vm_bundles)

The macOS path is confirmed. The Windows and Linux paths follow Claude Desktop's data folder on those systems and have not been checked on a real install.

Why it is usually safe to delete:

  • Anthropic's help center says Cowork runs your tasks in the cloud, and that tasks started on your computer before October 6, 2026 were local sessions. New tasks do not need the local VM.
  • Users on the Claude Code issue tracker report deleting vm_bundles to reclaim the space, and Claude Desktop downloading the bundle again when a local session needs it (anthropics/claude-code#22543). Anthropic has not documented this itself.

What the tool does:

  • The bundle is listed but never selected by default, and --yes skips it. Select it in the list, or add -m / --include-vm.
  • A bundle with files open by a running process (the VM) is marked in use and protected, unless you pass --force. On macOS and Linux this uses lsof. Right before deleting, the tool renames the bundle to <name>.deleting in one step, so it is never left half deleted; on Windows that rename fails while the VM holds a file. Quit Claude Desktop first.
  • A bundle that contains sessiondata.img may hold work from local sessions, so -m does not pre-select it; you can still pick it by hand.
  • Only folders inside vm_bundles are deleted, never vm_bundles itself or anything else of Claude Desktop's.

If your organization still runs Cowork locally, keep the bundle: deleting it means a new download the next time a local session starts (the compressed image, rootfs.img.zst, was about 1.4 GB on one Mac in December 2026).

Development

Needs Go (version in go.mod).

go test ./...
go run . --dry-run
./scripts/build.sh          # cross-compile every target into dist/

Releasing: push a v* tag. .github/workflows/release.yml tests, builds and publishes the binaries and checksums.txt to a GitHub Release. It then writes Formula/claude-plugin-cache-prune.rb to the Homebrew tap with scripts/homebrew-formula.sh; that step needs a HOMEBREW_TAP_TOKEN secret (a fine-grained token with Contents read/write on the tap repo) and fails without it. Pre-release tags such as v1.2.3-rc1 skip the tap.

The website lives in site/ (Astro, deployed to Cloudflare Workers with the cf CLI): pnpm --dir site dev to work on it, pnpm --dir site run deploy to publish. The social preview images (site/public/og-*.png) are rendered from site/og/og.html with pnpm --dir site run og, which needs Google Chrome.

To install from a fork, set CLAUDE_PLUGIN_CACHE_PRUNE_REPO=owner/repo when running the install scripts; update and the update check read the same variable.

Explore related projects

Loading…