Context Cleanup

SkillUtilitiesClaudeCodex

Clean up after your AI coding sessions. Remove leftover files, trim outdated agent notes, and free up disk space, all with one command.

A broom sweeps a pile of old files and notes off a laptop screen, and leaves a tidy window and sparkles behind.

The Problem

Every coding session with your AI agent leaves things behind: plans, handoff notes, logs, temporary files, build data, and more.

These files are useful while you're working, but once the feature is finished, most are no longer needed. They take up disk space and clutter future sessions with outdated notes and context that your agent could easily get from the latest code.

Over time, all that leftover clutter adds up.

The Solution

Context Cleanup! One command after you finish your work, and your agent cleans up what's no longer needed.

It removes leftover files, trims agent instructions down to what future sessions actually need, and frees up disk space, all while protecting your code and unfinished work.

How to use it

Run the skill once your work is committed or delivered. It only runs when you ask it to.

In Claude Code:

  • /context-cleanup — Clean up the current project and its leftover session files.
  • /context-cleanup docs/ — Limit cleanup to a specific folder or path.
  • /context-cleanup all — Check leftover disk files across all your projects, while keeping documentation cleanup limited to the current project.

In Codex, use $context-cleanup instead.

How it works

  1. Checks that your work is committed. If any Git-tracked files have uncommitted changes, the skill stops without deleting anything.
  2. Reviews what's left behind. A fresh subagent called the Sweeper reads your project as if it's starting a new session. It decides what to delete, rewrite, keep, or ask you about.
  3. Cleans up safely. Your main agent reviews those decisions, protects important files and active work, and asks your permission when needed.
  4. Shows you what changed. You get a report of what was cleaned up, what was kept, and how much disk space was freed.

Features

  • Remove leftover session files. Clean up outdated plans, handoffs, drafts, logs, and temporary files that are no longer needed.
  • Keep agent instructions relevant. Trim AGENTS.md, CLAUDE.md, and other agent notes to the information future sessions actually need: how to build, run, test, and work with your project. Remove outdated decisions, research, and session history.
  • Keep documentation up to date. Preserve documentation written for your users while removing outdated history and fixing instructions that no longer match the code.
  • Turn rules into automated checks. If a rule in your agent instructions can be enforced by an existing test or check, the skill can add that check with your approval and remove the redundant written rule.
  • Free up disk space. Find leftover session folders, transcripts, unused worktrees, obsolete Xcode build data, and simulators created during development.
  • Undo changes with Git. Rewrites to agent notes and deletions of tracked files are saved in one commit, so you can undo them with git revert. The skill never pushes.
  • Works with Claude Code and Codex. Use the same skill in either agent.

FAQs

Does it delete files without asking?

Only files that Git can restore, or cleanup items that are no longer usable, such as merged branches, clean worktrees, and Xcode build data for projects that no longer exist.

For anything else, the skill shows you what it wants to remove, including file sizes, and asks for your permission first.

Will it touch my code or unfinished work?

No. The skill doesn't modify your product code, except to add an automated check you've approved.

It also protects secrets, active sessions, booted simulators, and files belonging to unfinished work. It skips session files that changed within the last 24 hours and never manually deletes transcripts.

What if I haven't committed my changes?

The skill stops immediately and tells you which tracked file has uncommitted changes. Nothing gets deleted.

Commit your work, then run the command again.

Can I tell it to keep certain files or folders?

Yes! It's a customizable skill. Ask your agent to add them to the skill's keep list, in references/sweeper.md, such as docs/decisions/.

You can also adjust what the skill cleans up to better fit your workflow.

What happens after you buy

  1. 1

    Download

    Click the download link to get the ZIP file. Extract it, then share the folder with your agent.

  2. 2

    Your Agent Guides You Through Setup

    Your agent will follow INSTALL.md to install the skill in Claude Code or Codex, either for all your projects or just one. Then start a new session to load the skill.

  3. 3

    Make it yours

    Once you've committed your work, run /context-cleanup in Claude Code or $context-cleanup in Codex. If the skill misses something you want cleaned up or removes something you'd rather keep, ask your agent to adjust its instructions to fit your workflow.

Let your agent check if Context Cleanup is right for you.

Just copy this prompt:

Read https://tools.natashatherobot.com/context-cleanup.md, the page for Context Cleanup. Based on what you know about my projects and workflow, tell me whether this skill would be useful to me. Consider how much clutter my coding sessions leave behind, whether my agent instructions contain outdated or unnecessary context, and whether cleaning up temporary files, build data, and unused worktrees would help. Check whether I meet the requirements and whether the time and disk space saved would make it worth the price. If it’s not a good fit, explain why. Ask me for more context if needed.

It is a starter tool

Context Cleanup is a skill you can customize to fit your workflow. Edit its instructions, add new rules, or change what it cleans up.

The license is for one person. You can use and change the skill for yourself and your work. You can share or sell a version that makes a significant change to how it works, as long as you give that version a new name.

The full terms are in the LICENSE file of the download. The skill comes without warranty.