Built a persistent, multi-tenant agent memory layer on Elasticsearch. Achieved R@10 0.89 across 168 questions using three indices, hybrid retrieval with reranker, supersession, decay, and per-user isolation.
Published an architecture for a persistent agent memory layer built on Elasticsearch. It uses three indices (episodic, semantic, procedural), hybrid retrieval with RRF and a cross-encoder reranker, supersession, decay, and per-user document-level security (DLS). Achieved R@10 0.89 on 168 QA questions. Full implementation is open-source on GitHub.
The context window acts only as short-term memory, suffering from cost, latency, and the 'lost in the middle' effect. This post describes a real agent memory system inspired by cognitive science categories, built on Elasticsearch. It supports multi-tenancy with zero cross-tenant data leakage.
This approach enables agents to retain knowledge across sessions, remember past failures, and provide personalized responses. By leveraging Elasticsearch's search capabilities, it avoids the complexity of integrating separate vector stores, keyword engines, audit layers, and auth services. It is accessible to any MCP-speaking client, making it highly versatile.
Some comments criticize the article as AI-generated and argue that Elasticsearch is overkill for a memory layer. Others counter that for enterprises already using ES, it makes sense for shared memory and advanced features like scripted scoring. The core debate revolves around ES vs. simpler databases like SQLite, with some highlighting ES's scalability and unique capabilities.