cleanup

A housekeeping command for cleaning development-environment files, stale plans, plugin issues, and agent memory files. It can show proposed cleanup actions and apply the automatic part.

In plain words
What is it for?
Use it for disk hygiene, plan cleanup, plugin audits, or memory compaction, either individually or together.
Why use it?
It helps find accumulated temporary data and outdated planning or configuration files. It also separates automatic cleanup from items that require explicit confirmation.

Command

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.

agentmods
npx agentmods add commands/w2ur/claude-code-setup/cleanup
Clone the repo
git clone --depth 1 https://github.com/w2ur/claude-code-setup
Per session 28 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 2,503 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
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 $0.00028 $0.02503
Opus 5 $0.00014 $0.01252
Sonnet 5 $0.00006 $0.00501
Haiku 4.5 $0.00003 $0.00250

Measured 2d ago against content hash 4632f597f0f6, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

cleanup scanned grade A with 0 findings 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 2d ago.

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.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

commands/cleanup.md · 213 lines

How it starts

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

Run housekeeping tasks across the development environment.

Scope

  • If $0 is disk-only: run only Step 0 (disk hygiene).
  • If $0 is plans-only: run only the plans cleanup.
  • If $0 is plugins-only: run only the plugin audit.
  • If $0 is memory-only: run only the memory compaction.
  • If $0 is empty: run all steps.

Step 0 — Disk Hygiene

Run the deterministic disk-hygiene sweep. It is the source of truth for all retention numbers (AUTO tier days/keep-counts, CONFIRM tier rules) — do not restate those numbers here, they will drift out of sync with the script.

  1. Show the owner every action the sweep would take:

    ~/.claude/scripts/disk-hygiene.sh plan
    

    Present the grouped, per-category report as-is.

  2. Apply the AUTO tier without asking (it never touches anything outside the retention rules encoded in the script, and plans are archived, never deleted):

    ~/.claude/scripts/disk-hygiene.sh apply
    
  3. For the CONFIRM tier — stale projects/ transcript dirs and plugin temp/whitespace dirs reported by the plan run above — present the owner with the specific paths and their sizes (e.g. du -sh <path> for each) and ask for explicit confirmation. Only on an explicit yes, re-run with the corresponding flag(s):

    ~/.claude/scripts/disk-hygiene.sh apply --yes-projects
    ~/.claude/scripts/disk-hygiene.sh apply --yes-plugins
    

    (both flags can be combined in one apply call if the owner confirms both.)

  4. Any REPORT-verb lines (currently: marketplaces with no enabled plugin) are owner actions, surfaced verbatim with the run: claude plugin marketplace remove <name> (then delete) instruction from the script's reason field. Do NOT run claude plugin marketplace remove yourself — deregistering a marketplace is a decision for the owner, not something this command automates.

Step 1 — Plans Cleanup

Find and remove plan files that ended up inside project repos:

Read the full file on GitHub · 213 lines

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. 2d ago First seen · 213 lines · 28 tokens per session scan A 4632f597f0f6

Subscribe to this mod's changes

cleanup is a command published in the GitHub repository w2ur/claude-code-setup (2 stars, last pushed 9d ago), licensed MIT. It adds 28 tokens to every session and 2,503 once invoked, about $0.0001 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.