From e3321092737748cb367b42a2904c0386fee28148 Mon Sep 17 00:00:00 2001 From: "Dhanji R. Prasanna" Date: Mon, 2 Feb 2026 17:16:21 +1100 Subject: [PATCH] Auto-approve plans in non-interactive (autonomous/one-shot) mode - Add auto-approval logic in execute_plan_write() when ctx.is_autonomous is true - Update system prompt to document auto-approval behavior - Plans still require explicit approval in interactive mode --- crates/g3-core/src/prompts.rs | 2 +- crates/g3-core/src/tools/plan.rs | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/crates/g3-core/src/prompts.rs b/crates/g3-core/src/prompts.rs index 0acd235..f066223 100644 --- a/crates/g3-core/src/prompts.rs +++ b/crates/g3-core/src/prompts.rs @@ -37,7 +37,7 @@ Plan Mode is a cognitive forcing system that prevents: ## Workflow 1. **Draft**: Call `plan_read` to check for existing plan, then `plan_write` to create/update -2. **Approval**: Ask user to approve before coding (\"'approve', or edit plan?\") +2. **Approval**: Ask user to approve before coding (\"'approve', or edit plan?\"). In non-interactive mode (autonomous/one-shot), plans auto-approve on write. 3. **Execute**: Implement items, updating plan with `plan_write` to mark progress 4. **Complete**: When all items are done/blocked, verification runs automatically 5. **Remember**: Call `remember` to save discovered code locations diff --git a/crates/g3-core/src/tools/plan.rs b/crates/g3-core/src/tools/plan.rs index b785929..0d2f3e3 100644 --- a/crates/g3-core/src/tools/plan.rs +++ b/crates/g3-core/src/tools/plan.rs @@ -828,6 +828,12 @@ pub async fn execute_plan_write( return Ok(format!("❌ Plan validation failed: {}", e)); } + // Auto-approve in non-interactive (autonomous) mode + if ctx.is_autonomous && !plan.is_approved() { + plan.approve(); + debug!("Auto-approved plan in autonomous mode at revision {}", plan.revision); + } + // Write the plan if let Err(e) = write_plan(session_id, &plan) { return Ok(format!("❌ Failed to write plan: {}", e));