AI coding agents work like tireless developers: they spin up parallel Git worktrees, run test suites, cache packages, and write detailed transcripts and SQLite logs. They rarely clean up after themselves.
When a 512 GB or 1 TB MacBook suddenly drops to single-digit gigabytes free mid-session, the culprit is increasingly not Downloads or old movies — it is agent state and log files.
Where the space goes
- Codex SQLite logs and WAL sidecars (
~/.codex/):logs_1.sqlite,logs_2.sqlite, and especiallylogs_2.sqlite-walcan grow into tens of gigabytes during long sessions or retry loops, alongsidecodex-tui.logand~/.codex/sessions/. - Claude Code transcripts (
~/.claude/projects/): Plaintext session transcripts,file-historysnapshots, anddebuglogs accumulate quietly. Claude Code defaults to a 30-day retention window controlled bycleanupPeriodDaysin~/.claude/settings.json. - Cursor global state (
~/Library/Application Support/Cursor/User/globalStorage/state.vscdb): Stores chat history, context indices, and checkpoints. Under heavy multi-file agent usage, deleted rows leave massive SQLite freelist bloat inside the file. - Parallel Git worktrees: Ten concurrent agent branches can mean ten physical copies of
node_modules, Rusttarget/, Swift.build/, or Python.venv/.
Why raw rm -rf is dangerous here
Two traps catch developers who try to fix this in Terminal:
- Deleting a
-walfile while SQLite is open corrupts the database. A SQLite Write-Ahead Log (-wal) contains committed transactions that have not yet been checkpointed into the main.sqliteor.vscdbfile. Always quit the owning agent or editor first, and treat.sqlite,-wal, and-shmas a single unit. - Deleting
state.vscdberases your entire chat history. Most of the file size is often reclaimable freelist pages that can be recovered via an offlineVACUUMwithout losing a single conversation.
Auditing safely with DiskWright
DiskWright 1.5 ships a free, read-only diskwright agents CLI command (and matching Developer Storage workspace) that inspects Codex, Claude Code, Cursor, and Gemini stores in seconds:
Reports exact allocated bytes and coupled WAL sidecar sizes.
Checks whether
codex,claude, orCursoris currently running before recommending any action.Reads Claude Code's
cleanupPeriodDayssetting directly from~/.claude/settings.json.Provides Safe Offline SQLite Vacuum (
VACUUM INTO+PRAGMA integrity_check+ atomic swap + backup moved to Trash) and a Menu-Bar SSD Write-Rate Watch to catch runaway write loops early.
Written by the DiskWright team. Practical guidance for understanding your Mac’s storage.
Explore DiskWright’s sample demo →