Skip to content

feat(checkpoint): add compact_transcript path to metadata.json#1515

Merged
computermode merged 4 commits into
mainfrom
update-metadata-when-compact-generated
Jun 24, 2026
Merged

feat(checkpoint): add compact_transcript path to metadata.json#1515
computermode merged 4 commits into
mainfrom
update-metadata-when-compact-generated

Conversation

@computermode

@computermode computermode commented Jun 24, 2026

Copy link
Copy Markdown
Contributor

https://entire.io/gh/entireio/cli/trails/655

What

Following PR #1510, this takes a simpler approach to surfacing the compact transcript in checkpoint metadata. Instead of repointing the root metadata.json sessions[].transcript at transcript.jsonl, the pointer keeps targeting full.jsonl and a sibling path field is added:

  • sessions[].compact_transcript holds the path to transcript.jsonl when a compact transcript was generated and written into the session directory.
  • The field is omitted for non-compactable, empty, or oversized transcripts and for checkpoints written by older CLI versions.
"sessions": [
  {
    "metadata": "/ab/c123def456/0/metadata.json",
    "transcript": "/ab/c123def456/0/full.jsonl",
    "compact_transcript": "/ab/c123def456/0/transcript.jsonl",
    "content_hash": "/ab/c123def456/0/content_hash.txt",
    "prompt": "/ab/c123def456/0/prompt.txt"
  }
]

This avoids the pointer-flip and the compact_transcript_start offset machinery from #1510, while giving external readers (server/UI) a direct path to the compact transcript next to full.jsonl.

How

  • Added CompactTranscript string (json:"compact_transcript,omitempty") to SessionFilePaths in api/checkpoint/metadata.go, placed right after the transcript field, and corrected the Transcript doc comment (it always points at full.jsonl).
  • In writeSessionToSubdirectory (persistent.go), the path is derived directly from the tree entry: set to /<sessionPath>/transcript.jsonl only when that entry exists. Deriving from the actual tree entry (rather than threading a separate signal) keeps the pointer from dangling, and follows the same write-once lifecycle as the existing transcript/content_hash pointers.
  • This is the only metadata location that stores a transcript path — the session-level metadata.json carries only offsets/identifiers, not a full.jsonl path — so compact_transcript is added in exactly the one place the full.jsonl path appears.
  • Updated tests to assert the path is set for a compactable transcript and absent for a non-compactable one.

Reviewer notes

Rendered Markdown

Add a has_compact_transcript boolean to the root metadata.json sessions[]
entries instead of repointing sessions[].transcript at transcript.jsonl.
The transcript pointer keeps targeting full.jsonl; the flag (omitted when
false) signals to external readers that a compact transcript.jsonl was
written alongside it. Derived from the actual tree entry so it can't drift
from what was written.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Entire-Checkpoint: 9c9ee0f533ff
Copilot AI review requested due to automatic review settings June 24, 2026 16:59

@cursor cursor Bot left a comment

Copy link
Copy Markdown

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.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Comment @cursor review or bugbot run to trigger another review on this PR

Reviewed by Cursor Bugbot for commit 278addd. Configure here.

Comment thread cmd/entire/cli/checkpoint/persistent.go Outdated

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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 adds an explicit, backward-compatible signal in committed checkpoint metadata indicating whether a compact transcript (transcript.jsonl) was generated for a session, while keeping sessions[].transcript pointing at the raw full.jsonl used by CLI read paths.

Changes:

  • Add sessions[].has_compact_transcript (omitempty) to checkpoint summary metadata to indicate compact transcript availability.
  • Set the flag during checkpoint writes by detecting the presence of transcript.jsonl in the in-memory git tree entries.
  • Update docs and tests to reflect/validate the new metadata shape.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
docs/architecture/sessions-and-checkpoints.md Updates storage/metadata documentation and JSON example to include has_compact_transcript while keeping transcript on full.jsonl.
cmd/entire/cli/checkpoint/persistent.go Derives and records HasCompactTranscript on session file paths based on whether transcript.jsonl was written into the checkpoint tree.
cmd/entire/cli/checkpoint/persistent_compact_transcript_test.go Extends existing compact transcript tests to assert the new has_compact_transcript behavior for compactable vs non-compactable transcripts.
CLAUDE.md Updates strategy documentation to describe the new flag for external readers.
api/checkpoint/metadata.go Extends the public metadata contract (SessionFilePaths) with has_compact_transcript and updates transcript field documentation accordingly.

Comment thread cmd/entire/cli/checkpoint/persistent.go Outdated
Replace the has_compact_transcript boolean with a compact_transcript
string holding the path to transcript.jsonl, placed alongside the
transcript (full.jsonl) pointer in the root metadata.json sessions[]
entries. Omitted when no compact transcript was written. This mirrors
the existing transcript pointer rather than signalling presence
separately.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Entire-Checkpoint: d1553195a011
@computermode computermode changed the title feat(checkpoint): flag compact transcript via has_compact_transcript feat(checkpoint): add compact_transcript path to metadata.json sessions Jun 24, 2026
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Entire-Checkpoint: cc1dc940b7ca
@computermode computermode changed the title feat(checkpoint): add compact_transcript path to metadata.json sessions feat(checkpoint): add compact_transcript path to metadata.json Jun 24, 2026
backfillTranscript regenerates transcript.jsonl via replaceTranscript but
did not rewrite the root metadata.json, so a compact transcript created
during finalize (when the initial write skipped compaction) left
sessions[].compact_transcript omitted. Re-derive the pointer from the tree
entry after replaceTranscript and rewrite the root summary when it changed.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Entire-Checkpoint: b0e1c7d96944
@computermode computermode marked this pull request as ready for review June 24, 2026 18:14
@computermode computermode requested a review from a team as a code owner June 24, 2026 18:14
@computermode computermode merged commit 6576660 into main Jun 24, 2026
9 checks passed
@computermode computermode deleted the update-metadata-when-compact-generated branch June 24, 2026 18:44
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.

3 participants