Skip to content

Advanced Memory System

Note: This document describes features that are currently in the roadmap but not yet implemented. For the current memory system, see Memory System Guide. For our future vision, see Advanced Memory Roadmap.

Orchestre's planned advanced memory system will extend beyond traditional documentation with AI-powered memory that includes semantic search, knowledge graphs, and intelligent consolidation.

Overview

The advanced memory system provides:

  • Semantic Memory: Vector-based storage with embeddings for intelligent retrieval
  • Knowledge Graphs: GraphRAG-inspired relationship mapping
  • Memory Consolidation: Automatic merging and hierarchical organization
  • Multi-Tier Storage: Working, episodic, semantic, and procedural memory types

Architecture

Memory Hierarchy

Storage Structure

Memory Commands

/remember - Store Insights

Captures and stores important learnings with automatic categorization:

bash
/remember

# Automatically:
# - Analyzes recent conversation
# - Extracts key insights
# - Generates embeddings
# - Builds graph relationships
# - Stores with appropriate type

Example Output:

json
{
  "stored": {
    "id": "semantic_1234567890_abc",
    "type": "semantic",
    "content": "React Server Components reduce bundle size by rendering on server",
    "importance": 8,
    "relationships": ["React", "Performance", "SSR"]
  },
  "graphElements": {
    "nodes": 3,
    "edges": 2
  }
}

/recall - Retrieve Context

Semantic search across all memory types:

bash
/recall authentication patterns

# Returns:
# - Semantically similar memories
# - Related graph nodes
# - Community summaries
# - Synthesized context

Example Output:

Found 5 relevant memories:

1. [Semantic] JWT implementation with refresh tokens
   - Importance: 9/10
   - Last accessed: 2 days ago
   - Related: Security, Tokens, Middleware

2. [Procedural] Authentication middleware pattern
   - Steps: Token validation → User lookup → Context injection
   - Used in: 12 files

3. [Episodic] Resolved token refresh race condition
   - Problem: Parallel requests causing multiple refreshes
   - Solution: Request coalescing in middleware

Graph Context:
- Central node: "Authentication System"
- Connected concepts: JWT, Security, Middleware, User Management
- Community: "Security & Access Control" (24 nodes)

Synthesis: Your authentication system uses JWT with refresh tokens, 
implemented through middleware that handles validation and race conditions...

/consolidate - Optimize Memory

Merges similar memories and generates summaries:

bash
/consolidate

# Options:
# - aggressive: Lower similarity threshold (0.7)
# - conservative: Higher threshold (0.9)
# - prune: Remove low-value memories
# - rebuild: Regenerate all summaries

Example Process:

Analyzing 1,247 memories...

Consolidation Plan:
- Similar memories found: 187 pairs
- Proposed merges: 142
- Hierarchical summaries: 12
- Memories to prune: 89

Results:
- Before: 1,247 memories
- After: 892 memories (28% reduction)
- Performance improvement: 35% faster retrieval
- New community summaries: 8

/graph-memory - Explore Knowledge

Visualizes and navigates the knowledge graph:

bash
/graph-memory authentication

# Shows:
# - Node relationships
# - Path finding
# - Community detection
# - Centrality analysis

Example Visualization:

/forget - Remove Memories

Selective memory removal with safety checks:

bash
/forget "outdated API patterns" --before 2024-01-01

# Safety features:
# - Dependency checking
# - Impact analysis
# - Preservation options
# - Temporary archival

Memory Types Explained

Semantic Memory

What: Facts, concepts, and general knowledge When stored: Learning new concepts, understanding systems Example: "PostgreSQL supports JSONB for document storage"

Episodic Memory

What: Specific experiences and problem-solving sessions When stored: After debugging, implementing features, solving challenges Example: "Fixed memory leak by implementing proper cleanup in useEffect"

Procedural Memory

What: Patterns, workflows, and how-to knowledge When stored: Discovering reusable patterns, establishing workflows Example: "Deploy process: Test → Build → Stage → Canary → Production"

Working Memory

What: Current context and active information When stored: During active sessions Example: "Currently refactoring authentication to use Passport.js"

Knowledge Graph Features

Entity Extraction

Automatically identifies and extracts:

  • Concepts: Abstract ideas (e.g., "Authentication", "Caching")
  • Entities: Concrete items (e.g., "UserModel", "JWT")
  • Patterns: Reusable solutions (e.g., "Middleware Pattern")
  • Relationships: How entities connect

Relationship Types

  • implements: Concrete implementation of concept
  • uses: Dependency relationship
  • part-of: Hierarchical relationship
  • related-to: General association
  • conflicts-with: Incompatible approaches

Community Detection

Groups related concepts into communities:

Community: "Data Layer" (31 nodes)
- Central concepts: Database, ORM, Caching
- Key relationships: 47 edges
- Importance: 9/10
- Summary: "Handles data persistence, caching, and access patterns"

