Claude Code Auto-Deletes Local Session History After 30 Days
Anthropic's terminal-based coding agent removes old transcripts by default, sparking debate over user data ownership.
Claude Code, Anthropic's terminal-based agentic coding tool, automatically deletes local session transcripts stored on users' devices after 30 days—a design choice that has drawn criticism from developers who argue software should not silently remove data from a user's own hardware.
The cleanup routine runs when Claude Code starts up, removing .jsonl transcript files stored under ~/.claude/projects/ that exceed the configured retention threshold. Deleted records include the reasoning trail from coding sessions—design discussions, debugging context, and analysis—but not the user's actual code or git history.
Anthropic has defended the policy as a security measure. Because transcripts are stored in plaintext, they may contain sensitive information such as credentials or proprietary source code. A company spokesperson told The Register that the 30-day erasure policy has been part of Claude Code's design since launch, contradicting claims circulating on Hacker News that the behavior was recently introduced.
The retention period is user-configurable via the cleanupPeriodDays setting in settings.json. Users can extend storage to 90 days, a year, or longer by adjusting the value.
Critics argue the silent nature of the deletion—without explicit warnings before purging—violates user trust. "Anthropic should not be deleting your data on your own device," wrote Hacker News user espeed in a top-voted comment on the discussion thread.
The controversy highlights a broader tension in local-first AI tooling: balancing convenience and security against user agency. Unlike cloud-based LLM interfaces, Claude Code operates directly on the user's filesystem to perform tasks like writing tests, fixing lint errors, and managing dependencies. This local access generates significant session data, which Anthropic says necessitates automatic cleanup to prevent excessive disk consumption.
Some users have reported edge cases where active sessions may be incorrectly deleted if file modification times are altered by sync tools or system restores, though Anthropic has not independently confirmed these reports.
For developers who rely on session history for auditing or long-term project tracking, the recommended workaround is to increase cleanupPeriodDays or implement external backup routines for the ~/.claude/projects/ directory.