claude-configs/skills/memorygraph/SKILL.md
Cal Corum 8a1d15911f Initial commit: Claude Code configuration backup
Version control Claude Code configuration including:
- Global instructions (CLAUDE.md)
- User settings (settings.json)
- Custom agents (architect, designer, engineer, etc.)
- Custom skills (create-skill templates and workflows)

Excludes session data, secrets, cache, and temporary files per .gitignore.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-02-03 16:34:21 -06:00

7.3 KiB

name description
memorygraph Graph-based memory system for AI-assisted pattern recall, solution matching, and knowledge relationships. USE WHEN storing learnings, recalling past solutions, linking problems to fixes, tracking decisions, or building knowledge connections across sessions.

MemoryGraph - AI Memory Mind Map

Purpose

MemoryGraph provides persistent, graph-based memory for pattern recognition and solution recall. While NoteDiscovery handles long-form knowledge articles, MemoryGraph creates a web of interconnected memories optimized for AI retrieval.

Use MemoryGraph for:

  • Quick learnings and solutions (not full articles)
  • Problem/solution pairs with relationships
  • Decisions and their rationale
  • Patterns that should be recalled automatically
  • Cross-session knowledge accumulation

Use NoteDiscovery for:

  • Detailed documentation and guides
  • Reference material for humans
  • Structured knowledge articles
  • Searchable documentation

When to Activate This Skill

Explicit triggers:

  • "Remember this for later"
  • "Store this solution"
  • "What did we learn about X?"
  • "Find solutions for this problem"
  • "Link this to that issue"
  • "What causes this error?"
  • "Show me related memories"

Automatic triggers (per CLAUDE.md Memory Protocol):

  • After fixing a bug
  • After a git commit
  • After making an architecture decision
  • After discovering a reusable pattern
  • After a successful configuration
  • After troubleshooting sessions

Quick Reference

CLI Commands

# Store a memory
python client.py store --type solution --title "Fixed X" --content "Details..." --tags "tag1,tag2" --importance 0.8

# Recall memories (natural language search)
python client.py recall "timeout error redis"

# Get specific memory
python client.py get <memory_id>

# Create relationship
python client.py relate <from_id> <to_id> SOLVES --context "How it solves"

# Search with filters
python client.py search --query "authentication" --types "solution,fix" --tags "python"

# Update memory
python client.py update <memory_id> --title "New title" --importance 0.9

# Delete memory
python client.py delete <memory_id> --force

# Get related memories
python client.py related <memory_id> --types "SOLVES,CAUSES" --depth 2

# Statistics
python client.py stats

# Recent activity
python client.py recent --days 7

Memory Types

Type When to Use
solution Fix or resolution to a problem
problem Issue or challenge encountered
error Specific error message or condition
fix Code-level patch or correction
decision Architectural or design choice
code_pattern Reusable code pattern
configuration Config that worked
workflow Process or sequence
general Catch-all for other learnings

Relationship Types

Solution relationships:

  • SOLVES - Solution fixes a problem
  • FIXES - Fix addresses an error
  • ADDRESSES - General resolution
  • IMPROVES - Enhancement over previous

Causal relationships:

  • CAUSES - A causes B
  • TRIGGERS - A triggers B
  • PREVENTS - A prevents B

Dependency relationships:

  • REQUIRES - A needs B
  • DEPENDS_ON - A depends on B
  • BUILDS_ON - A extends B

Association:

  • RELATED_TO - General association

Importance Scale

Score Meaning
0.8-1.0 Critical - affects multiple projects, prevents major issues
0.5-0.7 Standard - useful pattern or solution
0.3-0.4 Minor - nice-to-know, edge cases

Workflow Patterns

1. Store a Bug Fix

# Store the problem
python client.py store --type problem \
  --title "Redis connection timeouts in production" \
  --content "Connections timing out after 30s idle..." \
  --tags "redis,timeout,production" \
  --importance 0.7

# Store the solution
python client.py store --type solution \
  --title "Configure Redis keepalive and timeout" \
  --content "Added socket_keepalive=True and socket_timeout=300..." \
  --tags "redis,configuration" \
  --importance 0.8

# Link them
python client.py relate <solution_id> <problem_id> SOLVES \
  --context "Keepalive prevents idle disconnections"

2. Recall Before Starting Work

# Check what we know about a topic
python client.py recall "authentication oauth"

# Get recent activity
python client.py recent --days 7

# Find solutions for similar problems
python client.py search --types "solution" --tags "python,api"

3. Document a Decision

python client.py store --type decision \
  --title "Chose PostgreSQL over MongoDB" \
  --content "Rationale: Need ACID transactions, complex queries..." \
  --tags "database,architecture,decision" \
  --importance 0.9

4. Track Error Patterns

# Store error
python client.py store --type error \
  --title "ModuleNotFoundError: No module named 'xyz'" \
  --content "Occurs when running in venv without dependencies..." \
  --tags "python,venv,import" \
  --importance 0.5

# Store fix
python client.py store --type fix \
  --title "Reinstall dependencies in active venv" \
  --content "pip install -e . or pip install -r requirements.txt" \
  --tags "python,venv" \
  --importance 0.5

# Link
python client.py relate <fix_id> <error_id> FIXES

Python API Usage

from client import MemoryGraphClient

client = MemoryGraphClient()

# Store
memory_id = client.store_memory(
    type="solution",
    title="Redis timeout fix",
    content="Configure keepalive...",
    tags=["redis", "timeout"],
    importance=0.8
)

# Recall
memories = client.recall_memories("redis timeout", limit=5)

# Get with relationships
memory = client.get_memory(memory_id, include_relationships=True)

# Create relationship
rel_id = client.create_relationship(
    from_memory_id=solution_id,
    to_memory_id=problem_id,
    relationship_type="SOLVES",
    context="Fixes the timeout issue"
)

# Find related
related = client.get_related_memories(
    memory_id,
    relationship_types=["SOLVES", "CAUSES"],
    max_depth=2
)

# Stats
stats = client.get_memory_statistics()

Integration with NoteDiscovery

These tools complement each other:

Scenario Use
Quick bug fix MemoryGraph (store_memory type=fix)
Troubleshooting guide NoteDiscovery (detailed article)
Decision rationale MemoryGraph (type=decision)
Architecture documentation NoteDiscovery
Pattern discovered MemoryGraph (type=code_pattern)
Best practices guide NoteDiscovery
Error/solution pair MemoryGraph (with SOLVES relationship)

Workflow: After creating memories in MemoryGraph, consider if a fuller NoteDiscovery article would help. Link them conceptually via tags.

Database Location

  • SQLite Database: ~/.memorygraph/memory.db
  • Client: ~/.claude/skills/memorygraph/client.py
  • Schema: ~/.claude/skills/memorygraph/SCHEMA.md

Proactive Usage

This skill should be used proactively when:

  1. Bug fixed - Store problem + solution + SOLVES relationship
  2. Git commit made - Store summary of what was fixed/added
  3. Architecture decision - Store choice + rationale
  4. Pattern discovered - Store for future recall
  5. Configuration worked - Store what worked and why
  6. Troubleshooting complete - Store what was tried, what worked
  7. Session ending - Prompt: "Should I store today's learnings?"

Location: ~/.claude/skills/memorygraph/ Version: 1.0.0 Created: 2025-12-07