Install any skill in seconds. Free to start, no credit card required.
Get Started Free →Mem0 memory layer integration for AI agents. Implement persistent, semantic memory for long-term context retention and personalization.
.claude/skills/a5c-ai-mem0-integration/SKILL.md| Test case | Without → With | Effect | Δ tokens | Δ turns |
|---|---|---|---|---|
| case-01 | ✗→✓ | ▲ Improved | 39% | 0% |
| case-12 | ✗→✓ | ▲ Improved | 120% | 0% |
| case-14 | ✗→✓ | ▲ Improved | 126% | 0% |
| case-18 | ✗→✓ | ▲ Improved | 50% | 0% |
| case-19 | ✗→✓ | ▲ Improved | 24% | 0% |
Integrate Mem0 (formerly MemGPT) as a universal memory layer for AI agents. Enable persistent memory storage, semantic search across memories, and personalized context retrieval.
Mem0 provides intelligent memory management for AI applications:
pythonfrom mem0 import Memory # Initialize with default local storage m = Memory() # Or with custom configuration config = { "vector_store": { "provider": "qdrant", "config": { "host": "localhost", "port": 6333, } }, "llm": { "provider": "openai", "config": { "model": "gpt-4o-mini", "temperature": 0.1, } } } m = Memory.from_config(config)
python# Add memory from conversation messages = [ {"role": "user", "content": "I prefer dark mode for all my applications"}, {"role": "assistant", "content": "I'll remember that you prefer dark mode."} ] m.add(messages, user_id="user123") # Add memory from plain text m.add("User works at Acme Corp as a software engineer", user_id="user123") # Add with metadata m.add( "Prefers Python over JavaScript", user_id="user123", metadata={"category": "preferences", "confidence": 0.9} )
python# Search for relevant memories results = m.search( query="What are the user's preferences?", user_id="user123", limit=5 ) for memory in results: print(f"Memory: {memory['memory']}") print(f"Relevance: {memory['score']}") print(f"Created: {memory['created_at']}")
python# Get all memories for a user all_memories = m.get_all(user_id="user123") # Filter by metadata filtered = m.get_all( user_id="user123", metadata={"category": "preferences"} )
python# Get memory changes over time history = m.history(memory_id="mem_abc123") for entry in history: print(f"Version: {entry['version']}") print(f"Content: {entry['memory']}") print(f"Updated: {entry['updated_at']}")
pythonfrom langchain_openai import ChatOpenAI from mem0 import MemoryClient # Initialize Mem0 client mem0_client = MemoryClient(api_key="your-api-key") # Create LLM with memory-enhanced context llm = ChatOpenAI(model="gpt-4") def chat_with_memory(user_message: str, user_id: str) -> str: # Retrieve relevant memories memories = mem0_client.search(user_message, user_id=user_id, limit=5) memory_context = "\n".join([m["memory"] for m in memories]) # Build prompt with memory context system_prompt = f"""You are a helpful assistant. Here is what you remember about this user: {memory_context} Use this context to personalize your response.""" # Generate response response = llm.invoke([ {"role": "system", "content": system_prompt}, {"role": "user", "content": user_message} ]) # Store new memory from conversation mem0_client.add( [ {"role": "user", "content": user_message}, {"role": "assistant", "content": response.content} ], user_id=user_id ) return response.content
python# Using Mem0 MCP server with Claude # Configure in claude_desktop_config.json: { "mcpServers": { "mem0": { "command": "npx", "args": ["-y", "@mem0/mcp-server"] } } }
javascriptconst mem0IntegrationTask = defineTask({ name: 'mem0-integration-setup', description: 'Configure Mem0 memory layer for AI agent', inputs: { storageBackend: { type: 'string', default: 'local' }, // 'local', 'qdrant', 'postgres', 'cloud' vectorDimension: { type: 'number', default: 1536 }, embeddingModel: { type: 'string', default: 'text-embedding-3-small' }, memoryCategories: { type: 'array', default: ['facts', 'preferences', 'conversations'] }, userIsolation: { type: 'boolean', default: true } }, outputs: { configured: { type: 'boolean' }, memoryStats: { type: 'object' }, artifacts: { type: 'array' } }, async run(inputs, taskCtx) { return { kind: 'skill', title: `Configure Mem0 with ${inputs.storageBackend} backend`, skill: { name: 'mem0-integration', context: { storageBackend: inputs.storageBackend, vectorDimension: inputs.vectorDimension, embeddingModel: inputs.embeddingModel, memoryCategories: inputs.memoryCategories, userIsolation: inputs.userIsolation, instructions: [ 'Validate storage backend availability', 'Configure embedding model and vector dimensions', 'Set up memory categories and metadata schemas', 'Implement user isolation if enabled', 'Create memory add/search/retrieve functions', 'Test memory operations with sample data', 'Document integration patterns for the application' ] } }, io: { inputJsonPath: `tasks/${taskCtx.effectId}/input.json`, outputJsonPath: `tasks/${taskCtx.effectId}/result.json` } }; } });
| Case | Status | Duration (ms) | Turns | Tokens | Tool calls | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Without | With | Δ | Without | With | Δ | Without | With | Δ | Without | With | Δ | ||
case-01 | fail→pass | 18,571 | 14,316 | -23% | 1 | 1 | 0% | 3,628 | 5,054 | +39% | 0 | 0 | — |
case-02 | fail→fail | 16,057 | 12,731 | -21% | 1 | 1 | 0% | 3,329 | 4,445 | +34% | 0 | 0 | — |
case-03 | fail→fail | 20,222 | 20,115 | -1% | 1 | 1 | 0% | 3,942 | 5,285 | +34% | 0 | 0 | — |
case-04 | fail→fail | 15,713 | 13,924 | -11% | 1 | 1 | 0% | 3,068 | 4,823 | +57% | 0 | 0 | — |
case-05 | fail→fail | 7,308 | 5,821 | -20% | 1 | 1 | 0% | 1,457 | 2,969 | +104% | 0 | 0 | — |
case-06 | fail→fail | 9,435 | 4,373 | -54% | 1 | 1 | 0% | 2,085 | 2,918 | +40% | 0 | 0 | — |
case-07 | fail→fail | 6,229 | 1,945 | -69% | 1 | 1 | 0% | 1,094 | 2,279 | +108% | 0 | 0 | — |
case-08 | fail→fail | 5,728 | 2,241 | -61% | 1 | 1 | 0% | 1,200 | 2,389 | +99% | 0 | 0 | — |
case-09 | fail→fail | 3,966 | 2,739 | -31% | 1 | 1 | 0% | 667 | 2,495 | +274% | 0 | 0 | — |
case-10 | pass→pass | 5,422 | 5,149 | -5% | 1 | 1 | 0% | 1,001 | 2,833 | +183% | 0 | 0 | — |
case-11 | fail→fail | 3,245 | 3,823 | +18% | 1 | 1 | 0% | 619 | 2,717 | +339% | 0 | 0 | — |
case-12 | fail→pass | 7,207 | 4,467 | -38% | 1 | 1 | 0% | 1,276 | 2,809 | +120% | 0 | 0 | — |
case-13 | fail→fail | 14,964 | 6,361 | -57% | 1 | 1 | 0% | 2,909 | 3,188 | +10% | 0 | 0 | — |
case-14 | fail→pass | 9,652 | 11,224 | +16% | 1 | 1 | 0% | 1,857 | 4,189 | +126% | 0 | 0 | — |
case-15 | fail→fail | 10,536 | 3,802 | -64% | 1 | 1 | 0% | 2,094 | 2,556 | +22% | 0 | 0 | — |
case-16 | pass→pass | 11,255 | 2,340 | -79% | 1 | 1 | 0% | 2,157 | 2,439 | +13% | 0 | 0 | — |
case-17 | fail→fail | 13,652 | 1,623 | -88% | 1 | 1 | 0% | 2,282 | 2,266 | -1% | 0 | 0 | — |
case-18 | fail→pass | 9,567 | 2,092 | -78% | 1 | 1 | 0% | 1,554 | 2,337 | +50% | 0 | 0 | — |
case-19 | fail→pass | 11,074 | 2,964 | -73% | 1 | 1 | 0% | 2,033 | 2,512 | +24% | 0 | 0 | — |
case-20 | pass→pass | 12,143 | 1,803 | -85% | 1 | 1 | 0% | 2,331 | 2,239 | -4% | 0 | 0 | — |
case-21 | fail→fail | 15,757 | 8,658 | -45% | 1 | 1 | 0% | 2,478 | 3,648 | +47% | 0 | 0 | — |
case-22 | fail→fail | 7,346 | 1,397 | -81% | 1 | 1 | 0% | 1,224 | 2,175 | +78% | 0 | 0 | — |
DecimalAI ran this skill against gemini-3.6-flash twice over the same eval suite — once with the skill loaded and once without — and compared the two runs case by case. 22 cases were attempted. The headline lift of +23 percentage points is the difference between those two pass rates over the 22 comparable cases.
Without the skill loaded, the model failed this case. With it loaded, the same prompt on the same model passed. This is one improved case from the latest verified run; every case, including any that regressed, is in the table above.
Other measured skills in the registry, with their headline benchmark lift.