Skip to main content

Extended Thinking in Claude Code: Unlock Deeper Reasoning

How extended thinking works in Claude Code: adaptive reasoning steered by effort levels, ultrathink for one turn, model choice, and when deep reasoning helps.

Updated November 4, 2026: ultrathink can now raise its turn to xhigh effort (Claude Code v2.1.311 and later); see Per-Turn: ultrathink and the effort levels guide.

Updated October 21, 2026: Rewritten for Claude Code 2.1.305: current models use adaptive reasoning that the effort level steers, thinking can’t be turned off on Opus 5.5, Sonnet 5.5, Haiku 5.5, or the Fable models, ultrathink requests deeper reasoning for a single turn, and the configuration examples now use real settings keys.

Extended thinking (also called “thinking mode”) is the reasoning Claude does before it responds. It’s like giving a developer time to think through architecture before writing code. On today’s models it is adaptive: Claude decides at each step whether and how much to think, and the effort level steers how readily it does.

This guide covers how thinking works on current models, how to steer it, and patterns for getting the most out of it.

What is Extended Thinking?

Extended thinking allows Claude to:

  • Deliberate longer before responding
  • Consider multiple approaches to a problem
  • Reason through edge cases systematically
  • Plan multi-step implementations thoroughly
┌─────────────────────────────────────────────────────────────┐
│                    Normal vs Extended Thinking              │
│                                                             │
│  Normal:                                                    │
│  ┌────────┐      ┌────────┐                                │
│  │ Prompt │  ──► │Response│                                │
│  └────────┘      └────────┘                                │
│                                                             │
│  Extended Thinking:                                         │
│  ┌────────┐   ┌─────────────────┐   ┌────────┐            │
│  │ Prompt │ ► │ Internal Reason │ ► │Response│            │
│  └────────┘   │ (collapsed)     │   └────────┘            │
│               └─────────────────┘                          │
│                     ▲                                       │
│                     │                                       │
│              Longer, deeper                                 │
│              deliberation                                   │
└─────────────────────────────────────────────────────────────┘

Adaptive reasoning: thinking on demand

Claude Code’s docs describe it this way: “Adaptive reasoning makes thinking optional on each step, so Claude can respond faster to routine prompts and reserve deeper thinking for steps that benefit from it.” Fable models, Sonnet 5 and later, Haiku 5.5, and Opus 4.7 and later always use adaptive reasoning, and on those models the effort level is the primary control for how much thinking happens. You can still ask for more or less thinking in your prompt or in CLAUDE.md; the model responds to that guidance within its effort setting.

Model Support

In Claude Code 2.1.305:

ModelHow it thinksCan you turn thinking off?Effort levelsDefault effort
Fable 5.1, Fable 5Adaptive reasoningNolow–maxhigh
Opus 5.5, Sonnet 5.5, Haiku 5.5Adaptive reasoningNolow–maxmedium
Opus 5, Sonnet 5, Opus 4.8Adaptive reasoningYeslow–maxhigh
Opus 4.7Adaptive reasoningYeslow–maxxhigh
Opus 4.6, Sonnet 4.6Adaptive by default; fixed budget with CLAUDE_CODE_DISABLE_ADAPTIVE_THINKING=1Yeslow, medium, high, maxhigh
Haiku 4.5Thinking with a fixed token budgetYesNot effort-capable—

low–max means all five levels: low, medium, high, xhigh, and max. Haiku 4.5 still matters because haiku resolves to it on Claude Platform on AWS, Amazon Bedrock, Google Cloud’s Agent Platform, and Microsoft Foundry.

Key insight: On the current lineup you don’t decide whether Claude thinks — you decide how much, with the effort level.

Turning Thinking On and Off

Thinking is on by default for every model that supports it. The controls below change that only on models that allow it; on Opus 5.5, Sonnet 5.5, Haiku 5.5, and the Fable models they show Thinking can't be turned off or have no effect.

Via Config

In /config, toggle thinking mode. Claude Code saves the choice as alwaysThinkingEnabled in ~/.claude/settings.json.

