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 ¶
- type Item
- type Learning
- type LearningsStore
- type Plan
- type Store
- func (s *Store) Check(itemID, note string) (*Plan, error)
- func (s *Store) Clear() error
- func (s *Store) Current() *Plan
- func (s *Store) Load() (*Plan, error)
- func (s *Store) Remaining() int
- func (s *Store) Set(title string, itemTexts []string) (*Plan, error)
- func (s *Store) Uncheck(itemID string) (*Plan, error)
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 ¶
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 ¶
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 ¶
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) Load ¶
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 ¶
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.