Mac storage

Codex WALs, Claude Code Transcripts and Cursor state.vscdb on macOS

Why AI coding agents quietly consume tens of gigabytes and burn SSD writes on MacBooks, and how to audit and compact them without corrupting live databases.

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 especially logs_2.sqlite-wal can grow into tens of gigabytes during long sessions or retry loops, alongside codex-tui.log and ~/.codex/sessions/.
  • Claude Code transcripts (~/.claude/projects/): Plaintext session transcripts, file-history snapshots, and debug logs accumulate quietly. Claude Code defaults to a 30-day retention window controlled by cleanupPeriodDays in ~/.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, Rust target/, Swift .build/, or Python .venv/.

Why raw rm -rf is dangerous here

Two traps catch developers who try to fix this in Terminal:

  1. Deleting a -wal file 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 .sqlite or .vscdb file. Always quit the owning agent or editor first, and treat .sqlite, -wal, and -shm as a single unit.
  2. Deleting state.vscdb erases your entire chat history. Most of the file size is often reclaimable freelist pages that can be recovered via an offline VACUUM without 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, or Cursor is currently running before recommending any action.

  • Reads Claude Code's cleanupPeriodDays setting 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.

  • Read the DiskWright User Guide

  • Download DiskWright 1.5 for Mac

Written by the DiskWright team. Practical guidance for understanding your Mac’s storage.

Explore DiskWright’s sample demo →