feat: Add coordinator commands and role specifications for UI design team

- Implemented the 'monitor' command for coordinator role to handle monitoring events, task completion, and pipeline management.
- Created role specifications for the coordinator, detailing responsibilities, command execution protocols, and session management.
- Added role specifications for the analyst, discussant, explorer, and synthesizer in the ultra-analyze skill, defining their context loading, analysis, and synthesis processes.
This commit is contained in:
catlog22
2026-03-03 23:35:41 +08:00
parent a7ed0365f7
commit 26bda9c634
188 changed files with 9332 additions and 3512 deletions

View File

@@ -147,10 +147,9 @@ Edit(`${sessionFolder}/state.md`, {
```javascript
mcp__ccw-tools__team_msg({
operation: "log", team: sessionId, // MUST be session ID (e.g., RD-xxx-date), NOT team name
operation: "log", session_id: sessionId,
from: "coordinator", to: "all",
type: "phase_started",
summary: `[coordinator] Phase ${phaseNumber} dispatched: PLAN-${phaseNumber}01 → EXEC-${phaseNumber}01 → VERIFY-${phaseNumber}01`,
ref: `${sessionFolder}/roadmap.md`
})
```

View File

@@ -171,26 +171,25 @@ function spawnPlanner(phase, gapIteration, sessionFolder) {
// Synchronous call - blocks until planner returns
Task({
subagent_type: "general-purpose",
subagent_type: "team-worker",
description: `Spawn planner worker for phase ${phase}`,
team_name: "roadmap-dev",
name: "planner",
prompt: `You are the PLANNER for team "roadmap-dev".
prompt: `## Role Assignment
role: planner
role_spec: .claude/skills/team-roadmap-dev/role-specs/planner.md
session: ${sessionFolder}
session_id: ${sessionId}
team_name: roadmap-dev
requirement: Phase ${phase} planning${gapContext}
inner_loop: false
## Primary Directive
Skill(skill="team-roadmap-dev", args="--role=planner")
## Assignment
- Session: ${sessionFolder}
## Current Task
- Task: PLAN-${phase}${suffix}
- Phase: ${phase}
- Task: PLAN-${phase}${suffix}${gapContext}
## Workflow
1. Skill(skill="team-roadmap-dev", args="--role=planner")
2. TaskList → find PLAN-${phase}${suffix} → execute
3. TaskUpdate completed when done
All outputs carry [planner] tag.`,
Read role_spec file to load Phase 2-4 domain instructions.
Execute built-in Phase 1 -> role-spec Phase 2-4 -> built-in Phase 5.`,
run_in_background: false // CRITICAL: Stop-Wait, blocks until done
})
}
@@ -203,26 +202,25 @@ function spawnExecutor(phase, gapIteration, sessionFolder) {
const suffix = gapIteration === 0 ? "01" : `0${gapIteration + 1}`
Task({
subagent_type: "general-purpose",
subagent_type: "team-worker",
description: `Spawn executor worker for phase ${phase}`,
team_name: "roadmap-dev",
name: "executor",
prompt: `You are the EXECUTOR for team "roadmap-dev".
prompt: `## Role Assignment
role: executor
role_spec: .claude/skills/team-roadmap-dev/role-specs/executor.md
session: ${sessionFolder}
session_id: ${sessionId}
team_name: roadmap-dev
requirement: Phase ${phase} execution
inner_loop: false
## Primary Directive
Skill(skill="team-roadmap-dev", args="--role=executor")
## Assignment
- Session: ${sessionFolder}
- Phase: ${phase}
## Current Task
- Task: EXEC-${phase}${suffix}
- Phase: ${phase}
## Workflow
1. Skill(skill="team-roadmap-dev", args="--role=executor")
2. TaskList → find EXEC-${phase}${suffix} → execute plans
3. TaskUpdate completed when done
All outputs carry [executor] tag.`,
Read role_spec file to load Phase 2-4 domain instructions.
Execute built-in Phase 1 -> role-spec Phase 2-4 -> built-in Phase 5.`,
run_in_background: false // CRITICAL: Stop-Wait
})
}
@@ -235,26 +233,25 @@ function spawnVerifier(phase, gapIteration, sessionFolder) {
const suffix = gapIteration === 0 ? "01" : `0${gapIteration + 1}`
Task({
subagent_type: "general-purpose",
subagent_type: "team-worker",
description: `Spawn verifier worker for phase ${phase}`,
team_name: "roadmap-dev",
name: "verifier",
prompt: `You are the VERIFIER for team "roadmap-dev".
prompt: `## Role Assignment
role: verifier
role_spec: .claude/skills/team-roadmap-dev/role-specs/verifier.md
session: ${sessionFolder}
session_id: ${sessionId}
team_name: roadmap-dev
requirement: Phase ${phase} verification
inner_loop: false
## Primary Directive
Skill(skill="team-roadmap-dev", args="--role=verifier")
## Assignment
- Session: ${sessionFolder}
- Phase: ${phase}
## Current Task
- Task: VERIFY-${phase}${suffix}
- Phase: ${phase}
## Workflow
1. Skill(skill="team-roadmap-dev", args="--role=verifier")
2. TaskList → find VERIFY-${phase}${suffix} → verify against success criteria
3. TaskUpdate completed when done
All outputs carry [verifier] tag.`,
Read role_spec file to load Phase 2-4 domain instructions.
Execute built-in Phase 1 -> role-spec Phase 2-4 -> built-in Phase 5.`,
run_in_background: false // CRITICAL: Stop-Wait
})
}
@@ -271,7 +268,6 @@ function triggerGapClosure(phase, iteration, gaps, sessionFolder) {
operation: "log", team: sessionId // MUST be session ID (e.g., RD-xxx-date), NOT team name,
from: "coordinator", to: "planner",
type: "gap_closure",
summary: `[coordinator] Gap closure iteration ${iteration} for phase ${phase}: ${gaps.length} gaps`,
ref: `${sessionFolder}/phase-${phase}/verification.md`
})
@@ -337,7 +333,6 @@ mcp__ccw-tools__team_msg({
operation: "log", team: sessionId // MUST be session ID (e.g., RD-xxx-date), NOT team name,
from: "coordinator", to: "all",
type: "project_complete",
summary: `[coordinator] All ${totalPhases} phases complete.`,
ref: `${sessionFolder}/roadmap.md`
})
```

View File

@@ -55,10 +55,9 @@ Edit(`${sessionFolder}/state.md`, {
```javascript
mcp__ccw-tools__team_msg({
operation: "log", team: "roadmap-dev",
operation: "log", session_id: sessionId,
from: "coordinator", to: "all",
type: "phase_paused",
summary: `[coordinator] Session paused at phase ${currentPhase}, step: ${currentStep}`,
ref: `${sessionFolder}/state.md`
})
```

View File

@@ -67,10 +67,9 @@ Edit(`${sessionFolder}/state.md`, {
```javascript
mcp__ccw-tools__team_msg({
operation: "log", team: "roadmap-dev",
operation: "log", session_id: sessionId,
from: "coordinator", to: "all",
type: "phase_started",
summary: `[coordinator] Session resumed at phase ${pausedPhase}, step: ${pausedStep}`,
ref: `${sessionFolder}/state.md`
})
```

View File

@@ -37,16 +37,58 @@ Orchestrate the roadmap-driven development workflow: init prerequisites -> roadm
---
## Command Execution Protocol
When coordinator needs to execute a command (dispatch, monitor, pause, resume):
1. **Read the command file**: `roles/coordinator/commands/<command-name>.md`
2. **Follow the workflow** defined in the command file (Phase 2-4 structure)
3. **Commands are inline execution guides** -- NOT separate agents or subprocesses
4. **Execute synchronously** -- complete the command workflow before proceeding
Example:
```
Phase 3 needs task dispatch
-> Read roles/coordinator/commands/dispatch.md
-> Execute Phase 2 (Context Loading)
-> Execute Phase 3 (Task Chain Creation)
-> Execute Phase 4 (Validation)
-> Continue to Phase 4
```
---
## Entry Router
When coordinator is invoked, first detect the invocation type:
When coordinator is invoked, detect invocation type:
| Detection | Condition | Handler |
|-----------|-----------|---------|
| Worker callback | Message contains role tag [planner], [executor], [verifier] | -> handleCallback |
| Resume mode | Arguments contain `--resume` | -> commands/resume.md: load session, re-enter monitor |
| Status check | Arguments contain "check" or "status" | -> handleCheck: output execution graph, no advancement |
| Manual continue | Arguments contain "resume" or "continue" | -> handleContinue: check worker states, advance pipeline |
| New session | None of the above | -> Phase 1 (Init Prerequisites) |
| Status check | Arguments contain "check" or "status" | -> handleCheck |
| Manual resume | Arguments contain "resume" or "continue" | -> handleResume |
| Pipeline complete | All tasks have status "completed" | -> handleComplete |
| Interrupted session | Active/paused session exists | -> Phase 0 (Session Resume Check) |
| New session | None of above | -> Phase 1 (Init Prerequisites) |
For callback/check/resume/complete: load `commands/monitor.md` and execute matched handler, then STOP.
### Router Implementation
1. **Load session context** (if exists):
- Scan `.workflow/.team/RD-*/.msg/meta.json` for active/paused sessions
- If found, extract session folder path, status, and pipeline mode
2. **Parse $ARGUMENTS** for detection keywords:
- Check for role name tags in message content
- Check for "check", "status", "resume", "continue", "--resume" keywords
3. **Route to handler**:
- For monitor handlers: Read `commands/monitor.md`, execute matched handler, STOP
- For --resume: Read `commands/resume.md`, execute resume flow
- For Phase 0: Execute Session Resume Check
- For Phase 1: Execute Init Prerequisites below
---
@@ -92,11 +134,10 @@ Before every SendMessage, log via `mcp__ccw-tools__team_msg`:
```
mcp__ccw-tools__team_msg({
operation: "log",
team: <session-id>, // MUST be session ID (e.g., RD-xxx-date), NOT team name. Extract from Session: field in task description.
session_id: <session-id>,
from: "coordinator",
to: <target-role>,
type: <message-type>,
summary: "[coordinator] <summary>",
ref: <artifact-path>
})
```
@@ -104,7 +145,7 @@ mcp__ccw-tools__team_msg({
**CLI fallback** (when MCP unavailable):
```
Bash("ccw team log --team <session-id> --from coordinator --to <target> --type <type> --summary \"[coordinator] <summary>\" --json")
Bash("ccw team log --session-id <session-id> --from coordinator --type <type> --json")
```
---

View File

@@ -203,10 +203,9 @@ ${(task.convergence?.criteria || []).map(c => `- [ ] ${c}`).join('\n')}
// 2e. Report wave progress
mcp__ccw-tools__team_msg({
operation: "log", team: "roadmap-dev",
from: "executor", to: "coordinator",
operation: "log", session_id: sessionId,
from: "executor",
type: "exec_progress",
summary: `[executor] Wave ${waveNum}/${totalWaves} complete (${completedTasks}/${totalTasks} tasks done)`,
ref: `${sessionFolder}/phase-${phaseNumber}/`
})
}
@@ -216,10 +215,9 @@ ${(task.convergence?.criteria || []).map(c => `- [ ] ${c}`).join('\n')}
```javascript
mcp__ccw-tools__team_msg({
operation: "log", team: "roadmap-dev",
from: "executor", to: "coordinator",
operation: "log", session_id: sessionId,
from: "executor",
type: "exec_complete",
summary: `[executor] All ${totalTasks} tasks executed across ${totalWaves} waves for phase ${phaseNumber}`,
ref: `${sessionFolder}/phase-${phaseNumber}/`
})
```

View File

@@ -69,11 +69,9 @@ Before every SendMessage, log via `mcp__ccw-tools__team_msg`:
```
mcp__ccw-tools__team_msg({
operation: "log",
team: <session-id>, // MUST be session ID (e.g., RD-xxx-date), NOT team name. Extract from Session: field in task description.
session_id: <session-id>,
from: "executor",
to: "coordinator",
type: <message-type>,
summary: "[executor] <task-prefix> complete: <task-subject>",
ref: <artifact-path>
})
```
@@ -81,7 +79,7 @@ mcp__ccw-tools__team_msg({
**CLI fallback** (when MCP unavailable):
```
Bash("ccw team log --team <session-id> --from executor --to coordinator --type <type> --summary \"[executor] <summary>\" --ref <artifact-path> --json")
Bash("ccw team log --session-id <session-id> --from executor --type <type> --ref <artifact-path> --json")
```
---
@@ -192,7 +190,6 @@ Standard report flow: team_msg log -> SendMessage with `[executor]` prefix -> Ta
**Report message**:
```
SendMessage({
to: "coordinator",
message: "[executor] Phase <N> execution complete.
- Tasks executed: <count>
- Waves: <wave-count>

View File

@@ -168,10 +168,9 @@ Each task: cli_execution.id = "RD-${sessionFolder.split('/').pop()}-{task_id}"
const taskFiles = Glob(`${taskDir}/IMPL-*.json`)
if (!taskFiles || taskFiles.length === 0) {
mcp__ccw-tools__team_msg({
operation: "log", team: "roadmap-dev",
from: "planner", to: "coordinator",
operation: "log", session_id: sessionId,
from: "planner",
type: "error",
summary: `[planner] action-planning-agent produced no task JSONs for phase ${phaseNumber}`
})
return
}
@@ -185,10 +184,9 @@ for (const taskFile of taskFiles) {
for (const field of requiredFields) {
if (!taskJson[field]) {
mcp__ccw-tools__team_msg({
operation: "log", team: "roadmap-dev",
from: "planner", to: "coordinator",
operation: "log", session_id: sessionId,
from: "planner",
type: "plan_progress",
summary: `[planner] Warning: ${taskFile} missing field: ${field}`
})
}
}
@@ -196,20 +194,18 @@ for (const taskFile of taskFiles) {
// Convergence criteria check
if (!taskJson.convergence?.criteria || taskJson.convergence.criteria.length === 0) {
mcp__ccw-tools__team_msg({
operation: "log", team: "roadmap-dev",
from: "planner", to: "coordinator",
operation: "log", session_id: sessionId,
from: "planner",
type: "plan_progress",
summary: `[planner] Warning: ${taskFile} has no convergence criteria`
})
}
// Dependency cycle check (simple: task cannot depend on itself)
if (taskJson.depends_on?.includes(taskJson.id)) {
mcp__ccw-tools__team_msg({
operation: "log", team: "roadmap-dev",
from: "planner", to: "coordinator",
operation: "log", session_id: sessionId,
from: "planner",
type: "error",
summary: `[planner] Self-dependency detected in ${taskJson.id}`
})
}
}
@@ -223,10 +219,9 @@ for (const task of allTasks) {
for (const dep of (task.depends_on || [])) {
if (!taskIds.has(dep)) {
mcp__ccw-tools__team_msg({
operation: "log", team: "roadmap-dev",
from: "planner", to: "coordinator",
operation: "log", session_id: sessionId,
from: "planner",
type: "plan_progress",
summary: `[planner] Warning: ${task.id} depends on unknown task ${dep}`
})
}
}
@@ -236,10 +231,9 @@ for (const task of allTasks) {
const implPlanExists = Bash(`test -f "${implPlanPath}" && echo "EXISTS" || echo "NOT_FOUND"`).trim()
if (implPlanExists === "NOT_FOUND") {
mcp__ccw-tools__team_msg({
operation: "log", team: "roadmap-dev",
from: "planner", to: "coordinator",
operation: "log", session_id: sessionId,
from: "planner",
type: "plan_progress",
summary: `[planner] Warning: IMPL_PLAN.md not generated, creating minimal version`
})
// Create minimal IMPL_PLAN.md from task JSONs
generateMinimalImplPlan(allTasks, implPlanPath, phaseGoal, phaseNumber)
@@ -284,10 +278,9 @@ const { waves, totalWaves } = computeWaves(allTasks)
const taskCount = allTasks.length
mcp__ccw-tools__team_msg({
operation: "log", team: "roadmap-dev",
from: "planner", to: "coordinator",
operation: "log", session_id: sessionId,
from: "planner",
type: "plan_progress",
summary: `[planner] Created ${taskCount} tasks across ${totalWaves} waves for phase ${phaseNumber}`,
ref: `${sessionFolder}/phase-${phaseNumber}/`
})

View File

@@ -71,11 +71,9 @@ Before every SendMessage, log via `mcp__ccw-tools__team_msg`:
```
mcp__ccw-tools__team_msg({
operation: "log",
team: <session-id>, // MUST be session ID (e.g., RD-xxx-date), NOT team name. Extract from Session: field in task description.
session_id: <session-id>,
from: "planner",
to: "coordinator",
type: <message-type>,
summary: "[planner] <task-prefix> complete: <task-subject>",
ref: <artifact-path>
})
```
@@ -83,7 +81,7 @@ mcp__ccw-tools__team_msg({
**CLI fallback** (when MCP unavailable):
```
Bash("ccw team log --team <session-id> --from planner --to coordinator --type <type> --summary \"[planner] <summary>\" --ref <artifact-path> --json")
Bash("ccw team log --session-id <session-id> --from planner --type <type> --ref <artifact-path> --json")
```
---
@@ -129,10 +127,9 @@ Delegate to `commands/research.md`:
**Report progress via team_msg**:
```
mcp__ccw-tools__team_msg({
operation: "log", team: "roadmap-dev",
from: "planner", to: "coordinator",
operation: "log", session_id: sessionId,
from: "planner",
type: "plan_progress",
summary: "[planner] Research complete for phase <N>. Context written.",
ref: "<session>/phase-<N>/context.md"
})
```
@@ -211,7 +208,6 @@ Standard report flow: team_msg log -> SendMessage with `[planner]` prefix -> Tas
**Report message**:
```
SendMessage({
to: "coordinator",
message: "[planner] Phase <N> planning complete.
- Tasks: <count>
- Waves: <wave-count>

View File

@@ -70,11 +70,9 @@ Before every SendMessage, log via `mcp__ccw-tools__team_msg`:
```
mcp__ccw-tools__team_msg({
operation: "log",
team: <session-id>, // MUST be session ID (e.g., RD-xxx-date), NOT team name. Extract from Session: field in task description.
session_id: <session-id>,
from: "verifier",
to: "coordinator",
type: <message-type>,
summary: "[verifier] <task-prefix> complete: <task-subject>",
ref: <artifact-path>
})
```
@@ -82,7 +80,7 @@ mcp__ccw-tools__team_msg({
**CLI fallback** (when MCP unavailable):
```
Bash("ccw team log --team <session-id> --from verifier --to coordinator --type <type> --summary \"[verifier] <summary>\" --ref <artifact-path> --json")
Bash("ccw team log --session-id <session-id> --from verifier --type <type> --ref <artifact-path> --json")
```
---
@@ -218,7 +216,6 @@ Standard report flow: team_msg log -> SendMessage with `[verifier]` prefix -> Ta
**Report message**:
```
SendMessage({
to: "coordinator",
message: "[verifier] Phase <N> verification complete.
- Status: <status>
- Tasks: <passed>/<total> passed