Skip to main content

Crate cel_memory_sqlite

Crate cel_memory_sqlite 

Source
Expand description

SQLite-backed MemoryProvider — one concrete persistence backend for the cel-memory crate.

This crate implements the MemoryProvider contract on top of a single local SQLite file (plus sqlite-vec for vector search and FTS5 for lexical search). It owns persistence behavior only — schema, migrations, embeddings, hybrid retrieval, caching — and depends on cel-memory for the trait and value types. It does not depend on any prompt builder, planner, or runtime.

What it delivers:

  • Schema migrations for every memory table (memory_chunks, memory_vec, memory_fts, memory_sessions, memory_summary_members, memory_access_log, memory_eviction_log).
  • sqlite-vec extension loaded into the connection at open time so the memory_vec virtual table is available.
  • Embedder trait + MockEmbedder (always available) and FastEmbedEmbedder (gated behind the fastembed feature) for the real bge-small-en-v1.5 model.
  • SqliteMemoryProvider implementing the full MemoryProvider surface: writes, hybrid (vector + FTS + recency) retrieval with a TTL+LRU cache, sessions, summarization and rollups (via an injected cel_memory::Summarizer), aging sweeps, export, and stats. The only method still returning Err(NotImplemented) is re_embed_all.

Re-exports§

pub use embedder::Embedder;
pub use embedder::MockEmbedder;
pub use error::SqliteMemoryError;
pub use provider::SqliteMemoryProvider;

Modules§

embedder
Embedder trait + reference implementations.
error
Storage-side error type. Converted to MemoryError on the way out of the SqliteMemoryProvider.
migrations
Embedded SQL migrations.
provider
SqliteMemoryProvider — the SQLite + vector backing storage.
vec_extension
Registration helper for the sqlite-vec extension.