A Rust memory engine for AI agents that compresses, evolves, and resolves conflicts in memories — implementing neuroscience mechanisms no existing system has built.
Every existing agent memory system treats memory as a database problem — store, index, retrieve. Mneme treats memory as a living process.
Mem0 appends new facts and hopes the old ones fade. Zep builds a temporal graph but never rewrites nodes. Letta lets the agent page memory in and out but never consolidates it. None of them update a memory when it's retrieved in a new context — the mechanism neuroscience calls reconsolidation.
The result: memory stores that grow without bound, accumulate contradictions, and can't distinguish between "the user changed their mind" and "both things are true in different contexts."
| Mechanism | Mem0 | Zep | Letta | Mneme |
|---|---|---|---|---|
| Reconsolidation | No | No | No | Drift-triggered |
| Dual memory system | Single store | Single graph | 3 tiers (manual) | Working + Semantic |
| Conflict resolution | Latest wins | No | No | 3 strategies |
| Progressive disclosure | Load all | Load all | Agent pages | Envelope → Body |
| Forgetting curve | No decay | No decay | No decay | Ebbinghaus decay |
| Language | Python | Python | Python | Rust |
Three operations that map directly to mechanisms in cognitive neuroscience. Together they transform a passive memory store into a living knowledge system.
Working memory entries from agent sessions get embedded, clustered by similarity, and synthesized into semantic engrams via LLM. Raw observations become distilled knowledge. If a similar semantic engram already exists, compaction routes to evolution instead.
Neuroscience: hippocampal → neocortical consolidation (CLS theory, McClelland et al. 1995)
Every retrieval triggers a drift check — cosine distance between the stored embedding and the current context. If drift exceeds a threshold, the LLM evaluates whether the memory should update, creating a new version while preserving the full supersession chain.
Neuroscience: reconsolidation (Nader, Schafe & LeDoux, 2000)
When two engrams contradict, the system selects from three strategies based on evidence strength: temporal supersede (newer wins), confidence merge (synthesize both), or conditional coexist (both true in different contexts). No existing system makes this distinction.
Neuroscience: schema-dependent encoding (Bartlett, 1932)
Every memory is an Engram with two layers: a lightweight envelope (embedding + metadata + summary) and a full content body (loaded on demand). Search touches thousands of envelopes; the agent reads a handful of summaries; only 2-3 full bodies enter the context window.
The agent-facing API exposes four verbs: remember(), recall(),
expand(), and end_session(). Reconsolidation runs automatically
on every retrieval. Compaction fires on session end or buffer threshold.
// Capture signals during a session
memory.remember("User prefers Rust for systems", "s1").await;
memory.remember("Building a sub-2ms trading engine", "s1").await;
// Retrieve relevant context (ranked summaries)
let ctx = memory.recall("preferred language for trading?", 5).await;
// Expand when you need full detail
let detail = memory.expand(ctx[0].id).await;
// End session → memory compacts automatically
memory.end_session("s1").await;
Most agent memory systems reference neuroscience metaphorically. Mneme implements the actual mechanisms — with specific parameters mapped from the literature.
MIT licensed. Framework-agnostic. Use as a library or HTTP server.