Via Settings

{
  "showThinkingSummaries": true
}

Claude Code collapses thinking output by default, and interactive sessions on the Anthropic API receive redacted thinking blocks. Set showThinkingSummaries: true if you want the full summaries available when you expand thinking with Ctrl+O. To turn thinking off for every session on models that allow it, set "alwaysThinkingEnabled": false; true changes nothing, because thinking is already on. You are charged for all thinking tokens generated, even when they’re collapsed or redacted.

Per-Session

Press Option+T (macOS) or Alt+T (Windows/Linux) to toggle thinking for the current session. It has no effect on Opus 5.5, Sonnet 5.5, Haiku 5.5, or the Fable models, which always think.

Per-Turn: ultrathink

Include ultrathink anywhere in your prompt to request deeper reasoning on that turn without changing your session’s effort setting:

"ultrathink: why does this cache invalidation race only show up under load?"

Claude Code recognizes the keyword and adds an in-context instruction. Since v2.1.311, typing it in the terminal prompt can also raise that turn to xhigh effort on Opus 5.5, Sonnet 5.5, Haiku 5.5, and Fable 5.1 through Anthropic’s API; the word shows in rainbow colors when it can. Where it can’t raise a turn, such as on Amazon Bedrock, set the effort level instead. Either way your saved effort setting doesn’t change, and the v2.1.316 changelog adds CLAUDE_CODE_DISABLE_ULTRATHINK to turn the keyword off. Other phrases such as “think”, “think hard”, and “think more” are passed through as ordinary prompt text rather than recognized as keywords.

Via Environment Variable

MAX_THINKING_TOKENS behaves differently depending on the model:

  • 0 turns thinking off on the Anthropic API, except on Opus 5.5, Sonnet 5.5, Haiku 5.5, and the Fable models, which can’t have thinking turned off. On third-party providers, 0 omits the thinking parameter instead, so adaptive-reasoning models may still think.
  • A positive value is a fixed thinking budget. Claude Code ignores the number on adaptive-reasoning models, unless CLAUDE_CODE_DISABLE_ADAPTIVE_THINKING=1 has switched Opus 4.6 or Sonnet 4.6 back to fixed budgets. It caps the budget at one token below the request’s max output tokens, and never below 1,024.

With thinking turned off on the Anthropic API, Claude Code sends effort high instead of a higher level to models that don’t accept that combination, such as Opus 5.

Quick Model Switch

Press Option+P (macOS) or Alt+P (Windows/Linux) to switch models without clearing your prompt. On macOS this shortcut needs Option configured as Meta in your terminal.

Effort Levels

On adaptive-reasoning models, the effort level is how you control thinking depth. Use /effort to set it for the session, and override it per subagent when needed:

EffortThinkingUse Case
lowMinimalQuick tasks, renames, batch operations you review
mediumBalancedDefault on Opus 5.5, Sonnet 5.5, and Haiku 5.5; scoped day-to-day work
highDeepBug fixes in existing code, complex analysis; default on most other models, including Fable 5.1
xhighDeeperArchitecture decisions and the hardest judgment work
maxDeepestHard problems Claude should work through on its own; prone to overthinking, so test first

Not every model supports every level: Opus 4.6 and Sonnet 4.6 lack xhigh, and Haiku 4.5 is not listed as effort-capable. For the full matrix and the settings that save and cap effort, see Ultracode & Effort Levels.

Configuring Effort

Writing “with high effort” in a prompt doesn’t change the effort level; it’s guidance the model weighs within its current setting. To change the level itself:

/effort high      # set the level and save it as this model's default
/effort           # open the slider: Enter saves, s applies to this session only
/effort status    # show the level in effect
claude --effort xhigh                   # one session, set at launch
CLAUDE_CODE_EFFORT_LEVEL=high claude    # environment variable; overrides --effort and /effort

