Refactor team collaboration skills and update documentation

- Renamed `team-lifecycle-v5` to `team-lifecycle` across various documentation files for consistency.
- Updated references in code examples and usage sections to reflect the new skill name.
- Added a new command file for the `monitor` functionality in the `team-iterdev` skill, detailing the coordinator's monitoring events and task management.
- Introduced new components for dynamic pipeline visualization and session coordinates display in the frontend.
- Implemented utility functions for pipeline stage detection and status derivation based on message history.
- Enhanced the team role panel to map members to their respective pipeline roles with status indicators.
- Updated Chinese documentation to reflect the changes in skill names and descriptions.
This commit is contained in:
catlog22
2026-03-04 11:07:48 +08:00
parent 5e96722c09
commit ffd5282932
132 changed files with 2938 additions and 18916 deletions

View File

@@ -13,35 +13,23 @@ Unified team skill: issue processing pipeline (explore → plan → implement
## Architecture
```
┌───────────────────────────────────────────────┐
Skill(skill="team-issue")
args="<issue-ids>" or args="--role=xxx" │
└───────────────────┬───────────────────────────┘
│ Role Router
┌──── --role present? ────┐
│ NO │ YES
↓ ↓
Orchestration Mode Role Dispatch
(auto → coordinator) (route to role.md)
┌────┴────┬───────────┬───────────┬───────────┬───────────┐
↓ ↓ ↓ ↓ ↓ ↓
┌──────────┐┌─────────┐┌─────────┐┌─────────┐┌──────────┐┌──────────┐
│coordinator││explorer ││planner ││reviewer ││integrator││implementer
│ ││EXPLORE-*││SOLVE-* ││AUDIT-* ││MARSHAL-* ││BUILD-* │
└──────────┘└─────────┘└─────────┘└─────────┘└──────────┘└──────────┘
```
+---------------------------------------------------+
| Skill(skill="team-issue") |
| args="<issue-ids>" |
+-------------------+-------------------------------+
|
Orchestration Mode (auto -> coordinator)
|
Coordinator (inline)
Phase 0-5 orchestration
|
+-----+-----+-----+-----+-----+
v v v v v
[tw] [tw] [tw] [tw] [tw]
explor plann review integ- imple-
er er er rator menter
## Command Architecture
```
roles/
├── coordinator.md # Pipeline orchestration (Phase 1/5 inline, Phase 2-4 core logic)
├── explorer.md # Context analysis (ACE + cli-explore-agent)
├── planner.md # Solution design (wraps issue-plan-agent)
├── reviewer.md # Solution review (technical feasibility + risk assessment)
├── integrator.md # Queue orchestration (wraps issue-queue-agent)
└── implementer.md # Code implementation (wraps code-developer)
(tw) = team-worker agent
```
## Role Router
@@ -52,14 +40,14 @@ Parse `$ARGUMENTS` to extract `--role`. If absent → Orchestration Mode (auto r
### Role Registry
| Role | File | Task Prefix | Type | Compact |
|------|------|-------------|------|---------|
| coordinator | [roles/coordinator.md](roles/coordinator.md) | (none) | orchestrator | **⚠️ 压缩后必须重读** |
| explorer | [roles/explorer.md](roles/explorer.md) | EXPLORE-* | pipeline | 压缩后必须重读 |
| planner | [roles/planner.md](roles/planner.md) | SOLVE-* | pipeline | 压缩后必须重读 |
| reviewer | [roles/reviewer.md](roles/reviewer.md) | AUDIT-* | pipeline | 压缩后必须重读 |
| integrator | [roles/integrator.md](roles/integrator.md) | MARSHAL-* | pipeline | 压缩后必须重读 |
| implementer | [roles/implementer.md](roles/implementer.md) | BUILD-* | pipeline | 压缩后必须重读 |
| Role | Spec | Task Prefix | Inner Loop |
|------|------|-------------|------------|
| coordinator | [roles/coordinator/role.md](roles/coordinator/role.md) | (none) | - |
| explorer | [role-specs/explorer.md](role-specs/explorer.md) | EXPLORE-* | false |
| planner | [role-specs/planner.md](role-specs/planner.md) | SOLVE-* | false |
| reviewer | [role-specs/reviewer.md](role-specs/reviewer.md) | AUDIT-* | false |
| integrator | [role-specs/integrator.md](role-specs/integrator.md) | MARSHAL-* | false |
| implementer | [role-specs/implementer.md](role-specs/implementer.md) | BUILD-* | false |
> **⚠️ COMPACT PROTECTION**: 角色文件是执行文档,不是参考资料。当 context compression 发生后,角色指令仅剩摘要时,**必须立即 `Read` 对应 role.md 重新加载后再继续执行**。不得基于摘要执行任何 Phase。
@@ -308,91 +296,103 @@ Beat 1 2 3 4 5
## Coordinator Spawn Template
When coordinator spawns workers, use background mode (Spawn-and-Stop).
### v5 Worker Spawn (all roles)
**Standard spawn** (single agent per role): For Quick/Full mode, spawn one agent per role. Explorer, planner, reviewer, integrator each get a single agent.
**Parallel spawn** (Batch mode): For Batch mode with multiple issues, spawn N explorer agents in parallel (max 5) and M implementer agents in parallel (max 3). Each parallel agent only processes tasks where owner matches its agent name.
**Spawn template**:
When coordinator spawns workers, use `team-worker` agent with role-spec path:
```
Task({
subagent_type: "general-purpose",
subagent_type: "team-worker",
description: "Spawn <role> worker",
team_name: "issue",
name: "<role>",
run_in_background: true,
prompt: `You are team "issue" <ROLE>.
prompt: `## Role Assignment
role: <role>
role_spec: .claude/skills/team-issue/role-specs/<role>.md
session: <session-folder>
session_id: <session-id>
team_name: issue
requirement: <task-description>
inner_loop: false
## Primary Directive
All your work must be executed through Skill to load role definition:
Skill(skill="team-issue", args="--role=<role>")
Current requirement: <task-description>
Session: <session-folder>
## Role Guidelines
- Only process <PREFIX>-* tasks, do not execute other role work
- All output prefixed with [<role>] identifier
- Only communicate with coordinator
- Do not use TaskCreate for other roles
- Call mcp__ccw-tools__team_msg before every SendMessage
## Workflow
1. Call Skill -> load role definition and execution logic
2. Follow role.md 5-Phase flow
3. team_msg + SendMessage results to coordinator
4. TaskUpdate completed -> check next task`
Read role_spec file to load Phase 2-4 domain instructions.
Execute built-in Phase 1 (task discovery) -> role-spec Phase 2-4 -> built-in Phase 5 (report).`
})
```
**All roles** (explorer, planner, reviewer, integrator, implementer): Set `inner_loop: false`.
### Parallel Spawn (Batch Mode)
> When Batch mode has parallel tasks assigned to the same role, spawn N distinct agents with unique names. A single agent can only process tasks serially.
> When Batch mode has parallel tasks assigned to the same role, spawn N distinct team-worker agents with unique names.
**Explorer parallel spawn** (Batch mode, N issues):
| Condition | Action |
|-----------|--------|
| Batch mode with N issues (N > 1) | Spawn min(N, 5) agents: `explorer-1`, `explorer-2`, ... with `run_in_background: true` |
| Quick/Full mode (single explorer) | Standard spawn: single `explorer` agent |
| Batch mode with N issues (N > 1) | Spawn min(N, 5) team-worker agents: `explorer-1`, `explorer-2`, ... with `run_in_background: true` |
| Quick/Full mode (single explorer) | Standard spawn: single `explorer` team-worker agent |
**Implementer parallel spawn** (Batch mode, M BUILD tasks):
| Condition | Action |
|-----------|--------|
| Batch mode with M BUILD tasks (M > 2) | Spawn min(M, 3) agents: `implementer-1`, `implementer-2`, ... with `run_in_background: true` |
| Quick/Full mode (single implementer) | Standard spawn: single `implementer` agent |
| Batch mode with M BUILD tasks (M > 2) | Spawn min(M, 3) team-worker agents: `implementer-1`, `implementer-2`, ... with `run_in_background: true` |
| Quick/Full mode (single implementer) | Standard spawn: single `implementer` team-worker agent |
**Parallel spawn template**:
```
Task({
subagent_type: "general-purpose",
subagent_type: "team-worker",
description: "Spawn <role>-<N> worker",
team_name: "issue",
name: "<role>-<N>",
run_in_background: true,
prompt: `You are team "issue" <ROLE> (<role>-<N>).
Your agent name is "<role>-<N>", use this name for task discovery owner matching.
prompt: `## Role Assignment
role: <role>
role_spec: .claude/skills/team-issue/role-specs/<role>.md
session: <session-folder>
session_id: <session-id>
team_name: issue
requirement: <task-description>
agent_name: <role>-<N>
inner_loop: false
## Primary Directive
Skill(skill="team-issue", args="--role=<role> --agent-name=<role>-<N>")
## Role Guidelines
- Only process tasks where owner === "<role>-<N>" with <PREFIX>-* prefix
- All output prefixed with [<role>] identifier
## Workflow
1. TaskList -> find tasks where owner === "<role>-<N>" with <PREFIX>-* prefix
2. Skill -> execute role definition
3. team_msg + SendMessage results to coordinator
4. TaskUpdate completed -> check next task`
Read role_spec file to load Phase 2-4 domain instructions.
Execute built-in Phase 1 (task discovery, owner=<role>-<N>) -> role-spec Phase 2-4 -> built-in Phase 5 (report).`
})
```
**Dispatch must match agent names**: When dispatching parallel tasks, coordinator sets each task's owner to the corresponding instance name (`explorer-1`, `explorer-2`, etc. or `implementer-1`, `implementer-2`, etc.). In role.md, task discovery uses `--agent-name` for owner matching.
**Dispatch must match agent names**: When dispatching parallel tasks, coordinator sets each task's owner to the corresponding instance name (`explorer-1`, `explorer-2`, etc. or `implementer-1`, `implementer-2`, etc.).
---
## Completion Action
When the pipeline completes (all tasks done, coordinator Phase 5):
```
AskUserQuestion({
questions: [{
question: "Issue resolution pipeline complete. What would you like to do?",
header: "Completion",
multiSelect: false,
options: [
{ label: "Archive & Clean (Recommended)", description: "Archive session, clean up tasks and team resources" },
{ label: "Keep Active", description: "Keep session active for follow-up work or inspection" },
{ label: "Export Results", description: "Export deliverables to a specified location, then clean" }
]
}]
})
```
| Choice | Action |
|--------|--------|
| Archive & Clean | Update session status="completed" -> TeamDelete(issue) -> output final summary |
| Keep Active | Update session status="paused" -> output resume instructions: `Skill(skill="team-issue", args="resume")` |
| Export Results | AskUserQuestion for target path -> copy deliverables -> Archive & Clean |
---

View File

@@ -1,336 +0,0 @@
# Coordinator Role
Orchestrate the issue resolution pipeline: requirement clarification -> mode selection -> team creation -> task chain -> dispatch -> monitoring -> reporting.
## Identity
- **Name**: `coordinator` | **Tag**: `[coordinator]`
- **Task Prefix**: N/A (coordinator creates tasks, does not receive them)
- **Responsibility**: Orchestration
## Boundaries
### MUST
- All output (SendMessage, team_msg, logs) must carry `[coordinator]` identifier
- Responsible only for: requirement clarification, mode selection, task creation/dispatch, progress monitoring, result reporting
- Create tasks via TaskCreate and assign to worker roles
- Monitor worker progress via message bus and route messages
- Parse user requirements and clarify ambiguous inputs via AskUserQuestion
- Maintain session state persistence
- Dispatch tasks with proper dependency chains (see SKILL.md Task Metadata Registry)
### MUST NOT
- Execute any business tasks directly (code writing, solution design, review, etc.)
- Call implementation subagents directly (issue-plan-agent, issue-queue-agent, code-developer, etc.)
- Modify source code or generated artifacts directly
- Bypass worker roles to complete delegated work
- Omit `[coordinator]` identifier in any output
- Skip dependency validation when creating task chains
> **Core principle**: coordinator is the orchestrator, not the executor. All actual work must be delegated to worker roles via TaskCreate.
---
## Toolbox
### Available Commands
> No command files -- all phases execute inline.
### Tool Capabilities
| Tool | Type | Used By | Purpose |
|------|------|---------|---------|
| `TeamCreate` | Team | coordinator | Initialize team |
| `TeamDelete` | Team | coordinator | Dissolve team |
| `SendMessage` | Team | coordinator | Communicate with workers/user |
| `TaskCreate` | Task | coordinator | Create and dispatch tasks |
| `TaskList` | Task | coordinator | Monitor task status |
| `TaskGet` | Task | coordinator | Get task details |
| `TaskUpdate` | Task | coordinator | Update task status |
| `AskUserQuestion` | UI | coordinator | Clarify requirements |
| `Read` | IO | coordinator | Read session files |
| `Write` | IO | coordinator | Write session files |
| `Bash` | System | coordinator | Execute ccw commands |
| `mcp__ccw-tools__team_msg` | Team | coordinator | Log messages to message bus |
---
## Message Types
| Type | Direction | Trigger | Description |
|------|-----------|---------|-------------|
| `task_assigned` | coordinator -> worker | Task dispatched | Notify worker of new task |
| `pipeline_update` | coordinator -> user | Progress milestone | Pipeline progress update |
| `escalation` | coordinator -> user | Unresolvable issue | Escalate to user decision |
| `shutdown` | coordinator -> all | Team dissolved | Team shutdown notification |
## Message Bus
Before every SendMessage, log via `mcp__ccw-tools__team_msg`:
```
mcp__ccw-tools__team_msg({
operation: "log",
session_id: <session-id>,
from: "coordinator",
type: <message-type>,
data: {ref: <artifact-path>}
})
```
`to` and `summary` auto-defaulted -- do NOT specify explicitly.
**CLI fallback**: `ccw team log --session-id <session-id> --from coordinator --type <type> --json`
---
## Entry Router
When coordinator is invoked, first detect the invocation type:
| Detection | Condition | Handler |
|-----------|-----------|---------|
| Worker callback | Message contains `[role-name]` tag from a known worker role | -> handleCallback: auto-advance pipeline |
| Status check | Arguments contain "check" or "status" | -> handleCheck: output execution graph, no advancement |
| Manual resume | Arguments contain "resume" or "continue" | -> handleResume: check worker states, advance pipeline |
| New session | None of the above | -> Phase 0 (Session Resume Check) |
For callback/check/resume: execute the appropriate handler, then STOP.
---
## Phase 0: Session Resume Check
**Objective**: Detect and resume interrupted sessions before creating new ones.
**Workflow**:
1. Check for existing team session via team_msg list
2. No sessions found -> proceed to Phase 1
3. Single session found -> resume it (-> Session Reconciliation)
4. Multiple sessions -> AskUserQuestion for user selection
**Session Reconciliation**:
1. Audit TaskList -> get real status of all tasks
2. Reconcile: session state <-> TaskList status (bidirectional sync)
3. Reset any in_progress tasks -> pending (they were interrupted)
4. Determine remaining pipeline from reconciled state
5. Rebuild team if disbanded (TeamCreate + spawn needed workers only)
6. Create missing tasks with correct blockedBy dependencies
7. Verify dependency chain integrity
8. Update session file with reconciled state
9. Kick first executable task's worker -> Phase 4
---
## Phase 1: Requirement Clarification
**Objective**: Parse user input and gather execution parameters.
**Workflow**:
1. **Parse arguments** for issue IDs and mode:
| Pattern | Extraction |
|---------|------------|
| `GH-\d+` | GitHub issue ID |
| `ISS-\d{8}-\d{6}` | Local issue ID |
| `--mode=<mode>` | Explicit mode |
| `--all-pending` | Load all pending issues |
2. **Load pending issues** if `--all-pending`:
```
Bash("ccw issue list --status registered,pending --json")
```
3. **Ask for missing parameters** via AskUserQuestion if no issue IDs found
4. **Mode auto-detection** (when user does not specify `--mode`):
| Condition | Mode |
|-----------|------|
| Issue count <= 2 AND no high-priority (priority < 4) | `quick` |
| Issue count <= 2 AND has high-priority (priority >= 4) | `full` |
| Issue count >= 5 | `batch` |
| 3-4 issues | `full` |
5. **Execution method selection** (for BUILD phase):
| Option | Description |
|--------|-------------|
| `Agent` | code-developer agent (sync, for simple tasks) |
| `Codex` | Codex CLI (background, for complex tasks) |
| `Gemini` | Gemini CLI (background, for analysis tasks) |
| `Auto` | Auto-select based on solution task_count (default) |
6. **Code review selection**:
| Option | Description |
|--------|-------------|
| `Skip` | No review |
| `Gemini Review` | Gemini CLI review |
| `Codex Review` | Git-aware review (--uncommitted) |
**Success**: All parameters captured, mode finalized.
---
## Phase 2: Create Team + Initialize Session
**Objective**: Initialize team, session file, and wisdom directory.
**Workflow**:
1. Generate session ID
2. Create session folder
3. Call TeamCreate with team name "issue"
4. Initialize wisdom directory (learnings.md, decisions.md, conventions.md, issues.md)
5. Write session file with: session_id, mode, scope, status="active"
**Spawn template**: Workers are NOT pre-spawned here. Workers are spawned on-demand in Phase 4. See SKILL.md Coordinator Spawn Template for worker prompt templates.
**Worker roles available**:
- quick mode: explorer, planner, integrator, implementer
- full mode: explorer, planner, reviewer, integrator, implementer
- batch mode: parallel explorers (max 5), parallel implementers (max 3)
**Success**: Team created, session file written, wisdom initialized.
---
## Phase 3: Create Task Chain
**Objective**: Dispatch tasks based on mode with proper dependencies.
### Quick Mode (4 beats, strictly serial)
Create task chain for each issue: EXPLORE -> SOLVE -> MARSHAL -> BUILD
| Task ID | Role | Dependencies | Description |
|---------|------|--------------|-------------|
| EXPLORE-001 | explorer | (none) | Context analysis |
| SOLVE-001 | planner | EXPLORE-001 | Solution design |
| MARSHAL-001 | integrator | SOLVE-001 | Queue formation |
| BUILD-001 | implementer | MARSHAL-001 | Code implementation |
### Full Mode (5-7 beats, with review gate)
Add AUDIT between SOLVE and MARSHAL:
| Task ID | Role | Dependencies | Description |
|---------|------|--------------|-------------|
| EXPLORE-001 | explorer | (none) | Context analysis |
| SOLVE-001 | planner | EXPLORE-001 | Solution design |
| AUDIT-001 | reviewer | SOLVE-001 | Solution review |
| MARSHAL-001 | integrator | AUDIT-001 | Queue formation |
| BUILD-001 | implementer | MARSHAL-001 | Code implementation |
### Batch Mode (parallel windows)
Create parallel task batches:
| Batch | Tasks | Parallel Limit |
|-------|-------|----------------|
| EXPLORE-001..N | explorer | max 5 parallel |
| SOLVE-001..N | planner | sequential |
| AUDIT-001 | reviewer | (all SOLVE complete) |
| MARSHAL-001 | integrator | (AUDIT complete) |
| BUILD-001..M | implementer | max 3 parallel |
**Task description must include**: execution_method, code_review settings from Phase 1.
---
## Phase 4: Spawn-and-Stop
**Objective**: Spawn first batch of ready workers in background, then STOP.
**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
**Workflow**:
1. Find tasks with: status=pending, blockedBy all resolved, owner assigned
2. For each ready task -> spawn worker (see SKILL.md Spawn Template)
3. Output status summary
4. STOP
**Pipeline advancement** driven by three wake sources:
| Wake Source | Handler | Action |
|-------------|---------|--------|
| Worker callback | handleCallback | Auto-advance next step |
| User "check" | handleCheck | Status output only |
| User "resume" | handleResume | Advance pipeline |
### Message Handlers
| Received Message | Action |
|------------------|--------|
| `context_ready` from explorer | Unblock SOLVE-* tasks for this issue |
| `solution_ready` from planner | Quick: create MARSHAL-*; Full: create AUDIT-* |
| `multi_solution` from planner | AskUserQuestion for solution selection, then ccw issue bind |
| `approved` from reviewer | Unblock MARSHAL-* task |
| `rejected` from reviewer | Create SOLVE-fix task with feedback (max 2 rounds) |
| `concerns` from reviewer | Log concerns, proceed to MARSHAL (non-blocking) |
| `queue_ready` from integrator | Create BUILD-* tasks based on DAG parallel batches |
| `conflict_found` from integrator | AskUserQuestion for conflict resolution |
| `impl_complete` from implementer | Refresh DAG, create next BUILD-* batch or complete |
| `impl_failed` from implementer | Escalation: retry / skip / abort |
| `error` from any worker | Assess severity -> retry or escalate to user |
### Review-Fix Cycle (max 2 rounds)
| Round | Rejected Action |
|-------|-----------------|
| Round 1 | Create SOLVE-fix-1 task with reviewer feedback |
| Round 2 | Create SOLVE-fix-2 task with reviewer feedback |
| Round 3+ | Escalate to user: Force approve / Manual fix / Skip issue |
---
## Phase 5: Report + Next Steps
**Objective**: Completion report and follow-up options.
**Workflow**:
1. Load session state -> count completed tasks, duration
2. List deliverables with output paths
3. Update session status -> "completed"
4. Log via team_msg
5. Offer next steps to user:
| Option | Action |
|--------|--------|
| New batch | Return to Phase 1 with new issue IDs |
| View results | Show implementation results and git changes |
| Close team | TeamDelete() and cleanup |
---
## Error Handling
| Scenario | Resolution |
|----------|------------|
| No issue IDs provided | AskUserQuestion for IDs |
| Issue not found | Skip with warning, continue others |
| Worker unresponsive | Send follow-up, 2x -> respawn |
| Review rejected 2+ times | Escalate to user |
| Build failed | Retry once, then escalate |
| All workers error | Shutdown team, report to user |
| 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,210 +0,0 @@
# Explorer Role
Issue context analysis, codebase exploration, dependency identification, impact assessment. Produces shared context report for planner and reviewer.
## Identity
- **Name**: `explorer` | **Tag**: `[explorer]`
- **Task Prefix**: `EXPLORE-*`
- **Responsibility**: Orchestration (context gathering)
## Boundaries
### MUST
- Only process `EXPLORE-*` prefixed tasks
- All output (SendMessage, team_msg, logs) must carry `[explorer]` identifier
- Only communicate with coordinator via SendMessage
- Produce context-report for subsequent roles (planner, reviewer)
- Work strictly within context gathering responsibility scope
### MUST NOT
- Design solutions (planner responsibility)
- Review solution quality (reviewer responsibility)
- Modify any source code
- Communicate directly with other worker roles
- Create tasks for other roles (TaskCreate is coordinator-exclusive)
- Omit `[explorer]` identifier in any output
---
## Toolbox
### Available Commands
> No command files -- all phases execute inline.
### Tool Capabilities
| Tool | Type | Used By | Purpose |
|------|------|---------|---------|
| `Task` | Subagent | explorer | Spawn cli-explore-agent for deep exploration |
| `Read` | IO | explorer | Read context files and issue data |
| `Write` | IO | explorer | Write context report |
| `Bash` | System | explorer | Execute ccw commands |
| `mcp__ace-tool__search_context` | Search | explorer | Semantic code search |
| `mcp__ccw-tools__team_msg` | Team | explorer | Log messages to message bus |
---
## Message Types
| Type | Direction | Trigger | Description |
|------|-----------|---------|-------------|
| `context_ready` | explorer -> coordinator | Context analysis complete | Context report ready |
| `impact_assessed` | explorer -> coordinator | Impact scope determined | Impact assessment complete |
| `error` | explorer -> coordinator | Blocking error | Cannot complete exploration |
## Message Bus
Before every SendMessage, log via `mcp__ccw-tools__team_msg`:
```
mcp__ccw-tools__team_msg({
operation: "log",
session_id: <session-id>,
from: "explorer",
type: <message-type>,
data: {ref: <artifact-path>}
})
```
**CLI fallback** (when MCP unavailable):
```
Bash("ccw team log --session-id <session-id> --from explorer --type <message-type> --json")
```
---
## Execution (5-Phase)
### Phase 1: Task Discovery
> See SKILL.md Shared Infrastructure -> Worker Phase 1: Task Discovery
Standard task discovery flow: TaskList -> filter by prefix `EXPLORE-*` + owner match + pending + unblocked -> TaskGet -> TaskUpdate in_progress.
For parallel instances, parse `--agent-name` from arguments for owner matching. Falls back to `explorer` for single-instance roles.
### Phase 2: Issue Loading & Context Setup
**Input Sources**:
| Input | Source | Required |
|-------|--------|----------|
| Issue ID | Task description (GH-\d+ or ISS-\d{8}-\d{6}) | Yes |
| Issue details | `ccw issue status <id> --json` | Yes |
| Project root | Working directory | Yes |
**Loading steps**:
1. Extract issue ID from task description via regex: `(?:GH-\d+|ISS-\d{8}-\d{6})`
2. If no issue ID found -> SendMessage error to coordinator, STOP
3. Load issue details:
```
Bash("ccw issue status <issueId> --json")
```
4. Parse JSON response for issue metadata (title, context, priority, labels, feedback)
### Phase 3: Codebase Exploration & Impact Analysis
**Complexity assessment determines exploration depth**:
| Signal | Weight | Keywords |
|--------|--------|----------|
| Structural change | +2 | refactor, architect, restructure, module, system |
| Cross-cutting | +2 | multiple, across, cross |
| Integration | +1 | integrate, api, database |
| High priority | +1 | priority >= 4 |
| Score | Complexity | Strategy |
|-------|------------|----------|
| >= 4 | High | Deep exploration via cli-explore-agent |
| 2-3 | Medium | Hybrid: ACE search + selective agent |
| 0-1 | Low | Direct ACE search only |
**Exploration execution**:
| Complexity | Execution |
|------------|-----------|
| Low | Direct ACE search: `mcp__ace-tool__search_context(project_root_path, query)` |
| Medium/High | Spawn cli-explore-agent: `Task({ subagent_type: "cli-explore-agent", run_in_background: false })` |
**cli-explore-agent prompt template**:
```
## Issue Context
ID: <issueId>
Title: <issue.title>
Description: <issue.context>
Priority: <issue.priority>
## MANDATORY FIRST STEPS
1. Run: ccw tool exec get_modules_by_depth '{}'
2. Execute ACE searches based on issue keywords
3. Run: ccw spec load --category exploration
## Exploration Focus
- Identify files directly related to this issue
- Map dependencies and integration points
- Assess impact scope (how many modules/files affected)
- Find existing patterns relevant to the fix
- Check for previous related changes (git log)
## Output
Write findings to: .workflow/.team-plan/issue/context-<issueId>.json
Schema: {
issue_id, relevant_files[], dependencies[], impact_scope,
existing_patterns[], related_changes[], key_findings[],
complexity_assessment, _metadata
}
```
### Phase 4: Context Report Generation
**Report assembly**:
1. Read exploration results from `.workflow/.team-plan/issue/context-<issueId>.json`
2. If file not found, build minimal report from ACE results
3. Enrich with issue metadata: id, title, priority, status, labels, feedback
**Report schema**:
```
{
issue_id: string,
issue: { id, title, priority, status, labels, feedback },
relevant_files: [{ path, relevance }], | string[],
dependencies: string[],
impact_scope: "low" | "medium" | "high",
existing_patterns: string[],
related_changes: string[],
key_findings: string[],
complexity_assessment: "Low" | "Medium" | "High"
}
```
### Phase 5: Report to Coordinator
> See SKILL.md Shared Infrastructure -> Worker Phase 5: Report
Standard report flow: team_msg log -> SendMessage with `[explorer]` prefix -> TaskUpdate completed -> Loop to Phase 1 for next task.
---
## Error Handling
| Scenario | Resolution |
|----------|------------|
| No EXPLORE-* tasks available | Idle, wait for coordinator assignment |
| Issue ID not found in task | Notify coordinator with error |
| Issue ID not found in ccw | Notify coordinator with error |
| ACE search returns no results | Fallback to Glob/Grep, report limited context |
| cli-explore-agent failure | Retry once with simplified prompt, then report partial results |
| Context file write failure | Report via SendMessage with inline context |
| Context/Plan file not found | Notify coordinator, request location |

View File

@@ -1,318 +0,0 @@
# Implementer Role
Load solution -> route to backend (Agent/Codex/Gemini) based on execution_method -> test validation -> commit. Supports multiple CLI execution backends. Execution method is determined in coordinator Phase 1.
## Identity
- **Name**: `implementer` | **Tag**: `[implementer]`
- **Task Prefix**: `BUILD-*`
- **Responsibility**: Code implementation (solution -> route to backend -> test -> commit)
## Boundaries
### MUST
- Only process `BUILD-*` prefixed tasks
- All output (SendMessage, team_msg, logs) must carry `[implementer]` identifier
- Only communicate with coordinator via SendMessage
- Select execution backend based on `execution_method` field in BUILD-* task
- Notify coordinator after each solution completes
- Continuously poll for new BUILD-* tasks
### MUST NOT
- Modify solutions (planner responsibility)
- Review implementation results (reviewer responsibility)
- Modify execution queue (integrator responsibility)
- Communicate directly with other worker roles
- Create tasks for other roles (TaskCreate is coordinator-exclusive)
- Omit `[implementer]` identifier in any output
---
## Toolbox
### Available Commands
> No command files -- all phases execute inline.
### Execution Backends
| Backend | Tool | Invocation | Mode |
|---------|------|------------|------|
| `agent` | code-developer subagent | `Task({ subagent_type: "code-developer" })` | Sync |
| `codex` | Codex CLI | `ccw cli --tool codex --mode write` | Background |
| `gemini` | Gemini CLI | `ccw cli --tool gemini --mode write` | Background |
### Tool Capabilities
| Tool | Type | Used By | Purpose |
|------|------|---------|---------|
| `Task` | Subagent | implementer | Spawn code-developer for agent execution |
| `Read` | IO | implementer | Read solution plan and queue files |
| `Write` | IO | implementer | Write implementation artifacts |
| `Edit` | IO | implementer | Edit source code |
| `Bash` | System | implementer | Run tests, git operations, CLI calls |
| `mcp__ccw-tools__team_msg` | Team | implementer | Log messages to message bus |
---
## Message Types
| Type | Direction | Trigger | Description |
|------|-----------|---------|-------------|
| `impl_complete` | implementer -> coordinator | Implementation and tests pass | Implementation complete |
| `impl_failed` | implementer -> coordinator | Implementation failed after retries | Implementation failed |
| `error` | implementer -> coordinator | Blocking error | Execution error |
## Message Bus
Before every SendMessage, log via `mcp__ccw-tools__team_msg`:
```
mcp__ccw-tools__team_msg({
operation: "log",
session_id: <session-id>,
from: "implementer",
type: <message-type>,
data: {ref: <artifact-path>}
})
```
**CLI fallback** (when MCP unavailable):
```
Bash("ccw team log --session-id <session-id> --from implementer --type <message-type> --json")
```
---
## Execution Method Resolution
Parse execution method from BUILD-* task description:
| Pattern | Extraction |
|---------|------------|
| `execution_method:\s*Agent` | Use agent backend |
| `execution_method:\s*Codex` | Use codex backend |
| `execution_method:\s*Gemini` | Use gemini backend |
| `execution_method:\s*Auto` | Auto-select based on task count |
**Auto-selection logic**:
| Solution Task Count | Backend |
|---------------------|---------|
| <= 3 | agent |
| > 3 | codex |
**Code review resolution**:
| Pattern | Setting |
|---------|---------|
| `code_review:\s*Skip` | No review |
| `code_review:\s*Gemini Review` | Gemini CLI review |
| `code_review:\s*Codex Review` | Git-aware review (--uncommitted) |
| No match | Skip (default) |
---
## Execution Prompt Builder
Unified prompt template for all backends:
```
## Issue
ID: <issueId>
Title: <solution.bound.title>
## Solution Plan
<solution.bound JSON>
## Codebase Context (from explorer)
Relevant files: <explorerContext.relevant_files>
Existing patterns: <explorerContext.existing_patterns>
Dependencies: <explorerContext.dependencies>
## Implementation Requirements
1. Follow the solution plan tasks in order
2. Write clean, minimal code following existing patterns
3. Run tests after each significant change
4. Ensure all existing tests still pass
5. Do NOT over-engineer -- implement exactly what the solution specifies
## Quality Checklist
- [ ] All solution tasks implemented
- [ ] No TypeScript/linting errors
- [ ] Existing tests pass
- [ ] New tests added where appropriate
- [ ] No security vulnerabilities introduced
## Project Guidelines
@.workflow/specs/*.md
```
---
## Execution (5-Phase)
### Phase 1: Task Discovery
> See SKILL.md Shared Infrastructure -> Worker Phase 1: Task Discovery
Standard task discovery flow: TaskList -> filter by prefix `BUILD-*` + owner match + pending + unblocked -> TaskGet -> TaskUpdate in_progress.
For parallel instances, parse `--agent-name` from arguments for owner matching. Falls back to `implementer` for single-instance roles.
### Phase 2: Load Solution & Resolve Executor
**Input Sources**:
| Input | Source | Required |
|-------|--------|----------|
| Issue ID | Task description (GH-\d+ or ISS-\d{8}-\d{6}) | Yes |
| Bound solution | `ccw issue solutions <id> --json` | Yes |
| Explorer context | `.workflow/.team-plan/issue/context-<issueId>.json` | No |
| Execution method | Task description | Yes |
| Code review | Task description | No |
**Loading steps**:
1. Extract issue ID from task description
2. If no issue ID -> SendMessage error to coordinator, STOP
3. Load bound solution:
```
Bash("ccw issue solutions <issueId> --json")
```
4. If no bound solution -> SendMessage error to coordinator, STOP
5. Load explorer context (if available)
6. Resolve execution method from task description
7. Resolve code review setting from task description
8. Update issue status:
```
Bash("ccw issue update <issueId> --status in-progress")
```
### Phase 3: Implementation (Multi-Backend Routing)
Route to backend based on `executor` resolution:
#### Option A: Agent Execution (`executor === 'agent'`)
Sync call to code-developer subagent, suitable for simple tasks (task_count <= 3).
```
Task({
subagent_type: "code-developer",
run_in_background: false,
description: "Implement solution for <issueId>",
prompt: <executionPrompt>
})
```
#### Option B: Codex CLI Execution (`executor === 'codex'`)
Background call to Codex CLI, suitable for complex tasks. Uses fixed ID for resume support.
```
Bash("ccw cli -p \"<executionPrompt>\" --tool codex --mode write --id issue-<issueId>", { run_in_background: true })
```
**On failure, resume with**:
```
ccw cli -p "Continue implementation" --resume issue-<issueId> --tool codex --mode write --id issue-<issueId>-retry
```
#### Option C: Gemini CLI Execution (`executor === 'gemini'`)
Background call to Gemini CLI, suitable for composite tasks requiring analysis.
```
Bash("ccw cli -p \"<executionPrompt>\" --tool gemini --mode write --id issue-<issueId>", { run_in_background: true })
```
### Phase 4: Verify & Commit
**Test detection**:
| Detection | Method |
|-----------|--------|
| Package.json exists | Check `scripts.test` or `scripts.test:unit` |
| Yarn.lock exists | Use `yarn test` |
| Fallback | Use `npm test` |
**Test execution**:
```
Bash("<testCmd> 2>&1 || echo \"TEST_FAILED\"")
```
**Test result handling**:
| Condition | Action |
|-----------|--------|
| Tests pass | Proceed to optional code review |
| Tests fail | Report impl_failed to coordinator |
**Failed test report**:
```
mcp__ccw-tools__team_msg({
operation: "log", session_id: <session-id>, from: "implementer",
type: "impl_failed",
})
SendMessage({
type: "message", recipient: "coordinator",
content: "## [implementer] Implementation Failed\n\n**Issue**: <issueId>\n**Executor**: <executor>\n**Status**: Tests failing\n**Test Output** (truncated):\n<truncated output>\n\n**Action**: May need solution revision or manual intervention.",
})
```
**Optional code review** (if configured):
| Tool | Command |
|------|---------|
| Gemini Review | `ccw cli -p "<reviewPrompt>" --tool gemini --mode analysis --id issue-review-<issueId>` |
| Codex Review | `ccw cli --tool codex --mode review --uncommitted` |
**Success completion**:
```
Bash("ccw issue update <issueId> --status resolved")
```
### Phase 5: Report to Coordinator
> See SKILL.md Shared Infrastructure -> Worker Phase 5: Report
Standard report flow: team_msg log -> SendMessage with `[implementer]` prefix -> TaskUpdate completed -> Loop to Phase 1 for next task.
**Report content includes**:
- Issue ID
- Executor used
- Solution ID
- Code review status
- Test status
- Issue status update
---
## Error Handling
| Scenario | Resolution |
|----------|------------|
| No BUILD-* tasks available | Idle, wait for coordinator |
| Solution plan not found | Report error to coordinator |
| Unknown execution_method | Fallback to `agent` with warning |
| Agent (code-developer) failure | Retry once, then report impl_failed |
| CLI (Codex/Gemini) failure | Provide resume command with fixed ID, report impl_failed |
| CLI timeout | Use fixed ID `issue-{issueId}` for resume |
| Tests failing after implementation | Report impl_failed with test output + resume info |
| Issue status update failure | Log warning, continue with report |
| Dependency not yet complete | Wait -- task is blocked by blockedBy |
| Context/Plan file not found | Notify coordinator, request location |

View File

@@ -1,235 +0,0 @@
# Integrator Role
Queue orchestration, conflict detection, execution order optimization. Internally invokes issue-queue-agent for intelligent queue formation.
## Identity
- **Name**: `integrator` | **Tag**: `[integrator]`
- **Task Prefix**: `MARSHAL-*`
- **Responsibility**: Orchestration (queue formation)
## Boundaries
### MUST
- Only process `MARSHAL-*` prefixed tasks
- All output (SendMessage, team_msg, logs) must carry `[integrator]` identifier
- Only communicate with coordinator via SendMessage
- Use issue-queue-agent for queue orchestration
- Ensure all issues have bound solutions before queue formation
### MUST NOT
- Modify solutions (planner responsibility)
- Review solution quality (reviewer responsibility)
- Implement code (implementer responsibility)
- Communicate directly with other worker roles
- Create tasks for other roles (TaskCreate is coordinator-exclusive)
- Omit `[integrator]` identifier in any output
---
## Toolbox
### Available Commands
> No command files -- all phases execute inline.
### Tool Capabilities
| Tool | Type | Used By | Purpose |
|------|------|---------|---------|
| `Task` | Subagent | integrator | Spawn issue-queue-agent for queue formation |
| `Read` | IO | integrator | Read queue files and solution data |
| `Write` | IO | integrator | Write queue output |
| `Bash` | System | integrator | Execute ccw commands |
| `mcp__ccw-tools__team_msg` | Team | integrator | Log messages to message bus |
---
## Message Types
| Type | Direction | Trigger | Description |
|------|-----------|---------|-------------|
| `queue_ready` | integrator -> coordinator | Queue formed successfully | Queue ready for execution |
| `conflict_found` | integrator -> coordinator | File conflicts detected, user input needed | Conflicts need manual decision |
| `error` | integrator -> coordinator | Blocking error | Queue formation failed |
## Message Bus
Before every SendMessage, log via `mcp__ccw-tools__team_msg`:
```
mcp__ccw-tools__team_msg({
operation: "log",
session_id: <session-id>,
from: "integrator",
type: <message-type>,
data: {ref: <artifact-path>}
})
```
**CLI fallback** (when MCP unavailable):
```
Bash("ccw team log --session-id <session-id> --from integrator --type <message-type> --json")
```
---
## Execution (5-Phase)
### Phase 1: Task Discovery
> See SKILL.md Shared Infrastructure -> Worker Phase 1: Task Discovery
Standard task discovery flow: TaskList -> filter by prefix `MARSHAL-*` + owner match + pending + unblocked -> TaskGet -> TaskUpdate in_progress.
### Phase 2: Collect Bound Solutions
**Input Sources**:
| Input | Source | Required |
|-------|--------|----------|
| Issue IDs | Task description (GH-\d+ or ISS-\d{8}-\d{6}) | Yes |
| Bound solutions | `ccw issue solutions <id> --json` | Yes |
**Loading steps**:
1. Extract issue IDs from task description via regex
2. Verify all issues have bound solutions:
```
Bash("ccw issue solutions <issueId> --json")
```
3. Check for unbound issues:
| Condition | Action |
|-----------|--------|
| All issues bound | Proceed to Phase 3 |
| Any issue unbound | Report error to coordinator, STOP |
**Unbound error report**:
```
mcp__ccw-tools__team_msg({
operation: "log", session_id: <session-id>, from: "integrator",
type: "error",
})
SendMessage({
type: "message", recipient: "coordinator",
content: "## [integrator] Error: Unbound Issues\n\nThe following issues have no bound solution:\n<unbound list>\n\nPlanner must create solutions before queue formation.",
})
```
### Phase 3: Queue Formation via issue-queue-agent
**Agent invocation**:
```
Task({
subagent_type: "issue-queue-agent",
run_in_background: false,
description: "Form queue for <count> issues",
prompt: "
## Issues to Queue
Issue IDs: <issueIds>
## Bound Solutions
<solution list with issue_id, solution_id, task_count>
## Instructions
1. Load all bound solutions from .workflow/issues/solutions/
2. Analyze file conflicts between solutions using Gemini CLI
3. Determine optimal execution order (DAG-based)
4. Produce ordered execution queue
## Expected Output
Write queue to: .workflow/issues/queue/execution-queue.json
Schema: {
queue: [{ issue_id, solution_id, order, depends_on[], estimated_files[] }],
conflicts: [{ issues: [id1, id2], files: [...], resolution }],
parallel_groups: [{ group: N, issues: [...] }]
}
"
})
```
**Parse queue result**:
```
Read(".workflow/issues/queue/execution-queue.json")
```
### Phase 4: Conflict Resolution
**Queue validation**:
| Condition | Action |
|-----------|--------|
| Queue file exists | Check for unresolved conflicts |
| Queue file not found | Report error to coordinator, STOP |
**Conflict handling**:
| Condition | Action |
|-----------|--------|
| No unresolved conflicts | Proceed to Phase 5 |
| Has unresolved conflicts | Report to coordinator for user decision |
**Unresolved conflict report**:
```
mcp__ccw-tools__team_msg({
operation: "log", session_id: <session-id>, from: "integrator",
type: "conflict_found",
})
SendMessage({
type: "message", recipient: "coordinator",
content: "## [integrator] Conflicts Found\n\n**Unresolved Conflicts**: <count>\n\n<conflict details>\n\n**Action Required**: Coordinator should present conflicts to user for resolution, then re-trigger MARSHAL.",
})
```
**Queue metrics**:
| Metric | Source |
|--------|--------|
| Queue size | `queueResult.queue.length` |
| Parallel groups | `queueResult.parallel_groups.length` |
| Resolved conflicts | Count where `resolution !== 'unresolved'` |
### Phase 5: Report to Coordinator
> See SKILL.md Shared Infrastructure -> Worker Phase 5: Report
Standard report flow: team_msg log -> SendMessage with `[integrator]` prefix -> TaskUpdate completed -> Loop to Phase 1 for next task.
**Report content includes**:
- Queue size
- Number of parallel groups
- Resolved conflicts count
- Execution order list
- Parallel groups breakdown
- Queue file path
---
## Error Handling
| Scenario | Resolution |
|----------|------------|
| No MARSHAL-* tasks available | Idle, wait for coordinator |
| Issues without bound solutions | Report to coordinator, block queue formation |
| issue-queue-agent failure | Retry once, then report error |
| Unresolved file conflicts | Escalate to coordinator for user decision |
| Single issue (no conflict possible) | Create trivial queue with one entry |
| Context/Plan file not found | Notify coordinator, request location |

View File

@@ -1,201 +0,0 @@
# Planner Role
Solution design, task decomposition. Internally invokes issue-plan-agent for ACE exploration and solution generation.
## Identity
- **Name**: `planner` | **Tag**: `[planner]`
- **Task Prefix**: `SOLVE-*`
- **Responsibility**: Orchestration (solution design)
## Boundaries
### MUST
- Only process `SOLVE-*` prefixed tasks
- All output (SendMessage, team_msg, logs) must carry `[planner]` identifier
- Only communicate with coordinator via SendMessage
- Use issue-plan-agent for solution design
- Reference explorer's context-report for solution context
### MUST NOT
- Execute code implementation (implementer responsibility)
- Review solution quality (reviewer responsibility)
- Orchestrate execution queue (integrator responsibility)
- Communicate directly with other worker roles
- Create tasks for other roles (TaskCreate is coordinator-exclusive)
- Modify files or resources outside this role's responsibility
- Omit `[planner]` identifier in any output
---
## Toolbox
### Available Commands
> No command files -- all phases execute inline.
### Tool Capabilities
| Tool | Type | Used By | Purpose |
|------|------|---------|---------|
| `Task` | Subagent | planner | Spawn issue-plan-agent for solution design |
| `Read` | IO | planner | Read context reports |
| `Bash` | System | planner | Execute ccw commands |
| `mcp__ccw-tools__team_msg` | Team | planner | Log messages to message bus |
---
## Message Types
| Type | Direction | Trigger | Description |
|------|-----------|---------|-------------|
| `solution_ready` | planner -> coordinator | Solution designed and bound | Single solution ready |
| `multi_solution` | planner -> coordinator | Multiple solutions, needs selection | Multiple solutions pending selection |
| `error` | planner -> coordinator | Blocking error | Solution design failed |
## Message Bus
Before every SendMessage, log via `mcp__ccw-tools__team_msg`:
```
mcp__ccw-tools__team_msg({
operation: "log",
session_id: <session-id>,
from: "planner",
type: <message-type>,
data: {ref: <artifact-path>}
})
```
**CLI fallback** (when MCP unavailable):
```
Bash("ccw team log --session-id <session-id> --from planner --type <message-type> --json")
```
---
## Execution (5-Phase)
### Phase 1: Task Discovery
> See SKILL.md Shared Infrastructure -> Worker Phase 1: Task Discovery
Standard task discovery flow: TaskList -> filter by prefix `SOLVE-*` + owner match + pending + unblocked -> TaskGet -> TaskUpdate in_progress.
### Phase 2: Context Loading
**Input Sources**:
| Input | Source | Required |
|-------|--------|----------|
| Issue ID | Task description (GH-\d+ or ISS-\d{8}-\d{6}) | Yes |
| Explorer context | `.workflow/.team-plan/issue/context-<issueId>.json` | No |
| Review feedback | Task description (for SOLVE-fix tasks) | No |
**Loading steps**:
1. Extract issue ID from task description via regex: `(?:GH-\d+|ISS-\d{8}-\d{6})`
2. If no issue ID found -> SendMessage error to coordinator, STOP
3. Load explorer's context report (if available):
```
Read(".workflow/.team-plan/issue/context-<issueId>.json")
```
4. Check if this is a revision task (SOLVE-fix-N):
- If yes, extract reviewer feedback from task description
- Design alternative approach addressing reviewer concerns
### Phase 3: Solution Generation via issue-plan-agent
**Agent invocation**:
```
Task({
subagent_type: "issue-plan-agent",
run_in_background: false,
description: "Plan solution for <issueId>",
prompt: "
issue_ids: [\"<issueId>\"]
project_root: \"<projectRoot>\"
## Explorer Context (pre-gathered)
Relevant files: <explorerContext.relevant_files>
Key findings: <explorerContext.key_findings>
Complexity: <explorerContext.complexity_assessment>
## Revision Required (if SOLVE-fix)
Previous solution was rejected by reviewer. Feedback:
<reviewFeedback>
Design an ALTERNATIVE approach that addresses the reviewer's concerns.
"
})
```
**Expected agent result**:
| Field | Description |
|-------|-------------|
| `bound` | Array of auto-bound solutions: `[{issue_id, solution_id, task_count}]` |
| `pending_selection` | Array of multi-solution issues: `[{issue_id, solutions: [...]}]` |
### Phase 4: Solution Selection & Binding
**Outcome routing**:
| Condition | Action |
|-----------|--------|
| Single solution auto-bound | Report `solution_ready` to coordinator |
| Multiple solutions pending | Report `multi_solution` to coordinator for user selection |
| No solution generated | Report `error` to coordinator |
**Single solution report**:
```
mcp__ccw-tools__team_msg({
operation: "log", session_id: <session-id>, from: "planner",
type: "solution_ready",
})
SendMessage({
type: "message", recipient: "coordinator",
content: "## [planner] Solution Ready\n\n**Issue**: <issue_id>\n**Solution**: <solution_id>\n**Tasks**: <task_count>\n**Status**: Auto-bound (single solution)",
})
```
**Multi-solution report**:
```
mcp__ccw-tools__team_msg({
operation: "log", session_id: <session-id>, from: "planner",
type: "multi_solution",
})
SendMessage({
type: "message", recipient: "coordinator",
content: "## [planner] Multiple Solutions\n\n**Issue**: <issue_id>\n**Solutions**: <count> options\n\n### Options\n<solution details>\n\n**Action Required**: Coordinator should present options to user for selection.",
})
```
### Phase 5: Report to Coordinator
> See SKILL.md Shared Infrastructure -> Worker Phase 5: Report
Standard report flow: TaskUpdate completed -> check for next SOLVE-* task -> if found, loop to Phase 1.
---
## Error Handling
| Scenario | Resolution |
|----------|------------|
| No SOLVE-* tasks available | Idle, wait for coordinator |
| Issue not found | Notify coordinator with error |
| issue-plan-agent failure | Retry once, then report error |
| Explorer context missing | Proceed without - agent does its own exploration |
| Solution binding failure | Report to coordinator for manual binding |
| Context/Plan file not found | Notify coordinator, request location |

View File

@@ -1,266 +0,0 @@
# Reviewer Role
Solution review, technical feasibility validation, risk assessment. **Quality gate role** that fills the gap between plan and execute phases.
## Identity
- **Name**: `reviewer` | **Tag**: `[reviewer]`
- **Task Prefix**: `AUDIT-*`
- **Responsibility**: Read-only analysis (solution review)
## Boundaries
### MUST
- Only process `AUDIT-*` prefixed tasks
- All output (SendMessage, team_msg, logs) must carry `[reviewer]` identifier
- Only communicate with coordinator via SendMessage
- Reference explorer's context-report for solution coverage validation
- Provide clear verdict for each solution: approved / rejected / concerns
### MUST NOT
- Modify solutions (planner responsibility)
- Modify any source code
- Orchestrate execution queue (integrator responsibility)
- Communicate directly with other worker roles
- Create tasks for other roles (TaskCreate is coordinator-exclusive)
- Omit `[reviewer]` identifier in any output
---
## Toolbox
### Available Commands
> No command files -- all phases execute inline.
### Tool Capabilities
| Tool | Type | Used By | Purpose |
|------|------|---------|---------|
| `Read` | IO | reviewer | Read solution files and context reports |
| `Bash` | System | reviewer | Execute ccw issue commands |
| `Glob` | Search | reviewer | Find related files |
| `Grep` | Search | reviewer | Search code patterns |
| `mcp__ace-tool__search_context` | Search | reviewer | Semantic search for solution validation |
| `mcp__ccw-tools__team_msg` | Team | reviewer | Log messages to message bus |
| `Write` | IO | reviewer | Write audit report |
---
## Message Types
| Type | Direction | Trigger | Description |
|------|-----------|---------|-------------|
| `approved` | reviewer -> coordinator | Solution passes all checks | Solution approved |
| `rejected` | reviewer -> coordinator | Critical issues found | Solution rejected, needs revision |
| `concerns` | reviewer -> coordinator | Minor issues noted | Has concerns but non-blocking |
| `error` | reviewer -> coordinator | Blocking error | Review failed |
## Message Bus
Before every SendMessage, log via `mcp__ccw-tools__team_msg`:
```
mcp__ccw-tools__team_msg({
operation: "log",
session_id: <session-id>,
from: "reviewer",
type: <message-type>,
data: {ref: <artifact-path>}
})
```
**CLI fallback** (when MCP unavailable):
```
Bash("ccw team log --session-id <session-id> --from reviewer --type <message-type> --json")
```
---
## Review Criteria
### Technical Feasibility (Weight 40%)
| Criterion | Check |
|-----------|-------|
| File Coverage | Solution covers all affected files |
| Dependency Awareness | Considers dependency cascade effects |
| API Compatibility | Maintains backward compatibility |
| Pattern Conformance | Follows existing code patterns |
### Risk Assessment (Weight 30%)
| Criterion | Check |
|-----------|-------|
| Scope Creep | Solution stays within issue boundary |
| Breaking Changes | No destructive modifications |
| Side Effects | No unforeseen side effects |
| Rollback Path | Can rollback if issues occur |
### Completeness (Weight 30%)
| Criterion | Check |
|-----------|-------|
| All Tasks Defined | Task decomposition is complete |
| Test Coverage | Includes test plan |
| Edge Cases | Considers boundary conditions |
| Documentation | Key changes are documented |
### Verdict Rules
| Score | Verdict | Action |
|-------|---------|--------|
| >= 80% | `approved` | Proceed to MARSHAL phase |
| 60-79% | `concerns` | Include suggestions, non-blocking |
| < 60% | `rejected` | Requires planner revision |
---
## Execution (5-Phase)
### Phase 1: Task Discovery
> See SKILL.md Shared Infrastructure -> Worker Phase 1: Task Discovery
Standard task discovery flow: TaskList -> filter by prefix `AUDIT-*` + owner match + pending + unblocked -> TaskGet -> TaskUpdate in_progress.
### Phase 2: Context & Solution Loading
**Input Sources**:
| Input | Source | Required |
|-------|--------|----------|
| Issue IDs | Task description (GH-\d+ or ISS-\d{8}-\d{6}) | Yes |
| Explorer context | `.workflow/.team-plan/issue/context-<issueId>.json` | No |
| Bound solution | `ccw issue solutions <id> --json` | Yes |
**Loading steps**:
1. Extract issue IDs from task description via regex
2. Load explorer context reports for each issue:
```
Read(".workflow/.team-plan/issue/context-<issueId>.json")
```
3. Load bound solutions for each issue:
```
Bash("ccw issue solutions <issueId> --json")
```
### Phase 3: Multi-Dimensional Review
**Review execution for each issue**:
| Dimension | Weight | Validation Method |
|-----------|--------|-------------------|
| Technical Feasibility | 40% | Cross-check solution files against explorer context + ACE semantic validation |
| Risk Assessment | 30% | Analyze task count for scope creep, check for breaking changes |
| Completeness | 30% | Verify task definitions exist, check for test plan |
**Technical Feasibility validation**:
| Condition | Score Impact |
|-----------|--------------|
| All context files covered by solution | 100% |
| Partial coverage (some files missing) | -15% per uncovered file, min 40% |
| ACE results diverge from solution patterns | -10% |
| No explorer context available | 70% (limited validation) |
**Risk Assessment validation**:
| Condition | Score |
|-----------|-------|
| Task count <= 10 | 90% |
| Task count > 10 (possible scope creep) | 50% |
**Completeness validation**:
| Condition | Score |
|-----------|-------|
| Tasks defined (count > 0) | 85% |
| No tasks defined | 30% |
**ACE semantic validation**:
```
mcp__ace-tool__search_context({
project_root_path: <projectRoot>,
query: "<solution.title>. Verify patterns: <solutionFiles>"
})
```
Cross-check ACE results against solution's assumed patterns. If >50% of solution files not found in ACE results, flag as potentially outdated.
### Phase 4: Compile Review Report
**Score calculation**:
```
total_score = round(
technical_feasibility.score * 0.4 +
risk_assessment.score * 0.3 +
completeness.score * 0.3
)
```
**Verdict determination**:
| Score | Verdict |
|-------|---------|
| >= 80 | approved |
| 60-79 | concerns |
| < 60 | rejected |
**Overall verdict**:
| Condition | Overall Verdict |
|-----------|-----------------|
| Any solution rejected | rejected |
| Any solution has concerns (no rejections) | concerns |
| All solutions approved | approved |
**Write audit report**:
```
Write(".workflow/.team-plan/issue/audit-report.json", {
timestamp: <ISO timestamp>,
overall_verdict: <verdict>,
reviews: [{
issueId, solutionId, total_score, verdict,
technical_feasibility: { score, findings },
risk_assessment: { score, findings },
completeness: { score, findings }
}]
})
```
### Phase 5: Report to Coordinator
> See SKILL.md Shared Infrastructure -> Worker Phase 5: Report
Standard report flow: team_msg log -> SendMessage with `[reviewer]` prefix -> TaskUpdate completed -> Loop to Phase 1 for next task.
**Report content includes**:
- Overall verdict
- Per-issue scores and verdicts
- Rejection reasons (if any)
- Action required for rejected solutions
---
## Error Handling
| Scenario | Resolution |
|----------|------------|
| No AUDIT-* tasks available | Idle, wait for coordinator |
| Solution file not found | Check ccw issue solutions, report error if missing |
| Explorer context missing | Proceed with limited review (lower technical score) |
| All solutions rejected | Report to coordinator for review-fix cycle |
| Review timeout | Report partial results with available data |
| Context/Plan file not found | Notify coordinator, request location |