Expand description
§gemini-memory-rs
A contextual memory engine for Gemini Live voice sessions.
The engine’s organising principle is that context is prepared
asynchronously and consumed synchronously. Nothing expensive — model
calls, search, repository writes — ever happens on the path between the
model asking for memory and the memory arriving. By the time a
recall_context tool call lands, the answer is already sitting in state.
user speech ─► input transcription ─► retrieval-state extraction
│
▼
local BM25 search
│
▼
immutable prepared snapshot ─► Gemini
final transcript ─► observation extraction ─► session ledger
│
┌───────────────────────────┤
▼ ▼
session overlay post-session reconciliation
(usable now) │
▼
canonical OKF markdown§Layout
Each module is the design’s correspondingly-named component:
| Module | Responsibility |
|---|---|
core | Domain vocabulary, deterministic policy, event log |
okf | Canonical Markdown memory records and the repository |
bm25 | Fielded lexical index, ranking, and search explanation |
transcript | Partial/final transcript accumulation and debouncing |
retrieval | Retrieval plans, fusion, budgeted context assembly |
ingestion | Observation extraction, candidate ledger, session overlay |
reconcile | Consolidation, conflict resolution, promotion, commit |
runtime | Live-session wiring: state keys, control loop, tools |
evals | Fixture-driven quality harness |
§Getting started
use gemini_memory_rs::prelude::*;
let engine = MemoryEngine::in_memory(UserId::new("usr_72ab"));
// A finalized user turn: evidence in, context out.
let session = engine.begin_session(SessionId::new("ses_01"));
session.observe_final_transcript(TurnId(1), "I am pescatarian").await?;
let snapshot = session.prepare(TurnId(2), "what should we eat tonight").await?;
for fact in snapshot.facts.iter() {
println!("{}", fact.statement);
}Modules§
- bm25
- Local lexical retrieval.
- core
- Domain vocabulary, policy and the event log.
- engine
- The memory engine facade.
- evals
- The fixture-driven quality harness.
- ingestion
- Capturing evidence from a live conversation.
- okf
- The canonical memory format: human-readable OKF Markdown.
- prelude
- The types a typical application touches.
- reconcile
- Turning a conversation’s evidence into durable memory.
- retrieval
- Preparing memory context before the model asks for it.
- runtime
- Wiring the memory engine into a Gemini Live session.
- transcript
- Transcript accumulation, stable-prefix tracking, and speculation gating.