agentleFS
hosaypenghosaypeng/claude-skills/clean-caches/SKILL.md

clean-caches

Skill0 starsChanged 9 days agoMITView on GitHub

Report and clear regenerable app caches (browser caches, Homebrew, Zoom, Google Drive logs, the Claude desktop Cowork VM image) with the clean_caches command. Use when user says 'clean caches', 'clear cache', 'check for cache buildup', 'free up disk space', 'what's taking up space', or 'cache audit'.

1 other project uses a version of this.

Adopted by

Most recently taken up by

  • Other versions1 project uses a version of this.

    Word for word · 0

    None found.

    Edited · 0

    None found.

    Wrote their own version · 1

    1. usrrname/agent-skills★ 0same name

    How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.

  • In this repository7 other files it gives its agents.

The file

We split this skill into the rules it gives an agent

7 rules. About 0 are common, 4 are distinctive, and 3 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈4

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 3

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Never call app data, models, chat stores, or an installed app's runtime "cache".

    line 24
  2. Distinctive:

    Check memory for known keep-lists before flagging anything.

    line 25
  3. Distinctive:

    If the disk is under ~80% full, say nothing is urgent.

    line 32
  4. Distinctive:

    If an item is skipped because its app is running, ask the user to quit that app, then re-run.

    line 35
  5. Very specific:

    Never run clean_caches run yourself, never rm cache paths, and never run uv cache clean --force.

    line 42
  6. Very specific:

    Never clear in-app items. Give the user the in-app path instead.

    line 44
  7. Very specific:

    clean_caches: command not found: run install.sh in the recovery repo.

    line 55

≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Clean Caches

/clean-caches wraps the clean_caches command (~/.local/bin/clean_caches, symlinked from the private recovery repo's bin/). The command owns the target list and every safety check; this skill only runs it, looks for new buildup, and interprets the output.

Steps

  1. Report (read-only): ~/.local/bin/clean_caches. Each known target gets a size and a status:

    • ready
    • ready (quits Drive, relaunches it)
    • skip: quit <App> first
    • skip: no rootfs.img.zst to rebuild from
    • opt-in: run --cowork
    • in-app: <where to clear it>

    Items under 10M are left out.

  2. Scan for new buildup (read-only): ~/.local/bin/clean_caches scan lists the top dirs in ~/Library/Caches, ~/.cache, ~/Library/Application Support and ~/Library/Containers. Flag anything ≥ 500M that the report doesn't cover, and classify it as regenerable cache, app data or models.
    • Never call app data, models, chat stores, or an installed app's runtime "cache".
    • Check memory for known keep-lists before flagging anything.
  3. Present:

    • free space
    • the ready total
    • each skipped item with its reason
    • numbered decisions for the user

    If the disk is under ~80% full, say nothing is urgent.

  4. Hand the user the clear command; never run it yourself. Claude Code never deletes files, caches included. Give the user ! ~/.local/bin/clean_caches run -y to paste, so the output lands in the conversation. Add --cowork only if the user asked for the Cowork VM image.
    • Without -y the command refuses to run outside a terminal, and ! doesn't count as one.
    • If an item is skipped because its app is running, ask the user to quit that app, then re-run. Never quit or kill apps yourself. The command itself quits and relaunches Google Drive.
  5. Report, from the output the user pasted:
    • the freed line, which is measured with df and is the real number. If other disk activity outweighed the gain, the line reads no net gain measured instead.
    • any skipped: …, refused: … or failed: … lines, verbatim. If Drive didn't quit, it is relaunched anyway when the command exits.

Rules

  • Never run clean_caches run yourself, never rm cache paths, and never run uv cache clean --force. Deleting is the user's step.
  • A new target goes into the command, never into an ad-hoc command. That means three changes: add it to collect_items, add its basename to the safe_target allowlist, and add a fake-HOME test case.
  • Never clear in-app items. Give the user the in-app path instead.

Notes

  • uv: uninstalled, so the command skips its row. If uv comes back, its cache is locked while any session runs uvx MCP servers: clear it from a plain terminal after quitting them.
  • Cowork VM image: the app rebuilds it from rootfs.img.zst the next time Cowork runs, so the space comes back.
  • Regrowth: browser caches regrow within days, so the gain is temporary.
  • Sizes: they are upper bounds (APFS clones share blocks), so the freed line is usually smaller than the ready total.

Troubleshooting

  • clean_caches: command not found: run install.sh in the recovery repo. Alternatively, ln -s ~/Code/mac-config/bin/clean_caches ~/.local/bin/clean_caches.
  • Homebrew failed: followed by a sudo chown hint (a root-owned keg): the user runs ! sudo chown -R $USER <keg path>, then re-runs the command.
  • An item that always shows skip: quit <App> first: the app is still running in the background. Ask the user to quit it fully (⌘Q, or from its menu-bar icon).

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.