disk-cleanup

disk-cleanup is a skill for Claude Code from glebis/claude-skills. It costs 153 tokens per session (1,830 once invoked), scanned B, original, MIT.

A macOS cleanup workflow that measures and removes selected caches, package-manager data, crash dumps, and application caches.

In plain words
What is it for?
Use it to survey cleanup candidates, preview a safe or full cleanup, or remove selected caches and related files.
Why use it?
It helps identify what is using disk space while keeping cleanup targets and deletion behavior explicit.

Skill for Claude Code

Written for Claude Code: shipped in a Claude Code plugin.

Part of the disk-cleanup plugin — 1 skill shipped together

Good fit Use it to survey cleanup candidates, preview a safe or full cleanup, or remove selected caches and related files.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/glebis/claude-skills/disk-cleanup
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add glebis/claude-skills --skill disk-cleanup
Clone the repo
git clone --depth 1 https://github.com/glebis/claude-skills

Made for: Claude Code.

Or install disk-cleanup, the plugin that ships this one along with the rest of its 1 skill.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for disk-cleanup

README.md
[![agentmods](https://agentmods.dev/badge/skills/glebis/claude-skills/disk-cleanup/github.svg)](https://agentmods.dev/skills/glebis/claude-skills/disk-cleanup)
Your own site
<a href="https://agentmods.dev/skills/glebis/claude-skills/disk-cleanup"><img src="https://agentmods.dev/badge/skills/glebis/claude-skills/disk-cleanup/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for disk-cleanup

Your own site · 80×15
<a href="https://agentmods.dev/skills/glebis/claude-skills/disk-cleanup"><img src="https://agentmods.dev/badge/skills/glebis/claude-skills/disk-cleanup.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 153 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,830 The whole file, excluding the scripts and references it only reads on demand.
Security scan B 1 finding. A grade says what 26 rules found in the file — not that it is safe. Third-party audits
  • NVIDIA SkillSpector warn 7 Sept 2026
SkillSpector: 1 finding, up to medium

These are SkillSpector’s own severities. On a checked sample its high-severity flags on skills were ~96% false positives — a documented command, a public API, a “never do X” rule — so we show them as a caution to read, not a verdict. Why →

  • medium Privilege Escalation · line 56
    Commands invoke sudo or root privileges. Verify this elevated access is necessary and justified.
    Fix: Avoid sudo/root unless strictly required. Prefer least-privilege patterns. If elevation is needed, document the justification and scope.
How audits are shown
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00153 $0.01830
Opus 5 $0.00077 $0.00915
Sonnet 5 $0.00031 $0.00366
Haiku 4.5 $0.00015 $0.00183

Measured 6d ago against content hash 55d04fe78a4e, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-10, from the pricing page.

Security

Grade B, and why

disk-cleanup scanned grade B with 1 finding against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 6d ago.

The scan reads SKILL.md. This mod also ships 4 executable files (scripts/clean.py, scripts/lib.py, scripts/survey.py, …), listed below but not scanned — reading those needs a real analyzer, not pattern matching.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Asks for rootmediumPrivilege escalation

A mod that escalates privileges can change anything on the machine, not only the project.

deletes, sudo for system caches) — never invoke it from the agent. **Never shell out to `mo`
skills/disk-cleanup/SKILL.md · 107 lines

How it starts

The opening of the file, as written. The whole thing — 107 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Disk Cleanup

Deterministic by design. All target knowledge lives in targets.json; all measuring and deleting lives in scripts/survey.py (read-only) and scripts/clean.py (executor, dry-run by default). They run headless with zero dependencies (stdlib only) — a user can run them in a terminal without any agent. The agent's job is small: run the scripts, relay the compressed output, and decide the handful of things that need human judgment.

The two scripts

python3 scripts/survey.py            # read-only: sizes, risk, flags, uncategorized. Touches nothing.
python3 scripts/survey.py --json     # same, machine-readable (preferred for the agent)

python3 scripts/clean.py --preset safe              # DRY-RUN plan (default — nothing deleted)
python3 scripts/clean.py --preset safe --go         # execute (safe risk only)
python3 scripts/clean.py --preset full --allow-medium --go --empty-trash   # safe+medium, then empty Trash
python3 scripts/clean.py --ids cargo-registry-cache,go-mod-cache --go       # specific targets
python3 scripts/clean.py --preset safe --skip ollama-models --go            # exclude one

trash is used for all file removal (never rm); freed space sits in Trash until emptied (--empty-trash, or the user empties it). Sizes are du estimates — approximate on APFS.

Safety model (enforced in code, not prose)

  • Risk gating: safe runs automatically; medium needs --allow-medium; never is refused even if named by id. advisory targets only print guidance, never execute.
  • Preflight on every trashed path: canonical realpath → must resolve under an allowed_roots entry → must not be a symlink → never $HOME or /. Anything failing is skipped and reported, not deleted.
  • Dry-run by default: clean.py prints the plan and touches nothing unless --go.

Agent workflow

  1. Run python3 scripts/survey.py --json. Relay the compressed summary: disk free, safe/medium recoverable totals, any flags (e.g. crash-loop), and the top targets. Do not dump the whole JSON.
  2. Auto-path: for a plain "clean up safe stuff", show the safe total and run clean.py --preset safe --go (offer --empty-trash). Safe targets are regenerable.
  3. Escalate to the user ONLY for (these are genuine judgment calls the scripts deliberately refuse to auto-decide):
    • medium targets (ML models, device support, project node_modules) — confirm before --allow-medium. ML-model targets (ollama-models, huggingface-models) carry a last_used_days field (newest file atime under the target, aggregate across all models in that store — not per-model) as a "how stale is this" signal; surface it before suggesting deletion.
    • uncategorized discoveries — unknown dirs >100 MB; ask or investigate before adding.
    • advisory notes — surface them (Telegram cache, simulators via simctl, uv/tools, Chrome whole-dir, Xcode Archives, mo clean deep-clean); never act on them automatically. For mole-deep-clean: suggest the user run mo clean themselves (interactive TUI, permanent deletes, sudo for system caches) — never invoke it from the agent. Never shell out to mo at all (not even --dry-run): it's TUI-only and blocks waiting for a real terminal even in dry-run mode — confirmed hanging under a piped subprocess, stdin=DEVNULL, and even a script(1)-allocated pty. A mole flag in survey.py's output only reads the mtime of mole's own leftover ~/.config/mole/clean-list.txt (last-run recency), never invokes it.
    • surgical Docker / simulator decisions (see below).
  4. Run clean.py with the resolved selection. Relay the result (freed_human, disk before→after).

Read the full file on GitHub · 107 lines

Files

What ships with it

9 files beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 6d ago First seen · 107 lines · 0 tokens per session scan B 55d04fe78a4e

Subscribe to this mod's changes

disk-cleanup is a skill published in the GitHub repository glebis/claude-skills (374 stars, last pushed 8d ago), licensed MIT. It adds 153 tokens to every session and 1,830 once invoked, about $0.0008 per session on Opus 5. A static security scan graded it B with 1 finding (asks for root). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-09-03.