Claude Code history

Claude Code deleted my sessions.

What happened, where they were, and what can come back.

Why did my old Claude Code sessions disappear?

Claude Code deletes session transcripts older than cleanupPeriodDays when it starts. The default is 30 days. It is documented behaviour, not a bug — and nothing announces it, so the first sign is usually a --resume that cannot find the conversation.

Where are Claude Code sessions stored?

In ~/.claude/projects/, one folder per working directory. Each session is a <session-id>.jsonl transcript, often with a folder of the same name beside it holding subagent transcripts and saved tool output. See the oldest one you still have:
copy
$find ~/.claude/projects -name '*.jsonl' -exec stat -f '%Sm %N' -t '%Y-%m-%d' {} + | sort | head -3

Can I get a deleted Claude Code session back?

Only if something copied it before the deletion. Claude Code keeps no trash. brain-mcp exists for exactly this: it records every session — transcript and folder — byte-exact as you work, and brain-mcp restore <id> writes a deleted one back where claude --resume <id> finds it. A session deleted before brain-mcp was installed cannot be recovered by it.

How do I stop it happening?

Two independent ways. Raise cleanupPeriodDays in your Claude Code settings so fewer sessions age out — that changes the clock but keeps one copy, on one machine. Or record them somewhere you control: brain-mcp keeps an append-only, sha256-manifested copy under ~/.brain, searchable from any MCP client, with no network and no account.

How do I know what was deleted?

brain-mcp health carries a receipt: which sessions are gone from where Claude Code kept them, and that the recorded copy still matches the hashes taken when it was captured. A copy that no longer matches is reported as unverified, never as fine.

Install

copy
$pipx install brain-mcp
$brain-mcp install cc