For a subagent, set effort in its definition’s frontmatter, or have Claude pass the Agent tool’s effort parameter (v2.1.292+). When you ask Claude to delegate the analysis to a general-purpose subagent on Opus at high effort, the call looks like this (the Agent tool was previously named Task, which still works as an alias):

Agent({
  description: "Analyze payment architecture",
  subagent_type: "general-purpose",
  model: "opus",
  effort: "high",
  prompt: `
    Analyze the payment integration architecture.
    Consider all edge cases and failure modes.
  `
})

When to Use Extended Thinking

Architecture Decisions

Quick pass, at the session’s default effort:

"How should we structure our microservices?"

Claude: [Quick response, may miss considerations]

Deep pass, with ultrathink (or /effort high first):

"ultrathink

How should we structure our microservices?
Consider: scalability, team structure, data ownership,
deployment complexity, and failure isolation."

Claude: [Thorough analysis of trade-offs]

Security Reviews

The prompt can’t switch models or effort, so do that first:

/model opus
/effort high

"Review the authentication implementation for vulnerabilities.

Consider: OWASP Top 10, JWT best practices, session
management, rate limiting, and common attack vectors."

Complex Refactoring

"Think through how to refactor the legacy payment system
to the new architecture. Consider:

- Backward compatibility
- Database migrations
- API versioning
- Rollback strategy
- Testing approach"

Debugging Complex Issues

"This bug only happens in production with high concurrency.
ultrathink about potential causes.

Symptoms: [describe symptoms]
Environment: [describe environment]
Recent changes: [describe changes]"

Extended Thinking Patterns

Phrases like “think deeply” are guidance the model weighs within its effort level; ultrathink is the one recognized keyword, and /effort changes the level itself.

Pattern 1: Architecture Review

"I need to design a new feature. ultrathink.

Feature: Real-time notifications
Requirements:
- Support 100K concurrent users
- < 100ms delivery latency
- Support mobile and web
- Handle offline users

Analyze options and recommend architecture."

Pattern 2: Trade-off Analysis

"Think deeply about this trade-off.

Option A: Monolith with modular structure
Option B: Microservices from start

Context:
- 3-person team
- MVP stage
- Unknown scale requirements
- Limited DevOps experience

Analyze both options with pros, cons, and recommendation."

Pattern 3: Security Audit

Run this one at /effort high or above:

"Perform a deep security audit.

Focus areas:
- Authentication and authorization
- Input validation
- Data encryption
- API security
- Dependency vulnerabilities

For each issue found, provide:
- Severity (Critical/High/Medium/Low)
- Description
- Remediation steps
- Code examples"

Pattern 4: Performance Investigation

"The API is slow under load. Think through potential causes.

Observations:
- Response time increases from 50ms to 2s at 500 RPS
- CPU stays at 30%, memory at 60%
- Database connections spike
- No errors in logs

Analyze potential bottlenecks and suggest investigation steps."

Impact on Cost and Cache

Important: Thinking costs tokens, and changing models or effort mid-session can cost you the prompt cache.

┌─────────────────────────────────────────────────────────────┐
│              What Thinking Costs You                        │
│                                                             │
│  Tokens:                                                    │
│  ├── Every thinking token is billed, even when collapsed    │
│  └── Higher effort -> more thinking -> more tokens          │
│                                                             │
│  Prompt cache:                                              │
│  ├── Switching models starts a fresh cache                  │
│  ├── Changing effort resets it on most models               │
│  └── Opus 5.5, Sonnet 5.5, Haiku 5.5 and Fable 5.1 keep it  │
│      (with an API key or a Claude subscription)             │
└─────────────────────────────────────────────────────────────┘

On models where changing effort resets the cache, Claude Code asks you to confirm while the cache is still warm.

Recommendation: Pick your model and effort level at the top of a session, and reserve deeper reasoning for high-value decisions rather than routine tasks.

Model Selection Guide

Use Haiku 5.5 (Lowest Effort That Works)

Best for:
- File searches and exploration subagents
- Pattern matching
- Simple code generation
- Bulk operations

Thinking is adaptive and always on; keep effort
low for mechanical work.

