Don't let Claude Code delete your session logs

AI-generated summary of reporting by Simon Willison’s Weblog. Read the original for the full story.

Why it matters

Claude Code silently deletes your local session logs after 30 days unless you change one setting.

Read this as

Claude Code is a programming assistant from Anthropic that runs on your computer. It secretly saves a full record of your conversations as files on your machine, but it deletes those files after 30 days by default and this cannot be switched off. The author says you can delay the deletion for 274 years by adding one line to a settings file. This affects anyone who uses Claude Code and wants to keep their history.

Anthropic's Claude Code coding agent automatically purges local session logs after 30 days by default, and this behavior cannot be fully disabled, a data-retention risk for teams relying on those logs for audits or documentation. The only mitigation is editing ~/.claude/settings.json to set cleanupPeriodDays to 99999, delaying deletion for roughly 274 years. The author's own logs totaled 379MB. Engineering teams should apply this setting now.

Claude Code writes full session transcripts as newline-delimited JSON to ~/.claude/projects/encoded-directory/*.jsonl; the author had 379MB accumulated. The known GitHub issue 4172 documents that these files are deleted after 30 days by default via the cleanupPeriodDays setting, which cannot be disabled entirely, maximum practical mitigation is 99999 days (~274 years) in ~/.claude/settings.json. The author also published a Python converter (claude_to_markdown.py) that transforms jsonl logs into readable Markdown.

Read the original

This summary exists to save you time, not to replace the source.

Key terms

Claude Code Anthropic Simon Willison Deepseek-OCR NVIDIA Spark GitHub

Was this summary useful?

One click, anonymous. It tells us which summaries to re-run.

Related reading