[BUG] Session files grow exponentially due to progress events including full normalizedMessages context
[BUG] Session files grow exponentially due to progress events including full normalizedMessages context
Description
Session .jsonl files grow to multi-GB sizes because progress event entries include the full normalizedMessages array (complete conversation context). As the conversation grows, each subsequent progress event logs an increasingly larger context, causing exponential file growth.
Environment
- Claude Code Version: 2.1.11 / 2.1.12
- Bun Version: 1.3.5 (bundled)
- OS: Windows 11
- Platform: VS Code Extension
Steps to Reproduce
- Start a Claude Code session with moderate complexity (tool calls, file reads, etc.)
- Continue working in the session for several hours
- Leave the session open (even idle)
- Check session file size:
ls -la ~/.claude/projects/*/[session-id].jsonl
Expected Behavior
Session files should grow proportionally to actual conversation content (messages, tool results). An hour-long session should be tens of MB, not GB.
Actual Behavior
Session file grew to 7.6GB with only 153 lines. Analysis showed:
Lines 112-128: ~200MB each
Total progress events: 15,766
Progress events with normalizedMessages: 77
Each progress event containing normalizedMessages includes the full accumulated conversation context, causing exponential growth:
{
"type": "progress",
"data": {
"message": {...},
"normalizedMessages": [/* ENTIRE CONVERSATION HISTORY */]
}
}
Impact
- Startup crash: Bun v1.3.5 crashes with "integer does not fit in destination type" when trying to load/index large session files on next startup
- Disk space: Session files consume GB of disk space
- Memory pressure: High RSS usage (8.46GB observed) before crash
- Session loss: Users must manually delete session files to recover
Root Cause Analysis
The progress event type appears to be logging full context for real-time UI updates, but this context is being persisted to the session file. The normalizedMessages field should either:
- Not be included in session file logging for
progressevents - Be deduplicated/referenced rather than repeated inline
Workaround
Delete the problematic session file:
rm ~/.claude/projects/[project-path]/[session-id].jsonl
Related Issues
- #10881 - Performance degradation over long sessions (may share root cause)
- #9579 - Autocompacting loop (different but related to session management)
- #18567 - Bun crash on Windows (symptom of this bug)
Diagnostic Data
Session file analysis:
- File size: 7,598,942,451 bytes (7.6GB)
- Line count: 153
- Largest lines: ~204MB each (lines 112-128)
- Pattern:
progressevents withnormalizedMessagescontaining full context
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