Skip to content

Commit ab52d78

Browse files
authored
feat(prompt-harness): centralize all system prompts (#531)
Add a new prompts module to cortex-prompt-harness that provides a single source of truth for all system prompts used throughout Cortex CLI. This improves visibility and maintainability of the prompt harness. ## New modules: - prompts/core.rs: Core agent prompts (main Cortex prompt, TUI prompt) - prompts/agents.rs: Built-in agent prompts (explore, general, research, etc.) - prompts/tasks.rs: Task-related prompts (summarization, compaction, titles) - prompts/review.rs: Code review prompts - prompts/tools.rs: Tool-specific prompts (subagent executor, mentions) - prompts/generation.rs: Agent generation prompts ## Key features: - All prompts are now documented with rustdoc comments - Helper functions for common operations (build_review_prompt, has_summary_output) - Type-safe review target enum for different review scenarios - Comprehensive tests for all prompt modules - Re-exports for commonly used prompts at module level
1 parent f2e496e commit ab52d78

File tree

8 files changed

+1850
-0
lines changed

8 files changed

+1850
-0
lines changed

cortex-prompt-harness/src/lib.rs

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
//! - **Dynamic prompt construction**: Build system prompts based on context (tasks, agents, etc.)
77
//! - **Agent state tracking**: Track agent state changes between messages
88
//! - **Update notifications**: Inject notifications about agent changes into the next prompt
9+
//! - **Centralized prompts**: Single source of truth for all system prompts (see [`prompts`] module)
910
//!
1011
//! # Architecture
1112
//!
@@ -28,6 +29,27 @@
2829
//! └─────────────────────────────────────────────────────────────────────┘
2930
//! ```
3031
//!
32+
//! # Centralized Prompts
33+
//!
34+
//! All system prompts are centralized in the [`prompts`] module for better
35+
//! visibility and maintainability:
36+
//!
37+
//! ```rust
38+
//! use cortex_prompt_harness::prompts;
39+
//!
40+
//! // Core prompts
41+
//! let main_prompt = prompts::core::CORTEX_MAIN_PROMPT;
42+
//! let tui_prompt = prompts::core::TUI_SYSTEM_PROMPT_TEMPLATE;
43+
//!
44+
//! // Agent prompts
45+
//! let explore = prompts::agents::EXPLORE_AGENT_PROMPT;
46+
//! let research = prompts::agents::RESEARCH_AGENT_PROMPT;
47+
//!
48+
//! // Task prompts
49+
//! let summarization = prompts::tasks::SUMMARIZATION_PROMPT;
50+
//! let compaction = prompts::tasks::COMPACTION_PROMPT;
51+
//! ```
52+
//!
3153
//! # Example
3254
//!
3355
//! ```rust
@@ -55,6 +77,7 @@
5577
pub mod builder;
5678
pub mod context;
5779
pub mod notifications;
80+
pub mod prompts;
5881
pub mod sections;
5982
pub mod state;
6083
pub mod tracker;

0 commit comments

Comments
 (0)