semanticmemory

package
v0.0.202 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 31, 2026 License: MIT Imports: 12 Imported by: 0

Documentation

Overview

Package semanticmemory provides a local, inspectable durable-memory store for Comanda workflows. It intentionally uses SQLite FTS5 as its first retrieval engine so memory remains local, portable, and easy to debug.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DefaultPath

func DefaultPath(root, namespace string) string

DefaultPath returns the project-local database path for a namespace.

Types

type Record

type Record struct {
	ID          string
	Namespace   string
	Type        string
	Priority    int
	Confidence  float64
	Content     string
	SourceRunID string
	SourceStep  string
	SourceRef   string
	CreatedAt   time.Time
	UpdatedAt   time.Time
}

Record is one durable, independently understandable fact. Source fields preserve a route back to the workflow run or artifact that established it.

type SearchOptions

type SearchOptions struct {
	Namespace string
	Types     []string
	Limit     int
}

SearchOptions bounds and filters a memory lookup.

type Store

type Store struct {
	// contains filtered or unexported fields
}

Store owns an SQLite database and its FTS index.

func Open

func Open(path string) (*Store, error)

Open creates or opens a durable memory store at path.

func (*Store) Close

func (s *Store) Close() error

Close releases the database connection.

func (*Store) Get

func (s *Store) Get(ctx context.Context, id string) (Record, error)

Get returns a memory by its durable ID.

func (*Store) Search

func (s *Store) Search(ctx context.Context, query string, options SearchOptions) ([]Record, error)

Search performs an FTS5 lookup. If a query cannot be expressed safely as FTS syntax, it degrades to a scoped LIKE search instead of failing a run.

func (*Store) Upsert

func (s *Store) Upsert(ctx context.Context, record Record) (Record, error)

Upsert writes a fact and refreshes its FTS entry. Callers can pass a stable ID to update an existing fact; otherwise a new durable ID is generated.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL