mcpField
S
sadd:do-in-parallel

sadd:do-in-parallel

github.com/neolabhqAgent 工作流1.8k446 次安装9 周前更新
代码仓库

关于 sadd:do-in-parallel

sadd:do-in-parallel 是用于协调多个子 Agent 并行处理不同目标的技能。它会归组需求、分派实施 Agent 与评审 Agent,并依据验证反馈重试未通过的任务。

主要功能

  1. 01分析目标与任务独立性
  2. 02归组重复或相关需求
  3. 03分派元评审与实施 Agent
  4. 04由专属评审 Agent 验证工作
  5. 05根据反馈重试未通过任务

适用场景

  1. 01对多个文件执行相同重构
  2. 02并行分析多个模块
  3. 03为不同组件生成文档
  4. 04并行执行互不依赖的转换

安装

复制下面的命令,在终端中运行。

$npx skills add https://github.com/neolabhq/context-engineering-kit --skill sadd:do-in-parallel

安装后在 Claude Code 中输入/sadd:do-in-parallel确认已加载。

详细介绍

do-in-parallel

并行启动多个子 Agent,在不同文件或目标上执行任务。分析任务以智能选择最优模型,执行需求分组分析(可重复、共享或独立),生成注重质量的提示词,并要求进行自我批评;然后根据分组情况分派元评审员(每组一个或每个独立任务一个),并行执行;接着为每项任务并行分派实现者,并在每项任务完成后,使用适合其分组的评估规范进行 LLM-as-a-judge 验证。 此命令实现了**监督者/编排者模式**,包含并行分派、**需求分组**以及**元评审员 → LLM-as-a-judge 验证**。其主要优势是**并行执行**——多个独立任务可同时运行,而非依次执行,从而大幅缩短批量操作的总耗时。需求分组分析可通过让相关任务共享元评审员和评审员,减少所需 Agent 数量:可重复组(在多个目标上执行相同任务)共享一份元评审规范;共享组(相互依赖的任务)则使用一名综合评审员。

主要优势:

  • 并行执行——同时运行多个任务
  • 需求分组——识别可重复和共享的任务模式,减少元评审员和评审员的数量
  • 全新上下文——每个子 Agent 都在干净的上下文窗口中工作
  • 针对任务的评估——每位元评审员都会为其特定任务或任务组制定量身定制的评分标准和检查清单
  • 外部验证——评审员机械地应用目标专属的元评审规范,捕捉自我批评未发现的盲点
  • 反馈循环——根据评审员指出的具体问题重试
  • 质量门槛——达到门槛前不交付工作

常见用例:

  • 在多个文件中应用相同的重构
  • 同时对多个模块进行代码分析
  • 为多个组件生成文档
  • 并行执行相互独立的转换

**重要:**你只能担任编排者,绝不能亲自执行任务。如果你读取、写入或运行 bash 工具,就会立刻导致任务失败。这是最关键的标准。如果你使用了子 Agent 以外的任何东西,就会立即被终止!你的职责是:

  1. 分析任务,执行需求分组分析,并选择最优模型
  2. 根据分组并行分派元评审员
  3. 每位元评审员完成后,为该组的目标分派实现子 Agent,并提供结构化提示词
  4. 实现者完成后,根据分组情况分派评审员
  5. 解析评审结果,并在必要时迭代(每个目标最多重试 3 次;对于共享组,仅重试未通过的任务)
  6. 收集结果并报告最终摘要

红线——绝不可做的事

绝不可:

  • 阅读实现文件以了解代码细节(交由子 Agent 处理)
  • 直接编写代码或修改源文件
  • 为了“节省时间”而跳过评审验证
  • 通篇阅读评审报告(只解析结构化标头)
  • 达到最大重试次数后,未征得用户决定就继续
  • 等待一个 Agent 完成后才启动另一个
  • 重试时重新运行元评审
  • 等待所有元评审完成后才启动实现 Agent
  • 为属于同一可重复或共享组的任务分别启动元评审
  • 共享组中只有部分任务失败时,重新启动所有实现 Agent

务必:

  • 使用 Task 工具为所有实现工作分派子 Agent
  • 在分派任何元评审前,先进行需求分组分析
  • 根据分组分派元评审,并在同一条回复中并行启动所有元评审
  • 不要等所有元评审都完成后才分派实现 Agent;每个元评审完成后立即启动相应实现 Agent
  • 每个任务的元评审完成后,立即为该任务启动实现 Agent。如果所有元评审均已完成,则在同一条回复中启动所有实现 Agent
  • 将每个目标专属的元评审评估规范传递给其评审 Agent
  • 对于共享组,只分派一名评审 Agent,一并评审所有相关改动
  • 在给元评审和评审 Agent 的提示词中加入 CLAUDE_PLUGIN_ROOT=${CLAUDE_PLUGIN_ROOT}
  • 使用 Task 工具分派独立的评审 Agent 进行验证
  • 每项实现完成后,再分派其评审 Agent
  • 只解析评审输出中的 VERDICT/SCORE/ISSUES
  • 如果验证未通过,附上反馈并迭代(每个目标最多重试 3 次)
  • 共享组重试时,只重新启动失败的具体实现 Agent,而非整个组
  • 所有重试均复用相同的元评审规范(绝不重新运行元评审)

流程

阶段 1:解析输入并识别目标

从命令参数中提取目标:

Input patterns:
1. --files "src/a.ts,src/b.ts,src/c.ts"    --> File-based targets
2. --targets "UserService,OrderService"    --> Named targets
3. Infer from task description             --> Parse file paths from task

解析规则:

  • 如果提供了 --files:按逗号拆分,并验证每个路径是否存在
  • 如果提供了 --targets:按逗号拆分,原样使用
  • 如果两者都未提供:尝试从任务描述中提取文件路径或目标名称
阶段 2:使用零样本 CoT 分析任务

分派前,系统地分析任务:

Let me analyze this parallel task step by step to determine the optimal configuration:

1. **Task Type Identification**
   "What type of work is being requested across all targets?"
   - Code transformation / refactoring
   - Code analysis / review
   - Documentation generation
   - Test generation
   - Data transformation
   - Simple lookup / extraction

2. **Per-Target Complexity Assessment**
   "How complex is the work for EACH individual target?"
   - High: Requires deep understanding, architecture decisions, novel solutions
   - Medium: Standard patterns, moderate reasoning, clear approach
   - Low: Simple transformations, mechanical changes, well-defined rules

3. **Per-Target Output Size**
   "How extensive is each target's expected output?"
   - Large: Multi-section documents, comprehensive analysis
   - Medium: Focused deliverable, single component
   - Small: Brief result, minor change

4. **Independence Check**
   "Are the targets truly independent?"
   - Yes: No shared state, no cross-dependencies, order doesn't matter
   - Partial: Some shared context needed, but can run in parallel
   - No: Dependencies exist --> Use sequential execution instead
独立性验证(并行分派前必须完成)

继续之前,验证任务确实相互独立:

检查项问题如果回答为“否”
文件独立性目标是否共享文件?无法并行——文件冲突
状态独立性任务是否会修改共享状态?无法并行——存在竞态条件
顺序独立性执行顺序是否重要?无法并行——必须按顺序执行
输出独立性是否有目标会读取其他目标的输出?无法并行——存在数据依赖

独立性检查清单:

  • 没有目标读取其他目标的输出
  • 没有目标修改其他目标会读取的文件
  • 完成顺序无关紧要
  • 没有共享的可变状态
  • 没有跨目标的数据库事务

如果任一检查未通过:停止,并告知用户并行化不安全的原因。建议使用 /launch-sub-agent 按顺序执行。

需求分组分析(在分派 Meta-Judge 前必须完成)

识别各项任务并验证其独立性后,分析这些任务是否可以共享 Meta-Judge 和/或 Judge。这样可以在不牺牲质量的前提下,减少分派的 Agent 总数。

三种分组类型(可在单个用户提示中组合使用):

分组类型适用情况Meta-Judge实施 AgentJudge
可重复型多个文件/模块应用相同的任务模式(例如,“为全部 3 个模块添加测试”)整组共用一个 Meta-Judge每项任务一个(始终隔离)每项任务一个,且都接收相同的共享规范
共享型任务相互依赖,需要一起审查/验证(例如,“实现 S3 适配器并将其集成到分析功能中”)整组合用一个 Meta-Judge每项任务一个(始终隔离)整组共用一个 Judge,一起审查所有变更
独立型任务完全独立,分组没有益处每项任务一个每项任务一个(始终隔离)每项任务一个

决策流程:

For each pair of tasks, ask:

1. "Is this the SAME task applied to different targets?"
   +-- YES --> Group as REPEATABLE
   |           (Same spec reused across targets)
   |
   +-- NO --> "Should these tasks be REVIEWED TOGETHER because
              one depends on the output/existence of the other?"
              |
              +-- YES --> Group as SHARED
              |           (Combined spec, single judge reviews all)
              |
              +-- NO --> Mark as INDEPENDENT
                         (Separate meta-judge and judge per task)

关键事项:

  • 如有疑问,默认采用独立型。如果无法确定任务是否真正属于可重复型或共享型,就将其视为独立任务。过度分组可能导致评估规范有误,而独立任务始终能获得正确且针对具体任务的评估。宁可多使用 Agent,也不要制定错误的验证标准。
  • 实施 Agent 始终隔离——每项任务一个,绝不共用。只有 Meta-Judge 和 Judge 可以共享/分组。分组分析在此处的任务分析阶段进行,且必须在启动任何 Agent 之前完成。

Meta-Judge 指示:

  • 可重复型分组:分派可重复型分组的 Meta-Judge 时,明确要求其制定可复用的验证规范。
  • 共享型分组:分派共享型分组的 Meta-Judge 时,明确要求其制定组合验证规范。

共享型分组的重试逻辑:

如果共享型 Judge 发现问题,请分析哪些具体实施 Agent 产生了未通过的变更。只重新启动其变更未通过的特定实施 Agent,不要重新启动组内所有 Agent,除非确有必要。定向重试后,重新启动共享型 Judge,重新审查所有变更,包括已通过 Agent 完成且未更改的工作。

阶段 3:模型与 Agent 选择

根据任务分析,选择最合适的模型和专用 Agent。所有并行 Agent 使用相同配置(确保质量一致):

