ai cleanup

A few days of heavy Claude Code use left a 512 GB Mac with only 20 GB free. The app itself was not the problem. What grew were the folders around it: repeated build output, old CLI versions, session files packed with screenshots, and local models.

Claude Code, Cursor, Codex, and similar tools are not especially large on their own. The real pressure comes from everything they generate and leave behind. Traditional cleaners were built for caches and leftover app files. They become less reliable when the largest folders look like “junk” but contain work you may still need.

“I judge a cleaner less by how many gigabytes it claims and more by whether it lets you see clearly before anything is removed.”

— from the developer of Mole, on building a Mac cleaner for the AI era

Measure before you delete anything

Start with totals, not guesses:

du -sh ~/.claude ~/.codex ~/.ollama/models ~/.cache/huggingface 2>/dev/null | sort -h

Then look for amplified build output in your project folders:

find ~/Projects ~/Developer -maxdepth 3 -type d \
\( -name target -o -name node_modules -o -name .next -o -name dist -o -name build -o -name DerivedData \) \
-prune -exec du -sh {} + 2>/dev/null | sort -h | tail -20

You will often find that one or two project folders, plus agent home directories, explain most of the pressure.

If you prefer a visual map, a disk analyzer such as DaisyDisk can help surface large folders quickly. It shows what is large; it still cannot tell you whether that data is safe to remove.

Common mistakes to avoid

These are the patterns that keep showing up in developer reports:

Deleting ~/.claude or ~/.codex entirely
These folders mix settings, sessions, and local state. Removing the whole directory can wipe useful history and app data at once.

Deleting Ollama or Hugging Face folders in Finder
Model stores often share layers. Removing files by hand can break other models. Use each tool’s own remove commands instead.

Treating agent sessions as ordinary cache
Conversation files can look like logs, but they may contain decisions, rejected approaches, and screenshots you still need. Don’t put them in one-click cleanup.

Clearing build folders while a project is still running
Quit agents and active builds first. Otherwise you may delete files still in use or force a broken rebuild mid-task.

The common theme: the biggest numbers on disk are not always the safest to remove.

Four kinds of AI-related storage

1. Build output (usually regenerable)

Agents compile and test far more often than a human does. That amplifies normal developer clutter:

  • Rust target/
  • JavaScript .next, dist, build, bundler caches
  • Python __pycache__
  • Xcode DerivedData

These can often be recreated locally when sources and toolchains are still present. Quit active builds first. Prefer project-native commands (cargo clean, clearing DerivedData carefully, etc.) when you know the stack.

In the Mole developer’s own workflow, repeated AI-assisted builds once left 86 GB of build artifacts on a single Mac.

Default: Safe to clear when the project is idle and you accept a rebuild cost.

2. Old agent CLI versions (review carefully)

Many agent CLIs update by downloading a full new release and leaving the previous ones on disk. Each copy can be a few hundred megabytes. After months of updates, several unused versions can add up to multiple gigabytes.

Do not simply keep the newest folder by date. Resolve the live launcher first:

readlink -f "$(command -v claude)"
readlink -f "$(command -v codex)"

Keep the target that is actually in use. Review the rest. If a version might still be pinned or referenced, leave it alone.

Default: Keep the active install; review older copies one by one.

3. Sessions, transcripts, and agent state (often irreplaceable)

Paths such as:

  • ~/.claude/projects
  • ~/.codex/sessions
  • ~/.grok/sessions

can look like logs. They are usually working history: approaches tried, rejected options, and the reasoning behind a change.

They can also be much larger than the text suggests. As Yukun Gao, developer of Mint, told us in our interview:

“Agents check their work by looking at it, and every screenshot is saved in the conversation. On my Mac, one Codex store was 22.83 GB, and 71% of it was images, many of them the same screenshot again and again.”

That is why “delete old chats” is a weak first response. A lot of the weight may be repeated media inside conversations you still use — and the text itself is often the part worth keeping.

Default: Do not put these in batch cleanup. Delete only conversations you deliberately no longer need, preferably through the agent itself when it offers a proper remove action.

