Date: December 1, 2025 Purpose: Guide Claude's tool selection for optimal memory operations Audience: Internal reference for Claude and developers
Claude should follow this decision tree when working with memories:
User Request
│
├─ Recall/Search Query? → START WITH recall_memories
│ ├─ Results found? → Use get_memory or get_related_memories for details
│ └─ No results? → Try search_memories with different parameters
│
├─ Store New Information? → START WITH store_memory
│ └─ After storing? → Use create_relationship to link related memories
│
├─ Explore Connections? → START WITH get_related_memories
│ └─ For specific memory ID
│
├─ Update/Delete? → get_memory first, then update_memory or delete_memory
│
└─ Overview/Stats? → get_memory_statistics
Use for:
- Any recall or search query from user
- "What did we learn about X?"
- "Show me solutions for Y"
- "Catch me up on this project"
Why first:
- Optimized defaults (fuzzy matching, relationships included)
- Simpler interface for natural language queries
- Best results for common use cases
When to skip:
- Need exact match only → use search_memories with search_tolerance="strict"
- Need advanced boolean queries → use search_memories
- Need multi-term queries → use search_memories (when Phase 2.D complete)
Use for:
- Capturing new solutions, problems, errors, decisions
- Recording patterns or learnings
- Documenting technology choices
Always follow with:
- create_relationship to link to related memories
Use for:
- After storing a solution → link to problem it solves
- After documenting an error → link to its fix
- Connecting decisions to what they improve
Common patterns:
- solution SOLVES problem
- fix ADDRESSES error
- decision IMPROVES previous_approach
- pattern APPLIES_TO project
Use when recall_memories isn't suitable:
- Need strict exact matching (search_tolerance="strict")
- Need to search with specific tags
- Need to filter by importance threshold
- Advanced queries requiring fine control
Don't use when:
- Starting a search (use recall_memories instead)
- Unless you need specific search parameters
Use for:
- Getting full details when you have a specific ID
- Verifying memory before update/delete
- Drilling down from search results
Don't use for:
- Initial search (use recall_memories instead)
- When you don't have an ID
Use for:
- After finding a memory, explore what connects to it
- "What caused this problem?"
- "What solutions exist for this?"
- Following chains of reasoning
Filter by relationship types when you know what you're looking for:
- relationship_types=["SOLVES"] → Find solutions
- relationship_types=["CAUSES", "TRIGGERS"] → Find causes
- relationship_types=["USED_IN"] → Find where pattern applies
Use for:
- Complex conditional queries
- Finding relationships with specific context (scope, conditions, evidence)
- Advanced graph queries
Don't use for:
- Simple recall queries
- Unless you specifically need structured context filtering
Use for:
- Corrections or enrichments
- Adding tags or updating importance
Always:
- Use get_memory first to verify contents
- Only update necessary fields
Use for:
- Removing obsolete or incorrect memories
Warning:
- Deletes all relationships too (cascade)
- Irreversible
- Prefer update_memory for corrections
Use for:
- Overview of memory database
- "Catch me up" on what's been stored
- Understanding memory distribution by type
Decision Tree:
- Start: recall_memories(query="X")
- Results found?
- Yes → Present results, offer to explore connections
- No → Try search_memories with different terms or broader filters
- User wants details? → get_memory(memory_id="...")
- User wants connections? → get_related_memories(memory_id="...")
Example:
User: "What timeouts have we fixed?"
Step 1: recall_memories(query="timeout", memory_types=["solution", "fix"])
Step 2: [Present results]
Step 3 (if user asks): get_memory(memory_id="timeout-solution-123")
Step 4 (if user asks): get_related_memories(memory_id="timeout-solution-123", relationship_types=["SOLVES"])
Decision Tree:
- Store solution: store_memory(type="solution", title="...", content="...")
- Search for related problem: recall_memories(query="related problem terms")
- Create link: create_relationship(from_memory_id="solution", to_memory_id="problem", relationship_type="SOLVES")
Example:
User: "I fixed the Redis timeout by increasing connection timeout to 5 seconds"
Step 1: store_memory(
type="solution",
title="Fixed Redis timeout with 5s connection timeout",
content="...",
tags=["redis", "timeout", "connection"]
)
→ Returns memory_id: "sol-123"
Step 2: recall_memories(query="Redis timeout", memory_types=["problem", "error"])
→ Finds memory_id: "prob-456" (Redis timeout problem)
Step 3: create_relationship(
from_memory_id="sol-123",
to_memory_id="prob-456",
relationship_type="SOLVES"
)
Decision Tree:
- Search for decision: recall_memories(query="X decision", memory_types=["decision"])
- Get details: get_memory(memory_id="decision-123")
- Explore context: get_related_memories(memory_id="decision-123")
- Look for IMPROVES relationships (what it improved)
- Look for REPLACES relationships (what it replaced)
Decision Tree:
- Get stats: get_memory_statistics()
- Get recent activity: recall_memories(project_path="/current/project", limit=10)
- For each recent item: Show title, type, context_summary
Future Enhancement (Phase 2.E):
- get_recent_activity(days=7, project="/current") will replace steps 1-2
After Phase 2.C implementation, measure:
- Tool selection accuracy: >90% (Claude uses correct tool first try)
- Tools per recall: 1-2 average (down from 3-4 currently)
- Failed searches: <10% (searches return no results)
- User satisfaction: Fewer "Claude couldn't find it" reports
❌ Don't:
- Use search_memories when recall_memories would work
- Call get_memory without an ID
- Create memory without considering relationships
- Use exact match search as default
✅ Do:
- Start with recall_memories for all searches
- Use create_relationship after storing related memories
- Filter by memory_types for precision
- Use get_related_memories to explore context
MemoryGraph supports three tool profiles:
- recall_memories ✅
- store_memory ✅
- get_memory ✅
- search_memories ✅
- update_memory ✅
- delete_memory ✅
- create_relationship ✅
- get_related_memories ✅
Best for: Most users, covers 90% of use cases
- All lite tools
- get_memory_statistics ✅
- search_relationships_by_context ✅
- Advanced relationship tools (7 tools)
Best for: Power users needing advanced queries
- All standard tools
- Intelligence tools (7 tools)
- Integration tools (11 tools)
- Proactive tools (9 tools)
Best for: Enterprise users, complex workflows, advanced automation
When complete, search_memories will support:
- Multiple search terms:
terms=["Redis", "timeout", "fix"] - Match modes:
match_mode="all"(AND) ormatch_mode="any"(OR) - Boolean operators:
query="Redis AND timeout NOT OAuth" - Relationship filters:
relationship_filter="SOLVES"
Impact on tool selection:
- recall_memories remains primary tool
- search_memories becomes more powerful for complex queries
New tool: get_recent_activity(days=7, project="/path")
Impact on tool selection:
- Preferred over get_memory_statistics for "catch me up" queries
- Auto-detects project context
- Focuses on what's relevant now
Tool descriptions follow this format:
[Brief summary]
WHEN TO USE:
- [Scenario 1]
- [Scenario 2]
HOW TO USE:
- [Step 1]
- [Step 2]
EXAMPLES:
- User: "[query]" → [tool usage]
RETURNS:
- [What the tool returns]
Adding new tools:
- Follow the description format
- Place in appropriate hierarchy (primary/secondary/utility)
- Update this guide
- Add usage examples
- Test with Claude in realistic scenarios
Key principles:
- Start simple: Use recall_memories unless there's a specific reason not to
- Follow chains: Store → Link → Recall
- Provide context: Always show relationship context in results
- Offer next steps: After presenting results, suggest how to explore further
/docs/TOOL_DESCRIPTION_AUDIT.md- Detailed audit of all tool descriptions/docs/planning/WORKPLAN.md- Phase 2.C implementation details/docs/PRODUCT_ROADMAP.md- "Claude as Semantic Layer" architecture/README.md- User-facing tool documentation
Last Updated: December 1, 2025 Version: 1.0 (Phase 2.C completion) Next Review: After Phase 2.D completion (multi-term search)