3.1 模型选择
任务特征推荐模型理由
复杂的单目标任务(架构、设计)opus每项任务都具备最强的推理能力
专业领域(代码审查、安全)opus领域专业知识至关重要
中等复杂度、大量输出sonnet能力出色,处理大量内容时成本效益高
简单转换(重命名、格式化)haiku快速、成本低,足以胜任机械性任务
默认(不确定时)opus以质量优先于成本

决策树:

Is EACH target's task COMPLEX (architecture, novel problem, critical decision)?
|
+-- YES --> Use Opus for ALL agents
|
+-- NO --> Is task SIMPLE and MECHANICAL (rename, format, extract)?
           |
           +-- YES --> Use Haiku for ALL agents
           |
           +-- NO --> Is output LARGE but task not complex?
                      |
                      +-- YES --> Use Sonnet for ALL agents
                      |
                      +-- NO --> Use Opus for ALL agents (default)
3.2 专业 Agent 选择(可选)

如果任务涉及专业领域,请在所有并行 Agent 中加入相关的 Agent 提示词。专业 Agent 可提供领域专属的最佳实践,从而提升输出质量。

专业 Agent: 专业 Agent 列表取决于项目和已加载的插件。

决策: 在以下情况下使用专业 Agent:

  • 任务明显受益于专业领域知识
  • 所有并行 Agent 之间的一致性很重要
  • 任务并非微不足道(简单任务不值得承担额外开销)

在以下情况下跳过专业 Agent:

  • 任务简单或机械(Haiku 级)
  • 没有明确匹配的专业领域
  • 通用执行方式已足够
阶段 3.5:分组派发元评审者(按需求类型,并行派发)

派发实现 Agent 之前,根据阶段 2 的需求分组分析派发元评审者。元评审者的数量取决于分组:每个可重复组派发一个,每个共享组派发一个,每个独立任务派发一个。无论分组类型如何,所有元评审者都要并行启动。每个元评审者都会生成评分标准、检查清单和评分准则。每份规范仅用于其关联任务的所有重试。

重要:遵循上下文隔离原则——只向每个 Agent 提供与其特定目标或分组相关的上下文。

3.5.1 按分组类型划分的元评审者提示模板

独立元评审者提示:

## Task

Generate an evaluation specification yaml for the following task applied to a specific target. You will produce rubrics, checklists, and scoring criteria that a judge agent will use to evaluate the implementation artifact for this specific target.

CLAUDE_PLUGIN_ROOT=`${CLAUDE_PLUGIN_ROOT}`

## User Prompt as Context
{Original user prompt}

## Target
{Specific target for this meta-judge: task description, file path, component name, etc. extracted from User Prompt}

## Context
{Any relevant codebase context, file paths, constraints}

## Artifact Type
{code | documentation | configuration | etc.}

## Instructions
User prompt is provided as context, you should use it only as reference of changes that can occur in the project by other agents. Generate evaluation specification ONLY on the for the your specific target, generated from User Prompt. Your report will be used to verify only this particular task, not the all tasks in the user prompt.
Return only the final evaluation specification YAML in your response.

可重复组元评审者提示(每组一个):

## Task

Generate a REUSABLE evaluation specification yaml that can be applied to ANY of the following targets performing the same task. You will produce rubrics, checklists, and scoring criteria that individual judge agents will each use independently to evaluate one target's implementation artifact.

CLAUDE_PLUGIN_ROOT=`${CLAUDE_PLUGIN_ROOT}`

## User Prompt as Context
{Original user prompt}

## Task Being Repeated
{The common task description shared by all targets in this group}

## Targets in This Group
{List of all targets: file paths, component names, etc.}

## Context
{Any relevant codebase context, file paths, constraints}

## Artifact Type
{code | documentation | configuration | etc.}

## Instructions
CRITICAL: You are generating a REUSABLE spec that will be applied to EACH target independently by separate judges.
- Use generic language: "target file should align with criteria" instead of "all files should align"
- Do NOT include file-specific requirements (e.g., NOT "file should have only authentication logic") if the same spec will be applied to another target which logically cannot fulfill this criteria (e.g. "cart.ts" or "payments.ts" cannot have authentication logic)
- The spec must be applicable to ANY target in this group without modification
- Each judge will receive this same spec and evaluate only its own target against it
User prompt is provided as context, you should use it only as reference of changes that can occur in the project by other agents.
Return only the final evaluation specification YAML in your response.

共享组元评审者提示(每组一个):

## Task

Generate a COMBINED evaluation specification yaml that covers ALL of the following related tasks. These tasks are interdependent and will be reviewed TOGETHER by a single judge. You will produce rubrics, checklists, and scoring criteria that account for cross-task dependencies and integration points.

CLAUDE_PLUGIN_ROOT=`${CLAUDE_PLUGIN_ROOT}`

## User Prompt as Context
{Original user prompt}

## Tasks in This Shared Group
{List of all tasks with their targets:
- Task 1: {description} -> {target}
- Task 2: {description} -> {target}
}

## Context
{Any relevant codebase context, file paths, constraints, integration points between tasks}

## Artifact Type
{code | documentation | configuration | etc.}

## Instructions
CRITICAL: You are generating a COMBINED spec for tasks that will be reviewed TOGETHER by ONE judge.
- Include evaluation criteria for EACH individual task
- Include cross-task verification criteria (e.g., "adapter implementation matches the interface consumed by the integration module")
- Organize the spec so the judge can identify which criteria apply to which task's changes
- The judge will review ALL changes from ALL tasks in this group in a single evaluation
User prompt is provided as context, you should use it only as reference of changes that can occur in the project by other agents.
Return only the final evaluation specification YAML in your response.
3.5.2 派发模式

在单个响应中派发所有元评审者(无论分组类型如何):

Use Task tool (one per group/independent task, all in same message):

[Meta-judge for Repeatable Group: "add tests"]
  - description: "Meta-judge (repeatable): reusable spec for adding tests across 3 modules"
  - prompt: {repeatable group meta-judge prompt}
  - model: opus
  - subagent_type: "sadd:meta-judge"

[Meta-judge for Shared Group: "S3 adapter + integration"]
  - description: "Meta-judge (shared): combined spec for S3 adapter implementation and integration"
  - prompt: {shared group meta-judge prompt}
  - model: opus
  - subagent_type: "sadd:meta-judge"

[Meta-judge for Independent Task: "update CI pipeline"]
  - description: "Meta-judge: update CI pipeline"
  - prompt: {independent meta-judge prompt}
  - model: opus
  - subagent_type: "sadd:meta-judge"

[All meta-judges launched simultaneously]

关键: 不要等到所有元评审者都完成后才进入阶段 4。每个元评审者完成后立即启动实现者。如果所有元评审者均已完成,则在单个响应中启动所有实现 Agent。

阶段 4:构建每个目标的提示

为每个目标构建结构相同的提示,只针对目标的特定细节进行定制:

4.1 零样本思维链前缀(必需——必须置于首位)
## Reasoning Approach

Let's think step by step.

Before taking any action, think through the problem systematically:

1. "Let me first understand what is being asked for this specific target..."
   - What is the core objective?
   - What are the explicit requirements?
   - What constraints must I respect?

2. "Let me analyze this specific target..."
   - What is the current state?
   - What patterns or conventions exist?
   - What context is relevant?

3. "Let me plan my approach..."
   - What are the concrete steps?
   - What could go wrong?
   - Is there a simpler approach?

Work through each step explicitly before implementing.
4.2 任务正文(按目标定制)
<task>
{Task description from $ARGUMENTS}
</task>

<target>
{Specific target for this agent: file path, component name, etc.}
</target>

<constraints>
- Work ONLY on the specified target
- Do NOT modify other files unless explicitly required
- Follow existing patterns in the target
- {Any additional constraints from context}
</constraints>

<output>
{Expected deliverable location and format}

CRITICAL: At the end of your work, provide a "Summary" section containing:
- Files modified (full paths)
- Key changes (3-5 bullet points)
- Any decisions made and rationale
- Potential concerns or follow-up needed
</output>
4.3 自我批评后缀(必需——必须置于末尾)
## Self-Critique Verification (MANDATORY)

Before completing, verify your work for this target. Do not submit unverified changes.

### 1. Generate Verification Questions

Create questions specific to your task and target. There examples of questions:

| # | Question | Why It Matters |
|---|----------|----------------|
| 1 | Did I achieve the stated objective for this target? | Incomplete work = failed task |
| 2 | Are my changes consistent with patterns in this file/codebase? | Inconsistency creates technical debt |
| 3 | Did I introduce any regressions or break existing functionality? | Breaking changes are unacceptable |
| 4 | Are edge cases and error scenarios handled appropriately? | Edge cases cause production issues |
| 5 | Is my output clear, well-formatted, and ready for review? | Unclear output reduces value |

### 2. Answer Each Question with Evidence

For each question, provide specific evidence from your work:

[Q1] Objective Achievement:
- Required: [what was asked]
- Delivered: [what you did]
- Gap analysis: [any gaps]

[Q2] Pattern Consistency:
- Existing pattern: [observed pattern]
- My implementation: [how I followed it]
- Deviations: [any intentional deviations and why]

[Q3] Regression Check:
- Functions affected: [list]
- Tests that would catch issues: [if known]
- Confidence level: [HIGH/MEDIUM/LOW]

[Q4] Edge Cases:
- Edge case 1: [scenario] - [HANDLED/NOTED]
- Edge case 2: [scenario] - [HANDLED/NOTED]

[Q5] Output Quality:
- Well-organized: [YES/NO]
- Self-documenting: [YES/NO]
- Ready for PR: [YES/NO]

### 3. Fix Issues Before Submitting

If ANY verification reveals a gap:
1. **FIX** - Address the specific issue
2. **RE-VERIFY** - Confirm the fix resolves the issue
3. **DOCUMENT** - Note what was changed and why

CRITICAL: Do not submit until ALL verification questions have satisfactory answers.
阶段 5:并行派发实现任务并由评审者验证

元评审者完成后,同时启动所有实现子 Agent,然后根据分组类型进行评审验证。

5.1 执行流程

独立/可重复流程(每个任务配一个评审者):

