Coding agents like Claude Code, Cursor, and Codex are quietly eating hard drives alive. By design, these tools spawn isolated git worktrees to run multiple tasks simultaneously, but each checkout duplicates dependencies, bloating storage with redundant node_modules and build outputs. Recent community reports highlight the severity: one Rails developer saw 61 Codex worktrees consume roughly 100 GB, while a Claude Code user discovered 27 forgotten worktrees hogging 80 GB. These agents often lack robust, cross-tool cleanup mechanisms, leaving developers to manually audit and purge gigabytes of stale data.
The Hidden Cost of Parallelism
A single worktree costs what a fresh clone costs once its dependencies are installed. For a Laravel project, this amounts to about 530 MB of node_modules and 350 MB of vendor per worktree, meaning ten worktrees can take up 9.9 GB. The problem scales rapidly with larger applications; a Rails app with 1.3 GB of node_modules per checkout resulted in 61 Codex worktrees consuming approximately 100 GB.
Where Agents Hide Their Data
Each tool stores worktrees in different locations, often outside the main repository directory. Claude Code users should check ~/.claude/worktrees and the legacy ~/.claude-worktrees directory. Cursor stores data in ~/.cursor/worktrees, while Codex uses ~/.codex/worktrees. To see how big they are without changing anything, developers can run du -sh commands on these paths, sorting by size to identify the largest offenders.
The Codex Crash Report Leak
Beyond worktrees, specific bugs can accelerate disk consumption. Some versions of the Codex app saved crash reports so aggressively that one user's folder grew by 4.9 GB and contained 54,504 files in a single day. While OpenAI has merged a fix for this issue, developers should check ~/Library/Application Support/Codex/Crashpad/pending and the equivalent path for com.openai.codex. If these folders are large, quitting Codex and manually moving the pending files to the Trash can free up significant space.
Safe Removal Strategies
Before deleting a worktree, ensure the work is finished. Use git worktree list to identify active directories, then check for uncommitted changes with git -C
Preventing Future Bloat
Developers can mitigate storage issues by adjusting agent settings. For Claude Code, lowering cleanupPeriodDays from the default 30 days helps sweep finished worktrees sooner. Cursor users should reduce cursor.worktreeMaxCount from its default of 25. Codex users can lower the limit of 15 kept worktrees in the app settings. Additionally, using pnpm with virtualStoreType: global allows worktrees to share a single package store, significantly reducing disk usage.
Key Takeaways
- Git worktrees created by coding agents duplicate dependencies, leading to tens of gigabytes in disk usage with no automatic cross-tool cleanup.
- Codex bug reports revealed a separate issue where crash reports filled up to 4.9 GB in a single day; manual cleanup of Crashpad folders is required for affected versions.
- Manual inspection via git worktree list and du -sh commands is necessary to identify and safely remove stale worktrees.
- Adjusting configuration limits for Claude Code, Cursor, and Codex, along with using pnpm's global store, can prevent worktree accumulation.
The Bottom Line
The convenience of parallel agent workflows comes with a hidden tax on your storage, requiring developers to actively manage worktree lifecycle and configuration to avoid disk bloat.