[BUG] Session files grow to multi-GB due to normalizedMessages duplication in subagent progress entries

Resolved 💬 11 comments Opened Jan 18, 2026 by rso42 Closed Apr 18, 2026

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?

Session .jsonl files grow to multi-GB sizes during long sessions with heavy subagent (Task tool) usage, eventually preventing Claude Code from starting.

Root cause: Every progress entry for subagents stores the full normalizedMessages array (complete conversation history at that moment). With many progress updates per subagent turn, session files grow exponentially.

Evidence from a 3.1GB session file:

  • 3,620 progress entries with normalizedMessages
  • 777,402 total messages stored (massive duplication)
  • Largest single entry: 7.1MB (1,154 messages)
  • Average ~200x duplication per message
  • Session duration: ~10 hours

Entry structure causing bloat:

{
  "type": "progress",
  "data": {
    "agentId": "a9b4d10",
    "normalizedMessages": [/* FULL HISTORY */],
    "prompt": "...",
    "message": "..."
  }
}

This is distinct from:

  • #5034 (stream-json format issue)
  • #9890/#10107 (FileHistory issues)
  • #6394 (.claude.json bloat)

What Should Happen?

Progress entries should NOT store the full conversation history on every update. Options:

  • Store message deltas/diffs only
  • Reference previous entries by ID
  • Don't include normalizedMessages in progress events (reconstruct from subagent files if needed)

Error Messages/Logs

No error messages - Claude Code simply fails to start when session files are too large. Had to manually move `~/.claude/projects/` to restore functionality.

Steps to Reproduce

  1. Start a Claude Code session in a project
  2. Use the Task tool (subagents) heavily throughout the session
  3. Continue for several hours with many subagent invocations
  4. Monitor ~/.claude/projects/{project-dir}/*.jsonl file sizes
  5. Observe exponential growth correlating with subagent usage
  6. Eventually Claude Code refuses to start due to file size

Claude Model

Opus

Is this a regression?

I don't know

Last Working Version

_No response_

Claude Code Version

2.1.12 (Claude Code)

Platform

Anthropic API

Operating System

macOS

Terminal/Shell

iTerm2

Additional Information

  • This punishes exactly the workflow that makes Claude Code valuable: long-running sessions with heavy agent delegation for complex tasks
  • I have the bloated session files preserved (~12GB total across multiple sessions) and can provide them for analysis
  • The issue appears to persist in 2.1.12 but at smaller scale in current sessions (226KB max vs 7MB per entry in older sessions)
  • Analysis commands used to identify root cause:

```bash
# Size by entry type
jq -c '{type, size: (. | tostring | length)}' session.jsonl | jq -s 'group_by(.type) | map({type: .[0].type, count: length, total_size: (map(.size) | add)})'

# normalizedMessages sizes
jq -c 'select(.type == "progress" and .data.normalizedMessages) | {nm_size: (.data.normalizedMessages | tostring | length)}' session.jsonl
```

View original on GitHub ↗

This issue has 11 comments on GitHub. Read the full discussion on GitHub ↗