Skip to content

3.4 Plan Mode vs Direct Execution

Claude Code works in two main modes: plan mode and direct execution. The exam tests whether you can pick the right one for a given task. It’s not a matter of taste — there are clear criteria for when each mode fits.

Plan mode is for complex tasks where you need to explore the codebase, evaluate multiple approaches, and design a strategy before making changes. Use plan mode when:

  • Large-scale changes are involved. Restructuring a monolith into microservices, reorganising a module system, or refactoring a core abstraction all require understanding the existing structure before changing it.
  • Multiple valid approaches exist. When there are different ways to solve the problem (e.g., different integration architectures with different infrastructure requirements), you need to evaluate them before committing.
  • Architectural decisions are required. Service boundaries, module dependencies, API contracts — these decisions have downstream consequences. Planning prevents costly rework.
  • Multi-file modifications are needed. A library migration affecting 45+ files requires a consistent strategy. Without a plan, you risk applying the migration inconsistently across files.
  • Codebase exploration is necessary. When you need to understand dependencies, trace data flows, or map the existing structure before changing anything.

Plan mode enables safe exploration and design. Claude reads the codebase, analyses dependencies, and proposes an approach — all without modifying any files.

Direct execution is for well-understood changes with clear, limited scope. Use direct execution when:

  • The change is well-scoped. A single-file bug fix with a clear stack trace. Adding a date validation conditional. Updating a configuration value.
  • The correct approach is already known. You know what needs to change, where, and how. There is no design decision to make.
  • The scope is limited. One function, one file, one clear modification.

Direct execution skips the planning phase and makes changes straight away. For simple, well-defined tasks, planning adds nothing.

The Explore subagent keeps verbose discovery output out of the main conversation. On multi-phase tasks, exploring the codebase throws off a lot: file listings, dependency graphs, code excerpts, analysis notes. Let all that flow into the main conversation and it fills the context window, which drags down the quality of later responses.

The Explore subagent:

  1. Runs the exploration in isolation
  2. Produces summaries of its findings
  3. Returns those summaries to the main conversation
  4. Keeps the main context window clean for the actual implementation work

Use the Explore subagent during multi-phase tasks where the discovery phase is verbose but the implementation phase needs focused context.

The combination of plan mode for investigation and direct execution for implementation is common in practice and tested on the exam. The pattern:

  1. Plan phase: Use plan mode to explore the codebase, understand dependencies, evaluate approaches, and design the implementation strategy.
  2. Execute phase: Switch to direct execution to implement the planned approach, file by file, with the strategy already decided.

For example, migrating from one logging library to another across 30 files:

  • Plan: Identify all files importing the old library, map the API differences between old and new, design the migration pattern, check for edge cases.
  • Execute: Apply the migration pattern to each file using the planned approach.

It’s plan THEN direct, not plan OR direct. The exam expects you to spot the pattern.

Task characteristics Mode
Architectural restructuring Plan mode
Library migration (many files) Plan mode (then direct execution)
Multiple valid implementation approaches Plan mode
Codebase exploration needed Plan mode (with Explore subagent)
Single-file bug fix with clear stack trace Direct execution
Adding a validation check to one function Direct execution
Configuration value update Direct execution
Known fix, known location, known approach Direct execution

A common exam trap: starting in direct execution and switching to plan mode only once complexity shows up. When the requirements already say the task is complex (e.g., “restructure the monolith into microservices”), reach for plan mode straight away. The complexity isn’t going to emerge later — it’s right there in the task description. Waiting for surprises is the wrong move.

Your team faces three tasks: (1) restructure a monolith into microservices, (2) fix a null pointer exception in a single function with a clear stack trace, (3) migrate from one logging library to another across 30 files. Which mode should be used for each?

  • A. Plan mode for all three, since they all involve code changes
  • B. Plan mode only for (1), direct execution otherwise
  • C. Plan mode for (1) and (3), and direct execution for (2)
  • D. Direct execution for all three with comprehensive upfront instructions
Answer & explanation

Correct: C

  • A — Task 2 is a well-understood, limited-scope bug fix with a clear stack trace. Plan mode adds no value when the problem, location, and solution are all clear.
  • B — Task 3 affects 30 files with API differences between the old and new library. Without planning the migration pattern first, you risk inconsistent application across files and missing edge cases.
  • C — Task 1 involves architectural decisions with multiple valid service boundary options — plan mode is essential. Task 3 affects 30 files and needs a consistent migration strategy designed before execution. Task 2 is a single-function fix with a clear stack trace — direct execution is appropriate.
  • D — Task 1 requires codebase exploration to understand dependencies before restructuring. Comprehensive upfront instructions assume you already know the right structure — but you cannot know that without exploring the code first.

Five exam-style multiple-choice questions on Plan Mode vs Direct Execution. Pick an answer, then open the explanation.

