Documentation
¶
Overview ¶
Package memory provides SQLite-backed persistent memory storage for agents.
Index ¶
- type Entry
- type SQLiteMemoryStore
- func (ms *SQLiteMemoryStore) ExtractAndSave(ctx context.Context, agentID, transcript string, embedder provider.Embedder) error
- func (ms *SQLiteMemoryStore) Save(ctx context.Context, entry executor.MemoryEntry) error
- func (ms *SQLiteMemoryStore) SaveFull(ctx context.Context, entry Entry) error
- func (ms *SQLiteMemoryStore) Search(ctx context.Context, agentID, query string, limit int) ([]executor.MemoryEntry, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Entry ¶
type Entry struct {
ID string
AgentID string
Content string
Category string // e.g., "decision", "fact", "preference", "general"
Embedding []float32 // optional vector embedding
CreatedAt time.Time
}
Entry is a single piece of persistent agent memory.
type SQLiteMemoryStore ¶
type SQLiteMemoryStore struct {
// contains filtered or unexported fields
}
SQLiteMemoryStore implements executor.MemoryStore using SQLite FTS5 and optional vector embeddings for hybrid semantic search.
func NewSQLiteMemoryStore ¶
func NewSQLiteMemoryStore(db *sql.DB) (*SQLiteMemoryStore, error)
NewSQLiteMemoryStore creates a new SQLiteMemoryStore. It creates the required tables if they don't exist.
func (*SQLiteMemoryStore) ExtractAndSave ¶
func (ms *SQLiteMemoryStore) ExtractAndSave(ctx context.Context, agentID, transcript string, embedder provider.Embedder) error
ExtractAndSave implements executor.MemoryStore. Extracts key facts from a conversation transcript and saves them.
func (*SQLiteMemoryStore) Save ¶
func (ms *SQLiteMemoryStore) Save(ctx context.Context, entry executor.MemoryEntry) error
Save implements executor.MemoryStore.
func (*SQLiteMemoryStore) SaveFull ¶
func (ms *SQLiteMemoryStore) SaveFull(ctx context.Context, entry Entry) error
SaveFull saves an Entry including optional vector embedding.
func (*SQLiteMemoryStore) Search ¶
func (ms *SQLiteMemoryStore) Search(ctx context.Context, agentID, query string, limit int) ([]executor.MemoryEntry, error)
Search implements executor.MemoryStore. Uses FTS5 BM25 ranking to find relevant memories for an agent.