Disable auto-deletion of past conversations

Status Fixed / completed
Maintainer reply None cached
Activity 4 comments · opened Jul 22, 2025 · closed Aug 16, 2025

Claude Code retains its history of conversations in ~/.claude/projects/xxx. However, when reviewing the diffs of a backup, I realized that it's silently deleting old conversations - it seems like after 30 days.

I definitely never opted into automatic data deletion, nor was I prompted to approve data deletion, nor can I find a way to disable this silent deletion of my conversation data.

How can it be disabled?

View original on GitHub ↗

4 Comments

Kansai53 · 1 year ago

Same issue, it's deleting conversation data without permission. How to disable?

coygeek · 1 year ago

This is correct. Claude Code has a default setting to automatically clean up local conversation history after 30 days.

You can disable this behavior by configuring the cleanupPeriodDays setting in your settings.json file. To apply this setting globally for your user, create or edit the file at ~/.claude/settings.json.

To effectively disable auto-deletion, you can set the cleanup period to a very large number of days. For example, add the following to your ~/.claude/settings.json file:

{
  "cleanupPeriodDays": 99999
}

This setting is documented on the Claude Code settings page, which states:

cleanupPeriodDays: How long to locally retain chat transcripts based on last activity date (default: 30 days)

The Data usage page also mentions this behavior:

Users' local Claude Code clients may store sessions locally for up to 30 days so that users can resume them. This behavior is configurable.

Setting a high value for cleanupPeriodDays will ensure your local conversation history is retained for as long as you need.

JGKle · 1 year ago

Ah perfect, thanks! I tried looking in /config, and also googling for "claude code retention settings", but every result it turned up was about Anthropic data retention. Somehow that didn't come up.

Closing :)

github-actions[bot] · 1 year 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.