Memory Integration Guide

This guide covers the advanced Memory MCP integration for the Remind Tools project, enabling intelligent context persistence and retrieval across development sessions.

Overview

The Memory MCP integration creates a sophisticated knowledge graph that captures and maintains:
  • Project Context: Architecture decisions, patterns, and technical knowledge
  • Team Intelligence: Member preferences, expertise, and collaboration patterns
  • Development History: Solutions, debugging insights, and implementation patterns
  • Workflow Optimization: Process improvements and automation opportunities

Architecture

Memory Contexts

The system uses three specialized memory contexts:

Core Memory (remind_tools_core.json)

  • Project architecture and design patterns
  • Technical decisions and their rationale
  • Implementation standards and conventions
  • Integration patterns and dependencies

Team Memory (remind_tools_team.json)

  • Team member roles and expertise areas
  • Communication and collaboration preferences
  • Work patterns and productivity insights
  • Knowledge sharing and mentoring relationships

Architecture Memory (remind_tools_arch.json)

  • Architectural decision history and evolution
  • Pattern usage and effectiveness metrics
  • Refactoring insights and best practices
  • Performance optimization strategies

Knowledge Graph Structure

Entities

Each entity represents a key concept with:
  • Name: Unique identifier for the entity
  • Type: Category (Project, Architecture Pattern, Team Role, etc.)
  • Observations: Discrete facts and insights about the entity

Relations

Connections between entities using active voice:
  • follows, implements, uses, belongs_to
  • manages, oversees, performs, optimizes
  • builds, validates, requires, supports

Configuration

MCP Server Setup

Three memory server instances in .mcp.json:
{
  "memory": {
    "command": "npx",
    "args": ["-y", "@modelcontextprotocol/server-memory@latest"],
    "env": {
      "MEMORY_FILE_PATH": "/Users/.claude/memory/remind_tools_core.json"
    }
  },
  "memory-team": {
    "command": "npx", 
    "args": ["-y", "@modelcontextprotocol/server-memory@latest"],
    "env": {
      "MEMORY_FILE_PATH": "/Users/.claude/memory/remind_tools_team.json"
    }
  },
  "memory-arch": {
    "command": "npx",
    "args": ["-y", "@modelcontextprotocol/server-memory@latest"], 
    "env": {
      "MEMORY_FILE_PATH": "/Users/.claude/memory/remind_tools_arch.json"
    }
  }
}

Intelligent Hooks

Memory hooks in .claude/settings.json provide automatic context loading:

Pre-Tool Hooks

  • Task Start: Loads relevant project context for complex operations
  • Code Analysis: Retrieves architectural patterns and decisions
  • Branch Switch: Loads branch-specific context and patterns

Post-Tool Hooks

  • Task Completion: Suggests insight capture and pattern preservation
  • Architecture Analysis: Prompts for decision and pattern documentation
  • PR Creation: Captures development decisions and collaboration patterns

Memory Configuration

Advanced settings in .claude/memory-config.json:
{
  "contexts": {
    "core": {
      "description": "Core project architecture, patterns, and decisions",
      "server": "memory",
      "priority": "high",
      "autoLoad": ["project_start", "feature_start", "architecture_analysis"]
    }
  },
  "optimization": {
    "maxEntitiesPerContext": 1000,
    "consolidateAfterDays": 30,
    "archiveOldEntitiesAfterDays": 90,
    "maxObservationsPerEntity": 50
  }
}

Custom Commands

Memory Management Commands

/memory-context

Display current memory state and load relevant context:
/memory-context                    # Show all memory contexts
/memory-context core              # Show core project context
/memory-context architecture      # Show architectural patterns

/load-project-context

Load specific project areas from memory:
/load-project-context architecture             # Load architectural context
/load-project-context patterns current-feature # Load patterns for current work
/load-project-context decisions --branch=feature/payment # Load feature decisions

/save-insights

Capture key decisions and learnings:
/save-insights decision "Authentication Flow"    # Save architectural decision
/save-insights pattern "Error Handling"         # Save code pattern  
/save-insights solution "Performance Fix"       # Save solution approach

/team-preferences

Manage team member preferences and collaboration patterns:
/team-preferences show                           # Show all preferences
/team-preferences show "Senior Developer"       # Show member preferences
/team-preferences analyze collaboration         # Analyze team patterns

/architecture-memory

Access architectural decision history:
/architecture-memory show                        # Show current architecture
/architecture-memory history "Clean Architecture" # Show evolution
/architecture-memory analyze patterns           # Analyze pattern usage

Usage Patterns

Session Initialization

When starting work, the memory system automatically:
  1. Loads Team Context: Your preferences and work patterns
  2. Retrieves Project Context: Current architecture and decisions
  3. Identifies Active Context: Based on Git branch and recent changes
  4. Suggests Relevant Patterns: Historical solutions and approaches

Feature Development Workflow

# Start feature development
/gitflow-start-feature user-authentication

# Memory automatically loads:
# - Authentication patterns and decisions
# - Related security considerations  
# - Team preferences for auth implementation
# - Previous authentication solutions

# During development, capture insights:
/save-insights pattern "OAuth Implementation"
/save-insights decision "JWT Token Strategy"

# Complete feature with memory persistence
/gitflow-finish-feature "Add OAuth authentication"

