TL;DR Every Claude Code session is saved as a
.jsonlfile in plain text under~/.claude/projects/(your prompts, the responses, and whatever you pasted, tokens included). By default they live 30 days. Shorten retention withcleanupPeriodDaysinsettings.json, or turn writing off entirely withCLAUDE_CODE_SKIP_PROMPT_HISTORY. It's the same data that powers--resumeand Rewind.
I opened my ~/.claude/projects/ folder and found 548 conversations, 541 MB, 14 projects. All in plain text. Every prompt I've typed, every response, every secret I pasted without thinking, sitting there, unencrypted. It's not a bug: it's exactly what makes resuming a session and rewinding possible. But it's worth knowing where it lives and how long it stays.
Where it lives
~/.claude/projects/<project-path>/<session-id>.jsonl
One folder per project (the path's / turned into -), one .jsonl per session, and each line is a JSON event: your prompt, the response, every tool call. Unencrypted. It's what --resume and Rewind with checkpoints read from.
Long pastes live separately, under ~/.claude/paste-cache/, and this same sweep deletes them: how to expand a pasted text before it expires.
See it for yourself
du -sh ~/.claude/projects/ # how much it takes up
find ~/.claude/projects -name '*.jsonl' | wc -l # how many conversations
And because every event carries its token counters, the same file doubles as an audit trail: add them up and you can see how much of a session went into re-reading its own history, which is a number no command will give you.
What to do
1. Shorten retention
In ~/.claude/settings.json:
{ "cleanupPeriodDays": 7 }
Default 30 days, minimum 1 (0 is rejected with a validation error). At startup, it deletes the older transcripts. It applies on the next session, not live. That same number sets the expiry on the worktrees of subagents and background sessions, which take up far more room than a transcript.
2. Turn it off entirely
export CLAUDE_CODE_SKIP_PROMPT_HISTORY=1 # stop writing transcripts
In headless or the SDK, --no-session-persistence (or persistSession: false). Mind the tradeoff: with no transcripts you lose --resume and Rewind, because both read from there.
3. Delete what's already there
It's a normal folder. Remove the sessions you don't want to keep (carefully):
rm ~/.claude/projects/<project>/<session-id>.jsonl
Reference
| Control | What it does |
|---|---|
cleanupPeriodDays (in settings.json) |
Retention in days. Default 30, minimum 1 |
CLAUDE_CODE_SKIP_PROMPT_HISTORY=1 |
Stops writing transcripts (interactive session) |
--no-session-persistence / persistSession: false |
Same thing, in headless or the SDK |
Heads up:
- It's a tradeoff, not a free switch: turning writing off kills
--resumeand Rewind. - The
cleanupPeriodDaysdeletion runs at startup, so a freshly written transcript stays on disk until a later session crosses the cutoff.
This is the hidden side of Rewind with checkpoints: that feature is convenient because your history lives on disk; this tip is where it lives and how to control its lifetime.
Official docs: Settings (
cleanupPeriodDays)
Related: Rewind: undo changes with checkpoints
Requirements
- A
settings.jsonin~/.claude/(user) or.claude/(project). The change applies when the next session starts.