Mem0
Mem0 Platform SDK for adding persistent memory to AI applications. TRIGGER when: user mentions "mem0", "MemoryClient", "memory layer", "remember user preferences", "persistent context", "personalization", or needs to add long-term memory to chatbots, agents, or AI apps. Covers Python SDK (mem0ai), TypeScript SDK (mem0ai), and framework integrations (LangChain, CrewAI, OpenAI Agents SDK, Pipecat…
- Type
- Memory Tool
- Repository
- mem0ai/mem0
- GitHub stars
- 66.1k
- License
- Apache-2.0
- Repo last updated
- Sep 25, 2026
- Source file
- skills/mem0/SKILL.md
What Mem0 is
Mem0 is a memory tool published in the mem0ai/mem0 repository on GitHub, which has about 66.1k stars. The repository describes itself as: “The Memory Layer for AI Agents - Drop-in memory infrastructure for AI agents and apps. Context that persists. Built for production.”
Mem0 is a community resource for extending Claude Code and Claude Cowork. Check the repository README for how the author intends it to be used.
Because resources like this change often, read the source before you rely on it and pin the version you tested.
How to install Mem0
Claude Code
- Download the source file from the repository.
- Save it as ~/.claude/skills/<skill-name>/SKILL.md for all projects, or .claude/skills/<skill-name>/SKILL.md for one project.
- Claude loads it automatically when a task matches; you can also run it with / and its name.
Claude Cowork
- Zip the skill folder so SKILL.md sits at the top level of the folder.
- Open Customize → Skills, click +, then upload the ZIP.
- Start a task that matches the description, or call it by name with /.
New to extending Cowork? Our plugins guide and Customize guide explain how skills, plugins, and connectors fit together.
Inside the source file
An excerpt from skills/mem0/SKILL.md, shared under the repository's Apache-2.0 license. Read the full file on GitHub.
> Skill Graph: This skill is part of the Mem0 skill graph: > - mem0 (this skill) -- Platform Client SDK + OSS (Python + TypeScript) > - mem0-cli (GitHub) -- Command-line interface > - mem0-vercel-ai-sdk (GitHub) -- Vercel AI SDK provider
Mem0 is a managed memory layer for AI applications. It stores, retrieves, and manages user memories via API — no infrastructure to deploy. For self-hosted usage, see the OSS section in the client references below.
Step 1: Install and authenticate
Python:
pip install mem0ai
export MEM0_API_KEY="m0-your-api-key"TypeScript/JavaScript:
npm install mem0ai
export MEM0_API_KEY="m0-your-api-key"Get an API key at: https://app.mem0.ai/dashboard/api-keys?utm_source=oss&utm_medium=skill-mem0
> Don't have a MEM0_API_KEY? Run mem0 init --agent --agent-caller --json (after pip install mem0-cli or npm install -g @mem0/cli), substituting your agent identity (e.g. claude-code, cursor). If you forgot to pass --agent-caller, run mem0 identify after init. The human can claim later with mem0 init --email .
Step 2: Initialize the client
Python:
from mem0 import MemoryClient
client = MemoryClient(api_key="m0-xxx")TypeScript:
import MemoryClient from 'mem0ai';
const client = new MemoryClient({ apiKey: 'm0-xxx' });For async Python, use AsyncMemoryClient.
Step 3: Core operations
Every Mem0 integration follows the same pattern: retrieve → generate → store.
Add memories
messages = [
{"role": "user", "content": "I'm a vegetarian and allergic to nuts."},
{"role": "assistant", "content": "Got it! I'll remember that."}
]
client.add(messages, user_id="alice")Search memories
results = client.search("dietary preferences", filters={"user_id": "alice"})
for mem in results.get("results", []):
print(mem["memory"])Get all memories
all_memories = client.get_all(filters={"user_id": "alice"})Update a memory
client.update("memory-uuid", text="Updated: vegetarian, nut allergy, prefers organic")Delete a memory
client.delete("memory-uuid")
client.delete_all(user_id="alice") # delete all for a userCommon integration pattern
from mem0 import MemoryClient
from openai import OpenAI
mem0 = MemoryClient()
openai = OpenAI()
def chat(user_input: str, user_id: str) -> str:
# 1. Retrieve relevant memories
memories = mem0.search(user_input, filters={"user_id": user_id})
context = "\n".join([m["memory"] for m in memories.get("results", [])])
# 2. Generate response with memory context
response = openai.chat.completions.create(
model="gpt-5-mini",
messages=[
{"role": "system", "content": f"User context:\n{context}"},
{"role": "user", "content": user_input},
]
…Common edge cases
- Search returns empty: Memories process asynchronously. Wait 2-3s after add() before searching. Also verify user_id matches exactly (case-sensitive) and use filters={"user_id": "..."} syntax.
- AND filter with user_id + agent_id returns empty: Entities are stored separately. Use OR instead, or query separately.
- Duplicate memories: Don't mix infer=True (default) and infer=False for the same data. Stick to one mode.
- Wrong import: Always use from mem0 import MemoryClient (or AsyncMemoryClient for async). Do not use from mem0 import Memory.
- v3 defaults: top_k=20, threshold=0.1, rerank=False. Adjust as needed for your use case.
v2 Compatibility
If you're using SDK v2.x, note these differences:
- Entity IDs: Pass user_id as top-level kwarg to search() instead of inside filters
- Defaults: top_k=100, no threshold, rerank=True
- Graph memory: Available via enable_graph=True
See the migration guide for details.
Live documentation search
For the latest docs beyond what's in the references, use the doc search tool:
python ${CLAUDE_SKILL_DIR}/scripts/mem0_doc_search.py --query "topic"
python ${CLAUDE_SKILL_DIR}/scripts/mem0_doc_search.py --page "/platform/features/graph-memory"
python ${CLAUDE_SKILL_DIR}/scripts/mem0_doc_search.py --indexNo API key needed — searches docs.mem0.ai directly.
Client SDK References
Language-specific deep references (Platform + OSS):
Platform References
Load these on demand for deeper detail:
Before you install
- Read the whole file first. Skills, commands, and subagents are instructions Claude will follow, so make sure they match what you want.
- Check which tools, scripts, or MCP servers it uses. Local servers and scripts run with your permissions.
- Try it in a test project or a copy of your files before pointing it at real work.
- Pin the version you tested, and review changes before updating.
- Watch for instructions that fetch web content or run shell commands; those are where prompt injection risks start. See our prompt injection guide.
FAQ
What is Mem0?
Mem0 is a memory tool for Claude Code and Claude Cowork from the mem0ai/mem0 repository on GitHub. Mem0 Platform SDK for adding persistent memory to AI applications. TRIGGER when: user mentions "mem0", "MemoryClient", "memory layer", "remember user preferences", "persistent context", "personalization", or needs to add long-term memory to chatbots, agents, or AI apps. Covers Python SDK (mem0ai), TypeScript SDK (mem0ai), and framework integrations (LangChain, CrewAI, OpenAI Agents SDK, Pipecat…
How do I install Mem0 in Claude Code?
Download the source file from the repository. Save it as ~/.claude/skills/<skill-name>/SKILL.md for all projects, or .claude/skills/<skill-name>/SKILL.md for one project. Claude loads it automatically when a task matches; you can also run it with / and its name.
Can I use Mem0 in Claude Cowork?
Zip the skill folder so SKILL.md sits at the top level of the folder. Open Customize → Skills, click +, then upload the ZIP. Start a task that matches the description, or call it by name with /.
Is Mem0 safe to install?
It is a third-party community resource, not reviewed by Anthropic or this site. Read the source file first, check which tools and connectors it uses, and install only from sources you trust.
Similar resources
- Obsidian Mind An Obsidian vault that gives AI coding agents persistent memory across sessions. Memory Tool · breferrari/obsidian-mind
- MCP Memory Server (official) The reference knowledge-graph memory server from the official Model Context Protocol servers repo. Memory Tool · modelcontextprotocol/servers
- Basic Memory A local-first knowledge base that syncs plain-Markdown notes into an MCP-accessible semantic store. Memory Tool · basicmachines-co/basic-memory
- Claude Code Memory Setup An Obsidian + graph memory setup that reports up to 71.5x fewer tokens per Claude Code session. Memory Tool · lucasrosati/claude-code-memory-setup
- Memorizer A vector-search powered agent memory MCP server from Petabridge. Memory Tool · petabridge/memorizer
- Memento MCP A fragment-based memory MCP server designed for mid- to long-term AI recall. Memory Tool · JinHo-von-Choi/anchormind