ClaudeDetails
UpdatesGuidesModelsMCPToolsLearning PathsFAQ
UpdatesGuidesModelsMCPToolsLearning PathsFAQ

On this page

What subagents areWhy use subagentsBuilt-in subagentsRestricting built-in subagentsFAQ
Home/Guides/Claude Code
Claude CodeINTERMEDIATE

Claude Code Subagents: Built-in Agents, Delegation, and Context Management

Needs reviewLast verified August 12, 2026·4 min read

This guide explains subagents in Claude Code: specialized AI assistants that handle side tasks like codebase search or research in their own context window, returning only a summary to your main conversation. It covers why subagents preserve context and control costs, the built-in subagents (Explore, Plan, General-purpose, and helper agents), how model inheritance works for Explore, and the options for restricting or disabling subagent delegation through permissions and environment variables.

What subagents are

Subagents are specialized AI assistants that handle specific types of tasks in Claude Code. Use one when a side task would flood your main conversation with search results, logs, or file contents you won't reference again: the subagent does that work in its own context and returns only the summary.

Each subagent runs in its own context window with a custom system prompt, specific tool access, and independent permissions. When Claude encounters a task that matches a subagent's description, it delegates to that subagent, which works independently and returns results. If you keep spawning the same kind of worker with the same instructions, that's the signal to define a custom subagent.

Note that subagents work within a single session. Anthropic's docs point to separate features for other patterns: background agents for running many independent sessions in parallel, cross-session messaging for sessions that pass messages to each other, and agent teams for a coordinated team of sessions Claude spawns and supervises.

Why use subagents

According to the documentation, subagents help you:

  • Preserve context by keeping exploration and implementation out of your main conversation
  • Enforce constraints by limiting which tools a subagent can use
  • Reuse configurations across projects with user-level subagents
  • Specialize behavior with focused system prompts for specific domains
  • Control costs by routing tasks to faster, cheaper models like Haiku

Claude uses each subagent's description to decide when to delegate. When you create a subagent, write a clear description so Claude knows when to use it.

Built-in subagents

Claude Code includes built-in subagents that Claude uses automatically when appropriate. Each inherits the parent conversation's permissions; most run with a restricted tool set.

One important detail: Explore and Plan skip your CLAUDE.md files and the parent session's git status to keep research fast and inexpensive. Every other built-in and custom subagent loads both.

Explore

A fast, read-only agent optimized for searching and analyzing codebases.

  • Model: inherits from the main conversation, capped at Opus on the Claude API
  • Tools: read-only tools; Write and Edit are denied
  • Purpose: file discovery, code search, codebase exploration

As of v2.1.198, Explore inherits the main conversation's model instead of always running on Haiku. On the Claude API, the inherited model is capped at Opus: a main conversation on a higher tier runs Explore on Opus, and a main conversation on Sonnet or Haiku runs Explore on that same model. On other providers (such as Amazon Bedrock, Google Cloud's Agent Platform, Microsoft Foundry, or Claude Platform on AWS), Explore inherits the main conversation's model directly.

A user or project subagent named Explore overrides the built-in and keeps its own model field, so you can define one with model: haiku to keep exploration on a lower-cost model.

When invoking Explore, Claude specifies a thoroughness level: quick for targeted lookups, medium for balanced exploration, or very thorough for comprehensive analysis.

Plan

A research agent used during plan mode to gather context before presenting a plan.

  • Model: inherits from the main conversation
  • Tools: read-only tools; Write and Edit are denied
  • Purpose: codebase research for planning

When you're in plan mode and Claude needs to understand your codebase, it delegates research to the Plan subagent so exploration output stays in a separate context window while the main conversation remains read-only.

General-purpose

A capable agent for complex, multi-step tasks that require both exploration and action.

  • Model: inherits from the main conversation
  • Tools: every tool available to subagents
  • Purpose: complex research, multi-step operations, code modifications

Claude delegates to general-purpose when the task requires both exploration and modification, complex reasoning to interpret results, or multiple dependent steps.

Other helper agents

Claude Code includes additional helper agents that are typically invoked automatically:

AgentModelWhen Claude uses it
claudeInheritsWhen a task doesn't fit a more specialized agent. A catch-all with every tool available to subagents; also the default agent for a dispatched background session, which runs with your settings' permission mode rather than a parent conversation's
statusline-setupSonnetWhen you run /statusline to configure your status line
claude-code-guideHaikuWhen you ask questions about Claude Code features

