cleanup

A repository-cleanup procedure for releasing all finished, unshipped work on the main branch as separate patch releases, then leaving the repository clean.

In plain words
What is it for?
Use it when preparing a repository for release: inspect worktrees and history, inventory unshipped changes, create separate changelog sections and tags, return to main, and remove leftover uncommitted changes unless explicitly kept.
Why use it?
It provides checks for unfinished work or other active sessions before publishing changes, reducing the risk of releasing someone else’s incomplete work.

Command for Claude Code

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/michellzappa/headroom/cleanup
Clone the repo
git clone --depth 1 https://github.com/michellzappa/headroom

Made for: Claude Code.

Per session 19 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,062 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.00019 $0.02062
Opus 5 $0.00010 $0.01031
Sonnet 5 $0.00004 $0.00412
Haiku 4.5 $0.00002 $0.00206

Measured 2d ago against content hash fdcc9686e262, 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.

.claude/commands/cleanup.md · 165 lines

How it starts

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

Cleanup: get back to a clean main

Run this in a fresh session when nobody else is working in the repo. It takes whatever state things are in — feature branches, uncommitted work from several sessions, commits sitting unshipped on main — and leaves:

  • every finished set released from main as its own patch version, each with its own CHANGELOG section and its own tag
  • nothing dirty except work you were explicitly told to leave
  • a checkout sitting on main, which is where work happens here

Read AGENTS.md first. It governs everything below, and where the two disagree, AGENTS.md wins.

0. Check nobody else is live

git worktree list, git status, and git log --all -20 --format='%h %cr %s'. Run ./scripts/ship-inventory.sh for a one-screen queue (unshipped commits, dirty paths, next version, recent Release runs). If another session looks like it is mid-change (a worktree you did not make, commits from the last few minutes, a half-applied edit), say so and stop. This command rewrites nothing, but it does publish, and publishing someone's half-finished work is not recoverable.

1. Inventory first, act second

Report before touching anything:

  • Unshipped on main: git log --oneline $(git describe --tags --abbrev=0)..main
  • Branches: git branch -v --no-merged main, then for each one git cherry -v main <branch>. Use git cherry, not the commit list — branches here get cherry-picked into one another, so the same change exists under two SHAs and --no-merged keeps reporting content that already shipped. A - prefix means already applied, + means genuinely outstanding.
  • Dirty: git status --short
  • Bumps already in flight: git log --all --oneline --grep='^chore: bump' since the last tag. Several branches may each carry one, and they may claim the same number or leapfrog each other. Treat every one as a guess someone made, not as a decision.
  • Last tag vs host/VERSION

Then present the sets you propose to ship, in the order you propose to ship them, with a version for each — and ask before starting. Getting the partition wrong is the expensive mistake; everything after it is mechanical.

Read the full file on GitHub · 165 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 · 165 lines · 19 tokens per session scan A fdcc9686e262

Subscribe to this mod's changes

cleanup is a command published in the GitHub repository michellzappa/headroom (263 stars, last pushed 6d ago), licensed MIT. It adds 19 tokens to every session and 2,062 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-30.