Why your Claude Code chat history disappears after 30 days
Claude Code keeps every chat as a file on your computer, and by default it deletes the files that are older than 30 days when it starts. One setting keeps them for as long as you want.
The fix: raise cleanupPeriodDays
Open ~/.claude/settings.json (on Windows, %USERPROFILE%\.claude\settings.json) and set a larger number of days. For about ten years:
{
"cleanupPeriodDays": 3650
}
The default is 30 days and the smallest value is 1, so 0 does not turn the cleanup off: pick a large number instead. If your organisation manages your Claude Code settings, its value wins over yours. The setting is described in Claude Code's settings reference.
Chats that were already deleted cannot be brought back by this setting, or by any tool on this page. It protects the chats you have now.
Where the chats are
Each project has a folder, and each chat is one .jsonl file in it:
~/.claude/projects/<project>/<session>.jsonl
On Windows that is %USERPROFILE%\.claude\projects. Copying the projects folder somewhere else is a complete backup.
Read or export a chat as Markdown
Axyome Lite is free and open source (MIT), needs no account, and only reads these files. From a terminal:
npx axyome-lite list --assistant claude
npx axyome-lite export <id> -o chat.md
In VS Code, the Axyome Lite extension shows the same chats in the Explorer. The source is on GitHub, and the command-line tool is on npm.
Search every session, not only the chat
Axyome XM records your Claude Code sessions in its own database on your computer as you work, together with the files, errors and terminal commands around them, and lets you and your assistant search them. The Free plan shows the last 30 days; Pro shows all of it.
The facts in one table
| Question | Answer |
|---|---|
| Setting | cleanupPeriodDays in ~/.claude/settings.json |
| Default | 30 days |
| Smallest value | 1 (0 is not accepted) |
| When old chats are removed | When Claude Code starts |
| Where chats are kept | ~/.claude/projects/<project>/<session>.jsonl |
| Source | Claude Code settings reference |
Checked against Claude Code's documentation on 28 November 2026. See also: where every AI assistant keeps its chats and Copilot chat history.