You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Setting cleanupPeriodDays: 0 in settings.json completely prevents session transcripts (.jsonl files) from being written to disk. The schema documentation says 0 means "disable cleanup" (i.e., retain transcripts forever), but the actual behavior is "disable all transcript persistence."
Expected Behavior
Per the settings schema:
"Number of days to retain chat transcripts (0 to disable cleanup)"
Setting cleanupPeriodDays: 0 should mean "never clean up old transcripts" — transcripts should still be written and retained indefinitely.
Actual Behavior
The appendEntry method in the session storage writer has a guard clause that checks cleanupPeriodDays:
asyncappendEntry(T,R=getSessionId()){letA=process.env.TEST_ENABLE_SESSION_PERSISTENCE==="true";if(getEnv()==="test"&&!A||getSettings()?.cleanupPeriodDays===0||isSessionPersistenceDisabled())return;// ... write logic never reached}
When cleanupPeriodDays === 0, the function returns immediately without writing any transcript data. This means:
No .jsonl transcript files are created
/resume reports "No conversations found"
SessionEnd hooks receive an empty transcript_path (the file doesn't exist)
All session history is permanently lost
The cleanup function correctly treats 0 as "don't clean up":
functioncleanup(){letretentionMs=((getSettings()||{}).cleanupPeriodDays??DEFAULT_DAYS)*24*60*60*1000;// When 0, retentionMs = 0, effectively meaning nothing is old enough to delete}
But appendEntry incorrectly uses the same field as a persistence toggle.
Impact
Users who set cleanupPeriodDays: 0 intending to keep transcripts forever actually lose all transcripts
The data loss is silent — no warning, no error, no log
Steps to Reproduce
Add "cleanupPeriodDays": 0 to ~/.claude/settings.json
Start a new Claude Code session
Have a conversation
Exit the session
Check ~/.claude/projects/{project}/ — no .jsonl file exists
Run /resume — "No conversations found"
Suggested Fix
Remove the cleanupPeriodDays === 0 check from appendEntry. The cleanup period should only affect the cleanup/retention logic, not the write path:
// Before (broken):if(getEnv()==="test"&&!A||getSettings()?.cleanupPeriodDays===0||isSessionPersistenceDisabled())return;// After (fixed):if(getEnv()==="test"&&!A||isSessionPersistenceDisabled())return;
Description
Setting
cleanupPeriodDays: 0insettings.jsoncompletely prevents session transcripts (.jsonlfiles) from being written to disk. The schema documentation says0means "disable cleanup" (i.e., retain transcripts forever), but the actual behavior is "disable all transcript persistence."Expected Behavior
Per the settings schema:
Setting
cleanupPeriodDays: 0should mean "never clean up old transcripts" — transcripts should still be written and retained indefinitely.Actual Behavior
The
appendEntrymethod in the session storage writer has a guard clause that checkscleanupPeriodDays:When
cleanupPeriodDays === 0, the function returns immediately without writing any transcript data. This means:.jsonltranscript files are created/resumereports "No conversations found"SessionEndhooks receive an emptytranscript_path(the file doesn't exist)The cleanup function correctly treats
0as "don't clean up":But
appendEntryincorrectly uses the same field as a persistence toggle.Impact
cleanupPeriodDays: 0intending to keep transcripts forever actually lose all transcripts/resumebecomes completely non-functionaltranscript_pathget empty/nonexistent paths (related: PreCompact hook receives empty transcript_path #13668)Steps to Reproduce
"cleanupPeriodDays": 0to~/.claude/settings.json~/.claude/projects/{project}/— no.jsonlfile exists/resume— "No conversations found"Suggested Fix
Remove the
cleanupPeriodDays === 0check fromappendEntry. The cleanup period should only affect the cleanup/retention logic, not the write path:Environment
Related Issues