Skip to content
AgenticAIWiki
  1. Learn
  2. Part 9
  3. 47. Plan-and-execute and ReWOO
  4. 47.4

Lesson 47.4 · 4 of 5 · 4 min read · Reviewed 24 Nov 2026

Plan mode in a coding agent as an example

By the end, you can

  • Use Claude Code's plan mode as a worked example of planning first.
  • Know when to plan before editing.

The pattern in a real tool

1. Plan mode on   ->  Claude reads code, asks questions, proposes a plan
                       (no file edits, no state-changing commands)
2. You review     ->  "Also update the migration" / "Don't touch the API layer"
3. Approve        ->  Claude executes the plan, editing and testing

This is plan-and-executePlan-and-execute: An agent pattern that first writes a full plan, then executes the steps, re-planning if needed. (47.1) with a person in the middle: the planner and executor are the same agentAgent: A system where a model decides its own next steps, calling tools in a loop until the task is done., but the approval gate separates them.

When to use it

Use plan mode Skip it
Changes across several files or modules One-line or single-file fixes
Unfamiliar codebases Work you’ve described precisely
Risky areas: auth, payments, data migrations Pure reading and questions
When you want to agree on an approach first Quick experiments on a branch

Chapters 44 and 45 show how hooks and permission rulesPermission rule: An allow, ask or deny rule that controls which tools, commands or paths a coding agent may use. enforce these limits in code.

The general lesson

Any agent that makes changes can borrow this: produce a plan as an artifact, let a person (or a checker) approve it, and only then grant the permissions to act.

Key points

  • Plan mode in Claude Code has Claude explore and propose a plan without editing files or running changes.
  • You review and refine the plan, then let it execute.
  • It's plan-and-execute with a human approval gate between the two halves.
  • Use it for multi-file or risky changes; skip it for small, obvious edits.
Hands-on labOn your own machine

Plan a multi-file change in plan mode

Use Claude Code's plan mode to agree an approach before any file is edited.

You will have: A reviewed plan, the change it produced on a branch, and a short note on what you changed in the plan and why.

Steps

  1. Install Claude Code from the official docs, and keep any API key in an environment variable, never in a file you commit.
  2. Open a practice repository on a new branch and pick a change that touches at least three files, such as renaming a config option everywhere.
  3. Start Claude Code, switch to plan mode (the docs list the shortcut), and describe the change and how you will know it is done.
  4. Read the proposed plan, ask for at least one change to it, and approve it only when every step makes sense.
  5. Let it carry out the plan, then run the tests and review the diff.

Done when

  • No file changed while in plan mode.
  • The final plan includes your correction.
  • Tests pass on the branch and the diff matches the plan's steps.

Docs: Common workflows (Claude Code docs) · Claude Code overview (Claude docs)

Quick checkWhen is plan mode most worth using?
How sure are you?
Pick an answer and how sure you are