Claude Code, Cursor and Codex run in git worktrees so several agents can work at once. Each worktree is a full checkout with its own node_modules and build output, and they pile up quietly. One Claude Code user found 27 forgotten worktrees using 80 GB ( issue 63087 ). 61 Codex worktrees of a Rails app took about 100 GB ( issue 35383 ).
Where they live
Claude Code: .claude/worktrees/ inside each repository (older versions used ~/.claude-worktrees )
Cursor: ~/.cursor/worktrees/
Codex: ~/.codex/worktrees/ , on a detached HEAD rather than a branch
See what they take
git worktree list # inside a repository du -sh .claude/worktrees/* 2 > /dev/null | sort -h # inside each repository du -sh ~/.cursor/worktrees/*/* ~/.codex/worktrees/* 2 > /dev/null | sort -h
Enter fullscreen mode
Exit fullscreen mode
Check before you remove one
git -C < path > status --short # prints nothing if nothing is uncommitted git -C < path > status --short --ignored # .env and other ignored files you'd lose git log --oneline main..…