Claude Code, Codex and Cursor disk usage: what's safe to clean
AI coding tools write a lot to disk: session transcripts, file snapshots for undo, git worktrees for parallel agents, older runtimes, and editor state for every folder you opened.
The short answer: debug logs, shell snapshots and editor caches are safe to remove. Old session transcripts and agent worktrees are fine to remove once you've checked you don't need them. Leave Claude Code's memory and your settings alone.
Where does Claude Code keep its data?
~/.claude/projects/: one folder per project with the session transcripts (.jsonlfiles). Claude Code removes transcripts older than itscleanupPeriodDayssetting (30 days unless changed), so these grow mostly when that's raised.~/.claude/file-history: earlier versions of the files Claude Code edited, so changes can be rewound.~/.claude/debugand~/.claude/shell-snapshots: logs and saved shell environments. Safe to remove.<your repo>/.claude/worktrees/: git worktrees made for agents working in parallel.- The Claude desktop app keeps the Claude Code versions it downloaded in
~/Library/Application Support/Claude/claude-code; only the newest is used.
Keep the memory folders inside ~/.claude/projects/, your CLAUDE.md files and settings.json.
Is it safe to delete Claude Code transcripts?
Yes, with one cost: you can no longer resume those sessions with --resume or --continue, or rewind their edits. Memory is stored separately and stays.
Where do Codex and Gemini CLI keep their sessions?
- Codex:
~/.codex/sessionsand~/.codex/archived_sessions(transcripts), log databases in~/.codex, and worktrees in~/.codex/worktrees. - Gemini CLI:
~/.gemini/tmp, with its sessions and checkpoints.
Why is my Cursor or VS Code folder so big?
Look in ~/Library/Application Support/Cursor (or Code, Windsurf):
Cache,CachedData,CachedExtensionVSIXs,Code CacheandGPUCache: safe to remove with the editor closed.User/workspaceStorage: state for every folder you ever opened. Entries for folders that no longer exist are dead weight.User/globalStorage/state.vscdb: settings and AI chat history, which can grow to several GB. Don't delete it. Quit the editor and compact it instead; deleted chats leave empty space that only compacting gives back:
sqlite3 ~/Library/Application\ Support/Cursor/User/globalStorage/state.vscdb 'VACUUM'
Older versions of extensions also pile up in ~/.vscode/extensions and ~/.cursor/extensions after updates.
How do I clean up agent git worktrees?
Each worktree is a full checkout, often with its own node_modules and build output. In the repository:
git worktree list
git worktree remove <path>
git worktree prune
git worktree remove refuses a worktree with uncommitted changes unless you add --force, which is the check you want. Merge or push any branch you need first.