Background
Plan mode (activated via enter_plan_mode) improves AI accuracy by separating the planning and execution phases. Currently, plan mode is explicitly denied for investigations via a hard-blocking callback added in #58 to prevent the AI from silently stalling a headless investigation.
Goal
Enable the investigation executor to use plan mode in a way that is safe for headless operation:
- The AI should be able to enter plan mode to produce a structured investigation plan
- The plan phase should complete (AI writes all planned steps as plan files)
- The executor should then automatically execute the plan without requiring terminal input to approve each step
- If execution of a plan step fails, fall back to logging the error and continuing (non-interactive)
Proposed Approach
- Replace the hard-deny callback with a headless-aware plan mode handler
- After plan mode produces plan files (
.agent/plans/), automatically replay them as real tool executions
- Add a config flag (e.g.
AGENT_INVESTIGATION_PLAN_MODE) to opt-in, defaulting to disabled until the replay logic is stable
Why This Matters
Planning before acting is a known technique to increase LLM reasoning accuracy on multi-step tasks (chain-of-thought, ReAct, etc.). Investigations are exactly the kind of multi-step diagnostic task that benefits most from an explicit planning phase.
Acceptance Criteria
Background
Plan mode (activated via
enter_plan_mode) improves AI accuracy by separating the planning and execution phases. Currently, plan mode is explicitly denied for investigations via a hard-blocking callback added in #58 to prevent the AI from silently stalling a headless investigation.Goal
Enable the investigation executor to use plan mode in a way that is safe for headless operation:
Proposed Approach
.agent/plans/), automatically replay them as real tool executionsAGENT_INVESTIGATION_PLAN_MODE) to opt-in, defaulting to disabled until the replay logic is stableWhy This Matters
Planning before acting is a known technique to increase LLM reasoning accuracy on multi-step tasks (chain-of-thought, ReAct, etc.). Investigations are exactly the kind of multi-step diagnostic task that benefits most from an explicit planning phase.
Acceptance Criteria
SetPlanModeConfirmCallback(false)guard is replaced, not just removed