/leftovers:leftoversfrom Leftovers
Scans disk usage, developer caches, stale git worktrees, and leftover processes, then deletes only what the user approves. Each item is re-checked before deletion.
Ships in Leftovers. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them; scripts run unread.
Clean up what apps and coding agents left behind, from inside Claude Code. Scripts are
python3 stdlib (macOS, Python 3.9+) plus git, du, df, ps, lsof, and gh if present.
The scans only read. Only clean.py --yes changes anything.
--force a worktree removal and never delete a branch. Never remove a worktree
with uncommitted changes, an open PR or a process working in it. clean.py checks all
of this again right before it acts.poetry env remove. Never touch ~/Library/Caches/pypoetry/virtualenvs or any
shared venv. Never remove Docker volumes.pg_ctl -D <dir> stop -m fast) before you delete its data
folder. Stop local servers before you delete their data.sudo and no rm -rf of your own. Every delete goes through clean.py.! command, such as ! npm cache clean --force
or ! go clean -cache or ! brew cleanup -s, then start the scan.Make one work folder and reuse its literal path in later commands:
mktemp -d -t leftovers # e.g. /var/folders/.../leftovers.Ab12 -> call it W
Run these in parallel. Each prints tables and saves JSON for the plan:
python3 "${CLAUDE_SKILL_DIR}/scripts/disk_scan.py" --save W/disk.json # ~20-90 s
python3 "${CLAUDE_SKILL_DIR}/scripts/worktree_scan.py" --save W/wt.json # ~20 s
python3 "${CLAUDE_SKILL_DIR}/scripts/procs_scan.py" --save W/procs.json # ~1 s; when asked about memory or slowness
disk_scan.py also prints where all the used space goes, by owner: you (home folder +
your temp area), each other account (or "private" when it can't be read), apps, shared
folders, macOS volumes, and what is left unread. On a shared Mac, say plainly that the
"private accounts" / "can't read" line belongs to other people and only an admin can
measure it (sudo du -sxh /Users/*, which the user runs themselves).
Useful flags:
disk_scan.py --budget 30: a shorter home-folder overview. --no-top skips it.worktree_scan.py --repo DIR or --root DIR: limit the scan to one repo or folder.
--no-size is faster. --no-gh checks with git only.What the groups mean:
| Group | Worktrees | Disk items | Processes |
|---|---|---|---|
| SAFE | PR merged, or the tip is on the default branch (merged or squash-merged). Clean, no open PR, nothing running in it, quiet for 2+ hours. | A cache that rebuilds itself, with nothing using it. Claude temp folders idle 3+ days. Old Chrome self-copies (chrome-clones:old, newest kept). | An orphaned dev process idle 12+ hours, or one whose folder was deleted. |
| REVIEW | PR closed without merging, no PR and not on main, untracked files only, or changed in the last 2 hours. | Costly to get back: Hugging Face models, Xcode archives, Trash, app caches, Docker images or containers. | Orphaned recently or still busy. Test Postgres clusters. |
| KEEP | Uncommitted changes, open PR, a process inside, locked, the main checkout, your current folder, or PR state unreadable. | In use, macOS-owned, Docker volumes, Ollama or LM Studio models, Time Machine snapshots. | Everything else. |
Show each scan's tables grouped as SAFE, REVIEW and KEEP, with sizes and totals. Say which tables are biggest. Then ask with AskUserQuestion, two questions in one call:
Never put KEEP items in the options.
python3 "${CLAUDE_SKILL_DIR}/scripts/make_plan.py" --scan W/disk.json --scan W/wt.json \
--safe [--kinds wt,cache,claude-tmp] [--review ID ...] [--exclude ID ...] -o W/plan.json
python3 "${CLAUDE_SKILL_DIR}/scripts/clean.py" --plan W/plan.json # dry run: changes nothing
python3 "${CLAUDE_SKILL_DIR}/scripts/clean.py" --plan W/plan.json --yes # only after the yes
--scan W/procs.json only if the user approved processes. A process gets SIGTERM
only, and only the exact PID that was in the plan.make_plan.py never writes KEEP items. A REVIEW item gets in only by --review ID or
--review-all.--yes with
run_in_background, send stderr (progress lines [i/n] id: ...) to W/progress.log,
and tell the user it is running.From clean.py's output, give a short table: item, freed, result (done, refused: why,
or git kept it). Then one line: Free: <before> -> <after> (+<delta>).
Then mention:
Delete the work folder W when done.
~/Library/Caches, a
Claude session folder under /private/tmp/claude-<uid>/, or an old Chrome copy in your
own temp area.git worktree remove --force.docker volume prune.poetry env remove.scripts/catalog.py (opens in a new tab)scripts/chrome_clones.py (opens in a new tab)scripts/clean.py (opens in a new tab)scripts/clean_actions.py (opens in a new tab)scripts/clean_worktrees.py (opens in a new tab)scripts/common.py (opens in a new tab)scripts/disk_extras.py (opens in a new tab)scripts/disk_scan.py (opens in a new tab)scripts/fsops.py (opens in a new tab)scripts/git_facts.py (opens in a new tab)scripts/make_plan.py (opens in a new tab)scripts/pr_state.py (opens in a new tab)scripts/proc_rules.py (opens in a new tab)scripts/proc_table.py (opens in a new tab)scripts/procs_scan.py (opens in a new tab)scripts/system_scan.py (opens in a new tab)scripts/topdirs.py (opens in a new tab)scripts/worktree_inspect.py (opens in a new tab)scripts/worktree_judge.py (opens in a new tab)scripts/worktree_scan.py (opens in a new tab)What SKILL.md sets; muted values are Claude Code's defaults
Use on "/leftovers", "leftovers", "disk full", "disk is almost full", "out of space", "free up space", "clean up stale worktrees", "remove old worktrees", "what's eating my disk", "where did my disk space go", or when a command fails with "No space left on device".
Three short reads, in order
npx claudepluginhub arpwal/leftovers --plugin leftoversOther plugins' skills for the same job