Shabash
Blog · Claude Code guides

Why did my Claude Code sessions disappear?

Claude Code deletes session transcripts after 30 days by default. Here's what gets deleted, what survives, how to change the setting, and how to keep every session.

By Robin Mehta · September 25, 2026

You open claude --resume to pick up something from last month, and it isn't there. You didn't delete it. Claude Code did, on purpose, because of a setting most people never see.

The short answer

Claude Code deletes files in its data folder once they are older than cleanupPeriodDays. The default is 30 days. That includes the full transcript of every session, so a session you last touched 31 days ago can no longer be resumed.

What gets deleted, and what doesn't

The cleanup sweep removes these once they pass the age limit, all under ~/.claude:

DeletedWhat it is
projects/<project>/<session>.jsonlThe full transcript: every message, tool call and result
projects/<project>/<session>/subagents/Subagent transcripts
file-history/<session>/Snapshots of files before Claude edited them
plans/Plans written in plan mode
paste-cache/, debug/, tasks/ and a few othersPer-session working files

One file is not cleaned up: ~/.claude/history.jsonl. It holds every prompt you have typed, with a timestamp and the project it belonged to. It's what powers the up arrow and Ctrl+R history search. So even after a transcript is gone, a record of what you asked survives.

How to keep sessions longer

Raise the limit in your user settings file, ~/.claude/settings.json:

{
  "cleanupPeriodDays": 365
}

A few things to know:

How to keep every session, no matter the setting

Claude Code documents a supported way to save transcripts yourself: a SessionEnd hook. Hooks receive a transcript_path field in their input, so a hook that runs when a session ends can copy that file somewhere safe. This is the approach I'd recommend over scanning ~/.claude/projects yourself, because the transcript format is internal to Claude Code and changes between versions. The hook gives you the exact file for each session as it closes.

To bring an archived session back, put the .jsonl file back in its project folder under ~/.claude/projects and run claude --resume <session-id>. You can also pass the full path to a transcript file directly: claude --resume /path/to/<session-id>.jsonl.

Deleting sessions on purpose

If you want the opposite, claude project purge deletes everything Claude Code holds for one project: its transcripts, memory, per-session files, and the matching lines in history.jsonl.

Why this matters more than it used to

When a session was a quick question, losing it after a month didn't matter. Now a session is often days of work on a feature, with every decision and dead end in it. The transcript is the only record of why the code looks the way it does. Keeping it is cheap, and losing it is the kind of thing you only notice when you need it.

That's part of why I built Shabash: it keeps a compressed copy of every session you typed in, organizes them into threads of work per project, and can put a deleted transcript back so a thread from last spring resumes with its full history.

Questions

How long does Claude Code keep sessions?

30 days by default. Transcripts older than cleanupPeriodDays are deleted, and the default is 30.

Can I turn off session cleanup completely?

No. The minimum for cleanupPeriodDays is 1, and setting it to 0 fails validation. Set a large number instead, such as 3650, or archive transcripts yourself with a SessionEnd hook.

Is my prompt history deleted too?

No. ~/.claude/history.jsonl, which holds every prompt you typed with its timestamp and project, is not part of the cleanup. Only the full transcripts and related per-session files are.

Can I get a deleted session back?

Not from Claude Code itself. Once the transcript file is gone, claude --resume can't find it. If you kept a copy, put the file back in its project folder under ~/.claude/projects and resume it by ID.