Guide

AI coding tools.
The new disk hogs.

Coding agents keep old versions, session transcripts and caches, and local models weigh gigabytes each. Here is where it all lives.All guides · Updated

Where do AI coding tools keep their files?

AI coding tools keep most of their weight in your home folder, not in the app: old versions of the tool, session transcripts, log databases, a virtual machine image, and local models of several gigabytes each. Each tool has its own idea of what it cleans up, and some parts are yours to keep.

LocationWhat it isSafe to remove?
~/.local/share/claude/versionsInstalled Claude Code versionsAll but the active one
~/.claude/projectsClaude Code transcriptsYour data: only what you won't resume
~/Library/Application Support/Claude/vm_bundlesClaude Desktop's virtual machineYes, with the app closed; it comes back
~/.codex/sessions, archived_sessionsCodex transcriptsYour data: only what you won't resume
~/.codex/logs_*.sqliteCodex diagnostic logsYes, with Codex closed
~/Library/Application Support/Cursor/UserCursor chats and project stateYour data
~/.ollama/models, ~/.cache/huggingface, ~/.lmstudio/modelsLocal modelsYes, with each tool's command; costs a download

To see what each one takes on your Mac:

du -sh ~/.local/share/claude ~/.claude ~/.codex ~/.ollama ~/.cache/huggingface ~/.lmstudio 2>/dev/null
du -sh ~/Library/Application\ Support/{Claude,Cursor,Code} 2>/dev/null

Why does Claude Code keep old versions?

The native installer keeps each Claude Code version in its own folder under ~/.local/share/claude/versions, and manages the launcher ~/.local/bin/claude as a symlink to the one in use. Updates install in the background and take effect the next time you start it. On the Mac this guide was checked on, four versions sat there, about 200 MB each. If you replaced the launcher with your own script or symlink, Claude Code keeps every version, because it can't tell which one your launcher needs.

See which version is active, then what else is there:

ls -l ~/.local/bin/claude
du -sh ~/.local/share/claude/versions/*

Every folder except the one the launcher points to can go. If you also installed Claude Code with npm before the native installer existed, that copy is a duplicate: npm uninstall -g @anthropic-ai/claude-code removes it. Homebrew installs keep old versions after upgrades until you run brew cleanup.

Is it safe to delete ~/.claude/projects?

Not without a look. ~/.claude/projects holds a folder per project with one JSONL transcript per session: every message, tool call and tool result. That is what claude --resume and --continue read, and each project's auto memory lives there too, in a memory/ folder. Delete a transcript and that session can't be resumed.

Claude Code already cleans up after itself. According to its documentation, it deletes transcripts, checkpoint snapshots in file-history/, debug logs and other session files once they are older than cleanupPeriodDays, 30 days by default. Memory files stay. If this folder is big, either your recent sessions are long, or you raised that setting. Lowering it in ~/.claude/settings.json is the supported way to keep less:

{
  "cleanupPeriodDays": 14
}

To remove everything Claude Code keeps for one project — transcripts, memory, checkpoints and its entry in ~/.claude.json — use claude purge. It prints the plan and asks before deleting; --dry-run only prints it. Versions before 2.1.288 call it claude project purge.

claude purge ~/code/old-project --dry-run

The rest of ~/.claude is working files. backups/ holds the five newest copies of ~/.claude.json; shell-snapshots/ is removed on a clean exit; todos/ is a legacy folder that newer versions no longer write. Transcripts are plain text and not encrypted, so anything a tool printed, credentials included, may be in them. That is one more reason to keep fewer.

Why is Claude Desktop using 10 GB?

Claude Desktop's agent features, Cowork among them, run in a virtual machine. Its disk lives in ~/Library/Application Support/Claude/vm_bundles/claudevm.bundle, mostly in one file, rootfs.img. On the Mac this guide was checked on, the folder took 10 GB. Several users report the same size in Anthropic's issue tracker, and that it comes back after deleting it.

You can delete it with Claude Desktop closed. If you don't use these features, that is the space back; if you do, the app downloads the image again when it needs it.

du -sh ~/Library/Application\ Support/Claude/*/ | sort -h

The same folder has claude-code and claude-code-vm: Claude Desktop's own copies of Claude Code, separate from the command-line install in ~/.local/share/claude. Here they held three versions and about 730 MB together. Anthropic doesn't document these folders, so quit Claude Desktop before removing anything in them.

Where does Codex keep sessions?

Codex keeps its state in ~/.codex, or wherever CODEX_HOME points, as OpenAI documents. Transcripts are JSONL files in date folders, ~/.codex/sessions/YYYY/MM/DD/rollout-….jsonl, and codex resume reopens them. The CLI manages them itself:

