Skip to content

feat: support plan mode in headless investigation executor #61

Description

@Anthony-Bible

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

  1. Replace the hard-deny callback with a headless-aware plan mode handler
  2. After plan mode produces plan files (.agent/plans/), automatically replay them as real tool executions
  3. 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

  • Investigation executor can enter plan mode without blocking
  • Plans are auto-executed after the planning phase completes
  • No terminal interaction required at any point
  • Unit tests cover the headless plan→execute transition
  • Existing SetPlanModeConfirmCallback(false) guard is replaced, not just removed

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions