plan

package
v0.11.0-beta.1 Latest Latest
Warning

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

Go to latest
Published: Oct 23, 2026 License: Apache-2.0, MIT Imports: 10 Imported by: 0

Documentation

Overview

Package plan — current-task plan + todo store. One "active plan" per session: a list of items the agent committed to doing, surfaced in the TUI right pane, and used at end-of-task to drive the tick-off + learnings reflection (master plan §4.11 + §6.2 self-learning loop).

Storage shape: snapshot JSON at ~/.overkill/plans/<session>.json PLUS an event-log sidecar (same pattern as personality state files — see internal/personality/eventlog.go). The store IS agent-mutable, but only via typed tools (plan_set, plan_check, plan_status); raw writes to the plan dir are blocked by the protected-path gate in internal/agent/tool_scan.go.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Item

type Item struct {
	ID     string     `json:"id"`
	Text   string     `json:"text"`
	Done   bool       `json:"done"`
	DoneAt *time.Time `json:"done_at,omitempty"`
	// Note is an optional one-line annotation the agent can attach
	// when checking an item — useful for "checked but with caveat".
	Note string `json:"note,omitempty"`
}

Item is one todo in the active plan. ID is opaque and assigned by the store on Set; the agent references items by ID for Check /Uncheck calls. Done timestamps are kept so the end-of-task surface can show "you completed 4 of 6 — what's left?".

type Learning

type Learning struct {
	ID        string    `json:"id"`
	Timestamp time.Time `json:"timestamp"`
	SessionID string    `json:"session_id"`
	Topic     string    `json:"topic"`
	Lesson    string    `json:"lesson"`
	Tags      []string  `json:"tags,omitempty"`
	ModelID   string    `json:"model_id,omitempty"`
}

Learning is one reflection record. Topic is the broad area ("auth refactor", "wall 4 monitor"); Lesson is the takeaway in the agent's own words. Tags optional. ModelID lets cross-session queries filter by current model (§4.16) — same pattern as FailedHypothesis.

type LearningsStore

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

LearningsStore wraps the JSONL directory. Reads scan every daily file under the dir; writes append to today's file.

func NewLearningsStore

func NewLearningsStore(dir string) *LearningsStore

func (*LearningsStore) All

func (s *LearningsStore) All() ([]Learning, error)

All loads every persisted learning across every day file.

func (*LearningsStore) Append

func (s *LearningsStore) Append(l Learning) error

Append writes one learning. ID is assigned if blank.

func (*LearningsStore) Search

func (s *LearningsStore) Search(query string) ([]Learning, error)

Search substring-matches across Topic / Lesson / Tags case-insensitively. Empty query returns nothing — callers wanting "everything" should use All.

func (*LearningsStore) SearchForModel

func (s *LearningsStore) SearchForModel(query, modelID string) ([]Learning, error)

SearchForModel is Search filtered to records produced by the given model ID. Unversioned records (no ModelID) pass through — see FailedHypothesisStore.SearchForModel for the same pattern.

type Plan

type Plan struct {
	SessionID string    `json:"session_id"`
	Title     string    `json:"title"`
	Items     []Item    `json:"items"`
	Created   time.Time `json:"created"`
	Updated   time.Time `json:"updated"`
}

Plan is the full active-plan record. Title is the headline description; Items is the checklist. Created/Updated bracket the plan's lifetime. SessionID lets the daemon and TUI agree on which plan to show when multiple sessions overlap.

type Store

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

Store wraps the on-disk plan file for ONE session. Concurrent access from the agent (writing) and the TUI sidebar (reading) is serialised by the in-memory mutex; cross-process safety comes from atomic rename + the event-log sidecar.

func NewStore

func NewStore(dir, sessionID string) *Store

NewStore builds a per-session Store. The directory is created lazily on the first Save. sessionID is the agent's session ID; the file lives at <dir>/<sessionID>.json.

func (*Store) Check

func (s *Store) Check(itemID, note string) (*Plan, error)

Check marks an item done by ID. Note is optional. Returns the updated plan. Idempotent — checking an already-done item just refreshes the DoneAt timestamp.

func (*Store) Clear

func (s *Store) Clear() error

Clear removes the active plan. Used at end of task when the agent confirms everything's done — frees the right pane for the next task's plan.

func (*Store) Current

func (s *Store) Current() *Plan

Current returns the in-memory plan or nil. Cheap — no disk hit.

func (*Store) Load

func (s *Store) Load() (*Plan, error)

Load reads the snapshot from disk (or the event-log latest if the snapshot is missing/corrupt). Missing-file is the legal "no active plan" state — returns (nil, nil).

func (*Store) Remaining

func (s *Store) Remaining() int

Remaining returns the count of unchecked items in the current plan, or 0 when there's no plan. Used by the end-of-task surface to decide whether to nudge the agent.

func (*Store) Set

func (s *Store) Set(title string, itemTexts []string) (*Plan, error)

Set replaces the active plan with a new title + items. Any prior plan for this session is overwritten. Items get fresh IDs assigned. Use this at the top of a task once the agent has decomposed the work into checkable steps.

func (*Store) Uncheck

func (s *Store) Uncheck(itemID string) (*Plan, error)

Uncheck flips an item back to pending. Mirrors Check semantics. The plan's Updated timestamp moves; the item's DoneAt is cleared.

Jump to

Keyboard shortcuts

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