System Prompt Management

Cipher provides a sophisticated system prompt management feature that allows you to dynamically compose system prompts from multiple sources using configurable providers. This modular approach enables flexible, maintainable, and context-aware prompt generation.

How It Works

The system prompt management feature uses a plugin-based architecture with three types of providers:
  • Static Providers: Deliver fixed content that doesn’t change
  • Dynamic Providers: Generate content at runtime based on context
  • File-based Providers: Load content from external files with optional summarization
Each provider has a priority level that determines the order in which content is assembled into the final system prompt. This allows you to create layered prompts where foundational instructions come first, followed by context-specific guidance and dynamic content.

Benefits

  • Modularity: Break complex prompts into manageable, reusable components
  • Flexibility: Mix static instructions with dynamic, context-aware content
  • Scalability: Add or remove providers without affecting existing functionality

Provider Architecture

The architecture ensures high performance through caching, lazy loading, and efficient content generation while maintaining flexibility for complex prompt composition scenarios.

Provider Types

Static Provider

Static providers deliver fixed content that remains constant across all interactions. Perfect for core instructions, disclaimers, or fundamental behavioral guidelines. Configuration:
- name: built-in-memory-search
  type: static
  priority: 100
  enabled: true
  config:
    content: |
      Use the memory search tool to retrieve facts, code, or context from previous interactions. Always search memory before answering if relevant.
Real Examples from Cipher:
  • built-in-memory-search: Instructions for using memory retrieval tools
  • built-in-reasoning-patterns: Guidelines for applying problem-solving strategies
  • built-in-knowledge-graph: Instructions for managing entities and concepts
  • built-in-efficiency-guidelines: Performance and efficiency best practices
  • built-in-automatic-tools: Information about background automated processes

Dynamic Provider

Dynamic providers generate content at runtime using registered generator functions. They can access conversation context, user data, and system state to produce relevant, personalized content. Configuration:
- name: summary
  type: dynamic
  priority: 50
  enabled: true
  config:
    generator: summary
    history: all  # or N for most recent N messages
Real Examples from Cipher:
  • summary: Generates conversation summaries from message history
  • rules: Extracts and applies relevant rules from past interactions
  • error-detection: Identifies patterns and common errors from conversation history

File-based Provider

File-based providers load content from external files, with support for template variables, file watching, and optional LLM-powered summarization for large documents. Configuration:
- name: project-guidelines
  type: file-based
  priority: 40
  enabled: true
  config:
    filePath: ./memAgent/project-guidelines.md
    summarize: false
Configuration Options:
  • filePath: Path to the source file (relative or absolute)
  • summarize: Whether to use LLM to summarize large files (true/false)
  • watchForChanges: Monitor file for updates and reload automatically
  • variables: Template variables for dynamic content replacement
Use Cases:
  • Project-specific guidelines and standards
  • External documentation integration
  • Large instruction sets with summarization
  • Version-controlled prompt content

Configuration File Format

Cipher uses YAML configuration files to define system prompt providers. Here’s the complete structure from cipher-advanced-prompt.yml:
# System Prompt Providers Configuration
providers:
  # Static providers - loaded at startup with fixed content
  - name: built-in-memory-search
    type: static
    priority: 100
    enabled: true
    config:
      content: |
        Use the memory search tool to retrieve facts, code, or context from previous interactions.

  - name: built-in-reasoning-patterns  
    type: static
    priority: 90
    enabled: true
    config:
      content: |
        Use the reasoning patterns tool to find and apply problem-solving strategies.

  # Dynamic providers - LLM-driven, not loaded at startup
  - name: summary
    type: dynamic
    priority: 50
    enabled: true
    config:
      generator: summary
      history: all  # or N for most recent N messages

  - name: rules
    type: dynamic  
    priority: 49
    enabled: true
    config:
      generator: rules
      history: all

  # File-based providers
  - name: project-guidelines
    type: file-based
    priority: 40
    enabled: true
    config:
      filePath: ./memAgent/project-guidelines.md
      summarize: false

# Global settings
settings:
  maxGenerationTime: 10000
  failOnProviderError: false
  contentSeparator: "\n\n---\n\n"

Settings Explained

  • maxGenerationTime: Maximum time in milliseconds for prompt generation
  • failOnProviderError: Whether to fail completely if any provider errors
  • contentSeparator: String used to separate content from different providers

Command Reference

List Active Providers

/prompt-providers list

Show All Providers

/prompt-providers show-all

Add Dynamic Provider

/prompt-providers add-dynamic summary --history all

Add File-based Provider

/prompt-providers add-file project-guidelines --summarize false

Remove Provider

/prompt-providers remove summary

Update Provider Configuration

/prompt-providers update project-guidelines --summarize true

Enable/Disable Providers

/prompt-providers enable error-detection
/prompt-providers disable built-in-automatic-tools

View Current System Prompt

/prompt

View Prompt Statistics

/prompt-stats