Expand description
SQLite-backed implementations of the three memory traits in
klieo_core::memory.
MemorySqlite::open(path) is the capability-shaped default — opens
a SQLite file (or ":memory:" for ephemeral), runs migrations for
all three trait tables, defaults to DummyEmbedder, and returns
three Arc<dyn …> handles ready to drop into
klieo_core::AgentContext.
For a caller-supplied Embedder (e.g. the fastembed feature’s
FastEmbedEmbedder), reach for MemorySqlite::new directly.
§Quickstart
use klieo_memory_sqlite::MemorySqlite;
async fn example() {
let mem = MemorySqlite::open(":memory:").await.unwrap();
// mem.short_term, mem.long_term, mem.episodic are
// Arc<dyn …> handles ready for AgentContext.
let _ = mem;
}§Advanced wiring — custom embedder
use klieo_memory_sqlite::{MemorySqlite, DummyEmbedder};
use std::sync::Arc;
async fn example() {
let mem = MemorySqlite::new(":memory:", Arc::new(DummyEmbedder)).await.unwrap();
let _ = mem;
}§Features
- Default — three SQLite-backed memory traits +
Embeddertrait withDummyEmbedder(zero-vector). Linear-scan recall. fastembed— addsFastEmbedEmbedder(real CPU embeddings via ONNX runtime). Heavy first compile; model auto-downloads to OS cache dir on first call.sqlite-vec— adds a vec0 virtual-table index onlong_term_facts_vec;LongTermMemory::recalluses k-NN MATCH instead of linear scan.test-utils— exposesFakeEmbedderfor downstream test deps.
§Limitations
- Sync SQLite under blocking pool. All trait methods spawn
tokio::task::spawn_blockingso they don’t stall the async runtime; throughput is bounded by the blocking-pool size.
Re-exports§
pub use short_term::SqliteShortTerm;pub use episodic::SqliteEpisodic;pub use long_term::SqliteLongTerm;pub use factory::MemorySqlite;
Modules§
- embedder
- Re-exports of the shared
Embeddertrait + dummy/fake impls. - episodic
SqliteEpisodic—EpisodicMemoryover a SQLite table.- factory
MemorySqlite— umbrella factory wiring all three SQLite-backed memory traits to the same database file.- long_
term SqliteLongTerm—LongTermMemoryover a SQLite table with linear-scan cosine recall (default) or sqlite-vec k-NN MATCH (under featuresqlite-vec).- short_
term SqliteShortTerm—ShortTermMemoryover a SQLite table.
Structs§
- Dummy
Embedder - Default embedder that returns zero vectors.
- Fake
Embedder - Test-only embedder that hashes each input text into a deterministic vector. Identical texts produce identical embeddings, so cosine recall behaves predictably under test.
- Fast
Embed Embedder - fastembed-rs–backed
Embedder.
Constants§
- DEFAULT_
DIM - Output dimension of
DEFAULT_MODEL. - DEFAULT_
MODEL - Default model: 384-dimensional
AllMiniLML6V2.
Traits§
- Embedder
- Compute embeddings for one or more texts.