Reactify Solutions

Subagents

A subagent runs a task in its own context window and hands back a summary. Use one to keep noisy work out of your main conversation, or to route a task to a cheaper model.

Claude CodeLast reviewed September 3, 2026
In one minute
  • A subagent is a separate Claude instance for one scoped task. It keeps noisy work out of your main conversation.
  • Do not give a subagent every tool by default. Omitting the tools field inherits everything, including MCP tools. List only what the task needs.
  • model lets you route a task to a cheaper tier without changing your main session's model.

What it is

A subagent is a separate Claude instance the main session can spawn to handle one scoped task. It runs in its own context window and returns only a final summary. The back-and-forth it took to get there never enters your main conversation. That is useful for two different reasons: keeping your context clean, and routing a task to a cheaper model on purpose.

What stays in your conversation
Main conversation
your context window
spawns
Subagent
its own, isolated context
returns
Final summary
the only part you see

The smallest working example

.claude/agents/code-reviewer.md
---
name: code-reviewer
description: Reviews code for quality and best practices. Use proactively after writing code.
tools: Read, Grep, Glob
model: sonnet
---
You are a code reviewer. For each issue, explain the problem, show the current code, and provide an improved version.
  • tools is explicit and short. This subagent can only read and search, not edit or run commands.
  • model picks a specific tier for this subagent only, independent of whatever model your main session is using.
  • The body below the frontmatter is this subagent's entire system prompt.
Check it worked.

Ask Claude to "review my recent changes" in a project with this file. It should hand the task to code-reviewer rather than reviewing inline.

How it behaves

  • Subagent files live in .claude/agents/ (project) or ~/.claude/agents/ (personal), scanned recursively.
  • Omitting tools inherits every tool the main thread has, including MCP tools. Worth setting explicitly for anything you did not build yourself.
  • model accepts sonnet, opus, haiku, a full model ID, or inherit (the default).
  • Three built-in types ship with Claude Code: Explore (read-only, fast model by default), Plan (read-only, used in plan mode), and general-purpose.

When not to use one

A subagent is for context isolation and, optionally, cost control. If the task needs to repeat across many items in a fixed structure, that is a workflow. If it should trigger automatically when Claude recognises a pattern, that is a skill. If you need to trigger it yourself by name on demand, that is a slash command.

Last reviewed September 3, 2026 · verified against Anthropic's Claude Code docs, Sep 2026