Transcript JSONL duplicates tool-result image payloads (message.content + toolUseResult), doubling image-turn size
Open 💬 3 comments Opened Jun 11, 2026 by samiam713
In the session transcript JSONL, each tool-result image (and file) payload is written twice within the same line:
- once inside
message.content[]as the{"type":"image","source":{"type":"base64","data":"…"}}block the model is shown, and - again in the top-level
toolUseResultfield (the raw tool return), which carries an identical copy of the base64data.
For image-heavy sessions this roughly doubles transcript size on the image bytes. Concrete example from our corpus: a single 18 MB transcript contained 5.3 MB of pure image duplication. Consequences:
- transcript files bloat on disk and over the wire (upload/resume cost);
- naive size heuristics (
stat().st_size) over-count "information content" by ~2x on image turns, skewing clipping/retention/cost logic downstream; - slower parse/scan of the JSONL.
Proposals:
- Store each blob once and have the second site reference it (content hash / pointer) rather than re-embedding the base64.
- Or omit the
toolUseResultimagedatawhen it is byte-identical to themessage.contentcopy (keep the metadata, drop the redundant bytes).
We've shipped a local read-side correction (per-entry blob dedup when sizing transcripts), but the on-disk duplication is upstream of us.
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