Knowledge memory is the primary storage system for factual information, technical concepts, and domain-specific knowledge in Cipher. It automatically extracts and stores programming knowledge, code patterns, and implementation details from conversations, making them available for future reference through semantic search.

Configuration

Required Environment Variables

# OpenAI API Key (Required for embeddings)
OPENAI_API_KEY=sk-proj-your-openai-key-here

# Vector Store Type (Required)
VECTOR_STORE_TYPE=qdrant  # qdrant, milvus, in-memory

Vector Storage Configuration

Qdrant Configuration

# Connection Options (choose one)
VECTOR_STORE_URL=http://localhost:6333           # Complete URL
# OR
VECTOR_STORE_HOST=localhost                      # Host + Port
VECTOR_STORE_PORT=6333

# Optional Settings
VECTOR_STORE_API_KEY=your-qdrant-api-key        # For Qdrant Cloud
VECTOR_STORE_COLLECTION=knowledge_memory         # Collection name
VECTOR_STORE_DIMENSION=1536                     # Embedding dimensions
VECTOR_STORE_DISTANCE=Cosine                    # Distance metric
VECTOR_STORE_ON_DISK=false                      # Store vectors on disk

Milvus Configuration

# Connection Options (choose one)
VECTOR_STORE_URL=http://localhost:19530          # Complete URL
# OR
VECTOR_STORE_HOST=localhost                      # Host + Port
VECTOR_STORE_PORT=19530

# Authentication (Zilliz Cloud)
VECTOR_STORE_USERNAME=your-username              # Optional
VECTOR_STORE_PASSWORD=your-password              # Optional
VECTOR_STORE_API_KEY=your-api-token             # Optional

# Collection Settings
VECTOR_STORE_COLLECTION=knowledge_memory         # Collection name
VECTOR_STORE_DIMENSION=1536                     # Embedding dimensions

Development Configuration

# In-Memory (Development/Testing)
VECTOR_STORE_TYPE=in-memory
VECTOR_STORE_COLLECTION=knowledge_memory
VECTOR_STORE_DIMENSION=1536
VECTOR_STORE_MAX_VECTORS=10000                  # Memory limit

Knowledge Memory Tools

Cipher provides two main tools for knowledge memory management:

Extract & Operate Memory Tool

cipher_extract_and_operate_memory This tool automatically processes conversations and determines what knowledge should be stored, updated, or removed. It uses intelligent content analysis and LLM-powered decision making to extract meaningful programming knowledge while avoiding redundant or low-quality information. Key Features:
  • Automatic knowledge extraction from conversations
  • Intelligent similarity detection to prevent duplicates
  • LLM-powered decision making for memory operations (ADD/UPDATE/DELETE)
  • Rich metadata tagging and categorization
  • Code pattern recognition and preservation

Memory Search Tool

cipher_search_memory This tool performs semantic search over the stored knowledge base to retrieve relevant information based on natural language queries. It uses vector similarity search to find the most contextually relevant knowledge for any given question or topic. Key Features:
  • Natural language query processing
  • Semantic similarity search using embeddings
  • Configurable result filtering and ranking
  • Detailed metadata and confidence scoring
  • Fast retrieval with similarity thresholds

Advanced Features

Intelligent Content Filtering

Knowledge memory automatically filters content to focus on significant programming knowledge:
  • Technical Patterns: Identifies code blocks, commands, and implementation details
  • Programming Concepts: Extracts algorithms, design patterns, and best practices
  • Domain Knowledge: Captures project-specific information and configurations
  • Quality Assessment: Evaluates content relevance and completeness

LLM-Powered Decision Making

When enabled, the system uses LLM analysis to make intelligent memory operation decisions:
  • Similarity Analysis: Compares new content with existing memories
  • Content Enhancement: Identifies improved or corrected versions
  • Contradiction Detection: Finds conflicting information requiring updates
  • Deduplication: Prevents redundant memory entries

Automatic Tagging

Extracts technical tags from content for improved organization:
// Example extracted tags
["react", "component", "hooks", "typescript", "frontend", "api", "async"]

Code Pattern Extraction

Automatically identifies and preserves code patterns:
code_pattern: "const useAsync = (asyncFunction) => { /* implementation */ }"

Examples

Best Practices

Configuration

  • Set similarity threshold to 0.8+ for high-quality knowledge extraction
  • Use maxSimilarResults: 3-5 to prevent information overload
  • Enable useLLMDecisions: true for better ADD/UPDATE/DELETE decisions

Search Strategies

  • Query with context: “React async patterns” vs just “async”
  • Set top_k: 3-7 for focused results, top_k: 10+ for exploration
  • Use similarity_threshold: 0.4+ to filter noise

Memory Management

  • Review UPDATE operations - cipher may merge similar knowledge incorrectly
  • Monitor confidence scores - items below 0.6 may need manual review
  • Use enableDeleteOperations: false initially to prevent data loss
  • Enable debug logging - set CIPHER_LOG_LEVEL=debug to see detailed logs for cipher_extract_and_operate_memory (not visible at info level)
Knowledge memory transforms conversations into a persistent, searchable knowledge base that continuously improves the agent’s understanding and capabilities.