Documentation
¶
Overview ¶
Package checkpoint stores per-turn PRE-IMAGES of files the agent edits, so a bad run can be rewound without touching git: before edit_file mutates a file, its current bytes (or its absence) are snapshotted under .memcode/checkpoints/<session>/<seq>/. Rewinding to turn N restores every touched file to its earliest pre-image from turns N..latest — the state the tree had before turn N ran. Shadow copies only: git stays untouched, and changes made OUTSIDE the agent's edit tool (bash, the user's editor) are not captured — this is the agent-edit undo, not a filesystem time machine.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Checkpoint ¶
type Checkpoint struct {
// contains filtered or unexported fields
}
Checkpoint is an open checkpoint accumulating snapshots for the current turn.
func (*Checkpoint) Empty ¶
func (cp *Checkpoint) Empty() bool
Empty reports whether the checkpoint captured nothing (no edits this turn).
func (*Checkpoint) Snapshot ¶
func (cp *Checkpoint) Snapshot(relPath string)
Snapshot records path's current state (bytes or absence) once per checkpoint. relPath may be absolute (it is normalized against the root). Best-effort: snapshot failures never block the edit itself.
type File ¶
type File struct {
Path string `json:"path"` // repo-relative
Existed bool `json:"existed"` // false → the edit CREATED it (rewind deletes it)
}
File is one snapshotted pre-image.
type Log ¶
type Log struct {
// contains filtered or unexported fields
}
Log is one session's checkpoint store.
func (*Log) Begin ¶
func (l *Log) Begin(label string) *Checkpoint
Begin opens a checkpoint for one turn. Nothing is written until the first Snapshot, so turns that never edit cost nothing. Prunes old checkpoints.