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.
git clone --depth 1 https://github.com/w2ur/claude-code-setupnpx agentmods add commands/w2ur/claude-code-setup/cleanupWrote 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.
[](https://agentmods.dev/commands/w2ur/claude-code-setup/cleanup)<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.
<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>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.
| Model | Per session | Once 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 |
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.
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
$0isdisk-only: run only Step 0 (disk hygiene). - If
$0isplans-only: run only the plans cleanup. - If
$0isplugins-only: run only the plugin audit. - If
$0ismemory-only: run only the memory compaction. - If
$0is 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.
-
Show the owner every action the sweep would take:
~/.claude/scripts/disk-hygiene.sh planPresent the grouped, per-category report as-is.
-
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 -
For the CONFIRM tier — stale
projects/transcript dirs and plugin temp/whitespace dirs reported by theplanrun 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
applycall if the owner confirms both.) -
Any
REPORT-verb lines are owner actions, surfaced verbatim with the script's reason field — for a marketplace with no enabled plugin, therun: claude plugin marketplace remove <name> (then delete)instruction. The# job-logscomment lines naming logs no plist writes are surfaced too; the script never touches those files, and neither does this command. Do NOT runclaude plugin marketplace removeyourself — deregistering a marketplace is a decision for the owner, not something this command automates.
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.
- 21d ago Changed · +5 lines c47a1880abdb
- 1mo ago First seen · 213 lines · 28 tokens per session scan A 4632f597f0f6
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.
Other commands, from other repositories
pull-learnings
Pulls shared organization patterns into local org-patterns.toon.
context-stats
Display context window usage and token statistics.
recall-loop
Periodic memory digest — designed for use with Claude Code's /loop scheduler. Shows recent memories and pending to-dos in a compact, scannable format.
sync
Session bootstrap - read project context, restore saved state, show status. Quick orientation with optional deep dive.
patterns
Scan recent sessions for recurring patterns and turn them into captures (rules, concept notes, writing seeds).
session-save
Save the current session state — decisions, modified files, current status, and next steps — to a handoff file for later resume.