checkpoint

package
v0.5.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 5, 2026 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Overview

Package checkpoint provides checkpoint creation and management for supervised execution.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Checkpoint

type Checkpoint struct {
	Pre       *PreCheckpoint   `json:"pre,omitempty"`
	Post      *PostCheckpoint  `json:"post,omitempty"`
	Reconcile *ReconcileResult `json:"reconcile,omitempty"`
	Supervise *SuperviseResult `json:"supervise,omitempty"`
}

Checkpoint represents a complete checkpoint for a step.

type Decision

type Decision struct {
	Choice string `json:"choice"`
	Reason string `json:"reason"`
}

Decision represents a key decision made during execution.

type Phase

type Phase string

Phase represents the execution phase of a step.

const (
	PhaseCommit    Phase = "commit"
	PhaseExecute   Phase = "execute"
	PhaseReconcile Phase = "reconcile"
	PhaseSupervise Phase = "supervise"
)

type PostCheckpoint

type PostCheckpoint struct {
	StepID        string    `json:"step_id"`
	ActualOutput  string    `json:"actual_output"`
	ToolsUsed     []string  `json:"tools_used,omitempty"`
	MetCommitment bool      `json:"met_commitment"`
	Deviations    []string  `json:"deviations,omitempty"`
	Concerns      []string  `json:"concerns,omitempty"`
	Unexpected    []string  `json:"unexpected,omitempty"`
	Timestamp     time.Time `json:"timestamp"`
}

PostCheckpoint is created during the EXECUTE phase after execution.

type PreCheckpoint

type PreCheckpoint struct {
	StepID          string            `json:"step_id"`
	StepType        string            `json:"step_type"` // GOAL, AGENT, RUN
	Instruction     string            `json:"instruction"`
	Interpretation  string            `json:"interpretation"`
	ScopeIn         []string          `json:"scope_in,omitempty"`
	ScopeOut        []string          `json:"scope_out,omitempty"`
	Approach        string            `json:"approach"`
	ToolsPlanned    []string          `json:"tools_planned,omitempty"`
	PredictedOutput string            `json:"predicted_output"`
	Confidence      string            `json:"confidence"` // high, medium, low
	Assumptions     []string          `json:"assumptions,omitempty"`
	Timestamp       time.Time         `json:"timestamp"`
	Metadata        map[string]string `json:"metadata,omitempty"`
}

PreCheckpoint is created during the COMMIT phase before execution.

type ReconcileResult

type ReconcileResult struct {
	StepID    string    `json:"step_id"`
	Triggers  []string  `json:"triggers"`
	Supervise bool      `json:"supervise"`
	Timestamp time.Time `json:"timestamp"`
}

ReconcileResult is created during the RECONCILE phase.

type Store

type Store struct {
	// contains filtered or unexported fields
}

Store manages checkpoints for a session.

func NewStore

func NewStore(dir string) (*Store, error)

NewStore creates a new checkpoint store.

func (*Store) Get

func (s *Store) Get(stepID string) *Checkpoint

Get retrieves a checkpoint by step ID.

func (*Store) GetDecisionTrail

func (s *Store) GetDecisionTrail() []*Checkpoint

GetDecisionTrail returns all checkpoints in order for audit.

func (*Store) Load

func (s *Store) Load() error

Load loads checkpoints from disk.

func (*Store) SavePost

func (s *Store) SavePost(cp *PostCheckpoint) error

SavePost saves a post-checkpoint.

func (*Store) SavePre

func (s *Store) SavePre(cp *PreCheckpoint) error

SavePre saves a pre-checkpoint.

func (*Store) SaveReconcile

func (s *Store) SaveReconcile(r *ReconcileResult) error

SaveReconcile saves a reconcile result.

func (*Store) SaveSupervise

func (s *Store) SaveSupervise(r *SuperviseResult) error

SaveSupervise saves a supervise result.

type SuperviseResult

type SuperviseResult struct {
	StepID     string    `json:"step_id"`
	Verdict    string    `json:"verdict"` // CONTINUE, REORIENT, PAUSE
	Correction string    `json:"correction,omitempty"`
	Question   string    `json:"question,omitempty"` // for PAUSE
	Timestamp  time.Time `json:"timestamp"`
}

SuperviseResult is created during the SUPERVISE phase.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL