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 the SAFE set in the current repository plus machine.mjs --delete.
  • /cleanup all: run across all sibling checkouts (--repos <parent dir>) plus machine.mjs --delete.
  • /cleanup disk: read-only space audit via node <skill>/scripts/disk.mjs (run in background; scans home, /private/tmp, tmp, /Applications >=10 GB up to 5 levels, flags written vs quiet). Never delete quiet rows automatically; run /cleanup scan on 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, inactive SAFE worktrees (triggered post-land by land.mjs).
  • scan.mjs --brief --auto: optional SessionStart hook; runs at most once/day in background removing only SAFE items (disable via auto cleanup: off in ~/.claude/pstack-models.md).
  • machine.mjs [--delete]: clears SAFE global caches (week-old Bun transpiler files, idle npx installs, uv cache prune, unused anonymous Docker volumes) and lists ASK items (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 with git worktree lock so scheduled runs keep it.
Installs
52
Repository
udecode/ustack
GitHub Stars
1.2K
First Seen
Oct 16, 2026