macOS Storage Cleanup
Measure what occupies local storage, identify exact targets and effects, and
complete authorized cleanup. Stop with an itemized proposal for choices that
remain outside the user's request or delegated authority.
When invoked without a narrower scope, default to a read-only staged audit of the
startup volume and current user's data. Do not scan other users, request Full
Disk Access, run an intensive whole-filesystem traversal, or change anything.
Preserve the authority boundary
- Treat every audit and proposal as read-only. Moving an item to Trash, emptying
Trash, deleting a cache, pruning a store, uninstalling software, stopping a
process, changing a retention setting, removing a local cloud copy, deleting a
snapshot, or running a command that garbage-collects data is a state change.
- Use the current request and applicable earlier authority. “Remove JetBrains
caches” authorizes verified regenerable JetBrains caches, including resolving
exact product/version paths; it does not require a second user turn. Honor
explicit delegation to choose cleanup candidates within its stated limits.
- A broad “clean my Mac” or “free as much space as possible” leaves data-retention
choices unresolved. Inspect and propose those choices before deleting. A clear
“remove them” can authorize previously identified targets; resolve ambiguous
referents from context or ask when materially different targets remain.
- Preserve scope: a JetBrains-only request does not authorize other categories.
Settings, plugins, Local History, user files, backups, container volumes, and
unrelated Trash contents are not implied by cache-cleanup authority. Verify
command flags and descendants stay within the authorized data effects.
- Recheck changed paths, symlinks, contents, processes, sync state, and command
behavior before mutation. Restore safe preconditions within existing authority;
ask again only when the changed target or effects exceed that authority. Never
transfer approval through an unexpected symlink.
- Work without elevation during discovery. Treat macOS privacy or permission
errors as not inspected; report them instead of bypassing them. Full Disk
Access or elevation is a separate user decision, not a routine prerequisite.
- Never recursively delete
/System, /Library, /private, all of
~/Library, an application-support root, a package-manager home, a container
or virtual-machine disk, a Photos library package, a Git object database, or
an unknown directory merely because its name or measured size looks disposable.
- Stop cleanup when storage hardware reports a critical condition, the system is
unstable, an active security incident is suspected, or the proposed target is
the only verified backup. Preserve data and hand off to recovery, hardware,
security, or backup work.
Read references/cleanup-catalog.md during every
task before interpreting candidates, proposing actions, or executing cleanup.
It distinguishes supported inspection and cleanup surfaces, version-sensitive
commands, regeneration costs, sync effects, and protected data.
Establish a read-only baseline
- Record the user's goal, the exact requested roots or categories, current free
bytes on the startup volume, and what amount of headroom would count as success.
- Inspect the APFS/container layout and macOS Storage categories without adding
their figures together. APFS volumes share space, purgeable bytes and snapshots
complicate “available” space, and the Storage Documents category is not the
same thing as
~/Documents.
- Scan in stages. Start with the requested path or current user's top-level
directories, then inspect only material categories. Use allocated size where
available, stay on the intended filesystem, do not follow symlinks, and record
skipped or timed-out paths. Do not use
sudo to turn an access failure into a
broader scan.
- Resolve managed locations through the installed owning tool or app where
possible. Examples include npm, pnpm, Yarn, Bun,
uv, pip, Cargo, Go, Gradle,
Maven, Homebrew, Xcode, JetBrains IDEs, Playwright, Docker, Android tools,
cloud-sync providers, and virtual-machine managers. Re-check local help when
the catalog marks a command version-sensitive.
- Use only operations proven read-only during the baseline. A command named
verify, repair, clean, prune, gc, optimize, or free up space may
mutate data. If its behavior is unclear, inspect the resolved directory and
stop at a proposal.
- Identify the owning process, sync provider, backup role, and lifecycle of each
material candidate. Do not infer that an old file is unused, a cache is fully
regenerable, a stopped container has no valuable volume, or an archive is a
duplicate backup.
Rank measured opportunities
Rank candidates by reclaimable local bytes, confidence in ownership and
regeneration, user value, reversibility, operational cost, and risk. Keep these
classes separate:
- regenerable caches and downloaded toolchains;
- project build outputs and dependency trees;
- app-managed downloads, container data, simulators, and virtual machines;
- large user files, archives, media, and backups;
- cloud-synced local copies;
- macOS-managed data, logs, and snapshots.
Do not combine overlapping directory totals or present logical database size,
cloud size, purgeable space, and immediately reclaimable filesystem bytes as one
number. Label estimates and unknowns explicitly. Prefer a smaller, well-supported
action over a larger target with ambiguous ownership or recovery.
Preview the exact plan
Give every proposed action a stable row identifier and all of these fields:
| Field |
Required detail |
| Evidence |
Measured size, owning tool or app, and why the target is a candidate |
| Exact target |
Resolved path, app item, snapshot ID, container object, or setting |
| Exact operation |
Supported command or app action, including every material flag |
| Expected benefit |
Estimated reclaimable local bytes without double counting |
| Data effect |
What is deleted, retained, stopped, moved, or made online-only |
| Risk and recovery |
Reversibility, redownload/rebuild cost, backup, and sync scope |
| Preconditions |
App/process shutdown, completed sync, network, time, elevation, or restart |
Keep user files, Trash, synced data, backups, snapshots, archives, container
volumes, IDE Local History, Xcode archives, and project dependency trees as
separate rows. Show the exact resolved targets and operations before execution;
already-authorized rows may proceed in the same turn after verification. Ask
only about rows whose targets or effects are not covered by existing authority.
An unresolved row does not block independent authorized rows.
Apply authorized rows
- Immediately before each action, re-resolve the target without following an
unexpected symlink, remeasure it, verify its owner and filesystem, and check
required process, sync, backup, and free-space gates. Reassess authority on drift.
- Use the supported owning app or CLI with exactly the previewed flags. Prefer
the narrowest reversible mechanism. Never substitute a broad recursive
deletion because a supported cleanup action is unavailable or slow.
- Apply one row at a time. Capture the command or app result and remeasure free
space before starting another row. Stop that branch on an error or unexpected
effect; do not escalate to force flags, permissions changes, a wider target,
or permanent deletion beyond the authorized operation.
- Treat Trash as storage, not completion. Moving an exact item to Trash is one
authorized action; permanently emptying those exact items needs its own
applicable authority. Never empty unrelated Trash contents to realize an estimate.
- Preserve unsaved work before stopping or restarting an app or the Mac. Proceed
only when the interruption is covered by existing authority; otherwise ask
after showing its effect. Do not infer permission to schedule future cleanup
from a request to clean now.
Verify and finish
Repeat the relevant baseline and report actual free-space change separately from
the sum of item sizes. List completed rows, exact targets retained, measured
bytes reclaimed by category, rebuild or redownload consequences, Trash or
recovery artifacts, failures, skipped paths, permission gaps, and remaining risk.
The task is complete when either:
- the read-only audit and itemized proposal have been delivered with no state
change; or
- every authorized row has been applied and verified, with all unauthorized rows
and unrelated data unchanged.
Never claim cleanup succeeded solely because a command exited successfully.
1---2name: macos-storage-cleanup3description: Audit and safely reclaim local macOS storage through measured targets and authorized actions. Explicit invocation only; use when the user names $macos-storage-cleanup for low disk space, broad Storage categories, large files, application caches, developer package caches or build artifacts, containers, cloud-local files, device backups, or local snapshots. Do not use for Windows cleanup, Codex-owned task and database cleanup, disk repair, malware response, device reset, secure erasure, or blind deletion of System Data.4---56# macOS Storage Cleanup78Measure what occupies local storage, identify exact targets and effects, and9complete authorized cleanup. Stop with an itemized proposal for choices that10remain outside the user's request or delegated authority.1112When invoked without a narrower scope, default to a read-only staged audit of the13startup volume and current user's data. Do not scan other users, request Full14Disk Access, run an intensive whole-filesystem traversal, or change anything.1516## Preserve the authority boundary1718- Treat every audit and proposal as read-only. Moving an item to Trash, emptying19 Trash, deleting a cache, pruning a store, uninstalling software, stopping a20 process, changing a retention setting, removing a local cloud copy, deleting a21 snapshot, or running a command that garbage-collects data is a state change.22- Use the current request and applicable earlier authority. “Remove JetBrains23 caches” authorizes verified regenerable JetBrains caches, including resolving24 exact product/version paths; it does not require a second user turn. Honor25 explicit delegation to choose cleanup candidates within its stated limits.26- A broad “clean my Mac” or “free as much space as possible” leaves data-retention27 choices unresolved. Inspect and propose those choices before deleting. A clear28 “remove them” can authorize previously identified targets; resolve ambiguous29 referents from context or ask when materially different targets remain.30- Preserve scope: a JetBrains-only request does not authorize other categories.31 Settings, plugins, Local History, user files, backups, container volumes, and32 unrelated Trash contents are not implied by cache-cleanup authority. Verify33 command flags and descendants stay within the authorized data effects.34- Recheck changed paths, symlinks, contents, processes, sync state, and command35 behavior before mutation. Restore safe preconditions within existing authority;36 ask again only when the changed target or effects exceed that authority. Never37 transfer approval through an unexpected symlink.38- Work without elevation during discovery. Treat macOS privacy or permission39 errors as **not inspected**; report them instead of bypassing them. Full Disk40 Access or elevation is a separate user decision, not a routine prerequisite.41- Never recursively delete `/System`, `/Library`, `/private`, all of42 `~/Library`, an application-support root, a package-manager home, a container43 or virtual-machine disk, a Photos library package, a Git object database, or44 an unknown directory merely because its name or measured size looks disposable.45- Stop cleanup when storage hardware reports a critical condition, the system is46 unstable, an active security incident is suspected, or the proposed target is47 the only verified backup. Preserve data and hand off to recovery, hardware,48 security, or backup work.4950Read [references/cleanup-catalog.md](references/cleanup-catalog.md) during every51task before interpreting candidates, proposing actions, or executing cleanup.52It distinguishes supported inspection and cleanup surfaces, version-sensitive53commands, regeneration costs, sync effects, and protected data.5455## Establish a read-only baseline56571. Record the user's goal, the exact requested roots or categories, current free58 bytes on the startup volume, and what amount of headroom would count as success.592. Inspect the APFS/container layout and macOS Storage categories without adding60 their figures together. APFS volumes share space, purgeable bytes and snapshots61 complicate “available” space, and the Storage **Documents** category is not the62 same thing as `~/Documents`.633. Scan in stages. Start with the requested path or current user's top-level64 directories, then inspect only material categories. Use allocated size where65 available, stay on the intended filesystem, do not follow symlinks, and record66 skipped or timed-out paths. Do not use `sudo` to turn an access failure into a67 broader scan.684. Resolve managed locations through the installed owning tool or app where69 possible. Examples include npm, pnpm, Yarn, Bun, `uv`, pip, Cargo, Go, Gradle,70 Maven, Homebrew, Xcode, JetBrains IDEs, Playwright, Docker, Android tools,71 cloud-sync providers, and virtual-machine managers. Re-check local help when72 the catalog marks a command version-sensitive.735. Use only operations proven read-only during the baseline. A command named74 `verify`, `repair`, `clean`, `prune`, `gc`, `optimize`, or `free up space` may75 mutate data. If its behavior is unclear, inspect the resolved directory and76 stop at a proposal.776. Identify the owning process, sync provider, backup role, and lifecycle of each78 material candidate. Do not infer that an old file is unused, a cache is fully79 regenerable, a stopped container has no valuable volume, or an archive is a80 duplicate backup.8182## Rank measured opportunities8384Rank candidates by reclaimable local bytes, confidence in ownership and85regeneration, user value, reversibility, operational cost, and risk. Keep these86classes separate:8788- regenerable caches and downloaded toolchains;89- project build outputs and dependency trees;90- app-managed downloads, container data, simulators, and virtual machines;91- large user files, archives, media, and backups;92- cloud-synced local copies;93- macOS-managed data, logs, and snapshots.9495Do not combine overlapping directory totals or present logical database size,96cloud size, purgeable space, and immediately reclaimable filesystem bytes as one97number. Label estimates and unknowns explicitly. Prefer a smaller, well-supported98action over a larger target with ambiguous ownership or recovery.99100## Preview the exact plan101102Give every proposed action a stable row identifier and all of these fields:103104| Field | Required detail |105| --- | --- |106| Evidence | Measured size, owning tool or app, and why the target is a candidate |107| Exact target | Resolved path, app item, snapshot ID, container object, or setting |108| Exact operation | Supported command or app action, including every material flag |109| Expected benefit | Estimated reclaimable local bytes without double counting |110| Data effect | What is deleted, retained, stopped, moved, or made online-only |111| Risk and recovery | Reversibility, redownload/rebuild cost, backup, and sync scope |112| Preconditions | App/process shutdown, completed sync, network, time, elevation, or restart |113114Keep user files, Trash, synced data, backups, snapshots, archives, container115volumes, IDE Local History, Xcode archives, and project dependency trees as116separate rows. Show the exact resolved targets and operations before execution;117already-authorized rows may proceed in the same turn after verification. Ask118only about rows whose targets or effects are not covered by existing authority.119An unresolved row does not block independent authorized rows.120121## Apply authorized rows1221231. Immediately before each action, re-resolve the target without following an124 unexpected symlink, remeasure it, verify its owner and filesystem, and check125 required process, sync, backup, and free-space gates. Reassess authority on drift.1262. Use the supported owning app or CLI with exactly the previewed flags. Prefer127 the narrowest reversible mechanism. Never substitute a broad recursive128 deletion because a supported cleanup action is unavailable or slow.1293. Apply one row at a time. Capture the command or app result and remeasure free130 space before starting another row. Stop that branch on an error or unexpected131 effect; do not escalate to force flags, permissions changes, a wider target,132 or permanent deletion beyond the authorized operation.1334. Treat Trash as storage, not completion. Moving an exact item to Trash is one134 authorized action; permanently emptying those exact items needs its own135 applicable authority. Never empty unrelated Trash contents to realize an estimate.1365. Preserve unsaved work before stopping or restarting an app or the Mac. Proceed137 only when the interruption is covered by existing authority; otherwise ask138 after showing its effect. Do not infer permission to schedule future cleanup139 from a request to clean now.140141## Verify and finish142143Repeat the relevant baseline and report actual free-space change separately from144the sum of item sizes. List completed rows, exact targets retained, measured145bytes reclaimed by category, rebuild or redownload consequences, Trash or146recovery artifacts, failures, skipped paths, permission gaps, and remaining risk.147148The task is complete when either:149150- the read-only audit and itemized proposal have been delivered with no state151 change; or152- every authorized row has been applied and verified, with all unauthorized rows153 and unrelated data unchanged.154155Never claim cleanup succeeded solely because a command exited successfully.