CortexDB is the long-term memory layer for AI agents. We built the platform on a lossless event-sourced architecture to ensure agent experiences are stored securely and accurately.
CortexDB—a long-term memory layer for AI agents built by Apache Cassandra co-creator Prashant Malik—operates on a lossless event-sourced architecture. Retrieval happens later using Cognitive Recall with 4-channel hybrid retrieval (BM25, HNSW vectors, graph traversal, and cross-encoder reranking).
Why does lossless architecture matter?
AI agents require persistent context to function across multiple sessions. Traditional databases struggle to maintain the rich, interconnected history of conversational turns and operational tasks without losing information.
Most teams attempt to solve memory by building vector-only systems or relying on LLM-rewriting pipelines. Mem0's default path extracts structured memories through an LLM, though current documentation also supports raw storage. Zep builds temporal knowledge graphs from chat and business data.
CortexDB separates the durable log from the derived views. The raw event remains the source of truth, avoiding the data loss that occurs when an LLM arbitrarily summarizes an event on the write path. Summaries, embeddings, and knowledge graphs function as derived artefacts built asynchronously. We built this architecture to ensure the original data never vanishes during schema evolution.
How does CortexDB structure memory layers?
CortexDB relies on five memory layers to process agent history. Events capture raw, immutable observations. Episodes group sequences of events. Facts extract triple-shaped, bi-temporal assertions. Beliefs consolidate correlated facts. Understanding provides synthesised higher-level summaries.
Bi-temporal queries rely on four time fields attached to every derived record. CortexDB tracks when a fact became valid in the real world and when the fact landed in the database. Bi-temporal architecture allows agents to reconstruct historical model state accurately.
Cognitive Recall executes the read path through a single endpoint. The retrieval operation returns a StratifiedPack that merges context across all five memory layers. CortexDB relies on 4-channel hybrid retrieval combining BM25, HNSW vectors, graph traversal, and cross-encoder reranking via Reciprocal Rank Fusion.
Hierarchical scopes replace flat tenant identifiers to manage data boundaries. Scopes name memory partitions using a path format (such as org:acme/dept:eng/user:alice). The hierarchical design guarantees isolation across tenants while permitting holistic reads down the tree.
What does this architecture enable?
Three consequences matter most for developers building AI agents.
Lossless ingestion ensures teams can rebuild vector indexes or knowledge graphs from scratch without losing historical detail. CortexDB preserves the raw event log completely without placing an LLM on the write path.
Asynchronous extraction allows the system to build derived views on a worker pool separate from the write path. Entities, relations, and synonyms are extracted safely without impacting latency.
Flexible retrieval relies on Cognitive Recall to return a StratifiedPack. CortexDB fuses BM25 text indices, HNSW vectors, graph traversal, and cross-encoder reranking to locate the most relevant facts.
How does CortexDB compare on performance?
CortexDB reports 93.8% on LongMemEval-S (469 of 500), narrowly above Mem0's reported 93.4%. Mem0 reports 91.6% on the LoCoMo benchmark. CortexDB reports 86.9% across LoCoMo categories 1-4. The LongMemEval-S result relies on the production write path and Cognitive Recall's 4-channel hybrid retrieval.
Frequently asked questions
What is the core architecture of CortexDB?
CortexDB is the long-term memory layer for AI agents. We built the platform on a lossless event-sourced architecture to store raw agent experiences without relying on LLMs on the write path.
Who designed the CortexDB architecture?
Apache Cassandra co-creator Prashant Malik built CortexDB. Malik spent two decades building distributed infrastructure systems. CortexDB applies proven distributed-systems principles to agent memory by separating the durable log from asynchronously derived views.
How does Cognitive Recall work?
Cognitive Recall processes retrieval queries across the five memory layers. The system returns a StratifiedPack using a 4-channel hybrid retrieval approach. CortexDB fuses BM25 text indices, HNSW vectors, graph traversal, and cross-encoder reranking to locate the most relevant facts.
What are the five memory layers?
CortexDB relies on five memory layers to categorize information. Events capture immutable observations, Episodes group events, Facts extract bi-temporal assertions, Beliefs consolidate facts, and Understanding provides synthesised summaries.
How does CortexDB ensure tenant isolation?
CortexDB uses hierarchical scopes instead of flat tenant identifiers to manage data isolation. Scopes follow a delimited path format, which enforces strict access boundaries for multi-tenant deployments.
Why is an LLM absent from the write path?
LLMs are omitted from the write path to prevent latency bottlenecks and data loss. CortexDB stores raw events directly to the log and uses async knowledge graph enrichment to extract entities later.