maestro-flow 0.2.1 → 0.2.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (141) hide show
  1. package/.claude/agents/team-supervisor.md +18 -8
  2. package/.claude/agents/team-worker.md +78 -0
  3. package/.claude/skills/team-coordinate/SKILL.md +266 -0
  4. package/.claude/skills/team-coordinate/roles/coordinator/commands/analyze-task.md +247 -0
  5. package/.claude/skills/team-coordinate/roles/coordinator/commands/dispatch.md +131 -0
  6. package/.claude/skills/team-coordinate/roles/coordinator/commands/monitor.md +358 -0
  7. package/.claude/skills/team-coordinate/roles/coordinator/role.md +363 -0
  8. package/.claude/skills/team-coordinate/specs/knowledge-transfer.md +111 -0
  9. package/.claude/skills/team-coordinate/specs/pipelines.md +97 -0
  10. package/.claude/skills/team-coordinate/specs/quality-gates.md +112 -0
  11. package/.claude/skills/team-coordinate/specs/role-spec-template.md +192 -0
  12. package/.claude/skills/team-executor/SKILL.md +189 -0
  13. package/.claude/skills/team-executor/roles/executor/commands/monitor.md +239 -0
  14. package/.claude/skills/team-executor/roles/executor/role.md +171 -0
  15. package/.claude/skills/team-executor/specs/session-schema.md +264 -0
  16. package/.claude/skills/team-lifecycle-v4/SKILL.md +209 -0
  17. package/.claude/skills/team-lifecycle-v4/roles/analyst/role.md +78 -0
  18. package/.claude/skills/team-lifecycle-v4/roles/coordinator/commands/analyze.md +56 -0
  19. package/.claude/skills/team-lifecycle-v4/roles/coordinator/commands/dispatch.md +56 -0
  20. package/.claude/skills/team-lifecycle-v4/roles/coordinator/commands/monitor.md +157 -0
  21. package/.claude/skills/team-lifecycle-v4/roles/coordinator/role.md +130 -0
  22. package/.claude/skills/team-lifecycle-v4/roles/executor/commands/fix.md +35 -0
  23. package/.claude/skills/team-lifecycle-v4/roles/executor/commands/implement.md +62 -0
  24. package/.claude/skills/team-lifecycle-v4/roles/executor/role.md +67 -0
  25. package/.claude/skills/team-lifecycle-v4/roles/planner/role.md +76 -0
  26. package/.claude/skills/team-lifecycle-v4/roles/reviewer/commands/review-code.md +34 -0
  27. package/.claude/skills/team-lifecycle-v4/roles/reviewer/commands/review-spec.md +44 -0
  28. package/.claude/skills/team-lifecycle-v4/roles/reviewer/role.md +69 -0
  29. package/.claude/skills/team-lifecycle-v4/roles/supervisor/role.md +192 -0
  30. package/.claude/skills/team-lifecycle-v4/roles/tester/role.md +87 -0
  31. package/.claude/skills/team-lifecycle-v4/roles/writer/role.md +95 -0
  32. package/.claude/skills/team-lifecycle-v4/specs/knowledge-transfer.md +112 -0
  33. package/.claude/skills/team-lifecycle-v4/specs/pipelines.md +125 -0
  34. package/.claude/skills/team-lifecycle-v4/specs/quality-gates.md +130 -0
  35. package/.claude/skills/team-lifecycle-v4/templates/architecture.md +254 -0
  36. package/.claude/skills/team-lifecycle-v4/templates/epics.md +196 -0
  37. package/.claude/skills/team-lifecycle-v4/templates/product-brief.md +133 -0
  38. package/.claude/skills/team-lifecycle-v4/templates/requirements.md +224 -0
  39. package/.claude/skills/team-quality-assurance/SKILL.md +147 -0
  40. package/.claude/skills/team-quality-assurance/roles/analyst/role.md +80 -0
  41. package/.claude/skills/team-quality-assurance/roles/coordinator/commands/analyze.md +72 -0
  42. package/.claude/skills/team-quality-assurance/roles/coordinator/commands/dispatch.md +111 -0
  43. package/.claude/skills/team-quality-assurance/roles/coordinator/commands/monitor.md +250 -0
  44. package/.claude/skills/team-quality-assurance/roles/coordinator/role.md +143 -0
  45. package/.claude/skills/team-quality-assurance/roles/executor/role.md +66 -0
  46. package/.claude/skills/team-quality-assurance/roles/generator/role.md +68 -0
  47. package/.claude/skills/team-quality-assurance/roles/scout/role.md +67 -0
  48. package/.claude/skills/team-quality-assurance/roles/strategist/role.md +71 -0
  49. package/.claude/skills/team-quality-assurance/specs/pipelines.md +115 -0
  50. package/.claude/skills/team-quality-assurance/specs/team-config.json +131 -0
  51. package/.claude/skills/team-review/SKILL.md +147 -0
  52. package/.claude/skills/team-review/roles/coordinator/commands/analyze.md +71 -0
  53. package/.claude/skills/team-review/roles/coordinator/commands/dispatch.md +91 -0
  54. package/.claude/skills/team-review/roles/coordinator/commands/monitor.md +224 -0
  55. package/.claude/skills/team-review/roles/coordinator/role.md +132 -0
  56. package/.claude/skills/team-review/roles/fixer/role.md +76 -0
  57. package/.claude/skills/team-review/roles/reviewer/role.md +68 -0
  58. package/.claude/skills/team-review/roles/scanner/role.md +71 -0
  59. package/.claude/skills/team-review/specs/dimensions.md +82 -0
  60. package/.claude/skills/team-review/specs/finding-schema.json +82 -0
  61. package/.claude/skills/team-review/specs/pipelines.md +102 -0
  62. package/.claude/skills/team-review/specs/team-config.json +27 -0
  63. package/.claude/skills/team-tech-debt/SKILL.md +128 -0
  64. package/.claude/skills/team-tech-debt/roles/assessor/role.md +69 -0
  65. package/.claude/skills/team-tech-debt/roles/coordinator/commands/analyze.md +47 -0
  66. package/.claude/skills/team-tech-debt/roles/coordinator/commands/dispatch.md +156 -0
  67. package/.claude/skills/team-tech-debt/roles/coordinator/commands/monitor.md +209 -0
  68. package/.claude/skills/team-tech-debt/roles/coordinator/role.md +123 -0
  69. package/.claude/skills/team-tech-debt/roles/executor/role.md +76 -0
  70. package/.claude/skills/team-tech-debt/roles/planner/role.md +69 -0
  71. package/.claude/skills/team-tech-debt/roles/scanner/role.md +82 -0
  72. package/.claude/skills/team-tech-debt/roles/validator/role.md +78 -0
  73. package/.claude/skills/team-tech-debt/specs/pipelines.md +47 -0
  74. package/.claude/skills/team-tech-debt/specs/team-config.json +129 -0
  75. package/.claude/skills/team-testing/SKILL.md +143 -0
  76. package/.claude/skills/team-testing/roles/analyst/role.md +95 -0
  77. package/.claude/skills/team-testing/roles/coordinator/commands/analyze.md +70 -0
  78. package/.claude/skills/team-testing/roles/coordinator/commands/dispatch.md +108 -0
  79. package/.claude/skills/team-testing/roles/coordinator/commands/monitor.md +257 -0
  80. package/.claude/skills/team-testing/roles/coordinator/role.md +134 -0
  81. package/.claude/skills/team-testing/roles/executor/role.md +99 -0
  82. package/.claude/skills/team-testing/roles/generator/role.md +98 -0
  83. package/.claude/skills/team-testing/roles/strategist/role.md +83 -0
  84. package/.claude/skills/team-testing/specs/pipelines.md +101 -0
  85. package/.claude/skills/team-testing/specs/team-config.json +93 -0
  86. package/.codex/skills/maestro-coordinate/SKILL.md +6 -6
  87. package/.codex/skills/maestro-overlay/SKILL.md +1 -3
  88. package/.codex/skills/manage-issue-analyze/SKILL.md +2 -2
  89. package/.codex/skills/quality-retrospective/SKILL.md +30 -31
  90. package/.codex/skills/team-coordinate/SKILL.md +16 -18
  91. package/.codex/skills/team-coordinate/roles/coordinator/commands/monitor.md +50 -7
  92. package/.codex/skills/team-coordinate/roles/coordinator/role.md +4 -4
  93. package/.codex/skills/team-coordinate/specs/knowledge-transfer.md +2 -0
  94. package/.codex/skills/team-executor/SKILL.md +11 -13
  95. package/.codex/skills/team-executor/roles/executor/commands/monitor.md +47 -11
  96. package/.codex/skills/team-lifecycle-v4/SKILL.md +27 -33
  97. package/.codex/skills/team-lifecycle-v4/instructions/agent-instruction.md +94 -0
  98. package/.codex/skills/team-lifecycle-v4/roles/coordinator/commands/dispatch.md +1 -1
  99. package/.codex/skills/team-lifecycle-v4/roles/coordinator/commands/monitor.md +94 -27
  100. package/.codex/skills/team-lifecycle-v4/roles/coordinator/role.md +12 -14
  101. package/.codex/skills/team-lifecycle-v4/roles/supervisor/role.md +1 -1
  102. package/.codex/skills/team-lifecycle-v4/specs/knowledge-transfer.md +69 -1
  103. package/.codex/skills/team-quality-assurance/SKILL.md +14 -16
  104. package/.codex/skills/team-quality-assurance/roles/coordinator/commands/monitor.md +60 -11
  105. package/.codex/skills/team-quality-assurance/roles/coordinator/role.md +4 -4
  106. package/.codex/skills/team-review/SKILL.md +14 -16
  107. package/.codex/skills/team-review/roles/coordinator/commands/monitor.md +47 -10
  108. package/.codex/skills/team-review/roles/coordinator/role.md +4 -4
  109. package/.codex/skills/team-tech-debt/SKILL.md +13 -15
  110. package/.codex/skills/team-tech-debt/roles/coordinator/commands/monitor.md +51 -12
  111. package/.codex/skills/team-tech-debt/roles/coordinator/role.md +4 -4
  112. package/.codex/skills/team-testing/SKILL.md +15 -17
  113. package/.codex/skills/team-testing/roles/coordinator/commands/monitor.md +51 -13
  114. package/.codex/skills/team-testing/roles/coordinator/role.md +4 -4
  115. package/dashboard/dist-server/dashboard/src/server/agents/stream-json-adapter.js +4 -0
  116. package/dashboard/dist-server/dashboard/src/server/agents/stream-json-adapter.js.map +1 -1
  117. package/dashboard/dist-server/dashboard/src/server/routes/cli-history.js +8 -1
  118. package/dashboard/dist-server/dashboard/src/server/routes/cli-history.js.map +1 -1
  119. package/dashboard/dist-server/dashboard/src/server/routes/mcp.js +20 -0
  120. package/dashboard/dist-server/dashboard/src/server/routes/mcp.js.map +1 -1
  121. package/dashboard/dist-server/dashboard/src/shared/constants.d.ts +1 -0
  122. package/dashboard/dist-server/dashboard/src/shared/constants.js +1 -0
  123. package/dashboard/dist-server/dashboard/src/shared/constants.js.map +1 -1
  124. package/dashboard/dist-server/src/agents/cli-history-store.js +21 -3
  125. package/dashboard/dist-server/src/agents/cli-history-store.js.map +1 -1
  126. package/dist/src/agents/cli-history-store.d.ts.map +1 -1
  127. package/dist/src/agents/cli-history-store.js +21 -3
  128. package/dist/src/agents/cli-history-store.js.map +1 -1
  129. package/dist/src/commands/cli.d.ts.map +1 -1
  130. package/dist/src/commands/cli.js +20 -8
  131. package/dist/src/commands/cli.js.map +1 -1
  132. package/dist/src/commands/uninstall-ui/UninstallFlow.d.ts.map +1 -1
  133. package/dist/src/commands/uninstall-ui/UninstallFlow.js +5 -4
  134. package/dist/src/commands/uninstall-ui/UninstallFlow.js.map +1 -1
  135. package/dist/src/commands/uninstall.js +1 -1
  136. package/dist/src/commands/uninstall.js.map +1 -1
  137. package/dist/src/core/manifest.d.ts.map +1 -1
  138. package/dist/src/core/manifest.js +9 -1
  139. package/dist/src/core/manifest.js.map +1 -1
  140. package/package.json +1 -1
  141. package/workflows/cli-tools-usage.md +6 -2
