Repository navigation
architecture checkpoints
Version messages within a session with checkpoint sequences and branch suffixes; support goto/truncate flows and REPL prompt prefixes; optional git commit OID sync on the session record.
| Package / file | Responsibility |
|---|---|
internal/checkpoint/ |
Bump, StampMsg, labels, truncate, full id types |
internal/agent/runtime/checkpoint.go |
ApplyGotoCheckpoint, staging |
internal/agent/commands/checkpoint_cmds.go |
Slash checkpoint UX |
internal/chatstore/checkpoint_sync.go |
LastCommitOID sync |
| Function | Behavior |
|---|---|
checkpoint.Bump |
Advance CheckpointLast on user message |
checkpoint.StampMsg |
Attach seq/branch to message |
FormatReplPromptPrefix |
You: prompt shows next checkpoint tag |
FormatLinePrefix |
Prefix on echoed user/assistant lines |
Runtime.ApplyGotoCheckpoint |
Restore staged workspace files then rewind session to a checkpoint id |
Tags look like [#012] or [#012b] when a branch suffix is active (FormatCheckpointTag).
Tool and transcript output keeps the checkpoint tag on the first visual row; wrapped or multiline continuation rows use the checkpoint continuation gutter instead of repeating the full tag. Terminal-aware wrapping also accounts for the live output descriptor when output is routed through the runtime mux.
flowchart TD
user["/checkpoint slash"]
parse[Resolve FullCheckpointID]
apply[ApplyGotoCheckpoint]
trunc[Truncate messages after target]
persist[persistSession]
user --> parse --> apply --> trunc --> persist
Exact slash names and branch rules: checkpoint_cmds.go.
editFile calls record a per-session staging log under chats/<session-id>/staging/ (baselines on first touch, operations tagged with checkpoint seq). ApplyGotoCheckpoint replays baselines and ops up to the target seq on the project root before truncating the transcript. Shell mutations are not staged in v1.
Session.LastCommitOID can be updated from workspace git state for correlation with checkpoints (checkpoint_sync.go, runtime staging hooks).
- New checkpoint operations: extend
checkpointpackage and slash commands together.