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 from cel_memory (re-exported here) 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 re_embed_all re-embeds stored vectors when the target model matches the configured Embedder.

Re-exports§

pub use error::SqliteMemoryError;
pub use provider::SqliteMemoryProvider;

Modules§

embedder
Re-exports the Embedder trait from cel_memory.
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.

Structs§

MockEmbedder
Deterministic test embedder. Hashes the input text to a small vector of pseudo-random floats. Never use in production — produces meaningless vectors.

Traits§

Embedder
An embedder turns text into a fixed-dimension vector.