ain3sh/.agents/disk-cleanup
Claude Code and agent skill by ain3sh/.agents
- community
Checking that the SKILL.md file is still in the repository.
Reclaim Linux home and /tmp disk space with bounded, repeatable cleanup scripts. Use when disks fill, /tmp balloons, caches/toolchains/containers accumulate, or cleanup must preserve Factory sessions, models, source data, and active temp files.
Install
npx vskill@latest install ain3sh/.agents/disk-cleanupSKILL.md
The same SKILL.md was published earlier as ain3sh/.agents/disk-cleanup.
Disk Cleanup
Treat cleanup as a bounded transaction: snapshot protected state, delete only named regenerable classes, then prove protected entries survived.
Act
Set the skill path once:
| Goal | Command | |
|---|---|---|
| Capture baseline; stop if a protected path is missing | python3 "$DISK_CLEANUP/snapshot.py" "${PROTECT[@]}" --hash-protected --output "$SNAPSHOT" | |
Preview /tmp; retain patches, evidence, and active fixtures explicitly | python3 "$DISK_CLEANUP/clean_tmp.py" "${PROTECT[@]}" --verbose | |
Purge eligible /tmp entries after reviewing the preview | python3 "$DISK_CLEANUP/clean_tmp.py" "${PROTECT[@]}" --apply | |
| Preview aggressive home cleanup without deleting Docker data | python3 "$DISK_CLEANUP/clean_home.py" "${PROTECT[@]}" --no-prune-docker | |
| Apply the reviewed home cleanup | python3 "$DISK_CLEANUP/clean_home.py" "${PROTECT[@]}" --no-prune-docker --apply | |
| Opt down to caches only | Add --profile caches; this skips installed toolchains, extensions, Docker, and the pnpm store | |
| Delete reviewed exact generated directories | python3 "$DISK_CLEANUP/clean_home.py" "${PROTECT[@]}" --no-prune-docker --generated /absolute/project/node_modules --generated /absolute/project/target --apply | |
| Inspect Btrfs pressure | btrfs filesystem usage "$HOME"; follow references/btrfs.md | |
| Verify disk and protected state | python3 "$DISK_CLEANUP/snapshot.py" --compare "$SNAPSHOT" |
Populate PROTECT before deletion; both cleaners accept repeated --protect. Do not copy stale model paths from previous runs. Resolve missing paths using references/safety.md. Docker pruning requires a separate scope decision.
Detect
Use this skill when either filesystem is under pressure. Target the filesystem that is full: cleaning a separate tmpfs cannot free home/Btrfs space. Use the aggressive profile unless the user asks for caches only; escalate to bulk, approved regenerable targets after one measured pass (references/targets.md).
Rules
- Never run recursive
du,find, orlsof +Dover a large home/repository tree -- they can stall for minutes and still do no cleanup. - Never delete or prune
~/.factory/sessionsor the dsx cache (~/.cache/dsx, includingXDG_CACHE_HOME,DSX_CACHE_DIR, andDSX_DB_PATHoverrides). The home cleaner excludes protected cache children and hard-blocks overlapping targets; the temporary cleaner retains roots containing configured dsx cache/index paths. - Never infer safety from a filename or apparent size -- pass irreplaceable paths through
--protect, and stop when a required path is missing. - Never sweep project trees for
node_modules,target, or build output -- pass each exact generated directory with--generated. - Never claim success from deletion output -- compare the snapshot and report
dfbefore/after. - Never race another cleanup owner -- stop your cleaners when the user takes over; wait for removal to finish before measuring or balancing.
Failure map
| Symptom | Action | |||
|---|---|---|---|---|
| Protected path is missing before cleanup | Stop; check likely locations and prior explicit removal/move decisions. Read references/safety.md. | |||
| Scan runs longer than seconds | Cancel it; use the scripts' bounded targets. | |||
/tmp deletion reports permission errors | Leave foreign/system entries; rerun as the owning user, not with broad sudo rm. | |||
/tmp remains full | Inspect only the remaining direct children: `du -x -h --max-depth=1 /tmp 2>/dev/null \ | sort -h \ | tail -40`. | |
| Home remains full after aggressive cleanup | Inspect one known top-level directory at a time; read references/targets.md. | |||
| Btrfs balance relocates zero chunks or fails with ENOSPC | Follow references/btrfs.md; do not retry thresholds blindly. | |||
| Snapshot comparison reports missing sessions or changed protected files | Stop all cleanup and preserve the filesystem for recovery. |
References
Load on demand; do not reabsorb into this file.
references/safety.md-- protection invariants, active/tmpdetection, Btrfs/reflink caveats, and failed approaches.references/targets.md-- exact cache/aggressive target classes, toolchain rules, extension retention, Docker behavior, and generated-path grammar.references/btrfs.md-- allocation diagnosis, bounded data balancing, ENOSPC recovery, and stopping criteria.
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/disk-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/ain3sh/.agents/disk-cleanup)