feat(explain): scope transcript and prompts to checkpoint boundaries#130
feat(explain): scope transcript and prompts to checkpoint boundaries#130
Conversation
When viewing a checkpoint with `entire explain -c {checkpoint}`, the prompts
and AI-generated summaries now show only content relevant to that specific
checkpoint rather than the entire cumulative session transcript.
This uses the existing TranscriptLinesAtStart metadata field to slice the
transcript at checkpoint boundaries.
Changes:
- Add SliceFromLine() to transcript package for byte-level transcript slicing
- Add scopeTranscriptForCheckpoint() and extractPromptsFromTranscript() helpers
- Update formatCheckpointOutput() to use scoped prompts
- Update generateCheckpointSummary() to generate summaries from scoped content
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Entire-Checkpoint: 649d11045222
There was a problem hiding this comment.
Pull request overview
This PR updates the entire explain -c checkpoint view so that both AI summaries and displayed prompts are scoped to the transcript region corresponding to that specific checkpoint, using TranscriptLinesAtStart to slice the cumulative transcript.
Changes:
- Added
SliceFromLine()in thetranscriptpackage to perform byte-level slicing of JSONL transcript content from a given 0-based line offset, with comprehensive unit tests covering edge cases. - Updated checkpoint explanation and summary generation in
explain.goto scope transcripts toTranscriptLinesAtStart, then derive prompts from the scoped transcript viaextractPromptsFromTranscript. - Extended
explaintests to validate transcript scoping, prompt extraction, and that verbose checkpoint output only shows prompts that fall within the checkpoint’s scoped transcript region.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
cmd/entire/cli/transcript/parse.go |
Adds SliceFromLine helper to slice JSONL transcript bytes starting at a given 0-based line index, used to implement checkpoint-aware transcript scoping. |
cmd/entire/cli/transcript/parse_test.go |
Introduces unit tests for SliceFromLine, validating correct skipping behavior, zero-offset behavior, out-of-bounds handling, empty content, and no-trailing-newline scenarios. |
cmd/entire/cli/explain.go |
Adjusts summary generation and checkpoint formatting to use a scoped transcript (scopeTranscriptForCheckpoint) and derive user prompts from it (extractPromptsFromTranscript), ensuring intent and prompts reflect only the current checkpoint. |
cmd/entire/cli/explain_test.go |
Updates and adds tests to cover verbose output with transcripts, transcript scoping behavior, prompt extraction from scoped transcripts, and that verbose explain output only includes prompts within the checkpoint’s scoped region. |
…cript When a checkpoint has stored prompts but no transcript (older checkpoints), fall back to using result.Prompts instead of showing "(not generated)". Also adds tests verifying: - Backwards compatibility fallback behavior - --full mode shows entire transcript (intentionally not scoped) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Response to PR ReviewRe: Full mode transcript not scoped to checkpoint boundaries This is intentional behavior. The Added Re: Intent fallback ignores existing prompts when transcript missing Fixed in 265cf2d. Added backwards compatibility fallback: when a checkpoint has stored prompts but no transcript (older checkpoints), we now fall back to using Added |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
Bugbot Autofix is OFF. To automatically fix reported issues with Cloud Agents, enable Autofix in the Cursor dashboard.
| scopedPrompts := extractPromptsFromTranscript(scopedTranscript) | ||
| if len(scopedPrompts) > 0 && scopedPrompts[0] != "" { | ||
| point.SessionPrompt = scopedPrompts[0] | ||
| } |
There was a problem hiding this comment.
Missing backwards compatibility fallback for checkpoint prompts
Medium Severity
In getBranchCheckpoints, when extracting prompts for the branch list view, the code only uses scopedPrompts from the transcript but lacks a fallback to result.Prompts when the scoped prompts are empty. This is inconsistent with formatCheckpointOutput which explicitly falls back to result.Prompts for backwards compatibility with older checkpoints (lines 525-530 and 569-571). Older checkpoints without transcripts will show "(no prompt)" in the branch list view, but display correctly in the detailed checkpoint view.


Summary
entire explain -c {checkpoint}, prompts and AI-generated summaries now show only content relevant to that specific checkpointTranscriptLinesAtStartmetadata field to slice the transcript at checkpoint boundariesSliceFromLine()utility to the transcript package for byte-level slicingTest plan
SliceFromLine()covering edge cases (zero start, out of bounds, empty content, no trailing newline)scopeTranscriptForCheckpoint()andextractPromptsFromTranscript()TestFormatCheckpointOutput_UsesScopedPromptsverifying scoped prompts appear correctlyentire explain -c {checkpoint}on a checkpoint with multiple prior prompts and verify only relevant prompts are shown🤖 Generated with Claude Code
Note
Medium Risk
User-visible
explainoutput and summary generation now depend on correct transcript slicing; off-by-one or missing metadata could hide prompts or prevent summary generation. Changes are localized to CLI formatting/utilities but touch checkpoint listing behavior and parsing utilities.Overview
entire explain --checkpointnow scopes prompts and generated summaries to the checkpoint’s portion of the transcript by slicing fromTranscriptLinesAtStart, instead of using the full session transcript.Adds
transcript.SliceFromLine()for byte-level JSONL slicing, updates branch checkpoint listing to derive the displayed session prompt from the scoped transcript, and extends tests to cover slicing edge cases plus scoped-prompt behavior and backwards-compatible fallback to stored prompts when no transcript exists.Written by Cursor Bugbot for commit 0e7a05f. This will update automatically on new commits. Configure here.