Example:
"Find all uses of deprecated API in the codebase"

On Bedrock, Agent Platform, Foundry, and Claude Platform on AWS, haiku still means Haiku 4.5, which thinks with a fixed budget and takes no effort setting.

Use Sonnet 5.5 (Default medium)

Best at medium effort:
- Standard implementations
- Code refactoring
- Test writing
- Documentation

Raise to high for:
- Complex implementations
- Multi-file refactoring
- Architecture-sensitive changes

Example:
"Implement the user authentication system following
our security patterns. ultrathink about the token
refresh mechanism design."

Use Opus 5.5 / Fable 5.1 (Deepest Reasoning)

Best for:
- Architecture decisions
- Security audits
- Complex debugging
- Critical code paths

Opus 5.5 defaults to medium; raise it to high or
xhigh for this work. Fable 5.1 defaults to high.

Example:
"Review the payment processing implementation,
especially the transaction handling logic."

Thinking Mode in Agents

Since v2.1.198, subagents inherit the main conversation’s thinking configuration: if thinking is on in your session, it’s on for the subagent. There’s no per-subagent thinking switch, so steer depth with each subagent’s model and effort instead.

Explore Agent (Haiku)

The built-in Explore agent runs on your main conversation’s model (when that model is Fable and you sign in with a subscription or Console account, it uses the opus model instead). To keep exploration cheap, define your own subagent named Explore with model: haiku, or ask Claude to run the search on Haiku:

Agent({
  description: "Find auth patterns",
  subagent_type: "Explore",
  model: "haiku",
  prompt: "Find authentication patterns (thoroughness: medium)"
})

No extra effort needed - pure search and discovery.

Implementation Agent (Sonnet + High Effort)

For complex implementations, raise the subagent’s effort:

Agent({
  description: "Implement OAuth with PKCE",
  subagent_type: "general-purpose",
  model: "sonnet",
  effort: "high",
  prompt: `
    Implement OAuth 2.0 with PKCE flow.
    Consider:
    - State management
    - Token storage
    - Refresh handling
    - Error recovery
  `
})

Review Agent (Opus + xhigh Effort)

For critical reviews, use Opus with xhigh effort:

Agent({
  description: "Security review payments",
  subagent_type: "general-purpose",
  model: "opus",
  effort: "xhigh",
  prompt: `
    Security review the payment integration.
    Check for:
    - PCI compliance issues
    - Data exposure risks
    - Authentication bypasses
    - Rate limiting gaps
  `
})

For reviews you run often, put model: opus and effort: xhigh in a custom subagent’s frontmatter so every invocation gets them.

Practical Examples

Example 1: Feature Design

"I need to add collaborative editing to our document app.

ultrathink.

Constraints:
- Real-time sync (< 100ms)
- Handle offline mode
- Conflict resolution
- Undo/redo support

Analyze:
1. Technology options (CRDT, OT, etc.)
2. Architecture approach
3. Trade-offs of each option
4. Recommended path forward"

Example 2: Migration Planning

/model opus
/effort high

"We're migrating from MongoDB to PostgreSQL.
Create a migration plan.

Current state:
- 50 collections
- 10M documents
- 5 services depending on data
- Zero downtime requirement

Deliverables:
1. Migration strategy
2. Schema design
3. Service update plan
4. Rollback strategy
5. Testing approach
6. Timeline estimate"

Example 3: Debug Session

"Production issue: Intermittent 500 errors on /api/checkout.

Think through this carefully.

Data points:
- Happens ~1% of requests
- No pattern in time of day
- No correlation with request size
- Started after last deploy
- Logs show: 'Connection reset by peer'

Analyze potential causes and investigation steps."

Example 4: Code Review

"ultrathink: review this PR.

PR adds: Payment processing with Stripe

Focus areas:
- Error handling completeness
- Idempotency of operations
- State machine correctness
- Webhook handling security
- Test coverage adequacy

Provide detailed feedback with specific line references."

Thinking Mode Configuration

Project-Level

