Claude Code Subagents 工作流指南 Prajwal Tomar 2026-08-06 8.1 KB 29.3K 20 ☆ 收藏 𝕏 文章列表 文章探讨了 Claude Code 重启嵌套子代理后的最佳实践。作者指出大多数人滥用子代理导致资源浪费,并提出了一套结构化工作流:设置唯一的编排器负责计划,利用三层深度进行审查分发,限制子代理范围,并在核心环节使用旗舰模型,在执行环节使用低成本模型,以实现高效、低成本的高质量交付。 Claude CodeSubagentsAgent工作流AI开发模型编排成本控制Opus 5开发效率 # Claude Code Subagents Are CRACKED Now. Here's My Exact Workflow. **作者**: Prajwal Tomar **日期**: 2026-08-05T11:07:08.000Z **来源**: [https://x.com/PrajwalTomar_/status/2084959382341837042](https://x.com/PrajwalTomar_/status/2084959382341837042) ---  Most people just unleashed a swarm of subagents, watched it burn through context and money, and decided nested agents are a gimmick. Some capped it at one layer, so their "team" is really one agent doing everything in sequence, no faster than before. And then there is a small group who run an actual structure: one lead, a scoped team, a review fan-out, and cheap models doing the volume. Those are the people shipping real features in a single prompt. I run an AI agency and I have taught 3,500+ people to build with AI, and agent workflows are how we ship client MVPs faster every month. When Claude Code reopened nested subagents, I rebuilt our setup around it. This is the exact system, and the mistakes that waste most people's runs. Here is the full breakdown. ## What Actually Changed Claude Code just reopened nested subagents. A subagent can now spawn its own subagents, up to three layers deep by default, up from a hard limit of one. Opus 5 is the default model, with a 1M-token context. That sounds small. It is not. Depth 1 meant a subagent could not delegate at all, ask it to spin up helpers and it just did the work itself, in one context window. Depth 3 means you can hand off a whole slice of a project and let the tree organize itself. There are two knobs that matter, and most people never touch them: - `CLAUDE_CODE_MAX_SUBAGENT_SPAWN_DEPTH` controls how deep the nesting goes. Set it to 1 for flat, single-layer delegation. - `CLAUDE_CODE_MAX_CONCURRENT_SUBAGENTS` caps how many run at once. It defaults to 20, so one message can fan out a lot of background agents fast.  What changed in Claude Code 2.1.219: nested subagents now run three layers deep by default, on Opus 5. ## The Problem With How Most People Use Subagents The default instinct is to unleash as many agents as possible and hope. That fails three ways. No orchestrator. If every agent can spawn siblings freely, nobody owns the plan. They drift, duplicate work, and quietly overwrite each other's changes. Context and money burn. Twenty concurrent agents on Opus 5 each carry their own context. You will watch your usage and your bill spike, for work a smaller setup does cleaner. No verification. A swarm that writes code is not a team. A team has someone checking the work against the plan. Without that, you ship whatever the loudest agent produced. The fix is not fewer agents or more agents. It is structure. ## The Setup, Step by Step ## Step 1: One orchestrator owns the plan Before any agent runs, the lead agent writes the plan and owns it. Subagents execute pieces of that plan, they do not freelance new work. This single rule kills most of the drift people blame on the model.  One orchestrator plans, then spawns scoped subagents while a reviewer verifies each finding against the plan. ## Step 2: Use depth 3 as a review fan-out, not a free-for-all Depth 3 was chosen deliberately. It is exactly what a review needs: the main conversation spawns a reviewer, the reviewer spawns one verifier per finding, and each verifier can still run a focused lookup. That is the shape to build toward. Going deeper than the work actually needs is where agents start eating their own context.  Depth 3 as a review fan-out: the main conversation spawns a reviewer, which spawns one verifier per finding. ## Step 3: Scope every subagent to one job Give each agent a tight brief: "write the tests for this module," not "improve the codebase." Vague scope is the single biggest cause of wasted tokens. A scoped agent finishes and reports. A vague one wanders. ## Step 4: Cap the fleet on purpose Do not run 20 agents because you can. Lower `CLAUDE_CODE_MAX_CONCURRENT_SUBAGENTS` to what the task needs, and set `CLAUDE_CODE_MAX_SUBAGENT_SPAWN_DEPTH` to 1 when a workflow assumes a flat structure. Constraints are what make the output legible.  The two knobs in settings.json: how deep subagents nest, and how many run at once. ## Step 5: Cheap models on the workers, flagship on the lead and reviewer This is the money move. Put Opus 5 where judgment matters, the lead that plans and the reviewer that checks. Let the workers doing volume run on a cheaper model. Same output on the parts that eat tokens, a fraction of the bill.  The money move: cheap models do the volume, Opus 5 handles the plan and the review. ## When to Use Depth 3 vs Flat Use the depth-3 review fan-out when the task genuinely branches: a build with independent modules, a review pass with several findings, a migration with parallel steps. Stay flat (depth 1) when the work is sequential, or when a workflow assumes a single fan-out. Deeper is not better. Deeper is more coordination cost. Match the structure to the shape of the work. Quick aside: I write a free weekly newsletter, The AI Head Start, where I test the best new AI workflows on real client work and send you only the few worth your time. Grab it here: https://theaiheadstart.com/ ## What To Watch Out For A few honest flags before you rebuild your setup. Context and cost scale with the tree, not the task. More agents is more context carried in parallel. Cap concurrency deliberately. Subagents drift without a plan. If the lead does not own a written plan, the tree will quietly diverge from what you asked for. Nesting is not review. A verifier only helps if it checks against the plan. Wire the verification in, do not assume depth alone gives you quality. Watch the knobs after updates. Claude Code has changed the default spawn depth a few times in a few weeks. Pin `CLAUDE_CODE_MAX_SUBAGENT_SPAWN_DEPTH` in settings so an update does not silently change your topology. ## What This Actually Means The skill is shifting again. Prompting was 2025. Then designing loops. Now it is orchestrating a team of agents, deciding who owns the plan, who does the volume, who checks the work, and how deep the tree goes. The tool is the same one everyone has. The difference is whether you run a structured team or a swarm and hope. A capped, scoped team of three beats an uncapped swarm of ten every time, on quality, on cost, and on whether it actually ships. 2026 is going to be UNFAIR for builders who move early on this. ## TLDR - Claude Code reopened nested subagents to depth 3 (was 1), on Opus 5 by default. - Most people unleash a swarm and burn context, money, and quality. - The setup: one orchestrator owns the plan, use depth 3 as a review fan-out, scope every agent to one job, cap the fleet on purpose. - The knobs: `CLAUDE_CODE_MAX_SUBAGENT_SPAWN_DEPTH` and `CLAUDE_CODE_MAX_CONCURRENT_SUBAGENTS` (default 20). - Money move: cheap models on the workers, flagship on the lead and reviewer. - A capped, scoped team of 3 beats an uncapped swarm of 10 every time. LFG. Want more like this? The AI Head Start is my free newsletter. One email a week, the AI tools and workflows actually worth your time, all tested on real client work: https://theaiheadstart.com/ ## 相关链接 - [Prajwal Tomar](https://x.com/PrajwalTomar_) - [@PrajwalTomar_](https://x.com/PrajwalTomar_) - [10K](https://x.com/PrajwalTomar_/status/2084959382341837042/analytics) - [Upgrade to Premium](https://x.com/i/premium_sign_up) - [7:07 PM · Aug 5, 2026](https://x.com/PrajwalTomar_/status/2084959382341837042) - [10.1K Views](https://x.com/PrajwalTomar_/status/2084959382341837042/analytics) - [View quotes](https://x.com/PrajwalTomar_/status/2084959382341837042/quotes) --- *导出时间: 2026/8/6 19:12:10* --- ## 中文翻译 # Claude Code 的子代理现在强得离谱。这是我的精准工作流。 **作者**: Prajwal Tomar **日期**: 2026-08-05T11:07:08.000Z **来源**: [https://x.com/PrajwalTomar_/status/2084959382341837042](https://x.com/PrajwalTomar_/status/2084959382341837042) ---  大多数人只是放出了一群子代理,眼睁睁看着它们消耗上下文和金钱,然后得出结论:嵌套代理不过是噱头。 有些人把它限制在一层,所以他们的“团队”实际上只是一个代理按顺序做完所有事情,速度并不比以前快。 还有一小部分人运行的是真正的结构:一个负责人、一个范围明确的团队、一个分发的审查机制,以及用廉价模型处理批量工作。这些人就是那些能在一次提示中交付真实功能的人。 我经营着一家 AI 代理机构,我已经教过 3,500 多人如何用 AI 构建应用,代理工作流是我们每个月更快交付客户 MVP 的秘诀。当 Claude Code 重新开放嵌套子代理时,我围绕它重建了我们的设置。这就是这套精准的系统,也是大多数人浪费算力时的错误所在。 以下是全部分解。 ## 实际上改变了什么 Claude Code 刚刚重新开放了嵌套子代理。子代理现在可以生成自己的子代理,默认深度达到三层,此前的硬限制是一层。默认模型是 Opus 5,配备 1M token 的上下文。 听起来改动不大?其实不然。深度为 1 意味着子代理根本无法进行委派,让它启动助手,它只是自己在一个上下文窗口里完成工作。深度为 3 意味着你可以移交整个项目的一部分,让树状结构自行组织。 有两个关键参数很重要,但大多数人从未碰过: - `CLAUDE_CODE_MAX_SUBAGENT_SPAWN_DEPTH` 控制嵌套的深度。设置为 1 则为扁平、单层委派。 - `CLAUDE_CODE_MAX_CONCURRENT_SUBAGENTS` 限制同时运行的数量。默认是 20,所以一条消息可以迅速分发大量后台代理。  Claude Code 2.1.219 的变化:嵌套子代理现在默认在 Opus 5 上运行三层深。 ## 大多数人使用子代理的问题所在 默认的本能是放出尽可能多的代理,然后听天由命。这会在三个方面失败。 没有指挥者。如果每个代理都可以随意生成同级代理,就没有人拥有计划。它们会跑偏、重复工作,并悄悄覆盖彼此的修改。 上下文和金钱的燃烧。Opus 5 上的 20 个并发代理各自携带自己的上下文。你会看着你的使用量和账单飙升,而那些工作原本可以用更小的配置更干净地完成。 没有验证。写代码的一群代理并不等于一个团队。团队需要有人根据计划检查工作。没有这一点,你交付的只是那个声音最大的代理产生的结果。 解决办法不是减少代理或增加代理。而是结构。 ## 设置,分步解析 ## 第一步:一个指挥者掌控计划 在任何代理运行之前,主代理要写出计划并拥有它。子代理执行该计划的一部分,它们不能自由发挥做新的工作。这一条规则就消灭了人们大多归咎于模型的大部分跑偏问题。  一个指挥者负责规划,然后生成范围明确的子代理,同时由审查员对照计划验证每个发现。 ## 第二步:将深度 3 用作审查分发,而不是自由混战 深度 3 是经过深思熟虑选择的。这正是审查所需要的:主对话生成一个审查员,审查员为每个发现生成一个验证员,每个验证员仍然可以运行一次精准的查询。这就是你应当构建的形态。超过工作实际需要的深度,就是代理开始吞噬自身上下文的地方。  深度 3 作为审查分发:主对话生成一个审查员,审查员为每个发现生成一个验证员。 ## 第三步:将每个子代理限制在单一任务 给每个代理一个简明的指令:“为这个模块编写测试”,而不是“改进代码库”。模糊的范围是浪费 token 的最大原因。范围明确的代理会完成并报告。模糊的代理则会漫无目的地游荡。 ## 第四步:有意限制代理数量 不要因为能行就运行 20 个代理。将 `CLAUDE_CODE_MAX_CONCURRENT_SUBAGENTS` 降低到任务所需的数量,当工作流假设为扁平结构时,将 `CLAUDE_CODE_MAX_SUBAGENT_SPAWN_DEPTH` 设置为 1。约束正是让输出清晰可读的关键。  settings.json 中的两个旋钮:子代理嵌套多深,以及同时运行多少个。 ## 第五步:廉价模型用于工作,旗舰模型用于负责人和审查员 这就是省钱的高招。把 Opus 5 放在需要判断力的地方:负责规划的负责人和负责检查的审查员。让处理批量工作的工作者运行更便宜的模型。在消耗 token 的部分输出相同,但费用只是原来的一小部分。  省钱的高招:廉价模型处理批量工作,Opus 5 处理计划和审查。 ## 何时使用深度 3 对比扁平结构 当任务真正分支时使用深度 3 的审查分发:包含独立模块的构建、有多项发现的审查过程、具有并行步骤的迁移。 当工作是顺序的,或者当工作流假设为单次分发时,保持扁平(深度 1)。更深不代表更好。更深意味着更多的协调成本。让结构与工作的形态相匹配。 顺便说一句:我写一份免费的周报《The AI Head Start》,我在真实的客户工作中测试最好的新 AI 工作流,只把值得你花时间的少数内容发给你。在此订阅:https://theaiheadstart.com/ ## 需要注意什么 在你重建你的设置之前,有几个诚实的警示。 上下文和成本随树状结构扩展,而非随任务。更多代理意味着更多并行携带的上下文。有意地限制并发数量。 没有计划的子代理会跑偏。如果负责人没有一个书面计划,树状结构会悄悄偏离你的要求。 嵌套不等于审查。只有当验证员对照计划进行检查时,它才有帮助。将验证机制接入进去,不要假设深度本身就能保证质量。 更新后留意那些旋钮。Claude Code 在几周内已经改变了几次默认生成深度。在设置中固定 `CLAUDE_CODE_MAX_SUBAGENT_SPAWN_DEPTH`,这样更新就不会悄悄改变你的拓扑结构。 ## 这实际上意味着什么 技能再次发生转变。提示词工程是 2025 年的事。然后是设计循环。现在是指挥一支代理团队,决定谁拥有计划、谁做批量工作、谁检查工作,以及树状结构有多深。 工具还是大家都有的那个工具。区别在于你运行的是一个结构化的团队,还是一群听天由命的乌合之众。一个受限、范围明确的三人团队,在质量、成本以及是否能真正交付上,每次都能击败一个不受限的十人群体。 对于较早行动的构建者来说,2026 年将是不公平的优势。 ## 太长不看 - Claude Code 将嵌套子代理重新开放至深度 3(此前为 1),默认使用 Opus 5。 - 大多数人放出一群代理,然后烧毁上下文、金钱和质量。 - 设置方案:一个指挥者掌控计划,将深度 3 用作审查分发,将每个代理限制在单一任务,有意限制代理数量。 - 关键旋钮:`CLAUDE_CODE_MAX_SUBAGENT_SPAWN_DEPTH` 和 `CLAUDE_CODE_MAX_CONCURRENT_SUBAGENTS`(默认 20)。 - 省钱高招:廉价模型用于工作者,旗舰模型用于负责人和审查员。 - 一个受限、范围明确的 3 人团队,每次都能击败一个不受限的 10 人群体。 冲啊。 想要更多类似内容?《The AI Head Start》是我的免费Newsletter。每周一封邮件,提供真正值得你花时间的 AI 工具和工作流,全部在真实客户工作经过测试:https://theaiheadstart.com/ ## 相关链接 - [Prajwal Tomar](https://x.com/PrajwalTomar_) - [@PrajwalTomar_](https://x.com/PrajwalTomar_) - [10K](https://x.com/PrajwalTomar_/status/2084959382341837042/analytics) - [升级到 Premium](https://x.com/i/premium_sign_up) - [7:07 PM · Aug 5, 2026](https://x.com/PrajwalTomar_/status/2084959382341837042) - [10.1K Views](https://x.com/PrajwalTomar_/status/2084959382341837042/analytics) - [查看引用](https://x.com/PrajwalTomar_/status/2084959382341837042/quotes) --- *导出时间: 2026/8/6 19:12:10*
让 让 Claude Code 指挥你的 Grok Bot 干活:三步搞定 本文介绍如何将 Claude Code、Grok Bot 和 Cursor cloud agent 串成一条自动化开发流水线。分工为:用户提需求拍板,Claude Code 负责读代码、拆任务、审 PR 和合并,Grok Bot 作为调度员派发 cloud agent 并跟进进度,Cursor cloud agent 负责写代码、跑测试、开 PR。这种架构省 Token 额度、支持并行开发、实现写审分离。搭建只需三步:在 Grok Bot 中创建专用调度 Bot 并粘贴协作提示词;在 Claude Code 中安装 cg-link 工具;登录 Cursor 完成授权。配置完成后即可通过 /cg-link 命令开始使用。 技术 › Claude Code 劳伦斯 2026-10-16 Claude CodeGrok BotCursorAgent自动化流水线cg-link多智能体协作开发效率PR审核工具
e eian-riso-broll:把口播逐字稿印成B-Roll信息动画 作者开发了第二个B-roll类Skill——eian-riso-broll,用于解决口播视频配画面繁琐的问题。该工具是一套孔版双色印刷风格的信息动画工作流:AI Agent自动从逐字稿中挑出值得配画面的句子,生成9:16竖屏信息动画视频。它内置10个模板对应10种信息形状(数字冲击、前后对比、流程步骤、金句等),采用三道确认闸门(分镜表、样帧、成片)确保质量,严格禁止AI编造内容。技术上使用HTML/CSS排版、GSAP动画、Chrome逐帧截图加ffmpeg合成,零npm依赖、无需联网和图片生成模型,专为竖屏短视频版面设计,跨平台渲染效果一致。 技术 › Skill Eian 2026-10-13 SkillClaude Code视频制作B-Roll信息动画孔版印刷Agent工作流开源短视频AI工具
A AI 开发中的关键二元选择:现成能力、Agent 与脚本边界 作者总结了 AI 开发中四个关键的二元选择:一是优先使用现成的开源能力(skill)而非从零开发,通过 GitHub star 数判断成熟度;二是 OpenClaw(龙虾)适合已搭好管道的日常自动化(BAU),而搭建复杂系统应使用 Claude Code、Codex、Jules 等开发工具;三是多 agent 并非越多越好,应先单 agent,确实不够用再逐个增加,复杂度是敌人;四是确定性逻辑用脚本执行,大模型只用于需要判断的环节,高风险决策需人工审批,最终形成脚本+大模型+human approval gate 的结构。正确选择可节省大量时间。 技术 › Agent Park (@xparkzz) 2026-10-08 AI开发AgentClaude CodeOpenClawCodexOpenCode脚本大模型开发工具最佳实践
C Claude Opus 5.5——17 个值得调整的习惯用法 Anthropic 发布 Claude Opus 5.5 后提供了官方 Prompting Guide。作者读完指南并总结出 17 个值得调整的用法:API 默认从 medium effort 开始,用真实任务测试最佳档位;5.5 切换 effort 不再清空 cache;长任务要一次性说清目标和完成标准,让模型维护文件中的 checklist;通过 system prompt 明确何时暂停询问;给多 Agent 工作流设置时间预算;用 subagents 处理重型任务但需核实其报告;删除'请仔细思考'等旧习惯提示词;要理由摘要而非完整推理;设计需求用删除法点名不喜欢的元素;区分用户指令与粘贴内容;Claude Code 现已支持 AGENTS.md。核心是讲清任务目标与流程,而非堆砌提示词。 技术 › Claude Kelvin 2026-10-05 Claude Opus 5.5提示词工程AnthropicClaude Codeeffort参数SubagentsAGENTS.mdLLMAgentPrompting Guide
独 独立开发者的启动清单 文章为想成为独立开发者的人整理了一套从 0 到 1 的启动工具清单,涵盖银行卡(中银香港、汇丰、Za Bank)、域名(Cloudflare)、服务器(腾讯云、ClawCloud)、代码托管与部署(GitHub、Cloudflare)、收款(Stripe)、关键词与竞品分析(Google Keyword Planner、Ahrefs、SEMrush、SimilarWeb)、设计与素材(Figma、Canva、iconfont、namelix)、AI 编码工具(Codex、Claude Code、Nano Banana)、存储与数据库(Cloudflare R2、Supabase、Redis)以及流量分析(Google Analytics、Search Console、Clarity)。作者指出除域名和服务器外大多可免费使用,启动总成本约 30 美元,关键在于行动力。 技术 › 工具与效率 Jason Jiang 2026-09-01 独立开发工具清单StripeCloudflareSupabaseSEOCodexClaude Code产品启动成本控制
我 我的 AI 开发流程 作者以给自己的字幕转录翻译 App BaoCut 添加远程转录功能为例,展示了完整的 AI 开发流程:先做可行性分析(产品和技术两个层面),再借助 Claude Code 撰写设计文档,然后通过原型设计低成本验证需求和 UI 交互,反复迭代原型后再让 Agent 按文档实现代码,最后人工黑盒测试验证并反馈调整。作者强调不盲目动手、文档先行、原型即 UI 设计的理念,并表示自己不做代码 Review,只做黑盒测试。 技术 › Claude Code 宝玉 2026-08-25 AI开发AgentClaude Code可行性分析设计文档原型设计BaoCut黑盒测试开发流程Fable
3 3 Secret Ways Claude Code’s Creator Actually Uses It 本文探讨了Claude Code的创建者Boris Cherny关于如何更有效使用AI代理的建议。作者发现,随着模型升级(如Opus 5),旧有的指令和技能可能反而阻碍新模型的表现。Boris建议定期删除或禁用CLAUDE.md、技能和钩子,以发现模型的新能力。作者通过对比测试发现,保留上下文但简化流程,让模型自主思考,效果更好。文章强调将上下文与程序分离,给出高层目标、护栏和退出标准,并让代理自我验证。最终,管理AI代理应像管理有能力的人一样,设定方向、审查结果,而非微观管理。 技术 › Claude Nate Herk 2026-08-13 Claude CodeAI代理提示工程模型管理技能优化上下文管理验证产品过时Opus 5工作流程
V Vibe Coding 16小时后的AI开发流程:搭子2.0如何让Claude Code和Codex像团队一样协作 作者分享了在Claude封号潮后,基于API的AI开发工作流优化经验。通过开源项目“搭子2.0”,实现了Claude Code和Codex两个Agent的深度协作,引入deep_reasoner、fast_worker、arbiter三种身份,支持跨模型混编、本地配置UI、一键试跑、Goal哈希校验和证据链小票等功能,有效降低了API成本并提升了开发效率。文章详细介绍了搭子2.0的核心升级、配置方法及实战效果。 技术 › Agent 卡尔的AI沃茨 2026-08-12 Claude CodeCodexAgent协作API成本优化工作流搭子2.0模型混编开发效率
图 图工程:构建全自动化AI开发系统 本文介绍如何摒弃手动单次提示,通过构建AI系统实现开发自动化。以Claude Code为基础,结合上下文规则实现工程化代理;利用循环工程让系统自动发现任务、执行并验证结果;引入图工程作为知识记忆层,通过三元组存储项目逻辑,使模型准确率大幅提升且避免从零开始;最后通过模型路由按任务复杂度自动分配Opus 5或Fable 5,以大幅降低开发成本并成倍提升工作效率。 技术 › Agent Noisy 2026-08-07 Graph EngineeringClaude CodeAgent自动化知识图谱GraphRAG模型路由LLM开发效率
如 如何使用 Opus 5 进行图工程 文章介绍了如何利用 Opus 5 的新特性(如缓存控制和低 effort 模式)低成本构建图记忆。核心在于将提取和遍历分离:提取使用低 effort 和缓存前缀以降低成本,遍历使用高 effort 以保证推理质量。通过优化配置,图工程的成本可降至原本的三分之一,甚至低于向量存储。 技术 › Hermes rody 2026-08-06 Opus 5图工程知识图谱缓存成本优化Claude CodeGraphitiAgentNeo4j
如 如何递归地改进你的智能体 文章介绍了一种递归自动改进智能体(RAI)的方法。通过使用编码智能体分析指令、挖掘使用数据并运行探测,测试并修复目标智能体,直到符合规范。文章详细阐述了实现该循环所需的系统设置、平台搭建步骤以及“创建-改进-扩展-部署”的全新开发生命周期。 技术 › Agent Ashpreet Bedi 2026-08-04 智能体递归改进自动化编码助手AI开发DevOps测试系统优化AgentOSClaude Code
用 用 AI Agent 开发的真实成本:记忆比 Token 更贵 作者分享了使用 Memmy 整合多个 AI Agent(Claude Code、Codex 等)历史记录的实战经验。通过统一记忆管理,新 Agent 能准确识别过期结论和冲突信息,避免重复试错成本。文章强调长期记忆的核心价值不在于存储数量,而在于精准识别“什么不再有效”,从而实现无缝的项目交接。 技术 › Agent Yanhua 2026-07-31 AI Agent记忆管理开发效率MemmyClaude Code独立开发