codex archive <session-id>     # archive a saved session
codex unarchive <session-id>   # restore an archived session
codex delete <session-id>      # delete a saved session permanently

Archived sessions are kept in ~/.codex/archived_sessions, so archiving alone frees nothing. On the Mac this guide was checked on, sessions took 460 MB and archived sessions another 291 MB.

The surprise is often ~/.codex/logs_2.sqlite, a diagnostic log database. Here it was 2.5 GB, and users report it growing fast during normal use. It holds logs, not your sessions, so you can delete it, with its -wal and -shm files, while Codex and the Codex app are closed. Leave state_*.sqlite and thread_history_*.sqlite alone: they hold the app's state and thread history.

ls -lh ~/.codex/*.sqlite*

Why is Cursor taking up so much space?

Cursor is built on VS Code and stores data the same way, in ~/Library/Application Support/Cursor. Two kinds of folders live there:

  • Caches — Electron folders such as Cache, CachedData, Code Cache and GPUCache, depending on the version. Cursor rebuilds them; delete them only while it is closed.
  • Your data — User/workspaceStorage, User/globalStorage and User/History. Chat and agent history is kept in SQLite databases named state.vscdb there, and Cursor's team says that data has no limit or cleanup yet.

On the Mac this guide was checked on, the Cursor folder took 8.7 GB, and 8.2 GB of it was User: 6.1 GB in globalStorage and 2 GB in workspaceStorage. Each folder in workspaceStorage belongs to one project, named in its workspace.json. This lists them by size with the project each belongs to:

cd ~/Library/Application\ Support/Cursor/User/workspaceStorage
for d in */; do printf '%s\t%s\n' "$(du -sh "$d" | cut -f1)" "$(grep -o 'file://[^"]*' "$d/workspace.json" 2>/dev/null)"; done | sort -h

A folder for a project you deleted long ago is a fair candidate. Remove it only with Cursor closed, and expect to lose what Cursor kept for that project, chat history included. Old extension versions also stay in ~/.cursor/extensions next to new ones. VS Code uses the same layout in ~/Library/Application Support/Code and ~/.vscode/extensions.

Where are Ollama, Hugging Face and LM Studio models stored?

Local models take gigabytes each, and each tool has its own way to list and remove them.

Ollama

On macOS, Ollama keeps models in ~/.ollama/models, unless OLLAMA_MODELS points elsewhere. Its CLI lists and removes them:

ollama ls
ollama rm <model>

Hugging Face

Models and datasets downloaded through huggingface_hub, and the libraries built on it, go to ~/.cache/huggingface/hub, or to the folder in HF_HOME or HF_HUB_CACHE. The hf command shows what is there and removes it. Older guides use huggingface-cli scan-cache and delete-cache; the current documentation uses hf cache:

hf cache ls
hf cache rm model/t5-small --dry-run
hf cache prune

Use an ID from hf cache ls with rm. prune removes revisions no branch or tag points to any more, leftover partial downloads, and shared files no cached repository uses, which makes it a good first step after updating models.

LM Studio

LM Studio keeps models in ~/.lmstudio/models, one folder per publisher and model, unless you chose another folder in its My Models tab. lms ls lists them with their sizes. Delete the ones you no longer use from the My Models tab in the app.

How Specula handles AI tools

Specula's Cleanup → Tools list measures every location on this page, and more: Claude Desktop, Claude Code, Codex, Cursor, VS Code, OMP and local models. Each is marked as regenerable, app data or your data, with a note on what removing it costs. Its size history shows which tool grew, hour by hour. Locations marked as your data, such as ~/.claude/projects, can only be moved to the Trash from Specula, never deleted permanently.

Caches the tools rebuild — Claude Desktop's browser cache, Claude Code's logs and cache, Codex and Cursor caches, and the Hugging Face cache — are checked by default in the one-click Clean Up plan. Uncheck the Hugging Face cache if you don't want to download those models again. The Old versions page finds version folders side by side, such as claude/versions/2.1.257 … 2.1.281.

For transcripts, Specula archives instead of deleting. Its AI sessions page lists the Claude Code, Codex and OMP sessions last changed more than 30 days ago (you can choose 7 to 365) and shows the expected archive size before you start. Archiving compresses one tool's sessions into a single .tar.xz file in the Archives folder inside Specula's own folder, ~/Library/Application Support/Specula. It lists the archive and extracts a test copy to check every session is in it, and only then deletes the originals — each only if it hasn't changed since it was listed. Restoring puts the sessions back where they were and never overwrites one that is already there. In the one-click plan, these archive steps are offered but start unchecked. Claude Code deletes its own transcripts after 30 days by default, so for Claude Code this matters mostly if you raised cleanupPeriodDays.

For the rest of the disk, see what is inside System Data and how to clear package manager caches, or how Specula works as a Mac cleaner for developers.