Claude Code

Claude Code deletes history after 30 days. Here is how to keep it

Claude Code removes local session files older than 30 days by default. Raise cleanupPeriodDays, or let UsageAtlas keep your daily usage totals.

Quick answer

Claude Code deletes local session files older than cleanupPeriodDays, which is 30 days by default. Raise that number in settings.json to keep transcripts longer, or install UsageAtlas, which saves a usage total for each finished day and keeps it after the files are gone.

Change cleanupPeriodDays

Add the setting to ~/.claude/settings.json:

{
  "cleanupPeriodDays": 365
}

This keeps full transcripts on disk, including your prompts and code. Make sure you are fine with that before you raise it a lot.

Keep the totals with UsageAtlas

UsageAtlas seals each finished day with its tokens, models, projects, and estimated cost. When Claude Code deletes the session files, those days stay in History. Prompts are never part of what it keeps.

Why it matters

You cannot compare this month with last month, or check what a project cost in spring, from data that no longer exists. See Claude usage last month for that view.

Questions, answered

Where does Claude Code store session history?

Under .claude/projects in your home folder, one file per session.

Can I recover sessions Claude Code already deleted?

No. Once the files are gone, no tool can read them. UsageAtlas only keeps days it saw before the cleanup.

Does UsageAtlas keep my prompts?

No. It keeps daily token counts, models, and estimated cost, not the conversation.

Browse by topic