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
{{ message }}
Repository navigation
Default Claude Code transcript retention to 1 year (cleanupPeriodDays) — 30-day default wipes sessions from the persisted ~/.claude volume #173
Claude Code deletes session transcripts older than cleanupPeriodDays (default 30) every time it starts. The template persists ~/.claude in a named volume, so transcripts survive rebuilds. The 30-day sweep still deletes them, and after a month /resume no longer finds those sessions. The images and templates should default to keeping transcripts for at least a year.
Why it has to be user scope
The cleanup runs at startup and sweeps every project under ~/.claude/projects, not just the current one. Setting cleanupPeriodDays in a project's .claude/settings.json isn't enough: any session started from another directory (a worktree, /tmp, a second repo on the same volume) falls back to 30 days and deletes the old transcripts from every project. The setting has to be in ~/.claude/settings.json (or managed settings).
The CLI's own schema text: "Number of days to retain chat transcripts before automatic cleanup (default: 30). Minimum 1. Use a large value for long retention."
Suggested fix
Set it only when it's missing (//=), so a value a user chose on purpose is kept:
Simpler, but can't be overridden: add "cleanupPeriodDays": 365 to claude-code/.devcontainer/managed-settings.json. Managed settings take precedence over user settings, so users could no longer pick a different value.
init-plugins.sh on its own isn't enough for the default variant, because it's run by hand there.
Summary
Claude Code deletes session transcripts older than
cleanupPeriodDays(default 30) every time it starts. The template persists~/.claudein a named volume, so transcripts survive rebuilds. The 30-day sweep still deletes them, and after a month/resumeno longer finds those sessions. The images and templates should default to keeping transcripts for at least a year.Why it has to be user scope
The cleanup runs at startup and sweeps every project under
~/.claude/projects, not just the current one. SettingcleanupPeriodDaysin a project's.claude/settings.jsonisn't enough: any session started from another directory (a worktree,/tmp, a second repo on the same volume) falls back to 30 days and deletes the old transcripts from every project. The setting has to be in~/.claude/settings.json(or managed settings).Verification
The CLI's own schema text: "Number of days to retain chat transcripts before automatic cleanup (default: 30). Minimum 1. Use a large value for long retention."
Suggested fix
Set it only when it's missing (
//=), so a value a user chose on purpose is kept:Where to put it:
/usr/local/bin/ensure-claude-defaults, chained intopostStartCommandnext to/usr/local/bin/patch-playwright-mcp. It only runsjq, with noclaudeCLI calls, so it doesn't hit the OAuth sign-in race from fix(devcontainer): theme, login, node_modules isolation, self-contained claude-code config #58. It also runs on every start, so existing containers and volumes pick it up.init-plugins.shhas the same "never reaches existing containers" problem as claude-code template: plugins added to init-plugins.sh never reach existing containers unless the script is run by hand #171."cleanupPeriodDays": 365toclaude-code/.devcontainer/managed-settings.json. Managed settings take precedence over user settings, so users could no longer pick a different value.init-plugins.shon its own isn't enough for the default variant, because it's run by hand there.Affected files in this repo
claude-code/.devcontainer/devcontainer.json(postStartCommand)claude-code/.devcontainer/claude-sandbox/devcontainer.json(postStartCommand)claude-code/.devcontainer/Dockerfile(bake the script)claude-code/.devcontainer/managed-settings.json,ralphex-fe/managed-settings.jsonRelated
claudeCLI calls from postCreate race the OAuth sign-ininit-plugins.shchanges don't reach existing containers