Fix Codex slow startup, Cursor lag, high disk I/O, huge state.vscdb, huge logs_2.sqlite, bloated AI chat history, snapshots, worktrees, and cache files on Windows.
Codex Cursor Cleaner is a one-click Windows maintenance script for developers using AI coding tools heavily. It cleans local cache, logs, snapshots, temporary worktrees, and oversized SQLite databases created by Codex and Cursor.
If you searched for any of these problems, this tool is for you:
- Codex is very slow or stuck on startup.
- Codex becomes laggy after many conversations.
- Codex consumes high disk I/O.
.codex/logs_2.sqlitegrows to hundreds of MB or multiple GB..codex/worktreescontains many temporary directories and hundreds of thousands of files.- Cursor is slow, freezes, or takes a long time to open.
- Cursor uses high disk I/O even on an SSD.
- Cursor
state.vscdbis huge, for example 1GB, 5GB, 10GB, or more. - Cursor
state.vscdb.backupis huge. - Cursor
snapshotsfolder is huge. - Cursor Composer / AI chat / checkpoint history keeps growing.
- Windows feels slow because AI IDE cache files are constantly scanned or indexed.
Heavy AI-assisted development can create a lot of local state:
| Tool | Common bloat source | Typical symptom |
|---|---|---|
| Codex | ~/.codex/logs_2.sqlite |
Slow startup, high disk writes, huge SQLite log DB |
| Codex | ~/.codex/worktrees |
Hundreds of thousands of files, slow file indexing |
| Codex | ~/.codex/sessions and archived_sessions |
Huge conversation history JSONL files |
| Codex | .tmp/bundled-marketplaces/*.staging-* |
Duplicate temporary runtime copies |
| Cursor | AppData/Roaming/Cursor/User/globalStorage/state.vscdb |
Cursor lag, large SQLite state DB |
| Cursor | state.vscdb.backup |
Duplicate multi-GB backup file |
| Cursor | AppData/Roaming/Cursor/snapshots |
Huge Git-like snapshot packs |
| Cursor | composer.content.*, agentKv:*, checkpointId:*, bubbleId:* |
AI chat / Composer / checkpoint data bloat |
| Cursor | .cursor/worktrees |
Temporary worktrees and many files |
| Cursor | project worker.log files |
Large logs in .cursor/projects |
- Cleans Codex local bloat:
~/.codex/logs_2.sqlite~/.codex/state_5.sqlite- old
worktrees - old
sessions/archived_sessions - staging marketplace temp folders
- plain log files
- Cleans Cursor local bloat:
AppData/Roaming/Cursor/User/globalStorage/state.vscdbstate.vscdb.backup- snapshots
- cache folders
- process monitor data
.cursor/worktrees- large project worker logs
.cursor/ai-tracking/ai-code-tracking.db
- Runs SQLite
VACUUMto compact databases. - Keeps recent data by default: removes old session/worktree data older than 14 days.
- Prevents unlimited growth: if known databases exceed safety thresholds, bulky AI history/cache keys are cleared.
- Skips risky cleanup if Codex or Cursor is currently running.
- Writes a log to
%USERPROFILE%\Documents\cleanup-codex-cursor.log.
| Target | Default behavior |
|---|---|
| Retention window | Keep recent 14 days |
| Codex logs DB | Delete old TRACE/DEBUG logs; if over 256MB, clear log table |
| Cursor state DB | Vacuum normally; if over 1GB, clear bulky AI history/checkpoint/composer keys |
| Codex/Cursor process running | Skip database cleanup to avoid locked/corrupted files |
- Windows
- PowerShell 5+ or PowerShell 7+
- Python available in
PATHfor SQLite maintenance
- Close Codex and Cursor.
- Double-click
run-cleanup.bat. - Check the log file if needed:
%USERPROFILE%\Documents\cleanup-codex-cursor.log
You can also run it from PowerShell:
powershell.exe -NoProfile -ExecutionPolicy Bypass -File .\cleanup-codex-cursor.ps1This tool deletes local caches, logs, old sessions, old worktrees, snapshots, and oversized AI history/cache data. It does not modify your project repositories.
If you rely on long-term Codex/Cursor chat history or Cursor snapshots, review the script before running it.
Codex slow, Codex lag, Codex high disk usage, Codex logs_2.sqlite huge, Codex worktrees huge, Cursor slow, Cursor lag, Cursor freezes, Cursor high disk usage, Cursor state.vscdb huge, Cursor snapshots huge, Cursor Composer history cleanup, AI IDE cache cleaner, Windows developer cache cleaner.