cleanup
Installation
SKILL.md
Cleanup
Extends pstack's Worktree and simulator cleanup playbook (this skill wins on differences). Always remove worktrees with git worktree remove --force, never rm -rf, git worktree prune, or git stash. scripts/scan.mjs makes every verdict deterministically.
Modes
/cleanup scan: classify and report without deleting./cleanup: remove theSAFEset in the current repository plusmachine.mjs --delete./cleanup all: run across all sibling checkouts (--repos <parent dir>) plusmachine.mjs --delete./cleanup disk: read-only space audit vianode <skill>/scripts/disk.mjs(run in background; scans home,/private/tmp, tmp,/Applications>=10 GB up to 5 levels, flagswrittenvsquiet). Never delete quiet rows automatically; run/cleanup scanon top worktree repos.
Supporting commands
scan.mjs --landed <worktree>: verifies the main checkout holds all changes and<plans>/artifacts/ignored files of a landed worktree before leaving it for cleanup.scan.mjs --remove <worktree>...: stops processes, saves unique state, and removes archived worktrees (skips locked, active, unresolved-merge, or unsafe paths).scan.mjs --drain [--interval-hours <n>]: non-blocking background drain (rate-limited, 1h default) removing only clean, landed, inactiveSAFEworktrees (triggered post-land byland.mjs).scan.mjs --brief --auto: optionalSessionStarthook; runs at most once/day in background removing onlySAFEitems (disable viaauto cleanup: offin~/.claude/pstack-models.md).machine.mjs [--delete]: clearsSAFEglobal caches (week-old Bun transpiler files, idle npx installs,uv cache prune, unused anonymous Docker volumes) and listsASKitems (pnpm store, named compose volumes).daily.mjs install: installs a 05:30 launchd job (dev.ustack.cleanup-daily) plus an hourly silent clean-landed drain (dev.ustack.cleanup-drain) across~/git(logs to~/Library/Logs/cleanup-daily/). Lock any pinned worktree withgit worktree lockso scheduled runs keep it.