Skip to main content

Crate codive_prompts

Crate codive_prompts 

Source
Expand description

Prompt management system for AI coding agent

This crate provides:

  • Model-specific system prompts (Claude, GPT, Gemini)
  • Embedded defaults with runtime file-based overrides
  • Layered prompt composition
  • External tool descriptions

§Quick Start

use codive_prompts::{PromptStore, PromptComposer, ProviderFamily};

// Create store with embedded defaults
let store = PromptStore::new();

// Compose a prompt for a specific model
let prompt = PromptComposer::new(&store)
    .with_base()
    .with_provider_auto("claude-3-sonnet")
    .with_current_environment()
    .compose();

§File-Based Overrides

Prompts can be overridden at runtime by placing files in a config directory:

~/.config/agent/prompts/
├── base.txt              # Override base prompt
├── verification.txt      # Override verification
├── providers/
│   ├── anthropic.txt     # Override Claude prompt
│   ├── openai.txt        # Override GPT prompt
│   └── gemini.txt        # Override Gemini prompt
└── tools/
    ├── bash.txt          # Override bash description
    └── read_file.txt     # Override read_file description

Load with overrides:

ⓘ
use codive_prompts::PromptStore;
use std::path::Path;

let store = PromptStore::new()
    .with_overrides_dir(Path::new("~/.config/agent/prompts"))
    .expect("Failed to load overrides");

Structs§

EmbeddedPrompts
Embedded prompts compiled into the binary
EnvironmentContext
Runtime environment context
PromptComposer
Builder for composing prompts from multiple layers
PromptStore
Stores prompts with support for file-based overrides

Enums§

LoaderError
ProviderFamily
Identifies the LLM provider/model family for prompt selection

Functions§

compose_standard
Quick helper to compose a standard prompt
default_overrides_dir
Get the default prompt overrides directory