Skip to content

Commit 5bcc3c9

Browse files
author
Yogthos
committed
Inject mode-specific reminders on prompt switch (Phase 8)
- Plan mode: reminder to create a detailed plan in PLAN.md - Code mode with existing PLAN.md: reminder to execute the plan step by step - Review modes: reminder to review thoroughly and provide actionable feedback - Code mode without PLAN.md: no additional context injected
1 parent 1800036 commit 5bcc3c9

1 file changed

Lines changed: 23 additions & 0 deletions

File tree

src/agent/builder.rs

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,29 @@ pub async fn build_agent_inner<M: CompletionModel + 'static>(
107107
preamble.push_str(&format!("\nGit branch: {}", branch));
108108
}
109109

110+
// Inject mode-specific reminders
111+
if let Some(prompt_name) = &context.current_prompt_name {
112+
match prompt_name.as_str() {
113+
"plan" => {
114+
preamble.push_str("\n\n---\n\nYou are now in PLAN mode. Create a detailed implementation plan. Save it to PLAN.md in the current directory. Analyze the task, break it into concrete steps, consider edge cases and trade-offs. Do NOT write any code or run any commands until the user reviews and approves the plan.");
115+
}
116+
"review" | "review-security" => {
117+
preamble.push_str("\n\n---\n\nYou are now in REVIEW mode. Review the code or plan carefully. Identify bugs, security issues, performance problems, and design flaws. Be thorough and specific. Provide actionable feedback.");
118+
}
119+
"code" => {
120+
let plan_path = std::env::current_dir()
121+
.unwrap_or_else(|_| ".".into())
122+
.join("PLAN.md");
123+
if plan_path.exists() {
124+
preamble.push_str(&format!(
125+
"\n\n---\n\nA plan file exists at PLAN.md. Execute the plan step by step. Write and test code following the plan. Report progress after each step. The plan is your guide — follow it closely."
126+
));
127+
}
128+
}
129+
_ => {}
130+
}
131+
}
132+
110133
let mut builder = AgentBuilder::new(model).preamble(&preamble);
111134

112135
let max_tokens = cli.resolve_max_tokens(cfg);

0 commit comments

Comments
 (0)