Add Plan Mode to replace TODO system

Plan Mode is a cognitive forcing system that requires reasoning about:
- Happy path
- Negative case
- Boundary condition

New tools:
- plan_read: Read current plan for session
- plan_write: Create/update plan with YAML content (validates structure)
- plan_approve: Mark current revision as approved

New command:
- /feature <description>: Start Plan Mode for a new feature

Plan schema requires:
- plan_id, revision, approved_revision
- items with id, description, state, touches, checks (happy/negative/boundary)
- evidence and notes required when marking items done

Verification:
- plan_verify() called automatically when all items are done/blocked

Removed:
- todo_read, todo_write tools
- todo.rs module and related tests
This commit is contained in:
Dhanji R. Prasanna
2026-02-02 14:38:25 +11:00
parent 7fc9eb0778
commit a63950d8f5
12 changed files with 997 additions and 942 deletions

View File

@@ -74,6 +74,7 @@ pub async fn handle_command<W: UiWriter>(
output.print(" /readme - Reload README.md and AGENTS.md from disk");
output.print(" /stats - Show detailed context and performance statistics");
output.print(" /run <file> - Read file and execute as prompt");
output.print(" /feature <description> - Start Plan Mode for a new feature");
output.print(" /help - Show this help message");
output.print(" exit/quit - Exit the interactive session");
output.print("");
@@ -452,6 +453,35 @@ pub async fn handle_command<W: UiWriter>(
}
Ok(true)
}
cmd if cmd.starts_with("/feature") => {
let parts: Vec<&str> = cmd.splitn(2, ' ').collect();
if parts.len() < 2 || parts[1].trim().is_empty() {
output.print("Usage: /feature <description>");
output.print("Starts Plan Mode for a new feature. The agent will:");
output.print(" 1. Research and draft a Plan with checks (happy/negative/boundary)");
output.print(" 2. Ask clarifying questions if needed");
output.print(" 3. Request approval before coding");
output.print("");
output.print("Example: /feature Add CSV import for comic book metadata");
} else {
let feature_description = parts[1].trim();
// Construct the feature prompt that instructs the agent to use Plan Mode
let prompt = format!(
"I want to implement a new feature: {}\n\n\
Please use Plan Mode to help me implement this:\n\
1. First, research the codebase to understand where this feature should live\n\
2. Draft a Plan using `plan_write` with items that have all three checks (happy, negative, boundary)\n\
3. Ask me any clarifying questions if needed\n\
4. Then ask me to approve the plan before you start coding\n\n\
Do NOT start coding until I approve the plan.",
feature_description
);
execute_task_with_retry(agent, &prompt, show_prompt, show_code, output).await;
}
Ok(true)
}
"/unproject" => {
if active_project.is_some() {
use crate::g3_status::G3Status;