Shabash
Blog · Claude Code guides

Does Claude Code delete your old sessions?

Short answer

Yes. Outside the Claude desktop app, it deletes a session's transcript once it's more than 30 days old, and 820 of my 920 sessions since January had lost theirs by September 27. Add "cleanupPeriodDays": 3650 to ~/.claude/settings.json to keep them for ten years.

By Robin Mehta · October 1, 2026

I counted my Claude Code sessions since January: 920 of them, almost 800 hours of hands-on work. Then I looked for the conversations behind them, and 820 were gone. That's wild!

For those 820, Claude Code kept only the prompts I typed. Claude's replies, the files it read, the commands it ran and the dead ends are gone, and claude --resume can't open them unless you kept a copy of the transcript somewhere else.

Claude Code's 30-day cleanup

Claude Code deletes a session's transcript once it's older than cleanupPeriodDays, and the default is 30. Sessions started or last continued in Claude Desktop or Cowork are the exception: since v2.1.248 they're kept at any age. The transcript is the file ~/.claude/projects/<project>/<session>.jsonl, with every message, tool call and result in it. The cleanup runs in the background after a session starts (settings reference, Claude Code docs).

So my own new sessions quietly deleted every transcript older than 30 days. On September 27, only 100 of my 920 sessions still had a transcript, and 98 of those were from the last month.

The 30-day cleanup never touches ~/.claude/history.jsonl. It keeps every prompt you've typed in the terminal, with the time, the project folder and the session. That's why I could still count all 920 sessions and time them, but it only has my side of each conversation.

Keep transcripts for ten years with cleanupPeriodDays

The lazy developer edition is one line of settings. Do it before your next session, because that's when the next cleanup runs.

  1. Paste this into Terminal. It adds "cleanupPeriodDays": 3650 to ~/.claude/settings.json, keeps any settings already there, and creates the file if it's missing:

    f=~/.claude/settings.json; [ -f "$f" ] || echo '{}' > "$f"; jq '.cleanupPeriodDays = 3650' "$f" > "$f.tmp" && mv "$f.tmp" "$f"

    It uses jq, which recent versions of macOS include at /usr/bin/jq. If jq --version says command not found, run brew install jq, or edit the file by hand. The line goes inside the outer braces:

    {
      "cleanupPeriodDays": 3650
    }
  2. Start Claude Code and check the setting took:

    /status

    If Claude Code can't read your settings file or finds an error in it, a warning shows here. The cleanup pauses until you fix it (docs).

3650 days is ten years. You can't set 0 to mean "never": the minimum is 1, and 0 fails validation (settings reference).

Deleted transcripts stay deleted

The setting only stops future deletes. It can't bring back anything the cleanup already took, which for me was more than 800 sessions. Other things it doesn't cover:

Shabash keeps a copy of each transcript

Shabash, the Mac app I'm building, saves a compressed copy of each Claude Code transcript in ~/.shabash/archive before the cleanup can take it. When you resume a session from Shabash and its transcript is gone, Shabash puts the copy back first, so claude --resume opens it again.

It only started keeping copies on September 25, two days before I counted, so it saved 11 of my 820. The other 809 are gone for good.

785 hours in 920 sessions

I counted from history.jsonl, since it's the one file that goes back to my first prompt. It covers January 10 to September 25, in more than 20 project folders. I counted a session if I typed at least one real prompt in it, so I left out 36 where I only ran a command like /clear.

Hours are hands-on time. After each prompt, I counted the minutes until my next prompt in any session, so five sessions open at once don't count five times. If my next prompt came more than 15 minutes later, I counted that as a break. I can't tell how long I really spent on the prompt before a break, so it gets a flat 4 minutes.

Sessions920
Hands-on hours785
Median session18 minutes, 7 prompts
Sessions over two hours102
Longest sessionabout 14½ hours
Most sessions I typed into within 15 minutes11
Sessions with a transcript left on September 27100

785 hours is almost 20 full work weeks! You can count your hours the same way: drop your history.jsonl into this free page. It reads the file in your browser and uploads nothing.

The page counts up to the moment you load it, and it includes the sessions where you only typed a command. When I loaded it late on September 27, it showed 801 hours in 980 sessions: the same method, plus September 26 and 27.

Questions

How long is a typical Claude Code session?

In my history, the median session was 18 minutes of hands-on time and 7 prompts. About one in ten ran past two hours, and the longest was about 14½ hours.

How many Claude Code sessions can you run at once?

In my history, at most 11: that many different sessions got a prompt from me inside one 15-minute window.

Can I get a deleted Claude Code session back?

Only if you kept a copy somewhere else. Raising cleanupPeriodDays stops future deletes, but it can't restore transcripts the cleanup already removed.

Is my prompt history deleted too?

No. ~/.claude/history.jsonl, which keeps every prompt you typed in the terminal, isn't part of the cleanup. You keep what you asked, but not Claude's answers or what it did.