[BUG]Session retention cleanup deletes transcripts well before documented 30-day default (VS Code extension)

Status Open
Reported on v2.1.227
Maintainer reply None cached
Activity 0 comments · opened Aug 28, 2026

Preflight Checklist

  • [x] I have searched existing issues and this hasn't been reported yet
  • [x] This is a single bug report (please file separate reports for different bugs)
  • [x] I am using the latest version of Claude Code

What's Wrong?

Environment:

  • Interface: Claude Code VS Code extension
  • OS: Windows (AzureAD-joined machine, based on file ownership)
  • Project: eks-airflow (mapped to ~/.claude/projects/c--Code-eks-airflow/)

Settings (~/.claude/settings.json):

{
  "autoUpdatesChannel": "latest",
  "theme": "dark"
}

cleanupPeriodDays is not set, so the documented 30-day default should apply.

Observed behavior:
As of 2026-08-28, the oldest surviving session transcript in the project folder is dated 2026-08-19 — exactly 9 days old. The Session History panel in the VS Code extension only shows sessions back to that same date. No transcripts older than 9 days exist on disk; they appear to have been silently deleted.

Expected behavior:
With no cleanupPeriodDays override, sessions up to 30 days old should be retained, per documentation.

Evidence:
ls -la output of the project's session directory shows all remaining .jsonl files dated between 2026-08-19 and 2026-08-28, with no gaps or older files present. Directory itself was created 2026-07-28, so earlier sessions definitely existed and were removed by cleanup, not simply never created.

Impact:
Lost ability to resume, search, or review conversations older than 9 days, despite no explicit configuration requesting that shorter window. No warning, confirmation, or recovery option was presented before deletion.

Additional context:
This appears to match a previously reported issue (#59248) describing the same discrepancy between documented and observed retention behavior.

Suggested fix / ask:

  • Confirm whether cleanupPeriodDays has an undocumented fallback that can trigger a shorter window than 30 days when the setting is absent.
  • Surface the effective retention period and next cleanup time in the UI so users aren't surprised by silent deletion.
  • Consider a soft-delete/trash period before permanent removal.

What Should Happen?

With cleanupPeriodDays not set in settings.json, session transcripts should be retained for 30 days (the documented default). Sessions from the last 30 days should remain visible in Session History and present on disk in ~/.claude/projects/.

Error Messages/Logs

Steps to Reproduce

  • Use Claude Code in VS Code on a project for 20+ days, generating sessions regularly.
  • Do not set cleanupPeriodDays in ~/.claude/settings.json (leave it absent, so the documented 30-day default should apply).
  • After ~9-10 days, open Session History in the VS Code extension, or list files in ~/.claude/projects/<project-folder>/.
  • Observe that sessions older than ~9 days are missing from both the UI and disk, despite the 30-day default.

Claude Model

None

Is this a regression?

I don't know

Last Working Version

_No response_

Claude Code Version

2.1.227

Platform

Anthropic API

Operating System

Windows

Terminal/Shell

VS Code integrated terminal

Additional Information

_No response_

View original on GitHub ↗