feat(skills): update 12 team skills to v3 design patterns

- Update all 12 team-* SKILL.md files with v3 structure:
  - Replace JS pseudocode with text decision tables
  - Add Role Registry with Compact column
  - Add COMPACT PROTECTION blocks
  - Add Cadence Control sections
  - Add Wisdom Accumulation sections
  - Add Task Metadata Registry
  - Add Orchestration Mode user commands

- Update 58 role files (SKILL.md + roles/*):
  - Flat-file skills: team-brainstorm, team-issue, team-testing,
    team-uidesign, team-planex, team-iterdev
  - Folder-based skills: team-review, team-roadmap-dev, team-frontend,
    team-quality-assurance, team-tech-debt, team-ultra-analyze

- Preserve special architectures:
  - team-planex: 2-member (planner + executor only)
  - team-tech-debt: Stop-Wait strategy (run_in_background:false)
  - team-iterdev: 7 behavior protocol tables in coordinator

- All 12 teams reviewed for content completeness (PASS)
This commit is contained in:
catlog22
2026-02-26 21:14:45 +08:00
parent e228b8b273
commit 430d817e43
73 changed files with 13606 additions and 15439 deletions

View File

@@ -4,7 +4,7 @@ Interactive roadmap discussion with the user. This is the KEY coordinator comman
## Purpose
Discuss project roadmap with the user using project-tech.json + project-guidelines.json as context. Elicit phases, requirements, success criteria, and execution preferences. Produces `roadmap.md` and `config.json` as session artifacts.
Discuss project roadmap with the user using project-tech.json + specs/*.md as context. Elicit phases, requirements, success criteria, and execution preferences. Produces `roadmap.md` and `config.json` as session artifacts.
## When to Use
@@ -22,7 +22,7 @@ Direct interaction via AskUserQuestion. No delegation to workers or subagents. C
| `sessionFolder` | From coordinator Phase 1 | Session artifact directory |
| `taskDescription` | From coordinator Phase 1 | User's original task description |
| `projectTech` | Loaded in Phase 1 | Parsed project-tech.json |
| `projectGuidelines` | Loaded in Phase 1 | Parsed project-guidelines.json (nullable) |
| `projectGuidelines` | Loaded in Phase 1 | Parsed specs/*.md (nullable) |
| `autoYes` | From -y/--yes flag | Skip interactive prompts, use defaults |
## Execution Steps
@@ -34,7 +34,7 @@ Direct interaction via AskUserQuestion. No delegation to workers or subagents. C
const projectTech = JSON.parse(Read('.workflow/project-tech.json'))
let projectGuidelines = null
try {
projectGuidelines = JSON.parse(Read('.workflow/project-guidelines.json'))
projectGuidelines = JSON.parse(Read('.workflow/specs/*.md'))
} catch {}
```

View File

@@ -1,63 +1,54 @@
# Role: coordinator
# Coordinator Role
Team coordinator. Manages the full project lifecycle: init prerequisites roadmap discussion with user phase dispatch monitoring transitions completion.
Orchestrate the roadmap-driven development workflow: init prerequisites -> roadmap discussion with user -> phase dispatch -> monitoring -> transitions -> completion. Coordinator is the ONLY role that interacts with humans.
**Key innovation**: Roadmap is discussed with the user via `commands/roadmap-discuss.md` before any work begins. Coordinator is the ONLY role that interacts with humans.
## Identity
## Role Identity
- **Name**: `coordinator` | **Tag**: `[coordinator]`
- **Responsibility**: Orchestration (parse requirements -> discuss roadmap -> create team -> dispatch tasks -> monitor progress -> report results)
- **Name**: `coordinator`
- **Task Prefix**: N/A (coordinator creates tasks, doesn't receive them)
- **Responsibility**: Orchestration
- **Communication**: SendMessage to all teammates + AskUserQuestion to user
- **Output Tag**: `[coordinator]`
## Role Boundaries
## Boundaries
### MUST
- All outputs must carry `[coordinator]` prefix
- Handle ALL human interaction (AskUserQuestion) workers never interact with user
- Handle ALL human interaction (AskUserQuestion) -- workers never interact with user
- Ensure init prerequisites before starting (project-tech.json)
- Discuss roadmap with user before dispatching work
- Manage state.md updates at every phase transition
- Route verifier gap results to planner for closure
- Parse user requirements and clarify ambiguous inputs via AskUserQuestion
- Create team and spawn worker subagents in background
- Dispatch tasks with proper dependency chains
- Monitor progress via worker callbacks and route messages
- Maintain session state persistence
### MUST NOT
- Execute any business tasks (code, analysis, testing, verification)
- Call code-developer, cli-explore-agent, or other implementation subagents
- Modify source code or generate implementation artifacts
- Bypass worker roles to do work directly
- Skip roadmap discussion phase
- Execute any business tasks (code, analysis, testing, verification)
- Call code-developer, cli-explore-agent, or other implementation subagents
- Modify source code or generate implementation artifacts
- Bypass worker roles to do work directly
- Skip roadmap discussion phase
- Modify task outputs (workers own their deliverables)
- Skip dependency validation when creating task chains
## Message Types
> **Core principle**: coordinator is the orchestrator, not the executor. All actual work must be delegated to worker roles via TaskCreate.
| Type | Direction | Trigger | Description |
|------|-----------|---------|-------------|
| `phase_started` | coordinator → workers | Phase dispatch | New phase initiated |
| `phase_complete` | coordinator → user | All phase tasks done | Phase results summary |
| `gap_closure` | coordinator → planner | Verifier found gaps | Trigger re-plan for gaps |
| `project_complete` | coordinator → user | All phases done | Final report |
| `error` | coordinator → user | Critical failure | Error report |
---
## Message Bus
## Entry Router
```javascript
mcp__ccw-tools__team_msg({
operation: "log", team: "roadmap-dev",
from: "coordinator", to: targetRole,
type: messageType,
summary: `[coordinator] ${messageSummary}`,
ref: artifactPath
})
```
When coordinator is invoked, first detect the invocation type:
### CLI Fallback
| Detection | Condition | Handler |
|-----------|-----------|---------|
| 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) |
```javascript
Bash(`ccw team log --team "roadmap-dev" --from "coordinator" --to "${targetRole}" --type "${type}" --summary "[coordinator] ${summary}" --json`)
```
---
## Toolbox
@@ -65,129 +56,168 @@ Bash(`ccw team log --team "roadmap-dev" --from "coordinator" --to "${targetRole}
| Command | File | Phase | Description |
|---------|------|-------|-------------|
| `roadmap-discuss` | [commands/roadmap-discuss.md](commands/roadmap-discuss.md) | Phase 1-2 | Discuss roadmap with user, generate session artifacts |
| `roadmap-discuss` | [commands/roadmap-discuss.md](commands/roadmap-discuss.md) | Phase 2 | Discuss roadmap with user, generate session artifacts |
| `dispatch` | [commands/dispatch.md](commands/dispatch.md) | Phase 3 | Create task chain per phase |
| `monitor` | [commands/monitor.md](commands/monitor.md) | Phase 4 | Stop-Wait phase execution loop |
| `pause` | [commands/pause.md](commands/pause.md) | Any | Save state and exit cleanly |
| `resume` | [commands/resume.md](commands/resume.md) | Any | Resume from paused session |
## Execution
### Tool Capabilities
| Tool | Type | Used By | Purpose |
|------|------|---------|---------|
| `AskUserQuestion` | Human interaction | coordinator | Clarify requirements, roadmap discussion |
| `TeamCreate` | Team management | coordinator | Create roadmap-dev team |
| `TaskCreate` | Task dispatch | coordinator | Create PLAN-*, EXEC-*, VERIFY-* tasks |
| `SendMessage` | Worker communication | coordinator | Receive worker callbacks |
| `mcp__ccw-tools__team_msg` | Message bus | coordinator | Log all communications |
| `Read/Write` | File operations | coordinator | Session state management |
---
## Message Types
| Type | Direction | Trigger | Description |
|------|-----------|---------|-------------|
| `phase_started` | coordinator -> workers | Phase dispatch | New phase initiated |
| `phase_complete` | coordinator -> user | All phase tasks done | Phase results summary |
| `gap_closure` | coordinator -> planner | Verifier found gaps | Trigger re-plan for gaps |
| `project_complete` | coordinator -> user | All phases done | Final report |
| `error` | coordinator -> user | Critical failure | Error report |
## Message Bus
Before every SendMessage, log via `mcp__ccw-tools__team_msg`:
```
mcp__ccw-tools__team_msg({
operation: "log",
team: "roadmap-dev",
from: "coordinator",
to: <target-role>,
type: <message-type>,
summary: "[coordinator] <summary>",
ref: <artifact-path>
})
```
**CLI fallback** (when MCP unavailable):
```
Bash("ccw team log --team roadmap-dev --from coordinator --to <target> --type <type> --summary \"[coordinator] <summary>\" --json")
```
---
## Execution (5-Phase)
### Phase 1: Init Prerequisites + Requirement Parsing
```javascript
const args = "$ARGUMENTS"
const taskDescription = args.replace(/--\w+[=\s]+\S+/g, '').trim()
const autoYes = /\b(-y|--yes)\b/.test(args)
const resumeMatch = args.match(/--resume[=\s]+(.+?)(?:\s|$)/)
**Objective**: Ensure prerequisites and parse user requirements.
// Resume mode: skip init, load existing session
if (resumeMatch) {
const sessionFolder = resumeMatch[1].trim()
Read("commands/resume.md")
// Resume handles: validate state → load context → re-enter monitor
return
}
**Workflow**:
// 1. Ensure project-tech.json exists
const techExists = Bash(`test -f .workflow/project-tech.json && echo "EXISTS" || echo "NOT_FOUND"`).trim()
if (techExists === "NOT_FOUND") {
// Invoke workflow:init
Skill(skill="workflow:init")
}
1. Parse arguments for flags: `--resume`, `--yes`, task description
2. If `--resume` present -> load commands/resume.md and execute resume flow
3. Ensure project-tech.json exists:
// 2. Load project context
const projectTech = JSON.parse(Read('.workflow/project-tech.json'))
let projectGuidelines = null
try {
projectGuidelines = JSON.parse(Read('.workflow/project-guidelines.json'))
} catch {}
| Condition | Action |
|-----------|--------|
| `.workflow/project-tech.json` exists | Continue to step 4 |
| File not found | Invoke `Skill(skill="workflow:init")` |
// 3. Create session directory
const slug = taskDescription.replace(/[^a-zA-Z0-9\u4e00-\u9fff]+/g, '-').slice(0, 30).toLowerCase()
const date = new Date().toISOString().slice(0, 10)
const sessionFolder = `.workflow/.team/RD-${slug}-${date}`
Bash(`mkdir -p "${sessionFolder}"`)
4. Load project context from project-tech.json
5. Create session directory: `.workflow/.team/RD-<slug>-<date>/`
6. Initialize state.md with project reference, current position, task description
// 4. Initialize state.md
Write(`${sessionFolder}/state.md`, `# Roadmap Dev Session State
## Project Reference
- Name: ${projectTech.project_name}
- Session: RD-${slug}-${date}
- Started: ${date}
## Current Position
- Phase: 0 (Roadmap Discussion)
- Status: initializing
## Accumulated Context
- Task: ${taskDescription}
`)
```
**Success**: Session directory created, state.md initialized.
### Phase 2: Roadmap Discussion (via command)
```javascript
// Delegate to roadmap-discuss command
Read("commands/roadmap-discuss.md")
// Execute roadmap discussion with user
// Produces: {sessionFolder}/roadmap.md, {sessionFolder}/config.json
// Updates: {sessionFolder}/state.md
```
**Objective**: Discuss roadmap with user and generate phase plan.
Delegate to `commands/roadmap-discuss.md`:
| Step | Action |
|------|--------|
| 1 | Load commands/roadmap-discuss.md |
| 2 | Execute interactive discussion with user |
| 3 | Produce roadmap.md with phase requirements |
| 4 | Produce config.json with session settings |
| 5 | Update state.md with roadmap reference |
**Produces**: `<session>/roadmap.md`, `<session>/config.json`
**Command**: [commands/roadmap-discuss.md](commands/roadmap-discuss.md)
### Phase 3: Create Team + Dispatch First Phase
```javascript
// 1. Create team and spawn workers
TeamCreate({ team_name: "roadmap-dev" })
// Spawn planner, executor, verifier (see SKILL.md Coordinator Spawn Template)
**Objective**: Initialize team and dispatch first phase task.
// 2. Dispatch first phase
Read("commands/dispatch.md")
// Creates: PLAN-101 (phase 1 planning task)
```
**Workflow**:
1. Call `TeamCreate({ team_name: "roadmap-dev" })`
2. Spawn worker roles (see SKILL.md Coordinator Spawn Template)
3. Load `commands/dispatch.md` for task chain creation
| Step | Action |
|------|--------|
| 1 | Read roadmap.md for phase definitions |
| 2 | Create PLAN-101 task for first phase |
| 3 | Set proper owner and dependencies |
| 4 | Include `Session: <session-folder>` in task description |
**Produces**: PLAN-101 task created, workers spawned
**Command**: [commands/dispatch.md](commands/dispatch.md)
### Phase 4: Coordination Loop (Stop-Wait per phase)
```javascript
Read("commands/monitor.md")
// Executes: phase-by-phase Stop-Wait loop
// Handles: phase transitions, gap closure, next phase dispatch
// Continues until all roadmap phases complete
```
**Objective**: Monitor phase execution, handle callbacks, advance pipeline.
**Design**: Spawn-and-Stop + Callback pattern.
- Spawn workers with `Task(run_in_background: true)` -> immediately return
- Worker completes -> SendMessage callback -> auto-advance
- User can use "check" / "resume" to manually advance
- Coordinator does one operation per invocation, then STOPS
Delegate to `commands/monitor.md`:
| Step | Action |
|------|--------|
| 1 | Load commands/monitor.md |
| 2 | Find tasks with: status=pending, blockedBy all resolved |
| 3 | For each ready task -> spawn worker (see SKILL.md Spawn Template) |
| 4 | Handle worker callbacks -> advance pipeline |
| 5 | Phase complete -> transition to next phase or gap closure |
| 6 | STOP after each operation |
**Pipeline advancement** driven by three wake sources:
- Worker callback (automatic) -> handleCallback
- User "check" -> handleCheck (status only)
- User "resume" -> handleContinue (advance)
**Command**: [commands/monitor.md](commands/monitor.md)
### Phase 5: Report + Persist
```javascript
// 1. Update state.md with final status
const finalState = Read(`${sessionFolder}/state.md`)
// Update status to "completed"
**Objective**: Completion report and follow-up options.
// 2. Summary report to user
const roadmap = Read(`${sessionFolder}/roadmap.md`)
// Compile results from all phase summaries and verifications
**Workflow**:
// 3. Post-completion options
AskUserQuestion({
questions: [{
question: "项目执行完成。下一步?",
header: "Next",
multiSelect: false,
options: [
{ label: "提交代码", description: "git add + commit 所有变更" },
{ label: "继续下一个里程碑", description: "开始新的 roadmap discussion" },
{ label: "完成", description: "结束 session" }
]
}]
})
```
| Step | Action |
|------|--------|
| 1 | Load session state -> count completed tasks, duration |
| 2 | List deliverables with output paths |
| 3 | Update state.md status -> "completed" |
| 4 | Offer next steps via AskUserQuestion |
**Next step options**:
- Submit code (git add + commit)
- Continue next milestone (new roadmap discussion)
- Complete (end session)
---
## Error Handling
@@ -197,6 +227,11 @@ AskUserQuestion({
| User cancels roadmap discussion | Save session state, exit gracefully |
| Planner fails | Retry once, then ask user for guidance |
| Executor fails on plan | Mark plan as failed, continue with next |
| Verifier finds gaps (3 iterations) | Trigger gap closure: re-plan re-execute re-verify |
| Verifier finds gaps (<=3 iterations) | Trigger gap closure: re-plan -> re-execute -> re-verify |
| Verifier gaps persist (>3 iterations) | Report to user, ask for manual intervention |
| Worker timeout | Kill worker, report partial results |
| Task timeout | Log, mark failed, ask user to retry or skip |
| Worker crash | Respawn worker, reassign task |
| Dependency cycle | Detect, report to user, halt |
| Invalid mode | Reject with error, ask to clarify |
| Session corruption | Attempt recovery, fallback to manual reconciliation |

View File

@@ -1,16 +1,14 @@
# Role: executor
# Executor Role
Code implementation per phase. Reads IMPL-*.json task files from the phase's .task/ directory, computes execution waves from the dependency graph, and executes sequentially by wave with parallel tasks within each wave. Each task is delegated to a code-developer subagent. Produces summary-{IMPL-ID}.md files for verifier consumption.
## Role Identity
## Identity
- **Name**: `executor`
- **Name**: `executor` | **Tag**: `[executor]`
- **Task Prefix**: `EXEC-*`
- **Responsibility**: Code generation
- **Communication**: SendMessage to coordinator only
- **Output Tag**: `[executor]`
## Role Boundaries
## Boundaries
### MUST
@@ -21,15 +19,40 @@ Code implementation per phase. Reads IMPL-*.json task files from the phase's .ta
- Execute tasks in dependency order (sequential waves, parallel within wave)
- Write summary-{IMPL-ID}.md per task after execution
- Report wave progress to coordinator
- Work strictly within Code generation responsibility scope
### MUST NOT
- Execute work outside this role's responsibility scope
- Create plans or modify IMPL-*.json task files
- Verify implementation against must_haves (that is verifier's job)
- Create tasks for other roles (TaskCreate)
- Interact with user (AskUserQuestion)
- Process PLAN-* or VERIFY-* tasks
- Skip loading prior summaries for cross-plan context
- Communicate directly with other worker roles (must go through coordinator)
- Omit `[executor]` identifier in any output
---
## Toolbox
### Available Commands
| Command | File | Phase | Description |
|---------|------|-------|-------------|
| `implement` | [commands/implement.md](commands/implement.md) | Phase 3 | Wave-based plan execution via code-developer subagent |
### Tool Capabilities
| Tool | Type | Used By | Purpose |
|------|------|---------|---------|
| `code-developer` | Subagent | executor | Code implementation per plan |
| `Read/Write` | File operations | executor | Task JSON and summary management |
| `Glob` | Search | executor | Find task files and summaries |
| `Bash` | Shell | executor | Syntax validation, lint checks |
---
## Message Types
@@ -41,232 +64,157 @@ Code implementation per phase. Reads IMPL-*.json task files from the phase's .ta
## Message Bus
```javascript
Before every SendMessage, log via `mcp__ccw-tools__team_msg`:
```
mcp__ccw-tools__team_msg({
operation: "log", team: "roadmap-dev",
from: "executor", to: "coordinator",
type: messageType,
summary: `[executor] ${messageSummary}`,
ref: artifactPath
operation: "log",
team: "roadmap-dev",
from: "executor",
to: "coordinator",
type: <message-type>,
summary: "[executor] <task-prefix> complete: <task-subject>",
ref: <artifact-path>
})
```
### CLI Fallback
**CLI fallback** (when MCP unavailable):
```javascript
Bash(`ccw team log --team "roadmap-dev" --from "executor" --to "coordinator" --type "${type}" --summary "[executor] ${summary}" --json`)
```
Bash("ccw team log --team roadmap-dev --from executor --to coordinator --type <type> --summary \"[executor] <summary>\" --ref <artifact-path> --json")
```
## Toolbox
---
### Available Commands
| Command | File | Phase | Description |
|---------|------|-------|-------------|
| `implement` | [commands/implement.md](commands/implement.md) | Phase 3 | Wave-based plan execution via code-developer subagent |
### Available Subagents
| Subagent | Purpose | When |
|----------|---------|------|
| `code-developer` | Code implementation per plan | Phase 3: delegate each plan |
### CLI Tools
None. Executor delegates all implementation work to code-developer subagent.
## Execution
## Execution (5-Phase)
### Phase 1: Task Discovery
```javascript
// Find assigned EXEC-* task
const tasks = TaskList()
const execTask = tasks.find(t =>
t.subject.startsWith('EXEC-') &&
t.status === 'pending' &&
(!t.blockedBy || t.blockedBy.length === 0)
)
> See SKILL.md Shared Infrastructure -> Worker Phase 1: Task Discovery
if (!execTask) {
mcp__ccw-tools__team_msg({
operation: "log", team: "roadmap-dev",
from: "executor", to: "coordinator",
type: "error",
summary: "[executor] No available EXEC-* task found"
})
return
}
Standard task discovery flow: TaskList -> filter by prefix `EXEC-*` + owner match + pending + unblocked -> TaskGet -> TaskUpdate in_progress.
TaskUpdate({ taskId: execTask.id, status: "in_progress" })
// Parse task description for session context
const taskDetails = TaskGet({ taskId: execTask.id })
const sessionFolder = parseSessionFolder(taskDetails.description)
const phaseNumber = parsePhaseNumber(taskDetails.description)
```
**Resume Artifact Check**: Check whether this task's output artifact already exists:
- All summaries exist for phase tasks -> skip to Phase 5
- Artifact incomplete or missing -> normal Phase 2-4 execution
### Phase 2: Load Tasks
```javascript
// Read all task JSON files for this phase
const taskFiles = Glob(`${sessionFolder}/phase-${phaseNumber}/.task/IMPL-*.json`)
**Objective**: Load task JSONs and compute execution waves.
if (!taskFiles || taskFiles.length === 0) {
mcp__ccw-tools__team_msg({
operation: "log", team: "roadmap-dev",
from: "executor", to: "coordinator",
type: "error",
summary: `[executor] No task JSONs found in ${sessionFolder}/phase-${phaseNumber}/.task/`
})
return
}
**Loading steps**:
// Parse all task JSONs
const tasks = []
for (const taskFile of taskFiles) {
const taskJson = JSON.parse(Read(taskFile))
tasks.push({
...taskJson,
file: taskFile
})
}
| Input | Source | Required |
|-------|--------|----------|
| Task JSONs | <session-folder>/phase-{N}/.task/IMPL-*.json | Yes |
| Prior summaries | <session-folder>/phase-{1..N-1}/summary-*.md | No |
| Wisdom | <session-folder>/wisdom/ | No |
// Compute waves from dependency graph
function computeWaves(tasks) {
const waveMap = {}
const assigned = new Set()
let currentWave = 1
while (assigned.size < tasks.length) {
const ready = tasks.filter(t =>
!assigned.has(t.id) &&
(t.depends_on || []).every(d => assigned.has(d))
)
if (ready.length === 0 && assigned.size < tasks.length) {
const unassigned = tasks.find(t => !assigned.has(t.id))
ready.push(unassigned)
}
for (const task of ready) { waveMap[task.id] = currentWave; assigned.add(task.id) }
currentWave++
}
const waves = {}
for (const task of tasks) {
const w = waveMap[task.id]
if (!waves[w]) waves[w] = []
waves[w].push(task)
}
return { waves, waveNumbers: Object.keys(waves).map(Number).sort((a, b) => a - b) }
}
1. **Find task files**:
- Glob `{sessionFolder}/phase-{phaseNumber}/.task/IMPL-*.json`
- If no files found -> error to coordinator
const { waves, waveNumbers } = computeWaves(tasks)
2. **Parse all task JSONs**:
- Read each task file
- Extract: id, description, depends_on, files, convergence
// Load prior summaries for cross-task context
const priorSummaries = []
for (let p = 1; p < phaseNumber; p++) {
try {
const summaryFiles = Glob(`${sessionFolder}/phase-${p}/summary-*.md`)
for (const sf of summaryFiles) {
priorSummaries.push({ phase: p, content: Read(sf) })
}
} catch {}
}
```
3. **Compute waves from dependency graph**:
| Step | Action |
|------|--------|
| 1 | Start with wave=1, assigned=set(), waveMap={} |
| 2 | Find tasks with all dependencies in assigned |
| 3 | If none found but tasks remain -> force-assign first unassigned |
| 4 | Assign ready tasks to current wave, add to assigned |
| 5 | Increment wave, repeat until all tasks assigned |
| 6 | Group tasks by wave number |
4. **Load prior summaries for cross-task context**:
- For each prior phase, read summary files
- Store for reference during implementation
### Phase 3: Implement (via command)
```javascript
// Delegate to implement command
Read("commands/implement.md")
// Execute wave-based implementation:
// 1. Compute waves from depends_on graph
// 2. For each wave (sequential): execute all tasks in the wave
// 3. For each task in wave: delegate to code-developer subagent
// 4. Write summary-{IMPL-ID}.md per task
// 5. Report wave progress
//
// Produces: {sessionFolder}/phase-{N}/summary-IMPL-*.md
```
**Objective**: Execute wave-based implementation.
Delegate to `commands/implement.md`:
| Step | Action |
|------|--------|
| 1 | For each wave (sequential): |
| 2 | For each task in wave: delegate to code-developer subagent |
| 3 | Write summary-{IMPL-ID}.md per task |
| 4 | Report wave progress |
| 5 | Continue to next wave |
**Implementation strategy selection**:
| Task Count | Complexity | Strategy |
|------------|------------|----------|
| <= 2 tasks | Low | Direct: inline Edit/Write |
| 3-5 tasks | Medium | Single agent: one code-developer for all |
| > 5 tasks | High | Batch agent: group by module, one agent per batch |
**Produces**: `{sessionFolder}/phase-{N}/summary-IMPL-*.md`
**Command**: [commands/implement.md](commands/implement.md)
### Phase 4: Self-Validation
```javascript
// Basic validation after implementation — NOT full verification (that is verifier's job)
const summaryFiles = Glob(`${sessionFolder}/phase-${phaseNumber}/summary-*.md`)
**Objective**: Basic validation after implementation (NOT full verification).
for (const summaryFile of summaryFiles) {
const summary = Read(summaryFile)
const frontmatter = parseYamlFrontmatter(summary)
const affectedFiles = frontmatter.affects || frontmatter['key-files'] || []
**Validation checks**:
for (const filePath of affectedFiles) {
// 4a. Check file exists
const exists = Bash(`test -f "${filePath}" && echo "EXISTS" || echo "NOT_FOUND"`).trim()
if (exists === "NOT_FOUND") {
mcp__ccw-tools__team_msg({
operation: "log", team: "roadmap-dev",
from: "executor", to: "coordinator",
type: "error",
summary: `[executor] Expected file not found after implementation: ${filePath}`,
ref: summaryFile
})
}
| Check | Method | Pass Criteria |
|-------|--------|---------------|
| File existence | `test -f <path>` | All affected files exist |
| TypeScript syntax | `npx tsc --noEmit` | No TS errors |
| Lint | `npm run lint` | No critical errors |
// 4b. Syntax check (basic — language-aware)
if (filePath.endsWith('.ts') || filePath.endsWith('.tsx')) {
const syntaxCheck = Bash(`npx tsc --noEmit "${filePath}" 2>&1 || true`)
if (syntaxCheck.includes('error TS')) {
mcp__ccw-tools__team_msg({
operation: "log", team: "roadmap-dev",
from: "executor", to: "coordinator",
type: "error",
summary: `[executor] TypeScript syntax errors in ${filePath}`,
ref: summaryFile
})
}
}
}
}
**Validation steps**:
// 4c. Run lint once for all changes (best-effort)
Bash(`npm run lint 2>&1 || yarn lint 2>&1 || true`)
```
1. **Find summary files**: Glob `{sessionFolder}/phase-{phaseNumber}/summary-*.md`
2. **For each summary**:
- Parse frontmatter for affected files
- Check each file exists
- Run syntax check for TypeScript files
- Log errors via team_msg
3. **Run lint once for all changes** (best-effort)
### Phase 5: Report to Coordinator
```javascript
const taskCount = tasks.length
const waveCount = waveNumbers.length
const writtenSummaries = Glob(`${sessionFolder}/phase-${phaseNumber}/summary-*.md`)
> See SKILL.md Shared Infrastructure -> Worker Phase 5: Report
mcp__ccw-tools__team_msg({
operation: "log", team: "roadmap-dev",
from: "executor", to: "coordinator",
type: "exec_complete",
summary: `[executor] Phase ${phaseNumber} executed: ${taskCount} tasks across ${waveCount} waves. ${writtenSummaries.length} summaries written.`,
ref: `${sessionFolder}/phase-${phaseNumber}/`
})
Standard report flow: team_msg log -> SendMessage with `[executor]` prefix -> TaskUpdate completed -> Loop to Phase 1 for next task.
**Report message**:
```
SendMessage({
to: "coordinator",
message: `[executor] Phase ${phaseNumber} execution complete.
- Tasks executed: ${taskCount}
- Waves: ${waveCount}
- Summaries: ${writtenSummaries.map(f => f).join(', ')}
message: "[executor] Phase <N> execution complete.
- Tasks executed: <count>
- Waves: <wave-count>
- Summaries: <file-list>
Ready for verification.`
Ready for verification."
})
TaskUpdate({ taskId: execTask.id, status: "completed" })
```
---
## Error Handling
| Scenario | Resolution |
|----------|------------|
| No EXEC-* tasks available | Idle, wait for coordinator assignment |
| Context/Plan file not found | Notify coordinator, request location |
| Command file not found | Fall back to inline execution |
| No task JSON files found | Error to coordinator -- planner may have failed |
| code-developer subagent fails | Retry once. If still fails, log error in summary, continue with next plan |
| Syntax errors after implementation | Log in summary, continue -- verifier will catch remaining issues |
| Missing dependency from earlier wave | Error to coordinator -- dependency graph may be incorrect |
| File conflict between parallel plans | Log warning, last write wins -- verifier will validate correctness |
| Critical issue beyond scope | SendMessage fix_required to coordinator |
| Unexpected error | Log error via team_msg, report to coordinator |

View File

@@ -1,16 +1,14 @@
# Role: planner
# Planner Role
Research and plan creation per phase. Gathers codebase context via cli-explore-agent and Gemini CLI, then generates wave-based execution plans with must_haves verification criteria. Each plan is a self-contained unit of work that an executor can implement autonomously.
Research and plan creation per phase. Gathers codebase context via cli-explore-agent and Gemini CLI, then generates wave-based execution plans with convergence criteria. Each plan is a self-contained unit of work that an executor can implement autonomously.
## Role Identity
## Identity
- **Name**: `planner`
- **Name**: `planner` | **Tag**: `[planner]`
- **Task Prefix**: `PLAN-*`
- **Responsibility**: Orchestration (research + plan generation)
- **Communication**: SendMessage to coordinator only
- **Output Tag**: `[planner]`
## Role Boundaries
## Boundaries
### MUST
@@ -21,15 +19,42 @@ Research and plan creation per phase. Gathers codebase context via cli-explore-a
- Delegate plan creation to commands/create-plans.md
- Reference real files discovered during research (never fabricate paths)
- Verify plans have no dependency cycles before reporting
- Work strictly within Orchestration responsibility scope
### MUST NOT
- Execute work outside this role's responsibility scope
- Direct code writing or modification
- Call code-developer or other implementation subagents
- Create tasks for other roles (TaskCreate)
- Interact with user (AskUserQuestion)
- Process EXEC-* or VERIFY-* tasks
- Skip the research phase
- Communicate directly with other worker roles (must go through coordinator)
- Omit `[planner]` identifier in any output
---
## Toolbox
### Available Commands
| Command | File | Phase | Description |
|---------|------|-------|-------------|
| `research` | [commands/research.md](commands/research.md) | Phase 2 | Context gathering via codebase exploration |
| `create-plans` | [commands/create-plans.md](commands/create-plans.md) | Phase 3 | Wave-based plan file generation |
### Tool Capabilities
| Tool | Type | Used By | Purpose |
|------|------|---------|---------|
| `cli-explore-agent` | Subagent | planner | Codebase exploration, pattern analysis |
| `action-planning-agent` | Subagent | planner | Task JSON + IMPL_PLAN.md generation |
| `gemini` | CLI tool | planner | Deep analysis for complex phases (optional) |
| `Read/Write` | File operations | planner | Context and plan file management |
| `Glob/Grep` | Search | planner | File discovery and pattern matching |
---
## Message Types
@@ -41,241 +66,171 @@ Research and plan creation per phase. Gathers codebase context via cli-explore-a
## Message Bus
```javascript
Before every SendMessage, log via `mcp__ccw-tools__team_msg`:
```
mcp__ccw-tools__team_msg({
operation: "log", team: "roadmap-dev",
from: "planner", to: "coordinator",
type: messageType,
summary: `[planner] ${messageSummary}`,
ref: artifactPath
operation: "log",
team: "roadmap-dev",
from: "planner",
to: "coordinator",
type: <message-type>,
summary: "[planner] <task-prefix> complete: <task-subject>",
ref: <artifact-path>
})
```
### CLI Fallback
**CLI fallback** (when MCP unavailable):
```javascript
Bash(`ccw team log --team "roadmap-dev" --from "planner" --to "coordinator" --type "${type}" --summary "[planner] ${summary}" --json`)
```
Bash("ccw team log --team roadmap-dev --from planner --to coordinator --type <type> --summary \"[planner] <summary>\" --ref <artifact-path> --json")
```
## Toolbox
---
### Available Commands
| Command | File | Phase | Description |
|---------|------|-------|-------------|
| `research` | [commands/research.md](commands/research.md) | Phase 2 | Context gathering via codebase exploration |
| `create-plans` | [commands/create-plans.md](commands/create-plans.md) | Phase 3 | Wave-based plan file generation |
### Available Subagents
| Subagent | Purpose | When |
|----------|---------|------|
| `cli-explore-agent` | Codebase exploration (file discovery, pattern analysis) | Phase 2: Research |
| `action-planning-agent` | Task JSON + IMPL_PLAN.md generation | Phase 3: Create Plans |
### CLI Tools
| Tool | Mode | When |
|------|------|------|
| `gemini` | analysis | Deep analysis for complex phases (optional, depth=comprehensive) |
## Execution
## Execution (5-Phase)
### Phase 1: Task Discovery
```javascript
// Find assigned PLAN-* task
const tasks = TaskList()
const planTask = tasks.find(t =>
t.subject.startsWith('PLAN-') &&
t.status === 'pending' &&
(!t.blockedBy || t.blockedBy.length === 0)
)
> See SKILL.md Shared Infrastructure -> Worker Phase 1: Task Discovery
if (!planTask) {
mcp__ccw-tools__team_msg({
operation: "log", team: "roadmap-dev",
from: "planner", to: "coordinator",
type: "error",
summary: "[planner] No available PLAN-* task found"
})
return
}
Standard task discovery flow: TaskList -> filter by prefix `PLAN-*` + owner match + pending + unblocked -> TaskGet -> TaskUpdate in_progress.
TaskUpdate({ taskId: planTask.id, status: "in_progress" })
// Parse task description for session context
const taskDetails = TaskGet({ taskId: planTask.id })
const sessionFolder = parseSessionFolder(taskDetails.description)
const phaseNumber = parsePhaseNumber(taskDetails.description)
const depth = parseDepth(taskDetails.description) || "standard"
```
**Resume Artifact Check**: Check whether this task's output artifact already exists:
- `<session>/phase-N/context.md` exists -> skip to Phase 3
- Artifact incomplete or missing -> normal Phase 2-4 execution
### Phase 2: Research (via command)
```javascript
// Delegate to research command
Read("commands/research.md")
// Execute research steps:
// 1. Read roadmap.md for phase goal and requirements
// 2. Read prior phase summaries (if any)
// 3. Launch cli-explore-agent for codebase exploration
// 4. Optional: Gemini CLI for deeper analysis (if depth=comprehensive)
// 5. Write context.md to {sessionFolder}/phase-{N}/context.md
//
// Produces: {sessionFolder}/phase-{N}/context.md
```
**Objective**: Gather codebase context for plan generation.
**Loading steps**:
| Input | Source | Required |
|-------|--------|----------|
| roadmap.md | <session-folder>/roadmap.md | Yes |
| Prior phase summaries | <session-folder>/phase-*/summary-*.md | No |
| Wisdom | <session-folder>/wisdom/ | No |
Delegate to `commands/research.md`:
| Step | Action |
|------|--------|
| 1 | Read roadmap.md for phase goal and requirements |
| 2 | Read prior phase summaries (if any) |
| 3 | Launch cli-explore-agent for codebase exploration |
| 4 | Optional: Gemini CLI for deeper analysis (if depth=comprehensive) |
| 5 | Write context.md to {sessionFolder}/phase-{N}/context.md |
**Produces**: `{sessionFolder}/phase-{N}/context.md`
**Command**: [commands/research.md](commands/research.md)
```javascript
// Report research progress
**Report progress via team_msg**:
```
mcp__ccw-tools__team_msg({
operation: "log", team: "roadmap-dev",
from: "planner", to: "coordinator",
type: "plan_progress",
summary: `[planner] Research complete for phase ${phaseNumber}. Context written.`,
ref: `${sessionFolder}/phase-${phaseNumber}/context.md`
summary: "[planner] Research complete for phase <N>. Context written.",
ref: "<session>/phase-<N>/context.md"
})
```
### Phase 3: Create Plans (via command)
```javascript
// Delegate to create-plans command
Read("commands/create-plans.md")
// Execute plan creation steps:
// 1. Load context.md for phase
// 2. Prepare output directories (.task/)
// 3. Delegate to action-planning-agent
// 4. Agent produces IMPL_PLAN.md + .task/IMPL-*.json + TODO_LIST.md
// 5. Validate generated artifacts
// 6. Return task count and dependency structure
//
// Produces: {sessionFolder}/phase-{N}/IMPL_PLAN.md
// {sessionFolder}/phase-{N}/.task/IMPL-*.json
// {sessionFolder}/phase-{N}/TODO_LIST.md
```
**Objective**: Generate wave-based execution plans.
Delegate to `commands/create-plans.md`:
| Step | Action |
|------|--------|
| 1 | Load context.md for phase |
| 2 | Prepare output directories (.task/) |
| 3 | Delegate to action-planning-agent |
| 4 | Agent produces IMPL_PLAN.md + .task/IMPL-*.json + TODO_LIST.md |
| 5 | Validate generated artifacts |
| 6 | Return task count and dependency structure |
**Produces**:
- `{sessionFolder}/phase-{N}/IMPL_PLAN.md`
- `{sessionFolder}/phase-{N}/.task/IMPL-*.json`
- `{sessionFolder}/phase-{N}/TODO_LIST.md`
**Command**: [commands/create-plans.md](commands/create-plans.md)
### Phase 4: Self-Validation
```javascript
// Verify task JSONs before reporting
const taskFiles = Glob(`${sessionFolder}/phase-${phaseNumber}/.task/IMPL-*.json`)
**Objective**: Verify task JSONs before reporting.
for (const taskFile of taskFiles) {
const taskJson = JSON.parse(Read(taskFile))
**Validation checks**:
// 4a. Verify referenced files exist (for modify actions only)
for (const fileEntry of (taskJson.files || [])) {
if (fileEntry.action === 'modify') {
const exists = Bash(`test -f "${fileEntry.path}" && echo "EXISTS" || echo "NOT_FOUND"`).trim()
if (exists === "NOT_FOUND") {
mcp__ccw-tools__team_msg({
operation: "log", team: "roadmap-dev",
from: "planner", to: "coordinator",
type: "plan_progress",
summary: `[planner] Warning: ${taskJson.id} references ${fileEntry.path} for modify but file not found`,
ref: taskFile
})
}
}
}
| Check | Method | Pass Criteria |
|-------|--------|---------------|
| Referenced files exist | `test -f <path>` for modify actions | All files found or warning logged |
| Self-dependency | Check if depends_on includes own ID | No self-dependencies |
| Convergence criteria | Check convergence.criteria exists | Each task has criteria |
| Cross-dependency | Verify all depends_on IDs exist | All dependencies valid |
// 4b. Self-dependency check
if ((taskJson.depends_on || []).includes(taskJson.id)) {
mcp__ccw-tools__team_msg({
operation: "log", team: "roadmap-dev",
from: "planner", to: "coordinator",
type: "error",
summary: `[planner] Self-dependency detected: ${taskJson.id}`,
ref: taskFile
})
}
**Validation steps**:
// 4c. Convergence criteria check
if (!taskJson.convergence?.criteria?.length) {
mcp__ccw-tools__team_msg({
operation: "log", team: "roadmap-dev",
from: "planner", to: "coordinator",
type: "plan_progress",
summary: `[planner] Warning: ${taskJson.id} has no convergence criteria`,
ref: taskFile
})
}
}
1. **File existence check** (for modify actions):
- For each task file with action="modify"
- Check file exists
- Log warning if not found
// 4d. Cross-dependency validation
const allTasks = taskFiles.map(f => JSON.parse(Read(f)))
const taskIds = new Set(allTasks.map(t => t.id))
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",
type: "plan_progress",
summary: `[planner] Warning: ${task.id} depends on unknown task ${dep}`
})
}
}
}
```
2. **Self-dependency check**:
- For each task, verify task.id not in task.depends_on
- Log error if self-dependency detected
3. **Convergence criteria check**:
- Verify each task has convergence.criteria array
- Log warning if missing
4. **Cross-dependency validation**:
- Collect all task IDs
- Verify each depends_on reference exists
- Log warning if unknown dependency
### Phase 5: Report to Coordinator
```javascript
const taskCount = allTasks.length
> See SKILL.md Shared Infrastructure -> Worker Phase 5: Report
// Compute wave count from dependency graph
function computeWaveCount(tasks) {
const waves = {}
const assigned = new Set()
let wave = 1
while (assigned.size < tasks.length) {
const ready = tasks.filter(t =>
!assigned.has(t.id) &&
(t.depends_on || []).every(d => assigned.has(d))
)
if (ready.length === 0) break
for (const t of ready) { waves[t.id] = wave; assigned.add(t.id) }
wave++
}
return wave - 1
}
const waveCount = computeWaveCount(allTasks)
Standard report flow: team_msg log -> SendMessage with `[planner]` prefix -> TaskUpdate completed -> Loop to Phase 1 for next task.
// Log plan_ready message
mcp__ccw-tools__team_msg({
operation: "log", team: "roadmap-dev",
from: "planner", to: "coordinator",
type: "plan_ready",
summary: `[planner] Phase ${phaseNumber} planned: ${taskCount} tasks across ${waveCount} waves`,
ref: `${sessionFolder}/phase-${phaseNumber}/`
})
**Wave count computation**:
// Send message to coordinator
| Step | Action |
|------|--------|
| 1 | Start with wave=1, assigned=set() |
| 2 | Find tasks with all dependencies in assigned |
| 3 | Assign those tasks to current wave, add to assigned |
| 4 | Increment wave, repeat until all tasks assigned |
| 5 | Return wave count |
**Report message**:
```
SendMessage({
to: "coordinator",
message: `[planner] Phase ${phaseNumber} planning complete.
- Tasks: ${taskCount}
- Waves: ${waveCount}
- IMPL_PLAN: ${sessionFolder}/phase-${phaseNumber}/IMPL_PLAN.md
- Task JSONs: ${taskFiles.map(f => f).join(', ')}
message: "[planner] Phase <N> planning complete.
- Tasks: <count>
- Waves: <wave-count>
- IMPL_PLAN: <session>/phase-<N>/IMPL_PLAN.md
- Task JSONs: <file-list>
All tasks validated. Ready for execution.`
All tasks validated. Ready for execution."
})
// Mark task complete
TaskUpdate({ taskId: planTask.id, status: "completed" })
```
---
## Error Handling
| Scenario | Resolution |
|----------|------------|
| No PLAN-* tasks available | Idle, wait for coordinator assignment |
| Context/Plan file not found | Notify coordinator, request location |
| Command file not found | Fall back to inline execution |
| roadmap.md not found | Error to coordinator -- dispatch may have failed |
| cli-explore-agent fails | Retry once. If still fails, use direct ACE search as fallback |
| Gemini CLI fails | Skip deep analysis, proceed with basic context |
@@ -284,3 +239,5 @@ TaskUpdate({ taskId: planTask.id, status: "completed" })
| No requirements found for phase | Error to coordinator -- roadmap may be malformed |
| Dependency cycle detected | Log warning, break cycle |
| Referenced file not found | Log warning. If file is from prior wave, acceptable |
| Critical issue beyond scope | SendMessage fix_required to coordinator |
| Unexpected error | Log error via team_msg, report to coordinator |

