How we built a persistent agent memory layer on Elasticsearch with 0.89 recall and zero tenant leaks
elastic.co 4 months ago 38
A team built a persistent memory system for AI agents using Elasticsearch with three separate indices for episodic (timestamped events), semantic (stable facts), and procedural (step-by-step playbooks) memories, combined with hybrid retrieval using BM25 and dense vectors plus a cross-encoder reranker. The system achieved 0.89 recall@10 on a 168-question evaluation with zero cross-tenant data leaks, using per-user document-level security to isolate each user's memories. The architecture consolidates short-lived episode logs into durable facts and playbooks every turn, handles contradictions through supersession rather than deletion, and applies time-decay so recent information ranks above older facts.