My AI Coding History Vanished? Understanding Claude Code's 30-Day Deletion Rule

Graphic visualizing coding records disappearing from a computer screen
AI Summary

Claude Code deletes chat history older than 30 days by default, but users can change this setting to prevent data loss.

Imagine this: You are trying to find a log because you cannot recall a complex code logic you worked hard to build with AI last month. When you go to check, the most crucial chat records have completely vanished. While it is a frustrating situation, it may actually be the result of your tool faithfully doing its “job.”

Recently, complaints have surfaced among developers that chat history in the AI coding tool Claude Code is being deleted without warning. Source: Claude Code users complain their chat records are being mysteriously wiped out Why is this happening?

Why is this important?

For developers, past chat records hold more value than mere text. They are critical assets containing the flow of thought shared with AI, traces of resolved bugs, and the project’s context (information referenced by the AI to understand the conversation). When these records disappear without notice, it creates inefficiencies as developers must solve the same problems again. For those working on team projects or performing long-term development, data retention policies are directly linked to work continuity.

Easy to Understand: The ‘Automatic Janitor’ Inside AI

Why are the records disappearing? Simply put, there is a kind of ‘automatic janitor’ program embedded within Claude Code. [Source: Claude Code Deletes Chat History After 30 Days by Default, Without Warning nowosci.ai/en](https://nowosci.ai/en/article/claude-code-deletes-chat-history-without-warning)

The identity of this janitor is an option in the configuration file called cleanupPeriodDays (the waiting period for automatic deletion). The default value is set to ‘30’, and every time Claude Code is started, this program runs to identify and immediately delete chat log files older than 30 days. Source: Claude Code users complain their chat records are being mysteriously wiped out

AD
Metaphorically, it is like a cleaning company coming to your house every morning and taking away all newspapers or notes older than 30 days. Your house might become tidy, but it would be a different story if those notes contained the core ideas for your project. The problem is that this ‘cleaning’ rule is not sufficiently communicated to the user during the installation process. [Source: Claude Code Deletes Chat History After 30 Days by Default, Without Warning nowosci.ai/en](https://nowosci.ai/en/article/claude-code-deletes-chat-history-without-warning)

Current Situation

Many users are realizing this only after their precious coding chat records have disappeared, leading to confusion. [Source: I investigated the storage location and retention period (cleanupPeriodDays) of Claude Code conversation history DevelopersIO](https://dev.classmethod.jp/en/articles/claude-code-conversation-history-retention/)
Fortunately, there is a way to prevent this. It can be solved by modifying the settings.json configuration file. By changing the cleanupPeriodDays setting to a very large number, you can prevent records from being automatically deleted. For example, setting it to 3,650 would allow you to keep records for about 10 years. Source: [BUG] Claude Code silently deletes conversation transcripts after 30 days by default · Issue #62476 · anthropics/claude-code Many users are sharing this method through communities to protect their data. [Source: Claude Code deletes conversations after 30 days Hacker News](https://news.ycombinator.com/item?id=48802300)

What happens next?

AI tools are expected to introduce clearer data management methods in the future to improve user experience (UX). Currently, requests are being made through GitHub issues and other channels to improve the interface so that, instead of simply deleting records, data is moved to a trash folder or users can more easily control deletion features. Source: [BUG] Claude Code silently deletes conversation transcripts after 30 days by default · Issue #62476 · anthropics/claude-code

When using AI tools, we need the wisdom to examine what the hidden settings behind their convenience actually mean. Preserving records is not just about storage; it is about protecting our workflow and precious ideas.

MindTickleBytes’ AI Reporter’s Perspective

Technology is a powerful tool to assist our work, but if you do not know how that tool handles your data, you may face unexpected inconveniences. To use smart AI while remaining the complete owner of your records, you must now develop the habit of carefully checking the ‘settings’ menu when adopting new tools.

References

  1. Claude Code users complain their chat records are being mysteriously wiped out
  2. [Claude Code Deletes Chat History After 30 Days by Default, Without Warning nowosci.ai/en](https://nowosci.ai/en/article/claude-code-deletes-chat-history-without-warning)
  3. Claude Code History: Where It’s Stored & How to Restore It
  4. [Claude Code deletes conversations after 30 days Hacker News](https://news.ycombinator.com/item?id=48802300)
  5. [I investigated the storage location and retention period (cleanupPeriodDays) of Claude Code conversation history DevelopersIO](https://dev.classmethod.jp/en/articles/claude-code-conversation-history-retention/)
  6. [BUG] Claude Code silently deletes conversation transcripts after 30 days by default · Issue #62476 · anthropics/claude-code
AD
Test Your Understanding
Q1. What is the default retention period after which Claude Code deletes chat history?
  • 7 days
  • 30 days
  • 1 year
Claude Code automatically deletes chat history that is more than 30 days old by default.
Q2. Which file should you modify to prevent the automatic deletion of chat history?
  • settings.json
  • config.py
  • main.js
You can adjust the cleanupPeriodDays value in the settings.json user configuration file to increase the retention period.
Q3. When does the record deletion occur?
  • Every midnight
  • Every time Claude Code is started
  • Once a week
This deletion mechanism is triggered every time Claude Code is started.
My AI Coding History Vanish...
0:00