Thinking needs no project setting, since it’s on by default. What you configure is effort. In .claude/settings.json:

{
  "model": "sonnet",
  "modelSettings": {
    "claude-opus-5-5": { "effortLevel": "high" }
  },
  "maxEffortLevel": "xhigh"
}

modelSettings gives each model its own effort level (here, Opus 5.5 runs at high when someone switches to it), and maxEffortLevel caps every model at xhigh. A top-level effortLevel (low, medium, high, or xhigh) sets one default for all models in this project.

Per-Task Triggers

Claude Code has no thinkingConfig or thinkingTriggers settings. Three real mechanisms cover the same need:

  • ultrathink in a prompt for a single turn.
  • effort in skill or subagent frontmatter, so the work that always needs depth always gets it.
  • maxEffortLevel to keep the most expensive levels out of reach.

For example, a security-review skill that always runs at xhigh:

---
name: security-review
description: Deep security review of the current diff
effort: xhigh
---

Review the diff for authentication, authorization, and input-validation issues.
Report each finding with a severity and a file and line reference.

Cost-Benefit Analysis

When Extended Thinking Pays Off

ScenarioSuggested EffortQuality GainROI
Architecture decisionhigh–xhighAvoid months of reworkVery High
Security reviewhigh–maxCatch vulnerabilityVery High
Complex refactorhighBetter designHigh
Bug investigationhighFaster root causeHigh
Routine codingModel defaultMarginal improvementLow

When to Skip

Stay at the model’s default or lower for:

  • File searches
  • Pattern matching
  • Simple code changes
  • Documentation updates
  • Routine tests

Best Practices

1. Be Explicit About Depth

"ultrathink: analyze this code for security issues."

Not:

"Analyze this code."

2. Provide Rich Context

Deep reasoning works better with context:

"ultrathink: design the caching layer.

Context:
- Current: No caching, 200ms average response
- Goal: <50ms for 80% of requests
- Constraints: Redis available, 5GB memory budget
- Traffic: 10K RPM, 80% reads

Consider cache invalidation, TTL strategies, and
cache stampede prevention."

3. Request Structured Output

"Think through this architecture decision.

Output format:
1. Options considered (3-5)
2. Evaluation criteria
3. Analysis matrix
4. Recommendation with rationale
5. Risk assessment"

4. Combine with Agents

Spend effort on orchestration, speed on execution:

"Phase 1 (Opus 5.5, xhigh effort): Design the migration strategy
Phase 2 (Sonnet 5.5, medium effort): Implement each migration step
Phase 3 (Haiku 5.5, low effort): Run tests in parallel"

Monitoring Thinking Usage

Check Effort and Context

The session header shows the active effort next to the model name (for example, “with low effort”), /effort status prints it, and /context shows what’s filling the context window. A custom status line receives the model, effort level, thinking state, and context usage as JSON, so you can keep them in view:

{
  "statusLine": {
    "type": "command",
    "command": "jq -r '\"[\\(.model.display_name)] \\(.effort.level // \"-\") effort | \\(.context_window.used_percentage // 0)% context\"'"
  }
}

Adjust Based on Session

You can’t turn thinking off on the 5.5 family or the Fable models, so for long stretches of routine file updates, lower the effort instead: open /effort, choose low, and press s to apply it to this session only. Typing /effort low would also save it as that model’s default.

Getting Started

Today:

  1. Ask one architecture question at your default effort, then again with ultrathink
  2. Compare output quality
  3. Note the time and token difference in /usage

This week:

  1. Choose a default model and per-model effort for your project
  2. Identify tasks that benefit from more effort
  3. Create prompts that give deep reasoning rich context

This month:

  1. Establish effort guidelines for your team
  2. Add effort to the frontmatter of the skills and subagents that need depth
  3. Measure impact on decision quality

Extended thinking transforms Claude from a fast responder to a thoughtful partner. Spend effort strategically on the decisions that matter, and watch the quality of your architecture decisions improve.

Sources: Claude Code model configuration, Claude Code CHANGELOG