[BUG] Desktop: local session transcripts grow unbounded and freeze the UI when opening heavy sessions; sidebar "Delete" does not remove transcript files
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: Claude Desktop 1.37937.3 (Windows 11 Home 10.0.26200, x64), bundled Claude Code 2.1.246, 32 GB RAM (~21 GB free while the issue reproduces), 20-core CPU.
Heavy local-session usage (long agentic sessions with hundreds of subagents) degrades the desktop app until typing lags for seconds, even though system memory and CPU are mostly idle. Four compounding behaviors:
- No usable lifecycle policy for local transcripts.
~/.claude/projects/<project>/had grown to 7.9 GB / 5,100+ files across 71 sessions, with transcripts persisting since February. A single finished session held 3.1 GB (84 MB main transcript + 298 subagent transcripts). The only existing mechanism,cleanupPeriodDays(default 30), never swept anything here — notably, old transcripts' mtimes appear to get refreshed in clusters (dozens of.jsonlfrom March–July all sharing the same few minutes of mtime), which would defeat mtime-based cleanup. So in practice nothing ages out, compacts, or archives.
- Opening a heavy session parses tens of MB of JSON on (or blocking) the UI thread. Selecting such a session in the sidebar freezes input for seconds; while it stays open the app feels "about to crash". RAM is not the issue (app tree ~2 GB, 21 GB free) — it is CPU on the interactive path.
- Sidebar "Delete session" removes only the list entry. The
.jsonland the<session-id>/subagents/folder remain on disk, so users who delete heavy sessions to fix the slowdown reclaim nothing, and there is no in-app way to actually free the space. (Deleting the same session from claude.ai web did remove the local transcript — the surfaces behave inconsistently.) Together with #86730 (sidebar advertises sessions whose files were silently deleted), the sidebar and the transcript store are out of sync in both directions: it keeps files for sessions the user deleted, and lists sessions whose files are gone.
- Full transcript rescan at startup — the stats worker walks every transcript file on each launch, which keeps getting slower as sessions accumulate.
Startup log excerpts (%LOCALAPPDATA%\Claude\Logs\main.log, ids redacted):
[warn] [CCD] Session <id> transcript is 84219319 bytes; tail-loading last 52428800 bytes
[warn] [CCD] Session <id>: subagent transcripts exceed the load bounds (33554432 bytes, 256 pending); loaded 5 of 298 (33554432 bytes), 0 pending, skipped 293
[info] [CCD] /stats (worker) scanned 2344/2344 transcript files since 2026-02-26
Impact: persistent input latency and multi-second freezes for a heavy daily user on an idle 32 GB machine. Manually deleting transcript files from disk (after extracting a small text digest) reduced the folder from 7.9 GB to 2.1 GB and restored responsiveness, confirming transcripts as the cause.
Repro sketch: accumulate a few sessions of >500 MB (long agentic runs with many subagents) → restart the app and open one from the sidebar → typing freezes while it loads and the warnings above appear in main.log → delete the session from the sidebar → files remain under ~/.claude/projects/.
Related: #86730 / #87748 (silent mtime-based deletion — the mirror-image lifecycle failure, arguing for an explicit, user-visible retention design rather than the current extremes), #81065 (transcript compression on disk — addresses storage size but not UI-thread loading, lifecycle, or delete behavior).
What Should Happen?
- Transcript lifecycle policy: auto-archive or compact old finished sessions (e.g., after N days keep a digest and compress/offload subagent transcripts), with a retention setting.
- Sidebar delete should free space — or offer a "delete including local files" option and clearly say when files are retained.
- Parse transcripts off the interactive path (worker thread / incremental hydration) so opening a large session never blocks typing.
- Incremental stats indexing instead of a full rescan of every transcript at each launch.
Error Messages/Logs
Steps to Reproduce
- Use the Claude Desktop app for months of heavy agentic work so
~/.claude/projects/<project>/accumulates several sessions larger than 500 MB (long runs with hundreds of subagent transcripts). - Restart the app and open one of those sessions from the sidebar → typing input freezes for seconds while it loads;
%LOCALAPPDATA%\Claude\Logs\main.loglogs thetail-loading/subagent transcripts exceed the load boundswarnings quoted above. - Delete that session from the sidebar → its
.jsonland<session-id>/subagents/folder remain under~/.claude/projects/and no disk space is reclaimed. - Observe startup cost grow with session count:
/stats (worker) scanned 2344/2344 transcript files.
Claude Model
None
Is this a regression?
I don't know
Last Working Version
_No response_
Claude Code Version
2.1.246 (bundled in Claude Desktop 1.37937.3; observed in the desktop app)
Platform
Anthropic API
Operating System
Windows
Terminal/Shell
Other
Additional Information
_No response_