Prune

Claude Code and Codex filling your disk? What is safe to delete

Coding agents save a full transcript of every session, plus the files they touched. A busy ~/.claude passes a gigabyte within months, and Codex users have reported far more. Some of it is cache, most of it is your history.

Where it lives

# Claude Code (Windows: %USERPROFILE%\.claude)
~/.claude/projects/<project>/<session>.jsonl   transcripts
~/.claude/file-history/<session>/             file checkpoints
~/.claude/debug                               debug logs

# Codex (Windows: %USERPROFILE%\.codex)
~/.codex/sessions/YYYY/MM/DD/rollout-*.jsonl  transcripts
~/.codex/cache

Safe to clear

Claude Code’s debug logs and unsent telemetry, and the Codex cache folder, are rebuilt as needed. Clearing them costs nothing.

Your call: old transcripts

A transcript is the only record of that session. Delete it and you can no longer resume it. Old sessions you will never reopen are fair game:

# macOS / Linux: list Codex sessions untouched for 90+ days
find ~/.codex/sessions -name '*.jsonl' -mtime +90

# Windows (PowerShell)
Get-ChildItem "$env:USERPROFILE\.codex\sessions" -Recurse -Filter *.jsonl |
  Where-Object LastWriteTime -lt (Get-Date).AddDays(-90)

For Claude Code, remove a session’s .jsonl together with its sibling folder and its file-history entry, or the leftovers keep their space.

Never delete

Cap it at the source

Claude Code’s cleanupPeriodDays setting in ~/.claude/settings.json controls how long it keeps transcripts. Lower it if you never resume old work.

FAQ

Is it safe to delete old Claude Code sessions?

Yes, for sessions you will not resume. A transcript is your history, not a cache: once it is gone, that session can no longer be resumed. Your code, CLAUDE.md files, memory, settings and skills are stored elsewhere and are not affected.

Where does Codex store its sessions?

In ~/.codex/sessions, one file per session, grouped into year, month and day folders. On Windows it is %USERPROFILE%\.codex\sessions.

Will Prune touch my memory or settings?

No. Prune only offers sessions you have not opened for 30 days or more. Memory folders, settings, skills, plugins and recent sessions are never listed, nothing is pre-selected, and removed sessions go to the Trash or Recycle Bin.

Related