Documentation
¶
Overview ¶
Package memory owns the user-managed long-term memory store: short facts the user chooses to keep, inject into chat, disable, or remove. Nothing in here is model-written or hidden; persistence lives in the local SQLite datastore.
Index ¶
- Variables
- type Memory
- type Snapshot
- type Store
- func (s *Store) Add(text string) (Memory, error)
- func (s *Store) Clear() error
- func (s *Store) Close() error
- func (s *Store) PromptTexts() ([]string, error)
- func (s *Store) PromptTextsContext(ctx context.Context) ([]string, error)
- func (s *Store) Recovered() bool
- func (s *Store) Remove(id string) error
- func (s *Store) SetEnabled(enabled bool) error
- func (s *Store) SetItemEnabled(id string, enabled bool) (Memory, error)
- func (s *Store) Snapshot() (Snapshot, error)
- func (s *Store) Summary(ctx context.Context) (Summary, error)
- type Summary
Constants ¶
This section is empty.
Variables ¶
var ( // ErrMemoryInvalid reports text that cannot be stored safely. ErrMemoryInvalid = errors.New("invalid memory") // ErrMemoryLimit reports that the durable memory capacity is full. ErrMemoryLimit = errors.New("memory limit reached") )
var ErrMemoryNotFound = errors.New("memory not found")
ErrMemoryNotFound reports an unknown memory identifier.
Functions ¶
This section is empty.
Types ¶
type Memory ¶
type Memory struct {
ID string `json:"id"`
Text string `json:"text"`
Enabled bool `json:"enabled"`
CreatedAt string `json:"created_at"`
}
Memory is one saved fact.
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
Store owns durable memory rows and the global injection switch.
func Open ¶
Open loads the memory store from dataDir; a missing store starts enabled and empty, and a corrupt file recovers to the same without failing startup.
func OpenWithDatabase ¶
OpenWithDatabase borrows the process-owned datastore for the memory domain.
func (*Store) PromptTexts ¶
PromptTexts returns the enabled memory texts for prompt injection, or nil when the global switch is off — chat must work identically without them.
func (*Store) PromptTextsContext ¶
PromptTextsContext reads prompt memories with the caller's lifetime.
func (*Store) SetEnabled ¶
SetEnabled flips the global injection switch.
func (*Store) SetItemEnabled ¶
SetItemEnabled toggles one memory without deleting it.