Local transcript deletion (30-day TTL) should be configurable independently of data sharing

Status Fixed / completed
Reported on v2.1.161
Maintainer reply ✓ Yes — bcherny
Activity 3 comments · opened Jun 3, 2026 · closed Aug 17, 2026
💡 Likely answer: A maintainer (bcherny, collaborator) responded on this thread — see the highlighted reply below.

Problem

Claude Code silently deletes local session transcripts after 30 days with no way to opt out short of enabling \"Help improve Claude\" (which shares data with Anthropic for training). These are two completely separate concerns — local storage lifetime and data sharing consent — but they're currently coupled.

The only mention of this behavior is buried in the privacy dialog: \"Turning it OFF keeps the default 30-day data retention.\"

Why this matters

Session transcripts are valuable for iterative workflows. They let you:

  • Review how a previous session solved a similar problem
  • Feed prior context into a new session
  • Build autonomous/agentic sessions that learn from past patterns
  • Audit what was done and why

A 30-day silent purge makes all of this impossible to rely on. I discovered the deletion only after noticing that 5+ weeks of sessions were missing — no warning, no config knob, no escape hatch.

What I want

A settings.json key to control local transcript retention independently of the training opt-in:

{
  "transcriptRetentionDays": -1
}

Where -1 (or null) means keep forever. The data-sharing preference should remain separate.

Current workaround

Hardlinking transcripts out of ~/.claude/projects/ via a daily systemd timer — but this is fragile and shouldn't be necessary.

Environment

  • Claude Code 2.1.161
  • Linux

View original on GitHub ↗

3 Comments

BobbinFortnox · 4 months ago

@kehansama this sounds like an ad.

bcherny collaborator · 1 month ago

Local transcript retention is already configurable on its own, separately from the data-sharing preference. Add cleanupPeriodDays to your settings.json:

{ "cleanupPeriodDays": 36500 }

The default is 30 days and the minimum is 1; set it as high as you like to effectively keep transcripts forever. It applies to session files and other application data under ~/.claude/. Details: https://code.claude.com/docs/en/settings and https://code.claude.com/docs/en/claude-directory#cleaned-up-automatically

🤖 Generated with Claude Code

github-actions[bot] · 8 days ago

This issue has been automatically locked since it was closed and has not had any activity for 7 days. If you're experiencing a similar issue, please file a new issue and reference this one if it's relevant.