Plan: Update sessions-and-checkpoints.md to match current codebase
Context
The documentation at docs/architecture/sessions-and-checkpoints.md was written from an early design doc and has diverged significantly from the actual implementation. Struct definitions, interface signatures, package locations, directory layouts, and even entire features (session nesting) described in the doc don't exist in the code. This update brings the doc in line with the actual codebase.
File to modify
docs/architecture/sessions-and-checkpoints.md
Changes
1. Replace Session struct (lines 14-33)
Remove the aspirational session package struct with FirstPrompt, AgentType, AgentSessionID, SubSessions, ParentID, ToolUseID, IsSubSession()
Replace with actual strategy.Session from strategy/session.go: ID, Description, Strategy, StartTime, Checkpoints
2. Replace Checkpoint struct (lines 40-54)
Remove ID string, SessionID string, Type CheckpointType
Replace with actual strategy.Checkpoint from strategy/session.go: CheckpointID id.CheckpointID, Message, Timestamp, IsTaskCheckpoint, ToolUseID
3. Update checkpoint.Type naming (lines 48-53)
Change CheckpointType to checkpoint.Type (from checkpoint/checkpoint.go)
4. Remove session nesting section (lines 63-74)
Delete the entire "Session Nesting" section — subsessions are not implemented
5. Replace Sessions interface (lines 81-86)
Remove the aspirational Sessions interface with Create, Get, List
Replace with the actual standalone functions: ListSessions() and GetSession() from strategy/session.go
6. Replace interface (lines 93-132)
Assistant
I'll start by reading the current documentation file and the relevant source files to get the exact struct definitions and signatures.
Assistant
Now let me read the remaining source files I need for the other changes.
Assistant
Now let me find the CondenseSession function signature and the SaveChanges signature for auto-commit.
Assistant
Now let me check if there's a session/session.go file (the plan says it doesn't exist).
Assistant
Good, confirmed session/session.go doesn't exist. Now I have all the information needed. Let me write the updated document.
Assistant
Now I have everything I need. Let me write the updated document.
Assistant
Now let me verify the changes are correct by checking for removed concepts and ensuring key identifiers match the codebase.
Assistant
All removed concepts (SubSessions, ParentID, CheckpointStore, TemporaryCheckpoint, CommittedCheckpoint) are gone, and all the correct identifiers from the actual codebase are present. The document is updated.
Here's a summary of all changes made:
Session struct - Replaced aspirational struct with actual strategy.Session (ID, Description, Strategy, StartTime, Checkpoints)
Checkpoint struct - Replaced with actual (CheckpointID, Message, Timestamp, IsTaskCheckpoint, ToolUseID)
CheckpointStore
Remove CheckpointStore with old method signatures and TemporaryCheckpoint/CommittedCheckpoint structs
Replace with actual checkpoint.Store interface from checkpoint/checkpoint.go — document key methods with their actual signatures (WriteTemporary(ctx, WriteTemporaryOptions), ReadTemporary(ctx, baseCommit, worktreeID), WriteCommitted(ctx, WriteCommittedOptions), ReadCommitted(ctx, checkpointID), ReadSessionContent(ctx, checkpointID, sessionIndex), ListCommitted(ctx), ListTemporary(ctx))
Show the actual WriteTemporaryOptions and WriteCommittedOptions types (abbreviated — just key fields)
7. Update TokenUsage package location
Change from checkpoint package to agent.TokenUsage in agent/types.go
8. Update Condense function signature (lines 142-145)
Change from Condense(ctx, sessionID, commitRef) to actual CondenseSession(repo, checkpointID, state) from manual_commit_condensation.go
Confirm no references to removed concepts: SubSessions, ParentID, CheckpointStore, TemporaryCheckpoint
If you need specific details from before exiting plan mode (like exact code snippets, error messages, or content you generated), read the full transcript at: /Users/soph/.REDACTED.jsonl
strategy.Checkpoint
Checkpoint type naming - Changed CheckpointType to checkpoint.Type from checkpoint/checkpoint.go