mem0ai/mem0
A vector-backed memory layer for AI agents that need to recall past conversations
Automated SPDX check for reference only — not legal advice. Disclaimer
GitHub Star History
Full-history star trajectory from GitHub official history. Switch ranges or hover any point for exact counts.
Evidence-Backed Technical Brief
AI Deep ReviewArchitecture & Core Mechanics
Mem0 is an application-level memory layer, not a replacement for the vector database beneath it. The Python integration calls Memory.search() with a scope such as user_id, injects the returned facts into the prompt, and calls Memory.add() after the response. The application still owns answer generation. The extraction path uses an LLM to derive memories from conversation turns, then embeds and indexes them for later recall.
The monorepo separates the Python package (mem0/), TypeScript SDK (mem0-ts/), server (server/), and CLI (cli/). The Python manifest declares openai, qdrant-client, pydantic, httpx, and sqlalchemy, with optional NLP and vector-store dependencies. Pluggable model and storage choices let teams change the memory backend without moving the chat-generation loop into Mem0.
Key Capabilities & Differentiators
Memory can be scoped by user, session, or agent. The single-pass, ADD-only extraction design retains earlier facts and also records assistant-confirmed actions. Retrieval combines semantic similarity, BM25, and entity signals; temporal ranking helps distinguish current state from past events and upcoming plans. The Python setup pairs mem0ai[nlp] with spaCy’s en_core_web_sm for enhanced keyword matching and entity extraction. Defaults are gpt-5-mini and text-embedding-3-small.
Managed-platform results under a single-pass top_200 retrieval budget are 92.5 on LoCoMo, 94.4 on LongMemEval, and 64.1 on BEAM (1M). BEAM (1M) used 6.7K tokens with a 1.00 s p50. The managed platform includes proprietary optimizations, so these figures are neither OSS performance estimates nor end-to-end latency targets for an application.
Trade-offs & Limitations
Compared with using Qdrant or pgvector directly, Mem0 supplies custom logic that a vector store does not: extracting durable facts from chat, scoping them, and ranking them for recall. If the application already has an explicit schema and deterministic update rules, direct storage is simpler and more predictable. ADD-only extraction preserves history but leaves potentially conflicting facts in play; temporal ranking helps retrieval, but it does not guarantee an authoritative current value.
Extraction adds a model call to the write path, and retrieval adds work before generation. Budget model costs, vector-store growth, and provider rate limits separately from chat inference. The Apache-2.0 self-hosted stack gives operators control over that API deployment, while the managed platform reduces operational work and includes optimizations not available in OSS. Neither an authenticated API nor a scope filter replaces application-level tenant authorization.
Hardware & Deployment Guide
For embedded use, install mem0ai on Python >=3.10,<4.0 or install mem0ai via npm for the TypeScript SDK. For a shared API, run cd server && make bootstrap, or use docker compose up -d from server/ and complete the browser setup. Self-hosted authentication is enabled by default. The default OpenAI model path requires outbound API access but no local GPU; a network-isolated deployment must replace those external dependencies and validate the chosen stack.
Pin the Python and TypeScript releases separately. Python v2.2.1 excludes rejected inserts from ADD results, history, and entity links, and raises an error if none of the extracted memories can be inserted. TypeScript ts-v3.3.1 stops injecting OpenAI default models and base URLs into non-OpenAI provider configurations.
Memory.search() retrieves scoped context before generation; Memory.add() extracts memories after the turn.nlp extra and en_core_web_sm enable the documented setup for BM25 matching and entity extraction alongside semantic retrieval.qdrant-client and lists Chroma, Weaviate, Pinecone, and FAISS among optional vector-store dependencies.cd server && make bootstrap starts the self-hosted stack, creates an admin, and issues the first API key.Assistants and support agents that need to recall preferences, prior decisions, and confirmed actions across sessions, without building their own extraction and retrieval pipeline.
You only need static document RAG, a deterministic profile store, or network-isolated operation and cannot validate a stack that replaces the default external model APIs.
Quick Start & Installation
# 1. Install npm install -g @mem0/cli # or: pip install mem0-cli # 2. Sign up as an agent (replace `claude-code` with your name) mem0 init --agent --agent-caller claude-code # 3. Add a memory mem0 add "I am using mem0" # 4. Search mem0 search "am I using mem0"
Comparison vs. Top RAG, Data & Memory Alternatives
Full comparison →| Repository | Stars | 7d Trend | Stack | License | Core Positioning |
|---|---|---|---|---|---|
| mem0 ★ | 70k | +498 | Python | Apache-2.0 | A vector-backed memory layer for AI agents that need to recall past conversation |
| Memori | 17.9k | +337 | Python | — | An SDK-based agent memory layer for persistent state across sessions. |
| OpenViking | 43.2k | +255 | Python | AGPL-3.0 | A directory-scoped RAG database for inspectable agent knowledge and memory |
| hindsight | 64.7k | +884 | Python | MIT | A bank-based memory service that turns agent interactions into durable knowledge |
AI Context Briefing (for Claude / Cursor / Windsurf)
Standardized architecture summary & quickstart commands ready to paste into coding agents.
curl -sL https://repoforai.com/repo/mem0ai/mem0.md
Active README embeds unlock Hot-Tier 6h Telemetry Refresh automatically (zero pay-to-rank).
Frequently Asked Questions about mem0
How do I integrate Mem0 into an existing chat application?
Memory.search() before generating a response, filter it with the application’s authenticated user identifier, and pass the returned memories into the prompt. After the response, call Memory.add() with the conversation turns you want it to process. Keep authorization in the application: a user_id search filter is not an access-control check.Do I need a GPU, and where does runtime overhead come from?
Can I self-host Mem0 commercially and keep sensitive data on-premises?
When should I choose Mem0 over Qdrant or pgvector directly?
Upstream README & Documentation
This profile focuses on independent engineering analysis and live telemetry. Read the full upstream README, changelog, and examples directly on GitHub.
Top 10 Breakout Open-Source AI Repos, Every Thursday
Signal-only digest of fast-growing AI repos, SPDX license alerts, and architecture picks. Zero spam.
Zero spam · 1-click unsubscribe · Privacy Policy