Memory Router Skill
Route memory operations to appropriate backends (Graphiti for knowledge, AgentDB for coordination).
Activation Triggers
- •"remember this"
- •"store this knowledge"
- •"save for later"
- •"search memory"
- •"recall"
- •"what do we know about"
- •"memory"
- •"knowledge graph"
- •"agent context"
Memory Channels
This skill manages four memory channels:
| Channel | Backend | Use For |
|---|---|---|
| long-term | Graphiti | Architecture, patterns, permanent knowledge |
| sprint | Graphiti | Current feature work, research, WIP decisions |
| team | AgentDB | Agent coordination, task handoffs, shared state |
| short-term | Context | Immediate task, scratchpad (automatic) |
Instructions
When Storing Information
- •
Determine the appropriate channel based on content type:
- •
Long-term (permanent project knowledge):
- •Architecture decisions (ADRs)
- •Code patterns and conventions
- •API schemas and contracts
- •Domain entity definitions
- •Team standards
- •
Sprint (current work context):
- •Feature research and findings
- •WIP design decisions
- •Investigation results
- •Temporary workarounds
- •Sprint-specific patterns
- •
Team (agent coordination):
- •Task assignments and status
- •Handoff context between agents
- •Shared variables and flags
- •Agent capabilities and availability
- •
- •
Use the appropriate MCP tool:
For Graphiti (long-term and sprint channels):
codeUse: mcp__graphiti__add_episode Parameters: - name: Descriptive name for the knowledge - episode_body: The content to store - source: Origin of the knowledge (e.g., "user_conversation", "code_analysis") - episode_type: "message" | "json" | "text"
For AgentDB (team channel):
codeUse: mcp__claude-flow__agent_set_state or mcp__claude-flow__shared_state_set Parameters vary by operation type
- •
Add appropriate metadata:
- •
channel: The target channel - •
content_type: Specific type (adr, pattern, research, task_assignment, etc.) - •
related_entities: Links to related knowledge - •
temporal_context: When this knowledge is valid
- •
When Searching/Recalling
- •
Determine which channels to search:
- •For architectural questions:
["long_term"] - •For current work context:
["sprint", "long_term"] - •For agent coordination:
["team"] - •For comprehensive search:
["long_term", "sprint", "team"]
- •For architectural questions:
- •
Use federated search:
For Graphiti:
codeUse: mcp__graphiti__search Parameters: - query: Natural language search query - num_results: Number of results (default: 10)
For AgentDB:
codeUse: mcp__claude-flow__memory_search Parameters: - query: Search query - limit: Number of results
- •
Merge and present results by relevance, noting the source channel.
Content Type Classification
When the user doesn't specify a channel, classify content automatically:
| Content Pattern | Channel | Content Type |
|---|---|---|
| "ADR", "architecture decision" | long_term | adr |
| "pattern", "convention", "standard" | long_term | pattern |
| "schema", "API contract" | long_term | schema |
| "researching", "investigating" | sprint | research |
| "for this feature", "current work" | sprint | feature_spec |
| "WIP", "temporary", "for now" | sprint | wip_decision |
| "agent status", "task update" | team | agent_status |
| "hand off to", "coordinate with" | team | handoff |
Promotion Operations
When sprint knowledge becomes permanent:
- •Confirm with user: "This appears to be stable knowledge. Promote to long-term memory?"
- •If confirmed, copy from sprint to long-term with provenance metadata
- •Optionally archive the sprint version
Example Interactions
User: "Remember that we decided to use JWT for authentication"
Action: Store in long_term channel as pattern content type
User: "Save my research on the rate limiting options"
Action: Store in sprint channel as research content type
User: "What do we know about the UserService?"
Action: Search long_term and sprint channels for "UserService"
User: "Update the backend worker that the API integration is complete"
Action: Update team channel with agent handoff context
User: "This workaround for the caching issue should be documented permanently"
Action: Promote from sprint to long_term with promotion metadata
MCP Tools Used
Graphiti MCP Server
- •
mcp__graphiti__add_episode- Store knowledge - •
mcp__graphiti__search- Semantic search - •
mcp__graphiti__get_entity- Retrieve specific entity - •
mcp__graphiti__get_entity_edge- Get relationships
claude-flow MCP Server
- •
mcp__claude-flow__memory_store- Store in AgentDB - •
mcp__claude-flow__memory_search- Search AgentDB - •
mcp__claude-flow__shared_state_set- Set shared state - •
mcp__claude-flow__shared_state_get- Get shared state - •
mcp__claude-flow__agent_set_state- Update agent state
Configuration
Ensure both MCP servers are configured:
{
"mcpServers": {
"graphiti": {
"command": "graphiti-mcp-server",
"args": ["--falkordb-url", "redis://localhost:6379"]
},
"claude-flow": {
"command": "npx",
"args": ["claude-flow@alpha", "mcp", "start"]
}
}
}
Fallback Behavior
If a backend is unavailable:
- •Graphiti unavailable: Fall back to AgentDB for all storage (with warning)
- •AgentDB unavailable: Fall back to Graphiti for team coordination (with warning)
- •Both unavailable: Use context window only, warn user about persistence loss
Related Documentation
- •[[adr-memory-channel-architecture]] - Full architecture decision
- •[[adr-agent-framework-strategy]] - Agent framework strategy
- •Graphiti Docs
- •claude-flow Docs