← All writing

Claude Code deletes your chats after 30 days

I thought all the golden eggs of my thinking were safely stashed away. Turns out Claude Code smashes them after 30 days 🥚💥

Yesterday I wanted to fine-tune how I work. So I ran a prompt that goes through my old Claude Code conversations and digs out the problems and dilemmas that keep coming back.

It only found the last 30 days.

I’ve been talking to Claude Code since spring about pretty much everything: technical stuff, business stuff, whatever came up. I was sure I had a big pile of good material sitting there.

Nope.

The integrations hurt the most, MCP servers and the like. I spent a lot of time troubleshooting those, and the fixes still work. But if I ever have to set one up again, I won’t remember what the actual problem was, so I’m starting from zero. With the history I could just say “last time it was X and Y” and move on. I’ve got a fine ADHD streak, and hitting the same problem over and over really gets under my skin.

So if you assumed your machine keeps a log of every conversation and every fix you found in it, I assumed exactly the same. It doesn’t.

By default, Claude Code deletes conversations older than 30 days every time it starts. It doesn’t warn you, and you can’t get them back.

The fix

Luckily there’s an easy one 🛠️

  1. Go to the .claude folder in your home directory (~/.claude on a Mac). The dot at the start of the name means the folder is hidden. In Finder, Cmd + Shift + . shows hidden files.
  2. Open settings.json in that folder, so ~/.claude/settings.json. If the file isn’t there, create it.
  3. Add the cleanupPeriodDays setting:
{
  "cleanupPeriodDays": 36500
}

The setting isn’t in the file to begin with. With the default settings it doesn’t show up at all, so you have to add it yourself.

If your settings.json already has other settings in it, add the line inside the existing braces and put a comma after the setting before it, like this (a LinkedIn commenter rightly pointed that out):

{
  "model": "opus",
  "cleanupPeriodDays": 36500
}

36,500 days is roughly a hundred years, and keeping the chats barely uses any disk space.

I only switched this on yesterday, so I’m still testing it. If you know more about this than I do, tell me on LinkedIn.


Originally posted in Finnish on LinkedIn.