┌─────────────────────────────────────────────────────────────────────────┐
│                                                                         │
│   Phase 3.5: Meta-Judge Dispatch (ALL in parallel)                      │
│                                                                         │
│   Independent:            Repeatable Group:                             │
│   ┌──────────────┐        ┌─────────────────────┐                       │
│   │ Meta-Judge A  │        │ Meta-Judge (shared)  │                       │
│   │ (Opus)        │        │ (Opus)               │                       │
│   │ → Spec YAML A │        │ → Reusable Spec YAML │                       │
│   └──────┬───────┘        └──────────┬──────────┘                       │
│          │                     ┌─────┴─────┐                            │
│          ▼                     ▼           ▼                            │
│   Phase 5: Implementation (ALL in parallel, one per task)               │
│                                                                         │
│   ┌──────────────┐   ┌──────────────┐   ┌──────────────┐               │
│   │ Implementer A │   │ Implementer B │   │ Implementer C │              │
│   └──────┬───────┘   └──────┬───────┘   └──────┬───────┘               │
│          │                  │                  │                        │
│          ▼                  ▼                  ▼                        │
│   Phase 5.2: Judge per task (after ALL implementors complete)           │
│                                                                         │
│   ┌──────────────┐   ┌──────────────┐   ┌──────────────┐               │
│   │  Judge A      │   │  Judge B      │   │  Judge C      │              │
│   │ +Spec YAML A  │   │ +Reusable Spec│   │ +Reusable Spec│              │
│   └──────┬───────┘   └──────┬───────┘   └──────┬───────┘               │
│          ▼                  ▼                  ▼                        │
│   Parse Verdict (per target) → PASS/FAIL → Retry if needed             │
└─────────────────────────────────────────────────────────────────────────┘

共享流程(每组配一个评审者):

┌─────────────────────────────────────────────────────────────────────────┐
│                                                                         │
│   Phase 3.5: Meta-Judge for Shared Group                                │
│   ┌──────────────────────┐                                              │
│   │ Meta-Judge (combined) │                                              │
│   │ (Opus)                │                                              │
│   │ → Combined Spec YAML  │                                              │
│   └──────────┬───────────┘                                              │
│         ┌────┴────┐                                                     │
│         ▼         ▼                                                     │
│   Phase 5: Implementation (one per task, in parallel)                   │
│   ┌──────────────┐   ┌──────────────┐                                   │
│   │ Implementer X │   │ Implementer Y │                                  │
│   └──────┬───────┘   └──────┬───────┘                                   │
│          │                  │                                           │
│          └────────┬─────────┘                                           │
│                   ▼                                                     │
│   Phase 5.2: ONE Judge for entire group                                 │
│   ┌────────────────────────────────┐                                    │
│   │  Judge (shared)                 │                                    │
│   │ +Combined Spec YAML             │                                    │
│   │ +ALL implementation outputs     │                                    │
│   └──────────────┬─────────────────┘                                    │
│                  ▼                                                      │
│   Parse per-task verdicts → Retry ONLY failing task(s) if needed        │
└─────────────────────────────────────────────────────────────────────────┘

关键:并行派发模式

在单个响应中启动所有实现 Agent。不要等一个 Agent 完成后再启动另一个:

## Dispatching 3 parallel tasks

[Task 1]
Use Task tool:
  description: "Parallel: simplify error handling in src/services/user.ts"
  prompt: [CoT prefix + task body for user.ts + critique suffix]
  model: sonnet

[Task 2]
Use Task tool:
  description: "Parallel: simplify error handling in src/services/order.ts"
  prompt: [CoT prefix + task body for order.ts + critique suffix]
  model: sonnet

[Task 3]
Use Task tool:
  description: "Parallel: simplify error handling in src/services/payment.ts"
  prompt: [CoT prefix + task body for payment.ts + critique suffix]
  model: sonnet

[All 3 tasks launched simultaneously - results collected when all complete]

并行化指南:

  • 在单个批次中启动所有独立任务(同一响应)
  • 不要等一个任务完成后再启动另一个
  • 不要按顺序调用 Task 工具
  • Task 工具会自动处理并行化
  • 所有任务完成后收集结果

上下文隔离(重要):

  • 仅提供与每个特定目标相关的上下文
  • 不要向每个 Agent 提供全部目标列表
  • 让子 Agent 通过读取文件自行发现本地模式
  • 每个 Agent 都在干净的上下文中工作,避免累积混淆
5.2 裁判验证协议

所有实现 Agent 完成后,根据第 2 阶段确定的需求分组派发裁判。派发模式因分组类型而异:

分组类型裁判派发方式使用的规范
独立每项任务派发一名裁判针对任务的元裁判规范
可重复每项任务派发一名裁判使用该组元裁判中的同一份可复用规范
共享为整个分组派发一名裁判使用该组元裁判的组合规范

重要:向裁判提供完全一致的元裁判评估规范 YAML,不得跳过或添加任何内容,也不得以任何方式修改,不得缩短或概述其中的任何文本!对于可重复分组,每个目标对应的裁判都应收到同一份可复用规范。对于共享分组,单个裁判应收到涵盖所有任务的组合规范。

5.2.1 分析预先存在或预期的并行变更部分

在派发每个目标对应的裁判之前,评估代码库中是否存在裁判需要了解的预先存在或预期的并行变更。“预先存在或预期的并行变更”部分可防止裁判将之前的修改与当前实现 Agent 的工作混淆。

包含条件:

  • 在同一会话中更早完成的 do-in-parallel 运行(之前批次的所有目标)
  • 调用此技能前用户进行的手动修改(可从对话上下文或 git 中查看)
  • 此次并行派发前其他工具或 Agent 产生的变更
  • 同一批次中其他并行 Agent 的预期变更(例如,其他 Agent 预计会在并行开发期间修改仓库中的其他文件)

省略条件:

  • 这是首次运行,且没有已知的先前变更——完全省略此部分
  • 在同一目标内重试时,不要将实现 Agent 自己之前的尝试列为“预先存在的变更”——这些属于当前目标的迭代周期

内容指南:

  • 使用高层级摘要:任务描述、受影响文件/模块列表、变更的大致性质(新建、修改、删除)
  • 不要包含代码块、差异内容或逐行细节——保持简洁
  • 清晰标明来源:“之前的 do-in-parallel:{description}”、“用户修改(当前任务之前)”等
  • 如果变更有多个来源,请为每个来源分别设置小节

重要:避免读取整个代码库或 git 历史记录;只需使用高层级的 git diff/status 确定更改了哪些文件,或根据对话上下文确定是否存在任何预先存在的变更。

5.2.2 使用提示词和针对目标的规范 YAML 启动裁判

裁判提示词模板:

You are evaluating an implementation artifact for target {target_name} against an evaluation specification produced by the meta judge.

CLAUDE_PLUGIN_ROOT=`${CLAUDE_PLUGIN_ROOT}`

## User Prompt
{Original task description from user}

## Target
{Specific target: file path or component name}

{IF pre-existing changes are known, include the following section — otherwise omit entirely}

## Pre-existing or Expected Parallel Changes (Context Only)

The following changes were made before or expected to be done by other parallel agents in the same batch now. They are NOT part of the current implementation agent's output. Focus your evaluation on the current agent's changes to its specific target. Only verify other changed files/logic if they directly relate to the current target's task requirements.

### {Source of changes: e.g., "Previous do-in-parallel: {task description}" or "User modifications (before current task)"}
{High-level summary: what was done, which files/modules were created or modified}

{END conditional section}

## Evaluation Specification

```yaml
{meta-judge's evaluation specification YAML}

实现输出

{实现 Agent 的摘要部分} {已修改文件的路径}

说明

用户提示词作为上下文提供,你应仅将其用作参考,以了解项目中其他 Agent 可能产生的变更。仅根据用户提示词中的任务进行评估。你的工作只是验证该目标的这一特定部分,而不是用户提示词中的所有任务。 按照你的 Agent 指令中定义的完整裁判流程进行操作!

输出

重要:你必须在回复开头使用 YAML 格式,严格按照以下结构化评估报告格式作答!


CRITICAL: NEVER provide score threshold, in any format, including `threshold_pass` or anything different. Judge MUST not know what threshold for score is, in order to not be biased!!!

##### 5.2.3 Shared Group Judge Prompt Template

For shared groups where ONE judge reviews ALL related changes together:

```markdown
You are evaluating implementation artifacts for a group of related tasks against a combined evaluation specification produced by the meta judge. These tasks are interdependent and must be reviewed together.

CLAUDE_PLUGIN_ROOT=`${CLAUDE_PLUGIN_ROOT}`

## User Prompt
{Original task description from user}

## Tasks in This Shared Group
{List of all tasks with their targets:
- Task 1: {description} -> {target}
- Task 2: {description} -> {target}
}

{IF pre-existing changes are known, include the "Pre-existing or Expected Parallel Changes (Context Only)" section — otherwise omit entirely}

## Evaluation Specification