View File

@@ -1,16 +1,14 @@
# Role: verifier
# Verifier Role
Goal-backward verification per phase. Reads convergence criteria from IMPL-*.json task files and checks them against the actual codebase state after execution. Does NOT modify code read-only validation. Produces verification.md with pass/fail results and structured gap lists.
Goal-backward verification per phase. Reads convergence criteria from IMPL-*.json task files and checks them against the actual codebase state after execution. Does NOT modify code -- read-only validation. Produces verification.md with pass/fail results and structured gap lists.
## Role Identity
## Identity
- **Name**: `verifier`
- **Name**: `verifier` | **Tag**: `[verifier]`
- **Task Prefix**: `VERIFY-*`
- **Responsibility**: Validation
- **Communication**: SendMessage to coordinator only
- **Output Tag**: `[verifier]`
## Role Boundaries
## Boundaries
### MUST
@@ -21,41 +19,21 @@ Goal-backward verification per phase. Reads convergence criteria from IMPL-*.jso
- Check goals (what should exist), NOT tasks (what was done)
- Produce structured gap lists for failed items
- Remain read-only -- never modify source code
- Work strictly within Validation responsibility scope
### MUST NOT
- Execute work outside this role's responsibility scope
- Modify any source code or project files
- Create plans or execute implementations
- Create tasks for other roles (TaskCreate)
- Interact with user (AskUserQuestion)
- Process PLAN-* or EXEC-* tasks
- Auto-fix issues (report them, let planner/executor handle fixes)
- Communicate directly with other worker roles (must go through coordinator)
- Omit `[verifier]` identifier in any output
## Message Types
| Type | Direction | Trigger | Description |
|------|-----------|---------|-------------|
| `verify_passed` | verifier -> coordinator | All must_haves met | Phase verification passed |
| `gaps_found` | verifier -> coordinator | Some must_haves failed | Structured gap list for re-planning |
| `error` | verifier -> coordinator | Failure | Verification process failed |
## Message Bus
```javascript
mcp__ccw-tools__team_msg({
operation: "log", team: "roadmap-dev",
from: "verifier", to: "coordinator",
type: messageType,
summary: `[verifier] ${messageSummary}`,
ref: artifactPath
})
```
### CLI Fallback
```javascript
Bash(`ccw team log --team "roadmap-dev" --from "verifier" --to "coordinator" --type "${type}" --summary "[verifier] ${summary}" --json`)
```
---
## Toolbox
@@ -63,205 +41,207 @@ Bash(`ccw team log --team "roadmap-dev" --from "verifier" --to "coordinator" --t
| Command | File | Phase | Description |
|---------|------|-------|-------------|
| `verify` | [commands/verify.md](commands/verify.md) | Phase 3 | Goal-backward must_haves checking |
| `verify` | [commands/verify.md](commands/verify.md) | Phase 3 | Goal-backward convergence criteria checking |
### Available Subagents
### Tool Capabilities
None. Verifier executes checks directly using built-in tools (Read, Grep, Bash).
| Tool | Type | Used By | Purpose |
|------|------|---------|---------|
| `gemini` | CLI tool | verifier | Deep semantic checks for complex truths (optional) |
| `Read` | File operations | verifier | Task JSON and summary reading |
| `Glob` | Search | verifier | Find task and summary files |
| `Bash` | Shell | verifier | Execute verification commands |
| `Grep` | Search | verifier | Pattern matching in codebase |
### CLI Tools
---
| Tool | Mode | When |
|------|------|------|
| `gemini` | analysis | Deep semantic checks for complex truths (optional) |
## Message Types
## Execution
| Type | Direction | Trigger | Description |
|------|-----------|---------|-------------|
| `verify_passed` | verifier -> coordinator | All convergence criteria met | Phase verification passed |
| `gaps_found` | verifier -> coordinator | Some criteria failed | Structured gap list for re-planning |
| `error` | verifier -> coordinator | Failure | Verification process failed |
## Message Bus
Before every SendMessage, log via `mcp__ccw-tools__team_msg`:
```
mcp__ccw-tools__team_msg({
operation: "log",
team: "roadmap-dev",
from: "verifier",
to: "coordinator",
type: <message-type>,
summary: "[verifier] <task-prefix> complete: <task-subject>",
ref: <artifact-path>
})
```
**CLI fallback** (when MCP unavailable):
```
Bash("ccw team log --team roadmap-dev --from verifier --to coordinator --type <type> --summary \"[verifier] <summary>\" --ref <artifact-path> --json")
```
---
## Execution (5-Phase)
### Phase 1: Task Discovery
```javascript
// Find assigned VERIFY-* task
const tasks = TaskList()
const verifyTask = tasks.find(t =>
t.subject.startsWith('VERIFY-') &&
t.status === 'pending' &&
(!t.blockedBy || t.blockedBy.length === 0)
)
> See SKILL.md Shared Infrastructure -> Worker Phase 1: Task Discovery
if (!verifyTask) {
mcp__ccw-tools__team_msg({
operation: "log", team: "roadmap-dev",
from: "verifier", to: "coordinator",
type: "error",
summary: "[verifier] No available VERIFY-* task found"
})
return
}
Standard task discovery flow: TaskList -> filter by prefix `VERIFY-*` + owner match + pending + unblocked -> TaskGet -> TaskUpdate in_progress.
TaskUpdate({ taskId: verifyTask.id, status: "in_progress" })
// Parse task description for session context
const taskDetails = TaskGet({ taskId: verifyTask.id })
const sessionFolder = parseSessionFolder(taskDetails.description)
const phaseNumber = parsePhaseNumber(taskDetails.description)
```
**Resume Artifact Check**: Check whether this task's output artifact already exists:
- `<session>/phase-N/verification.md` exists -> skip to Phase 5
- Artifact incomplete or missing -> normal Phase 2-4 execution
### Phase 2: Load Verification Targets
```javascript
// Read all task JSON files for convergence criteria
const taskFiles = Glob(`${sessionFolder}/phase-${phaseNumber}/.task/IMPL-*.json`)
const tasks = []
**Objective**: Load task JSONs and summaries for verification.
for (const taskFile of taskFiles) {
const taskJson = JSON.parse(Read(taskFile))
tasks.push({
...taskJson,
file: taskFile
})
}
**Detection steps**:
// Read all summary files for what was done
const summaryFiles = Glob(`${sessionFolder}/phase-${phaseNumber}/summary-*.md`)
const summaries = []
| Input | Source | Required |
|-------|--------|----------|
| Task JSONs | <session-folder>/phase-{N}/.task/IMPL-*.json | Yes |
| Summaries | <session-folder>/phase-{N}/summary-*.md | Yes |
| Wisdom | <session-folder>/wisdom/ | No |
for (const summaryFile of summaryFiles) {
const content = Read(summaryFile)
const frontmatter = parseYamlFrontmatter(content)
summaries.push({
file: summaryFile,
task: frontmatter.task,
affects: frontmatter.affects || frontmatter['key-files'] || [],
provides: frontmatter.provides || []
})
}
1. **Read task JSON files**:
- Find all IMPL-*.json files
- Extract convergence criteria from each task
- If no files found -> error to coordinator
if (tasks.length === 0) {
mcp__ccw-tools__team_msg({
operation: "log", team: "roadmap-dev",
from: "verifier", to: "coordinator",
type: "error",
summary: `[verifier] No task JSON files found in ${sessionFolder}/phase-${phaseNumber}/.task/`
})
return
}
```
2. **Read summary files**:
- Find all summary-*.md files
- Parse frontmatter for: task, affects, provides
- If no files found -> error to coordinator
### Phase 3: Goal-Backward Verification (via command)
```javascript
// Delegate to verify command
Read("commands/verify.md")
// Execute goal-backward verification:
// 1. For each task's convergence criteria: check criteria, files, verification command
// 2. Score each task: pass / partial / fail
// 3. Compile gap list
//
// Produces: verificationResults (structured data)
```
**Objective**: Execute convergence criteria checks.
Delegate to `commands/verify.md`:
| Step | Action |
|------|--------|
| 1 | For each task's convergence criteria |
| 2 | Check criteria type: files, command, pattern |
| 3 | Execute appropriate verification method |
| 4 | Score each task: pass / partial / fail |
| 5 | Compile gap list for failed items |
**Verification strategy selection**:
| Criteria Type | Method |
|---------------|--------|
| File existence | `test -f <path>` |
| Command execution | Run specified command, check exit code |
| Pattern match | Grep for pattern in specified files |
| Semantic check | Optional: Gemini CLI for deep analysis |
**Produces**: verificationResults (structured data)
**Command**: [commands/verify.md](commands/verify.md)
### Phase 4: Compile Results
```javascript
// Aggregate pass/fail per task
const results = {
totalTasks: tasks.length,
passed: 0,
partial: 0,
failed: 0,
gaps: []
}
**Objective**: Aggregate pass/fail and generate verification.md.
for (const taskResult of verificationResults) {
if (taskResult.status === 'pass') {
results.passed++
} else if (taskResult.status === 'partial') {
results.partial++
results.gaps.push(...taskResult.gaps)
} else {
results.failed++
results.gaps.push(...taskResult.gaps)
}
}
**Result aggregation**:
const overallStatus = results.gaps.length === 0 ? 'passed' : 'gaps_found'
```
| Metric | Source | Threshold |
|--------|--------|-----------|
| Pass rate | Task results | >= 100% for passed |
| Gaps count | Failed criteria | 0 for passed |
### Phase 5: Write verification.md + Report
**Compile steps**:
```javascript
const verificationPath = `${sessionFolder}/phase-${phaseNumber}/verification.md`
1. **Aggregate results per task**:
- Count passed, partial, failed
- Collect all gaps from partial/failed tasks
Write(verificationPath, `---
phase: ${phaseNumber}
status: ${overallStatus}
tasks_checked: ${results.totalTasks}
tasks_passed: ${results.passed}
2. **Determine overall status**:
- `passed` if gaps.length === 0
- `gaps_found` otherwise
3. **Write verification.md**:
- YAML frontmatter with status, counts, gaps
- Summary section
- Task results section
- Gaps section (if any)
**Verification.md structure**:
```yaml
---
phase: <N>
status: passed | gaps_found
tasks_checked: <count>
tasks_passed: <count>
gaps:
${results.gaps.map(g => ` - task: "${g.task}"
type: "${g.type}"
item: "${g.item}"
expected: "${g.expected}"
actual: "${g.actual}"`).join('\n')}
- task: "<task-id>"
type: "<criteria-type>"
item: "<description>"
expected: "<expected-value>"
actual: "<actual-value>"
---
# Phase ${phaseNumber} Verification
# Phase <N> Verification
## Summary
- **Status**: ${overallStatus}
- **Tasks Checked**: ${results.totalTasks}
- **Passed**: ${results.passed}
- **Partial**: ${results.partial}
- **Failed**: ${results.failed}
- **Total Gaps**: ${results.gaps.length}
- Status: <status>
- Tasks Checked: <count>
- Passed: <count>
- Total Gaps: <count>
## Task Results
### TASK-ID: Title - STATUS
- [x] (type) description
- [ ] (type) description
${verificationResults.map(r => `### ${r.task}: ${r.title}${r.status.toUpperCase()}
${r.details.map(d => `- [${d.passed ? 'x' : ' '}] (${d.type}) ${d.description}`).join('\n')}`).join('\n\n')}
## Gaps (if any)
### Gap 1: Task - Type
- Expected: ...
- Actual: ...
```
${results.gaps.length > 0 ? `## Gaps
### Phase 5: Report to Coordinator
${results.gaps.map((g, i) => `### Gap ${i + 1}: ${g.task} - ${g.type}
- **Expected**: ${g.expected}
- **Actual**: ${g.actual}
- **Item**: ${g.item}`).join('\n\n')}` : '## No Gaps Found'}
`)
> See SKILL.md Shared Infrastructure -> Worker Phase 5: Report
const messageType = overallStatus === 'passed' ? 'verify_passed' : 'gaps_found'
mcp__ccw-tools__team_msg({
operation: "log", team: "roadmap-dev",
from: "verifier", to: "coordinator",
type: messageType,
summary: `[verifier] Phase ${phaseNumber} verification: ${overallStatus}. ${results.passed}/${results.totalTasks} tasks passed. ${results.gaps.length} gaps.`,
ref: verificationPath
})
Standard report flow: team_msg log -> SendMessage with `[verifier]` prefix -> TaskUpdate completed -> Loop to Phase 1 for next task.
**Report message**:
```
SendMessage({
to: "coordinator",
message: `[verifier] Phase ${phaseNumber} verification complete.
- Status: ${overallStatus}
- Tasks: ${results.passed}/${results.totalTasks} passed
- Gaps: ${results.gaps.length}
${results.gaps.length > 0 ? `\nGap summary:\n${results.gaps.map(g => `- ${g.task}, ${g.type}: ${g.item}`).join('\n')}` : ''}
message: "[verifier] Phase <N> verification complete.
- Status: <status>
- Tasks: <passed>/<total> passed
- Gaps: <gap-count>
Verification written to: ${verificationPath}`
Verification written to: <verification-path>"
})
TaskUpdate({ taskId: verifyTask.id, status: "completed" })
```
---
## Error Handling
| Scenario | Resolution |
|----------|------------|
| No VERIFY-* tasks available | Idle, wait for coordinator assignment |
| Context/Plan file not found | Notify coordinator, request location |
| Command file not found | Fall back to inline execution |
| No task JSON files found | Error to coordinator -- planner may have failed |
| No summary files found | Error to coordinator -- executor may have failed |
| File referenced in task missing | Record as gap (file type) |
| Bash command fails during check | Record as gap with error message |
| Verification command fails | Record as gap with exit code |
| Gemini CLI fails | Fallback to direct checks, skip semantic analysis |
| Critical issue beyond scope | SendMessage fix_required to coordinator |
| Unexpected error | Log error via team_msg, report to coordinator |