4. Local models (remove only through the owning tool)

Ollama, LM Studio, and Hugging Face caches are often the heaviest items on disk. They are also easy to damage if you delete hashed blobs by hand, because models can share layers.

Use the tool’s own commands:

ollama ls
ollama rm MODEL_NAME

For LM Studio, remove models from within the app (or its supported CLI), not by guessing folders in Finder.

Default: Inventory and remove named models through the owner tool. Leave the store alone otherwise.

Where these tools usually store data

Tool Common locations What you may find
Claude Code ~/.claude/ Sessions, project state, logs
Codex ~/.codex/ (or CODEX_HOME) Sessions, config, local state
Cursor ~/Library/Application Support/Cursor/ Workspace and app state
Ollama ~/.ollama/models/ Downloaded models
Hugging Face ~/.cache/huggingface/ Model/dataset cache

These are starting points, not automatic delete lists. Some tools allow custom data directories.

A simple rule that prevents most mistakes

Rank candidates by what it costs to get them back:

Tier Examples Approach
Regenerable Build output, many caches, bytecode Clear when idle
Expensive to rebuild node_modules, package caches, model weights Review first
Irreplaceable Agent sessions, memories, plans, unique project state Keep out of one-click clean

This is the same philosophy behind tools that treat AI clutter more carefully. Mole, for example, hard-protects session and model paths in ordinary cleanup and emphasizes review-before-delete. Mint focuses on clear categories and, where supported, non-destructive Optimize options for some agent-related storage.

Looking at a disk full of agent data, the useful question is not “How much junk did we find?” but “What can return in minutes, what needs a download, and what is gone forever if we delete it?”

One extra caution: a folder named Caches is not automatically safe. Some system “cache” paths hold compiled resources (for example Neural Engine data) that other apps still need.

A practical cleanup order

  1. Measure agent homes and large project build folders.
  2. Quit coding agents and related CLIs.
  3. Clear regenerable build output in projects you are not actively using.
  4. Review old CLI version folders after confirming the live launcher target.
  5. Leave sessions and models alone unless you intentionally remove specific chats or named models through the right tool.
  6. Empty Trash only after you have confirmed nothing important was moved there.

If you prefer a guided tool:

  • Mole — strong for review-first cleanup of AI/dev clutter, with protected session and model paths.
  • Mint — strong when you want clearer categories and safer decision boundaries, including AI-related storage.

Both appear in our updated guide to the best Mac cleaner apps, in the AI-era section.

FAQ

Is it safe to delete ~/.codex or ~/.claude entirely?
Usually no. Those folders mix settings, sessions, and other state. Remove specific conversations or caches only when you understand what you are targeting.

Does archiving a conversation free disk space?
Often not. Archiving may only move the file. Space returns when data is actually deleted.

Should I delete Ollama or Hugging Face folders in Finder?
No. Use ollama rm, LM Studio’s model UI, or the Hugging Face cache tools so shared blobs and manifests stay consistent.

Do I need a Mac cleaner for this?
Not always. Built-in Storage settings plus careful manual cleanup are enough for many people. A dedicated tool helps when you want a clearer review list, better leftover detection, or ongoing maintenance — and when the tool is explicit about what it will not touch.

What’s the fastest safe win?
Clear idle project build output (target, DerivedData, .next) after quitting agents. That often frees more space than deleting chats, with less risk.

Final takeaway

AI coding agents did not invent disk clutter. They changed the mix and the stakes. Build folders grow faster. Old CLI copies accumulate quietly. Session files can be both large and valuable. Models are heavy and easy to break if removed the wrong way.

Clean by restore cost, not by the biggest number on screen. Look before you delete. And when a tool promises to reclaim space after agent work, the most important feature is still the list of what it refuses to remove.

Note: If a large chunk of your “System Data” is actually Apple Intelligence models (common after macOS 27), that is a separate issue. See our guide on reclaiming System Data and removing Apple Intelligence models.

Loved the article, share!

Related Articles

Sign In

Register

Reset Password

Please enter your username or email address, you will receive a link to create a new password via email.