Documentation
¶
Overview ¶
Package memory provides SQLite-backed persistent storage for the autopilot agent. It stores conversation history (with pruning), user facts as key-value pairs the agent learns over time, and per-module state.
Index ¶
- type Message
- type Store
- func (s *Store) AddMessage(role, content string) error
- func (s *Store) AllFacts() (map[string]string, error)
- func (s *Store) Close() error
- func (s *Store) GetFact(key string) (string, error)
- func (s *Store) GetModuleState(module, key string) (string, error)
- func (s *Store) PruneMessages(keep int) (int64, error)
- func (s *Store) RecentMessages(n int) ([]Message, error)
- func (s *Store) SetFact(key, value string) error
- func (s *Store) SetModuleState(module, key, value string) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
Store is the persistent memory backend backed by SQLite.
func Open ¶
Open creates or opens a SQLite database at the given path and initializes the schema. Parent directories are created if they don't exist.
func (*Store) AddMessage ¶
AddMessage stores a conversation message with the given role and content.
func (*Store) GetFact ¶
GetFact retrieves a single fact by key. Returns empty string and nil error if the key doesn't exist.
func (*Store) GetModuleState ¶
GetModuleState retrieves a module-scoped value. Returns empty string and nil error if the key doesn't exist.
func (*Store) PruneMessages ¶
PruneMessages deletes all but the most recent n messages.
func (*Store) RecentMessages ¶
RecentMessages returns the most recent n messages ordered oldest-first.
func (*Store) SetFact ¶
SetFact upserts a user fact. Facts are things the agent learns about the user over time — name, preferences, habits, goals.
func (*Store) SetModuleState ¶
SetModuleState persists a key-value pair scoped to a specific module.