Documentation
¶
Index ¶
- type Category
- type Consolidator
- type Entry
- type Store
- func (s *Store) BuildContextFromMemory(ctx context.Context, query string) string
- func (s *Store) ClearHistory(_ context.Context, sessionID string) error
- func (s *Store) Close() error
- func (s *Store) Consolidate(_ context.Context) (int64, error)
- func (s *Store) Count(_ context.Context) (int, error)
- func (s *Store) DB() *sql.DB
- func (s *Store) Forget(_ context.Context, id int64) error
- func (s *Store) Get(_ context.Context, id int64) (*Entry, error)
- func (s *Store) GetHistory(_ context.Context, sessionID string, limit int) ([]map[string]string, error)
- func (s *Store) GetLatestSessionID() (string, error)
- func (s *Store) List(_ context.Context, category Category, limit int) ([]Entry, error)
- func (s *Store) ListOlderThan(ctx context.Context, olderThan time.Time, limit int) ([]Entry, error)
- func (s *Store) MemStore(_ context.Context, category Category, content, tags string, importance float64) (int64, error)
- func (s *Store) Recall(_ context.Context, query string, limit int) ([]Entry, error)
- func (s *Store) SaveHistory(_ context.Context, sessionID, role, content string) error
- type SummarizeFunc
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Consolidator ¶
type Consolidator struct {
// contains filtered or unexported fields
}
Consolidator merges old memories into concise summaries.
func NewConsolidator ¶
func NewConsolidator(store *Store, summarize SummarizeFunc) *Consolidator
NewConsolidator creates a memory consolidator. summarize is called to produce a summary of a group of memories. If nil, a simple concatenation is used as fallback.
func (*Consolidator) Consolidate ¶
func (c *Consolidator) Consolidate(ctx context.Context) (int, error)
Consolidate finds old daily/conversation memories, groups by tags, summarizes, and replaces.
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
func (*Store) BuildContextFromMemory ¶
BuildContextFromMemory retrieves relevant memories for the current query and formats them for the system prompt. Core memories are ALWAYS included. Additional memories are keyword-matched from the query.
func (*Store) ClearHistory ¶
ClearHistory deletes all history for a session.
func (*Store) Consolidate ¶
Consolidate removes old, low-importance memories that haven't been accessed recently. Keeps core, lesson, and correction memories. Removes daily/conversation/custom memories older than 30 days with low access counts and importance.
func (*Store) GetHistory ¶
func (s *Store) GetHistory(_ context.Context, sessionID string, limit int) ([]map[string]string, error)
GetHistory returns conversation history for a session.
func (*Store) GetLatestSessionID ¶
GetLatestSessionID returns the most recent session ID from conversation history.
func (*Store) ListOlderThan ¶
ListOlderThan returns daily/conversation memories older than the given time.
func (*Store) MemStore ¶
func (s *Store) MemStore(_ context.Context, category Category, content, tags string, importance float64) (int64, error)
MemStore stores a memory entry with an importance score. Importance ranges from 0.0 to 1.0 (default 0.5).