Where Claude Code stores your chats — and why they disappear after 30 days
Claude Code keeps every session as a plaintext JSONL file under ~/.claude/projects and deletes it after cleanupPeriodDays (30 by default). Here's how to see the size, keep history longer, and back it up safely.
6 min read
Every Claude Code session is saved to disk as you work: every message, every tool call and every tool result. That's what powers claude --resume. It's also why the folder grows, and why sessions you might want to look back on vanish after a month.
Where the files live
Transcripts are stored under ~/.claude/projects/, in one folder per project (named after the project's path, with slashes turned into dashes):
| Path under ~/.claude/ | What it is |
|---|---|
projects/<project>/<session>.jsonl | The full conversation transcript |
projects/<project>/<session>/subagents/ | Subagent transcripts for that session |
projects/<project>/<session>/tool-results/ | Large tool outputs and full-size images returned by tools |
file-history/<session>/ | Pre-edit snapshots used for checkpoint restore |
plans/, debug/, paste-cache/ | Plan files, debug logs and large pastes |
A session is really a pair: the .jsonl file and the folder with the same name next to it. If you move or back up sessions by hand, keep them together. Leave any memory/folders alone: that's Claude Code's auto memory, not chat history.
Why sessions disappear after 30 days
Claude Code deletes these files once they're older than the cleanupPeriodDays setting. According to the official documentation, the default is 30 days, the minimum is 1, and setting it to 0fails validation. In other words, you can't switch the sweep off with this setting, only lengthen it.
One exception: on recent versions, sessions you started or last continued in Claude Desktop or Cowork are kept at any age unless you set desktopSessionCleanupPeriodDays.
To keep terminal sessions longer, raise the value in ~/.claude/settings.json:
{
"cleanupPeriodDays": 365
}That only delays the sweep. If the history matters to you, back it up too. A longer retention period also means more plaintext on disk (see below).
How big is it on your machine?
# Total size of all transcripts
du -sh ~/.claude/projects
# The ten biggest projects
du -sh ~/.claude/projects/* | sort -h | tail -10
# Sessions that are close to the default 30-day sweep
find ~/.claude/projects -name '*.jsonl' -mtime +25 | wc -lThe transcripts themselves are usually not the biggest problem: on the MacBook we tested, ~/.claude/projects was about 1 GB. Debug logs and temporary files can be far larger when something goes wrong, so check du -sh ~/.claude/* as well.
Transcripts are stored in plaintext
The docs are explicit that transcripts are not encrypted at rest: file permissions are the only protection. Anything that passes through a tool ends up in the transcript, including the contents of a .env file Claude read or a token a command printed. Treat ~/.claude/projects as sensitive, and only back it up to somewhere encrypted.
Backing up by hand
With Claude Code closed, copy the folder to an encrypted destination, such as an encrypted APFS external drive:
rsync -a ~/.claude/projects/ "/Volumes/Encrypted Backup/claude-projects/"Two things to watch. First, don't add --delete: it would mirror the 30-day sweep into your backup and remove exactly the sessions you were trying to keep. Second, run it regularly, at least more often than your cleanupPeriodDays.
To restore a session, copy the .jsonl file and its matching folder back into the same project folder. It should then show up again in claude --resumewhen run from that project's directory.
A gotcha if you also use Claude Desktop
On the Macs we've inspected, Claude Desktop keeps its own list of Claude Code sessions in ~/Library/Application Support/Claude/claude-code-sessions/, and each entry points at a transcript by session ID. Deleting transcripts by hand can leave entries in the Desktop sidebar that no longer open. Archiving rather than deleting, and restoring to the exact original path, avoids that.
The short version
- Sessions live in
~/.claude/projects/<project>/as a.jsonlfile plus a matching folder. - They're deleted after
cleanupPeriodDays(30 by default, and it can't be disabled). - They're plaintext, so back them up only to encrypted storage.
- Never mirror deletions into your backup, and keep each
.jsonltogether with its folder.