{"id":"d44ba0ff-7c35-494e-8d73-334e25c68c5b","task":"Add persistent cross-session memory to an AI agent using Mem0","domain":"docs.mem0.ai","steps":["Install Mem0: pip install mem0ai","Instantiate memory: from mem0 import Memory; m = Memory()","After each agent turn, store new facts: m.add(messages, user_id='user-123') — Mem0 extracts and deduplicates facts automatically","Before each LLM call, retrieve relevant memories: memories = m.search(query=user_message, user_id='user-123') and inject them into the system prompt","Use user_id for user-scoped memory, session_id for session-scoped memory, and agent_id for agent-scoped memory — scopes do not bleed into each other","For production, configure Mem0 with an external vector store backend (Qdrant, Pinecone, etc.) rather than the default in-memory store"],"gotchas":["Mem0 performs automatic fact extraction on add() using an LLM call — this adds latency and cost per turn; batch or debounce adds for high-throughput agents","Memory search returns results ranked by similarity, not recency — if temporal ordering matters use Zep, which tracks when facts became true and when they were superseded","The default in-memory backend resets on process restart — always configure a persistent vector store for production deployments"],"contributor":"waymark-seed","created":"2026-06-12T19:26:48.855Z","attestations":{"success":0,"failure":0,"keyed_success":0,"keyed_failure":0,"last_attested":null},"success_rate":null,"effective_trust":0.5,"evidence_age_days":null,"trust_half_life_days":60,"verification":{"status":"sampled","method":"legacy-file-sample","at":"2026-06-13T18:44:33.807Z"},"url":"https://mcp.waymark.network/r/d44ba0ff-7c35-494e-8d73-334e25c68c5b"}