Skip to main content

Module sqlite_store

Module sqlite_store 

Source
Available on crate feature sqlite only.
Expand description

SQLite persistent Store (FTS5 full-text search + optional vector search)

Production-grade persistent storage, based on SQLite + FTS5 full-text search engine, with optional vector similarity retrieval integration.

§Storage structure

TablePurpose
store_itemsKV main table (namespace, key, value, timestamps)
store_ftsFTS5 full-text index (auto-synced)
store_vectorsVector table (optional, stores embedding vectors)

§Quick start

use echo_core::error::Result;
use echo_state::memory::store::Store;
use echo_state::memory::SqliteStore;
use std::sync::Arc;

// Basic usage: FTS5 full-text search
let store = Arc::new(SqliteStore::new("~/.echo-agent/memory.db")?);

store.put(&["alice", "memories"], "pref-001", serde_json::json!({
    "content": "User prefers dark theme",
    "importance": 8
})).await?;

// FTS5 full-text search
let items = store.search(&["alice", "memories"], "dark theme", 5).await?;

// With hybrid search (requires Embedder)
use echo_state::memory::{Embedder, HttpEmbedder};
let embedder: Arc<dyn Embedder> = Arc::new(HttpEmbedder::from_env());
let store = Arc::new(SqliteStore::with_embedder("~/.echo-agent/memory.db", embedder)?);
let items = store
    .search_with(&["alice", "memories"], echo_state::memory::SearchQuery::hybrid("theme preference", 5))
    .await?;

Structs§

SearchQuery
Unified search request
SqliteStore
SQLite persistent Store with FTS5 full-text search and optional vector search
StoreItem
A single record in the Store

Enums§

SearchMode
Search mode

Traits§

Embedder
Text embedding interface: maps text to dense float vectors
Store
Unified storage interface for long-term memory