---
name: multi-agent-clean-disk
description: "Free disk space with the disk cleaner: measure every category, pick what to delete, apply, report the space freed. Invoked only when the user types it."
user-invocable: true
argument-hint: "[autopilot]  -  dry-run first; nothing is deleted before you choose"
metadata:
  language: en
---

# multi-agent-clean-disk

`DC="$HOME/.copilot/scripts/disk-cleaner.mjs"`. Unattended means
`MULTI_AGENT_UNATTENDED=1` or `autopilot` in the arguments. The script never
stops a process.

1. Measure, deleting nothing: `node "$DC" --dry-run --json --top=5 --trash --transcripts`
   (unattended: `node "$DC" --dry-run --json --top=5 --unattended`).
2. Before asking anything, show per category its item count and size, its
   five largest items with real paths and sizes plus "and N more", and why
   items were kept or a category is blocked; then the total reclaimable,
   the free space now and the free space expected after. Add one line each
   when `held.aged` (items kept only for being touched recently, with
   `held.agedBytes`) or `unreadable.count` (folders it could not read) is
   above 0. Reclaimable 0 B: stop.
3. Unattended: `node "$DC" --apply --unattended`, then report. Never ask.
4. Attended, ask: all safe categories (the ones `--list` tags
   `unattended-safe`), choose categories, or none. Ask about the Trash on its
   own (it holds the user's files) and about old transcripts on their own
   (`/resume` and past-session search read them), each only when it measured
   above 0 B, each defaulting to keep. When `held.aged` is above 0, ask on
   its own whether to include the recently touched items, defaulting to
   keep. Nothing chosen changes nothing.
5. Skip list: every id from `node "$DC" --list` that was not chosen, without
   `trash` and `transcripts`. Run `node "$DC" --apply --skip="$SKIP"` plus
   `--trash` / `--transcripts` / `--include-recent` only when their own
   question chose them.
6. Report removed and failed counts, `freed` with df before and after, every
   `held` and `failed` line, and the report path. Never retry a refused path
   with `rm` or a loop of your own.
