Repository navigation
Description
What happened?
Converting a claude_code session turns the compaction summary into a user prompt that repeats the earlier conversation.
When a session is compacted, Claude Code writes a system row with subtype: "compact_boundary" (parentUuid: null, logicalParentUuid naming the last row before it) and then a user row flagged isCompactSummary: true and isVisibleInTranscriptOnly: true, parented on the boundary, whose content is a summary of everything before. The rows before the boundary stay in the same file.
txcript reads the file in order, so the whole earlier history is already in the Common conversation; the summary row then adds it a second time, condensed, as a user turn between two real prompts. A target agent reads it as something the user said.
In every compacted transcript we checked (Claude Code 2.1.310 and 2.1.311) the earlier rows are still in the file before the boundary, and the summary row is parented on the boundary.
Expected: the summary row stays out of the Common conversation, like the other bookkeeping, and stays in the native body so a native round trip is unchanged.
Not part of this report: user rows flagged isMeta stay as they are. docs/formats/cowork.md documents them as context the model saw, and the Cowork tests rely on that.
How to reproduce
A minimal transcript (envelope fields trimmed):
{"type":"user","uuid":"u1","sessionId":"…","timestamp":"…","message":{"role":"user","content":"first prompt"}}
{"type":"assistant","uuid":"a1","parentUuid":"u1","sessionId":"…","timestamp":"…","message":{"id":"msg_a1","role":"assistant","content":[{"type":"text","text":"first reply"}],"stop_reason":"end_turn"}}
{"type":"system","subtype":"compact_boundary","uuid":"b1","parentUuid":null,"logicalParentUuid":"a1","sessionId":"…","timestamp":"…","content":"Conversation compacted"}
{"type":"user","uuid":"s1","parentUuid":"b1","isCompactSummary":true,"isVisibleInTranscriptOnly":true,"sessionId":"…","timestamp":"…","message":{"role":"user","content":"summary of the conversation so far"}}
{"type":"user","uuid":"u2","parentUuid":"s1","sessionId":"…","timestamp":"…","message":{"role":"user","content":"second prompt"}}
{"type":"assistant","uuid":"a2","parentUuid":"u2","sessionId":"…","timestamp":"…","message":{"id":"msg_a2","role":"assistant","content":[{"type":"text","text":"second reply"}],"stop_reason":"end_turn"}}ClaudeCode::to_common on main (c60e686) yields a user turn "summary of the conversation so far" between "first reply" and "second prompt".
Versions
- txcript:
mainat c60e686 (also 0.14.4). - Agents and their versions: Claude Code 2.1.310 and 2.1.311 transcripts.
- Operating system: Windows 11.
I have a fix with a test ready: skip user rows flagged isCompactSummary when building Common, keeping them in the native records.
Activity
[-]claude_code: injected isMeta rows and the compaction summary become user prompts[/-][+]claude_code: the compaction summary becomes a user prompt that repeats the earlier history[/+]fix(claude_code): drop the compaction summary from Common