Architecture Decision Process

# Analyze current architectural state
/architecture-memory show

# Load relevant architectural context
/load-project-context architecture Clean Architecture

# Document new architectural decision
/save-insights decision "State Management Approach" --context=architecture

# Update architectural memory with insights
/architecture-memory evolve --timeline

Memory Optimization

Automatic Optimization

The system performs intelligent optimization:
  • Consolidation: Merges similar observations into refined insights
  • Archival: Moves stale information to archive while preserving key decisions
  • Relationship Optimization: Removes duplicate relations and improves connections
  • Performance Monitoring: Tracks memory system effectiveness

Manual Optimization

Run optimization scripts as needed:
# Full memory maintenance
.claude/scripts/memory-maintenance.sh

# Individual operations
.claude/scripts/memory-maintenance.sh backup    # Create backup
.claude/scripts/memory-maintenance.sh health    # Check health
.claude/scripts/memory-maintenance.sh optimize  # Run optimization

Memory Health Monitoring

Regular health checks assess:
  • Entity Count: Ensures contexts don’t become oversized
  • Relationship Integrity: Validates connection consistency
  • Observation Quality: Identifies consolidation opportunities
  • Performance Impact: Monitors system response times

Best Practices

Context Capture

Do Capture:
  • Architectural decisions with rationale
  • Successful patterns and their use cases
  • Problem-solution pairs with context
  • Team collaboration insights
  • Performance optimization discoveries
Avoid Capturing:
  • Temporary debugging information
  • Implementation details without broader relevance
  • Personal preferences that don’t affect team collaboration
  • Duplicate information across contexts

Memory Hygiene

  1. Regular Review: Periodically review and consolidate observations
  2. Pattern Recognition: Identify recurring themes for pattern creation
  3. Relationship Maintenance: Keep entity relationships current and relevant
  4. Context Boundaries: Maintain clear separation between memory contexts

Team Collaboration

  • Share Insights: Use memory to share successful approaches across team
  • Document Decisions: Capture rationale for future team members
  • Pattern Evolution: Track how team practices improve over time
  • Knowledge Transfer: Leverage memory for onboarding and mentoring

Integration with Git Flow

Branch-Specific Context

Memory integration with Git Flow provides:
  • Feature Branch Memory: Loads context specific to feature development
  • Release Branch Context: Focuses on stability and quality considerations
  • Hotfix Memory: Provides rapid access to debugging and fix patterns
  • Integration History: Tracks merge patterns and conflict resolution

Workflow Enhancement

# Feature development with memory
/gitflow-start-feature payment-processing
# → Automatically loads payment-related patterns and decisions

# Release preparation with memory  
/gitflow-start-release 1.2.0
# → Loads release checklist and quality gate patterns

# Emergency response with memory
/gitflow-hotfix "Database timeout issue"
# → Provides immediate access to database troubleshooting patterns

Performance Considerations

Memory Loading Optimization

  • Selective Loading: Only loads relevant context based on current activity
  • Lazy Evaluation: Defers loading of detailed information until needed
  • Caching Strategy: Maintains frequently accessed information in memory
  • Background Updates: Updates memory during idle time

Storage Efficiency

  • Compression: Uses efficient JSON storage with compression
  • Deduplication: Prevents storage of duplicate information
  • Archival Strategy: Moves old information to compressed archives
  • Size Monitoring: Tracks and alerts on memory growth

Troubleshooting

Common Issues

Memory Not Loading:
  • Verify MCP server configuration in .mcp.json
  • Check file permissions for memory directory
  • Ensure memory files are valid JSON
Performance Issues:
  • Run memory optimization: .claude/scripts/memory-maintenance.sh optimize
  • Check memory file sizes and entity counts
  • Review recent memory growth patterns
Context Missing:
  • Verify entity names and relationships
  • Check memory file integrity with health command
  • Review memory hooks configuration

Recovery Procedures

Corrupted Memory Files:
  1. Restore from backup: .claude/scripts/memory-maintenance.sh backup
  2. Validate restored files with health check
  3. Re-run optimization if needed
Performance Degradation:
  1. Run full maintenance: .claude/scripts/memory-maintenance.sh full
  2. Review memory statistics and recommendations
  3. Consider archiving old information

Advanced Features

Memory Analytics

Track memory system effectiveness:
  • Usage Patterns: Identify most accessed entities and relationships
  • Decision Impact: Measure effectiveness of captured decisions
  • Team Learning: Track knowledge growth and sharing patterns
  • Productivity Metrics: Correlate memory usage with development velocity

Custom Memory Extensions

Extend memory functionality:
  • Domain-Specific Entities: Add specialized entity types for your domain
  • Custom Relationships: Define domain-specific relationship types
  • Automated Capture: Implement automated insight capture from code changes
  • Integration Hooks: Connect memory with external tools and services

Future Enhancements

Planned improvements:
  • Semantic Search: Enhanced search capabilities across memory contexts
  • Predictive Loading: AI-powered context prediction and preloading
  • Cross-Project Memory: Shared memory across related projects
  • Visual Memory Maps: Interactive visualization of knowledge graphs
This memory integration transforms Claude Code into an intelligent development companion that learns from your team’s experiences and continuously improves development efficiency.