mem0-plugin/skills/mem0-mcp/SKILL.md
You have access to persistent memory via the mem0 MCP tools. Follow this protocol to maintain context across sessions.
Decide whether persistent memory context would improve your response, then act accordingly. Don't search by default — search deliberately.
Search WHEN the user:
Skip WHEN:
add_memory), not a searchEmpty results are normal. Proceed without context — they don't mean the system is broken.
When you do search, run 2–4 parallel search_memories calls at different angles instead of one query echoing the user's prompt.
Query phrasing:
"auth module decisions" beats "what did we decide about auth"."Postgres choice".get_memories ordered by created_at.Metadata filters match the same type values written under "After completing significant work" below.
Two rules from the v2 filter spec:
AND / OR / NOT) with an array. A bare {"user_id": "..."} won't work.{"metadata": {"type": "decision"}}, never {"metadata.type": "decision"}. Only top-level metadata keys are filterable.Combine user_id with one metadata clause per call:
metadata.type clause | Use for |
|---|---|
{"metadata": {"type": "decision"}} | design / architecture / "how should we" questions |
{"metadata": {"type": "anti_pattern"}} | debugging, error handling, things that failed before |
{"metadata": {"type": "user_preference"}} | tooling, stack, style — always include for code work |
{"metadata": {"type": "convention"}} | established patterns in this project |
Full filter (replace <your_user_id> with the active user_id from your runtime):
filters={"AND": [{"user_id": "<your_user_id>"}, {"metadata": {"type": "decision"}}]}
User asks: "Refactor the auth module to use JWT."
Don't:
search_memories(query="Refactor the auth module to use JWT")
# Hits whatever shares words. Misses prior decisions and preferences.
Do (parallel — substitute the active user_id for <your_user_id>):
search_memories(query="auth module decisions",
filters={"AND": [{"user_id": "<your_user_id>"}, {"metadata": {"type": "decision"}}]})
search_memories(query="JWT",
filters={"AND": [{"user_id": "<your_user_id>"}]})
search_memories(query="auth refactor failures",
filters={"AND": [{"user_id": "<your_user_id>"}, {"metadata": {"type": "anti_pattern"}}]})
search_memories(query="auth",
filters={"AND": [{"user_id": "<your_user_id>"}, {"metadata": {"type": "user_preference"}}]})
Extract key learnings and store them using the add_memory tool:
{"type": "decision"}{"type": "task_learning"}{"type": "anti_pattern"}{"type": "user_preference"}{"type": "environmental"}{"type": "convention"}Memories can be as detailed as needed -- include full context, reasoning, code snippets, file paths, and examples. Longer, searchable memories are more valuable than vague one-liners.
If context is about to be compacted or the session is ending, store a comprehensive session summary:
## Session Summary
### User's Goal
[What the user originally asked for]
### What Was Accomplished
[Numbered list of tasks completed]
### Key Decisions Made
[Architectural choices, trade-offs discussed]
### Files Created or Modified
[Important file paths with what changed]
### Current State
[What is in progress, pending items, next steps]
Include metadata: {"type": "session_state"}