What Claude Code, Codex and Cursor leave on your Mac
Coding agents save every conversation, keep earlier versions of themselves, make extra working copies of your repositories and cache like any editor. None of it is large on day one. After a few months of vibe coding it can be tens of gigabytes. Here's where each tool keeps what, and what you can safely clear.
Some of these folders are your only copy of something: a conversation you may want to resume, or code an agent wrote in a worktree and never committed. Read the notes before removing anything, and prefer the Trash to rm.
Claude Code
| Folder | What it is | Safe to remove? |
|---|---|---|
~/.claude/projects | Your past conversations, one folder per project, used by claude --resume. | Only if you won't want to resume or read them again. Your code isn't touched. |
~/.claude/file-history, shell-snapshots, todos, debug | Backups of files each session changed (for rewinding), shell snapshots, task lists and debug logs. | Yes, for old sessions. You can't rewind those sessions afterwards. Claude Code removes them itself after 30 days. |
~/.local/share/claude/versions | The current version and the two before it, so you can roll back. | The older ones, yes. Keep the one in use. |
How long conversations are kept is set by cleanupPeriodDays in ~/.claude/settings.json.
The Claude desktop app keeps its caches in ~/Library/Application Support/Claude, along with the system files of the Linux virtual machine it uses to run code for you (vm_bundles). Those can be removed with Claude closed; it downloads them again, several gigabytes, the next time a task needs them.
Codex
| Folder | What it is | Safe to remove? |
|---|---|---|
~/.codex/sessions, ~/.codex/archived_sessions | Your past Codex conversations. | Only if you won't resume them. Codex's settings and memories are elsewhere. |
~/.codex/worktrees | Extra working copies of your repositories that Codex made to work on a branch. | Ones already merged, with nothing uncommitted, yes. See worktrees below. |
~/.cache/codex-runtimes | Runtimes Codex downloads. | Yes. Downloaded again when needed. |
Cursor, Devin and VS Code
Cursor and Devin (formerly Windsurf) are built on VS Code and lay their files out the same way, each under its own name in ~/Library/Application Support:
Cache,CachedData,Code Cache,GPUCacheandlogsrebuild themselves. Clear them with the app closed.User/workspaceStorageholds a small store for every folder the editor has opened: layout, open files and data extensions saved, such as chat history. Stores for folders you've since deleted can go.~/.cursor/extensionskeeps old versions of extensions after updates. Superseded versions can go; the newest of each stays.~/.local/share/cursor-agent/versionskeeps earlier versions of the Cursor Agent command-line tool.
Git worktrees agents leave behind
Agents that work on several tasks at once make a Git worktree for each: a full extra checkout of your repository on its own branch. They're easy to forget, and each one is the size of your project.
cd ~/dev/my-project
git worktree list # every worktree of this repository
git worktree remove ../my-project-feature # remove one you've merged
git worktree prune # forget worktrees whose folders are already gone
Before removing a worktree, check it the way you'd check any copy of your code: git status for uncommitted changes, and whether its branch is merged or pushed. Anything uncommitted in a worktree exists nowhere else. Committed work stays in the main repository.
Aider, Continue and Roo Code
Aider keeps caches in ~/.aider/caches and a repository map in each project's .aider.tags.cache.v4; both rebuild. Continue keeps a code index in ~/.continue/index and a downloaded browser in ~/.continue/.utils. Roo Code saves each task's conversation in the editor's extension storage, under User/globalStorage/rooveterinaryinc.roo-cline/tasks; treat those like any other conversation history.
How ElfClean does it
ElfClean's AI & coding screen shows how much each tool uses and how that has grown since about a week ago. Caches are marked as rebuilding themselves. Conversations are never treated as a cache: you can archive old ones to a zip on your Mac before they're removed, and conversations for projects you've deleted are found separately. Projects used in the last day are skipped.
Every worktree an agent made is listed with its repository; merged ones with nothing uncommitted are ready to prune, and ones with work that isn't committed or pushed are marked At risk. Folders a running agent is using are left alone.
More guides
- How to delete old node_modules folders on a Mac safely
- Where Ollama and Hugging Face store models on a Mac, and how to remove them
- How to clear Xcode DerivedData, simulators and device support
- What System Data is on a Mac, and how to make it smaller
- How to find large files and duplicates on a Mac
- How to free up Docker disk space on a Mac
- Clear pip, uv, Homebrew, Cargo and other caches on a Mac
- Mac cleaners for developers compared: CleanMyMac alternatives