```yaml
{meta-judge's COMBINED evaluation specification YAML}

实现输出

{针对组内的每项任务:}

任务:{任务描述} -> {目标}

{该任务对应的实现 Agent 的摘要部分} {已修改文件的路径}

说明

用户提示作为上下文提供,你只能将其用作参考,了解其他 Agent 可能对项目做出的更改。请综合评估此共享组中的所有任务。验证跨任务集成点(例如,适配器是否与集成模块使用的接口匹配)。 关键:分别指出每项任务是通过还是未通过,以便只重试未通过的任务。 请按照 Agent 指令中定义的完整评审流程进行!

输出

关键:你必须在回复开头使用 YAML 格式,严格按照以下结构化评估报告格式作答!在报告中包含每项任务的判定结果。


##### 5.2.4 Dispatch Judges by Grouping Type

**Independent and Repeatable targets -- one judge per task:**

使用 Task 工具:

  • description: "Judge: {target name}"
  • prompt: {包含精确元评审规范 YAML 的评审核验提示,以及适用时的“预先存在或预期的并行更改”部分}
  • model: opus
  • subagent_type: "sadd:judge"

For repeatable groups, each judge receives the SAME shared reusable spec from the group's single meta-judge. The judge prompt template from 5.2.2 is used as-is; only the target and implementation output differ between judges.

**Shared group -- ONE judge for the entire group:**

使用 Task 工具:

  • description: "Judge (shared): {group description}"
  • prompt: {5.2.3 中的共享组评审提示,包含组合后的元评审规范 YAML 和所有实现输出}
  • model: opus
  • subagent_type: "sadd:judge"

**Launch ALL judges in parallel** (independent, repeatable, and shared judges all dispatched in same response).

CRITICAL: NEVER provide score threshold, in any format, including `threshold_pass` or anything different. Judge MUST not know what threshold for score is, in order to not be biased!!!

#### 5.3 Parse Verdict and Iterate

Parse judge output for each target (DO NOT read full report):

从评审回复中提取:

  • VERDICT:PASS 或 FAIL
  • SCORE:X.X/5.0
  • ISSUES:问题列表(如有)
  • IMPROVEMENTS:建议列表(如有)

**Decision logic per target:**

如果分数 >= 4: -> VERDICT:PASS -> 将目标标记为完成 -> 将 IMPROVEMENTS 作为可选改进列出

如果分数 >= 3.0 且发现的问题均为低优先级,则: -> VERDICT:PASS -> 将目标标记为完成 -> 将 IMPROVEMENTS 作为可选改进列出

如果分数 < 4: -> VERDICT:FAIL -> 检查此目标的重试次数

如果重试次数 < 3: -> 根据评审反馈调度重试实现 Agent -> 返回目标专属元评审规范,重新进行评审核验

如果重试次数 >= 3: -> 将目标标记为失败(与其他目标隔离) -> 未经用户决定,不得继续重试


**IMPORTANT: Failures are isolated**
- One target failing does NOT affect other targets
- Other parallel tasks continue independently
- Only the failed target is retried

**Shared group verdict parsing:**

For shared groups, the judge produces per-task verdicts within a single report. Parse each task's verdict individually:

从共享评审回复中提取:

  • 每项任务的判定结果:
    • 任务 1({target}):VERDICT:PASS/FAIL,SCORE:X.X/5.0,ISSUES:[…]
    • 任务 2({target}):VERDICT:PASS/FAIL,SCORE:X.X/5.0,ISSUES:[…]
  • OVERALL SCORE:X.X/5.0
  • CROSS-TASK ISSUES:集成问题列表(如有)

**Shared group retry logic:**

如果共享评审发现未通过项:

  1. 根据每项任务的判定结果,确定具体哪些任务未通过
  2. 仅重新启动未通过任务对应的实现 Agent -- 不要重新启动已通过任务对应的 Agent
  3. 重试实现完成后,重新启动共享评审, 再次检查所有更改(已通过项和重试项) -- 共享评审仍使用相同的组合元评审规范
  4. 重复上述流程,直到所有任务通过,或任一任务达到最大重试次数

关键:只重试未通过的具体实现 Agent。 已通过的任务不得重新实现。每轮共享评审都必须结合完整任务组进行审查。


#### 5.4 Retry with Feedback (If Needed)

**Retry prompt template:**

```markdown
## Retry Required for Target: {target_name}

Your previous implementation did not pass judge verification.

## Original Task
{Original task description}

## Target
{Specific target}

## Judge Feedback
VERDICT: FAIL
SCORE: {score}/5.0
ISSUES:
{list of issues from judge}

## Your Previous Changes
{files modified in previous attempt}

## Instructions
Let's fix the identified issues step by step.

1. Review each issue the judge identified
2. For each issue, determine the root cause
3. Plan the fix for each issue
4. Implement ALL fixes
5. Verify your fixes address each issue
6. Provide updated Summary section

CRITICAL: Focus on fixing the specific issues identified. Do not rewrite everything.
阶段 6:收集并汇总结果

所有 Agent 完成后(包括必要的重试),汇总结果:

## Parallel Execution Summary

### Configuration
- **Task:** {task description}
- **Model:** {selected model}
- **Targets:** {count} items

### Results

| Target | Grouping | Model | Judge Score | Retries | Status | Summary |
|--------|----------|-------|-------------|---------|--------|---------|
| {target_1} | {Repeatable/Shared/Independent} | {model} | {X.X}/5.0 | {0-3} | SUCCESS | {brief outcome} |
| {target_2} | {Repeatable/Shared/Independent} | {model} | {X.X}/5.0 | {0-3} | SUCCESS | {brief outcome} |
| {target_3} | {Repeatable/Shared/Independent} | {model} | {X.X}/5.0 | {3} | FAILED | {failure reason} |
| ... | ... | ... | ... | ... | ... | ... |

### Overall Assessment
- **Completed:** {X}/{total}
- **Failed:** {Y}/{total}
- **Total Retries:** {sum of all retries}
- **Common patterns:** {any patterns across results}

### Verification Summary
{Aggregate judge verification results - any common issues?}

### Files Modified
- {list of all modified files}

