Correction, October 13: Desktop and Cowork transcript exemptions require Claude Code v2.1.248 or later and do not apply when managed retention settings or the HIPAA configuration impose the ordinary limit.
Claude Code normally saves local session transcripts on your computer. That record is how you resume an old conversation and how you find out why the agent made a change three weeks ago. By default, it does not last long.
According to Anthropic’s data usage docs, Claude Code stores session transcripts locally, in plaintext, under ~/.claude/projects/ for 30 days by default. The docs say you can adjust that period with a setting called cleanupPeriodDays. A transcript is the full text of the conversation, including your prompts, the agent’s replies, and what it ran.
Sessions may disappear after a month
If you build with Claude Code over weeks, the history you rely on is on a timer. After the period ends, older sessions are cleaned up. A session you hoped to resume next month may not be there.
Anthropic’s application-data documentation lists an exception in Claude Code v2.1.248 and later. Transcripts of sessions started or most recently continued in Claude Desktop or Cowork are exempt by default. Earlier versions apply cleanupPeriodDays to them too.
The ordinary limit also applies when managed settings specify cleanupPeriodDays, or when the HIPAA configuration applies to the session. HIPAA settings support organizations handling regulated health information.
The settings reference describes cleanupPeriodDays as how many days Claude Code keeps transcripts before deleting them. It also lists a separate desktopSessionCleanupPeriodDays setting, which puts an age limit on the Desktop and Cowork transcripts.
Longer retention keeps plaintext on disk
Keeping history longer is not free. The docs say these files are plaintext, meaning anyone or any program that can read your user folder can read them. That includes anything that ever appeared in a session. If you pasted an API key or a customer’s email into a prompt, or the agent printed a secret from a config file, it can sit in those files for as long as you keep them.
So the choice is a tradeoff. A short period limits how much sensitive text piles up on disk. A long period protects your ability to look back. The right answer depends on what you paste into sessions and whether anyone else uses your machine or backs it up.
Extending retention keeps existing files eligible for longer storage. It cannot restore transcripts that have already been deleted.
What to do next
- Open your Claude Code settings file at
~/.claude/settings.jsonand look forcleanupPeriodDays. The default is 30 days, but a value in project or managed settings can override your user setting. Check those sources before assuming which limit applies. - Decide what you need. If you only resume sessions within a couple of weeks, leave it. If you use old sessions as a project diary, add a longer value, for example
"cleanupPeriodDays": 90. - Check the result. Open
/resumein Claude Code and see how far back your sessions go. Then look again in a week to confirm nothing you wanted has dropped off. - Keep secrets out of prompts and tool output. Environment variables can supply credentials to software, but a tool that reads or prints them can still put them in a transcript.
- If your organization manages Claude Code settings, confirm which value applies before editing the local file.
If you need a permanent record of a decision, do not rely on the transcript at all. Ask the agent to write the reasoning into a file in your project, such as a short notes document, and commit it. Review the notes for sensitive data before committing them to Git, which stores the file’s change history.
End of article