Store compact transcript.jsonl in v1 checkpoints, point metadata at it · Entire
Store compact transcript.jsonl in v1 checkpoints, point metadata at it
afd9428→main·
computermode·1mo ago·6 files·+396 added/-29 removed
Committed checkpoint writes now generate a compact transcript (transcript.jsonl) from the full transcript via transcript/compact and store it in the session directory next to full.jsonl, so it is pushed with the entire/checkpoints/v1 branch. The root metadata.json sessions[].transcript pointer targets transcript.jsonl when it was generated and falls back to full.jsonl otherwise (unparseable or external-agent transcripts, checkpoints from older CLI versions).
Unlike the removed v2 (cumulative compact plus compact-unit offset), the stored compact is pre-sliced to the checkpoint's own portion: compact.Compact runs with StartLine = checkpoint_transcript_start. v1's checkpoint_transcript_start must keep full.jsonl units for CLI readers, so a pre-sliced file avoids a new offset field and is self-describing for consumers. Generation is best-effort and never fails the checkpoint write; finalization (UpdateCommitted) regenerates the compact from the new content and keeps the previous one on generation failure so the metadata pointer never dangles. CLI read paths (rewind/resume/explain) are unaffected: they read full.jsonl by filename, not through the metadata pointer.
Sessions
63b41777384aView transcript
Changes
6
MCLAUDE.md+1
cmd/entire/cli
checkpoint
Mcheckpoint.go+6/-2
Mcommitted.go+121/-20
Acommitted_compact_transcript_test.go+241
paths
Mpaths.go+7/-4
docs/architecture
Msessions-and-checkpoints.md+20/-3
427 unmodified lines
428
429
430
431
432
433
434
427 unmodified lines
- **Worktree-specific branches** - each git worktree gets its own shadow branch namespace, preventing conflicts
- **Supports multiple concurrent sessions** - checkpoints from different sessions in the same directory interleave on the same shadow branch
- Condenses session logs to permanent `entire/checkpoints/v1` branch on user commits
- Each committed session stores the raw transcript (`full.jsonl`, read by CLI rewind/resume/explain) plus a best-effort compact transcript (`transcript.jsonl`, generated via `transcript/compact` and pre-sliced to the checkpoint's `checkpoint_transcript_start`). The root `metadata.json` `sessions[].transcript` pointer targets `transcript.jsonl` when generated, falling back to `full.jsonl`. Both are pushed with the v1 branch.
- When `checkpoints_version` is `1.1`, best-effort mirrors v1 metadata to the `refs/entire/checkpoints/v1.1` read ref after entire-managed v1 writes and fetches; mirror failures are logged, not fatal. The resolver also adds v1.1 to the push set, so `PrePush` pushes it to the configured remote alongside v1 (re-pointing the mirror at the current v1 tip first); v1.1 is a non-branch ref, so it gets no origin-tracking shadow and reads do not bootstrap it from origin (reads target v1.1 while Primary stays v1). The resume bootstrap that promotes local v1 from origin's remote-tracking ref is the deliberate exception — it does not mirror and is skipped entirely in v1.1 mode. Read paths use the configured ref as-is.
- Uses the `post-rewrite` Git hook to keep local session linkage aligned after amend/rebase rewrites
- Builds git trees in-memory using go-git plumbing APIs