Magic Tools
Claude GuidesBy CooconJuly 28, 2026303 views4 min read

Claude Code Plan Mode: Research First, Code Later, Rework Less

The most expensive thing about Claude Code is not tokens — it is rework. Claude confidently edits eight files, you read the diff, and the whole approach was wrong. Roll back, start over. Plan Mode is the switch built for exactly this: Claude researches read-only and proposes a plan, and only after you approve does it touch code.

What Plan Mode is: read-only research plus an approval gate

In Plan Mode, Claude's behavior splits into two phases:

  1. Research (read-only): it can read files, search code, and analyze structure — but it cannot edit files or run commands that change system state
  2. Approval: it distills the research into an implementation plan and presents it; approve and it exits Plan Mode to execute, or push back and it revises the plan

The key value is separating "think it through" from "do the work" at the mechanism level. Without Plan Mode you can always write "don't change code yet" in your prompt, but that is a verbal agreement. Plan Mode is a hard constraint: during research, file edits are blocked even if attempted.

How to enter: cycle with Shift+Tab

Press Shift+Tab during a session to cycle through three permission modes:

  • Normal: every sensitive action asks for confirmation
  • Auto-accept: file edits go through automatically — good for mechanical tasks you trust
  • Plan Mode: read-only planning, all modifications blocked

You can also start a session directly in it: claude --permission-mode plan. If your team has a "big changes need a plan first" convention, write it into the project's CLAUDE.md — Claude will then proactively start non-trivial tasks in a planning flow.

Which tasks deserve Plan Mode

A practical threshold: if the change takes more than 3 steps, or more than one reasonable approach exists, plan first. Concretely:

Turn it on for:

  • Multi-file refactors ("extract the auth logic into middleware")
  • First changes in an unfamiliar codebase — the research phase doubles as your codebase tour
  • Features with architectural forks ("add real-time notifications" — WebSocket or polling?)
  • Bugs with an unknown root cause: let it investigate read-only and present a diagnosis, instead of guess-and-edit contaminating the scene

Skip it for:

  • Typo fixes and one-line style tweaks
  • Tasks where you have already specified the exact change and only execution remains
  • Pure lookup questions ("where is this function called?") — just ask; planning adds a detour

The cost of using Plan Mode on a small task is one extra round trip. The cost of skipping it on a large task is wholesale rework. When unsure, err toward planning.

Four techniques that make planning actually improve quality

1. Make it ask questions before proposing. Add "if the requirements are ambiguous, ask me first" to your planning prompt. Every question surfaced during planning is one rework avoided during execution.

2. Require verification steps in the plan. A good plan lists not just "which files change" but "how we prove it worked" — which test to run, which log to check. Acceptance criteria written into the plan give you something to audit against after execution.

3. Persist the plan to a file. Have Claude write the approved plan into something like tasks/todo.md and check items off as it executes. If the session is interrupted or the context gets compacted, that file is the anchor for resuming exactly where things stood.

4. When execution drifts, go back to planning. If a premise turns out wrong mid-execution, do not let Claude "adjust as it goes" — switch back to Plan Mode and re-evaluate. Pushing through after a wrong turn almost always costs more than stopping to re-plan.

How it composes with the rest of Claude Code

Plan Mode is not an island. During research it pairs naturally with subagents — send them to investigate different subsystems in parallel while the main context receives only conclusions. During execution, the approved plan pairs with auto-accept so mechanical edits stop asking for confirmation one by one. And the team rule about when planning is mandatory belongs in CLAUDE.md, where every future session inherits it automatically.

In one sentence: Plan Mode turns AI coding from "give an order, gamble on the result" into "review the approach, then release the brakes." The bigger the task, the more rework that one approval round saves.

Related reading on this site: the "Claude Code Quickstart Guide" if you are still building your basic workflow, and "10 Advanced Claude Code Techniques" for session recovery, checkpoint rewind, and other capabilities that complement Plan Mode.

Related Articles

Blocking rm -rf in Claude Code: A Deny Rule Stopped 14 Deletes in Two Weeks, 7 Other Spellings Still Get Through, and a Hook That Closes the Gap

To keep Claude Code from deleting things by accident, I added a deny rule, Bash(rm -rf *), to my global settings. Across my sessions from October 7 to 21 it blocked 14 deletes. After each denial the model picked a new directory name 8 times and dropped the delete 6 times. It never tried another spelling. Then I replayed 22 delete commands verbatim against Claude Code 2.1.285 through a stub. rm -fr, rm -r -f, rm -Rf and rm -r deleted the directory in manual, auto and bypass mode alike. /bin/rm, find -delete and bash -c deleted it in manual and bypass mode. In auto mode, rm -fr inside the working directory skips the classifier because it 'would be allowed in acceptEdits mode'. A second, built-in dangerous-rm check fires on targets like $D/*, even in bypass mode, but loses track of a variable assignment when a heredoc comes earlier in the same command. The post ends with a PreToolUse hook that blocks every recursive spelling in all three modes and tells the model what to do instead.

claude-codehooks+5
pitfallsOct 21, 20268 min
208

Claude Code Auto Mode with DeepSeek, GLM or Kimi: What Each "temporarily unavailable" Reason Means and When Retrying Is Pointless (Fault-Injection Test)

On a third-party model, Claude Code auto mode sends one extra classifier request per side-effecting action, from your session model to the same backend: a 132,470-character system prompt, about 29.7K input tokens per check. When it fails, you see "xxx is temporarily unavailable, so auto mode cannot determine the safety of Bash". We injected faults and recorded each message: 500 (server error), 429 (rate-limited), 529 (overloaded) and connection resets (connection failed) are retried 5 times; no reply in 60 s gives (timed out). **No parentheses means a 4xx rejection: tried once, and retrying never helps.** A reply with no verdict gives "could not evaluate"; three in a row bring back manual approval. CLAUDE_CODE_AUTO_MODE_MODEL has no effect. Claude Code 2.1.285, real DeepSeek v4-pro and MiMo v2.5 backends.

claude-codedeepseek+7
pitfallsOct 11, 202612 min
422

Claude Code "Prompt is too long" vs "maximum context length": Why Auto-Compact Works for One and Not the Other (Tested)

Claude Code decides a request was too long by matching the error text. If the backend says prompt is too long or input is too long for requested model, it auto-compacts the conversation and retries — invisible to you. DeepSeek and OpenAI-style gateways say This model's maximum context length is …, which it doesn't recognize: you get API Error: 400 on every turn. Manual /compact works; the better fix is to declare the real window with CLAUDE_CODE_MAX_CONTEXT_TOKENS (non-claude- model IDs) or CLAUDE_CODE_AUTO_COMPACT_WINDOW (claude- IDs) so it compacts before hitting the limit. Tested on Claude Code 2.1.285 against a local stub.

claude-codedeepseek+6
pitfallsOct 5, 20267 min
437

Claude Code Stuck on a Spinner With No Response: It Waits 6 Minutes per Attempt, and 10 Retries Can Hang It for Over an Hour (Tested)

When Claude Code spins without output or sits at Retrying in 0s, the backend is usually not sending anything. Tested on 2.1.285 (API key + ANTHROPIC_BASE_URL): with no response headers it waits 6 minutes (360 s) per attempt before timing out — setting API_TIMEOUT_MS to 600000 or 900000 doesn't change that; only lower values work. With the default 10 retries it can hang for over an hour. A gateway that buffers the reply until generation finishes will never deliver a reply that takes over 6 minutes. Press Esc to interrupt. All tested against a local stub.

claude-codetroubleshooting+5
pitfallsOct 5, 20269 min
377

Published by Magic Tools