subagent-planificator

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Subagent Planificator

Subagent Planificator

Orchestrate collaborative planning where specialist subagents create plans, critique each other's work, and iterate toward consensus through structured discussion rounds.
协调由专业子Agent创建计划、相互评审工作,并通过结构化多轮讨论逐步达成共识的协作规划流程。

Core Concept

核心概念

Multiple specialists plan together, not in isolation. They see each other's work and improve it through discussion.
[DRAFT] → [WAIT] → [REVIEW] → [WAIT] → [REFINE] → [CONSENSUS?]
                                          ┌───────────┴───────────┐
                                          │                       │
                                     [CONSENSUS]           [MORE ROUNDS]
                                          │                       │
                                          ▼                       ▼
                                    [MASTER PLAN]          [Repeat refine]
多专家协同规划,而非孤立作业。他们可以查看彼此的工作并通过讨论加以改进。
[DRAFT] → [WAIT] → [REVIEW] → [WAIT] → [REFINE] → [CONSENSUS?]
                                          ┌───────────┴───────────┐
                                          │                       │
                                     [CONSENSUS]           [MORE ROUNDS]
                                          │                       │
                                          ▼                       ▼
                                    [MASTER PLAN]          [Repeat refine]

Quick Start

快速开始

Plan: [what needs planning]

Specialists needed:
- [Specialist A]: [their focus]
- [Specialist B]: [their focus]
- [Specialist C]: [their focus]
Orchestrator creates
.plans/session-[id]/
, dispatches specialists through draft → review → refine rounds, checks consensus, generates master plan.
Plan: [需要规划的内容]

所需专家:
- [专家A]: [其专注领域]
- [专家B]: [其专注领域]
- [专家C]: [其专注领域]
协调者会创建
.plans/session-[id]/
目录,通过草拟→评审→优化的轮次调度专家,检查共识情况,最终生成主计划。

Execution Model

执行模型

YOU ARE THE ORCHESTRATOR: You coordinate rounds, dispatch specialists, manage waiting, synthesize results. You never write plans yourself.
你作为协调者(ORCHESTRATOR):负责协调各轮次工作、调度子Agent、管理等待状态、综合结果。你无需自行编写计划。

Phase Flow

阶段流程

PhaseWhatOutputParallel
draftInitial plans
draft-[specialist].md
Yes
reviewCross-review
review-[specialist].md
Yes
refineRefine from feedback
refined-[specialist]-round[N].md
Yes
consensusCheck agreement(orchestrator action)No
masterCombine plans
master-plan.md
No
阶段内容输出并行执行
草拟编写初始计划
draft-[specialist].md
评审交叉评审
review-[specialist].md
优化根据反馈优化计划
refined-[specialist]-round[N].md
共识检查确认达成一致情况(协调者执行操作)
主计划生成合并所有计划
master-plan.md

Round Cycle

轮次周期

  1. All specialists draft simultaneously → wait for all complete
  2. All specialists review others' drafts → wait for all complete
  3. All specialists refine based on reviews → wait for all complete
  4. Check consensus
  5. If not consensus and rounds < max: repeat from step 2
  6. Generate master plan
  1. 所有专家同时草拟计划 → 等待全部完成
  2. 所有专家评审他人的草拟计划 → 等待全部完成
  3. 所有专家根据评审意见优化计划 → 等待全部完成
  4. 检查共识情况
  5. 若未达成共识且轮次未达上限:从步骤2重复执行
  6. 生成主计划

Coordination

协调机制

File-Based Waiting

基于文件的等待

Specialists wait for dependencies using file polling with sleep:
bash
undefined
子Agent通过带休眠的文件轮询来等待依赖项完成:
bash
undefined

Wait for all drafts

等待所有草拟文件完成

while [ $(ls draft-*.md 2>/dev/null | wc -l) -lt 3 ]; do sleep 5 done

**Critical**: Always sleep between checks. Never busy-wait.

See [waiting-script.md](references/waiting-script.md) for full implementation.
while [ $(ls draft-*.md 2>/dev/null | wc -l) -lt 3 ]; do sleep 5 done

**重要提示**:轮询间隔必须加入休眠,绝对禁止忙等。

完整实现请参考 [waiting-script.md](references/waiting-script.md)。

Status File

状态文件

status.yaml
tracks progress:
yaml
phase: "draft"
rounds:
  current: 1
  max: 5
status:
  backend-architect:
    draft: "complete"
    review: "pending"
    refine: "pending"
status.yaml
用于跟踪进度:
yaml
phase: "draft"
rounds:
  current: 1
  max: 5
status:
  backend-architect:
    draft: "complete"
    review: "pending"
    refine: "pending"

Dispatching Specialists

专家调度

Draft Phase

