anthropics / anthropics/claude-code
Session .jsonl transcript silently deleted while session folder remains — deletion pattern doesn't match simple age-based retention
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 147k
- Forks
- 24k
- PR merge metrics
- PR metrics pending
Description
Summary
Session transcripts (~/.claude/projects/<project>/<uuid>.jsonl) disappear from disk while the session's auxiliary directory (~/.claude/projects/<project>/<uuid>/tool-results/, which caches SessionStart hook output) remains intact. This affects real, substantial interactive conversations — not just short/automated sessions — and the temporal pattern does not match a simple age-based retention sweep.
Environment
- Claude Code CLI: 2.1.272 (native binary,
/joao/.local/bin/claude) - Claude Code VS Code extension (code-server): 2.1.276
- OS: Ubuntu 24.04.4 LTS, self-hosted VPS
cleanupPeriodDaysis not set in either~/.claude/settings.jsonor~/.claude.jsonfileCheckpointingEnabled: true(used only for/rewind, per docs — confirmed not related)
Observed behavior (measured directly on disk)
Across multiple project directories under ~/.claude/projects/, most session folders (identified by a valid UUID) no longer have their companion .jsonl transcript, while the folder itself — and its tool-results/ cache from the SessionStart hook — still exists:
| Project | Session folders | Live .jsonl |
Folders without .jsonl |
|---|---|---|---|
| Project A | 75 | 16 | 65 |
| Project B | 199 | 57 | 152 |
| Project C | 118 | 80 | 41 |
I cross-referenced this against a separate local database (a memory plugin that records content_session_id + started_at + first user prompt for every session that ever ran) to distinguish two very different situations:
- Automated/non-interactive sessions (skill runs triggered by cron, autonomous sub-agent task executions, git-worktree sessions) — most of the missing-transcript count falls here (e.g. 163 of 218 in one project). This may be expected/acceptable.
- Real interactive human conversations with substantial content — a smaller but recurring subset. Example: a session that ran for ~8 minutes, produced 11 distinct pieces of work (document analysis, calendar events created, files edited), and both its
.jsonland its folder are now completely gone — no trace at all on disk, not even thetool-results/cache. This is a different, more severe symptom than "folder survives, only.jsonlis missing."
What I ruled out
- No cron/systemd timer or user script touches
~/.claude/projects/on this machine (verified: crontab, systemd timers,grep -racross all local scripts). - Not the documented
/compactbehavior: found a liveisCompactSummary: trueentry inside a transcript that survived — it uses the samesessionId, appended within the same.jsonlfile. Compaction does not create a new file or delete the old one. - Not a VM reboot:
last rebootshows uptime since 2026-08-20, no reboot around the dates the deletions occurred. - Not a simple age-based sweep relative to "today": in one project, a session from yesterday has already lost its
.jsonl, while a session from 29 days ago still has its.jsonlintact. This directly contradicts "delete anything older than N days, checked against today's date."
What's unclear from the docs
settings.json reference documents cleanupPeriodDays only as "control how many days Claude Code retains transcripts before automatic deletion" — it doesn't state the default value when the key is absent, nor how to disable the sweep entirely, nor whether the sweep trigger is time-based (a periodic check) or event-based (e.g. only evaluated when a new session starts in that same project directory — which would better explain why deletions cluster in bursts rather than following a smooth daily pattern).
Question
- What is the actual default retention period when
cleanupPeriodDaysis unset? - Is there a way to fully disable transcript deletion (not just increase the number of days)?
- Why would a session's
.jsonlbe deleted while itstool-results/folder (or, in the more severe case, the entire session folder) is not touched by the same sweep — and in the severe case, why would a real, substantial, non-trivial interactive session be eligible for deletion at all after only ~6 weeks?
Happy to provide more specific session IDs/timestamps privately if useful for debugging — omitted here since this repo is public and some of that data touches personal projects.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by checking ~/.claude/settings.json and ~/.claude.json, then reproduce transcript cleanup while comparing .jsonl files, session folders, and tool-results/ directories under ~/.claude/projects/. Determine the unset cleanupPeriodDays behavior, whether deletion can be disabled, and why transcripts or complete session folders are selected; done means documenting or fixing each observed case.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- cli
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Active
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100