How It Works

  1. Query Embedding: Converts search query to vector
  2. Similarity Calculation: Cosine similarity against stored embeddings
  3. Relevance Ranking: Combines similarity, importance, and recency
  4. Context Building: Includes related memories and graph context

Search Examples

bash
# Conceptual search
/recall "how to handle errors"
# Finds: Error boundaries, try-catch patterns, logging strategies

# Problem-specific search
/recall "performance optimization React"
# Finds: Memoization, lazy loading, bundle splitting

# Pattern search
/recall "middleware patterns"
# Finds: Auth middleware, error middleware, logging middleware

Memory Consolidation

Strategies

Merge Consolidation

Combines highly similar memories:

Memory 1: "Use React.memo for performance"
Memory 2: "React.memo prevents re-renders"
→ Merged: "React.memo prevents unnecessary re-renders for performance optimization"

Hierarchical Consolidation

Creates summary levels:

Level 1: Individual optimization techniques
Level 2: Performance optimization strategies
Level 3: Overall application performance approach

Temporal Consolidation

Preserves learning evolution:

Day 1: "Basic error handling with try-catch"
Week 1: "Added error boundaries for React"
Month 1: "Comprehensive error system with monitoring"

Integration with Development

Automatic Memory Creation

Memory is created during:

  • Problem Solving: Captures solutions and approaches
  • Pattern Recognition: Identifies reusable patterns
  • Decision Making: Records architectural choices
  • Learning Moments: Stores new discoveries

Context Enhancement

Retrieved memories automatically enhance:

  • Code Generation: Applies learned patterns
  • Problem Solving: Suggests proven solutions
  • Decision Making: Provides historical context
  • Code Review: Checks against known patterns

Best Practices

Effective Memory Storage

  1. Be Specific: Detailed memories are more useful
bash
# Good
"PostgreSQL row-level security policies filter data at database level"

# Poor
"Database has security"
  1. Include Context: Why and when matters
bash
# Good
"Switched to Redis for session storage due to horizontal scaling needs"

# Poor
"Using Redis for sessions"
  1. Capture Gotchas: Document what surprised you
bash
# Good
"Array.sort() mutates original array - use [...arr].sort() for immutable"

# Poor
"JavaScript array sorting"

Memory Maintenance

  1. Regular Consolidation: Run monthly for active projects
  2. Prune Thoughtfully: Keep high-value memories even if old
  3. Update Relationships: Graph connections evolve
  4. Review Summaries: Ensure community summaries stay relevant

Team Collaboration

  1. Share Insights: Important discoveries benefit everyone
  2. Document Patterns: Reusable solutions save time
  3. Record Decisions: Context prevents repeated discussions
  4. Learn Together: Team memory is more valuable than individual

Advanced Features

Multi-Hop Reasoning

Discover indirect relationships:

Payment Gateway ← → Stripe API ← → Webhooks ← → Event Queue

Memory Chains

Build on previous memories:

1. "Learned about React hooks"
2. "Discovered custom hooks pattern"
3. "Built reusable data fetching hooks"
4. "Established hooks testing strategy"

Cross-Domain Insights

Connect concepts across domains:

Frontend Performance ← → API Design ← → Database Queries

Performance Optimization

Embedding Efficiency

  • Uses OpenAI's text-embedding-3-small model
  • Cached embeddings prevent recomputation
  • Indexed for fast similarity search

Graph Optimization

  • Communities reduce traversal complexity
  • Hierarchical summaries speed comprehension
  • Pruning maintains performance

Retrieval Speed

  • Semantic search: <100ms for 10k memories
  • Graph traversal: O(log n) with indexing
  • Consolidation: Background process

Future Capabilities

Planned Enhancements

  1. Automatic Pattern Learning: Identify patterns without explicit storage
  2. Cross-Project Memory: Learn from all your projects
  3. Team Intelligence: Aggregate team knowledge
  4. Predictive Suggestions: Anticipate needs based on context
  5. Memory Versioning: Track how understanding evolves

Research Integration

  • MemGPT Patterns: OS-inspired memory management
  • GraphRAG Advances: Better knowledge extraction
  • Vector DB Optimization: Improved storage and retrieval
  • Cognitive Architectures: Human-like memory systems

Conclusion

Orchestre's advanced memory system transforms AI assistance from stateless interactions to an evolving, learning partnership. By combining vector embeddings, knowledge graphs, and intelligent consolidation, it provides context-aware assistance that improves over time.

The system works best when you:

  • Store insights as you discover them
  • Regularly consolidate and optimize
  • Explore knowledge relationships
  • Trust the semantic search

Your AI assistant doesn't just help—it learns and grows with your project.

Built with ❤️ for the AI Coding community, by Praney Behl