published fresh until

Claude Code: delegate work to isolated subagents

Summary As of November 2026, define a specialist in .claude/agents/ with required name and description, restrict tools, and ask Claude to delegate. Fresh context isolates conversation history; repository edits need a temporary Git worktree via isolation: worktree.

Not for Codex custom TOML agents.

For your agent
claude mcp add --transport http --scope user whatworks https://whatworks.dev/mcp

Read-only, no account. Sign-in is only for trial reports: /connect.md

What this thread does

Do first: Ask Claude to create a project specialist under .claude/agents/, give it a bounded task and return format, and explicitly request delegation to it.

Short answer

A normal subagent starts with fresh conversation context. To isolate repository edits too, set isolation: worktree. A separate context alone leaves the subagent in the parent's working directory.

What to do

Create a Markdown file with YAML frontmatter between opening and closing ---, followed by the specialist's system prompt. For a reviewer, the documented example is .claude/agents/code-reviewer.md.

Field / controlValue / action
Required fieldsname, description; description tells Claude when to delegate
Name constraintsAt most 256 characters; cannot start with - or contain :; identity comes from name, not filename
Read-only review toolstools: Read, Glob, Grep; omit tools to inherit all tools available to subagents
Denied toolsdisallowedTools; tool specifiers such as Bash(git push *) remove the entire tool
Modelsonnet, opus, haiku, fable, full ID such as claude-opus-5-5, or inherit; omitted normally uses the parent's model
Model precedenceInvocation model alias → definition model → CLAUDE_CODE_SUBAGENT_MODEL → parent's model
Own efforteffort: low, medium, high, xhigh, max, subject to model support; invocation effort overrides definition, but CLAUDE_CODE_EFFORT_LEVEL wins over both; invocation parameter requires v2.1.292 or later
Repository isolationisolation: worktree; temporary worktree branches from the default branch, not necessarily parent HEAD; automatically removed if unchanged
Bounded runmaxTurns; reaching it returns partial output that can be resumed; partial marker requires v2.1.246 or later
PermissionspermissionMode: default (alias manual), acceptEdits, auto, dontAsk, bypassPermissions, plan; omitted inherits main mode
Permission constraintsParent bypassPermissions, acceptEdits or auto forces that mode; parent plan keeps plan, and dontAsk also denies prompts; default/dontAsk parents honor the requested mode except unavailable auto or bypassPermissions; bypass exception requires v2.1.267 or later

Ask for a specific agent and a concise report; include file scope, evidence to return, and whether to wait. Non-fork subagents do not receive your conversation history. A fork does inherit it.

Definitions in an existing project agents directory reload within seconds for the next delegation. Restart after creating the first agents directory, editing an agents directory loaded via --add-dir or /add-dir, or using a session with --disable-slash-commands. Project directories are scanned recursively; the definition nearest the working directory wins across nested project directories. Same-directory duplicate names depend on filesystem order; use /doctor to locate them.

Background execution is the default. In interactive terminal, VS Code or desktop sessions, to let Claude wait: set CLAUDE_CODE_FORK_SUBAGENT=0 in the environment or settings.json, start a new session, then ask it to wait for the report. Ctrl+B moves waiting work into the background. Alternatively, CLAUDE_CODE_DISABLE_BACKGROUND_TASKS=1 makes Claude wait and disables background commands and Ctrl+B.

Background permission prompts appear in the main session; Esc denies one tool call. Results arrive in a completion notification. /tasks shows a subagent's model and effort from v2.1.242; ask Claude to resume a completed custom subagent when needed.

Limits and open questions

  • Default running-agent threshold: 20. Another Agent-tool spawn returns Concurrent subagent limit reached; wait until the running count drops. CLAUDE_CODE_MAX_CONCURRENT_SUBAGENTS accepts any positive whole number; available from v2.1.217. Ultracode sessions are exempt; forks and resumes can occupy slots without being blocked by this limit.
  • A named Agent call in interactive agent-teams mode can become a teammate in the main checkout. Pass isolation on the invocation itself to preserve the subagent path; frontmatter isolation alone does not prevent that conversion.
  • Plugin agents ignore hooks, mcpServers, permissionMode; copy the definition into project scope when those fields are needed.
  • Worktree isolation is not an independent permission boundary. Review allowed tools and parent permissions.

Not for: Codex custom TOML agents.

Sources

Checked

2026-11-16; read Create custom subagents and its Markdown version, including scope, frontmatter, model/effort selection, isolation, permissions, background runs and concurrency; no command was run.

Started from a post by @Anthropic Claude Code documentation, packaged by the editor. Original post

Subjects

More in agent workflows

For agents

Copy a short instruction for an agent that has WhatWorks connected, or open this page as Markdown.

# Claude Code: delegate work to isolated subagents
Summary: As of November 2026, define a specialist in `.claude/agents/` with required `name` and `description`, restrict `tools`, and ask Claude to delegate. Fresh context isolates conversation history; repository edits need a temporary Git worktree via `isolation: worktree`.
Copy for agent
get the whatworks thread claude-code-delegate-isolated-subagent-work and help me try it

Follow this thread

Following tells you when the verdict changes, a new version ships or a new option is added. Your agent mentions it the next time you ask WhatWorks.

Sign in with GitHub to follow. Nothing is posted for you.

Sign in with GitHub

Or ask your agent
follow the whatworks thread claude-code-delegate-isolated-subagent-work
WhatWorks

Connect your agent MCP

Paste this into your agent

Connect me to WhatWorks: add https://whatworks.dev/mcp/login and sign me in so I have an account. Steps: https://whatworks.dev/connect.md.

Or run this in your terminal
  • Claude Codeclaude mcp add --transport http --scope user whatworks https://whatworks.dev/mcp/login && claude mcp login whatworks
  • Codexcodex mcp add whatworks --url https://whatworks.dev/mcp/login && codex mcp login whatworks