Three end-to-end animated diagrams: write path (memory_store), read path (memory_recall with hybrid fusion), and federation (W-of-N quorum sync). Every box is a real function in src/storage/ or src/handlers/; every arrow is a real call.
Validation → embedding → SQLite insert → HNSW index update → federation fanout. The full path takes ~9-86ms p95 depending on whether embedding is requested.
memory_recall combines three retrieval modalities and reconciles them into one ranked result set. Each modality has different strengths; the fusion model produces something none of them could alone. p95 hot-path: 18ms.
When the caller passes context_tokens=[...], the recall biases the query embedding toward recent conversation:
embed(query) — what the caller explicitly asked. Anchors the recall.
embed(context_tokens.join(" ")) — recent conversation tokens. Biases toward "what the agent is currently thinking about".
Final query vector = 0.7·primary + 0.3·context, deliberately un-normalized — cosine similarity divides out magnitudes downstream, so only direction matters (Embedder::fuse).
Each node accepts writes locally and fans out to peers via mTLS. The local commit lands first; the quorum (default W=2, counting the local commit) is met once W−1 peers ack within the deadline. Eventual consistency. Per-peer cursors for catchup after partition. Federation private endpoints under /api/v1/sync/*.
Reads always serve from local SQLite. Zero network call. Sub-50ms regardless of peer state.
Local commit lands first; the write returns 200 once W is met — the local commit plus W−1 peer ACKs within the deadline. Default W=2 (majority).
Detached peer catches up on rejoin via per-peer cursor. Convergent within one catchup_interval (default 30s).
QuorumFailureReason: Unreachable / Timeout / IdDrift / InFlight; QuorumError: InvalidPolicy / LocalWriteFailed).