ain3sh/.agents/disk-cleanup

Claude Code and agent skill by ain3sh/.agents

Trust tier 3
  • community
Source check pending

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-cleanup

SKILL.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:

bash
DISK_CLEANUP="$HOME/.agents/skills/disk-cleanup/scripts"
SNAPSHOT="$HOME/.local/state/disk-cleanup/before.json"
PROTECT=() # Populate with --protect /absolute/path for actual models and active fixtures.
GoalCommand
Capture baseline; stop if a protected path is missingpython3 "$DISK_CLEANUP/snapshot.py" "${PROTECT[@]}" --hash-protected --output "$SNAPSHOT"
Preview /tmp; retain patches, evidence, and active fixtures explicitlypython3 "$DISK_CLEANUP/clean_tmp.py" "${PROTECT[@]}" --verbose
Purge eligible /tmp entries after reviewing the previewpython3 "$DISK_CLEANUP/clean_tmp.py" "${PROTECT[@]}" --apply
Preview aggressive home cleanup without deleting Docker datapython3 "$DISK_CLEANUP/clean_home.py" "${PROTECT[@]}" --no-prune-docker
Apply the reviewed home cleanuppython3 "$DISK_CLEANUP/clean_home.py" "${PROTECT[@]}" --no-prune-docker --apply
Opt down to caches onlyAdd --profile caches; this skips installed toolchains, extensions, Docker, and the pnpm store
Delete reviewed exact generated directoriespython3 "$DISK_CLEANUP/clean_home.py" "${PROTECT[@]}" --no-prune-docker --generated /absolute/project/node_modules --generated /absolute/project/target --apply
Inspect Btrfs pressurebtrfs filesystem usage "$HOME"; follow references/btrfs.md
Verify disk and protected statepython3 "$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

bash
df -h "$HOME" /tmp

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

  1. Never run recursive du, find, or lsof +D over a large home/repository tree -- they can stall for minutes and still do no cleanup.
  2. Never delete or prune ~/.factory/sessions or the dsx cache (~/.cache/dsx, including XDG_CACHE_HOME, DSX_CACHE_DIR, and DSX_DB_PATH overrides). The home cleaner excludes protected cache children and hard-blocks overlapping targets; the temporary cleaner retains roots containing configured dsx cache/index paths.
  3. Never infer safety from a filename or apparent size -- pass irreplaceable paths through --protect, and stop when a required path is missing.
  4. Never sweep project trees for node_modules, target, or build output -- pass each exact generated directory with --generated.
  5. Never claim success from deletion output -- compare the snapshot and report df before/after.
  6. Never race another cleanup owner -- stop your cleaners when the user takes over; wait for removal to finish before measuring or balancing.

Failure map

SymptomAction
Protected path is missing before cleanupStop; check likely locations and prior explicit removal/move decisions. Read references/safety.md.
Scan runs longer than secondsCancel it; use the scripts' bounded targets.
/tmp deletion reports permission errorsLeave foreign/system entries; rerun as the owning user, not with broad sudo rm.
/tmp remains fullInspect only the remaining direct children: `du -x -h --max-depth=1 /tmp 2>/dev/null \sort -h \tail -40`.
Home remains full after aggressive cleanupInspect one known top-level directory at a time; read references/targets.md.
Btrfs balance relocates zero chunks or fails with ENOSPCFollow references/btrfs.md; do not retry thresholds blindly.
Snapshot comparison reports missing sessions or changed protected filesStop all cleanup and preserve the filesystem for recovery.

References

Load on demand; do not reabsorb into this file.

  • references/safety.md -- protection invariants, active /tmp detection, 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

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
vskill VERIFIED badge
[![vskill VERIFIED](https://verified-skill.com/api/v1/skills/ain3sh/.agents/disk-cleanup/badge)](https://verified-skill.com/skills/ain3sh/.agents/disk-cleanup)

Something wrong with this skill or its page? Tell us.