Your team faces three tasks: (1) restructure a monolith into microservices, (2) fix a null pointer exception in a single function with a clear stack trace, (3) migrate from one logging library to another across 30 files. Which mode should be used for each?

  • A. Plan mode for all three, since they all involve code changes
  • B. Plan mode for (1) and (3), direct execution for (2)
  • C. Plan mode for (1), direct execution for (2) and (3)
  • D. Direct execution for all three with comprehensive upfront instructions
Answer & explanation

Correct: B

  • A is wrong: Task 2 is a well-understood, limited-scope bug fix with a clear stack trace. Plan mode adds no value when the problem, location, and solution are all clear.
  • B is correct: Task 1 involves architectural decisions with multiple valid service boundary options – plan mode is essential. Task 3 affects 30 files and needs a consistent migration strategy designed before execution. Task 2 is a single-function fix with a clear stack trace – direct execution is appropriate.
  • C is wrong: Task 3 affects 30 files with API differences between the old and new library. Without planning the migration pattern first, you risk inconsistent application across files and missing edge cases.
  • D is wrong: Task 1 requires codebase exploration to understand dependencies before restructuring. Comprehensive upfront instructions assume you already know the right structure without exploring.

A developer is tasked with migrating a date library across 25 files. They plan to use plan mode to design the migration strategy, then switch to direct execution to apply it file by file. What is this approach called?

  • A. Incremental execution with checkpoints
  • B. Sequential plan mode
  • C. Staged deployment behind feature flags
  • D. The hybrid plan-then-execute pattern
Answer & explanation

Correct: D

  • A is wrong: Incremental execution is not a defined Claude Code pattern in the exam material.
  • B is wrong: Sequential plan mode is not a defined concept. Plan mode is one phase; direct execution is the other.
  • C is wrong: Staged deployment refers to deployment strategies, not Claude Code execution modes.
  • D is correct: The hybrid pattern uses plan mode for investigation and design, then direct execution for implementing the planned approach. This is the documented name for combining both modes.

During a multi-phase codebase analysis, the Explore subagent produces a dependency map, identifies patterns, and analyses 50 files. The main conversation receives only a summary. Why is this isolation important?

  • A. The Explore subagent can access files that the main session cannot
  • B. The Explore subagent runs on a more powerful model better suited for analysis
  • C. Verbose discovery output would fill the main conversation’s context window
  • D. Isolation prevents the analysis from modifying any source files
Answer & explanation

Correct: C

  • A is wrong: The Explore subagent does not have special file access. It has the same access as the main session.
  • B is wrong: The Explore subagent uses the same model. Its purpose is output isolation, not model selection.
  • C is correct: Context window preservation is the primary purpose. Without isolation, extensive file listings, dependency graphs, and code excerpts fill the context window. Subsequent implementation responses degrade because relevant context is pushed out by verbose exploration output.
  • D is wrong: Plan mode prevents modification, not the Explore subagent specifically. The Explore subagent’s purpose is context isolation.

A colleague suggests starting with direct execution for a feature that requires restructuring the authentication module across 15 files. They argue they can switch to plan mode if complexity becomes apparent. Is this approach correct?

  • A. No, the scope is already known, so plan mode belongs at the start
  • B. Yes, starting lean with direct execution and escalating to plan mode if needed is always best practice
  • C. Yes, because 15 files is below the threshold that requires plan mode
  • D. No, because you should always use plan mode for any task, regardless of scope
Answer & explanation

Correct: A

  • A is correct: The requirements explicitly state restructuring across 15 files. This is a multi-file architectural change with known complexity. Plan mode should be chosen upfront to explore dependencies and design the approach before making changes.
  • B is wrong: When complexity is already stated in the requirements (restructuring, 15 files, cross-module), waiting for surprises is the wrong approach. The complexity is known, not speculative.
  • C is wrong: There is no fixed file-count threshold. The decision is based on ambiguity and whether multiple valid approaches exist, not a magic number of files.
  • D is wrong: Plan mode for every task wastes time on well-defined, limited-scope changes.

Which of the following tasks is most appropriate for direct execution without a planning phase?

  • A. Extracting a shared utility module used by 12 different services
  • B. Evaluating three different caching strategies for an API endpoint
  • C. Fixing a typo in a configuration file that causes a deployment failure
  • D. Migrating database access patterns from callbacks to async/await across the project
Answer & explanation

Correct: C

  • A is wrong: A shared utility used by 12 services requires understanding all consumers before extraction. Plan mode is needed to map dependencies.
  • B is wrong: Evaluating three strategies involves comparing approaches with different tradeoffs. This is architectural decision-making that requires plan mode.
  • C is correct: A typo fix in a configuration file is well-scoped, well-understood, and has no ambiguity. The problem is known, the location is known, and the fix is obvious.
  • D is wrong: Migrating patterns across the project is a multi-file change requiring a consistent strategy. Plan mode designs the migration; direct execution applies it.