Agent memory is a system that stores what an AI agent has learned from interactions — corrections, preferences, decisions, behavioral patterns — outside the model's context window, so that knowledge persists across sessions and can be retrieved when relevant. Without a memory layer, an LLM-based agent starts every session as a blank slate: it cannot remember that you corrected it last week, that you prefer TypeScript over JavaScript, or that the API endpoint changed last Tuesday. Agent memory gives the model a notebook it writes in, distinct from both the training data baked into its weights and the documents retrieved by RAG at query time. A 2024 survey by Zhang et al. identified memory as "the key component to support agent-environment interactions" and the foundation of agents' "self-evolving capability" — the ability to improve through experience rather than retraining (arXiv:2404.13501).
Large language models are stateless. Each API call is independent: the model receives a prompt, generates a response, and forgets everything. The context window — the token limit on a single request — is the only "memory" the model has within a session, and it is volatile: when the session ends, the context is gone.
This creates a problem the moment you build anything beyond a single-turn chatbot. A coding assistant that forgets your architectural decisions between sessions. A customer support agent that asks for the same information twice. A research agent that re-reads the same documents every time it starts. The agent cannot learn from its mistakes, remember your preferences, or build on past interactions — because there is nowhere to put what it learned.
Agent memory solves this by writing what the agent learns to an external store that survives session boundaries. At the start of the next session, relevant memories are retrieved and injected into the context, so the agent picks up where it left off rather than starting from scratch.
Agent memory systems perform four core operations:
Capture — Extract knowledge from the conversation as it happens. This is not a document dump; it is structured extraction of facts, corrections, preferences, and decisions. The agent learned you use Vitest, that the database is PostgreSQL, that the auth flow uses JWT — each becomes a discrete memory item.
Store — Persist those items outside the model in a format that survives session end. Formats vary across implementations: Mem0 uses a vector store, Letta uses agent state blocks, Zep uses a temporal knowledge graph, PLUR uses human-readable YAML files. The CoALA framework (Sumers et al., 2023, arXiv:2309.02427) formalized this as "modular memory components" — a standard part of any cognitive architecture for language agents.
Retrieve — At the start of the next session, surface the right memories for the current context. Not all of them — that would overflow the window. The relevant ones, selected by hybrid search (keyword + semantic similarity), activation strength, and feedback signals.
Update and forget — When a fact changes, update the memory. When a fact is wrong, correct it. When a memory is no longer relevant, let it decay. Several systems adapt the ACT-R cognitive theory of memory decay, where memories that are not accessed lose retrieval strength while reinforced ones stay sharp — preventing the store from accumulating stale noise.
The memory taxonomy used in agent research draws from cognitive science. Zhang et al. (arXiv:2404.13501) and the CoALA framework (arXiv:2309.02427) both organize agent memory along these dimensions:
| Memory type | What it stores | Cognitive science analog | Example |
|---|---|---|---|
| Working / short-term | Current conversation context, recent turns | Working memory | The last 5 messages in the chat |
| Semantic | Facts, general knowledge | Semantic memory | "The user's database is PostgreSQL" |
| Episodic | Specific past events, interactions | Episodic memory | "Last Tuesday, the user corrected me on the API endpoint" |
| Procedural | Learned skills, workflows | Procedural memory | "When deploying, run tests first, then build, then push" |
MemGPT (Packer et al., 2023, arXiv:2310.08560) introduced a complementary taxonomy inspired by operating systems: core memory (always in the context window, like CPU registers) vs. archival memory (retrieved on demand, like disk storage). The OS analogy is deliberate — the agent manages memory tiers the way an operating system manages RAM and disk, paging information in and out of the context window as needed.
Park et al. (arXiv:2304.03442) demonstrated a third dimension in their "Generative Agents" work: reflection — the agent synthesizes higher-level abstractions from raw observations over time, moving from "I saw X at 10am" to "The user seems to prefer working in the morning." This consolidation pass turns accumulated episodic memories into semantic knowledge, mirroring how human sleep consolidates the day's experiences into long-term understanding.
| Concept | What it does | How it differs from agent memory |
|---|---|---|
| RAG | Retrieves passages from a fixed document corpus at query time | Read-only retrieval; does not learn from interactions or persist corrections |
| Fine-tuning | Modifies model weights to internalize new knowledge | Bakes data into opaque weights; cannot inspect, edit, or selectively delete; risks catastrophic forgetting |
| Context window | Holds the current conversation in the model's working memory | Volatile — lost when the session ends; limited in size |
| Agent memory | Stores what the agent learned, persists across sessions, updates with feedback | Read-write, persistent, selective retrieval, supports forgetting and correction |
For a deeper comparison, see RAG vs. Agent Memory and Fine-Tuning vs. Memory.
| Project | Stars | License | Memory format | Key approach |
|---|---|---|---|---|
| Mem0 | ~60K | Apache-2.0 | Vector store | Universal memory layer API; add/update/delete/get_all operations |
| Graphiti (Zep) | ~28K | Apache-2.0 | Temporal knowledge graph | Real-time knowledge graphs; sub-200ms retrieval |
| Cognee | ~27K | Apache-2.0 | Graph + vector + relational | Multi-backend memory platform |
| Letta (formerly MemGPT) | ~24K | Apache-2.0 | Agent state blocks | Stateful agent OS; self-editing memory tiers |
| LangMem | ~1.5K | MIT | LangGraph storage layer | LangChain ecosystem memory modules |
| PLUR | ~215 | Apache-2.0 | Human-readable YAML (engrams) | Local-first; MCP-native; open format; feedback-driven recall |
Star counts as of July 2026. The key differentiator within agent memory is format openness: Mem0 and Letta are open-source engines but store memories in opaque formats (vectors, state blocks). PLUR stores memories as human-readable YAML files you can open in a text editor, diff in git, and inspect without running code. The MCP (Model Context Protocol, specification 2025-11-25) makes the transport layer open across all these tools; the memory format is the differentiator.
| Situation | Need agent memory? |
|---|---|
| Single-turn chatbot (one question, one answer) | No |
| Chatbot with context window only (same session) | No |
| Agent that must remember user preferences across sessions | Yes |
| Coding assistant that should not repeat corrected mistakes | Yes |
| Long-running autonomous agent (research, analysis, monitoring) | Yes |
| Multi-agent system where agents share knowledge | Yes |
| Agent that must comply with GDPR right to erasure | Yes (external store enables deletion) |
PLUR (github.com/plur-ai/plur, Apache-2.0) implements the model described above with engrams — typed, human-readable YAML entries with provenance and confidence, stored locally under ~/.plur/ (what an engram is · full specification). Retrieval is hybrid (BM25 + local embeddings, merged via Reciprocal Rank Fusion) with ACT-R-inspired activation: memories strengthen with use and positive feedback, decay when irrelevant. On retrieval quality, PLUR reaches 97.6% R@5 on LongMemEval-S, fully local (benchmark).
Any MCP-compatible runtime can use the same store:
npx @plur-ai/mcp init # Claude Code / Cursor / Windsurf (any MCP client)
openclaw plugins install @plur-ai/claw # OpenClaw
pip install plur-hermes # Hermes Agent (Python)
Is agent memory the same as RAG? No. RAG retrieves passages from a fixed document collection at query time — it is read-only retrieval. Agent memory stores what the agent learned from interactions and updates it over time with feedback and forgetting. RAG gives the model a library; agent memory gives it a notebook. See RAG vs. Agent Memory for a detailed comparison.
Is agent memory the same as fine-tuning? No. Fine-tuning modifies the model's weights to internalize knowledge. Agent memory stores knowledge externally, separate from the model. Fine-tuning cannot selectively forget a fact, cannot show you what it learned, and risks catastrophic forgetting when new knowledge overwrites old. Agent memory is inspectable, editable, and transferable across models. See Fine-Tuning vs. Memory for details.
What is an engram in AI agent memory? An engram is the atomic unit of memory in some agent memory systems — a single learned fact, correction, preference, or pattern. The term is borrowed from neuroscience, where an engram is the physical trace of a memory in the brain. In PLUR's implementation, engrams are stored as human-readable YAML entries in plain files. See The Open Engram Format for the definition and the Engram Specification for the full format.
Does agent memory slow down the model? Not on the inference path. Memory retrieval happens at session start (before the first generation) and memory capture happens asynchronously (after the response). The model's generation latency is unaffected. Retrieval itself is typically sub-second — Zep reports sub-200ms for its temporal knowledge graph.
Can I use agent memory with any LLM? Yes. Agent memory is model-agnostic — it stores knowledge outside the model and injects it into the prompt at session start. You can switch from GPT-4 to Claude to Llama without losing your agent's memories, because they live in an external store, not in the model's weights. This is a key advantage over fine-tuning, which locks knowledge into a specific model.
What is the ACT-R decay model in agent memory? ACT-R is a cognitive architecture from cognitive science that models how human memory decays over time. Several agent memory systems adapt it: memories that are not accessed lose retrieval strength, while memories that are reinforced (accessed or given positive feedback) gain strength. This prevents the memory store from accumulating stale noise — something RAG cannot do because all documents remain equally retrievable.