disk-cleanup
Clean up local disk space
Recover space left behind by completed work while preserving source, user data and running work. Use existing filesystem, Git and cache-management tools; read targets.md for the target types involved.
Establish scope and measure
- Distinguish an inspection request from permission to delete. Asking what uses space or explicitly asking to hold deletion authorizes inspection only. A request to clean up authorizes the clearly disposable items within its scope; reuse that authority without repeatedly asking. Ask only when a useful next action crosses that scope, destroys valuable data or requires stopping another task.
- Start with
df -hon the requested location to identify the full filesystem and record available space. An artifact on another mount will not help that filesystem. Ask for a space target only if the next decision depends on it; otherwise prioritize a useful batch of cold, regenerable leftovers. - Follow the applicable host and repository resource rules, including any required current temperature readings and limits on local checks. Do not substitute a historical policy or invent a threshold. Carry applicable restrictions into any delegation.
- Begin with known artifact/cache locations, worktree registrations and task metadata. Query one selected location at a time; bound metadata walks by time and scope, avoid crossing mounts or following symlinks, and stop when sufficient evidence is available. Do not recursively scan the whole home, filesystem, repository contents or personal logs. Respect the one-file parsing/search limit; do not upload private local trees to CI to measure them. If a recursive size scan would exceed the permitted local work, use an existing size report or report the measurement limit.
Choose what to reclaim
For each candidate, identify its exact path, type, owning tool/task, known size, regeneration cost and evidence that it is no longer needed. Age, an old branch name and a directory called cache are hints, not proof. Mark unknown sizes as unknown; prefer allocated/reclaimable bytes over apparent size, and avoid counting shared layers or hard links twice.
Prefer completed-task build outputs, expired scratch outputs with known ownership and tool-managed unused cache entries. Preserve source, credentials, databases, user exports, session history, backups and unknown content. Separate them from disposable outputs even when they share a directory.
Before removing a Git worktree: