cleanup

cleanup is a command for Claude Code from w2ur/claude-code-setup. It costs 28 tokens per session (2,721 once invoked), scanned A, original, MIT.

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 for Claude Code

Written for Claude Code: allowed-tools in frontmatter. Also seen: model in frontmatter; reads .claude/ paths; positional $N argument.

Needs its repository: it runs a file that does not travel with it, so clone the repository first. The line is cd ~/Dev/claude-code-setup && ./scripts/sync.py --dry-run.

Good fit Use it for disk hygiene, plan cleanup, plugin audits, or memory compaction, either individually or together.

Compare 6 commands from other repositories ↓
Install

Getting it into your agent

It runs from inside its repository, so the clone comes first — what it calls does not travel with the file alone.

Clone the repo
git clone --depth 1 https://github.com/w2ur/claude-code-setup
agentmods
npx agentmods add commands/w2ur/claude-code-setup/cleanup

Made for: Claude Code.

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 cleanup

README.md
[![agentmods](https://agentmods.dev/badge/commands/w2ur/claude-code-setup/cleanup/github.svg)](https://agentmods.dev/commands/w2ur/claude-code-setup/cleanup)
Your own site
<a href="https://agentmods.dev/commands/w2ur/claude-code-setup/cleanup"><img src="https://agentmods.dev/badge/commands/w2ur/claude-code-setup/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 cleanup

Your own site · 80×15
<a href="https://agentmods.dev/commands/w2ur/claude-code-setup/cleanup"><img src="https://agentmods.dev/badge/commands/w2ur/claude-code-setup/cleanup.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
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,721 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
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.00028 $0.02721
Opus 5.5 $0.00011 $0.01088
Sonnet 5.5 $0.00006 $0.00544
Haiku 4.5 $0.00003 $0.00272

Measured 21d ago against content hash c47a1880abdb, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, 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 21d 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 · 218 lines

How it starts

The opening of the file, as written. The whole thing — 218 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 are owner actions, surfaced verbatim with the script's reason field — for a marketplace with no enabled plugin, the run: claude plugin marketplace remove <name> (then delete) instruction. The # job-logs comment lines naming logs no plist writes are surfaced too; the script never touches those files, and neither does this command. Do NOT run claude plugin marketplace remove yourself — deregistering a marketplace is a decision for the owner, not something this command automates.

Read the full file on GitHub · 218 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. 21d ago Changed · +5 lines c47a1880abdb
  2. 1mo 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 3d ago), licensed MIT. It adds 28 tokens to every session and 2,721 once invoked, about $0.0001 per session on Opus 5.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.