@@ -0,0 +1,71 @@
1
+ # Analyze Task
2
+
3
+ Parse user task -> detect review capabilities -> build dependency graph -> design pipeline.
4
+
5
+ **CONSTRAINT**: Text-level analysis only. NO source code reading, NO codebase exploration.
6
+
7
+ ## Signal Detection
8
+
9
+ | Keywords | Capability | Prefix |
10
+ |----------|------------|--------|
11
+ | scan, lint, static analysis, toolchain | scanner | SCAN |
12
+ | review, analyze, audit, findings | reviewer | REV |
13
+ | fix, repair, remediate, patch | fixer | FIX |
14
+
15
+ ## Pipeline Mode Detection
16
+
17
+ | Condition | Mode |
18
+ |-----------|------|
19
+ | Flag `--fix` | fix-only |
20
+ | Flag `--full` | full |
21
+ | Flag `-q` or `--quick` | quick |
22
+ | (none) | default |
23
+
24
+ ## Dependency Graph
25
+
26
+ Natural ordering for review pipeline:
27
+ - Tier 0: scanner (toolchain + semantic scan, no upstream dependency)
28
+ - Tier 1: reviewer (deep analysis, requires scan findings)
29
+ - Tier 2: fixer (apply fixes, requires reviewed findings + user confirm)
30
+
31
+ ## Pipeline Definitions
32
+
33
+ ```
34
+ quick: SCAN(quick=true)
35
+ default: SCAN -> REV
36
+ full: SCAN -> REV -> [user confirm] -> FIX
37
+ fix-only: FIX
38
+ ```
39
+
40
+ ## Complexity Scoring
41
+
42
+ | Factor | Points |
43
+ |--------|--------|
44
+ | Per capability | +1 |
45
+ | Large target scope (>20 files) | +2 |
46
+ | Multiple dimensions | +1 |
47
+ | Fix phase included | +1 |
48
+
49
+ Results: 1-2 Low, 3-4 Medium, 5+ High
50
+
51
+ ## Role Minimization
52
+
53
+ - Cap at 4 roles (coordinator + 3 workers)
54
+ - Sequential pipeline: scanner -> reviewer -> fixer
55
+
56
+ ## Output
57
+
58
+ Write <session>/task-analysis.json:
59
+ ```json
60
+ {
61
+ "task_description": "<original>",
62
+ "pipeline_mode": "<quick|default|full|fix-only>",
63
+ "target": "<path>",
64
+ "dimensions": ["sec", "cor", "prf", "mnt"],
65
+ "auto_confirm": false,
66
+ "capabilities": [{ "name": "<cap>", "prefix": "<PREFIX>" }],
67
+ "dependency_graph": { "<TASK-ID>": { "role": "<role>", "blockedBy": ["..."] } },
68
+ "roles": [{ "name": "<role>", "prefix": "<PREFIX>", "inner_loop": false }],
69
+ "complexity": { "score": 0, "level": "Low|Medium|High" }
70
+ }
71
+ ```
@@ -0,0 +1,91 @@
1
+ # Dispatch Tasks
2
+
3
+ Create task chains from pipeline mode with proper blockedBy relationships.
4
+
5
+ ## Workflow
6
+
7
+ 1. Read task-analysis.json -> extract pipeline_mode and parameters
8
+ 2. Read specs/pipelines.md -> get task registry for selected pipeline
9
+ 3. Topological sort tasks (respect blockedBy)
10
+ 4. Validate all owners exist in role registry (SKILL.md)
11
+ 5. For each task (in order):
12
+ - TaskCreate with structured description (see template below)
13
+ - TaskUpdate with blockedBy + owner assignment
14
+ 6. Update session meta.json with pipeline.tasks_total
15
+ 7. Validate chain (no orphans, no cycles, all refs valid)
16
+
17
+ ## Task Description Template
18
+
19
+ ```
20
+ PURPOSE: <goal> | Success: <criteria>
21
+ TASK:
22
+ - <step 1>
23
+ - <step 2>
24
+ CONTEXT:
25
+ - Session: <session-folder>
26
+ - Target: <target>
27
+ - Dimensions: <dimensions>
28
+ - Upstream artifacts: <list>
29
+ EXPECTED: <artifact path> + <quality criteria>
30
+ CONSTRAINTS: <scope limits>
31
+ ---
32
+ InnerLoop: <true|false>
33
+ RoleSpec: ~ or <project>/.claude/skills/team-review/roles/<role>/role.md
34
+ ```
35
+
36
+ ## Pipeline Task Registry
37
+
38
+ ### default Mode
39
+ ```
40
+ SCAN-001 (scanner): Multi-dimension code scan
41
+ blockedBy: [], meta: target=<target>, dimensions=<dims>
42
+ REV-001 (reviewer): Deep finding analysis and review
43
+ blockedBy: [SCAN-001]
44
+ ```
45
+
46
+ ### full Mode
47
+ ```
48
+ SCAN-001 (scanner): Multi-dimension code scan
49
+ blockedBy: [], meta: target=<target>, dimensions=<dims>
50
+ REV-001 (reviewer): Deep finding analysis and review
51
+ blockedBy: [SCAN-001]
52
+ FIX-001 (fixer): Plan and execute fixes
53
+ blockedBy: [REV-001]
54
+ ```
55
+
56
+ ### fix-only Mode
57
+ ```
58
+ FIX-001 (fixer): Execute fixes from manifest
59
+ blockedBy: [], meta: input=<fix-manifest>
60
+ ```
61
+
62
+ ### quick Mode
63
+ ```
64
+ SCAN-001 (scanner): Quick scan (fast mode)
65
+ blockedBy: [], meta: target=<target>, quick=true
66
+ ```
67
+
68
+ ## InnerLoop Flag Rules
69
+
70
+ - true: fixer role (iterative fix cycles)
71
+ - false: scanner, reviewer roles
72
+
73
+ ## Dependency Validation
74
+
75
+ - No orphan tasks (all tasks have valid owner)
76
+ - No circular dependencies
77
+ - All blockedBy references exist
78
+ - Session reference in every task description
79
+ - RoleSpec reference in every task description
80
+
81
+ ## Log After Creation
82
+
83
+ ```
84
+ mcp__ccw-tools__team_msg({
85
+ operation: "log",
86
+ session_id: <session-id>,
87
+ from: "coordinator",
88
+ type: "dispatch_ready",
89
+ data: { pipeline: "<mode>", task_count: <N>, target: "<target>" }
90
+ })
91
+ ```
@@ -0,0 +1,224 @@
1
+ # Monitor Pipeline
2
+
3
+ Event-driven pipeline coordination. Beat model: coordinator wake -> process -> spawn -> STOP.
4
+
5
+ ## Constants
6
+
7
+ - SPAWN_MODE: background
8
+ - ONE_STEP_PER_INVOCATION: true
9
+ - FAST_ADVANCE_AWARE: true
10
+ - WORKER_AGENT: team-worker
11
+
12
+ ## Handler Router
13
+
14
+ | Source | Handler |
15
+ |--------|---------|
16
+ | Message contains [scanner], [reviewer], [fixer] | handleCallback |
17
+ | "capability_gap" | handleAdapt |
18
+ | "check" or "status" | handleCheck |
19
+ | "resume" or "continue" | handleResume |
20
+ | All tasks completed | handleComplete |
21
+ | Default | handleSpawnNext |
22
+
23
+ ## Role-Worker Map
24
+
25
+ | Prefix | Role | Role Spec | inner_loop |
26
+ |--------|------|-----------|------------|
27
+ | SCAN-* | scanner | `~ or <project>/.claude/skills/team-review/roles/scanner/role.md` | false |
28
+ | REV-* | reviewer | `~ or <project>/.claude/skills/team-review/roles/reviewer/role.md` | false |
29
+ | FIX-* | fixer | `~ or <project>/.claude/skills/team-review/roles/fixer/role.md` | true |
30
+
31
+ ## handleCallback
32
+
33
+ Worker completed. Verify completion, check pipeline conditions, advance.
34
+
35
+ 1. Parse message to identify role and task ID:
36
+
37
+ | Message Pattern | Role Detection |
38
+ |----------------|---------------|
39
+ | `[scanner]` or task ID `SCAN-*` | scanner |
40
+ | `[reviewer]` or task ID `REV-*` | reviewer |
41
+ | `[fixer]` or task ID `FIX-*` | fixer |
42
+
43
+ 2. Check if progress update (inner loop) or final completion
44
+ 3. Progress -> update session state, STOP
45
+ 4. Completion -> mark task done via TaskUpdate(status="completed"), remove from active_workers
46
+ 5. Check for checkpoints:
47
+ - scanner completes -> read meta.json for findings_count:
48
+ - findings_count === 0 -> delete remaining REV-*/FIX-* tasks -> handleComplete
49
+ - findings_count > 0 -> proceed to handleSpawnNext
50
+ - reviewer completes AND pipeline_mode === 'full':
51
+ - autoYes flag set -> write fix-manifest.json, set fix_scope='all' -> handleSpawnNext
52
+ - NO autoYes -> AskUserQuestion:
53
+ ```
54
+ question: "<N> findings reviewed. Proceed with fix?"
55
+ options:
56
+ - "Fix all": set fix_scope='all'
57
+ - "Fix critical/high only": set fix_scope='critical,high'
58
+ - "Skip fix": delete FIX-* tasks -> handleComplete
59
+ ```
60
+ Write fix_scope to meta.json, write fix-manifest.json, -> handleSpawnNext
61
+ - fixer completes -> handleSpawnNext (checks for completion naturally)
62
+
63
+ 6. -> handleSpawnNext
64
+
65
+ ## handleCheck
66
+
67
+ Read-only status report, then STOP.
68
+
69
+ **Worker Progress** (from message bus):
70
+
71
+ Before generating status output, read worker milestones:
72
+
73
+ ```javascript
74
+ const progressMsgs = mcp__ccw-tools__team_msg({
75
+ operation: "list", session_id: sessionId, type: "progress", last: 50
76
+ })
77
+ const blockerMsgs = mcp__ccw-tools__team_msg({
78
+ operation: "list", session_id: sessionId, type: "blocker", last: 10
79
+ })
80
+
81
+ // Aggregate latest milestone per task
82
+ const taskProgress = {}
83
+ for (const msg of (progressMsgs.result?.messages || [])) {
84
+ const tid = msg.data?.task_id
85
+ if (tid && (!taskProgress[tid] || msg.ts > taskProgress[tid].ts)) {
86
+ taskProgress[tid] = { phase: msg.data.phase, pct: msg.data.progress_pct, ts: msg.ts }
87
+ }
88
+ }
89
+ ```
90
+
91
+ Include in status output:
92
+ - Per-worker latest milestone (phase + progress_pct) next to task status
93
+ - Active blockers section (if any blockerMsgs found)
94
+
95
+ Output:
96
+ ```
97
+ [coordinator] Review Pipeline Status
98
+ [coordinator] Mode: <pipeline_mode>
99
+ [coordinator] Progress: <completed>/<total> (<percent>%)
100
+
101
+ [coordinator] Pipeline Graph:
102
+ SCAN-001: <done|run|wait|deleted> <summary>
103
+ REV-001: <done|run|wait|deleted> <summary>
104
+ FIX-001: <done|run|wait|deleted> <summary>
105
+
106
+ done=completed >>>=running o=pending x=deleted
107
+
108
+ [coordinator] Active Workers: <list with elapsed time>
109
+ [coordinator] Ready to spawn: <subjects>
110
+ [coordinator] Commands: 'resume' to advance | 'check' to refresh
111
+ ```
112
+
113
+ Then STOP.
114
+
115
+ ## handleResume
116
+
117
+ 1. No active workers -> handleSpawnNext
118
+ 2. Has active -> check each status
119
+ - completed -> mark done via TaskUpdate
120
+ - in_progress -> still running
121
+ - other -> worker failure -> reset to pending
122
+ 3. Some completed -> handleSpawnNext
123
+ 4. All running -> report status, STOP
124
+
125
+ ## handleSpawnNext
126
+
127
+ Find ready tasks, spawn workers, STOP.
128
+
129
+ 1. Collect from TaskList():
130
+ - completedSubjects: status = completed
131
+ - inProgressSubjects: status = in_progress
132
+ - deletedSubjects: status = deleted
133
+ - readySubjects: status = pending AND all blockedBy in completedSubjects
134
+
135
+ 2. No ready + work in progress -> report waiting, STOP
136
+ 3. No ready + nothing in progress -> handleComplete
137
+ 4. Has ready -> take first ready task:
138
+ a. Determine role from prefix (use Role-Worker Map)
139
+ b. TaskUpdate -> in_progress
140
+ c. team_msg log -> task_unblocked
141
+ d. Spawn team-worker:
142
+
143
+ ```
144
+ Agent({
145
+ subagent_type: "team-worker",
146
+ description: "Spawn <role> worker for <subject>",
147
+ team_name: "review",
148
+ name: "<role>",
149
+ run_in_background: true,
150
+ prompt: `## Role Assignment
151
+ role: <role>
152
+ role_spec: ~ or <project>/.claude/skills/team-review/roles/<role>/role.md
153
+ session: <session-folder>
154
+ session_id: <session-id>
155
+ team_name: review
156
+ requirement: <task-description>
157
+ inner_loop: <true|false>
158
+
159
+ ## Current Task
160
+ - Task ID: <task-id>
161
+ - Task: <subject>
162
+
163
+ ## Progress Milestones
164
+ session_id: <session-id>
165
+ Report progress via team_msg at natural phase boundaries (context loaded -> core work done -> verification).
166
+ Report blockers immediately via team_msg type="blocker".
167
+ Report completion via team_msg type="task_complete" after final SendMessage.
168
+
169
+ Read role_spec file to load Phase 2-4 domain instructions.
170
+ Execute built-in Phase 1 (task discovery) -> role Phase 2-4 -> built-in Phase 5 (report).`
171
+ })
172
+ ```
173
+
174
+ e. Add to active_workers
175
+ 5. Update session meta.json, output summary, STOP
176
+
177
+ ## handleComplete
178
+
179
+ Pipeline done. Generate report and completion action.
180
+
181
+ 1. All tasks completed or deleted (no pending, no in_progress)
182
+ 2. Read final session state from meta.json
183
+ 3. Generate pipeline summary: mode, target, findings_count, stages_completed, fix results (if applicable), deliverable paths
184
+ 4. Update session: pipeline_status='complete', completed_at=<timestamp>
185
+ 5. Read session.completion_action:
186
+ - interactive -> AskUserQuestion (Archive/Keep/Export)
187
+ - auto_archive -> Archive & Clean (status=completed, TeamDelete)
188
+ - auto_keep -> Keep Active (status=paused)
189
+
190
+ ## handleAdapt
191
+
192
+ Capability gap reported mid-pipeline.
193
+
194
+ 1. Parse gap description
195
+ 2. Check if existing role covers it -> redirect
196
+ 3. Role count < 4 -> generate dynamic role-spec in <session>/role-specs/
197
+ 4. Create new task, spawn worker
198
+ 5. Role count >= 4 -> merge or pause
199
+
200
+ ## Fast-Advance Reconciliation
201
+
202
+ On every coordinator wake:
203
+ 1. Read team_msg entries with type="fast_advance"
204
+ 2. Sync active_workers with spawned successors
205
+ 3. No duplicate spawns
206
+
207
+ ## Phase 4: State Persistence
208
+
209
+ After every handler execution:
210
+ 1. Reconcile active_workers with actual TaskList states
211
+ 2. Remove entries for completed/deleted tasks
212
+ 3. Write updated meta.json
213
+ 4. STOP (wait for next callback)
214
+
215
+ ## Error Handling
216
+
217
+ | Scenario | Resolution |
218
+ |----------|------------|
219
+ | Session file not found | Error, suggest re-initialization |
220
+ | Worker callback from unknown role | Log info, scan for other completions |
221
+ | 0 findings after scan | Delete remaining stages, complete pipeline |
222
+ | User declines fix | Delete FIX-* tasks, complete with review-only results |
223
+ | Pipeline stall | Check blockedBy chains, report to user |
224
+ | Worker failure | Reset task to pending, respawn on next resume |
@@ -0,0 +1,132 @@
1
+ # Coordinator Role
2
+
3
+ Orchestrate team-review: parse target -> detect mode -> dispatch task chain -> monitor -> report.
4
+
5
+ ## Identity
6
+ - Name: coordinator | Tag: [coordinator]
7
+ - Responsibility: Target parsing, mode detection, task creation/dispatch, stage monitoring, result aggregation
8
+
9
+ ## Boundaries
10
+
11
+ ### MUST
12
+ - All output prefixed with `[coordinator]`
13
+ - Parse task description and detect pipeline mode
14
+ - Create team and spawn team-worker agents in background
15
+ - Dispatch task chain with proper dependencies
16
+ - Monitor progress via callbacks and route messages
17
+ - Maintain session state
18
+ - Execute completion action when pipeline finishes
19
+
20
+ ### MUST NOT
21
+ - Run analysis tools directly (semgrep, eslint, tsc, etc.)
22
+ - Modify source code files
23
+ - Perform code review or scanning directly
24
+ - Bypass worker roles
25
+ - Spawn workers with general-purpose agent (MUST use team-worker)
26
+
27
+ ## Command Execution Protocol
28
+ When coordinator needs to execute a specific phase:
29
+ 1. Read `commands/<command>.md`
30
+ 2. Follow the workflow defined in the command
31
+ 3. Commands are inline execution guides, NOT separate agents
32
+ 4. Execute synchronously, complete before proceeding
33
+
34
+ ## Entry Router
35
+
36
+ | Detection | Condition | Handler |
37
+ |-----------|-----------|---------|
38
+ | Worker callback | Message contains [scanner], [reviewer], [fixer] | -> handleCallback (monitor.md) |
39
+ | Status check | Args contain "check" or "status" | -> handleCheck (monitor.md) |
40
+ | Manual resume | Args contain "resume" or "continue" | -> handleResume (monitor.md) |
41
+ | Capability gap | Message contains "capability_gap" | -> handleAdapt (monitor.md) |
42
+ | Pipeline complete | All tasks completed | -> handleComplete (monitor.md) |
43
+ | Interrupted session | Active session in .workflow/.team/RV-* | -> Phase 0 |
44
+ | New session | None of above | -> Phase 1 |
45
+
46
+ For callback/check/resume/adapt/complete: load @commands/monitor.md, execute handler, STOP.
47
+
48
+ ## Phase 0: Session Resume Check
49
+
50
+ 1. Scan .workflow/.team/RV-*/.msg/meta.json for active/paused sessions
51
+ 2. No sessions -> Phase 1
52
+ 3. Single session -> reconcile (audit TaskList, reset in_progress->pending, rebuild team, kick first ready task)
53
+ 4. Multiple -> AskUserQuestion for selection
54
+
55
+ ## Phase 1: Requirement Clarification
56
+
57
+ TEXT-LEVEL ONLY. No source code reading.
58
+
59
+ 1. Parse arguments for explicit settings:
60
+
61
+ | Flag | Mode | Description |
62
+ |------|------|-------------|
63
+ | `--fix` | fix-only | Skip scan/review, go directly to fixer |
64
+ | `--full` | full | scan + review + fix pipeline |
65
+ | `-q` / `--quick` | quick | Quick scan only, no review/fix |
66
+ | (none) | default | scan + review pipeline |
67
+
68
+ 2. Extract parameters: target, dimensions, auto-confirm flag
69
+ 3. Clarify if ambiguous (AskUserQuestion for target path)
70
+ 4. Delegate to @commands/analyze.md
71
+ 5. Output: task-analysis.json
72
+ 6. CRITICAL: Always proceed to Phase 2, never skip team workflow
73
+
74
+ ## Phase 2: Create Team + Initialize Session
75
+
76
+ 1. Resolve workspace paths (MUST do first):
77
+ - `project_root` = result of `Bash({ command: "pwd" })`
78
+ - `skill_root` = `<project_root>/.claude/skills/team-review`
79
+ 2. Generate session ID: RV-<slug>-<date>
80
+ 3. Create session folder structure (scan/, review/, fix/, wisdom/)
81
+ 4. TeamCreate with team name "review"
82
+ 5. Read specs/pipelines.md -> select pipeline based on mode
83
+ 6. Initialize pipeline via team_msg state_update:
84
+ ```
85
+ mcp__ccw-tools__team_msg({
86
+ operation: "log", session_id: "<id>", from: "coordinator",
87
+ type: "state_update", summary: "Session initialized",
88
+ data: {
89
+ pipeline_mode: "<default|full|fix-only|quick>",
90
+ pipeline_stages: ["scanner", "reviewer", "fixer"],
91
+ team_name: "review",
92
+ target: "<target>",
93
+ dimensions: "<dimensions>",
94
+ auto_confirm: "<auto_confirm>"
95
+ }
96
+ })
97
+ ```
98
+ 7. Write session meta.json
99
+
100
+ ## Phase 3: Create Task Chain
101
+
102
+ Delegate to @commands/dispatch.md:
103
+ 1. Read specs/pipelines.md for selected pipeline's task registry
104
+ 2. Create tasks via TaskCreate with blockedBy
105
+ 3. Update session meta.json with pipeline.tasks_total
106
+
107
+ ## Phase 4: Spawn-and-Stop
108
+
109
+ Delegate to @commands/monitor.md#handleSpawnNext:
110
+ 1. Find ready tasks (pending + blockedBy resolved)
111
+ 2. Spawn team-worker agents (see SKILL.md Spawn Template)
112
+ 3. Output status summary
113
+ 4. STOP
114
+
115
+ ## Phase 5: Report + Completion Action
116
+
117
+ 1. Generate summary (mode, target, findings_total, by_severity, fix_rate if applicable)
118
+ 2. Execute completion action per session.completion_action:
119
+ - interactive -> AskUserQuestion (Archive/Keep/Export)
120
+ - auto_archive -> Archive & Clean
121
+ - auto_keep -> Keep Active
122
+
123
+ ## Error Handling
124
+
125
+ | Error | Resolution |
126
+ |-------|------------|
127
+ | Task too vague | AskUserQuestion for clarification |
128
+ | Session corruption | Attempt recovery, fallback to manual |
129
+ | Worker crash | Reset task to pending, respawn |
130
+ | Scanner finds 0 findings | Report clean, skip review + fix stages |
131
+ | Fix verification fails | Log warning, report partial results |
132
+ | Target path invalid | AskUserQuestion for corrected path |
@@ -0,0 +1,76 @@
1
+ ---
2
+ role: fixer
3
+ prefix: FIX
4
+ inner_loop: true
5
+ message_types:
6
+ success: fix_complete
7
+ error: fix_failed
8
+ ---
9
+
10
+ # Code Fixer
11
+
12
+ Fix code based on reviewed findings. Load manifest, plan fix groups, apply with rollback-on-failure, verify. Code-generation role -- modifies source files.
13
+
14
+ ## Phase 2: Context & Scope Resolution
15
+
16
+ | Input | Source | Required |
17
+ |-------|--------|----------|
18
+ | Task description | From task subject/description | Yes |
19
+ | Session path | Extracted from task description | Yes |
20
+ | Fix manifest | <session>/fix/fix-manifest.json | Yes |
21
+ | Review report | <session>/review/review-report.json | Yes |
22
+ | .msg/meta.json | <session>/.msg/meta.json | No |
23
+
24
+ 1. Extract session path, input path from task description
25
+ 2. Load manifest (scope, source report path) and review report (findings with enrichment)
26
+ 3. Filter fixable findings: severity in scope AND fix_strategy !== 'skip'
27
+ 4. If 0 fixable -> report complete immediately
28
+ 5. Detect quick path: findings <= 5 AND no cross-file dependencies
29
+ 6. Detect verification tools: tsc (tsconfig.json), eslint (package.json), jest (package.json), pytest (pyproject.toml), semgrep (semgrep available)
30
+ 7. Load wisdom files from `<session>/wisdom/`
31
+
32
+ ## Phase 3: Plan + Execute
33
+
34
+ ### 3A: Plan Fixes (deterministic, no CLI)
35
+ 1. Group findings by primary file
36
+ 2. Merge groups with cross-file dependencies (union-find)
37
+ 3. Topological sort within each group (respect fix_dependencies, append cycles at end)
38
+ 4. Sort groups by max severity (critical first)
39
+ 5. Determine execution path: quick_path (<=5 findings, <=1 group) or standard
40
+ 6. Write `<session>/fix/fix-plan.json`: `{plan_id, quick_path, groups[{id, files[], findings[], max_severity}], execution_order[], total_findings, total_groups}`
41
+
42
+ ### 3B: Execute Fixes
43
+ **Quick path**: Single code-developer agent for all findings.
44
+ **Standard path**: One code-developer agent per group, in execution_order.
45
+
46
+ Agent prompt includes: finding list (dependency-sorted), file contents (truncated 8K), critical rules:
47
+ 1. Apply each fix using Edit tool in order
48
+ 2. After each fix, run related tests
49
+ 3. Tests PASS -> finding is "fixed"
50
+ 4. Tests FAIL -> `git checkout -- {file}` -> mark "failed" -> continue
51
+ 5. No retry on failure. Rollback and move on
52
+ 6. If finding depends on previously failed finding -> mark "skipped"
53
+
54
+ Agent returns JSON: `{results:[{id, status: fixed|failed|skipped, file, error?}]}`
55
+ Fallback: check git diff per file if no structured output.
56
+
57
+ Write `<session>/fix/execution-results.json`: `{fixed[], failed[], skipped[]}`
58
+
59
+ ## Phase 4: Post-Fix Verification
60
+
61
+ 1. Run available verification tools on modified files:
62
+
63
+ | Tool | Command | Pass Criteria |
64
+ |------|---------|---------------|
65
+ | tsc | `npx tsc --noEmit` | 0 errors |
66
+ | eslint | `npx eslint <files>` | 0 errors |
67
+ | jest | `npx jest --passWithNoTests` | Tests pass |
68
+ | pytest | `pytest --tb=short` | Tests pass |
69
+ | semgrep | `semgrep --config auto <files> --json` | 0 results |
70
+
71
+ 2. If verification fails critically -> rollback last batch
72
+ 3. Write `<session>/fix/verify-results.json`
73
+ 4. Generate `<session>/fix/fix-summary.json`: `{fix_id, fix_date, scope, total, fixed, failed, skipped, fix_rate, verification}`
74
+ 5. Generate `<session>/fix/fix-summary.md` (human-readable)
75
+ 6. Update `<session>/.msg/meta.json` with fix results
76
+ 7. Contribute discoveries to `<session>/wisdom/` files
@@ -0,0 +1,68 @@
1
+ ---
2
+ role: reviewer
3
+ prefix: REV
4
+ inner_loop: false
5
+ message_types:
6
+ success: review_complete
7
+ error: error
8
+ ---
9
+
10
+ # Finding Reviewer
11
+
12
+ Deep analysis on scan findings: triage, root cause / impact / optimization enrichment via CLI fan-out, cross-correlation, and structured review report generation. Read-only -- never modifies source code.
13
+
14
+ ## Phase 2: Context & Triage
15
+
16
+ | Input | Source | Required |
17
+ |-------|--------|----------|
18
+ | Task description | From task subject/description | Yes |
19
+ | Session path | Extracted from task description | Yes |
20
+ | Scan results | <session>/scan/scan-results.json | Yes |
21
+ | .msg/meta.json | <session>/.msg/meta.json | No |
22
+
23
+ 1. Extract session path, input path, dimensions from task description
24
+ 2. Load review specs: Run `ccw spec load --category review` for review standards, checklists, and approval gates
25
+ 3. Load scan results. If missing or empty -> report clean, complete immediately
26
+ 3. Load wisdom files from `<session>/wisdom/`
27
+ 4. Triage findings into two buckets:
28
+
29
+ | Bucket | Criteria | Action |
30
+ |--------|----------|--------|
31
+ | deep_analysis | severity in [critical, high, medium], max 15, sorted critical-first | Enrich with root cause, impact, optimization |
32
+ | pass_through | remaining (low, info, or overflow) | Include in report without enrichment |
33
+
34
+ If deep_analysis empty -> skip Phase 3, go to Phase 4.
35
+
36
+ ## Phase 3: Deep Analysis (CLI Fan-out)
37
+
38
+ Split deep_analysis into two domain groups, run parallel CLI agents:
39
+
40
+ | Group | Dimensions | Focus |
41
+ |-------|-----------|-------|
42
+ | A | Security + Correctness | Root cause tracing, fix dependencies, blast radius |
43
+ | B | Performance + Maintainability | Optimization approaches, refactor tradeoffs |
44
+
45
+ If either group empty -> skip that agent.
46
+
47
+ Build prompt per group requesting 6 enrichment fields per finding:
48
+ - `root_cause`: `{description, related_findings[], is_symptom}`
49
+ - `impact`: `{scope: low/medium/high, affected_files[], blast_radius}`
50
+ - `optimization`: `{approach, alternative, tradeoff}`
51
+ - `fix_strategy`: minimal / refactor / skip
52
+ - `fix_complexity`: low / medium / high
53
+ - `fix_dependencies`: finding IDs that must be fixed first
54
+
55
+ Execute via `maestro cli --tool gemini --mode analysis --rule analysis-diagnose-bug-root-cause` (fallback: qwen -> codex). Parse JSON array responses, merge with originals (CLI-enriched replace originals, unenriched get defaults). Write `<session>/review/enriched-findings.json`.
56
+
57
+ ## Phase 4: Report Generation
58
+
59
+ 1. Combine enriched + pass_through findings
60
+ 2. Cross-correlate:
61
+ - **Critical files**: file appears in >=2 dimensions -> list with finding_count, severities
62
+ - **Root cause groups**: cluster findings sharing related_findings -> identify primary
63
+ - **Optimization suggestions**: from root cause groups + standalone enriched findings
64
+ 3. Compute metrics: by_dimension, by_severity, dimension_severity_matrix, fixable_count, auto_fixable_count
65
+ 4. Write `<session>/review/review-report.json`: `{review_id, review_date, findings[], critical_files[], optimization_suggestions[], root_cause_groups[], summary}`
66
+ 5. Write `<session>/review/review-report.md`: Executive summary, metrics matrix (dimension x severity), critical/high findings table, critical files list, optimization suggestions, recommended fix scope
67
+ 6. Update `<session>/.msg/meta.json` with review summary
68
+ 7. Contribute discoveries to `<session>/wisdom/` files