claude-code - 💡(How to fix) Fix [BUG] Claude Code silently deletes conversation transcripts after 30 days by default

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…

Error Message

Error Messages/Logs

Fix Action

Fix / Workaround

Workaround for others: add "cleanupPeriodDays": 3650 to ~/.claude/settings.json immediately.

RAW_BUFFERClick to expand / collapse

Preflight Checklist

  • I have searched existing issues and this hasn't been reported yet
  • This is a single bug report (please file separate reports for different bugs)
  • I am using the latest version of Claude Code

What's Wrong?

cleanupPeriodDays defaults to 30, causing Claude Code to silently delete ~/.claude/projects/<project>/<sessionId>.jsonl files older than 30 days on startup. There is no first-run disclosure, no warning before deletion, and the setting is not surfaced in /config. I lost months of conversation history before realizing this was happening.

Repro: Use Claude Code for >30 days without setting cleanupPeriodDays. Old transcripts disappear.

Evidence on my machine: ~/.claude/history.jsonl shows 14 sessions / 1,315 prompts for one project from March–April. Only the current session's .jsonl survives in ~/.claude/projects/. The cutoff matches the 30-day default exactly. My settings.json does not override the default.

Impact: The code and git history remain, but the reasoning trail — design discussions, debugging context, analysis — is gone. For research work that context is the artifact.

What Should Happen?

Requested:

  1. Change the default to non-destructive (disabled, or very long retention).
  2. Disclose at first run; require opt-in for auto-deletion.
  3. Soft-delete to a trash folder instead of unlink().
  4. Surface the setting in /config.

Workaround for others: add "cleanupPeriodDays": 3650 to ~/.claude/settings.json immediately.

Error Messages/Logs

Steps to Reproduce

Use Claude Code for >30 days without setting cleanupPeriodDays. Old transcripts disappear.

Claude Model

None

Is this a regression?

I don't know

Last Working Version

No response

Claude Code Version

2.1.150

Platform

Anthropic API

Operating System

Ubuntu/Debian Linux

Terminal/Shell

Other

Additional Information

No response

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING