[BUG] Queued image prompts are re-serialized into the session transcript 16-23 times, inflating .jsonl by GBs
When an image is pasted into the prompt box while Claude is working, the
prompt goes into the queue and is written to the session transcript as aqueued_command attachment containing the full base64 PNG. Each subsequent
re-serialization of the queue writes the entire base64 payload again, so a
single screenshot ends up stored 16-23 times in ~/.claude/projects/<ws>/<id>.jsonl.
Measured on two real sessions in the same workspace:
| Session | Size | Lines | Byte-identical duplicate lines | Max repeats of one line |
|---|---|---|---|---|
| 8c357f2c-… | 8.15 GB | 2,013,093 | 1,376,121 (68%) | 7,598 |
| fa31562a-… | 1.02 GB | 244,630 | 144,234 (59%) | 2,976 |
Top waste contributors in fa31562a (waste = (copies-1) x size):
11.3 MB 17 copies x 725 KB attachment / queued_command (base64 PNG)
10.1 MB 23 copies x 470 KB user message / image
4.5 MB 16 copies x 310 KB attachment / queued_command
4.1 MB 17 copies x 264 KB attachment / queued_command
Waste by record type: assistant 379 MB, attachment 138 MB, user 30 MB.
Total redundant bytes: 0.54 GB of 1.02 GB (53%).
Deduplicating byte-identical lines is lossless: unique uuid count is
27,801 before and after, and dangling parentUuid references are 0 in
both. So no distinct record is lost — the copies carry no information.
What Should Happen?
- A queued prompt's binary payload should be written once and referenced
afterwards, not re-embedded on every queue re-serialization.
- Transcript growth should scale with conversation content, not with how many
times the queue happens to be rewritten.
Steps to Reproduce
- Start a long task so Claude is busy.
- Paste a screenshot into the prompt box and send (it queues).
- Repeat a few times during the session.
awk '{print length($0)}' <session>.jsonl | sort -rn | head— the same
large line length appears many times; hashing lines shows exact duplicates.
Impact
- 8.15 GB single-session file had to be moved out of the workspace because it
broke a weekly backup uploader (file-part limits) and dominated backup time.
- With
cleanupPeriodDaysset high (transcripts kept deliberately), this
compounds indefinitely.
Environment
- Claude Code VS Code extension, Windows 11
- Workspace with long-running multi-session usage