Implement planning mode
This commit is contained in:
@@ -1,4 +1,11 @@
|
||||
//! Prompts used for discovery phase
|
||||
//! Prompts used for planning mode and discovery phase
|
||||
//!
|
||||
//! This module contains all LLM prompts used in the planner crate.
|
||||
//! All prompts are defined as constants to ensure consistency and maintainability.
|
||||
|
||||
// =============================================================================
|
||||
// DISCOVERY PHASE PROMPTS (existing)
|
||||
// =============================================================================
|
||||
|
||||
/// System prompt for discovery mode - instructs the LLM to analyze codebase and generate exploration commands
|
||||
pub const DISCOVERY_SYSTEM_PROMPT: &str = r#"You are an expert code analyst. Your task is to analyze a codebase structure and generate shell commands to explore it further.
|
||||
@@ -35,3 +42,101 @@ Your output MUST include:
|
||||
- Mark the beginning and end of the commands with "```".
|
||||
|
||||
DO NOT ADD ANY COMMENTS OR OTHER EXPLANATION IN THE COMMANDS SECTION, JUST INCLUDE THE SHELL COMMANDS."#;
|
||||
|
||||
// =============================================================================
|
||||
// PLANNING MODE PROMPTS
|
||||
// =============================================================================
|
||||
|
||||
/// System prompt for requirements refinement phase
|
||||
pub const REFINE_REQUIREMENTS_SYSTEM_PROMPT: &str = r#"You're an experienced software engineering architect. Please help me to ideate and refine
|
||||
REQUIREMENTS for an implementation (or changes to the existing implementation), at the specified codepath.
|
||||
The requirements will later be used by an LLM.
|
||||
|
||||
IMPORTANT: Before suggesting changes, you MUST:
|
||||
1. Read and understand the existing codebase at the specified codepath using read_file, shell commands, and code_search
|
||||
2. Read the `<codepath>/g3-plan/` directory to understand past requirements and implementation history
|
||||
- Pay particular attention to `planner_history.txt` which contains a chronological record of all planning activities
|
||||
- Review any `completed_requirements_*.md` files to understand what has been implemented before
|
||||
3. Use this context to ensure your suggestions are consistent with the existing codebase architecture
|
||||
|
||||
I wish to have a compact specification, and DO NOT ATTEMPT TO IMPLEMENT OR BUILD ANYTHING.
|
||||
At this point ONLY suggest improvements to the requirements. Do not implement anything.
|
||||
DO NOT DO A RE-WRITE, UNLESS THE USER EXPLICITLY ASKS FOR THAT.
|
||||
If you think the requirements are totally incoherent and unusable, write constructive feedback on
|
||||
why that is, and suggest (very briefly) that you could rewrite it if explicitly asked to do so.
|
||||
If the requirements are usable, make some edits/changes/additions as you deem necessary, and
|
||||
PREPEND them under the heading `{{CURRENT REQUIREMENTS}}` to the `<codepath>/g3-plan/new_requirements.md` file.
|
||||
|
||||
The codepath will be provided in the user message."#;
|
||||
|
||||
/// System prompt for generating requirements summary for planner_history.txt
|
||||
pub const GENERATE_REQUIREMENTS_SUMMARY_PROMPT: &str = r#"Generate a short summary of the following requirements.
|
||||
Take care that the most important elements of the requirements are reflected.
|
||||
Do not go into deep detail. Make the summary at most 5 lines long.
|
||||
Each line should be at most 120 characters long.
|
||||
Output ONLY the summary text, no headers or formatting.
|
||||
|
||||
Requirements:
|
||||
{requirements}"#;
|
||||
|
||||
/// System prompt for generating git commit message
|
||||
pub const GENERATE_COMMIT_MESSAGE_PROMPT: &str = r#"Generate a git commit message for the following implementation.
|
||||
|
||||
REQUIREMENTS THAT WERE IMPLEMENTED:
|
||||
{requirements}
|
||||
|
||||
COMPLETED FILES:
|
||||
- Requirements: {requirements_file}
|
||||
- Todo: {todo_file}
|
||||
|
||||
Generate a commit message with:
|
||||
1. A summary line (max 72 characters, imperative mood, e.g., "Add planning mode with...")
|
||||
2. A blank line
|
||||
3. A description (max 10 lines, each max 72 characters, wrapped properly)
|
||||
|
||||
The description should:
|
||||
- Describe the implementation concisely
|
||||
- Include only the most important and salient details
|
||||
- Mention the completed_requirements and completed_todo filenames
|
||||
|
||||
Output format:
|
||||
{{COMMIT_SUMMARY}}
|
||||
<summary line here>
|
||||
{{COMMIT_DESCRIPTION}}
|
||||
<description here>"#;
|
||||
|
||||
// =============================================================================
|
||||
// CONFIG ERROR MESSAGES
|
||||
// =============================================================================
|
||||
|
||||
/// Error message for old config format
|
||||
pub const OLD_CONFIG_FORMAT_ERROR: &str = r#"Your configuration file uses an old format that is no longer supported.
|
||||
|
||||
Please update your configuration to use the new provider format:
|
||||
|
||||
```toml
|
||||
[providers]
|
||||
default_provider = "anthropic.default" # Format: "<provider_type>.<config_name>"
|
||||
planner = "anthropic.planner" # Optional: specific provider for planner
|
||||
coach = "anthropic.default" # Optional: specific provider for coach
|
||||
player = "openai.player" # Optional: specific provider for player
|
||||
|
||||
# Named configs per provider type
|
||||
[providers.anthropic.default]
|
||||
api_key = "your-api-key"
|
||||
model = "claude-sonnet-4-5"
|
||||
max_tokens = 64000
|
||||
|
||||
[providers.anthropic.planner]
|
||||
api_key = "your-api-key"
|
||||
model = "claude-opus-4-5"
|
||||
thinking_budget_tokens = 16000
|
||||
|
||||
[providers.openai.player]
|
||||
api_key = "your-api-key"
|
||||
model = "gpt-5"
|
||||
```
|
||||
|
||||
Each mode (planner, coach, player) can specify a full path like "<provider_type>.<config_name>".
|
||||
If not specified, they fall back to `default_provider`."#;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user