udecode/dotai/cleanup
Claude Code and agent skill by udecode/dotai
- community
Checking that the SKILL.md file is still in the repository.
Audit disk usage and remove idle git worktrees, Next.js caches, test Postgres DBs, and unused Bun/npx/uv/Docker caches while preserving active checkouts. Use for /cleanup, /cleanup disk, or freeing worktree/build disk space.
Install
npx vskill@latest install udecode/dotai/cleanupSKILL.md
The same SKILL.md was published earlier as udecode/dotai/cleanup.
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 --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 running cleanup across~/git(logs to~/Library/Logs/cleanup-daily/). Lock any pinned worktree withgit worktree lockso daily runs keep it.
Workflow (/cleanup, /cleanup scan, /cleanup all)
- Record
df -h <checkout>(macOSdf -h /shows the read-only system volume, not data). - If the runtime has a session-list tool, save all sessions (including archived) as a JSON array in the run directory. Without it, idle worktrees expire after one quiet day.
- Run
node <skill>/scripts/scan.mjs --repo . --sessions <file>(or--repos <dir>forall) in the background. Verdicts:
- Worktree `KEEP`: locked, T3-managed (
~/.t3/worktrees/), current worktree, active process/server, running/pinned session, or modified/transcript-written within 1 day (reads HEAD reflog, Claude project transcripts, Codex rollouts). - Worktree `SAFE`: agent-created location or
claude//codex//detached branch with noKEEPsignal. Before removal,--deletesaves unique state under<git-dir>/cleanup/<worktree>-<id>/(changes.patch,staged.patch,commits.bundle,ignored/,worktreemetadata), re-verifies no write occurred during save, removes viagit worktree remove --force, and expires week-old saves. Restore within a week viagit fetch <save>/commits.bundle 'refs/cleanup/*:refs/restored/*',git worktree add --detach,git apply, and copyingignored/. - Worktree `ASK`: outside agent folders, nested worktree/dirty submodule, unresolved merge, unreadable git history, >20k ignored files, or missing
.gitwith remaining files. - Caches:
.next/.next-plitebuild outputs stay; theirdev/cachesubdirs expire after 1 quiet day (maincheckout.next-<port>/devkept 7 days for Turbopack cache; worktree.next-*kept 1 hour, or 7 days ifBUILD_IDexists). Active server locks keep caches. - Run folders (`<plans>/artifacts/*`, `.tmp/*`):
KEEPif active/worktree/written within 1 day;SAFE stripremovesnode_modules/.next*/.turbo;SAFE expireremoves week-old unreferenced folders (after saving clone patches). Top-level files (ledger) are never touched. - Local Docker Postgres DBs:
KEEPif referenced by an env file, active connection, or written within 1 day;SAFEotherwise (dropped withoutFORCE).
- For
/cleanup scan, report the table and stop. Otherwise refresh the session list and runscan.mjs --deleteplusmachine.mjs --delete. - List every
ASKrow with path, size, reason, and session title. Only delete rows the owner explicitly names (git worktree remove --force <path>) and lock any they want kept (git worktree lock --reason "<why>" <path>). - Record
df -h <checkout>again and report actual space freed (duovercounts APFS clones), what was removed, and each kept/asked item.
Next telemetry note: If a KEEP row is held only by orphaned next/dist/telemetry/detached-flush.js (PPID 1), stop them, run next telemetry disable, and rescan.
Security
- Security scanPassed, 90 of 100Pattern checks on the skill's files.
- Model reviewPassed
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingskills/cleanup/SKILL.md
Popularity
- 7-day trend score
- 0
Not refreshed yet.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/udecode/dotai/cleanup)