Skip to content

feat(explain): scope transcript and prompts to checkpoint boundaries#130

Merged
khaong merged 4 commits intomainfrom
alex/test-explain-checkpoint-boundaries
Feb 2, 2026
Merged

feat(explain): scope transcript and prompts to checkpoint boundaries#130
khaong merged 4 commits intomainfrom
alex/test-explain-checkpoint-boundaries

Conversation

@khaong
Copy link
Contributor

@khaong khaong commented Jan 30, 2026

Summary

  • When viewing a checkpoint with entire explain -c {checkpoint}, prompts and AI-generated summaries now show only content relevant to that specific checkpoint
  • Uses the existing TranscriptLinesAtStart metadata field to slice the transcript at checkpoint boundaries
  • Adds SliceFromLine() utility to the transcript package for byte-level slicing

Test plan

  • Unit tests for SliceFromLine() covering edge cases (zero start, out of bounds, empty content, no trailing newline)
  • Integration tests for scopeTranscriptForCheckpoint() and extractPromptsFromTranscript()
  • End-to-end test TestFormatCheckpointOutput_UsesScopedPrompts verifying scoped prompts appear correctly
  • Manual test: run entire 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 explain output 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 --checkpoint now scopes prompts and generated summaries to the checkpoint’s portion of the transcript by slicing from TranscriptLinesAtStart, 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.

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
@khaong khaong requested a review from a team as a code owner January 30, 2026 19:42
Copilot AI review requested due to automatic review settings January 30, 2026 19:42
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 the transcript package 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.go to scope transcripts to TranscriptLinesAtStart, then derive prompts from the scoped transcript via extractPromptsFromTranscript.
  • Extended explain tests 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.

khaong and others added 2 commits January 31, 2026 07:58
…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>
@khaong
Copy link
Contributor Author

khaong commented Jan 30, 2026

Response to PR Review

Re: Full mode transcript not scoped to checkpoint boundaries

This is intentional behavior. The --full flag is meant to show the complete session transcript for context, while prompts are scoped to the checkpoint. This allows users to see exactly what happened during a checkpoint (scoped prompts) while still being able to reference the full conversation history if needed.

Added TestFormatCheckpointOutput_FullShowsEntireTranscript to document this as expected behavior.


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 result.Prompts instead of showing "(not generated)".

Added TestFormatCheckpointOutput_FallsBackToStoredPrompts to verify this behavior.

@khaong khaong enabled auto-merge February 1, 2026 01:14
@khaong khaong merged commit 3ebe059 into main Feb 2, 2026
4 checks passed
@khaong khaong deleted the alex/test-explain-checkpoint-boundaries branch February 2, 2026 00:20
Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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]
}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Fix in Cursor Fix in Web

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants