Data Flow
How information moves through Mnemosyne's memory tiers.
Write Path
flowchart LR A[Agent Input] -->|remember| WM[Working Memory] WM -->|index| FI[FTS5 Index] WM -->|sleep| SC[Sleep Consolidator] SC -->|promote| EM[Episodic Memory] EM -->|index| VI[Vector Index + FTS5] SC -->|evict| DEL[Deleted]
- Agent calls
remember()with content, source, importance, and optional metadata - Working Memory stores the raw entry with metadata in SQLite
- FTS5 index is updated for full-text search
- Sleep consolidation (triggered by calling
sleep()) processes older entries - Promotion summarizes and moves entries to Episodic Memory
- Vector + FTS5 indexing occurs on the new Episodic entries
- Eviction removes the original Working Memory entries
Read Path
flowchart LR Q[Query] -->|recall| RE[Retrieval Engine] RE -->|vector search| VI[sqlite-vec Index] RE -->|text search| FI[FTS5 Index] VI -->|scores| RF[Rank Fusion] FI -->|scores| RF RF -->|ranked results| A[Agent]
- Agent calls
recall(query, top_k=5) - Query is embedded using BAAI/bge-small-en-v1.5 (384 dims) for vector search
- Parallel dispatch to vector (sqlite-vec) and text (FTS5) indices
- Rank Fusion combines scores:
vec×0.5 + fts×0.3 + importance×0.2, then applies recency decay:score × (0.7 + 0.3 × recency_decay) - Agent receives ranked results
Consolidation Flow
flowchart TD START[sleep called] --> SELECT[Select entries older than TTL/2] SELECT --> GROUP[Group by source] GROUP --> SUMMARIZE[Summarize via LLM or AAAK] SUMMARIZE --> PROMOTE[Store summary in Episodic Memory] PROMOTE --> INDEX[Index new episodic entry] INDEX --> EVICT[Evict originals from Working Memory]
Consolidation is triggered explicitly by calling mem.sleep():
- Select Working Memory entries older than TTL/2 (default 12 hours)
- Group candidates by their source field
- Summarize each group via LLM (if enabled) or AAAK text substitution
- Promote the summary as a new Episodic Memory entry (with
summary_oftracking) - Index the new entry in vector and FTS5 indices
- Evict the original entries from Working Memory
Event Lifecycle
| Stage | Location | Trigger | Duration |
|---|---|---|---|
| Ingestion | Working Memory | remember() | Immediate |
| FTS5 Indexing | FTS5 virtual table | Write completion | <50ms |
| Consolidation | Episodic Memory | sleep() call | Depends on batch size |
| Retrieval | Episodic Memory | recall() | <100ms |
| Eviction | Working Memory | sleep() completion | Immediate |
Related Pages
System Design
Deep dive into Mnemosyne's system design: SQLite storage engine, memory manager, retrieval pipeline,...
Hybrid Search
Learn how Mnemosyne's hybrid search combines dense vector similarity with SQLite FTS5 full-text sear...
Working Memory
Explore Mnemosyne's Working Memory tier: a short-term, high-speed buffer for the most recent agent o...
Mnemosyne