### Failed Targets (If Any)
{For each failed target after max retries}
- **Target:** {name}
- **Final Score:** {X.X}/5.0
- **Persistent Issues:** {issues that weren't resolved}
- **Options:** Retry with guidance / Skip / Manual fix

### Next Steps
{If any failures, suggest remediation}

失败处理:

  • 清楚说明失败的任务及错误详情
  • 成功任务不受失败影响
  • 达到最大重试次数后,将失败目标隔离
  • 提供可选方案:给出指导、跳过或手动修复

示例

示例 1:需求分组——混合可重复项与独立项(存在先前批次的更改)

场景:

一个团队连续运行两个并行执行批次。第一个批次更新 3 个端点文件中的 API 文档(src/api/users.ts、src/api/orders.ts、src/api/products.ts)。第二个批次为 src 文件夹中的全部 3 个模块添加测试,并在 GitHub Actions 中添加一个测试步骤。第二个批次中每个 Agent 的评审器都需要了解第一个批次中的文档更改,以及同一第二批次中其他并行 Agent 预期进行的更改。

输入(第二批次——第一批次已在本次会话中较早完成):

/do-in-parallel add tests to all 3 modules in src folder and add tests step to github actions

编排器分析:

Phase 2: Task Analysis + Requirement Grouping

1. Task Identification:
   - Task A: "Add tests to src/modules/auth.ts"
   - Task B: "Add tests to src/modules/cart.ts"
   - Task C: "Add tests to src/modules/payments.ts"
   - Task D: "Add tests step to GitHub Actions CI pipeline"

2. Requirement Grouping:
   - Tasks A, B, C: REPEATABLE — same task ("add tests") applied to 3 different modules
     → ONE shared meta-judge producing a reusable spec
   - Task D: INDEPENDENT — different task type (CI configuration)
     → Separate meta-judge

3. Pre-existing and Expected Parallel Changes Assessment:
   - Pre-existing (from prior batch): API documentation updated across
     src/api/users.ts, src/api/orders.ts, src/api/products.ts
   - Expected parallel: Each agent should be aware that other agents in this
     batch are adding tests to other modules and updating GH Actions simultaneously

4. Agent Count:
   - Meta-judges: 2 (1 repeatable for tests + 1 independent for GH Actions)
   - Implementation agents: 4 (one per task, always isolated)
   - Judges: 4 (3 using shared test spec + 1 for GH Actions)
   - Total: 10 agents (vs. 12 without grouping)

阶段 3.5:分发元评审器(2 个元评审器并行运行):

[Meta-judge 1: Repeatable group — test generation]
Use Task tool:
  - description: "Meta-judge (repeatable): reusable spec for adding tests across 3 modules"
  - prompt:
    ## Task

    Generate a REUSABLE evaluation specification yaml that can be applied to
    ANY of the following targets performing the same task. You will produce
    rubrics, checklists, and scoring criteria that individual judge agents
    will each use independently to evaluate one target's implementation artifact.

    CLAUDE_PLUGIN_ROOT={CLAUDE_PLUGIN_ROOT}

    ## User Prompt as Context
    add tests to all 3 modules in src folder and add tests step to github actions

    ## Task Being Repeated
    Add comprehensive unit tests to a source module

    ## Targets in This Group
    - src/modules/auth.ts
    - src/modules/cart.ts
    - src/modules/payments.ts

    ## Context
    Project uses Jest for testing. Test files should be co-located as
    *.test.ts files. Existing test patterns available in src/modules/__tests__/.

    ## Artifact Type
    code

    ## Instructions
    CRITICAL: You are generating a REUSABLE spec that will be applied to
    EACH target independently by separate judges.
    - Use generic language: "target file should align with criteria" instead
      of "all files should align"
    - Do NOT include file-specific requirements (e.g., NOT "auth.ts should
      test only authentication logic") since this same spec will be applied
      to different files
    - The spec must be applicable to ANY target in this group without modification
    - Each judge will receive this same spec and evaluate only its own target
      against it
    User prompt is provided as context, you should use it only as reference
    of changes that can occur in the project by other agents.
    Return only the final evaluation specification YAML in your response.
  - model: opus
  - subagent_type: "sadd:meta-judge"

[Meta-judge 2: Independent — GitHub Actions]
Use Task tool:
  - description: "Meta-judge: add tests step to GitHub Actions"
  - prompt:
    ## Task

    Generate an evaluation specification yaml for the following task applied
    to a specific target. You will produce rubrics, checklists, and scoring
    criteria that a judge agent will use to evaluate the implementation
    artifact for this specific target.

    CLAUDE_PLUGIN_ROOT={CLAUDE_PLUGIN_ROOT}

    ## User Prompt as Context
    add tests to all 3 modules in src folder and add tests step to github actions

    ## Target
    Add a test execution step to the GitHub Actions CI pipeline
    (.github/workflows/ci.yml or similar)

    ## Context
    Project uses Jest for testing. The CI pipeline should run tests after
    build step. Existing workflow file may need a new job or step.

    ## Artifact Type
    configuration

    ## Instructions
    User prompt is provided as context, you should use it only as reference
    of changes that can occur in the project by other agents. Generate
    evaluation specification ONLY for adding the tests step to GitHub Actions.
    Your report will be used to verify only this particular task, not the
    all tasks in the user prompt.
    Return only the final evaluation specification YAML in your response.
  - model: opus
  - subagent_type: "sadd:meta-judge"

[Both meta-judges launched simultaneously]

阶段 5:分发实现任务(元评审器完成后,4 个 Agent 并行运行):

[Implementation 1: auth module tests]
Use Task tool:
  - description: "Parallel: add tests to src/modules/auth.ts"
  - prompt:
    ## Reasoning Approach
    Let's think step by step.
    Before taking any action, think through the problem systematically:
    1. "Let me first understand what is being asked for this specific target..."
    2. "Let me analyze this specific target..."
    3. "Let me plan my approach..."
    Work through each step explicitly before implementing.

    <task>Add comprehensive unit tests</task>
    <target>src/modules/auth.ts</target>
    <constraints>
    - Work ONLY on the specified target
    - Do NOT modify other files unless explicitly required
    - Follow existing test patterns in the project
    </constraints>
    <output>
    Create test file for the auth module.
    CRITICAL: At the end of your work, provide a "Summary" section containing:
    - Files modified (full paths)
    - Key changes (3-5 bullet points)
    - Any decisions made and rationale
    </output>

    ## Self-Critique Verification (MANDATORY)
    [standard self-critique suffix]
  - model: sonnet

[Implementation 2: cart module tests]
Use Task tool:
  - description: "Parallel: add tests to src/modules/cart.ts"
  - prompt:
    ## Reasoning Approach
    Let's think step by step.
    Before taking any action, think through the problem systematically:
    1. "Let me first understand what is being asked for this specific target..."
    2. "Let me analyze this specific target..."
    3. "Let me plan my approach..."
    Work through each step explicitly before implementing.

    <task>Add comprehensive unit tests</task>
    <target>src/modules/cart.ts</target>
    <constraints>
    - Work ONLY on the specified target
    - Do NOT modify other files unless explicitly required
    - Follow existing test patterns in the project
    </constraints>
    <output>
    Create test file for the cart module.
    CRITICAL: At the end of your work, provide a "Summary" section containing:
    - Files modified (full paths)
    - Key changes (3-5 bullet points)
    - Any decisions made and rationale
    </output>

    ## Self-Critique Verification (MANDATORY)
    Before submitting, verify your work:
    1. Re-read the original task and confirm every requirement is addressed
    2. Check that all tests follow existing patterns in the project
    3. Verify no unrelated files were modified
    4. Confirm the Summary section is complete and accurate
  - model: sonnet

[Implementation 3: payments module tests]
Use Task tool:
  - description: "Parallel: add tests to src/modules/payments.ts"
  - prompt: [Same CoT prefix + task body for payments.ts + critique suffix]
  - model: sonnet

[Implementation 4: GitHub Actions test step]
Use Task tool:
  - description: "Parallel: add tests step to GitHub Actions CI"
  - prompt:
    ## Reasoning Approach
    Let's think step by step.
    Before taking any action, think through the problem systematically:
    1. "Let me first understand what is being asked for this specific target..."
    2. "Let me analyze this specific target..."
    3. "Let me plan my approach..."
    Work through each step explicitly before implementing.

    <task>Add a test execution step to the GitHub Actions CI pipeline</task>
    <target>.github/workflows/ci.yml</target>
    <constraints>
    - Work ONLY on the CI workflow file
    - Add a step that runs the test suite after the build step
    - Do NOT modify other workflow files or steps beyond what is necessary
    - Follow existing workflow patterns and conventions
    </constraints>
    <output>
    Update the CI workflow with a test execution step.
    CRITICAL: At the end of your work, provide a "Summary" section containing:
    - Files modified (full paths)
    - Key changes (3-5 bullet points)
    - Any decisions made and rationale
    </output>

    ## Self-Critique Verification (MANDATORY)
    Before submitting, verify your work:
    1. Re-read the original task and confirm every requirement is addressed
    2. Check that the workflow YAML is valid and well-structured
    3. Verify no unrelated workflow steps were modified
    4. Confirm the Summary section is complete and accurate
  - model: sonnet

[All 4 launched simultaneously]

阶段 5.2:分发评审任务(所有实现者完成后,4 个评审器并行运行):

[Judge 1: auth module — uses SHARED reusable spec from repeatable meta-judge]
Use Task tool:
  - description: "Judge: src/modules/auth.ts"
  - prompt:
    You are evaluating an implementation artifact for target
    src/modules/auth.ts against an evaluation specification produced
    by the meta judge.

    CLAUDE_PLUGIN_ROOT={CLAUDE_PLUGIN_ROOT}

    ## User Prompt
    add tests to all 3 modules in src folder and add tests step to github actions

    ## Target
    src/modules/auth.ts

    ## Pre-existing and expected parallel changes (Context Only)

    The following changes were made before or expected to be done by
    other parallel agents in the same batch now. They are NOT part of
    the current implementation agent's output. Focus your evaluation
    on the current agent's changes to its specific target. Only verify
    other changed files/logic if they directly relate to the current
    target's task requirements.

    ### Previous do-in-parallel: "Update API documentation for all endpoints"
    The following files were modified as part of a previous parallel batch:
    - src/api/users.ts (modified) - Added JSDoc to public methods,
      updated module header
    - src/api/orders.ts (modified) - Added JSDoc to public methods,
      added @example tags
    - src/api/products.ts (modified) - Added JSDoc to public methods,
      updated type annotations

    ### Expected parallel changes (current batch)
    Other agents in this batch are simultaneously:
    - Adding tests to src/modules/cart.ts and src/modules/payments.ts
      (repeatable group — same task on other modules)
    - Adding a tests step to .github/workflows/ci.yml (independent task)

    ## Evaluation Specification
    ```yaml
    {EXACT reusable spec YAML from repeatable meta-judge — same for all 3 module judges}
    ```

    ## Implementation Output
    {Summary from auth implementation agent}

    ## Instructions
    User prompt is provided as context, you should use it only as reference
    of changes that can occur in the project by other agents. Evaluate ONLY
    the test generation for auth.ts.
    Follow your full judge process as defined in your agent instructions!

    ## Output
    CRITICAL: You must reply with this exact structured evaluation report
    format in YAML at the START of your response!
  - model: opus
  - subagent_type: "sadd:judge"

[Judge 2: cart module — uses SAME shared reusable spec]
Use Task tool:
  - description: "Judge: src/modules/cart.ts"
  - prompt: [Same judge template, same reusable spec YAML, cart implementation output.
    Pre-existing and expected parallel changes section: same prior batch info,
    expected parallel changes list auth.ts, payments.ts, and GH Actions instead]
  - model: opus
  - subagent_type: "sadd:judge"

[Judge 3: payments module — uses SAME shared reusable spec]
Use Task tool:
  - description: "Judge: src/modules/payments.ts"
  - prompt: [Same judge template, same reusable spec YAML, payments implementation output.
    Pre-existing and expected parallel changes section: same prior batch info,
    expected parallel changes list auth.ts, cart.ts, and GH Actions instead]
  - model: opus
  - subagent_type: "sadd:judge"

[Judge 4: GitHub Actions — uses INDEPENDENT spec from GH Actions meta-judge]
Use Task tool:
  - description: "Judge: GitHub Actions CI"
  - prompt:
    You are evaluating an implementation artifact for target
    .github/workflows/ci.yml against an evaluation specification produced
    by the meta judge.

    CLAUDE_PLUGIN_ROOT={CLAUDE_PLUGIN_ROOT}

    ## User Prompt
    add tests to all 3 modules in src folder and add tests step to github actions

    ## Target
    .github/workflows/ci.yml

    ## Pre-existing and expected parallel changes (Context Only)

    The following changes were made before or expected to be done by
    other parallel agents in the same batch now. They are NOT part of
    the current implementation agent's output. Focus your evaluation
    on the current agent's changes to its specific target. Only verify
    other changed files/logic if they directly relate to the current
    target's task requirements.

    ### Previous do-in-parallel: "Update API documentation for all endpoints"
    The following files were modified as part of a previous parallel batch:
    - src/api/users.ts (modified) - Added JSDoc to public methods,
      updated module header
    - src/api/orders.ts (modified) - Added JSDoc to public methods,
      added @example tags
    - src/api/products.ts (modified) - Added JSDoc to public methods,
      updated type annotations

    ### Expected parallel changes (current batch)
    Other agents in this batch are simultaneously:
    - Adding tests to src/modules/auth.ts, src/modules/cart.ts,
      and src/modules/payments.ts (repeatable group — test generation)

    ## Evaluation Specification
    ```yaml
    {EXACT spec YAML from independent GH Actions meta-judge}
    ```

    ## Implementation Output
    {Summary from GH Actions implementation agent}

    ## Instructions
    User prompt is provided as context, you should use it only as reference
    of changes that can occur in the project by other agents. Evaluate ONLY
    the GitHub Actions test step.
    Follow your full judge process as defined in your agent instructions!

    ## Output
    CRITICAL: You must reply with this exact structured evaluation report
    format in YAML at the START of your response!
  - model: opus
  - subagent_type: "sadd:judge"

[All 4 judges launched simultaneously]

结果:

目标分组模型评审分数重试次数状态
src/modules/auth.ts可重复sonnet4.2/5.00成功
src/modules/cart.ts可重复sonnet4.0/5.00成功
src/modules/payments.ts可重复sonnet4.1/5.00成功
.github/workflows/ci.yml独立sonnet4.3/5.00成功

总体: 4/4 已完成。Agent 总数:10(2 个元评审器 + 4 个实现 Agent + 4 个评审器)


示例 2:需求分组——共享项与可重复项组合(存在用户先前的更改)

场景:

一位开发者在整个对话过程中一直在开发 Node.js 后端。他们重构了数据库连接层,并手动更新了多个服务模块,包括添加 S3 类接口。随后,他们调用 do-in-parallel 来实现并集成 S3 接口,同时重构 cart 模块。每个 Agent 的评审器都需要了解用户先前的修改,以及同一批次中其他并行 Agent 预期进行的更改。

输入:

/do-in-parallel I wrote class interface for S3 service in s3.adapter.ts, please do 2 tasks: implement s3 adapter with tests and integrate s3 adapter to analytics module. Also refactor and simplify all files in cart module

编排器分析:

Phase 2: Task Analysis + Requirement Grouping

1. Task Identification:
   - Task A: "Implement S3 adapter with tests in src/adapters/s3.adapter.ts"
   - Task B: "Integrate S3 adapter into src/modules/analytics.module.ts"
   - Task C: "Refactor and simplify src/modules/cart/cart.service.ts"
   - Task D: "Refactor and simplify src/modules/cart/cart.repository.ts"
   - Task E: "Refactor and simplify src/modules/cart/cart.controller.ts"

2. Requirement Grouping:
   - Tasks A, B: SHARED — interdependent (adapter must match interface consumed
     by analytics integration; should be reviewed together)
     → ONE combined meta-judge, ONE shared judge
   - Tasks C, D, E: REPEATABLE — same task ("refactor and simplify") applied
     to 3 different files in cart module
     → ONE reusable meta-judge

3. Pre-existing and Expected Parallel Changes Assessment:
   - Pre-existing (user modifications): Refactored database connection layer
     (src/db/connection.ts, src/db/queries.ts), updated service modules,
     and added S3 class interface in src/adapters/s3.adapter.ts
   - Expected parallel: S3 adapter implementation and analytics integration
     run in parallel (shared group); cart refactoring agents run in parallel
     (repeatable group); both groups run simultaneously

4. Agent Count:
   - Meta-judges: 2 (1 shared for S3 work + 1 repeatable for cart refactoring)
   - Implementation agents: 5 (one per task, always isolated)
   - Judges: 4 (1 shared for S3 group + 3 individual for cart)
   - Total: 11 agents (vs. 15 without grouping)

阶段 3.5:分发元评审器(2 个元评审器并行运行):

[Meta-judge 1: Shared group — S3 adapter + integration]
Use Task tool:
  - description: "Meta-judge (shared): combined spec for S3 adapter and analytics integration"
  - prompt:
    ## Task

    Generate a COMBINED evaluation specification yaml that covers ALL of the
    following related tasks. These tasks are interdependent and will be
    reviewed TOGETHER by a single judge. You will produce rubrics, checklists,
    and scoring criteria that account for cross-task dependencies and
    integration points.

    CLAUDE_PLUGIN_ROOT={CLAUDE_PLUGIN_ROOT}

    ## User Prompt as Context
    I wrote class interface for S3 service in s3.adapter.ts, please do 2 tasks:
    implement s3 adapter with tests and integrate s3 adapter to analytics module.
    Also refactor and simplify all files in cart module

    ## Tasks in This Shared Group
    - Task A: Implement S3 adapter with tests -> src/adapters/s3.adapter.ts
    - Task B: Integrate S3 adapter into analytics module -> src/modules/analytics.module.ts

    ## Context
    The user has already written the class interface in s3.adapter.ts. Task A
    implements the interface methods and adds unit tests. Task B integrates the
    adapter into the analytics module. The adapter's public API from Task A must
    match what Task B consumes.

    ## Artifact Type
    code

    ## Instructions
    CRITICAL: You are generating a COMBINED spec for tasks that will be
    reviewed TOGETHER by ONE judge.
    - Include evaluation criteria for EACH individual task
    - Include cross-task verification criteria (e.g., "S3 adapter's public
      methods match the calls made by the analytics integration")
    - Organize the spec so the judge can identify which criteria apply to
      which task's changes
    - The judge will review ALL changes from ALL tasks in this group in a
      single evaluation
    User prompt is provided as context, you should use it only as reference
    of changes that can occur in the project by other agents.
    Return only the final evaluation specification YAML in your response.
  - model: opus
  - subagent_type: "sadd:meta-judge"

[Meta-judge 2: Repeatable group — cart refactoring]
Use Task tool:
  - description: "Meta-judge (repeatable): reusable spec for refactoring cart module files"
  - prompt:
    ## Task

    Generate a REUSABLE evaluation specification yaml that can be applied to
    ANY of the following targets performing the same task. You will produce
    rubrics, checklists, and scoring criteria that individual judge agents
    will each use independently to evaluate one target's implementation artifact.

    CLAUDE_PLUGIN_ROOT={CLAUDE_PLUGIN_ROOT}

    ## User Prompt as Context
    I wrote class interface for S3 service in s3.adapter.ts, please do 2 tasks:
    implement s3 adapter with tests and integrate s3 adapter to analytics module.
    Also refactor and simplify all files in cart module

    ## Task Being Repeated
    Refactor and simplify a source file in the cart module

    ## Targets in This Group
    - src/modules/cart/cart.service.ts
    - src/modules/cart/cart.repository.ts
    - src/modules/cart/cart.controller.ts

    ## Context
    All three files are in the cart module. Refactoring should simplify logic,
    reduce complexity, improve readability while preserving existing behavior.

    ## Artifact Type
    code

    ## Instructions
    CRITICAL: You are generating a REUSABLE spec that will be applied to
    EACH target independently by separate judges.
    - Use generic language: "target file should align with criteria" instead
      of "all files should align"
    - Do NOT include file-specific requirements since this same spec will be
      applied to different files
    - The spec must be applicable to ANY target in this group without modification
    User prompt is provided as context, you should use it only as reference
    of changes that can occur in the project by other agents.
    Return only the final evaluation specification YAML in your response.
  - model: opus
  - subagent_type: "sadd:meta-judge"

[Both meta-judges launched simultaneously]

阶段 5:分发实现任务(元评审器完成后,5 个 Agent 并行运行):

[Implementation 1: S3 adapter]
Use Task tool:
  - description: "Parallel: implement S3 adapter with tests"
  - prompt:
    ## Reasoning Approach
    Let's think step by step.
    Before taking any action, think through the problem systematically:
    1. "Let me first understand what is being asked for this specific target..."
    2. "Let me analyze this specific target..."
    3. "Let me plan my approach..."
    Work through each step explicitly before implementing.

    <task>Implement S3 adapter with tests based on the existing class interface</task>
    <target>src/adapters/s3.adapter.ts</target>
    <constraints>
    - Work ONLY on the specified target
    - Implement all methods defined in the existing class interface
    - Add comprehensive unit tests
    - Do NOT modify the analytics module
    </constraints>
    <output>
    Implement the S3 adapter and create tests.
    CRITICAL: At the end of your work, provide a "Summary" section containing:
    - Files modified (full paths)
    - Key changes (3-5 bullet points)
    - Any decisions made and rationale
    </output>

    ## Self-Critique Verification (MANDATORY)
    Before submitting, verify your work:
    1. Re-read the original task and confirm every requirement is addressed
    2. Check that the adapter implements all interface methods correctly
    3. Verify no unrelated files were modified
    4. Confirm the Summary section is complete and accurate
  - model: opus

[Implementation 2: Analytics integration]
Use Task tool:
  - description: "Parallel: integrate S3 adapter into analytics module"
  - prompt:
    ## Reasoning Approach
    [standard CoT prefix]

    <task>Integrate S3 adapter into the analytics module</task>
    <target>src/modules/analytics.module.ts</target>
    <constraints>
    - Work ONLY on the specified target
    - Import and use the S3 adapter from src/adapters/s3.adapter.ts
    - Follow existing dependency injection patterns
    - Do NOT modify the S3 adapter itself
    </constraints>
    <output>
    Integrate S3 adapter into analytics module.
    CRITICAL: At the end of your work, provide a "Summary" section.
    </output>

    ## Self-Critique Verification (MANDATORY)
    [standard self-critique suffix]
  - model: opus

[Implementation 3: cart.service.ts refactoring]
Use Task tool:
  - description: "Parallel: refactor src/modules/cart/cart.service.ts"
  - prompt:
    ## Reasoning Approach
    Let's think step by step.
    Before taking any action, think through the problem systematically:
    1. "Let me first understand what is being asked for this specific target..."
    2. "Let me analyze this specific target..."
    3. "Let me plan my approach..."
    Work through each step explicitly before implementing.

    <task>Refactor and simplify the cart service</task>
    <target>src/modules/cart/cart.service.ts</target>
    <constraints>
    - Work ONLY on the specified target
    - Simplify logic, reduce complexity, improve readability
    - Preserve existing behavior — no functional changes
    - Do NOT modify other cart module files
    </constraints>
    <output>
    Refactor the cart service file.
    CRITICAL: At the end of your work, provide a "Summary" section containing:
    - Files modified (full paths)
    - Key changes (3-5 bullet points)
    - Any decisions made and rationale
    </output>

    ## Self-Critique Verification (MANDATORY)
    Before submitting, verify your work:
    1. Re-read the original task and confirm every requirement is addressed
    2. Check that existing behavior is preserved after refactoring
    3. Verify no unrelated files were modified
    4. Confirm the Summary section is complete and accurate
  - model: sonnet

[Implementation 4: cart.repository.ts refactoring]
Use Task tool:
  - description: "Parallel: refactor src/modules/cart/cart.repository.ts"
  - prompt: [Same CoT prefix + refactoring task body for cart.repository.ts + critique suffix]
  - model: sonnet

[Implementation 5: cart.controller.ts refactoring]
Use Task tool:
  - description: "Parallel: refactor src/modules/cart/cart.controller.ts"
  - prompt: [Same CoT prefix + refactoring task body for cart.controller.ts + critique suffix]
  - model: sonnet

[All 5 launched simultaneously]

阶段 5.2:分发评审任务(所有实现者完成后,4 个评审器并行运行):

[Judge 1: SHARED judge for S3 group — reviews both S3 adapter + analytics integration]
Use Task tool:
  - description: "Judge (shared): S3 adapter implementation and analytics integration"
  - prompt:
    You are evaluating implementation artifacts for a group of related tasks
    against a combined evaluation specification produced by the meta judge.
    These tasks are interdependent and must be reviewed together.

    CLAUDE_PLUGIN_ROOT={CLAUDE_PLUGIN_ROOT}

    ## User Prompt
    I wrote class interface for S3 service in s3.adapter.ts, please do 2 tasks:
    implement s3 adapter with tests and integrate s3 adapter to analytics module.
    Also refactor and simplify all files in cart module

    ## Tasks in This Shared Group
    - Task A: Implement S3 adapter with tests -> src/adapters/s3.adapter.ts
    - Task B: Integrate S3 adapter into analytics module -> src/modules/analytics.module.ts

    ## Pre-existing and expected parallel changes (Context Only)

    The following changes were made before or expected to be done by
    other parallel agents in the same batch now. They are NOT part of
    the current implementation agents' output for this shared group.
    Focus your evaluation on the S3 group's changes. Only verify other
    changed files/logic if they directly relate to these tasks.

    ### User modifications (before current task)
    The user made changes to the following files/modules before this
    task was started:
    - src/db/connection.ts (modified) - Refactored database connection
      pooling
    - src/db/queries.ts (modified) - Updated query builder patterns
    - src/adapters/s3.adapter.ts (created) - Added S3 class interface
      (the interface that Task A implements)
    - Several service modules updated to use new DB connection API

    ### Expected parallel changes (current batch)
    Other agents in this batch are simultaneously:
    - Refactoring src/modules/cart/cart.service.ts (repeatable group)
    - Refactoring src/modules/cart/cart.repository.ts (repeatable group)
    - Refactoring src/modules/cart/cart.controller.ts (repeatable group)

    ## Evaluation Specification
    ```yaml
    {EXACT combined spec YAML from shared S3 meta-judge}
    ```

    ## Implementation Outputs
    ### Task: Implement S3 adapter with tests -> src/adapters/s3.adapter.ts
    {Summary from S3 adapter implementation agent}
    Files: src/adapters/s3.adapter.ts (modified), src/adapters/s3.adapter.test.ts (created)

    ### Task: Integrate S3 adapter into analytics -> src/modules/analytics.module.ts
    {Summary from analytics integration agent}
    Files: src/modules/analytics.module.ts (modified)

    ## Instructions
    User prompt is provided as context, you should use it only as reference
    of changes that can occur in the project by other agents. Evaluate ALL
    tasks in this shared group together. Verify cross-task integration points
    (e.g., does the adapter's public API match what the analytics module consumes?).
    CRITICAL: For each task, indicate separately whether it PASSED or FAILED
    so that only failing tasks can be retried.
    Follow your full judge process as defined in your agent instructions!

    ## Output
    CRITICAL: You must reply with this exact structured evaluation report
    format in YAML at the START of your response! Include per-task verdicts.
  - model: opus
  - subagent_type: "sadd:judge"

[Judge 2: cart.service.ts — uses SHARED reusable spec from repeatable meta-judge]
Use Task tool:
  - description: "Judge: src/modules/cart/cart.service.ts"
  - prompt:
    You are evaluating an implementation artifact for target
    src/modules/cart/cart.service.ts against an evaluation specification
    produced by the meta judge.

    CLAUDE_PLUGIN_ROOT={CLAUDE_PLUGIN_ROOT}

    ## User Prompt
    [original user prompt]

    ## Target
    src/modules/cart/cart.service.ts

    ## Pre-existing and expected parallel changes (Context Only)

    The following changes were made before or expected to be done by
    other parallel agents in the same batch now. They are NOT part of
    the current implementation agent's output. Focus your evaluation
    on the current agent's changes to its specific target. Only verify
    other changed files/logic if they directly relate to the current
    target's task requirements.

    ### User modifications (before current task)
    The user made changes to the following files/modules before this
    task was started:
    - src/db/connection.ts (modified) - Refactored database connection
      pooling
    - src/db/queries.ts (modified) - Updated query builder patterns
    - src/adapters/s3.adapter.ts (created) - Added S3 class interface
    - Several service modules updated to use new DB connection API

    ### Expected parallel changes (current batch)
    Other agents in this batch are simultaneously:
    - Implementing S3 adapter in src/adapters/s3.adapter.ts (shared group)
    - Integrating S3 adapter into src/modules/analytics.module.ts (shared group)
    - Refactoring src/modules/cart/cart.repository.ts (repeatable group)
    - Refactoring src/modules/cart/cart.controller.ts (repeatable group)

    ## Evaluation Specification
    ```yaml
    {EXACT reusable spec YAML from repeatable cart meta-judge — same for all 3 cart judges}
    ```

    ## Implementation Output
    {Summary from cart.service.ts implementation agent}

    ## Instructions
    User prompt is provided as context, you should use it only as reference
    of changes that can occur in the project by other agents. Evaluate ONLY
    the refactoring of cart.service.ts.
    Follow your full judge process as defined in your agent instructions!

    ## Output
    CRITICAL: You must reply with this exact structured evaluation report
    format in YAML at the START of your response!
  - model: opus
  - subagent_type: "sadd:judge"

[Judge 3: cart.repository.ts — uses SAME shared reusable spec]
Use Task tool:
  - description: "Judge: src/modules/cart/cart.repository.ts"
  - prompt: [Same judge template, same reusable spec YAML, cart.repository implementation output.
    Pre-existing and expected parallel changes section: same user modifications,
    expected parallel changes list S3 group, cart.service.ts, and cart.controller.ts instead]
  - model: opus
  - subagent_type: "sadd:judge"

[Judge 4: cart.controller.ts — uses SAME shared reusable spec]
Use Task tool:
  - description: "Judge: src/modules/cart/cart.controller.ts"
  - prompt: [Same judge template, same reusable spec YAML, cart.controller implementation output.
    Pre-existing and expected parallel changes section: same user modifications,
    expected parallel changes list S3 group, cart.service.ts, and cart.repository.ts instead]
  - model: opus
  - subagent_type: "sadd:judge"

[All 4 judges launched simultaneously]

共享评审器重试场景(如果 S3 共享评审器发现问题):

Shared Judge Verdict:
  - Task A (S3 adapter): PASS, SCORE: 4.2/5.0
  - Task B (analytics integration): FAIL, SCORE: 3.0/5.0
    ISSUES: Analytics module imports wrong method name from S3 adapter
  - CROSS-TASK ISSUES: Method signature mismatch between adapter and consumer

Retry Decision:
  → Task A PASSED — do NOT re-launch S3 adapter implementation agent
  → Task B FAILED — re-launch ONLY the analytics integration agent with feedback
  → After retry, re-launch shared judge to review ALL changes again

结果:

目标分组模型评审分数重试次数状态
src/adapters/s3.adapter.ts共享opus4.2/5.00成功
src/modules/analytics.module.ts共享opus4.1/5.01成功
src/modules/cart/cart.service.ts可重复sonnet4.0/5.00成功
src/modules/cart/cart.repository.ts可重复sonnet4.3/5.00成功
src/modules/cart/cart.controller.ts可重复sonnet4.1/5.00成功

总体: 5/5 已完成。Agent 总数:12(2 个元评审器 + 5 个实现 Agent + 1 次重试 + 4 个评审器[1 次共享项重新评审 + 3 个 cart 评审器])


示例 3:需求分组——全部独立

输入:

/do-in-parallel write tests for loan.service.ts, add password recovery feature to auth module and enable caching during dependency loading in github actions.

协调器分析:

Phase 2: Task Analysis + Requirement Grouping

1. Task Identification:
   - Task A: "Write tests for src/services/loan.service.ts"
   - Task B: "Add password recovery feature to src/modules/auth/"
   - Task C: "Enable caching during dependency loading in .github/workflows/ci.yml"

2. Requirement Grouping:
   - Task A: INDEPENDENT — test generation for a specific service
   - Task B: INDEPENDENT — new feature in auth module (unrelated to tasks A and C)
   - Task C: INDEPENDENT — CI configuration change (unrelated to tasks A and B)
   - No grouping possible: all 3 tasks are different task types on different targets

3. Agent Count:
   - Meta-judges: 3 (one per task — standard flow)
   - Implementation agents: 3 (one per task)
   - Judges: 3 (one per task)
   - Total: 9 agents (no reduction possible)

阶段 3.5:元评审器派发(3 个元评审器并行):

[Meta-judge 1: Independent — loan service tests]
Use Task tool:
  - description: "Meta-judge: write tests for loan.service.ts"
  - prompt:
    ## Task

    Generate an evaluation specification yaml for the following task applied
    to a specific target. You will produce rubrics, checklists, and scoring
    criteria that a judge agent will use to evaluate the implementation
    artifact for this specific target.

    CLAUDE_PLUGIN_ROOT={CLAUDE_PLUGIN_ROOT}

    ## User Prompt as Context
    write tests for loan.service.ts, add password recovery feature to auth
    module and enable caching during dependency loading in github actions.

    ## Target
    Write comprehensive unit tests for src/services/loan.service.ts

    ## Context
    Project uses Jest. Tests should cover all public methods, edge cases,
    and error scenarios for the loan service.

    ## Artifact Type
    code

    ## Instructions
    User prompt is provided as context, you should use it only as reference
    of changes that can occur in the project by other agents. Generate
    evaluation specification ONLY for the loan service test generation.
    Your report will be used to verify only this particular task, not the
    all tasks in the user prompt.
    Return only the final evaluation specification YAML in your response.
  - model: opus
  - subagent_type: "sadd:meta-judge"

[Meta-judge 2: Independent — password recovery feature]
Use Task tool:
  - description: "Meta-judge: add password recovery to auth module"
  - prompt:
    ## Task

    Generate an evaluation specification yaml for the following task applied
    to a specific target. You will produce rubrics, checklists, and scoring
    criteria that a judge agent will use to evaluate the implementation
    artifact for this specific target.

    CLAUDE_PLUGIN_ROOT={CLAUDE_PLUGIN_ROOT}

    ## User Prompt as Context
    write tests for loan.service.ts, add password recovery feature to auth
    module and enable caching during dependency loading in github actions.

    ## Target
    Add password recovery feature to src/modules/auth/ (password reset flow:
    request, token generation, validation, password update)

    ## Context
    Auth module handles authentication. Password recovery requires new
    endpoints, email integration, token management.

    ## Artifact Type
    code

    ## Instructions
    User prompt is provided as context, you should use it only as reference
    of changes that can occur in the project by other agents. Generate
    evaluation specification ONLY for the password recovery feature.
    Your report will be used to verify only this particular task, not the
    all tasks in the user prompt.
    Return only the final evaluation specification YAML in your response.
  - model: opus
  - subagent_type: "sadd:meta-judge"

[Meta-judge 3: Independent — GH Actions caching]
Use Task tool:
  - description: "Meta-judge: enable dependency caching in GitHub Actions"
  - prompt:
    ## Task

    Generate an evaluation specification yaml for the following task applied
    to a specific target. You will produce rubrics, checklists, and scoring
    criteria that a judge agent will use to evaluate the implementation
    artifact for this specific target.

    CLAUDE_PLUGIN_ROOT={CLAUDE_PLUGIN_ROOT}

    ## User Prompt as Context
    write tests for loan.service.ts, add password recovery feature to auth
    module and enable caching during dependency loading in github actions.

    ## Target
    Enable caching during dependency loading in .github/workflows/ci.yml
    (e.g., npm/yarn cache, actions/cache)

    ## Context
    GitHub Actions CI pipeline. Dependency installation step should use
    caching to speed up builds.

    ## Artifact Type
    configuration

    ## Instructions
    User prompt is provided as context, you should use it only as reference
    of changes that can occur in the project by other agents. Generate
    evaluation specification ONLY for enabling dependency caching in GH Actions.
    Your report will be used to verify only this particular task, not the
    all tasks in the user prompt.
    Return only the final evaluation specification YAML in your response.
  - model: opus
  - subagent_type: "sadd:meta-judge"

[All 3 meta-judges launched simultaneously]

阶段 5:实现任务派发(3 个 Agent 并行,在元评审器完成后):

[Implementation 1: loan service tests]
Use Task tool:
  - description: "Parallel: write tests for loan.service.ts"
  - prompt:
    ## Reasoning Approach
    Let's think step by step.
    Before taking any action, think through the problem systematically:
    1. "Let me first understand what is being asked for this specific target..."
    2. "Let me analyze this specific target..."
    3. "Let me plan my approach..."
    Work through each step explicitly before implementing.

    <task>Write comprehensive unit tests for the loan service</task>
    <target>src/services/loan.service.ts</target>
    <constraints>
    - Work ONLY on the specified target
    - Create test file co-located with the service
    - Cover all public methods, edge cases, and error scenarios
    - Follow existing test patterns in the project
    </constraints>
    <output>
    Create test file for the loan service.
    CRITICAL: At the end of your work, provide a "Summary" section containing:
    - Files modified (full paths)
    - Key changes (3-5 bullet points)
    - Any decisions made and rationale
    </output>

    ## Self-Critique Verification (MANDATORY)
    Before submitting, verify your work:
    1. Re-read the original task and confirm every requirement is addressed
    2. Check that all tests follow existing patterns in the project
    3. Verify no unrelated files were modified
    4. Confirm the Summary section is complete and accurate
  - model: sonnet

[Implementation 2: password recovery]
Use Task tool:
  - description: "Parallel: add password recovery feature to auth module"
  - prompt:
    ## Reasoning Approach
    [standard CoT prefix]

    <task>Add password recovery feature to the auth module</task>
    <target>src/modules/auth/</target>
    <constraints>
    - Work ONLY on the auth module
    - Implement password reset request, token generation, validation,
      and password update
    - Follow existing auth module patterns
    - Do NOT modify unrelated modules
    </constraints>
    <output>
    Implement password recovery feature.
    CRITICAL: At the end of your work, provide a "Summary" section.
    </output>

    ## Self-Critique Verification (MANDATORY)
    [standard self-critique suffix]
  - model: opus

[Implementation 3: GH Actions caching]
Use Task tool:
  - description: "Parallel: enable dependency caching in GitHub Actions"
  - prompt:
    ## Reasoning Approach
    [standard CoT prefix]

    <task>Enable caching during dependency loading in CI pipeline</task>
    <target>.github/workflows/ci.yml</target>
    <constraints>
    - Work ONLY on the CI workflow file
    - Add dependency caching (npm/yarn cache or actions/cache)
    - Do NOT modify other workflow steps beyond what is necessary
    </constraints>
    <output>
    Update CI workflow with dependency caching.
    CRITICAL: At the end of your work, provide a "Summary" section.
    </output>

    ## Self-Critique Verification (MANDATORY)
    [standard self-critique suffix]
  - model: sonnet

[All 3 launched simultaneously]

阶段 5.2:评审器派发(3 个评审器并行,在所有实现者完成后):

[Judge 1: loan service tests — independent spec]
Use Task tool:
  - description: "Judge: loan.service.ts tests"
  - prompt:
    You are evaluating an implementation artifact for target
    src/services/loan.service.ts against an evaluation specification
    produced by the meta judge.

    CLAUDE_PLUGIN_ROOT={CLAUDE_PLUGIN_ROOT}

    ## User Prompt
    write tests for loan.service.ts, add password recovery feature to auth
    module and enable caching during dependency loading in github actions.

    ## Target
    src/services/loan.service.ts

    ## Evaluation Specification
    ```yaml
    {EXACT spec YAML from loan service meta-judge}
    ```

    ## Implementation Output
    {Summary from loan service test implementation agent}

    ## Instructions
    User prompt is provided as context, you should use it only as reference
    of changes that can occur in the project by other agents. Evaluate ONLY
    the test generation for loan.service.ts.
    Follow your full judge process as defined in your agent instructions!

    ## Output
    CRITICAL: You must reply with this exact structured evaluation report
    format in YAML at the START of your response!
  - model: opus
  - subagent_type: "sadd:judge"

[Judge 2: password recovery — independent spec]
Use Task tool:
  - description: "Judge: auth password recovery"
  - prompt:
    You are evaluating an implementation artifact for target
    src/modules/auth/ against an evaluation specification produced
    by the meta judge.

    CLAUDE_PLUGIN_ROOT={CLAUDE_PLUGIN_ROOT}

    ## User Prompt
    [original user prompt]

    ## Target
    src/modules/auth/ (password recovery feature)

    ## Evaluation Specification
    ```yaml
    {EXACT spec YAML from password recovery meta-judge}
    ```

    ## Implementation Output
    {Summary from password recovery implementation agent}

    ## Instructions
    User prompt is provided as context, you should use it only as reference
    of changes that can occur in the project by other agents. Evaluate ONLY
    the password recovery feature.
    Follow your full judge process as defined in your agent instructions!

    ## Output
    CRITICAL: You must reply with this exact structured evaluation report
    format in YAML at the START of your response!
  - model: opus
  - subagent_type: "sadd:judge"

[Judge 3: GH Actions caching — independent spec]
Use Task tool:
  - description: "Judge: GitHub Actions dependency caching"
  - prompt:
    You are evaluating an implementation artifact for target
    .github/workflows/ci.yml against an evaluation specification produced
    by the meta judge.

    CLAUDE_PLUGIN_ROOT={CLAUDE_PLUGIN_ROOT}

    ## User Prompt
    [original user prompt]

    ## Target
    .github/workflows/ci.yml (dependency caching)

    ## Evaluation Specification
    ```yaml
    {EXACT spec YAML from GH Actions caching meta-judge}
    ```

    ## Implementation Output
    {Summary from GH Actions caching implementation agent}

    ## Instructions
    User prompt is provided as context, you should use it only as reference
    of changes that can occur in the project by other agents. Evaluate ONLY
    the dependency caching in GitHub Actions.
    Follow your full judge process as defined in your agent instructions!

    ## Output
    CRITICAL: You must reply with this exact structured evaluation report
    format in YAML at the START of your response!
  - model: opus
  - subagent_type: "sadd:judge"

[All 3 judges launched simultaneously]

结果:

目标分组模型评审得分重试次数状态
src/services/loan.service.ts独立sonnet4.1/5.00SUCCESS
src/modules/auth/独立opus4.3/5.00SUCCESS
.github/workflows/ci.yml独立sonnet4.0/5.00SUCCESS

总体: 3/3 已完成。Agent 总数:9(3 个元评审器 + 3 个实现任务 + 3 个评审器)。对于完全独立的任务,无法进一步减少分组。

最佳实践

目标选择
  • 具体明确: 尽可能列出确切文件
  • 谨慎使用 glob: 确认前检查展开后的列表
  • 限制范围: 每批最多 10-15 个目标,便于管理
  • 按相似性分组: 相似目标可受益于一致的模式
模型选择指南
场景模型原因
安全分析Opus需要关键推理能力
架构决策Opus质量优先于速度
简单重构Haiku快速且足够
文档生成Haiku机械性任务
逐文件代码审查Sonnet能力均衡
测试生成Sonnet规模较大但有固定模式
元评审器 + 评审器验证
  • 先进行需求分组——派发任何元评审器前,分析任务是否可归为可重复、共享或独立分组,以尽量减少 Agent 总数
  • 每个分组或独立任务配一个元评审器——可重复分组共用一份可复用规范,共享分组共用一份组合规范,独立任务各自使用一份规范
  • 先批量派发元评审器——并行启动所有元评审器(无论分组类型),然后再启动实现者
  • 重试时复用规范——每个分组/目标的评估规范在重试期间保持不变;只有实现内容会改变
  • 仅解析评审器的标题——不要阅读完整报告,以避免上下文污染
  • 包含 CLAUDE_PLUGIN_ROOT——元评审器和评审器都需要已解析的插件根路径
  • 针对目标的 YAML——只向对应的评审器传递相关的元评审器 YAML,不要添加任何额外文本或注释!
  • 共享分组重试——只重新启动具体失败的实现 Agent,而不是整个分组
评审器选择
实现模型评审模型理由
OpusOpus关键工作需要有力验证
SonnetOpus定制评估需要强大的推理能力
HaikuOpus通过强有力的评估验证简单工作

指南: 评审器始终使用 Opus,以便对所有目标进行一致、高质量的评估。

上下文隔离
  • 最少上下文: 每个子 Agent 只获取所需信息
  • 不交叉引用: 不要向 Agent A 透露 Agent B 的目标
  • 让它们自行发现: 子 Agent 通过阅读文件来理解模式
  • 以文件系统为准: 通过文件系统协调更改
  • 跟踪已有更改——向每个 Agent 的评审器传递此前修改的上下文,避免混淆已有更改与当前更改的归属
质量保证
  • 三层验证: 自我审查(内部)+ 针对目标的元评审规范(结构化)+ 评审器(外部)
  • 先进行自我审查: 实现 Agent 在提交前验证自己的工作
  • 针对目标的元评审规范: 为每个目标定制评审标准,以考虑其独特特点,从而制定更精准的评估标准
  • 再进行外部评审: 独立评审器机械地应用针对目标的元评审规范,发现自我审查遗漏的盲点
  • 迭代循环: 根据反馈重试,直到通过或达到最大重试次数
  • 隔离失败: 一个目标失败不会影响其他目标
  • 检查摘要: 查看是否有失败或部分完成的项目
  • 之后运行测试: 并行更改可能会产生细微的交互影响
  • 原子化提交: 一个批次的所有更改 = 一次提交
错误处理
失败类型描述恢复操作
可恢复评审器发现问题,且仍可重试根据评审器反馈重试(每个目标最多 3 次)
方案失败此目标的方案有误向用户说明情况并提供选项
基础问题需求不明确或无法实现请用户澄清
超过最大重试次数目标重试 3 次后仍失败标记为失败,继续处理其他目标,并在最后报告

关键规则:

  • 绝不在未征得用户意见的情况下超过最大重试次数后继续
  • 绝不在未解决评审问题的情况下尝试“向前修复”
  • 绝不跳过评审验证
  • 如果缺少上下文,立即停止并报告(不要猜测)
  • 隔离失败——一个目标失败不会阻止其他目标

评论

支持 Markdown