草拟阶段

ROLE: [Specialist]
PHASE: Draft
MISSION: Create initial plan for [topic] from your domain perspective.

CONTEXT: .plans/session-[id]/context.md
OUTPUT: .plans/session-[id]/draft-[your-name].md

Include:
- Summary and approach
- Detailed phases with steps
- Dependencies on other specialists
- Risks and alternatives

Update status.yaml when complete.
ROLE: [专家角色]
PHASE: Draft
MISSION: 从你的专业领域视角为[主题]创建初始计划。

CONTEXT: .plans/session-[id]/context.md
OUTPUT: .plans/session-[id]/draft-[your-name].md

需包含:
- 概述与实施思路
- 分阶段详细步骤
- 对其他专家的依赖项
- 风险点与备选方案

完成后更新 status.yaml。

Review Phase

评审阶段

ROLE: [Specialist]
PHASE: Review
MISSION: Review other specialists' drafts and provide feedback.

PLANS TO REVIEW:
- draft-[other-specialist-1].md
- draft-[other-specialist-2].md

WAIT: Before reviewing, poll for all draft files with 5s sleep.

OUTPUT: review-[your-name].md

For each plan:
- Strengths
- Concerns (specific, actionable)
- Alignment with your plan
- Conflicts identified

Update status.yaml when complete.
ROLE: [专家角色]
PHASE: Review
MISSION: 评审其他专家的草拟计划并提供反馈。

需评审的计划:
- draft-[other-specialist-1].md
- draft-[other-specialist-2].md

等待机制:评审前,每5秒轮询一次,直到所有草拟文件都已生成。

OUTPUT: review-[your-name].md

针对每个计划需包含:
- 优势
- 需改进的问题(具体且可落地)
- 与自身计划的契合度
- 发现的冲突点

完成后更新 status.yaml。

Refine Phase

优化阶段

ROLE: [Specialist]
PHASE: Refine Round [N]
MISSION: Refine your plan based on reviews.

REVIEWS: review-[specialist-1].md, review-[specialist-2].md
WAIT: Poll for all review files with 5s sleep.

OUTPUT: refined-[your-name]-round[N].md

Include:
- Changes from previous version (with reasons)
- Addressed feedback (how, or why not)
- Convergence notes (where you now agree with others)
- Remaining concerns

Update status.yaml when complete.
See plan-templates.md for full formats.
ROLE: [专家角色]
PHASE: Refine Round [N]
MISSION: 根据评审意见优化你的计划。

参考评审文件: review-[specialist-1].md, review-[specialist-2].md
等待机制:优化前,每5秒轮询一次,直到所有评审文件都已生成。

OUTPUT: refined-[your-name]-round[N].md

需包含:
- 与上一版本的差异及原因
- 已处理的反馈(如何处理,或不处理的原因)
- 共识收敛点(与其他专家达成一致的部分)
- 仍存在的疑问

完成后更新 status.yaml。
完整格式请参考 plan-templates.md

Consensus Checking

共识检查

After each refine round, check for consensus:
每轮优化完成后,检查共识情况:

Positive Signals

积极信号

  • "Aligned with [other]'s approach"
  • "Incorporated [feedback]"
  • "Converged on [decision]"
  • "与[其他专家]的方案一致"
  • "已采纳[反馈意见]"
  • "就[决策事项]达成共识"

Negative Signals

消极信号

  • "Fundamentally disagree"
  • "Cannot proceed if [condition]"
  • "This conflicts with [requirement]"
  • "存在根本性分歧"
  • "若[条件]不满足则无法推进"
  • "与[需求]存在冲突"

Decision

决策逻辑

IF no_negative_signals AND min_positive_per_specialist >= 2:
    consensus = full
    
ELSE IF negative_signals <= 2 AND movement_toward_agreement:
    consensus = partial
    trigger_another_round
    
ELSE IF rounds < max:
    trigger_another_round
    
ELSE:
    document_divergence
    proceed_to_master
See consensus-criteria.md for full algorithm.
IF 无消极信号 且 每位专家的积极信号数≥2:
    共识状态 = 完全达成
    
ELSE IF 消极信号数≤2 且 有向共识推进的趋势:
    共识状态 = 部分达成
    触发新一轮优化
    
ELSE IF 轮次未达上限:
    触发新一轮优化
    
ELSE:
    记录分歧点
    进入主计划生成阶段
完整算法请参考 consensus-criteria.md

Master Plan Generation

主计划生成

ROLE: Master Planner
MISSION: Combine refined plans into unified master plan.

INPUTS: All refined plans, all reviews from final round
OUTPUT: master-plan.md

Include:
- Executive summary
- Consensus decisions
- Specialist contributions by domain
- Integrated plan (phases, owners, steps)
- Resolved conflicts
- Open items
- Combined risk assessment
- Divergent views (if any)
ROLE: Master Planner
MISSION: 将所有优化后的计划合并为统一的主计划。

输入:所有优化后的计划、最终轮次的所有评审意见
输出:master-plan.md

需包含:
- 执行摘要
- 共识决策内容
- 各领域专家的贡献
- 整合后的完整计划(阶段、负责人、步骤)
- 已解决的冲突
- 待处理事项
- 合并后的风险评估
- 仍存在的分歧(若有)

File Structure

文件结构

.plans/
└── session-[id]/
    ├── context.md              # Planning brief
    ├── status.yaml             # Coordination
    ├── draft-[spec].md         # Initial plans
    ├── review-[spec].md        # Cross-reviews
    ├── refined-[spec]-r[N].md  # Refined plans
    └── master-plan.md          # Final combined plan
.plans/
└── session-[id]/
    ├── context.md              # 规划任务说明
    ├── status.yaml             # 协调状态
    ├── draft-[spec].md         # 初始计划
    ├── review-[spec].md        # 交叉评审意见
    ├── refined-[spec]-r[N].md  # 优化后的计划
    └── master-plan.md          # 最终合并的主计划

Specialist Selection

专家选择

DomainAgent Type
Architecture
architect-review
Security
code-reviewer
Frontend
frontend-developer
Backend
backend-security-coder
DevOps
devops-troubleshooter
Counts: 2-3 for simple plans, 3-5 for standard, 5-7 for complex.
领域Agent类型
架构
architect-review
安全
code-reviewer
前端
frontend-developer
后端
backend-security-coder
DevOps
devops-troubleshooter
数量建议:简单计划2-3名,标准计划3-5名,复杂计划5-7名。

Critical Rules

核心规则

  1. Orchestrator coordinates, never plans - You manage, not write
  2. Specialists must wait - Poll with sleep before dependencies
  3. Incremental saving - Save progress as you go
  4. Constructive review - Improve, don't attack
  5. Explicit disagreement - Explain why, don't stay silent
  6. Max rounds cap - Stop at 5 even without full consensus
  1. 协调者仅负责协调,不编写计划 - 你只做管理,不写计划
  2. 专家必须等待依赖项完成 - 轮询时必须加入休眠
  3. 增量保存进度 - 随时保存工作进展
  4. 建设性评审 - 以改进为目的,而非指责
  5. 明确表达分歧 - 说明原因,不要保持沉默
  6. 轮次上限限制 - 即使未完全达成共识,最多执行5轮

Progress Reporting

进度汇报

Session: [id]
Round: [N]/5
Phase: [draft|review|refine]
Status:
  - [Specialist A]: [complete|in_progress|pending]
  - [Specialist B]: [complete|in_progress|pending]
Final: Consensus level, divergent views (if any), output path.
会话ID: [id]
当前轮次: [N]/5
当前阶段: [draft|review|refine]
状态:
  - [专家A]: [已完成|进行中|待开始]
  - [专家B]: [已完成|进行中|待开始]
最终汇报:共识达成程度、存在的分歧(若有)、输出文件路径。

Integration

集成对接

  • deep-agent-review: Use planificator to plan remediation after review
  • subagent-orchestration: Use master plan as input for implementation
  • the-council: Council for decisions, Planificator for comprehensive plans
  • deep-agent-review:使用Planificator规划评审后的整改方案
  • subagent-orchestration:将主计划作为输入用于执行环节
  • the-council:Council用于决策,Planificator用于制定全面计划

Quick Reference

快速参考

1. Create .plans/session-[id]/ with context.md, status.yaml
2. Draft: dispatch all specialists in parallel, wait for files
3. Review: dispatch all specialists, each waits for all drafts
4. Refine: dispatch all specialists, each waits for all reviews
5. Check consensus → if not and rounds < 5, goto 3
6. Master: dispatch agent to synthesize
7. Report to user
1. 创建 .plans/session-[id]/ 目录,包含 context.md 和 status.yaml
2. 草拟阶段:并行调度所有专家,等待文件生成
3. 评审阶段:调度所有专家,每人等待所有草拟文件完成
4. 优化阶段:调度所有专家,每人等待所有评审文件完成
5. 检查共识 → 若未达成且轮次<5,回到步骤3
6. 主计划生成:调度Agent合成计划
7. 向用户汇报结果

Reference Documentation

参考文档

  • Waiting Scripts - File-based coordination
  • Plan Templates - Full format for each phase
  • Consensus Criteria - Agreement detection
  • 等待脚本 - 基于文件的协调机制
  • 计划模板 - 各阶段完整格式
  • 共识判定标准 - 一致性检测方法