Memory System Overview

Cipher’s memory system is a sophisticated, multi-layered architecture that enables AI agents to maintain persistent knowledge, learn from interactions, and continuously improve their reasoning capabilities. Unlike traditional stateless AI systems, cipher provides a comprehensive memory runtime that transforms single-pass interactions into intelligent, stateful conversations.

Storage Architecture

Cipher implements a four-layer storage architecture designed for different data types and access patterns:
  1. Cache Backend: Fast, ephemeral storage for temporary data and caching
  2. Database Backend: Persistent, reliable storage for long-term data
  3. Vector Storage: High-dimensional vector storage for semantic search
  4. Knowledge Graph: Graph database for entity relationships

Cache Backend

The cache backend provides fast, ephemeral storage for session data, temporary caches, and frequently accessed information. This layer prioritizes speed over persistence. Options:
  • Redis (Production): Distributed, high-performance cache with persistence options
  • In-Memory (Development): Simple local storage for testing and development
Use Cases:
  • Session state management
  • Temporary conversation context
  • Fast lookups and caching
  • Performance optimization
Configuration:
# Cache Backend Configuration
STORAGE_CACHE_TYPE=redis              # redis, in-memory
STORAGE_CACHE_HOST=localhost          # Redis server hostname
STORAGE_CACHE_PORT=6379               # Redis server port
STORAGE_CACHE_PASSWORD=               # Redis authentication (optional)
STORAGE_CACHE_DATABASE=0              # Redis database number (0-15)

Database Backend

The database backend provides persistent, reliable storage for long-term data that must survive system restarts and maintain ACID properties. Options:
  • PostgreSQL (Production): Full-featured relational database with advanced features
  • SQLite (Development): Lightweight, file-based database for single-user applications
  • In-Memory (Testing): Temporary storage for testing scenarios
Use Cases:
  • Memory operation history and audit trails
  • User data and preferences
  • Configuration persistence
  • Long-term analytics and reporting
Configuration:
# Database Backend Configuration
STORAGE_DATABASE_TYPE=sqlite          # sqlite, postgresql, in-memory
STORAGE_DATABASE_PATH=./data          # Directory path for SQLite
STORAGE_DATABASE_NAME=cipher.db       # Database filename

Memory Architecture

Built on top of these storage layers, Cipher implements a three-component memory system that provides intelligent knowledge management and continuous learning capabilities:

Knowledge Memory

Knowledge memory stores factual information, technical concepts, and domain-specific knowledge extracted from conversations. It uses vector embeddings to enable semantic search and retrieval. Content Types:
  • Technical concepts and programming patterns
  • Code snippets and implementation details
  • Domain knowledge and project context
  • Best practices and optimization techniques
Overview: Storage: Vector embeddings in dedicated collections (Qdrant, Milvus, or in-memory)

Reflection Memory

Reflection memory captures the agent’s reasoning processes and decision-making patterns, enabling continuous learning and improvement through pattern recognition. Content Types:
  • Step-by-step reasoning traces
  • Decision-making processes and logic
  • Pattern recognition and effectiveness metrics
  • Learning experiences and quality evaluations
Overview: Storage: Separate vector collection optimized for reasoning pattern analysis

Knowledge Graph

Knowledge graph provides advanced relationship modeling between entities, enabling complex queries and deep understanding of connections within the knowledge base. Content Types:
  • Entity relationships and connections
  • Hierarchical knowledge structures
  • Cross-domain knowledge mapping
  • Complex query patterns
Overview: Storage: Graph database (Neo4j or in-memory) for relationship modeling

Vector Storage Configuration

Both knowledge and reflection memory utilize vector storage for semantic search capabilities:
# Vector Store Configuration
VECTOR_STORE_TYPE=qdrant                   # qdrant, milvus, in-memory
VECTOR_STORE_HOST=localhost                # Vector database hostname
VECTOR_STORE_PORT=6333                     # Vector database port
VECTOR_STORE_COLLECTION=knowledge_memory   # Knowledge collection name
VECTOR_STORE_DIMENSION=1536                # Embedding dimensions

# Reflection Memory Configuration
REFLECTION_VECTOR_STORE_COLLECTION=reflection_memory  # Reflection collection
DISABLE_REFLECTION_MEMORY=false            # Enable/disable reflection memory

# Memory Search Configuration
SEARCH_MEMORY_TYPE=both                    # knowledge, reflection, both

Knowledge Graph Configuration

Knowledge graph functionality provides advanced relationship modeling:
# Knowledge Graph Configuration
KNOWLEDGE_GRAPH_ENABLED=true              # Enable knowledge graph features
KNOWLEDGE_GRAPH_TYPE=neo4j                # neo4j, in-memory
KNOWLEDGE_GRAPH_HOST=localhost            # Neo4j hostname
KNOWLEDGE_GRAPH_PORT=7687                 # Neo4j bolt port
KNOWLEDGE_GRAPH_USERNAME=neo4j            # Neo4j username
KNOWLEDGE_GRAPH_PASSWORD=                 # Neo4j password (required)

Memory Tools

Cipher provides internal tools for memory operations across all three memory components:

Knowledge Memory Tools

  • cipher_extract_and_operate_memory: Extract and manage knowledge entries
  • cipher_memory_search: Search stored knowledge using semantic queries

Reflection Memory Tools

  • cipher_store_reasoning_memory: Store reasoning patterns and evaluations
  • cipher_extract_reasoning_steps: Extract reasoning traces from conversations
  • cipher_evaluate_reasoning: Evaluate reasoning quality and effectiveness
  • cipher_search_reasoning_patterns: Search for similar reasoning patterns

Knowledge Graph Tools

  • cipher_add_node: Add nodes to the knowledge graph with labels and properties
  • cipher_add_edge: Create relationships between nodes in the knowledge graph
  • cipher_search_graph: Search for nodes and edges with filtering capabilities
  • cipher_get_neighbors: Get neighboring nodes and their relationships
  • cipher_extract_entities: Extract entities from text and add to knowledge graph
  • cipher_update_node: Update existing node properties and labels
  • cipher_delete_node: Remove nodes and their relationships from the graph
  • cipher_query_graph: Execute custom queries against the knowledge graph
  • cipher_enhanced_search: Advanced search with semantic and fuzzy matching
  • cipher_intelligent_processor: Process natural language to manage entities automatically
  • cipher_relationship_manager: Intelligently manage complex relationship operations

Memory System Benefits

Persistent Intelligence

  • Cross-Session Knowledge: Information persists across conversations and sessions
  • Contextual Understanding: Build comprehensive domain and project knowledge
  • Continuous Learning: Improve through pattern recognition and quality evaluation

Advanced Capabilities

  • Semantic Search: Natural language queries across stored knowledge
  • Pattern Recognition: Identify and reuse successful reasoning approaches
  • Relationship Modeling: Understand complex connections between concepts
  • Quality Assurance: Automated evaluation and improvement of memory content

Next Steps

Explore the detailed capabilities of each memory component: The memory system transforms cipher from a simple conversation tool into a sophisticated AI agent with persistent intelligence, continuous learning capabilities, and comprehensive knowledge management.