Follow Discord
Sweep 03 Dec 2026 · 19:13Z Build v2.1.336 553 read Stable v2.1.332 Latest v2.1.336 Next v2.1.336 Feeds RSS JSON llms.txt llms-full.txt Unofficial
One change · claude-code

Create custom subagents changedsub-agents

Nearest release: v2.1.334, published 6 hours before upstream edited the page. Shown because the two are within 24 hours of each other. Nothing here says the release caused the edit.

Upstream edited this page at 2 Dec 2026 01:25 UTC, give or take a minute or two: the time comes from Anthropic’s own sitemap rather than from a commit. This site recorded the change at 2 Dec 2026 01:37 UTC.

Upstream edited
Recorded here
Lines+13added
Lines−11removed
From line 4 where the diff opens
First seen 14 Aug 2026 this site's first read of the page
Recorded edits128to this page, all time

The whole hunk

from line 4, old and new numbered
/
lines
from line 4
44 
55Subagents are specialized AI assistants that handle specific types of tasks. 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. Define a custom subagent when you keep spawning the same kind of worker with the same instructions.
66 
7Each subagent runs in its own context window with a custom system prompt, specific tool access, and independent permissions. It also sends its own requests, which count toward the same [usage limits](https://code.claude.com/docs/en/costs.md#plan-usage-breakdown) as your main conversation. When Claude encounters a task that matches a subagent's description, it delegates to that subagent, which works independently and returns results. To see the context savings in practice, the [context window visualization](https://code.claude.com/docs/en/context-window.md) walks through a session where a subagent handles research in its own separate window.
7Each subagent runs in its own context window with a custom system prompt, specific tool access, and your [permission rules](https://code.claude.com/docs/en/permissions.md). It also sends its own requests, which count toward the same [usage limits](https://code.claude.com/docs/en/costs.md#plan-usage-breakdown) as your main conversation. To see how a subagent saves context, open the [context window visualization](https://code.claude.com/docs/en/context-window.md).
88 
99> [!NOTE]
1010>
from line 30
3030 
3131> [tab] Explore
3232>
33> A fast, read-only agent optimized for searching and analyzing codebases.
33> A fast agent optimized for searching and analyzing codebases.
3434>
3535> * **Model**: the [parent conversation's](#which-model-a-nested-subagent-runs-on) model. When the parent conversation runs Fable, Explore runs on Opus or stays on Fable, based on how you connect.
3636> * With a Claude subscription, an Anthropic Console account, or an [LLM gateway](https://code.claude.com/docs/en/llm-gateway) reached through `ANTHROPIC_BASE_URL`, Explore runs on the Opus model that the [`opus` alias](https://code.claude.com/docs/en/model-config#model-aliases) resolves to.
3737> * On Amazon Bedrock, Google Cloud's Agent Platform, Microsoft Foundry, [Claude Platform on AWS](https://code.claude.com/docs/en/claude-platform-on-aws.md), or a [Claude apps gateway](https://code.claude.com/docs/en/claude-apps-gateway), Explore stays on Fable.
38> * **Tools**: read-only tools; Write and Edit are denied
38> * **Tools**: includes Bash and MCP tools; excludes Edit, Write, and NotebookEdit
3939> * **Purpose**: file discovery, code search, codebase exploration
4040>
4141> A [user or project subagent](#choose-the-subagent-scope) named `Explore` overrides the built-in and keeps its own `model` field, so define one with `model: haiku` to run exploration on a lower-cost model. To force one model onto every subagent, Explore included, see [Run every subagent on one model](#run-every-subagent-on-one-model).
from line 49
4949> A research agent used during [plan mode](https://code.claude.com/docs/en/permission-modes.md#analyze-before-you-edit-with-plan-mode) to gather context before presenting a plan.
5050>
5151> * **Model**: inherits from the [parent conversation](#which-model-a-nested-subagent-runs-on), unless you set `CLAUDE_CODE_SUBAGENT_MODEL` and [force it onto every subagent](#run-every-subagent-on-one-model)
52> * **Tools**: read-only tools; Write and Edit are denied
52> * **Tools**: includes Bash and MCP tools; excludes Edit, Write, and NotebookEdit
5353> * **Purpose**: codebase research for planning
5454>
5555> When you're in plan mode and Claude needs to understand your codebase, it delegates research to the Plan subagent so that exploration output stays in a separate context window while the main conversation remains read-only.
from line 300
300300| `maxTurns` | No | Maximum number of agentic turns before the subagent stops. When the subagent reaches the limit, Claude Code returns its output marked as partial, and Claude can [resume it](#resume-subagents) to continue. The partial marking requires Claude Code v2.1.246 or later |
301301| `autoCompactWindow` | No | Lower the [auto-compact window](#subagent-auto-compact-window) for this subagent to a token count of `100000` or more. Requires Claude Code v2.1.296 or later |
302302| `skills` | No | [Skills](https://code.claude.com/docs/en/skills.md) to preload into the subagent's context at startup. The full skill content is injected, not only the description. Subagents can still invoke unlisted project, user, and plugin skills through the Skill tool |
303| `mcpServers` | No | [MCP servers](https://code.claude.com/docs/en/mcp.md) available to this subagent. Each entry is either a server name referencing an already-configured server (e.g., `"slack"`) or an inline definition with the server name as key and a full [MCP server config](https://code.claude.com/docs/en/mcp.md#installing-mcp-servers) as value. Ignored for [plugin subagents](#choose-the-subagent-scope) |
303| `mcpServers` | No | [MCP servers](https://code.claude.com/docs/en/mcp.md) to add to any that this subagent inherits. Each entry is the name of an already-configured server, such as `"slack"`, or an inline definition with the server name as key and a full [MCP server config](https://code.claude.com/docs/en/mcp.md#installing-mcp-servers) as value. Ignored for [plugin subagents](#choose-the-subagent-scope) |
304304| `hooks` | No | [Lifecycle hooks](#define-hooks-for-subagents) scoped to this subagent. Ignored for [plugin subagents](#choose-the-subagent-scope) |
305305| `memory` | No | [Persistent memory scope](#enable-persistent-memory): `user`, `project`, or `local`. Enables cross-session learning |
306306| `background` | No | Set to `true` to keep this subagent in the background even when Claude asks to wait for it. By default, custom subagents Claude spawns from the main conversation already [start in the background](#run-subagents-in-foreground-or-background) |
from line 472
472472 
473473To restrict tools, use the `tools` field as an allowlist or the `disallowedTools` field as a denylist. If both are set, `disallowedTools` is applied first, then `tools` is resolved against the remaining pool. A tool listed in both is removed.
474474 
475This example uses `tools` to allow only Read, Grep, Glob, and Bash. The subagent has no Edit, Write, or MCP tools but can still change files through Bash:
475This example uses `tools` to allow only Read, Grep, Glob, and Bash. The subagent can still change files through Bash:
476476 
477477```yaml theme={null}
478478---
from line 690
690690 
691691* The subagent's system prompt includes instructions for reading and writing to the memory directory.
692692* The subagent's system prompt also includes the first 200 lines or 25KB of `MEMORY.md` in the memory directory, whichever comes first, with instructions to curate `MEMORY.md` if it exceeds that limit.
693* Read, Write, and Edit tools are automatically enabled so the subagent can manage its memory files.
693* Claude Code adds Read, Write, and Edit to the subagent's tools, and they work outside the memory directory too. To remove one, list it in `disallowedTools`.
694694 
695695##### Persistent memory tips
696696 
from line 710
710710 
711711For more dynamic control over tool usage, use `PreToolUse` hooks to validate operations before they execute. This is useful when you need to allow some operations of a tool while blocking others.
712712 
713This example creates a subagent that only allows read-only database queries. The `PreToolUse` hook runs the script specified in `command` before each Bash tool call executes:
713This example creates a subagent whose hook blocks commands that contain common SQL write keywords. The hook lets other writes through, so connect with a read-only database user. The `PreToolUse` hook runs the script specified in `command` before each Bash tool call executes:
714714 
715715```yaml theme={null}
716716---
from line 1324
13241324 
13251325### Code reviewer
13261326 
1327A subagent that reviews code without the Edit and Write tools. It can still change files through Bash.
1327A subagent that reviews code. It can change files through Bash.
13281328 
13291329```markdown theme={null}
13301330---
from line 1435
14351435 
14361436### Database query validator
14371437 
1438A subagent that allows Bash access but validates commands to permit only read-only SQL queries. This example shows how to use `PreToolUse` hooks for conditional validation when you need finer control than the `tools` field provides.
1438A subagent with Bash access whose hook blocks commands that contain common SQL write keywords. The hook lets other writes through, so connect with a read-only database user. Use a `PreToolUse` hook like this when you need finer control than the `tools` field provides.
14391439 
14401440```markdown theme={null}
14411441---
from line 1497
14971497 
14981498See [Hooks](https://code.claude.com/docs/en/hooks.md#exit-code-output) for details on exit codes and [Hook input](https://code.claude.com/docs/en/hooks.md#pretooluse-input) for the complete input schema.
14991499 
1500The system prompt tells the subagent to refuse write requests, so the hook is a backstop: if the subagent attempts a write anyway, Claude Code blocks the command and the subagent sees the `Blocked: Write operations not allowed. Use SELECT queries only.` message.
1500> [!NOTE]
1501>
1502> The system prompt tells the subagent to refuse write requests, so the hook is a backstop. If a command contains one of the keywords in the script, Claude Code blocks the command and the subagent sees the `Blocked: Write operations not allowed. Use SELECT queries only.` message.
15011503 
15021504## Next steps
15031505 
Feedback