class

Smith::Checkpoints::Store

Inherits Reference < Object

Constructors

new(session_dir : String, enabled : Bool = true)
Source
open(session_dir : String, enabled : Bool, max : Int32, retention : Time::Span) : Store

What a run needs at startup: a store on this session's directory, pruned to the configured limits before anything new is written to it.

Every start path calls this — the interactive loop, smith run and smith -c. Construction and pruning are one step on purpose: they were two, inline in the interactive setup, and the headless paths reached neither. A path that gets its store from here cannot forget to prune.

Source

Instance methods

blob_count
Source
blobs_dir

Blobs are shared across all checkpoints of a session, not stored per checkpoint — otherwise ten edits of one file would still keep ten copies, which is exactly what content addressing is meant to avoid.

Source
checkpoints_dir
Source
current_message_id

Set by the agent before each batch of tool calls. The registry has no business knowing about the transcript, so the position is handed in rather than looked up.

Source
current_message_id=(current_message_id : String | Nil)

Set by the agent before each batch of tool calls. The registry has no business knowing about the transcript, so the position is handed in rather than looked up.

Source
default_target

What a bare rewind acts on: the newest checkpoint, so one invocation undoes one step. Rewinding the whole session by accident is the expensive direction to get wrong, and --to <id> reaches further on purpose.

Source
enabled?
Source
list
Source
prune(max : Int32, retention : Time::Span) : Nil
Source
rewind_to(target : Entry, force : Bool = false, dry_run : Bool = false) : RestoreResult

Undoes target and everything after it.

Applied per file rather than per entry: the newest entry for a file describes the state smith left it in, which is what an external change is measured against, while the oldest holds the content to put back.

Source
seal(entry : Entry) : Nil

Called once the tool has run, so a later rewind can tell smith's own change apart from one made afterwards by someone else.

Not named finalize: that is Crystal's GC hook.

Source
session_dir
Source
snapshot(tool : String, args : JSON::Any) : Entry | Nil
Source