[Checkpoints V2] Tag "thinking" lines for compact transcript#973
[Checkpoints V2] Tag "thinking" lines for compact transcript#973computermode wants to merge 2 commits intomainfrom
Conversation
Entire-Checkpoint: 5e0dbcccf51a
Entire-Checkpoint: c4da4bf56e17
There was a problem hiding this comment.
Pull request overview
This PR updates the compact transcript generator to include explicit thinking blocks (and Gemini thoughts) in the emitted content arrays, so “thinking” can be associated with the surrounding assistant message blocks in the compact JSONL format.
Changes:
- Preserve Claude Code
thinkingblocks (while still droppingredacted_thinking) during compacting. - Emit Gemini
thoughtsas{"type":"thinking","thinking":"..."}blocks in compact output (including thought-only assistant messages). - Update compact transcript fixtures and unit tests to expect the new
thinkingblocks.
Reviewed changes
Copilot reviewed 6 out of 7 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| cmd/entire/cli/transcript/compact/compact.go | Adds a preserve-thinking path for Claude Code and updates assistant-content stripping to keep thinking blocks. |
| cmd/entire/cli/transcript/compact/compact_test.go | Adjusts compact tests to expect preserved thinking blocks (including thinking-only assistant). |
| cmd/entire/cli/transcript/compact/gemini.go | Adds Gemini thoughts parsing and emits them as thinking blocks in compact transcripts. |
| cmd/entire/cli/transcript/compact/gemini_test.go | Adds test coverage for a Gemini assistant message with only thoughts (no content/tool calls). |
| cmd/entire/cli/transcript/compact/testdata/claude_expected.jsonl | Updates expected Claude fixture output to include a thinking block. |
| cmd/entire/cli/transcript/compact/testdata/claude_expected2.jsonl | Updates expected Claude fixture output to include thinking blocks (including empty thinking markers). |
| cmd/entire/cli/transcript/compact/testdata/gemini_expected.jsonl | Updates expected Gemini fixture output to include thought-derived thinking blocks. |
| if preserveThinking && blockType == "thinking" { | ||
| stripped := make(map[string]json.RawMessage) | ||
| copyField(stripped, block, "type") | ||
| copyField(stripped, block, "thinking") |
There was a problem hiding this comment.
stripAssistantContent now preserves Claude thinking blocks (including the full thinking text) when opts.Agent == "claude-code". Since the redaction package doesn't appear to scrub thinking content, this can persist chain-of-thought / potentially sensitive reasoning into checkpoint metadata and increase transcript size. If the intent is only to tag that thinking occurred, consider emitting only a marker (e.g., keep type:"thinking" but blank/omit the thinking field, or replace with a constant placeholder) rather than storing the full text.
| copyField(stripped, block, "thinking") | |
| stripped["thinking"] = json.RawMessage(`"[thinking omitted]"`) |
| for _, thought := range msg.Thoughts { | ||
| thinkingText := geminiThoughtText(thought) | ||
| if thinkingText == "" { | ||
| continue | ||
| } | ||
|
|
||
| blockType, err := json.Marshal("thinking") | ||
| if err != nil { | ||
| continue | ||
| } | ||
| thinking, err := json.Marshal(thinkingText) | ||
| if err != nil { | ||
| continue | ||
| } | ||
|
|
||
| content = append(content, map[string]json.RawMessage{ | ||
| "type": blockType, | ||
| "thinking": thinking, | ||
| }) | ||
| } |
There was a problem hiding this comment.
emitGeminiAssistant serializes thoughts into output thinking blocks containing the full subject/description text. If the goal is just to tag that thinking occurred (as the PR title/description suggest), persisting the full thought text may unintentionally store sensitive chain-of-thought into the compact transcript. Consider emitting a marker-only thinking block (or dropping the description content) and relying on other fields for analytics.
Adds "thinking..." tags to their corresponding message blocks in the compact transcript.
(Work in progress + this doesn't gate shipping checkpoints V2 and this information isn't consumed by the CLI or UI. It was requested internally.)
Note
Medium Risk
Changes the normalized
transcript.jsonloutput by retaining assistantthinkingcontent forclaude-codeand emitting Geminithoughtsasthinkingblocks, which may affect any downstream consumers expecting thinking to be stripped or thinking-only assistant lines to be dropped.Overview
Compact transcript output now preserves assistant “thinking” content. For
claude-codeJSONL compaction,thinkingblocks are kept (whileredacted_thinkingremains dropped), which also means assistant messages containing only thinking are no longer filtered out.Gemini compaction now includes
thoughts. Gemini messages’thoughts[]are converted into{"type":"thinking","thinking":"..."}blocks and prepended to assistant content; tests and fixtures are updated accordingly.Reviewed by Cursor Bugbot for commit 46c8809. Configure here.