派活 · Subagents、并行与后台Delegate · Subagents, Parallelism, and Background Tasks.
一个上下文装不下一件大事:读遍二十个文件找一处调用、同时审五个维度、跑一个 migration。Claude Code 让你把活派给 subagent —— 独立上下文、干完只把结论交回来;可以一次并行铺开许多个,也可以丢到后台让它自己跑、跑完叫你。这是「编排台」这个词的实体:你不再自己钻进每个文件,而是拆活、派活、收活。这一章讲什么活值得派、怎么并行、后台任务什么时候用,以及自定义 agent 类型怎么让每支队伍各司其职。One context can't hold a big job: reading twenty files to find one call site, reviewing five dimensions at once, running a migration. Claude Code lets you delegate to subagents — each with its own context, handing back only the conclusion; you can fan out many in parallel, or drop one into the background to run and call you when it's done. This is what 'orchestration console' means in the flesh: instead of burrowing into every file yourself, you split, delegate, and collect. What's worth delegating, how to parallelize, when to use background tasks, and how custom agent types give each crew its own job.
11 分钟 · 初稿 2026.0711 Min · Drafted 2026.07
一个上下文装不下一件大事。读二十个文件找一处调用,找到时上下文已经塞满了搜索残渣;同时审安全、性能、风格三个维度,审到第三个,第一个的标准已经被挤得模糊。到目前为止,这本书里干活的还是「一个 Claude」—— 这一章把它变成复数。subagent 是编排台这个词的实体:你不再钻进每个文件,你拆活、派活、收活。One context can't hold a big job. Read twenty files to find one call site and by the time you find it, the context is packed with search debris; review security, performance, and style at once and by the third dimension, the first one's criteria have been squeezed blurry. So far this book has run on 'one Claude' — this chapter makes it plural. Subagents are the word console made flesh: you stop burrowing into files; you split, delegate, and collect.
— I
为什么派:上下文是你最贵的资源Why Delegate: Context Is Your Costliest Resource.
subagent 的定义一句话:在自己的上下文窗口里跑的一个 Claude,带自己的系统提示和工具权限,干完只把结论交回主对话。1注 1Note 1Claude Code Docs · Subagents —— 每个 subagent 在自己的上下文窗口里运行:独立系统提示、独立工具权限,干完只把结果交回主对话。内置 Explore(只读快查)、Plan(计划模式的调研)、general-purpose(全能)。自建:.claude/agents/*.md(项目)或 ~/.claude/agents/(个人),frontmatter 必填 name 与 description(description 决定它何时被派),可配 tools、model(sonnet/opus/haiku/fable/inherit)、memory(跨会话记忆)、isolation: worktree(临时 git worktree 里跑)、maxTurns 等;/agents 创建向导已移除,直接让 Claude 写文件。运行:默认在后台跑,要结果才前台等;Ctrl+B 手动丢后台;权限弹窗仍回主会话;/tasks 看清单;subagent 可再派 subagent,最深 5 层;完成的 subagent 可用 SendMessage 按名字续跑,历史全在。截至 2026-07-17。Claude Code Docs · Subagents — each subagent runs in its own context window: its own system prompt and tool permissions, returning only results to the main conversation. Built-ins: Explore (fast read-only search), Plan (research during plan mode), general-purpose. Custom: .claude/agents/*.md (project) or ~/.claude/agents/ (personal); frontmatter requires name and description (the description decides when it gets the job), with optional tools, model (sonnet/opus/haiku/fable/inherit), memory (cross-session), isolation: worktree (runs in a temporary git worktree), maxTurns, and more; the /agents creation wizard is removed — ask Claude to write the file. Runtime: subagents run in the background by default, foregrounding only when the result is needed now; Ctrl+B backgrounds a running task; permission prompts still surface in your main session; /tasks lists them; a subagent can spawn subagents, up to 5 levels deep; a finished subagent can be resumed by name via SendMessage with its full history intact. As of 2026-07-17.它解决的问题在第 2 章末尾就埋下了:主对话的上下文是你最贵的资源,而调研恰恰是最脏的活 —— 官方的建议直白:用 subagents 做调研,探索的几十次文件读取都发生在别处,你的主对话只收到三段结论。2注 2Note 2Claude Code Docs · Best practices —— 上下文是根本约束,「用 subagents 做调研」:探索在独立上下文里发生,主对话只收结论;并行的几条路:git worktrees 里开多个 CLI 会话互不打架、桌面端多会话、云端会话;fan out:循环调用 claude -p 批量分发。截至 2026-07-17。Claude Code Docs · Best practices — context is the fundamental constraint; 'use subagents for investigation': exploration happens in a separate context and the main conversation receives only findings. Parallel routes: multiple CLI sessions in git worktrees that can't collide, desktop multi-session, cloud sessions; fan out by looping claude -p across a task list. As of 2026-07-17.其实你已经见过它干活:Claude 平时自己就会把搜索派给内置的 Explore(只读快查),计划模式的调研派给 Plan。1注 1Note 1Claude Code Docs · Subagents —— 每个 subagent 在自己的上下文窗口里运行:独立系统提示、独立工具权限,干完只把结果交回主对话。内置 Explore(只读快查)、Plan(计划模式的调研)、general-purpose(全能)。自建:.claude/agents/*.md(项目)或 ~/.claude/agents/(个人),frontmatter 必填 name 与 description(description 决定它何时被派),可配 tools、model(sonnet/opus/haiku/fable/inherit)、memory(跨会话记忆)、isolation: worktree(临时 git worktree 里跑)、maxTurns 等;/agents 创建向导已移除,直接让 Claude 写文件。运行:默认在后台跑,要结果才前台等;Ctrl+B 手动丢后台;权限弹窗仍回主会话;/tasks 看清单;subagent 可再派 subagent,最深 5 层;完成的 subagent 可用 SendMessage 按名字续跑,历史全在。截至 2026-07-17。Claude Code Docs · Subagents — each subagent runs in its own context window: its own system prompt and tool permissions, returning only results to the main conversation. Built-ins: Explore (fast read-only search), Plan (research during plan mode), general-purpose. Custom: .claude/agents/*.md (project) or ~/.claude/agents/ (personal); frontmatter requires name and description (the description decides when it gets the job), with optional tools, model (sonnet/opus/haiku/fable/inherit), memory (cross-session), isolation: worktree (runs in a temporary git worktree), maxTurns, and more; the /agents creation wizard is removed — ask Claude to write the file. Runtime: subagents run in the background by default, foregrounding only when the result is needed now; Ctrl+B backgrounds a running task; permission prompts still surface in your main session; /tasks lists them; a subagent can spawn subagents, up to 5 levels deep; a finished subagent can be resumed by name via SendMessage with its full history intact. As of 2026-07-17.这一章教你的,是主动派、成建制地派。The one-line definition: a Claude running in its own context window, with its own system prompt and tool permissions, handing back only conclusions.1注 1Note 1Claude Code Docs · Subagents —— 每个 subagent 在自己的上下文窗口里运行:独立系统提示、独立工具权限,干完只把结果交回主对话。内置 Explore(只读快查)、Plan(计划模式的调研)、general-purpose(全能)。自建:.claude/agents/*.md(项目)或 ~/.claude/agents/(个人),frontmatter 必填 name 与 description(description 决定它何时被派),可配 tools、model(sonnet/opus/haiku/fable/inherit)、memory(跨会话记忆)、isolation: worktree(临时 git worktree 里跑)、maxTurns 等;/agents 创建向导已移除,直接让 Claude 写文件。运行:默认在后台跑,要结果才前台等;Ctrl+B 手动丢后台;权限弹窗仍回主会话;/tasks 看清单;subagent 可再派 subagent,最深 5 层;完成的 subagent 可用 SendMessage 按名字续跑,历史全在。截至 2026-07-17。Claude Code Docs · Subagents — each subagent runs in its own context window: its own system prompt and tool permissions, returning only results to the main conversation. Built-ins: Explore (fast read-only search), Plan (research during plan mode), general-purpose. Custom: .claude/agents/*.md (project) or ~/.claude/agents/ (personal); frontmatter requires name and description (the description decides when it gets the job), with optional tools, model (sonnet/opus/haiku/fable/inherit), memory (cross-session), isolation: worktree (runs in a temporary git worktree), maxTurns, and more; the /agents creation wizard is removed — ask Claude to write the file. Runtime: subagents run in the background by default, foregrounding only when the result is needed now; Ctrl+B backgrounds a running task; permission prompts still surface in your main session; /tasks lists them; a subagent can spawn subagents, up to 5 levels deep; a finished subagent can be resumed by name via SendMessage with its full history intact. As of 2026-07-17. The problem it solves was planted at the end of chapter 2: your main conversation's context is your costliest resource, and research is precisely the dirtiest work — the official advice is blunt: use subagents for investigation, so the dozens of file reads happen elsewhere and your conversation receives three paragraphs of findings.2注 2Note 2Claude Code Docs · Best practices —— 上下文是根本约束,「用 subagents 做调研」:探索在独立上下文里发生,主对话只收结论;并行的几条路:git worktrees 里开多个 CLI 会话互不打架、桌面端多会话、云端会话;fan out:循环调用 claude -p 批量分发。截至 2026-07-17。Claude Code Docs · Best practices — context is the fundamental constraint; 'use subagents for investigation': exploration happens in a separate context and the main conversation receives only findings. Parallel routes: multiple CLI sessions in git worktrees that can't collide, desktop multi-session, cloud sessions; fan out by looping claude -p across a task list. As of 2026-07-17. You've already seen them work, in fact: Claude routinely hands searches to the built-in Explore (fast, read-only) and plan-mode research to Plan.1注 1Note 1Claude Code Docs · Subagents —— 每个 subagent 在自己的上下文窗口里运行:独立系统提示、独立工具权限,干完只把结果交回主对话。内置 Explore(只读快查)、Plan(计划模式的调研)、general-purpose(全能)。自建:.claude/agents/*.md(项目)或 ~/.claude/agents/(个人),frontmatter 必填 name 与 description(description 决定它何时被派),可配 tools、model(sonnet/opus/haiku/fable/inherit)、memory(跨会话记忆)、isolation: worktree(临时 git worktree 里跑)、maxTurns 等;/agents 创建向导已移除,直接让 Claude 写文件。运行:默认在后台跑,要结果才前台等;Ctrl+B 手动丢后台;权限弹窗仍回主会话;/tasks 看清单;subagent 可再派 subagent,最深 5 层;完成的 subagent 可用 SendMessage 按名字续跑,历史全在。截至 2026-07-17。Claude Code Docs · Subagents — each subagent runs in its own context window: its own system prompt and tool permissions, returning only results to the main conversation. Built-ins: Explore (fast read-only search), Plan (research during plan mode), general-purpose. Custom: .claude/agents/*.md (project) or ~/.claude/agents/ (personal); frontmatter requires name and description (the description decides when it gets the job), with optional tools, model (sonnet/opus/haiku/fable/inherit), memory (cross-session), isolation: worktree (runs in a temporary git worktree), maxTurns, and more; the /agents creation wizard is removed — ask Claude to write the file. Runtime: subagents run in the background by default, foregrounding only when the result is needed now; Ctrl+B backgrounds a running task; permission prompts still surface in your main session; /tasks lists them; a subagent can spawn subagents, up to 5 levels deep; a finished subagent can be resumed by name via SendMessage with its full history intact. As of 2026-07-17. What this chapter teaches is delegating deliberately, and in formation.什么活值得派?三个信号:过程你不需要看,只要结论(调研、找调用点);量大而平行(一百个文件各查一遍);或者你想要一个不带偏见的新脑子(第 9 章的复审)。反例也清楚:三轮以内你要来回指挥的活,派出去的沟通成本比省下的上下文还贵。What's worth delegating? Three signals: you don't need the process, only the conclusion (research, call-site hunting); the work is large and parallel (a hundred files, one check each); or you want a fresh mind without bias (chapter 9's re-review). The counter-case is just as clear: work you'll steer back and forth within three rounds costs more in handoff than it saves in context.
— II
建队:一个 markdown 文件一个兵种Build the Crew: One Markdown File per Specialty.
反复派同一类活,就该把那类工人定义下来。自定义 subagent 是一个带 frontmatter 的 markdown 文件,项目级放 .claude/agents/(进版本库,全队共用),个人级放 ~/.claude/agents/。1注 1Note 1Claude Code Docs · Subagents —— 每个 subagent 在自己的上下文窗口里运行:独立系统提示、独立工具权限,干完只把结果交回主对话。内置 Explore(只读快查)、Plan(计划模式的调研)、general-purpose(全能)。自建:.claude/agents/*.md(项目)或 ~/.claude/agents/(个人),frontmatter 必填 name 与 description(description 决定它何时被派),可配 tools、model(sonnet/opus/haiku/fable/inherit)、memory(跨会话记忆)、isolation: worktree(临时 git worktree 里跑)、maxTurns 等;/agents 创建向导已移除,直接让 Claude 写文件。运行:默认在后台跑,要结果才前台等;Ctrl+B 手动丢后台;权限弹窗仍回主会话;/tasks 看清单;subagent 可再派 subagent,最深 5 层;完成的 subagent 可用 SendMessage 按名字续跑,历史全在。截至 2026-07-17。Claude Code Docs · Subagents — each subagent runs in its own context window: its own system prompt and tool permissions, returning only results to the main conversation. Built-ins: Explore (fast read-only search), Plan (research during plan mode), general-purpose. Custom: .claude/agents/*.md (project) or ~/.claude/agents/ (personal); frontmatter requires name and description (the description decides when it gets the job), with optional tools, model (sonnet/opus/haiku/fable/inherit), memory (cross-session), isolation: worktree (runs in a temporary git worktree), maxTurns, and more; the /agents creation wizard is removed — ask Claude to write the file. Runtime: subagents run in the background by default, foregrounding only when the result is needed now; Ctrl+B backgrounds a running task; permission prompts still surface in your main session; /tasks lists them; a subagent can spawn subagents, up to 5 levels deep; a finished subagent can be resumed by name via SendMessage with its full history intact. As of 2026-07-17.必填只有两项:name,和决定命运的 description —— Claude 靠它判断什么任务该派给谁,写得越清楚,派工越准。1注 1Note 1Claude Code Docs · Subagents —— 每个 subagent 在自己的上下文窗口里运行:独立系统提示、独立工具权限,干完只把结果交回主对话。内置 Explore(只读快查)、Plan(计划模式的调研)、general-purpose(全能)。自建:.claude/agents/*.md(项目)或 ~/.claude/agents/(个人),frontmatter 必填 name 与 description(description 决定它何时被派),可配 tools、model(sonnet/opus/haiku/fable/inherit)、memory(跨会话记忆)、isolation: worktree(临时 git worktree 里跑)、maxTurns 等;/agents 创建向导已移除,直接让 Claude 写文件。运行:默认在后台跑,要结果才前台等;Ctrl+B 手动丢后台;权限弹窗仍回主会话;/tasks 看清单;subagent 可再派 subagent,最深 5 层;完成的 subagent 可用 SendMessage 按名字续跑,历史全在。截至 2026-07-17。Claude Code Docs · Subagents — each subagent runs in its own context window: its own system prompt and tool permissions, returning only results to the main conversation. Built-ins: Explore (fast read-only search), Plan (research during plan mode), general-purpose. Custom: .claude/agents/*.md (project) or ~/.claude/agents/ (personal); frontmatter requires name and description (the description decides when it gets the job), with optional tools, model (sonnet/opus/haiku/fable/inherit), memory (cross-session), isolation: worktree (runs in a temporary git worktree), maxTurns, and more; the /agents creation wizard is removed — ask Claude to write the file. Runtime: subagents run in the background by default, foregrounding only when the result is needed now; Ctrl+B backgrounds a running task; permission prompts still surface in your main session; /tasks lists them; a subagent can spawn subagents, up to 5 levels deep; a finished subagent can be resumed by name via SendMessage with its full history intact. As of 2026-07-17.When you keep delegating the same kind of job, define that kind of worker. A custom subagent is a markdown file with frontmatter: project-level in .claude/agents/ (checked in, shared by the team), personal in ~/.claude/agents/.1注 1Note 1Claude Code Docs · Subagents —— 每个 subagent 在自己的上下文窗口里运行:独立系统提示、独立工具权限,干完只把结果交回主对话。内置 Explore(只读快查)、Plan(计划模式的调研)、general-purpose(全能)。自建:.claude/agents/*.md(项目)或 ~/.claude/agents/(个人),frontmatter 必填 name 与 description(description 决定它何时被派),可配 tools、model(sonnet/opus/haiku/fable/inherit)、memory(跨会话记忆)、isolation: worktree(临时 git worktree 里跑)、maxTurns 等;/agents 创建向导已移除,直接让 Claude 写文件。运行:默认在后台跑,要结果才前台等;Ctrl+B 手动丢后台;权限弹窗仍回主会话;/tasks 看清单;subagent 可再派 subagent,最深 5 层;完成的 subagent 可用 SendMessage 按名字续跑,历史全在。截至 2026-07-17。Claude Code Docs · Subagents — each subagent runs in its own context window: its own system prompt and tool permissions, returning only results to the main conversation. Built-ins: Explore (fast read-only search), Plan (research during plan mode), general-purpose. Custom: .claude/agents/*.md (project) or ~/.claude/agents/ (personal); frontmatter requires name and description (the description decides when it gets the job), with optional tools, model (sonnet/opus/haiku/fable/inherit), memory (cross-session), isolation: worktree (runs in a temporary git worktree), maxTurns, and more; the /agents creation wizard is removed — ask Claude to write the file. Runtime: subagents run in the background by default, foregrounding only when the result is needed now; Ctrl+B backgrounds a running task; permission prompts still surface in your main session; /tasks lists them; a subagent can spawn subagents, up to 5 levels deep; a finished subagent can be resumed by name via SendMessage with its full history intact. As of 2026-07-17. Only two fields are required: name, and the fate-deciding description — Claude reads it to decide which tasks go to whom, and the clearer it is, the truer the dispatch.1注 1Note 1Claude Code Docs · Subagents —— 每个 subagent 在自己的上下文窗口里运行:独立系统提示、独立工具权限,干完只把结果交回主对话。内置 Explore(只读快查)、Plan(计划模式的调研)、general-purpose(全能)。自建:.claude/agents/*.md(项目)或 ~/.claude/agents/(个人),frontmatter 必填 name 与 description(description 决定它何时被派),可配 tools、model(sonnet/opus/haiku/fable/inherit)、memory(跨会话记忆)、isolation: worktree(临时 git worktree 里跑)、maxTurns 等;/agents 创建向导已移除,直接让 Claude 写文件。运行:默认在后台跑,要结果才前台等;Ctrl+B 手动丢后台;权限弹窗仍回主会话;/tasks 看清单;subagent 可再派 subagent,最深 5 层;完成的 subagent 可用 SendMessage 按名字续跑,历史全在。截至 2026-07-17。Claude Code Docs · Subagents — each subagent runs in its own context window: its own system prompt and tool permissions, returning only results to the main conversation. Built-ins: Explore (fast read-only search), Plan (research during plan mode), general-purpose. Custom: .claude/agents/*.md (project) or ~/.claude/agents/ (personal); frontmatter requires name and description (the description decides when it gets the job), with optional tools, model (sonnet/opus/haiku/fable/inherit), memory (cross-session), isolation: worktree (runs in a temporary git worktree), maxTurns, and more; the /agents creation wizard is removed — ask Claude to write the file. Runtime: subagents run in the background by default, foregrounding only when the result is needed now; Ctrl+B backgrounds a running task; permission prompts still surface in your main session; /tasks lists them; a subagent can spawn subagents, up to 5 levels deep; a finished subagent can be resumed by name via SendMessage with its full history intact. As of 2026-07-17.
一个依赖审计员:收权、降档、带记忆A dependency auditor: scoped tools, downshifted model, with memory
frontmatter 的三个旋钮对应三种控制。tools 收权:审计员只该读和查,不该写 —— 少给的每一样工具都是少一分风险。model 降档:机械的批量活派给 haiku,便宜且快,难题才留给主对话的大模型(选型逻辑在第 10 章)。memory 让它跨会话攒经验:这个审计员下个月还记得上次哪个包坑过你。1注 1Note 1Claude Code Docs · Subagents —— 每个 subagent 在自己的上下文窗口里运行:独立系统提示、独立工具权限,干完只把结果交回主对话。内置 Explore(只读快查)、Plan(计划模式的调研)、general-purpose(全能)。自建:.claude/agents/*.md(项目)或 ~/.claude/agents/(个人),frontmatter 必填 name 与 description(description 决定它何时被派),可配 tools、model(sonnet/opus/haiku/fable/inherit)、memory(跨会话记忆)、isolation: worktree(临时 git worktree 里跑)、maxTurns 等;/agents 创建向导已移除,直接让 Claude 写文件。运行:默认在后台跑,要结果才前台等;Ctrl+B 手动丢后台;权限弹窗仍回主会话;/tasks 看清单;subagent 可再派 subagent,最深 5 层;完成的 subagent 可用 SendMessage 按名字续跑,历史全在。截至 2026-07-17。Claude Code Docs · Subagents — each subagent runs in its own context window: its own system prompt and tool permissions, returning only results to the main conversation. Built-ins: Explore (fast read-only search), Plan (research during plan mode), general-purpose. Custom: .claude/agents/*.md (project) or ~/.claude/agents/ (personal); frontmatter requires name and description (the description decides when it gets the job), with optional tools, model (sonnet/opus/haiku/fable/inherit), memory (cross-session), isolation: worktree (runs in a temporary git worktree), maxTurns, and more; the /agents creation wizard is removed — ask Claude to write the file. Runtime: subagents run in the background by default, foregrounding only when the result is needed now; Ctrl+B backgrounds a running task; permission prompts still surface in your main session; /tasks lists them; a subagent can spawn subagents, up to 5 levels deep; a finished subagent can be resumed by name via SendMessage with its full history intact. As of 2026-07-17.还有一个后面会用到的:isolation: worktree 让它在临时 git worktree 里干活 —— 这是并行改文件不打架的钥匙。1注 1Note 1Claude Code Docs · Subagents —— 每个 subagent 在自己的上下文窗口里运行:独立系统提示、独立工具权限,干完只把结果交回主对话。内置 Explore(只读快查)、Plan(计划模式的调研)、general-purpose(全能)。自建:.claude/agents/*.md(项目)或 ~/.claude/agents/(个人),frontmatter 必填 name 与 description(description 决定它何时被派),可配 tools、model(sonnet/opus/haiku/fable/inherit)、memory(跨会话记忆)、isolation: worktree(临时 git worktree 里跑)、maxTurns 等;/agents 创建向导已移除,直接让 Claude 写文件。运行:默认在后台跑,要结果才前台等;Ctrl+B 手动丢后台;权限弹窗仍回主会话;/tasks 看清单;subagent 可再派 subagent,最深 5 层;完成的 subagent 可用 SendMessage 按名字续跑,历史全在。截至 2026-07-17。Claude Code Docs · Subagents — each subagent runs in its own context window: its own system prompt and tool permissions, returning only results to the main conversation. Built-ins: Explore (fast read-only search), Plan (research during plan mode), general-purpose. Custom: .claude/agents/*.md (project) or ~/.claude/agents/ (personal); frontmatter requires name and description (the description decides when it gets the job), with optional tools, model (sonnet/opus/haiku/fable/inherit), memory (cross-session), isolation: worktree (runs in a temporary git worktree), maxTurns, and more; the /agents creation wizard is removed — ask Claude to write the file. Runtime: subagents run in the background by default, foregrounding only when the result is needed now; Ctrl+B backgrounds a running task; permission prompts still surface in your main session; /tasks lists them; a subagent can spawn subagents, up to 5 levels deep; a finished subagent can be resumed by name via SendMessage with its full history intact. As of 2026-07-17.文件不用手写:描述清楚你要的兵种,让 Claude 替你写(创建向导已移除,文件就是接口)。1注 1Note 1Claude Code Docs · Subagents —— 每个 subagent 在自己的上下文窗口里运行:独立系统提示、独立工具权限,干完只把结果交回主对话。内置 Explore(只读快查)、Plan(计划模式的调研)、general-purpose(全能)。自建:.claude/agents/*.md(项目)或 ~/.claude/agents/(个人),frontmatter 必填 name 与 description(description 决定它何时被派),可配 tools、model(sonnet/opus/haiku/fable/inherit)、memory(跨会话记忆)、isolation: worktree(临时 git worktree 里跑)、maxTurns 等;/agents 创建向导已移除,直接让 Claude 写文件。运行:默认在后台跑,要结果才前台等;Ctrl+B 手动丢后台;权限弹窗仍回主会话;/tasks 看清单;subagent 可再派 subagent,最深 5 层;完成的 subagent 可用 SendMessage 按名字续跑,历史全在。截至 2026-07-17。Claude Code Docs · Subagents — each subagent runs in its own context window: its own system prompt and tool permissions, returning only results to the main conversation. Built-ins: Explore (fast read-only search), Plan (research during plan mode), general-purpose. Custom: .claude/agents/*.md (project) or ~/.claude/agents/ (personal); frontmatter requires name and description (the description decides when it gets the job), with optional tools, model (sonnet/opus/haiku/fable/inherit), memory (cross-session), isolation: worktree (runs in a temporary git worktree), maxTurns, and more; the /agents creation wizard is removed — ask Claude to write the file. Runtime: subagents run in the background by default, foregrounding only when the result is needed now; Ctrl+B backgrounds a running task; permission prompts still surface in your main session; /tasks lists them; a subagent can spawn subagents, up to 5 levels deep; a finished subagent can be resumed by name via SendMessage with its full history intact. As of 2026-07-17.Three frontmatter knobs, three kinds of control. tools scopes power: an auditor should read and search, never write — every tool withheld is risk withheld. model downshifts: mechanical bulk work goes to haiku, cheap and fast, saving the big model for the main conversation's hard problems (the routing logic is chapter 10). memory lets it accumulate experience across sessions: next month this auditor still remembers which package burned you.1注 1Note 1Claude Code Docs · Subagents —— 每个 subagent 在自己的上下文窗口里运行:独立系统提示、独立工具权限,干完只把结果交回主对话。内置 Explore(只读快查)、Plan(计划模式的调研)、general-purpose(全能)。自建:.claude/agents/*.md(项目)或 ~/.claude/agents/(个人),frontmatter 必填 name 与 description(description 决定它何时被派),可配 tools、model(sonnet/opus/haiku/fable/inherit)、memory(跨会话记忆)、isolation: worktree(临时 git worktree 里跑)、maxTurns 等;/agents 创建向导已移除,直接让 Claude 写文件。运行:默认在后台跑,要结果才前台等;Ctrl+B 手动丢后台;权限弹窗仍回主会话;/tasks 看清单;subagent 可再派 subagent,最深 5 层;完成的 subagent 可用 SendMessage 按名字续跑,历史全在。截至 2026-07-17。Claude Code Docs · Subagents — each subagent runs in its own context window: its own system prompt and tool permissions, returning only results to the main conversation. Built-ins: Explore (fast read-only search), Plan (research during plan mode), general-purpose. Custom: .claude/agents/*.md (project) or ~/.claude/agents/ (personal); frontmatter requires name and description (the description decides when it gets the job), with optional tools, model (sonnet/opus/haiku/fable/inherit), memory (cross-session), isolation: worktree (runs in a temporary git worktree), maxTurns, and more; the /agents creation wizard is removed — ask Claude to write the file. Runtime: subagents run in the background by default, foregrounding only when the result is needed now; Ctrl+B backgrounds a running task; permission prompts still surface in your main session; /tasks lists them; a subagent can spawn subagents, up to 5 levels deep; a finished subagent can be resumed by name via SendMessage with its full history intact. As of 2026-07-17. One more for later: isolation: worktree runs it in a temporary git worktree — the key to parallel edits that don't collide.1注 1Note 1Claude Code Docs · Subagents —— 每个 subagent 在自己的上下文窗口里运行:独立系统提示、独立工具权限,干完只把结果交回主对话。内置 Explore(只读快查)、Plan(计划模式的调研)、general-purpose(全能)。自建:.claude/agents/*.md(项目)或 ~/.claude/agents/(个人),frontmatter 必填 name 与 description(description 决定它何时被派),可配 tools、model(sonnet/opus/haiku/fable/inherit)、memory(跨会话记忆)、isolation: worktree(临时 git worktree 里跑)、maxTurns 等;/agents 创建向导已移除,直接让 Claude 写文件。运行:默认在后台跑,要结果才前台等;Ctrl+B 手动丢后台;权限弹窗仍回主会话;/tasks 看清单;subagent 可再派 subagent,最深 5 层;完成的 subagent 可用 SendMessage 按名字续跑,历史全在。截至 2026-07-17。Claude Code Docs · Subagents — each subagent runs in its own context window: its own system prompt and tool permissions, returning only results to the main conversation. Built-ins: Explore (fast read-only search), Plan (research during plan mode), general-purpose. Custom: .claude/agents/*.md (project) or ~/.claude/agents/ (personal); frontmatter requires name and description (the description decides when it gets the job), with optional tools, model (sonnet/opus/haiku/fable/inherit), memory (cross-session), isolation: worktree (runs in a temporary git worktree), maxTurns, and more; the /agents creation wizard is removed — ask Claude to write the file. Runtime: subagents run in the background by default, foregrounding only when the result is needed now; Ctrl+B backgrounds a running task; permission prompts still surface in your main session; /tasks lists them; a subagent can spawn subagents, up to 5 levels deep; a finished subagent can be resumed by name via SendMessage with its full history intact. As of 2026-07-17. And don't write the file by hand: describe the specialty and let Claude write it (the creation wizard is gone; the file is the interface).1注 1Note 1Claude Code Docs · Subagents —— 每个 subagent 在自己的上下文窗口里运行:独立系统提示、独立工具权限,干完只把结果交回主对话。内置 Explore(只读快查)、Plan(计划模式的调研)、general-purpose(全能)。自建:.claude/agents/*.md(项目)或 ~/.claude/agents/(个人),frontmatter 必填 name 与 description(description 决定它何时被派),可配 tools、model(sonnet/opus/haiku/fable/inherit)、memory(跨会话记忆)、isolation: worktree(临时 git worktree 里跑)、maxTurns 等;/agents 创建向导已移除,直接让 Claude 写文件。运行:默认在后台跑,要结果才前台等;Ctrl+B 手动丢后台;权限弹窗仍回主会话;/tasks 看清单;subagent 可再派 subagent,最深 5 层;完成的 subagent 可用 SendMessage 按名字续跑,历史全在。截至 2026-07-17。Claude Code Docs · Subagents — each subagent runs in its own context window: its own system prompt and tool permissions, returning only results to the main conversation. Built-ins: Explore (fast read-only search), Plan (research during plan mode), general-purpose. Custom: .claude/agents/*.md (project) or ~/.claude/agents/ (personal); frontmatter requires name and description (the description decides when it gets the job), with optional tools, model (sonnet/opus/haiku/fable/inherit), memory (cross-session), isolation: worktree (runs in a temporary git worktree), maxTurns, and more; the /agents creation wizard is removed — ask Claude to write the file. Runtime: subagents run in the background by default, foregrounding only when the result is needed now; Ctrl+B backgrounds a running task; permission prompts still surface in your main session; /tasks lists them; a subagent can spawn subagents, up to 5 levels deep; a finished subagent can be resumed by name via SendMessage with its full history intact. As of 2026-07-17.
— III
铺开与后台:活不必排队,也不必等你Fan Out and Background: No Queue, No Waiting for You.
并行不需要仪式,一句话就够:「分别用 subagent 并行调研认证、数据库和 API 三个模块」—— 三个独立上下文同时开工,三份结论先后落回你的对话。2注 2Note 2Claude Code Docs · Best practices —— 上下文是根本约束,「用 subagents 做调研」:探索在独立上下文里发生,主对话只收结论;并行的几条路:git worktrees 里开多个 CLI 会话互不打架、桌面端多会话、云端会话;fan out:循环调用 claude -p 批量分发。截至 2026-07-17。Claude Code Docs · Best practices — context is the fundamental constraint; 'use subagents for investigation': exploration happens in a separate context and the main conversation receives only findings. Parallel routes: multiple CLI sessions in git worktrees that can't collide, desktop multi-session, cloud sessions; fan out by looping claude -p across a task list. As of 2026-07-17.而且默认就是后台跑的:子任务转它的,你和主对话继续聊你的,只有 Claude 立刻要用结果时才前台等;一个正跑的任务按 Ctrl+B 也能随手丢去后台,/tasks 看全部进度。1注 1Note 1Claude Code Docs · Subagents —— 每个 subagent 在自己的上下文窗口里运行:独立系统提示、独立工具权限,干完只把结果交回主对话。内置 Explore(只读快查)、Plan(计划模式的调研)、general-purpose(全能)。自建:.claude/agents/*.md(项目)或 ~/.claude/agents/(个人),frontmatter 必填 name 与 description(description 决定它何时被派),可配 tools、model(sonnet/opus/haiku/fable/inherit)、memory(跨会话记忆)、isolation: worktree(临时 git worktree 里跑)、maxTurns 等;/agents 创建向导已移除,直接让 Claude 写文件。运行:默认在后台跑,要结果才前台等;Ctrl+B 手动丢后台;权限弹窗仍回主会话;/tasks 看清单;subagent 可再派 subagent,最深 5 层;完成的 subagent 可用 SendMessage 按名字续跑,历史全在。截至 2026-07-17。Claude Code Docs · Subagents — each subagent runs in its own context window: its own system prompt and tool permissions, returning only results to the main conversation. Built-ins: Explore (fast read-only search), Plan (research during plan mode), general-purpose. Custom: .claude/agents/*.md (project) or ~/.claude/agents/ (personal); frontmatter requires name and description (the description decides when it gets the job), with optional tools, model (sonnet/opus/haiku/fable/inherit), memory (cross-session), isolation: worktree (runs in a temporary git worktree), maxTurns, and more; the /agents creation wizard is removed — ask Claude to write the file. Runtime: subagents run in the background by default, foregrounding only when the result is needed now; Ctrl+B backgrounds a running task; permission prompts still surface in your main session; /tasks lists them; a subagent can spawn subagents, up to 5 levels deep; a finished subagent can be resumed by name via SendMessage with its full history intact. As of 2026-07-17.两个让它可控的细节:后台 subagent 要权限时,弹窗仍回你的主会话,该批的还是你批;派出去的活干完不是终点 —— 用名字就能把它叫回来续跑,之前的全部上下文都在。1注 1Note 1Claude Code Docs · Subagents —— 每个 subagent 在自己的上下文窗口里运行:独立系统提示、独立工具权限,干完只把结果交回主对话。内置 Explore(只读快查)、Plan(计划模式的调研)、general-purpose(全能)。自建:.claude/agents/*.md(项目)或 ~/.claude/agents/(个人),frontmatter 必填 name 与 description(description 决定它何时被派),可配 tools、model(sonnet/opus/haiku/fable/inherit)、memory(跨会话记忆)、isolation: worktree(临时 git worktree 里跑)、maxTurns 等;/agents 创建向导已移除,直接让 Claude 写文件。运行:默认在后台跑,要结果才前台等;Ctrl+B 手动丢后台;权限弹窗仍回主会话;/tasks 看清单;subagent 可再派 subagent,最深 5 层;完成的 subagent 可用 SendMessage 按名字续跑,历史全在。截至 2026-07-17。Claude Code Docs · Subagents — each subagent runs in its own context window: its own system prompt and tool permissions, returning only results to the main conversation. Built-ins: Explore (fast read-only search), Plan (research during plan mode), general-purpose. Custom: .claude/agents/*.md (project) or ~/.claude/agents/ (personal); frontmatter requires name and description (the description decides when it gets the job), with optional tools, model (sonnet/opus/haiku/fable/inherit), memory (cross-session), isolation: worktree (runs in a temporary git worktree), maxTurns, and more; the /agents creation wizard is removed — ask Claude to write the file. Runtime: subagents run in the background by default, foregrounding only when the result is needed now; Ctrl+B backgrounds a running task; permission prompts still surface in your main session; /tasks lists them; a subagent can spawn subagents, up to 5 levels deep; a finished subagent can be resumed by name via SendMessage with its full history intact. As of 2026-07-17.嵌套也允许:subagent 自己还能再派 subagent(比如一个审查员给每条发现派一个核实员),最深五层。1注 1Note 1Claude Code Docs · Subagents —— 每个 subagent 在自己的上下文窗口里运行:独立系统提示、独立工具权限,干完只把结果交回主对话。内置 Explore(只读快查)、Plan(计划模式的调研)、general-purpose(全能)。自建:.claude/agents/*.md(项目)或 ~/.claude/agents/(个人),frontmatter 必填 name 与 description(description 决定它何时被派),可配 tools、model(sonnet/opus/haiku/fable/inherit)、memory(跨会话记忆)、isolation: worktree(临时 git worktree 里跑)、maxTurns 等;/agents 创建向导已移除,直接让 Claude 写文件。运行:默认在后台跑,要结果才前台等;Ctrl+B 手动丢后台;权限弹窗仍回主会话;/tasks 看清单;subagent 可再派 subagent,最深 5 层;完成的 subagent 可用 SendMessage 按名字续跑,历史全在。截至 2026-07-17。Claude Code Docs · Subagents — each subagent runs in its own context window: its own system prompt and tool permissions, returning only results to the main conversation. Built-ins: Explore (fast read-only search), Plan (research during plan mode), general-purpose. Custom: .claude/agents/*.md (project) or ~/.claude/agents/ (personal); frontmatter requires name and description (the description decides when it gets the job), with optional tools, model (sonnet/opus/haiku/fable/inherit), memory (cross-session), isolation: worktree (runs in a temporary git worktree), maxTurns, and more; the /agents creation wizard is removed — ask Claude to write the file. Runtime: subagents run in the background by default, foregrounding only when the result is needed now; Ctrl+B backgrounds a running task; permission prompts still surface in your main session; /tasks lists them; a subagent can spawn subagents, up to 5 levels deep; a finished subagent can be resumed by name via SendMessage with its full history intact. As of 2026-07-17.Parallelism needs no ceremony — one sentence: 'research the auth, database, and API modules in parallel with separate subagents' — three contexts start at once, three sets of findings land back in your conversation.2注 2Note 2Claude Code Docs · Best practices —— 上下文是根本约束,「用 subagents 做调研」:探索在独立上下文里发生,主对话只收结论;并行的几条路:git worktrees 里开多个 CLI 会话互不打架、桌面端多会话、云端会话;fan out:循环调用 claude -p 批量分发。截至 2026-07-17。Claude Code Docs · Best practices — context is the fundamental constraint; 'use subagents for investigation': exploration happens in a separate context and the main conversation receives only findings. Parallel routes: multiple CLI sessions in git worktrees that can't collide, desktop multi-session, cloud sessions; fan out by looping claude -p across a task list. As of 2026-07-17. And by default they run in the background: the subtask spins while you and the main conversation keep talking, foregrounding only when Claude needs the result immediately; Ctrl+B backgrounds a running task on demand, and /tasks shows them all.1注 1Note 1Claude Code Docs · Subagents —— 每个 subagent 在自己的上下文窗口里运行:独立系统提示、独立工具权限,干完只把结果交回主对话。内置 Explore(只读快查)、Plan(计划模式的调研)、general-purpose(全能)。自建:.claude/agents/*.md(项目)或 ~/.claude/agents/(个人),frontmatter 必填 name 与 description(description 决定它何时被派),可配 tools、model(sonnet/opus/haiku/fable/inherit)、memory(跨会话记忆)、isolation: worktree(临时 git worktree 里跑)、maxTurns 等;/agents 创建向导已移除,直接让 Claude 写文件。运行:默认在后台跑,要结果才前台等;Ctrl+B 手动丢后台;权限弹窗仍回主会话;/tasks 看清单;subagent 可再派 subagent,最深 5 层;完成的 subagent 可用 SendMessage 按名字续跑,历史全在。截至 2026-07-17。Claude Code Docs · Subagents — each subagent runs in its own context window: its own system prompt and tool permissions, returning only results to the main conversation. Built-ins: Explore (fast read-only search), Plan (research during plan mode), general-purpose. Custom: .claude/agents/*.md (project) or ~/.claude/agents/ (personal); frontmatter requires name and description (the description decides when it gets the job), with optional tools, model (sonnet/opus/haiku/fable/inherit), memory (cross-session), isolation: worktree (runs in a temporary git worktree), maxTurns, and more; the /agents creation wizard is removed — ask Claude to write the file. Runtime: subagents run in the background by default, foregrounding only when the result is needed now; Ctrl+B backgrounds a running task; permission prompts still surface in your main session; /tasks lists them; a subagent can spawn subagents, up to 5 levels deep; a finished subagent can be resumed by name via SendMessage with its full history intact. As of 2026-07-17. Two details that keep it governable: when a background subagent needs permission, the prompt still surfaces in your main session — you still approve what needs approving; and a finished delegation isn't an endpoint — call it back by name to resume, full context intact.1注 1Note 1Claude Code Docs · Subagents —— 每个 subagent 在自己的上下文窗口里运行:独立系统提示、独立工具权限,干完只把结果交回主对话。内置 Explore(只读快查)、Plan(计划模式的调研)、general-purpose(全能)。自建:.claude/agents/*.md(项目)或 ~/.claude/agents/(个人),frontmatter 必填 name 与 description(description 决定它何时被派),可配 tools、model(sonnet/opus/haiku/fable/inherit)、memory(跨会话记忆)、isolation: worktree(临时 git worktree 里跑)、maxTurns 等;/agents 创建向导已移除,直接让 Claude 写文件。运行:默认在后台跑,要结果才前台等;Ctrl+B 手动丢后台;权限弹窗仍回主会话;/tasks 看清单;subagent 可再派 subagent,最深 5 层;完成的 subagent 可用 SendMessage 按名字续跑,历史全在。截至 2026-07-17。Claude Code Docs · Subagents — each subagent runs in its own context window: its own system prompt and tool permissions, returning only results to the main conversation. Built-ins: Explore (fast read-only search), Plan (research during plan mode), general-purpose. Custom: .claude/agents/*.md (project) or ~/.claude/agents/ (personal); frontmatter requires name and description (the description decides when it gets the job), with optional tools, model (sonnet/opus/haiku/fable/inherit), memory (cross-session), isolation: worktree (runs in a temporary git worktree), maxTurns, and more; the /agents creation wizard is removed — ask Claude to write the file. Runtime: subagents run in the background by default, foregrounding only when the result is needed now; Ctrl+B backgrounds a running task; permission prompts still surface in your main session; /tasks lists them; a subagent can spawn subagents, up to 5 levels deep; a finished subagent can be resumed by name via SendMessage with its full history intact. As of 2026-07-17. Nesting is allowed too: a subagent can dispatch its own (a reviewer sending one verifier per finding), up to five levels deep.1注 1Note 1Claude Code Docs · Subagents —— 每个 subagent 在自己的上下文窗口里运行:独立系统提示、独立工具权限,干完只把结果交回主对话。内置 Explore(只读快查)、Plan(计划模式的调研)、general-purpose(全能)。自建:.claude/agents/*.md(项目)或 ~/.claude/agents/(个人),frontmatter 必填 name 与 description(description 决定它何时被派),可配 tools、model(sonnet/opus/haiku/fable/inherit)、memory(跨会话记忆)、isolation: worktree(临时 git worktree 里跑)、maxTurns 等;/agents 创建向导已移除,直接让 Claude 写文件。运行:默认在后台跑,要结果才前台等;Ctrl+B 手动丢后台;权限弹窗仍回主会话;/tasks 看清单;subagent 可再派 subagent,最深 5 层;完成的 subagent 可用 SendMessage 按名字续跑,历史全在。截至 2026-07-17。Claude Code Docs · Subagents — each subagent runs in its own context window: its own system prompt and tool permissions, returning only results to the main conversation. Built-ins: Explore (fast read-only search), Plan (research during plan mode), general-purpose. Custom: .claude/agents/*.md (project) or ~/.claude/agents/ (personal); frontmatter requires name and description (the description decides when it gets the job), with optional tools, model (sonnet/opus/haiku/fable/inherit), memory (cross-session), isolation: worktree (runs in a temporary git worktree), maxTurns, and more; the /agents creation wizard is removed — ask Claude to write the file. Runtime: subagents run in the background by default, foregrounding only when the result is needed now; Ctrl+B backgrounds a running task; permission prompts still surface in your main session; /tasks lists them; a subagent can spawn subagents, up to 5 levels deep; a finished subagent can be resumed by name via SendMessage with its full history intact. As of 2026-07-17.并行的硬边界在写文件:两个 agent 同时改同一份检出,就是打架。出路按重量排:只读的并行随便铺;要改文件的,给 subagent 加 isolation: worktree,各自在临时 worktree 里改自己的副本1注 1Note 1Claude Code Docs · Subagents —— 每个 subagent 在自己的上下文窗口里运行:独立系统提示、独立工具权限,干完只把结果交回主对话。内置 Explore(只读快查)、Plan(计划模式的调研)、general-purpose(全能)。自建:.claude/agents/*.md(项目)或 ~/.claude/agents/(个人),frontmatter 必填 name 与 description(description 决定它何时被派),可配 tools、model(sonnet/opus/haiku/fable/inherit)、memory(跨会话记忆)、isolation: worktree(临时 git worktree 里跑)、maxTurns 等;/agents 创建向导已移除,直接让 Claude 写文件。运行:默认在后台跑,要结果才前台等;Ctrl+B 手动丢后台;权限弹窗仍回主会话;/tasks 看清单;subagent 可再派 subagent,最深 5 层;完成的 subagent 可用 SendMessage 按名字续跑,历史全在。截至 2026-07-17。Claude Code Docs · Subagents — each subagent runs in its own context window: its own system prompt and tool permissions, returning only results to the main conversation. Built-ins: Explore (fast read-only search), Plan (research during plan mode), general-purpose. Custom: .claude/agents/*.md (project) or ~/.claude/agents/ (personal); frontmatter requires name and description (the description decides when it gets the job), with optional tools, model (sonnet/opus/haiku/fable/inherit), memory (cross-session), isolation: worktree (runs in a temporary git worktree), maxTurns, and more; the /agents creation wizard is removed — ask Claude to write the file. Runtime: subagents run in the background by default, foregrounding only when the result is needed now; Ctrl+B backgrounds a running task; permission prompts still surface in your main session; /tasks lists them; a subagent can spawn subagents, up to 5 levels deep; a finished subagent can be resumed by name via SendMessage with its full history intact. As of 2026-07-17.;要更彻底的隔离,开多个会话配 git worktrees —— 官方对多会话的第一条建议,就是一个会话占一个独立检出,互不碰撞。2注 2Note 2Claude Code Docs · Best practices —— 上下文是根本约束,「用 subagents 做调研」:探索在独立上下文里发生,主对话只收结论;并行的几条路:git worktrees 里开多个 CLI 会话互不打架、桌面端多会话、云端会话;fan out:循环调用 claude -p 批量分发。截至 2026-07-17。Claude Code Docs · Best practices — context is the fundamental constraint; 'use subagents for investigation': exploration happens in a separate context and the main conversation receives only findings. Parallel routes: multiple CLI sessions in git worktrees that can't collide, desktop multi-session, cloud sessions; fan out by looping claude -p across a task list. As of 2026-07-17.The hard boundary of parallelism is writes: two agents editing the same checkout is a collision. The routes, by weight: read-only parallelism fans out freely; for edits, give the subagent isolation: worktree so each works on its own copy in a temporary worktree1注 1Note 1Claude Code Docs · Subagents —— 每个 subagent 在自己的上下文窗口里运行:独立系统提示、独立工具权限,干完只把结果交回主对话。内置 Explore(只读快查)、Plan(计划模式的调研)、general-purpose(全能)。自建:.claude/agents/*.md(项目)或 ~/.claude/agents/(个人),frontmatter 必填 name 与 description(description 决定它何时被派),可配 tools、model(sonnet/opus/haiku/fable/inherit)、memory(跨会话记忆)、isolation: worktree(临时 git worktree 里跑)、maxTurns 等;/agents 创建向导已移除,直接让 Claude 写文件。运行:默认在后台跑,要结果才前台等;Ctrl+B 手动丢后台;权限弹窗仍回主会话;/tasks 看清单;subagent 可再派 subagent,最深 5 层;完成的 subagent 可用 SendMessage 按名字续跑,历史全在。截至 2026-07-17。Claude Code Docs · Subagents — each subagent runs in its own context window: its own system prompt and tool permissions, returning only results to the main conversation. Built-ins: Explore (fast read-only search), Plan (research during plan mode), general-purpose. Custom: .claude/agents/*.md (project) or ~/.claude/agents/ (personal); frontmatter requires name and description (the description decides when it gets the job), with optional tools, model (sonnet/opus/haiku/fable/inherit), memory (cross-session), isolation: worktree (runs in a temporary git worktree), maxTurns, and more; the /agents creation wizard is removed — ask Claude to write the file. Runtime: subagents run in the background by default, foregrounding only when the result is needed now; Ctrl+B backgrounds a running task; permission prompts still surface in your main session; /tasks lists them; a subagent can spawn subagents, up to 5 levels deep; a finished subagent can be resumed by name via SendMessage with its full history intact. As of 2026-07-17.; for full separation, run multiple sessions over git worktrees — the docs' first advice for multi-session work is one isolated checkout per session, no collisions.2注 2Note 2Claude Code Docs · Best practices —— 上下文是根本约束,「用 subagents 做调研」:探索在独立上下文里发生,主对话只收结论;并行的几条路:git worktrees 里开多个 CLI 会话互不打架、桌面端多会话、云端会话;fan out:循环调用 claude -p 批量分发。截至 2026-07-17。Claude Code Docs · Best practices — context is the fundamental constraint; 'use subagents for investigation': exploration happens in a separate context and the main conversation receives only findings. Parallel routes: multiple CLI sessions in git worktrees that can't collide, desktop multi-session, cloud sessions; fan out by looping claude -p across a task list. As of 2026-07-17.
用 <subagent 名字或 use a subagent> 做:<一句话任务>。
范围:只看 <目录 / 文件>,别展开到范围外。
交回:<结论的形状 —— 几条发现 / 一张表 / 一份 diff>,不要过程。
验收标准:<能检验的标准>(交回时对着它自查一遍)。Use <subagent name, or 'use a subagent'> to: <one-sentence task>.
Scope: only <dirs / files>; don't expand beyond it.
Return: <the shape of the conclusion — N findings / a table / a diff>, no process.
Acceptance: <a checkable standard> (self-check against it before returning).
用 dep-auditor 做:审计这次 lockfile 变更里所有主版本升级。
范围:只看 package.json、pnpm-lock.yaml 和 src/ 里的实际用法。
交回:每个包一条 —— 破坏性变更、影响到的 文件:行、迁移建议;没影响的包归成一行列表。
验收标准:每条结论都有出处链接或代码位置(交回时对着它自查一遍)。Use dep-auditor to: audit every major-version bump in this lockfile change.
Scope: only package.json, pnpm-lock.yaml, and actual usage in src/.
Return: one entry per package — the breaking change, affected file:line, migration advice; unaffected packages as a single list line.
Acceptance: every conclusion carries a source link or code location (self-check before returning).
— IV
队伍的上限:什么时候 subagent 不够用The Crew's Ceiling: When Subagents Aren't Enough.
subagent 的模型是「工人向工头汇报」:它们不互相说话,你的主对话是唯一的汇合点。要的就是这个的话 —— 绝大多数派活场景都是 —— 它是成本最低的形态。当任务真的需要多个工人互相讨论(竞争假设的调研、各占一块的大型开发),那是 agent teams 的地界:多个独立会话共享任务列表、互发消息,token 成本也按整会话计 —— 目前是实验特性,默认关闭。3注 3Note 3Claude Code Docs · Extend Claude Code —— subagent 与 agent team 的分界:subagent 在你的会话内干活、只向主 agent 汇报,适合「只要结论」的聚焦任务;agent teams 是多个互相通信、共享任务列表的独立会话,token 成本更高,适合要互相讨论的复杂协作 —— 目前为实验特性,默认关闭。截至 2026-07-17。Claude Code Docs · Extend Claude Code — the subagent / agent-team line: subagents work inside your session and report only to the main agent, right for focused only-the-result tasks; agent teams are independent sessions that message each other and share a task list, at higher token cost, right for collaboration that needs discussion — currently experimental and off by default. As of 2026-07-17.先用足 subagent,再考虑编队;多数「需要 team」的直觉,其实是「派活单没写清」。The subagent model is workers reporting to a foreman: they don't talk to each other, and your main conversation is the only meeting point. If that's what you need — and for most delegation it is — it's the cheapest formation. When a task genuinely needs workers discussing with each other — competing-hypothesis research, a large build with owned parcels — that's agent-team territory: independent sessions sharing a task list and messaging each other, at full-session token cost — currently experimental and off by default.3注 3Note 3Claude Code Docs · Extend Claude Code —— subagent 与 agent team 的分界:subagent 在你的会话内干活、只向主 agent 汇报,适合「只要结论」的聚焦任务;agent teams 是多个互相通信、共享任务列表的独立会话,token 成本更高,适合要互相讨论的复杂协作 —— 目前为实验特性,默认关闭。截至 2026-07-17。Claude Code Docs · Extend Claude Code — the subagent / agent-team line: subagents work inside your session and report only to the main agent, right for focused only-the-result tasks; agent teams are independent sessions that message each other and share a task list, at higher token cost, right for collaboration that needs discussion — currently experimental and off by default. As of 2026-07-17. Exhaust subagents first; most 'we need a team' instincts are really 'the dispatch slip was vague.'动手 · 这周把三类派活各试一次:Hands-on · try each of the three delegations this week:
下次想「查一下 X 是怎么实现的」,改成让 subagent 去查,只收结论 —— 对比一下你主对话省下的篇幅。Next time you think 'let me check how X is implemented,' send a subagent instead and take only the findings — compare how much of your main conversation survives.
按第 II 节的样子,给你最常重复的那类活建第一个自定义 subagent,进 .claude/agents/ 提交给团队。Model on section II: build your first custom subagent for your most repeated job, and commit it to .claude/agents/ for the team.
把一个要跑十分钟的活派出去后按 Ctrl+B,继续手头的事,用 /tasks 看它跑完 —— 体会「活在转,你没停」。Delegate a ten-minute job, hit Ctrl+B, keep working, and watch it finish in /tasks — feel work spinning while you never stopped.
你不必钻进每个文件 ——
拆活,派活,收活.
You don't burrow into every file —
split, delegate, collect.
Aklman Library
— 讨论Discussion
讨论Discussion.
评论区初始化中…Initializing comments…
01 / 01
没有匹配结果No matches.
换个关键词,或按 Esc 回到页面Try another keyword, or press Esc to return