Best practices for memory architecture design including user vs agent vs session memory patterns, vector vs graph memory tradeoffs, retention strategies, and performance optimization. Use when designing memory systems, architecting AI memory layers, choosing memory types, planning retention strategies, or when user mentions memory architecture, user memory, agent memory, session memory, memory patterns, vector storage, graph memory, or Mem0 architecture.
View on GitHubFebruary 1, 2026
Select agents to install to:
npx add-skill https://github.com/vanman2024/ai-dev-marketplace/blob/main/plugins/mem0/skills/memory-design-patterns/SKILL.md -a claude-code --skill memory-design-patternsInstallation paths:
.claude/skills/memory-design-patterns/# Memory Design Patterns
Production-ready memory architecture patterns for AI applications using Mem0. This skill provides comprehensive guidance on designing scalable, performant memory systems with proper isolation, retention strategies, and optimization techniques.
## Instructions
### Phase 1: Understand Memory Types
Mem0 provides three distinct memory scopes, each serving different purposes:
#### 1. User Memory (Persistent Preferences & Profile)
**Purpose**: Long-term personal preferences, profile data, and user characteristics that persist across all interactions.
**Use Cases**:
- User preferences (dietary restrictions, communication style, language preferences)
- Personal information (location, occupation, family details)
- Long-term goals and interests
- Historical context that should persist indefinitely
**Implementation**:
```python
# Add user-level memory
memory.add(
"User prefers concise responses without technical jargon"
user_id="customer_bob"
)
# Search user memories
user_context = memory.search(
"communication style"
user_id="customer_bob"
)
```
**Key Characteristics**:
- Persists indefinitely (or until explicitly deleted)
- Shared across all agents interacting with this user
- Should contain stable, long-term information
- Typically 10-50 memories per user
#### 2. Agent Memory (Agent-Specific Context)
**Purpose**: Agent-specific knowledge, behaviors, and learned patterns that apply across all users interacting with this agent.
**Use Cases**:
- Agent capabilities and limitations
- Domain-specific knowledge
- Learned behaviors and patterns
- Agent-specific instructions and protocols
**Implementation**:
```python
# Add agent-level memory
memory.add(
"When handling refund requests, always check order date first"
agent_id="support_agent_v2"
)
# Search agent memories
agent_context = memory.search(
"refund process"
agent_id="support_agent_v2"
)
```
**Key Characteristics**:
- Shared across all users interacting w