Restricting built-in subagents

Built-in subagents are registered by default in interactive sessions. The documentation lists these ways to restrict them:

  • To block a specific built-in type, add it to permissions.deny.
  • To prevent Claude from delegating to any subagent, deny the Agent tool itself with permissions.deny.
  • To remove only the built-in Explore and Plan subagents, set CLAUDE_CODE_DISABLE_EXPLORE_PLAN_AGENTS=1. Claude then reads and explores files directly instead of delegating. This requires Claude Code v2.1.198 or later.

The docs also reference non-interactive (headless) mode behavior in this context; consult the full official documentation for details on that mode.


claudedetails.com is an independent publication and is not affiliated with, endorsed by, or sponsored by Anthropic. "Claude" is a trademark of Anthropic, PBC, used here for identification purposes only. Product details can change — always confirm specifics on Anthropic's own site before making decisions based on this post.

FAQ

What model does the Explore subagent use in Claude Code?

As of Claude Code v2.1.198, Explore inherits the main conversation's model instead of always running on Haiku. On the Claude API, the inherited model is capped at Opus, so a session on Sonnet or Haiku runs Explore on that same model. On other providers like Amazon Bedrock, Explore inherits the main conversation's model directly. You can override this by defining a user or project subagent named Explore with model: haiku to keep exploration on a lower-cost model.

How do I disable subagents in Claude Code?

You have several options: add a specific built-in type to permissions.deny to block it; deny the Agent tool itself with permissions.deny to prevent any subagent delegation; or set CLAUDE_CODE_DISABLE_EXPLORE_PLAN_AGENTS=1 (requires v2.1.198 or later) to remove only the built-in Explore and Plan subagents, in which case Claude reads and explores files directly instead.

Do subagents read my CLAUDE.md files?

The built-in Explore and Plan subagents skip your CLAUDE.md files and the parent session's git status to keep research fast and inexpensive. Every other built-in and custom subagent loads both.

Can the Explore or Plan subagent edit files?

No. Both Explore and Plan use read-only tools, and the Write and Edit tools are explicitly denied for them. If a task requires both exploration and modification, Claude delegates to the general-purpose subagent instead, which has access to every tool available to subagents.

More in Claude Code

Claude CodeBEGINNER
Aug 12, 2026

Common Claude Code Workflows: Exploring Code, Fixing Bugs, Testing, and PRs

This guide walks through the everyday prompt patterns Anthropic documents for Claude Code: getting an overview of an unfamiliar codebase, locating relevant files, fixing bugs from error messages, refactoring legacy code safely, adding tests for uncovered code, creating pull requests, and generating documentation. It also notes related workflows the docs cover, such as resuming sessions, running parallel sessions with worktrees, planning before edits, delegating research to subagents, and piping Claude into scripts.

Read guide →
Claude CodeINTERMEDIATE
Aug 11, 2026

Using Claude Code on a React Project: CLAUDE.md, Permissions, and Workflow Tips

Claude Code has no React-specific mode — what actually makes it effective on a React codebase is the same CLAUDE.md and permissions setup that works on any project, applied deliberately. This guide walks through what to put in CLAUDE.md for a React app, which commands to allow, and how to structure a component or test-fixing session.

Read guide →
Claude CodeBEGINNER
Aug 11, 2026

How to Create Your First Claude Code Plugin: Manifest, Skills, and Local Testing

This guide explains how to create a custom Claude Code plugin from scratch. It covers when to use a plugin versus standalone configuration in the .claude directory, how to structure a plugin directory with a .claude-plugin/plugin.json manifest, how to add a skill using a SKILL.md file, how to test the plugin locally with the --plugin-dir flag, and how to make skills accept user input with the $ARGUMENTS placeholder. It is based on Anthropic's documentation for Claude Code plugins.

Read guide →
ClaudeDetails
UpdatesGuidesModelsMCPToolsLearning PathsFAQRSS
Get new guides and Claude updates by email

Occasional, no spam. Unsubscribe anytime.

claudedetails.com is an independent publication and is not affiliated with, endorsed by, or sponsored by Anthropic. "Claude" is a trademark of Anthropic, PBC, used here for identification purposes only. Product details can change — always confirm specifics on Anthropic's own site before making decisions based on this post.