Which memory layer should I use for my AI agent?
A memory layer keeps what an agent learned somewhere outside the model and hands the useful part back on a later turn. Four questions pick one: who writes the memories, where they live, what each new memory costs, and whose memory it is. The first question also decides most of the cost: a design where a second model reads every message costs a model call per message, and a design where the agent writes its own notes saves only what the agent thinks to save.
For an app whose users come back, start with Mem0 if a hosted service is fine, Zep if facts change and you need to know what was true when, and Cognee or Mem0’s open-source library if the memory has to live on machines you run. For an agent that keeps its own notes, use Anthropic’s memory tool on the Claude API, LangMem’s memory tools on LangGraph, or Letta, which is a whole agent built around its memory. If the memory is for the assistant you use yourself, that’s a different choice, and it’s the one we make: Counterparts gives Claude its own memory of you in Claude Code and Claude Desktop. It has no SDK or API, so it isn’t for building memory into an app.
An AI drafted this page from the sources below and another AI checked it. No person has run these tools for this page. Facts about each product come from its maker’s docs, read 9 November 2026; counts come from our directory’s open data the same day. Counterparts is ours: Mike LaPeter runs Counterparts, and the directory is ours too.
Do you need a memory layer?
Each model call starts blank. Without a memory layer, an app either replays the whole history into every prompt or loses it when the session ends. Mem0’s docs put the trade in one line: without a memory layer you “Keep appending chat history to the prompt”; with one you “Store facts once, then retrieve them by query” (Mem0, how it works).
You may not need one yet. If each task brings its own context and nobody comes back, a long context window is enough. If one agent works on one project, plain files the agent reads and edits go a long way, and you can open them to see why it did something. A layer earns its place when many users return and expect to be remembered, or when the history no longer fits in a prompt. How memory differs from retrieval over documents (RAG) is in our guide to memory, RAG and the context window.
1. Who writes the memories?
There are two designs, and LangChain’s LangMem docs describe both (LangMem concepts).
The agent writes its own, with a memory tool, as it talks. LangMem calls this saving “in the hot path”: it “lets the agent itself choose how to store and update its memory”, but “it adds perceptible latency to user interactions”. Anthropic’s memory tool works this way: “Claude automatically checks its memory directory before starting a task. As it works, Claude stores what it learns in files under /memories” (Claude API docs, memory tool). Letta agents do the same with a folder of Markdown files: “the agent edits it as it learns” (Letta, memory). No second model reads every message, so there’s no extra call per message. The cost is that a memory exists only if the agent decided to write it (why agents skip their memory tools).
A separate model reads what you send and writes the memories. Mem0 is the plainest case: “You send Mem0 messages. By default, Mem0 stores extracted memories, not a verbatim transcript,” and “An LLM extracts preferences, decisions, plans, and other details” (Mem0, how it works). Zep turns each message into “episodes in the graph” (Zep, agent memory), and Supermemory runs “a custom learning model” that “Decides what and how to learn, what is important, when to forget” (Supermemory, how it works). LangMem’s background manager runs after the conversation, which it says is “perfect for ensuring higher recall of extracted information”. Every message gets read, and nothing waits on the agent remembering to save. Each add is a model call, and the extractor decides what counts as a fact; one r/LangChain thread asks “mem0, Zep, Letta, Supermemory etc: why do memory layers keep remembering the wrong things?” (read from an archive copy).
Mem0’s extraction is also additive: “If a user says, ‘I moved from Austin to Seattle,’ Mem0 can store the new fact without silently rewriting the old one. Use explicit update or delete operations when your application needs to correct or remove a memory.” Mem0’s cloud marks an older fact as superseded when a newer one contradicts it, as each memory is added (part of what it calls Dream; its Dream docs say this is on every plan, while its pricing page lists Dream under Custom plans). A default search still returns the old fact, badged as superseded; pass latest_only=true to get only the current one. The open-source library doesn’t do this (Mem0, platform vs open source). So test a change of fact before you commit to any of them: store something, change it, then ask. Why AI memory goes stale has what each system does when a fact changes.
Across the 21 systems in our directory, by our reading of each entry’s “who writes” line:
| Who writes | Systems |
|---|---|
| The agent you talk to, through tools or its own notes | Counterparts (ours), Letta, Basic Memory, Engram Alpha, trusty-memory, the MCP reference memory server |
| A separate model, from what you send it | Mem0, Zep, Cognee, Supermemory, claude-mem, agent-qa |
| Either, your choice | LangMem |
| No model chooses: it keeps what it’s sent or records | Hyperconsciousness, Screenpipe |
| The assistant itself, inside its own app (some also run a background pass) | ChatGPT, Claude, Claude Code, Microsoft Copilot, Gemini, Perplexity |
The lines blur at the edges. Counterparts and Letta also run a background pass (Counterparts between sessions, Letta after a set number of steps or at compaction), trusty-memory’s saves can come from a hook, Zep, Supermemory and Screenpipe also let an agent add memories through a tool, and Mem0 can store text exactly as sent (infer=False). Anthropic’s memory tool isn’t in the directory yet; by its docs it belongs in the first row.
2. Where does it live?
- A file on one machine. Cognee “Runs locally for free — no API key required”, extracting its graph with a small local model when no key is set (Cognee README). Its README calls that bundled extractor a demo; Ollama is its other local route. Supermemory has a local server: “One binary, zero config”, free up to 10,000 stored documents, built “from a separate, non-public codebase” (Supermemory local). Letta’s CLI keeps agents on your disk with “no Letta account” (Letta, self-hosting).
- Your own database or storage. Mem0’s open-source library uses a vector store, model and embedder that “You provision, configure, and pay for”. Graphiti, the open-source graph engine inside Zep, runs on Neo4j, FalkorDB or Amazon Neptune, and its README says plainly that “you build the service around it: ingestion, tenancy, access control, and operations” (Graphiti). Anthropic’s memory tool “operates client-side: Claude requests file operations, and your application runs them”, so the files sit wherever your code puts them.
- The vendor’s cloud. Mem0’s platform, Zep, Supermemory’s cloud, Letta Cloud and Cognee Cloud host it for you. Anthropic also has memory stores for its Managed Agents, in beta.
Storing locally doesn’t keep the text local when a cloud model writes the memories: Mem0’s open-source library sends what you add to the model you configure (OpenAI’s by default). Only a local model keeps both halves on your machine. Mem0’s open-source library and Graphiti can be pointed at a local model through Ollama, Cognee runs on a small local model with no key, and Supermemory’s local server and Letta’s CLI document the same route; our local AI memory guide covers it. Who can read your AI’s memory goes system by system.
3. What does it cost to add?
Three costs: model calls to write memories, the keys and accounts each needs, and the infrastructure you run. Prices below are as of 9 November 2026 and change often.
| System | Model calls to write | Keys and accounts | You run |
|---|---|---|---|
| Mem0, hosted | One extraction call per add (“one LLM call” in its README’s description of the algorithm); Mem0 pays for the first 30 days, then your own model key | A Mem0 key; free plan of 10,000 adds and 1,000 retrievals a month for 30 days, then 50,000 and 10,000 with your key. Mem0 puts your provider’s charge at $3.55 to $5.34 per 1,000 adds on the models it recommends | Nothing |
| Mem0, open source | The same call, on your model (OpenAI’s by default) | Your model key | A vector database |
| Zep | Done by Zep; billed at 1 credit per message or record up to 350 bytes, with “Memory, retrieval, storage, and users” unmetered | A Zep key; free with 10,000 credits a month, then from $125 a month | Nothing |
| Graphiti | Calls on your model (OpenAI by default) | Your model key | A graph database |
| Supermemory | Its model reads everything you add, billed as credits | A key; free with $5 of credits a month, Pro $19 a month with $20 of credits; the local server needs your own model or a local one | Nothing, or its local server |
| Cognee | No paid calls on its small local model (which its README calls a demo) or a local Ollama model; with a key, “processing and generated answers make provider calls” | None, or your model key | Nothing extra locally |
| LangMem | Each background run is a model call, plus embeddings | Your model key | LangGraph’s store |
| Claude memory tool | No separate model; each memory read or write is a tool call, an extra round trip on your API usage | Your Claude API key | The storage behind it |
| Letta | No separate model; the agent’s own edits are tool calls, plus background “dreaming” runs you can set to fire after a number of steps or at compaction | Free with your own keys (up to 3 agents on its cloud), Pro $20 a month with $20 of credits (20 agents) | Nothing, or its server |
4. Whose memory is it?
Most building blocks hold memory about your users, filed under each one. Mem0 scopes everything by user_id, agent_id and run_id and says to “Always scope searches with filters” so users’ memories don’t mix; in Zep, “A Zep user owns a user Context Graph”.
Some hold a team’s or company’s knowledge. Zep now calls itself “the enterprise context layer for reliable agents” (Zep on GitHub), and Cognee turns “documents, code, and application data” into a graph agents can search.
A few hold the agent’s own memory: what it learned, in its own words, carried across conversations. Letta’s docs: “An agent’s memory is its own: it persists across conversations, follows the agent between models and computers.” Counterparts is built on the same idea for one person and their Claude.
Our directory files each system under one of these: the AI’s own memory (2 systems), memory about you (7), work and project memory (6) and building blocks (6). For an app, start with the building blocks.
The picks, by what you’re building
| You’re building | Pick | Why |
|---|---|---|
| An app whose users come back, hosted is fine | Mem0, Zep, Supermemory | Mem0 is the quickest start, with a free plan and SDKs for Python and TypeScript. Zep keeps each fact with the dates it was true, for data that changes. Supermemory also takes in files (and, on its paid plans, connected apps: Google Drive, Notion and OneDrive from the $19 Pro plan, Gmail from the $100 Max plan), and keeps a profile per user |
| The same, on machines you run | Mem0 open source, Graphiti, Cognee | All three are open source under Apache-2.0. Cognee runs with no key on a small local model, which its README calls a demo (for a production version it asks you to contact its team), and it can also run on a local model through Ollama. Mem0 open source doesn’t mark replaced facts the way the cloud does, so old and new facts sit side by side until your code fixes them |
| An agent that keeps its own notes | Claude’s memory tool, LangMem’s tools, Letta | The memory tool is part of the Claude API, and your code decides where the files live. LangMem’s tools plug into a LangGraph agent, though its last release on PyPI was 0.0.30, in October 2025. Letta is the whole agent, so pick it when you want Letta to be the agent and not only its memory |
| Shared knowledge for a company’s agents | Zep, Cognee | Zep has access control and connectors to company data on its paid plans. Cognee builds a graph from documents and code |
| Memory for the assistant you use yourself | Counterparts (ours) in Claude Code and Claude Desktop | See below |
The side-by-side comparison has every system on the same facts, and the head-to-head pages cover the usual pairs: Mem0 vs Zep, Letta vs Mem0, Cognee vs Mem0 and Mem0 vs Supermemory.
Where your own assistant fits
In Claude Code, on a Mac, Linux or Windows (new there, through npm), and in Claude Desktop on a Mac, that’s what we make: Counterparts. Claude writes down what it learned in its own words at the end of each session, what matters sticks and the rest fades, and each session opens with a short note Claude wrote itself about who you are and where you left off. It keeps one file on your machine, needs no API key or account, and is free and open source. Our guide to Claude Code memory plugins compares it with the other add-ons.
On claude.ai, a hosted version of Counterparts is coming soon, in beta; sign up on the home page to hear when it opens. Until then, a remote memory server reaches claude.ai as a connector; our memory MCP server guide lists them.
Counterparts is the wrong pick in these cases:
- You’re building an app for other people. It has no SDK or API for that.
- You want one memory for a team. It’s for one person and one AI.
- You use ChatGPT, Cursor or Gemini. It doesn’t run there. Basic Memory and Supermemory reach ChatGPT and Cursor as MCP servers.
What our directory adds, and how to read it
The directory lists 21 memory systems, as of its last update on 1 November 2026. Each is graded on the same 11 mechanisms of human memory, such as forgetting, strengthening with use and correcting an old memory, by one written rubric, and every “built” or “partly built” grade links the source that shows it. The data is open under CC BY 4.0, as JSON and CSV, and each entry is a file anyone can correct by pull request. Not covered here: Honcho, Hindsight and the memory built into cloud agent platforms such as Amazon Bedrock AgentCore and Vertex AI. They aren’t in our directory yet, and we didn’t read their docs for this page.
We make Counterparts and wrote the rubric, and our own entry tops the grades: 8 of 11 mechanisms built, with Mem0 next at 7. And only 3 of the 21 entries carry a “Confirmed by its makers” mark (Counterparts, Engram Alpha and trusty-memory); the rest are our reading of each maker’s docs and code.
The grades measure how much a system behaves like human memory. They don’t say which one fits your app. A building block with few mechanisms built can still be the right pick if it scopes users cleanly and your team can run it.
What people report
These come from archived copies of Reddit comments, read through the Arctic Shift archive; nobody opened them live on Reddit.
- On replaced facts: “retrieval can find an old decision perfectly and still give the user the wrong answer because that decision was replaced.” The fix they suggest: “keep explicit project state with current decisions, their source messages, and which decisions they supersede”. (comment)
- On who gets to write: “The write side is the part nobody prices in when choosing between Mem0, Zep, and files.” They give the agent “a scratch area it can write freely, and a curated memory that nothing writes to without an approval or a rule promoting the fact.” (comment)
- On starting small: “Mem0/Zep-style services save time, but rolling your own is easier to debug. I’d start with plain files or a table and move to a service once retrieval quality is the real bottleneck.” (comment)
Questions people ask
What is a memory layer for AI agents?
A store outside the model, plus the code that decides what goes into it and what comes back out. Your app, or the agent itself, writes to it after a turn and reads from it before the next model call. Mem0’s docs describe the loop: call add “After a useful interaction”, and search “Before a model call”.
Mem0 vs Zep vs Letta: which should I use?
They do different jobs. Mem0 and Zep are services a separate model writes into: Mem0 pulls out short facts per user, and Zep builds a graph where each fact carries the dates it was true. Letta is a whole agent that edits its own memory files. Pick Mem0 for the quickest start, Zep for facts that change over time, and Letta if you want its agent, not just a memory. Mem0 vs Zep and Letta vs Mem0 compare them in detail.
Can I use Letta’s memory without the rest of Letta?
Partly. Letta’s main docs are built around its own agent, “a persistent AI identity with its own memory, model configuration, tools, and message history”. On GitHub, Letta also has a Learning SDK (agentic-learning) that wraps your existing model calls, sends the conversations to Letta’s service (with a Letta API key) and adds what it remembers to later prompts; its last release was in December 2025, and the main docs don’t mention it. If you want memory for an agent you already have and don’t want Letta’s service, a building block (Mem0, Zep, Cognee, LangMem) or Anthropic’s memory tool is the more common route.
What are the open-source options?
Mem0, Graphiti (Zep’s graph engine), Cognee and Letta are Apache-2.0; LangMem is MIT; Basic Memory is AGPL-3.0. Supermemory’s SDKs are open, but its local server is built from code that isn’t public. Zep’s cloud and Mem0’s hosted platform aren’t open source.
Can an agent’s memory run fully locally?
Yes, if both the store and the model that writes memories run on your machine. Mem0’s open-source library, Graphiti, Supermemory’s local server and Letta’s CLI can all use a local model through Ollama. Cognee runs with no key set on a small bundled model its README calls a demo, or on a local Ollama model (Supermemory’s server sends telemetry unless you set SUPERMEMORY_DISABLE_TELEMETRY=1). With Anthropic’s memory tool the files are yours, but Claude itself runs in Anthropic’s cloud.
Do I need a memory layer, or is a vector database enough?
A vector database finds text that’s similar to the question. It doesn’t know that a newer fact replaced an older one, which is what most memory layers add, with dates, merging or a graph. If your facts rarely change, a vector database or plain files may be enough; test a changed fact before you decide.
Is there a memory layer made for Claude?
Anthropic’s memory tool is part of the Claude API and works with current Claude models, with the files stored wherever your code puts them. Managed Agents have memory stores in beta. For your own Claude Code or Claude Desktop, Counterparts is ours.
Is there a directory that compares AI memory systems?
Ours, at counterparts.ai/directory: 21 systems, each with where it keeps memory, what it needs, its licence and price, and grades on 11 mechanisms with sources. The data is open under CC BY 4.0. We make Counterparts, which is one of the 21.
Can Counterparts be the memory layer for my app?
No. Counterparts is a memory for one person’s Claude, in Claude Code and Claude Desktop, with a hosted version for claude.ai coming soon. It has no SDK or API for building into an app.
Questions? Ask in r/AIMemorySystems.