Claude Code deletes local coding sessions after 30 days
Coding agent session histories contain valuable data on failed attempts, cost drivers, and correction patterns, but they are often ephemeral. The author argues that these transcripts are essential for debugging agent behavior and auditing billing, yet they face automatic deletion. Claude Code’s default settings remove local session records older than 30 days, including tool calls and results. If…
Key points
- Claude Code automatically deletes local session files older than 30 days by default.
- Session transcripts reveal cost drivers and failure patterns that final diffs hide.
- Users can extend Claude Code retention to 365 days via settings.json.
The article highlights specific cases where session data revealed issues that metrics alone missed. For instance, a benchmark attempt cost 9x more than baseline due to a plugin rewriting commands, a detail only visible in the trajectory. Similarly, LangChain improved its agent’s pass rate from 52.8% to 66.5% by analyzing session logs to fix repeated failures. The author also notes that forgotten model configurations, such as using an older model version, can skew usage data and costs.
To prevent data loss, the author recommends backing up session files to off-device storage. For Claude Code users, changing the cleanupPeriodDays setting to 365 in settings.json can extend retention, though independent backups are still necessary to guard against accidental deletion or hardware failure. The post includes specific file paths for macOS, Linux, and Windows to help users locate and secure these records.
Your agentic coding sessions are a treasure
kotrys.dev · 2 November 2026
Loading the full article…
This text was published by kotrys.dev and written by Bartosz Kotrys. It is reproduced here with attribution so you can read it in full; the rights remain with the publisher. Read it at the source ↗
Coverage and discussion
1source- Reddit discussionreddit.com
The headline, key points and digest above were generated by Digest AI's editorial model from the linked sources. Automated summaries can contain errors: the sources are the record. Spotted a mistake? Tell us. Published by Martin K., who runs Digest AI and handles corrections.
More in Agents & Tools
All →- Nvidia and AMD back $6B AI startup Hark to challenge Grok · 1 src
- Sierra integrates Ghostwriter into Agent Studio workflows · 1 src
- Anthropic adds message threads to Claude Platform for faster agent responses · 1 src
- Claude Code automates tasks by managing 5 AI subordinates for executives · 2 src
- Qodo launches Codex plugin to add org context to AI code review · 1 src
Comments
via GitHub Discussions