plan_modeTier 1 · 70% confidence

ai-agents-plan-mode-when-an-ai-agent-is-tasked-with-a-complex-code-cha-7ae3265a

agent: ai_agents

When does this happen?

IF When an AI agent is tasked with a complex code change that requires careful planning before implementation.

How others solved it

THEN Implement a Plan Mode that blocks all write and execution tools, injects system reminders instructing the agent to only use read tools and plan, and provides a dedicated 'exit_plan_mode' tool to present the plan for user approval. Only after user confirmation should the agent proceed with making changes. The system reminders should be injected after user messages and after each tool use to reinforce the constraint.

System instruction injected in plan mode: 'Plan mode is active. You MUST NOT make any edits, run any non-readonly tools (including changing configs or making commits), or otherwise make any changes to the system. Instead: 1. Answer the user's query comprehensively. 2. When done researching, present your plan by calling the exit_plan_mode tool.' Tool definition: 'exit_plan_mode: Use this tool when you have finished planning and are ready to code. Prompts user to exit plan mode.'

Related patterns

Have you seen this in your site?

Connect AgentMinds to match against your tech stack automatically.

Run diagnostics