/brainstorming Help me to figure out a project plan for implementing checkpoints v2
Based on the current state of this repository, I'd like to create a project plan for implementing both transcript log compaction as well as support for the new checkpoints v2 spec based on this document: ~/entire/company-knowledge/rfds/rfd-009-transcript-compaction.md
Base parameters:
At the time of writing, the plan is for two people to work on this in parallel
Both engineers working on this are experienced staff software engineers at a startup
While we'll be collaborating actively, we'll need tasks to work on in parallel so making dependencies explicit is very important
We'll be working in pull requests against the default branch of this repo: main
We'll need a reasonable rollout plan that also includes validation of the changes
Constraints:
The changes merged with each pull request should always result in a shippable product. New functionality will be hidden/deactivated based on strategy options, but existing functionality must not break for customers using this cli during the development process
Newly added functionality must not impact existing users or coworkers using this repository while we're still developing it
Before we haven't validated that our changes, especially everything related to writing refs, work, checkpoints in the v2 format should not be pushed to a production git repository. It would, however, be good to use validation repositories for testing and validation purposes.
Open Questions
The open questions down below don't need to be addressed immediately but should be addressed soon to ensure we're not missing anything going forward:
How do we add compaction support for agents implemented as external agent?
I'm assuming that transcripts are simply copied and committed at the moment since they're not compacted or parsed in an agent specific way. Is that correct?
Additional information
I've attached some handwritten notes with some ideas. Please also take them into account.
When there are any open questions or ambiguity, please ask me rather than making decisions on my behalf. Thoroughly think about the timeline and execution of this project and come up with tasks and individual can work on. We'll manually add these tasks to our project management system.
User
superpowers:brainstorming
/superpowers:brainstorming
Help me to figure out a project plan for implementing checkpoints v2
Based on the current state of this repository, I'd like to create a project plan for implementing both transcript log compaction as well as support for the new checkpoints v2 spec based on this document: ~/entire/company-knowledge/rfds/rfd-009-transcript-compaction.md
Base parameters:
At the time of writing, the plan is for two people to work on this in parallel
Both engineers working on this are experienced staff software engineers at a startup
While we'll be collaborating actively, we'll need tasks to work on in parallel so making dependencies explicit is very important
We'll be working in pull requests against the default branch of this repo: main
We'll need a reasonable rollout plan that also includes validation of the changes
Constraints:
The changes merged with each pull request should always result in a shippable product. New functionality will be hidden/deactivated based on strategy options, but existing functionality must not break for customers using this cli during the development process
Newly added functionality must not impact existing users or coworkers using this repository while we're still developing it
Before we haven't validated that our changes, especially everything related to writing refs, work, checkpoints in the v2 format should not be pushed to a production git repository. It would, however, be good to use validation repositories for testing and validation purposes.
Open Questions
The open questions down below don't need to be addressed immediately but should be addressed soon to ensure we're not missing anything going forward:
How do we add compaction support for agents implemented as external agent?
I'm assuming that transcripts are simply copied and committed at the moment since they're not compacted or parsed in an agent specific way. Is that correct?
Additional information
I've attached some handwritten notes with some ideas. Please also take them into account.
When there are any open questions or ambiguity, please ask me rather than making decisions on my behalf. Thoroughly think about the timeline and execution of this project and come up with tasks and individual can work on. We'll manually add these tasks to our project management system.
Let me start by exploring the project context and reading the RFD document.
Assistant
Now let me explore the project context — I'll read the RFD and explore the current codebase in parallel.
Assistant
Good, I now have a thorough understanding of both the RFD and the current codebase. Let me also check the external agent plugin handling for transcripts more closely.
Assistant
I've now thoroughly reviewed the RFD, your handwritten notes, and the current codebase. Here's what I understand from your notes:
Rollout approach:
Hide changes behind strategy options
Start with dual-writing v1 + v2
Switch over main ref first
Implement full compaction parallel to main
Update commands in parallel
Write logs:
Update checkpoint storage to use refs
Write condensed format to /main
Write full log to /full/current
Rotate full logs
Compaction:
Required to write main ref
Filter out irrelevant lines
Use common format
Updated read paths (CLI commands):
Read checkpoints from main, transcripts from full (with archive iteration)
Before I start proposing approaches, I have my first clarifying question:
Regarding the Entire Transcript Format and agent-specific compaction:
The RFD specifies that the CLI writes transcript.jsonl at condensation time. Currently, each agent has its own transcript format (Claude Code = JSONL, Gemini = JSON with messages array, OpenCode = JSON export, etc.) and the TranscriptAnalyzer interface handles agent-specific parsing.
For the compaction to work, each agent needs a "transcript compactor" that converts its native format → Entire Transcript Format. The built-in agents (Claude Code, Gemini, Cursor, OpenCode, Factory AI Droid, Copilot CLI) can have compaction logic implemented in Go.
For external agents (plugins): The current plugin protocol delegates ReadTranscript, ChunkTranscript, ExtractPrompts, CalculateTokens to the external binary. There are two approaches for compaction:
Add a compact-transcript subcommand to the external agent protocol — the plugin binary does the compaction and returns Entire Transcript Format JSONL.
Use a "best-effort" generic compactor — since external agents already implement ExtractPrompts and the transcript is just JSONL/JSON, try to extract user/assistant turns generically and fall back to storing full.jsonl only (no compact format) if the format isn't understood.
Which approach do you prefer? Or should we defer external agent compaction support to a later phase entirely (meaning external agents would initially only get full.jsonl written, not transcript.jsonl)?
User
I'd prefer option 1 where we're delegating the transcript compaction to the external plugin. Can you come up with a proposal for that so I can add it to the RFD, too?
Something else I'd be interested in: Given the complexities around compaction, would it be possible to structure the project plan such that we can work on the v1 - v2 migration in parallel while someone else is working on compaction. I'd be open to suggestions to what this could look like.
Assistant
Good questions — let me address both.
External Agent Compaction Protocol Extension
Here's a concrete proposal for the plugin protocol:
New capability:"compact_transcript" declared in the info response.
Fallback behavior: If the plugin doesn't declare compact_transcript capability, the CLI writes full.jsonl to /main instead of transcript.jsonl for that checkpoint. This means:
Old plugins continue working without changes
New plugins opt into compaction when ready
The API/CLI read path checks for transcript.jsonl first, falls back to full.jsonl
Why base64 for both directions: Transcripts can contain arbitrary binary data (images) and multi-byte characters. Base64 avoids JSON encoding issues. This matches the pattern already used for read-transcript.
Why pass the raw transcript via stdin rather than just the session-ref: The CLI may already have the transcript in memory (just read it for the shadow branch). Passing it avoids a redundant filesystem read by the plugin binary. The --session-ref is still provided for context (e.g., if the plugin needs to read additional session metadata).
Parallelizing v2 Migration and Compaction
Yes — this can be cleanly split. The key insight is that /main doesn't needtranscript.jsonl from day one. Here's the structure:
I think I need to push back on the idea of accepting JSON via STDIN on the compact-transcript command. If I understand correctly, this is not a pattern that we're using for existing commands since the external agent binary should know where the transcripts are located on disk already. I'm assuming that the --session-ref parameter would already be enough information for the plugin to locate the transcripts on disk. Correct?
You're right, I'll revise. Looking at the existing protocol:
read-transcript --session-ref <path> → plugin reads from disk, outputs raw bytes to stdout
get-transcript-position --path <path> → plugin reads from disk, outputs JSON
The pattern is clear: the plugin locates and reads its own transcripts via filesystem paths. chunk-transcript is the exception (stdin) because the CLI has already read the bytes and just needs them split.
For compact-transcript, the plugin knows its own format and where the file lives — no reason to pipe the data through stdin.
Capability: "compact_transcript": true in the info response
Fallback: if the plugin doesn't declare this capability, the CLI writes full.jsonl to /main instead of transcript.jsonl
One open question on the output: The 10 MB stdout cap mentioned in the docs could be a concern for asset-heavy sessions (lots of screenshots). Should we handle that with a --output-dir <path> flag where the plugin writes assets to disk instead of base64-encoding them to stdout? Or do you think the 10 MB cap is sufficient for typical sessions?
Coming back to the earlier question about rollout sequencing — is the dual-write → v2-only → v1-cleanup phasing I described roughly what you had in mind? And specifically: should v2 refs be pushed to remotes during the dual-write phase, or only after validation in test repos?
User
For the question about the 10mb limit: I'm not sure if have exising patterns for providing a --output-dir and the logistics of providing a folder to a plugin, the plugin writing to that folder and then having to clean up everything again sounds very involved. Could we instead return an assets property where an asset can either contain a data attribute with base64 encoded data or a file system reference? In the updated doc, I would mention that this would be an optional addition that we could implement down the road.
Each asset has either data (inline base64) or path (filesystem reference). The CLI handles both — reads inline data directly, reads filesystem paths and cleans up if needed. In the RFD addition, I'd note that asset support is optional and can be implemented in a later phase, with the initial version focusing on transcript only.
Here's the full RFD-ready section:
External agent compaction protocol
Plugins opt into compaction by declaring "compact_transcript": true in their info response capabilities.
transcript (required): Base64-encoded Entire Transcript Format JSONL.
assets (optional, future addition): Extracted binary data. Each asset has a name, media_type, and either inline data (base64) or a filesystem path.
Fallback: If the plugin does not declare compact_transcript, the CLI writes full.jsonl to /main instead of transcript.jsonl for that checkpoint. Read paths check for transcript.jsonl first, fall back to full.jsonl.
Does that look right for the RFD addition?
And circling back to the rollout question I asked earlier — I want to make sure we get this right before designing the task breakdown:
Is the dual-write (v1 + v2) → v2-only → v1-cleanup phasing correct?
During the dual-write phase, should v2 refs be pushed to remotes, or only after validation in test repos? (This ties into your constraint about not pushing v2 to production repos prematurely.)
User
1: What I was thinking was:
First update the code paths that write the checkpoints metadata used in the hooks to support dual writes when the "checkpoints-v2" setting is enabled
In parallel we'd be working on the compaction logic, too
During the "dual write implementation" phase, we wouldn't push to production remotes
Given that full and proper validation will only be possible when the commands reading the checkpoints data I'd say we can start validating the changes more thoroughly once we have a full end2end scenario where we're writing the new formats to git and have at least one command that will read them.
After initial validation against testing repositories, we can start enablign dual writes to be pushed to a production repository. This will also help to unblock work related to updating the API and UI to take advantage of the new format.
Assistant
That makes sense. So the rollout sequence is:
Implement dual-write behind checkpoints-v2 setting (no remote push)
In parallel: compaction logic for all agents
Validate end-to-end once at least one read command works with v2 format (against test repos)
Enable v2 push to production remotes → unblocks API/UI work
Next question — scope for this project plan. The RFD includes several features beyond the core dual-write and compaction:
Pinning (entire pin / entire unpin) — keeping raw logs permanently in /main
Generation rotation for /full/current → archived generations
Cleanup tool (GitHub Action + CLI command) for deleting old generations
Cold storage archive (optional S3/GCS upload before deletion)
v1 → v2 migration tool (backfill transcript.jsonl from old full.jsonl)
retain_raw_logs compliance mode
Which of these do you consider in-scope for this project plan, and which should be deferred to follow-up work? My instinct is that the core deliverable is dual-write + compaction + updated read paths + generation rotation, with pinning/cleanup/cold-storage/migration as follow-ups — but I don't want to assume.
User
I think your assumption is mostly correct. What I see as in-scope:
dual writes
compaction
validation
removing v1 support
Generation rotation
Based on the document I think at least the migration and cleanup should be part of the initial work as well since we don't want to leave behind any stale data for our customers. We should add these to the project plan as well. I think the rest of the features mentioned in the doc can ship later.
I think I have enough context now to propose approaches for structuring the parallel work. Let me present the options.
Approach 1: Split by layer — Storage Infrastructure vs. Compaction
Engineer A owns the v2 storage plumbing: ref infrastructure under refs/entire/, dual-write in condensation, generation rotation, push logic, updated read paths for CLI commands.
Engineer B owns compaction: Entire Transcript Format definition, compactors for each built-in agent, external agent protocol extension, binary asset externalization.
Merge point: B's compaction output gets wired into A's condensation write path (single integration PR). Then both work on migration, cleanup, validation, and v1 removal together.
Pros:
Genuinely independent — compaction needs zero storage infrastructure to develop and test
Both workstreams produce independently testable artifacts from day one
Aligns with your notes ("implement full compaction parallel to main")
Cons:
Read path updates depend on write paths being done first — Engineer B may have idle time waiting if compaction finishes faster than storage infra
Migration tool needs both compaction (to backfill transcript.jsonl) and storage infra (to write v2 refs), so it's naturally a joint task
Approach 2: Split by ref — /main ref vs. /full/* refs
Engineer A owns everything related to the /main ref: metadata writes, compaction (since transcript.jsonl lives on /main), the read paths that consume compact transcripts.
Engineer B owns everything related to /full/* refs: raw log writes, generation rotation, cleanup tool, entire resume (reads raw transcripts).
Pros:
Each engineer owns a complete vertical slice (write + read for their ref)
Less coordination needed — each ref is self-contained
User
Let's go with approach 1 for now
Assistant
Good. Let me now present the design in sections. I'll go through each major component and check alignment before moving on.
Section 1: Strategy Option & Feature Gating
All v2 functionality is gated behind a checkpoints_v2 strategy option in settings:
When false (default): existing v1 behavior, no changes. When true: dual-write to both v1 and v2 refs.
This lives in the existing settings package. A helper like settings.IsCheckpointsV2Enabled() provides the check. The condensation path, push logic, and read paths all branch on this flag.
Removal plan: Once v2 is validated and v1 support is removed, this option becomes a no-op and eventually gets cleaned up.
Does this gating approach look right?
User
Yes
Assistant
Section 2: v2 Ref Infrastructure & Checkpoint Store Changes
New ref namespace:
code
refs/entire/checkpoints/v2/main ← permanent: metadata + compact transcripts
refs/entire/checkpoints/v2/full/current ← active generation: raw logs
refs/entire/checkpoints/v2/full/0000000000001 ← archived generation (after rotation)
Changes to the checkpoint store (cmd/entire/cli/checkpoint/):
The current GitStore writes committed checkpoints to entire/checkpoints/v1 (a branch under refs/heads/). For v2, it needs to write to two refs under refs/entire/:
WriteCommitted becomes aware of the v2 split — it writes metadata entries to /main and raw transcript entries to /full/current as separate commits on separate refs.
The existing tree-splicing logic (spliceCheckpointSubtree) and sharded path structure (<id[:2]>/<id[2:]>/) remain unchanged — the only difference is which ref the commit is appended to.
A new WriteCommittedV2(checkpointID, mainEntries, fullEntries) method (or similar) handles the two-ref write, while the existing WriteCommitted stays for v1.
Read path changes in the store:
ReadCommitted gains v2 awareness: read metadata from /main ref, raw transcript from /full/current (with fallback to archived generations).
ListCommitted reads from /main tree (same walk as today, different ref).
Ref management:
Since these are custom refs (not under refs/heads/), the store needs helpers for:
Creating/updating refs under refs/entire/ using go-git's storer.SetReference
Reading ref targets (resolving refs/entire/checkpoints/v2/main to a commit hash)
Listing refs matching a prefix (for discovering archived generations)
Shadow branches (temporary checkpoints): No changes. They're ephemeral, local-only, and not affected by v2.
entire/trails/v1 branch: No changes in this project.
Does this structure for the store changes make sense? Any concerns about the WriteCommittedV2 split vs. modifying the existing WriteCommitted?
User
Yes
Assistant
Section 3: Dual-Write Condensation Path
Current flow (manual_commit_condensation.go):
Extract session data from shadow branch (or live transcript)
Build metadata, calculate attribution/tokens
Write everything to entire/checkpoints/v1 via store.WriteCommitted()
v2 flow (when checkpoints_v2 is enabled):
Same extraction and metadata calculation as today
If compaction is available for this agent: produce transcript.jsonl via the agent's compactor
Split entries into two sets:
Main entries:metadata.json, prompt.txt, content_hash.txt, and (if compaction available) transcript.jsonl + assets/*
Full entries:full.jsonl (raw transcript, chunked if needed)
Write to v2 refs via store.WriteCommittedV2(checkpointID, mainEntries, fullEntries)
Also write to v1 via existing store.WriteCommitted() (dual-write)
When compaction is NOT available (e.g., external agent without compact_transcript capability):
/main gets metadata.json, prompt.txt, content_hash.txt — but no transcript.jsonl
/full/current gets full.jsonl as usual
Read paths know to fall back to /full/current for the raw transcript when transcript.jsonl is absent
Workstream A defines this interface. Workstream B implements it for each agent. Until B delivers, the condensation path simply skips the compaction step — /main has metadata only, /full/current has the raw transcript. The wiring PR connects them.
Does this condensation flow and the interface between workstreams look right?
User
Yes
Assistant
Section 4: Compaction — Entire Transcript Format & Agent Compactors
Entire Transcript Format (transcript.jsonl):
A normalized, agent-agnostic JSONL format as specified in the RFD. Header line + conversational entries, every line carries "v":1.
Implementation structure:
A new package (e.g., cmd/entire/cli/transcript/) that owns:
Type definitions for the format (Header, UserEntry, AssistantEntry, UserToolResultEntry)
A Compactor interface that each agent implements
A writer that serializes entries to JSONL
A reader/parser for the compact format (needed by read paths later)
Agent compactors:
Each built-in agent gets a compactor that understands its native format:
Claude Code: Parse JSONL, extract user/assistant messages, drop progress/system/thinking blocks, strip tool result content text
Gemini CLI: Parse JSON messages array, map to Entire Transcript Format entries
Cursor: Parse JSONL variant, similar to Claude Code
OpenCode: Parse JSON export format
Factory AI Droid: Parse envelope format
Copilot CLI: Parse its session format
Each compactor also handles binary asset extraction — pulling inline base64 images out of the transcript and returning them separately as assets.
External agents:
As discussed: compact-transcript --session-ref <path> subcommand, gated by compact_transcript capability. The CLI's CompactTranscript function checks for the capability and delegates to the plugin binary, or returns nil (no compact format available) if the plugin doesn't support it.
Testing strategy:
Each compactor gets unit tests with real transcript samples (anonymized/synthetic). The transcript package gets tests for round-trip serialization (write → read → verify). Integration with the condensation path is tested via the existing integration test infrastructure.
One question: Where should the compactor implementations live? Two options:
In the transcript package — each agent's compactor is a file like compact_claude.go, compact_gemini.go, etc. Keeps all format knowledge in one place.
In each agent's package — the Claude compactor lives in agent/claudecode/, Gemini's in agent/gemini/, etc. Keeps agent-specific knowledge co-located with the agent.
My instinct is option 2 (co-located with the agent) since each compactor needs intimate knowledge of the agent's native format and the agent packages already have transcript parsing logic. The transcript package would own the shared types and the Compactor interface. What's your preference?
User
I'd go with option 2 for now but note that this decision is ultimately up to the person implementing this feature and might be subject to change.
Assistant
Section 5: Generation Rotation for /full/current
When it triggers:
After writing a checkpoint's full.jsonl to /full/current, the condensation path checks if the current generation has reached its capacity threshold.
Rotation logic:
Count checkpoints in the current generation's tree (top-level shard directories)
If count >= threshold (default: 100 checkpoints, as recommended in the RFD):
Write a generation.json to the tree root with checkpoint_count, oldest_checkpoint_at, newest_checkpoint_at
Create fresh orphan commit with empty tree, point refs/entire/checkpoints/v2/full/current at it
Concurrent rotation race (RFD open question #6):
Two CLI instances could both detect that /full/current is at capacity and try to rotate simultaneously. Proposed approach: optimistic — after rotation, if the ref update fails (because someone else already rotated), re-read /full/current (which is now a fresh generation) and write to it. This is the same pattern the existing merge-recovery logic uses for concurrent pushes.
Configuration:
The generation size threshold could be a strategy_options field (e.g., generation_max_checkpoints) but I'd suggest starting with a hardcoded default of 100 and making it configurable only if needed. Keeps the settings surface small.
generation.json written at rotation time to the archived generation's tree root:
This lets the cleanup tool quickly assess eligibility without reading every checkpoint's metadata.
Does this rotation design look right? Anything you'd change about the threshold or the concurrent rotation handling?
User
Yes
Assistant
Section 6: Updated Read Paths
All CLI commands that read checkpoint data need v2 awareness. When checkpoints_v2 is enabled, they read from v2 refs first, fall back to v1 for older checkpoints created before v2 was enabled.
Resolution order for all read operations:
Check v2 /main ref for metadata
Check v2 /full/current (then archived generations) for raw transcripts
Fall back to v1 branch for checkpoints written before v2
Per-command changes:
entire explain — reads metadata + transcript for summarization. With v2: reads metadata.json from /main, prefers transcript.jsonl (compact) if available, falls back to full.jsonl from /full/*. The compact format is actually better for explain since it already strips noise.
entire resume — needs the raw transcript to reconstruct conversation state. Reads full.jsonl from /full/current, searches archived generations if not found. Falls back to v1 branch for old checkpoints.
entire status — reads session metadata and checkpoint counts. Reads from /main ref. Minimal change since it primarily uses metadata.json.
entire rewind — restores files from shadow branch checkpoints (temporary, not committed). No change needed — rewind operates on shadow branches which are unchanged in v2.
entire doctor — health checks. Needs to verify v2 refs exist and are consistent when checkpoints_v2 is enabled.
entire clean — cleanup operations. Needs v2 awareness for what to clean.
entire session list/show — reads from session state files (.git/entire-sessions/) and cross-references committed checkpoint data. Reads metadata from /main.
Shared read helper:
A function like ResolveTranscript(store, checkpointID) ([]byte, format) that encapsulates the resolution order (compact from /main → raw from /full/* → raw from v1) so each command doesn't reimplement the fallback logic.
Does this read path design look right? Any commands I'm missing or concerns about the fallback chain?
User
Yes
Assistant
Section 7: Push Logic
Current push behavior:PrePush hook pushes entire/checkpoints/v1 branch to the checkpoint remote (or the user's push remote).
v2 push behavior (when checkpoints_v2 is enabled):
Since these are custom refs (not under refs/heads/), they require explicit refspecs — the default fetch/push refspec won't pick them up. This is intentional per the RFD: refs under refs/entire/ are invisible to normal git operations.
Merge recovery:
The existing fetchAndMergeSessionsCommon pattern applies to /main — different users write to different sharded paths, so merges are conflict-free. Same logic, different ref name.
For /full/current — same story. Sharded paths mean no conflicts.
Dual-write push phase:
During the dual-write period, PrePush pushes both:
v1 branch (as today)
v2 refs (when enabled)
The "don't push to production until validated" constraint:
This is handled by the rollout sequence — the setting is only enabled in test repos initially. But I want to confirm: should there be an additional safeguard? For example, a push_v2_refs sub-option that's separate from checkpoints_v2, so you could dual-write locally without pushing v2 refs? Or is the rollout discipline (only enable the setting in test repos) sufficient?
User
Yes, let's plan for an additional safeguard for now. This can be something that only exists during development and is removed later.
Assistant
Section 8: Migration Tool
Purpose: Convert existing v1 checkpoint data to v2 format so old checkpoints are accessible via v2 read paths and the v1 branch can eventually be deleted.
When it runs:
An explicit entire migrate command rather than auto-migration on first write. Reasoning:
Migration could take time for repos with large checkpoint history
Users should opt in and be aware of what's happening
Avoids surprising behavior during normal CLI usage
After all checkpoints are migrated, optionally delete the v1 branch
Backfill compaction:
The migration tool uses the same CompactTranscript function from the condensation path. For old checkpoints where the agent type is known (stored in committed metadata), it can retroactively generate compact transcripts. For checkpoints where the agent or format can't be determined, it skips compaction — those checkpoints get full.jsonl on /main as fallback.
Idempotency:
The migration should be safe to run multiple times — if a checkpoint already exists on the v2 refs, skip it. This allows resuming after interruption.
Remote migration:
The migration operates on local refs. After migration, the next git push (via PrePush) pushes the populated v2 refs. The v1 branch deletion can be pushed separately.
One question: Should the migration tool also handle the checkpoint remote scenario (where v1 data lives in a separate repo configured via checkpoint_remote)? Or is it sufficient to run migration locally and let the push logic handle syncing to the remote?
User
For the current project plan, I'd assume that the migration tool would only run locally. We should add a note that it might become necessary to add a --remote option as well down the road.
Assistant
Section 9: Cleanup Tool
Purpose: Delete archived /full/* generation refs whose checkpoints have all aged past the retention window, reclaiming storage.
Implementation: An entire clean subcommand (or extending the existing one if it exists).
How it works:
List all archived generation refs matching refs/entire/checkpoints/v2/full/<sequence-number>
For each generation, read generation.json from the tree root → check newest_checkpoint_at
If the newest checkpoint is older than the retention threshold: delete the ref locally and push the deletion to the remote
/main and /full/current are never touched
Retention threshold:
A strategy_options field, e.g., generation_retention_days with a sensible default (14 days as mentioned in the RFD). This is the only configuration the cleanup tool needs.
This respects the checkpoint_remote setting — if checkpoints are pushed to a separate repo, cleanup targets that repo.
Automation (deferred):
The RFD mentions a GitHub Action for automated cleanup. I'd suggest keeping that out of scope for this project plan — the CLI command is the foundation, and the GitHub Action is a packaging/distribution concern that can come later.
Does this cleanup design look right? And is deferring the GitHub Action the right call?
User
Yes, go ahead
Assistant
Section 10: v1 Removal
Purpose: Once v2 is validated and migration is available, remove v1 code paths to reduce maintenance burden.
What gets removed:
v1 write path in WriteCommitted (or the v1-specific branch of the dual-write logic)
v1 read fallback in all CLI commands
v1 push logic in PrePush
The checkpoints_v2 and push_v2_refs strategy options (v2 becomes the only path)
The entire/checkpoints/v1 branch reference in documentation
What stays temporarily:
The migration tool's ability to read v1 data — this is needed until we're confident all customer repos have been migrated
v1 read-only support could linger behind a --legacy flag or similar if needed, but ideally it's a clean removal
Sequencing:
This is the last phase. It depends on:
v2 dual-write being validated in production
Migration tool being available and tested
A reasonable transition period where customers can migrate
Approach:
A single PR (or small series) that removes the v1 code paths and makes v2 the default. The checkpoints_v2 setting becomes a no-op and is cleaned up. Tests that were specific to v1 behavior get removed or converted to v2 equivalents.
Does this look right? Any concerns about the removal approach or timing?
User
Yes
Assistant
Section 11: Validation Strategy
Test repos:
Use dedicated validation repositories (not production repos) for end-to-end testing of v2 functionality. These repos should have:
The checkpoints_v2 and push_v2_refs settings enabled
Multiple agents configured (at least Claude Code + one other)
Enough checkpoint history to exercise generation rotation
Validation milestones (in order):
Local dual-write works: Condensation writes to both v1 and v2 refs, data is correct in both. Verified by unit + integration tests.
Read paths work end-to-end: At least one CLI command (e.g., entire explain or entire status) successfully reads from v2 refs. This is the "minimum viable end-to-end" that unblocks broader validation.
Compaction produces correct output: Compact transcripts for each agent are verified against expected output. Unit tests per compactor + spot-checking against the prototype's results from the RFD.
Push + fetch works: v2 refs round-trip correctly through a remote (GitHub). Verified in a test repo with push_v2_refs enabled.
Generation rotation works:/full/current rotates correctly after reaching threshold. Cleanup tool deletes old generations and storage is reclaimed.
Migration works: v1 data is correctly converted to v2 format. Verified by migrating a test repo and checking all commands still work.
All read paths work: Every CLI command (explain, resume, status, rewind, doctor, clean, session) works with v2 data, including the v1 fallback for old checkpoints.
E2E test coverage:
The existing E2E test infrastructure (Vogon agent + real agent tests) should be extended with v2-specific scenarios. The Vogon agent is particularly useful here since it's deterministic and free to run. New E2E tests would cover:
Condensation with checkpoints_v2 enabled
Reading checkpoints from v2 refs
Generation rotation trigger
Migration from v1 to v2
Production rollout:
After validation milestones 1-7 pass against test repos:
Enable push_v2_refs in test repos → verify remote data is correct
Enable in a small set of internal/dogfood repos
Roll out to customers (v2 as default, v1 dual-write continues briefly)
After transition period: run migration, remove v1
Does this validation approach give enough confidence? Anything you'd add or change?
User
Yes
Assistant
Section 12: Task Breakdown & Dependencies
Now let me lay out the concrete tasks for both workstreams. I'll make dependencies explicit so you can assign and schedule them.
Workstream A: v2 Storage Infrastructure
ID
Task
Depends on
Description
A1
Strategy option & feature gating
—
Add checkpoints_v2 and push_v2_refs to settings package with helpers
A2
Ref infrastructure in checkpoint store
A1
Helpers for creating/reading/updating refs under refs/entire/, listing refs by prefix, resolving ref targets
A3
WriteCommittedV2 — write to /main ref
A2
Write metadata entries (metadata.json, prompt.txt, content_hash.txt) to /main ref using existing tree-splicing logic
A4
WriteCommittedV2 — write to /full/current ref
A2
Write full.jsonl to /full/current ref, same sharded layout
A5
Dual-write condensation path
A3, A4
Wire WriteCommittedV2 into CondenseSession alongside existing WriteCommitted when checkpoints_v2 is enabled
Explicit refspec pushes for /main and /full/current, merge recovery, gated by push_v2_refs
A8
Read path — shared ResolveTranscript helper
A3, A4
Resolution order: compact from /main → raw from /full/* → raw from v1
A9
Read path — entire status
A8
Update to read metadata from /main with v1 fallback
A10
Read path — entire explain
A8
User
Yes
Assistant
Let me write the design doc.
Assistant
Now let me commit the design doc and then run the spec review.
User
[Request interrupted by user for tool use]
User
Continue with the review loop. The doc doesn't need to be checked into version control.
Assistant
The reviewer found 3 issues. Let me verify issue #3 and then fix all of them.
Assistant
All three issues confirmed. Let me fix the spec.
Assistant
Now let me fix all three issues.
Issue 1: Contradictory fallback — Section 4 says /main gets metadata only when compaction unavailable, Section 6 says write full.jsonl to /main. I'll align with Section 4 (metadata only on /main, never full.jsonl).
Issue 2:UpdateCommitted (stop-time finalization) not addressed.
Issue 3:entire session list/show doesn't exist as a command.
Assistant
Now update the task table to reflect the UpdateCommitted and corrected command references.
Assistant
Also add generation_retention_days to the settings section as the reviewer recommended.
Assistant
Now let me re-run the spec review.
Assistant
One issue remaining: archived generations aren't covered by the push logic. Let me fix that plus add clarifying notes for the reviewer's recommendations.
Assistant
Now add a note about task checkpoint routing.
Assistant
Now let me re-run the spec review one more time.
Assistant
Spec review passed — Approved with no blocking issues.
Assistant
Spec written to docs/superpowers/specs/2026-03-19-checkpoints-v2-design.md. Please review it and let me know if you want to make any changes before we move on to writing the implementation plan.
A few advisory items the reviewer flagged that are worth noting (none blocking):
content_hash.txt scope (Open Question 2) — should be resolved before implementing WriteCommittedV2 since it affects what gets hashed. Worth deciding early.
DeclaredCaps struct — Task B5 should explicitly include adding a CompactTranscript field to agent.DeclaredCaps and an AsTranscriptCompactor helper.
entire clean expansion — Task A14 is extending the existing entire clean command, not creating a new one.
User
Can you phrase things about entire clean and such as a decision that should be made by the person who will implement this. This should be a rough plan used for distributing work, not a prescriptive spec. That's what the RFD is for!
Assistant
Good point — this is a project plan for work distribution, not an implementation spec. Let me soften the prescriptive language.
Assistant
Let me update the sections that are too prescriptive to frame them as decisions for the implementer.
Assistant
Now let me also soften the task table descriptions to be less prescriptive.
Assistant
Updated the spec to frame implementation details as decisions for the implementers rather than prescriptive choices. The spec now focuses on what needs to happen and why, leaving how to the engineers working on it.
Please take a look at the updated docs/superpowers/specs/2026-03-19-checkpoints-v2-design.md and let me know if you'd like any further changes before we move to writing the implementation plan.
User
The RFD I've references has also been updated. Can you take that into account, too?
Assistant
The RFD now includes the external agent compaction protocol section we discussed. Let me align our spec with the RFD's version — there are some differences to reconcile.
Key changes in the RFD:
Explicitly clarifies --session-ref is the absolute file path to the transcript file
Assets only have data (base64) — no path option (the filesystem reference we discussed isn't in the RFD)
Notes that a chunked version (like chunk-transcript) could be added if the 10MB stdout limit becomes an issue
Includes a "Why base64 encoding" rationale
API domain now explicitly mentions falling back to full.jsonl on /full/current for plugins without compaction
Assistant
Updated the spec to align with the RFD's external agent protocol section. Key changes:
Removed the path option from assets (RFD only has data)
Added explicit note that --session-ref is the absolute file path to the transcript
Added the 10 MB chunked version escape hatch note
Added the "no permanent full.jsonl on /main" rationale from the RFD
Anything else you'd like to change in the spec?
User
I think the spec is good for now. I'd like to start working on the project now. I'll be working on the v2 ref structure. Can you start by adding the checkpoints checkpoints_v2 strategy option, related helpers and tests? We'll introduce the other options when they're actually needed.
Assistant
Let me read the settings package to understand the existing patterns.
Assistant
Now let me look at the existing tests to understand patterns.
Assistant
Good, I see the patterns. checkpoints_v2 is a boolean in strategy_options, similar to push_sessions. Let me implement the helper and tests.
Assistant
Now add the package-level convenience function, following the IsSummarizeEnabled pattern.
Assistant
Now add tests.
Assistant
Now let me build and test.
Assistant
All 7 tests pass. Let me also run the full settings test suite to make sure nothing is broken.
Assistant
All passing. Here's what I added:
settings.go:
(*EntireSettings).IsCheckpointsV2Enabled() — reads checkpoints_v2 bool from strategy_options, returns false if missing/nil/wrong type
IsCheckpointsV2Enabled(ctx) — package-level convenience that loads settings and delegates
settings_test.go — 7 tests:
Defaults to false (nil strategy_options)
False with empty strategy_options
True when explicitly set
False when explicitly set to false
False for non-bool value (e.g., "yes")
Loads correctly from settings.json
Local override via settings.local.json merges correctly
User
/requesting-code-review Review the changes in this branch against main.
User
superpowers:requesting-code-review
/superpowers:requesting-code-review
Review the changes in this branch against main.
Assistant
No commits yet — these are unstaged changes. Let me dispatch the reviewer on the working tree diff.
Assistant
Review came back clean — Ready to merge, no issues to fix.
Summary of reviewer feedback:
No critical or important issues
Implementation follows existing patterns exactly
All tests pass, safe defaults
Minor notes: the .gitignore change is unrelated (we can split it into a separate commit if desired), and method placement ordering is a nit
The checkpoints_v2 strategy option is ready. Want me to commit this, or do you want to review the diff first?
User
Can you commit the .gitignore change and the strategy option in two commits?
Assistant
Done. Two clean commits:
2bfdb5fb — .gitignore addition for docs/superpowers/
2585b2a7 — checkpoints_v2 strategy option with helpers and tests
Dual-write: continue writing v1 branch AND write to v2 refs
Initially, /main stores only metadata (metadata.json, prompt.txt, content_hash.txt) — no transcript
/full/current stores full.jsonl (raw transcript, same as today)
Update all CLI read paths (explain, resume, status, rewind, doctor, clean) to read from v2 refs with v1 fallback
Implement generation rotation for /full/current
Update push logic for custom refs under refs/entire/
Implement the v1→v2 migration path
Workstream B: Transcript Compaction (Entire Transcript Format + agent compactors)
Define and implement the Entire Transcript Format types
Implement compactors for each built-in agent (Claude Code, Gemini, Cursor, OpenCode, Factory AI Droid, Copilot CLI)
Add compact-transcript to the external agent protocol
Binary asset externalization logic
Integration: wire compaction into the condensation path so transcript.jsonl is written to /main
The interface between the two workstreams is small and well-defined:
Workstream A provides a WriteToMain(checkpointID, entries map[string][]byte) capability that accepts arbitrary file entries for a checkpoint
Workstream B produces transcript.jsonl and assets/* and calls that same write path
Until B is ready, A just doesn't write a transcript to /main — the read paths know to fall back to /full/current for the raw transcript
The merge point is when B's compaction output gets wired into A's condensation path. That's a single integration PR after both sides are tested independently.
My next question: Regarding the dual-write transition period and the "shippable at every PR" constraint:
During the transition, the CLI needs to write to both v1 and v2. Your notes say "start switching dual writing v1 + v2" and "switch over main ref first." I want to make sure I understand the intended rollout sequence:
Phase 1 — Dual-write (v1 + v2): Every condensation writes to both entire/checkpoints/v1 branch AND refs/entire/checkpoints/v2/* refs. Read paths prefer v2, fall back to v1. This is behind a strategy option (e.g., "checkpoints_v2": true).
Phase 2 — v2 only: Once validated, stop writing to v1. New installs default to v2. Existing repos auto-migrate on first write (or explicit entire migrate).
Phase 3 — v1 cleanup: Migration tool to convert old v1 data. Eventually remove v1 code paths.
Is that roughly the rollout sequence you had in mind? And specifically: during dual-write, should the v2 refs be pushed to remotes, or should pushing v2 refs only happen after we've validated the format in test repos? (This ties into your constraint about not pushing v2 to production repos before validation.)
Cons:
Compaction is tightly coupled with /main writes, making Engineer A's workstream much larger
The ref infrastructure (creating/managing refs under refs/entire/) is shared — risk of stepping on each other
Read paths for commands like entire explain need both refs, creating more merge points
Approach 3: Split by phase — Write paths first, then read paths
Phase 1 (both engineers, different write paths): A does ref infrastructure + dual-write, B does compaction. Same as Approach 1 for this phase.
Phase 2 (both engineers, different read commands): Split the CLI commands between engineers. A takes explain, status, doctor. B takes resume, rewind, session list.
Read path updates are individually small — splitting them between engineers adds coordination overhead without much time savings
Phase 2 can't start until Phase 1 is mostly done for both engineers, creating a synchronization point
My recommendation: Approach 1
It has the cleanest separation of concerns, the smallest interface between workstreams, and aligns with how you described the parallel work in your notes. The "idle time" risk for Engineer B is manageable — if compaction finishes before storage infra, B can start on the migration tool's compaction side (backfilling transcript.jsonl for old checkpoints) or help A with read path updates.
Does one of these resonate, or would you like me to explore a different split?
Update to prefer transcript.jsonl, fall back to full.jsonl
A11
Read path — entire resume
A8
Read full.jsonl from /full/current with archived generation search
A12
Read path — entire session list/show
A8
Cross-reference committed data from /main
A13
Read path — entire doctor
A8
Health checks for v2 ref consistency
A14
Read path — entire clean
A6
Cleanup tool: list archived generations, check retention, delete eligible refs
A15
Vogon E2E tests for v2
A5
E2E scenarios for dual-write, read paths, generation rotation
A16
Migration tool
A3, A4, B5
entire migrate command: read v1 tree, split into /main + /full/current, backfill compaction where possible. Note: depends on B5 for compaction backfill, but can be built without it (just skip transcript.jsonl generation) and wired up later
Workstream B: Compaction
ID
Task
Depends on
Description
B1
Entire Transcript Format types
—
Package with type definitions (Header, UserEntry, AssistantEntry, UserToolResultEntry), JSONL writer, JSONL reader/parser
B2
Compactor interface & CompactTranscript function
B1
Interface definition, dispatch function that routes to agent-specific compactor
B3
Claude Code compactor
B2
Parse JSONL, extract user/assistant turns, drop thinking/progress/system, extract binary assets
B4
Remaining built-in agent compactors
B2
Gemini CLI, Cursor, OpenCode, Factory AI Droid, Copilot CLI — can be parallelized or done sequentially
B5
External agent protocol extension
B2
Add compact_transcript capability, compact-transcript subcommand, fallback when unsupported
B6
Binary asset externalization
B2
Extract base64 images from transcripts, return as separate assets alongside compact transcript
B7
Unit tests per compactor
B3, B4
Test each compactor with real (anonymized/synthetic) transcript samples
B8
Wire compaction into condensation
A5, B2
Integration PR: call CompactTranscript in the dual-write condensation path, write transcript.jsonl + assets/* to /main
Joint Tasks (after both workstreams converge)
ID
Task
Depends on
Description
J1
End-to-end validation in test repos
A15, B8
Full scenario: session → condensation → v2 write with compaction → read via CLI commands → push → fetch
J2
Wire compaction into migration tool
A16, B5
Backfill transcript.jsonl for old v1 checkpoints during migration
J3
Production rollout
J1
Enable push_v2_refs in dogfood repos, validate remote data
J4
Remove v1 support
J1, J2, J3
Remove dual-write, v1 read fallbacks, settings options; make v2 the only path