Mem0 Explained: How the AI Memory Layer Works
Mem0 is an open-source memory layer that sits between your app and your model. Your app sends it conversation turns. Mem0 extracts facts from them, and your app searches those facts before the next model call. The project calls itself "The Memory Layer for AI Agents" on GitHub, where it had about 68,000 stars in late October 2026. Below: what Mem0 stores, how the hosted platform differs from the library, and how far its benchmarks hold.
What is Mem0, in one sentence?
Mem0 is a memory layer for LLM apps and agents that extracts facts from conversations with a model and returns the relevant ones when your app searches.
It ships as a Python and JavaScript library under the Apache-2.0 license. You install it with pip install mem0ai or the npm package of the same name. There is also a self-hostable server and a managed cloud platform. The research behind it is a 2025 paper by Prateek Chhikara and colleagues, Mem0: Building Production-Ready AI Agents with Scalable Long-Term Memory.
How does the Mem0 platform differ from the open-source library?
The two share an API shape and differ in what runs where. Mem0's own comparison page lists the gaps.
| Mem0 Platform (hosted) | Mem0 open source | |
|---|---|---|
| Who runs it | Mem0. No vector store, LLM or embedder to configure | You. You pick and pay for each part |
| Graph memory | Native and always on. Entity links feed ranking | Removed in the v3 pipeline. Entities still boost ranking, with no queryable graph |
| Scopes | User, agent, app and run IDs, plus orgs and projects | User, agent and run IDs |
| Ranking extras | Memory decay, temporal reasoning, Dream consolidation | Your vector store plus an optional reranker |
| Choice of parts | Managed by Mem0 | 25 vector stores, 18 LLM providers, 11 embedders |
| Dashboard | Yes | Only with the self-hosted server |
The pricing page lists two plans in October 2026. The free plan allows 10,000 adds and 1,000 retrievals a month for the first 30 days. After that it allows 50,000 adds and 10,000 retrievals a month with your own LLM key. Graph memory and Dream consolidation are in the Custom plan, which has no public price. On-prem deployment is there too.
How does Mem0 work?
The memory overview describes a two-call loop: add after each turn and search before each model call.
An LLM reads each batch of added messages and pulls out facts such as preferences. Mem0 checks existing memories and removes duplicates. Then it embeds the new facts and links the entities they mention. By default it keeps the extracted facts and drops the transcript. Pass infer=False and it stores your payload exactly as sent.
Storage is split three ways: facts and metadata in a SQL database, embeddings in a vector database, and entities in a store of their own. On the platform, an add returns a pending status with an event ID, so the write finishes in the background.
Mem0 ranks search results on several signals. Its research page names semantic, keyword and entity scoring, run in parallel. The overview adds a temporal signal. Filter every search by ID, or memories from different users can mix.
What changed in the 2026 algorithm?
On April 16, 2026, Mem0 published what it calls a token-efficient memory algorithm. Extraction became a single LLM pass that only adds facts. The add documentation says new memories are added "without overwriting or deleting existing memories."
If a user changes their mind, the old fact stays until you remove it. The overview says corrections need explicit update or delete calls, so a settings screen should call update when the user edits a preference.
What do Mem0's benchmarks show?
Mem0 reports two sets of self-published numbers. The 2025 paper evaluated on the LOCOMO benchmark. Its abstract claims a 26% relative improvement over OpenAI's memory on an LLM-as-a-judge metric. Compared with putting the full history in context, it reports 91% lower p95 latency and more than 90% token savings.
The 2026 algorithm comes with new scores in the GitHub README. It reports 92.5 on LoCoMo, up from 71.4 under the old algorithm. LongMemEval rose from 67.8 to 94.4. Each retrieval uses about 7,000 tokens with a median latency near one second. The research page contrasts this with 25,000 or more tokens for a full-context approach.
The README says the scores reflect the managed platform, "which includes proprietary optimizations not available in the open-source SDK." Open-source users should expect "directionally similar gains but not identical numbers." Mem0 has released its evaluation code at mem0ai/memory-benchmarks, so you can rerun it. We found no independent reproduction to cite.
How do you use Mem0 with Claude Code and Cursor?
Mem0 ships a Claude Code plugin, and its integration page lays out how it records a session. Hooks save each exchange locally without a model call, including short test results. A background worker sends batches to Mem0 after every five exchanges. Ending or compacting the session flushes the rest.
Mem0 then extracts memories and sorts them into shared project memory and personal preferences. In a new session, the plugin searches with your first prompt and injects up to five memories before Claude answers. After that, recall needs an explicit search. The plugin needs a Mem0 Platform API key, and the page describes no self-hosted option.
Cursor connects through Mem0's hosted MCP server. The Cursor page has you add the server to .cursor/mcp.json with your API key in a header.
When does Mem0 fit, and when does it not?
Mem0 fits apps that serve many end users and need per-user personalization. Support bots and tutors are the obvious cases. The scoping model and the hosted option are built for them. If you want memory without running a vector store, the platform is the shortest path.
It fits less well when you need to read and edit what was stored. Facts live in databases you query through an API. On the platform, a model you do not control decides what becomes a fact. Since extraction only adds, stale facts pile up unless your code cleans them. If you must self-host, budget for your own reranker, because graph memory and decay stay on the platform.
The bottom line
Use Mem0 when your product must remember thousands of separate users and you want a managed API for it. Start on the free plan and test retrieval quality on your own conversations. The benchmark scores are vendor claims about the hosted platform. Write your own update and delete logic from day one.
How do you share one memory across coding agents?
A developer who moves between coding agents needs one memory that every agent can read. Today Claude Code and Codex each learn the same project facts in their own silo. And when a memory layer extracts facts with its own model, you see the stored fact with no record of why it was chosen.
In memU, your coding agent decides what to remember. A scheduled background task slices new session logs into jobs. The agent distills them into memory and skill Markdown, and memU commits the files. memU's memory service makes no LLM or chat calls. It stores and embeds the Markdown the agent prepared, then retrieves it. A standing instruction in CLAUDE.md or AGENTS.md tells the agent to retrieve before answering. All hosts share one backend, so what Codex learned is there for Claude Code. Because memory is readable Markdown, you can open a wrong entry and fix it by hand.
The hosted version on memu.so is free and syncs across devices. Get an API key there and send your agent one message:
Read https://memu.pro/SKILL.md, follow its instructions to install and configure memU, API Key is
YOUR_MEMU_API_KEY.
The self-hosted setup and the support matrix are in the memU GitHub repository. It is open source under Apache-2.0.
FAQ
Is Mem0 free and open source?
Yes. The library is open source under Apache-2.0 and installs with pip or npm. The hosted platform has a free plan with monthly limits, plus a Custom plan with no public price.
What is the difference between user_id, agent_id and run_id in Mem0?
They are scopes. A user ID ties memories to one person, an agent ID to one agent, and a run ID to one session or task. Mem0 recommends filtering every search by them so memories do not mix.
Does open-source Mem0 support graph memory?
Not any more. Mem0's docs say graph memory was removed from the open-source version with the v3 pipeline. Entities still help ranking there. The queryable graph is only on the platform.
Does Mem0 update or delete old memories automatically?
No. Extraction has only added facts since the April 2026 algorithm. Existing memories stay in place. Corrections need explicit update or delete calls, or an expiration date set when you add the memory.
Does the Mem0 Claude Code plugin work without an account?
No. Mem0's integration page says the plugin needs a Mem0 Platform API key. It also needs Python 3.10 or later and Git.