maestro-flow 0.4.9 → 0.4.10

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 (187) hide show
  1. package/.agy/agents/cli-explore-agent.md +186 -0
  2. package/.agy/agents/conceptual-planning-agent.md +244 -0
  3. package/.agy/agents/impeccable-agent.md +97 -0
  4. package/.agy/agents/team-supervisor.md +142 -0
  5. package/.agy/agents/team-worker.md +236 -0
  6. package/.agy/agents/ui-design-agent.md +286 -0
  7. package/.agy/agents/workflow-analyzer.md +114 -0
  8. package/.agy/agents/workflow-codebase-mapper.md +76 -0
  9. package/.agy/agents/workflow-collab-planner.md +142 -0
  10. package/.agy/agents/workflow-debugger.md +102 -0
  11. package/.agy/agents/workflow-executor.md +131 -0
  12. package/.agy/agents/workflow-external-researcher.md +86 -0
  13. package/.agy/agents/workflow-integration-checker.md +82 -0
  14. package/.agy/agents/workflow-nyquist-auditor.md +84 -0
  15. package/.agy/agents/workflow-phase-researcher.md +84 -0
  16. package/.agy/agents/workflow-plan-checker.md +89 -0
  17. package/.agy/agents/workflow-planner.md +194 -0
  18. package/.agy/agents/workflow-project-researcher.md +73 -0
  19. package/.agy/agents/workflow-research-synthesizer.md +70 -0
  20. package/.agy/agents/workflow-reviewer.md +81 -0
  21. package/.agy/agents/workflow-roadmapper.md +81 -0
  22. package/.agy/agents/workflow-verifier.md +119 -0
  23. package/.agy/skills/codify-to-knowhow/SKILL.md +172 -0
  24. package/.agy/skills/codify-to-knowhow/phases/01-load-manifest.md +101 -0
  25. package/.agy/skills/codify-to-knowhow/phases/02-generate-knowhow.md +97 -0
  26. package/.agy/skills/codify-to-knowhow/phases/03-generate-specs.md +92 -0
  27. package/.agy/skills/codify-to-knowhow/phases/04-index-verify.md +119 -0
  28. package/.agy/skills/learn-decompose/SKILL.md +118 -0
  29. package/.agy/skills/learn-follow/SKILL.md +129 -0
  30. package/.agy/skills/learn-investigate/SKILL.md +154 -0
  31. package/.agy/skills/learn-retro/SKILL.md +159 -0
  32. package/.agy/skills/learn-second-opinion/SKILL.md +124 -0
  33. package/.agy/skills/maestro/SKILL.md +221 -0
  34. package/.agy/skills/maestro-amend/SKILL.md +162 -0
  35. package/.agy/skills/maestro-analyze/SKILL.md +135 -0
  36. package/.agy/skills/maestro-brainstorm/SKILL.md +118 -0
  37. package/.agy/skills/maestro-collab/SKILL.md +174 -0
  38. package/.agy/skills/maestro-composer/SKILL.md +180 -0
  39. package/.agy/skills/maestro-execute/SKILL.md +133 -0
  40. package/.agy/skills/maestro-fork/SKILL.md +88 -0
  41. package/.agy/skills/maestro-guard/SKILL.md +101 -0
  42. package/.agy/skills/maestro-help/SKILL.md +267 -0
  43. package/.agy/skills/maestro-help/index/catalog.json +184 -0
  44. package/.agy/skills/maestro-help/phases/01-parse-intent.md +122 -0
  45. package/.agy/skills/maestro-help/phases/02-search-present.md +181 -0
  46. package/.agy/skills/maestro-help/phases/03-workflow-guide.md +186 -0
  47. package/.agy/skills/maestro-impeccable/SKILL.md +250 -0
  48. package/.agy/skills/maestro-init/SKILL.md +80 -0
  49. package/.agy/skills/maestro-learn/SKILL.md +142 -0
  50. package/.agy/skills/maestro-merge/SKILL.md +66 -0
  51. package/.agy/skills/maestro-milestone-audit/SKILL.md +70 -0
  52. package/.agy/skills/maestro-milestone-complete/SKILL.md +77 -0
  53. package/.agy/skills/maestro-milestone-release/SKILL.md +98 -0
  54. package/.agy/skills/maestro-overlay/SKILL.md +177 -0
  55. package/.agy/skills/maestro-plan/SKILL.md +172 -0
  56. package/.agy/skills/maestro-player/SKILL.md +176 -0
  57. package/.agy/skills/maestro-quick/SKILL.md +67 -0
  58. package/.agy/skills/maestro-ralph/SKILL.md +546 -0
  59. package/.agy/skills/maestro-ralph-execute/SKILL.md +255 -0
  60. package/.agy/skills/maestro-roadmap/SKILL.md +170 -0
  61. package/.agy/skills/maestro-tools-execute/SKILL.md +119 -0
  62. package/.agy/skills/maestro-tools-register/SKILL.md +159 -0
  63. package/.agy/skills/maestro-ui-codify/SKILL.md +81 -0
  64. package/.agy/skills/maestro-update/SKILL.md +175 -0
  65. package/.agy/skills/maestro-verify/SKILL.md +111 -0
  66. package/.agy/skills/manage-codebase-rebuild/SKILL.md +77 -0
  67. package/.agy/skills/manage-codebase-refresh/SKILL.md +59 -0
  68. package/.agy/skills/manage-harvest/SKILL.md +96 -0
  69. package/.agy/skills/manage-issue/SKILL.md +72 -0
  70. package/.agy/skills/manage-issue-discover/SKILL.md +83 -0
  71. package/.agy/skills/manage-knowhow/SKILL.md +76 -0
  72. package/.agy/skills/manage-knowhow-capture/SKILL.md +78 -0
  73. package/.agy/skills/manage-learn/SKILL.md +64 -0
  74. package/.agy/skills/manage-status/SKILL.md +51 -0
  75. package/.agy/skills/manage-wiki/SKILL.md +61 -0
  76. package/.agy/skills/quality-auto-test/SKILL.md +135 -0
  77. package/.agy/skills/quality-debug/SKILL.md +122 -0
  78. package/.agy/skills/quality-refactor/SKILL.md +69 -0
  79. package/.agy/skills/quality-retrospective/SKILL.md +79 -0
  80. package/.agy/skills/quality-review/SKILL.md +130 -0
  81. package/.agy/skills/quality-sync/SKILL.md +53 -0
  82. package/.agy/skills/quality-test/SKILL.md +119 -0
  83. package/.agy/skills/security-audit/SKILL.md +157 -0
  84. package/.agy/skills/skill-iter-tune/SKILL.md +381 -0
  85. package/.agy/skills/skill-iter-tune/phases/01-setup.md +144 -0
  86. package/.agy/skills/skill-iter-tune/phases/02-execute.md +292 -0
  87. package/.agy/skills/skill-iter-tune/phases/03-evaluate.md +312 -0
  88. package/.agy/skills/skill-iter-tune/phases/04-improve.md +198 -0
  89. package/.agy/skills/skill-iter-tune/phases/05-report.md +166 -0
  90. package/.agy/skills/skill-iter-tune/specs/evaluation-criteria.md +63 -0
  91. package/.agy/skills/skill-iter-tune/templates/eval-prompt.md +134 -0
  92. package/.agy/skills/skill-iter-tune/templates/execute-prompt.md +97 -0
  93. package/.agy/skills/spec-add/SKILL.md +67 -0
  94. package/.agy/skills/spec-load/SKILL.md +70 -0
  95. package/.agy/skills/spec-remove/SKILL.md +50 -0
  96. package/.agy/skills/spec-setup/SKILL.md +47 -0
  97. package/.agy/skills/team-coordinate/SKILL.md +267 -0
  98. package/.agy/skills/team-coordinate/roles/coordinator/commands/analyze-task.md +247 -0
  99. package/.agy/skills/team-coordinate/roles/coordinator/commands/dispatch.md +131 -0
  100. package/.agy/skills/team-coordinate/roles/coordinator/commands/monitor.md +348 -0
  101. package/.agy/skills/team-coordinate/roles/coordinator/role.md +362 -0
  102. package/.agy/skills/team-coordinate/specs/knowledge-transfer.md +111 -0
  103. package/.agy/skills/team-coordinate/specs/pipelines.md +97 -0
  104. package/.agy/skills/team-coordinate/specs/quality-gates.md +112 -0
  105. package/.agy/skills/team-coordinate/specs/role-spec-template.md +198 -0
  106. package/.agy/skills/team-executor/SKILL.md +180 -0
  107. package/.agy/skills/team-executor/roles/executor/commands/monitor.md +235 -0
  108. package/.agy/skills/team-executor/roles/executor/role.md +171 -0
  109. package/.agy/skills/team-executor/specs/session-schema.md +264 -0
  110. package/.agy/skills/team-lifecycle-v4/SKILL.md +189 -0
  111. package/.agy/skills/team-lifecycle-v4/roles/analyst/role.md +92 -0
  112. package/.agy/skills/team-lifecycle-v4/roles/coordinator/commands/analyze.md +56 -0
  113. package/.agy/skills/team-lifecycle-v4/roles/coordinator/commands/dispatch.md +56 -0
  114. package/.agy/skills/team-lifecycle-v4/roles/coordinator/commands/monitor.md +206 -0
  115. package/.agy/skills/team-lifecycle-v4/roles/coordinator/role.md +130 -0
  116. package/.agy/skills/team-lifecycle-v4/roles/executor/commands/fix.md +35 -0
  117. package/.agy/skills/team-lifecycle-v4/roles/executor/commands/implement.md +62 -0
  118. package/.agy/skills/team-lifecycle-v4/roles/executor/role.md +64 -0
  119. package/.agy/skills/team-lifecycle-v4/roles/planner/role.md +82 -0
  120. package/.agy/skills/team-lifecycle-v4/roles/reviewer/commands/review-code.md +34 -0
  121. package/.agy/skills/team-lifecycle-v4/roles/reviewer/commands/review-spec.md +44 -0
  122. package/.agy/skills/team-lifecycle-v4/roles/reviewer/role.md +65 -0
  123. package/.agy/skills/team-lifecycle-v4/roles/supervisor/role.md +188 -0
  124. package/.agy/skills/team-lifecycle-v4/roles/tester/role.md +84 -0
  125. package/.agy/skills/team-lifecycle-v4/roles/writer/role.md +92 -0
  126. package/.agy/skills/team-lifecycle-v4/specs/knowledge-transfer.md +114 -0
  127. package/.agy/skills/team-lifecycle-v4/specs/pipelines.md +140 -0
  128. package/.agy/skills/team-lifecycle-v4/specs/quality-gates.md +130 -0
  129. package/.agy/skills/team-lifecycle-v4/templates/architecture.md +254 -0
  130. package/.agy/skills/team-lifecycle-v4/templates/epics.md +196 -0
  131. package/.agy/skills/team-lifecycle-v4/templates/product-brief.md +133 -0
  132. package/.agy/skills/team-lifecycle-v4/templates/requirements.md +224 -0
  133. package/.agy/skills/team-quality-assurance/SKILL.md +148 -0
  134. package/.agy/skills/team-quality-assurance/roles/analyst/role.md +85 -0
  135. package/.agy/skills/team-quality-assurance/roles/coordinator/commands/analyze.md +72 -0
  136. package/.agy/skills/team-quality-assurance/roles/coordinator/commands/dispatch.md +111 -0
  137. package/.agy/skills/team-quality-assurance/roles/coordinator/commands/monitor.md +235 -0
  138. package/.agy/skills/team-quality-assurance/roles/coordinator/role.md +143 -0
  139. package/.agy/skills/team-quality-assurance/roles/executor/role.md +62 -0
  140. package/.agy/skills/team-quality-assurance/roles/generator/role.md +65 -0
  141. package/.agy/skills/team-quality-assurance/roles/scout/role.md +72 -0
  142. package/.agy/skills/team-quality-assurance/roles/strategist/role.md +69 -0
  143. package/.agy/skills/team-quality-assurance/specs/pipelines.md +115 -0
  144. package/.agy/skills/team-quality-assurance/specs/team-config.json +131 -0
  145. package/.agy/skills/team-review/SKILL.md +149 -0
  146. package/.agy/skills/team-review/roles/coordinator/commands/analyze.md +71 -0
  147. package/.agy/skills/team-review/roles/coordinator/commands/dispatch.md +91 -0
  148. package/.agy/skills/team-review/roles/coordinator/commands/monitor.md +209 -0
  149. package/.agy/skills/team-review/roles/coordinator/role.md +132 -0
  150. package/.agy/skills/team-review/roles/fixer/role.md +74 -0
  151. package/.agy/skills/team-review/roles/reviewer/role.md +66 -0
  152. package/.agy/skills/team-review/roles/scanner/role.md +77 -0
  153. package/.agy/skills/team-review/specs/dimensions.md +82 -0
  154. package/.agy/skills/team-review/specs/finding-schema.json +82 -0
  155. package/.agy/skills/team-review/specs/pipelines.md +102 -0
  156. package/.agy/skills/team-review/specs/team-config.json +27 -0
  157. package/.agy/skills/team-tech-debt/SKILL.md +133 -0
  158. package/.agy/skills/team-tech-debt/roles/assessor/role.md +76 -0
  159. package/.agy/skills/team-tech-debt/roles/coordinator/commands/analyze.md +47 -0
  160. package/.agy/skills/team-tech-debt/roles/coordinator/commands/dispatch.md +156 -0
  161. package/.agy/skills/team-tech-debt/roles/coordinator/commands/monitor.md +198 -0
  162. package/.agy/skills/team-tech-debt/roles/coordinator/role.md +123 -0
  163. package/.agy/skills/team-tech-debt/roles/executor/role.md +76 -0
  164. package/.agy/skills/team-tech-debt/roles/planner/role.md +68 -0
  165. package/.agy/skills/team-tech-debt/roles/scanner/role.md +90 -0
  166. package/.agy/skills/team-tech-debt/roles/validator/role.md +78 -0
  167. package/.agy/skills/team-tech-debt/specs/pipelines.md +47 -0
  168. package/.agy/skills/team-tech-debt/specs/team-config.json +129 -0
  169. package/.agy/skills/team-testing/SKILL.md +144 -0
  170. package/.agy/skills/team-testing/roles/analyst/role.md +101 -0
  171. package/.agy/skills/team-testing/roles/coordinator/commands/analyze.md +70 -0
  172. package/.agy/skills/team-testing/roles/coordinator/commands/dispatch.md +108 -0
  173. package/.agy/skills/team-testing/roles/coordinator/commands/monitor.md +242 -0
  174. package/.agy/skills/team-testing/roles/coordinator/role.md +134 -0
  175. package/.agy/skills/team-testing/roles/executor/role.md +95 -0
  176. package/.agy/skills/team-testing/roles/generator/role.md +95 -0
  177. package/.agy/skills/team-testing/roles/strategist/role.md +81 -0
  178. package/.agy/skills/team-testing/specs/pipelines.md +101 -0
  179. package/.agy/skills/team-testing/specs/team-config.json +93 -0
  180. package/.agy/skills/wiki-connect/SKILL.md +64 -0
  181. package/.agy/skills/wiki-digest/SKILL.md +70 -0
  182. package/.agy/skills/workflow-skill-designer/SKILL.md +506 -0
  183. package/.agy/skills/workflow-skill-designer/phases/01-requirements-analysis.md +356 -0
  184. package/.agy/skills/workflow-skill-designer/phases/02-orchestrator-design.md +444 -0
  185. package/.agy/skills/workflow-skill-designer/phases/03-phase-design.md +458 -0
  186. package/.agy/skills/workflow-skill-designer/phases/04-validation.md +471 -0
  187. package/package.json +3 -1
@@ -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,209 @@
1
+
2
+ ## Sub-Agent Registration (Antigravity)
3
+
4
+ Before any `invoke_subagent` call below, register each sub-agent type once per session by reading the system_prompt from `<agy-agents-dir>/<name>.md` and passing it to `define_subagent`. The `<agy-agents-dir>` is:
5
+ - global install: `~/.gemini/antigravity-cli/agents/`
6
+ - workspace install: `<project>/.agents/agents/`
7
+
8
+ - `define_subagent(name="team-worker", description="<from agents/team-worker.md frontmatter>", system_prompt=<contents of agents/team-worker.md body>, enable_write_tools=true, enable_mcp_tools=true, enable_subagent_tools=false)`
9
+
10
+ **ConversationId tracking**: `invoke_subagent` returns a ConversationId per spawned instance. Subsequent `send_message(Recipient=<ConversationId>, Message=...)` calls require that ConversationId — never use the role name as the recipient.
11
+
12
+ ---
13
+ # Monitor Pipeline
14
+
15
+ Event-driven pipeline coordination. Beat model: coordinator wake -> process -> spawn -> STOP.
16
+
17
+ ## Constants
18
+
19
+ - SPAWN_MODE: background
20
+ - ONE_STEP_PER_INVOCATION: true
21
+ - FAST_ADVANCE_AWARE: true
22
+ - WORKER_AGENT: team-worker
23
+
24
+ ## Handler Router
25
+
26
+ | Source | Handler |
27
+ |--------|---------|
28
+ | Message contains [scanner], [reviewer], [fixer] | handleCallback |
29
+ | "capability_gap" | handleAdapt |
30
+ | "check" or "status" | handleCheck |
31
+ | "resume" or "continue" | handleResume |
32
+ | All tasks completed | handleComplete |
33
+ | Default | handleSpawnNext |
34
+
35
+ ## Role-Worker Map
36
+
37
+ | Prefix | Role | Role Spec | inner_loop |
38
+ |--------|------|-----------|------------|
39
+ | SCAN-* | scanner | `~ or <project>/.claude/skills/team-review/roles/scanner/role.md` | false |
40
+ | REV-* | reviewer | `~ or <project>/.claude/skills/team-review/roles/reviewer/role.md` | false |
41
+ | FIX-* | fixer | `~ or <project>/.claude/skills/team-review/roles/fixer/role.md` | true |
42
+
43
+ ## handleCallback
44
+
45
+ Worker completed. Verify completion, check pipeline conditions, advance.
46
+
47
+ 1. Parse message to identify role and task ID:
48
+
49
+ | Message Pattern | Role Detection |
50
+ |----------------|---------------|
51
+ | `[scanner]` or task ID `SCAN-*` | scanner |
52
+ | `[reviewer]` or task ID `REV-*` | reviewer |
53
+ | `[fixer]` or task ID `FIX-*` | fixer |
54
+
55
+ 2. Check if progress update (inner loop) or final completion
56
+ 3. Progress -> update session state, STOP
57
+ 4. Completion -> mark task done via TaskUpdate(status="completed"), remove from active_workers
58
+ 5. Check for checkpoints:
59
+ - scanner completes -> read meta.json for findings_count:
60
+ - findings_count === 0 -> delete remaining REV-*/FIX-* tasks -> handleComplete
61
+ - findings_count > 0 -> proceed to handleSpawnNext
62
+ - reviewer completes AND pipeline_mode === 'full':
63
+ - autoYes flag set -> write fix-manifest.json, set fix_scope='all' -> handleSpawnNext
64
+ - NO autoYes -> ask_question:
65
+ ```
66
+ question: "<N> findings reviewed. Proceed with fix?"
67
+ options:
68
+ - "Fix all": set fix_scope='all'
69
+ - "Fix critical/high only": set fix_scope='critical,high'
70
+ - "Skip fix": delete FIX-* tasks -> handleComplete
71
+ ```
72
+ Write fix_scope to meta.json, write fix-manifest.json, -> handleSpawnNext
73
+ - fixer completes -> handleSpawnNext (checks for completion naturally)
74
+
75
+ 6. -> handleSpawnNext
76
+
77
+ ## handleCheck
78
+
79
+ Read-only status report, then STOP.
80
+
81
+ **Worker Progress** (from message bus):
82
+
83
+ Before generating status output, read worker milestones:
84
+
85
+ ```javascript
86
+ const progressMsgs = mcp__ccw-tools__team_msg({
87
+ operation: "list", session_id: sessionId, type: "progress", last: 50
88
+ })
89
+ const blockerMsgs = mcp__ccw-tools__team_msg({
90
+ operation: "list", session_id: sessionId, type: "blocker", last: 10
91
+ })
92
+
93
+ // Aggregate latest milestone per task
94
+ const taskProgress = {}
95
+ for (const msg of (progressMsgs.result?.messages || [])) {
96
+ const tid = msg.data?.task_id
97
+ if (tid && (!taskProgress[tid] || msg.ts > taskProgress[tid].ts)) {
98
+ taskProgress[tid] = { phase: msg.data.phase, pct: msg.data.progress_pct, ts: msg.ts }
99
+ }
100
+ }
101
+ ```
102
+
103
+ Include in status output:
104
+ - Per-worker latest milestone (phase + progress_pct) next to task status
105
+ - Active blockers section (if any blockerMsgs found)
106
+
107
+ Output:
108
+ ```
109
+ [coordinator] Review Pipeline Status
110
+ [coordinator] Mode: <pipeline_mode>
111
+ [coordinator] Progress: <completed>/<total> (<percent>%)
112
+
113
+ [coordinator] Pipeline Graph:
114
+ SCAN-001: <done|run|wait|deleted> <summary>
115
+ REV-001: <done|run|wait|deleted> <summary>
116
+ FIX-001: <done|run|wait|deleted> <summary>
117
+
118
+ done=completed >>>=running o=pending x=deleted
119
+
120
+ [coordinator] Active Workers: <list with elapsed time>
121
+ [coordinator] Ready to spawn: <subjects>
122
+ [coordinator] Commands: 'resume' to advance | 'check' to refresh
123
+ ```
124
+
125
+ Then STOP.
126
+
127
+ ## handleResume
128
+
129
+ 1. No active workers -> handleSpawnNext
130
+ 2. Has active -> check each status
131
+ - completed -> mark done via TaskUpdate
132
+ - in_progress -> still running
133
+ - other -> worker failure -> reset to pending
134
+ 3. Some completed -> handleSpawnNext
135
+ 4. All running -> report status, STOP
136
+
137
+ ## handleSpawnNext
138
+
139
+ Find ready tasks, spawn workers, STOP.
140
+
141
+ 1. Collect from TaskList():
142
+ - completedSubjects: status = completed
143
+ - inProgressSubjects: status = in_progress
144
+ - deletedSubjects: status = deleted
145
+ - readySubjects: status = pending AND all blockedBy in completedSubjects
146
+
147
+ 2. No ready + work in progress -> report waiting, STOP
148
+ 3. No ready + nothing in progress -> handleComplete
149
+ 4. Has ready -> take first ready task:
150
+ a. Determine role from prefix (use Role-Worker Map)
151
+ b. TaskUpdate -> in_progress
152
+ c. team_msg log -> task_unblocked
153
+ d. Spawn team-worker:
154
+
155
+ ```
156
+ invoke_subagent([{ TypeName: "team-worker", Role: "<role>", Prompt: "<Prompt>", Workspace: "inherit" }])
157
+ ```
158
+
159
+ e. Add to active_workers
160
+ 5. Update session meta.json, output summary, STOP
161
+
162
+ ## handleComplete
163
+
164
+ Pipeline done. Generate report and completion action.
165
+
166
+ 1. All tasks completed or deleted (no pending, no in_progress)
167
+ 2. Read final session state from meta.json
168
+ 3. Generate pipeline summary: mode, target, findings_count, stages_completed, fix results (if applicable), deliverable paths
169
+ 4. Update session: pipeline_status='complete', completed_at=<timestamp>
170
+ 5. Read session.completion_action:
171
+ - interactive -> ask_question (Archive/Keep/Export)
172
+ - auto_archive -> Archive & Clean (status=completed, TeamDelete)
173
+ - auto_keep -> Keep Active (status=paused)
174
+
175
+ ## handleAdapt
176
+
177
+ Capability gap reported mid-pipeline.
178
+
179
+ 1. Parse gap description
180
+ 2. Check if existing role covers it -> redirect
181
+ 3. Role count < 4 -> generate dynamic role-spec in <session>/role-specs/
182
+ 4. Create new task, spawn worker
183
+ 5. Role count >= 4 -> merge or pause
184
+
185
+ ## Fast-Advance Reconciliation
186
+
187
+ On every coordinator wake:
188
+ 1. Read team_msg entries with type="fast_advance"
189
+ 2. Sync active_workers with spawned successors
190
+ 3. No duplicate spawns
191
+
192
+ ## Phase 4: State Persistence
193
+
194
+ After every handler execution:
195
+ 1. Reconcile active_workers with actual TaskList states
196
+ 2. Remove entries for completed/deleted tasks
197
+ 3. Write updated meta.json
198
+ 4. STOP (wait for next callback)
199
+
200
+ ## Error Handling
201
+
202
+ | Scenario | Resolution |
203
+ |----------|------------|
204
+ | Session file not found | Error, suggest re-initialization |
205
+ | Worker callback from unknown role | Log info, scan for other completions |
206
+ | 0 findings after scan | Delete remaining stages, complete pipeline |
207
+ | User declines fix | Delete FIX-* tasks, complete with review-only results |
208
+ | Pipeline stall | Check blockedBy chains, report to user |
209
+ | 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 -> ask_question 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 (ask_question 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 `run_command({ 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 -> ask_question (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 | ask_question 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 | ask_question for corrected path |
@@ -0,0 +1,74 @@
1
+ ---
2
+ role: fixer
3
+ prefix: FIX
4
+ inner_loop: true
5
+ message_types:
6
+ ---
7
+
8
+ # Code Fixer
9
+
10
+ Fix code based on reviewed findings. Load manifest, plan fix groups, apply with rollback-on-failure, verify. Code-generation role -- modifies source files.
11
+
12
+ ## Phase 2: Context & Scope Resolution
13
+
14
+ | Input | Source | Required |
15
+ |-------|--------|----------|
16
+ | Task description | From task subject/description | Yes |
17
+ | Session path | Extracted from task description | Yes |
18
+ | Fix manifest | <session>/fix/fix-manifest.json | Yes |
19
+ | Review report | <session>/review/review-report.json | Yes |
20
+ | .msg/meta.json | <session>/.msg/meta.json | No |
21
+
22
+ 1. Extract session path, input path from task description
23
+ 2. Load manifest (scope, source report path) and review report (findings with enrichment)
24
+ 3. Filter fixable findings: severity in scope AND fix_strategy !== 'skip'
25
+ 4. If 0 fixable -> report complete immediately
26
+ 5. Detect quick path: findings <= 5 AND no cross-file dependencies
27
+ 6. Detect verification tools: tsc (tsconfig.json), eslint (package.json), jest (package.json), pytest (pyproject.toml), semgrep (semgrep available)
28
+ 7. Load wisdom files from `<session>/wisdom/`
29
+
30
+ ## Phase 3: Plan + Execute
31
+
32
+ ### 3A: Plan Fixes (deterministic, no CLI)
33
+ 1. Group findings by primary file
34
+ 2. Merge groups with cross-file dependencies (union-find)
35
+ 3. Topological sort within each group (respect fix_dependencies, append cycles at end)
36
+ 4. Sort groups by max severity (critical first)
37
+ 5. Determine execution path: quick_path (<=5 findings, <=1 group) or standard
38
+ 6. Write `<session>/fix/fix-plan.json`: `{plan_id, quick_path, groups[{id, files[], findings[], max_severity}], execution_order[], total_findings, total_groups}`
39
+
40
+ ### 3B: Execute Fixes
41
+ **Quick path**: Single code-developer agent for all findings.
42
+ **Standard path**: One code-developer agent per group, in execution_order.
43
+
44
+ Agent prompt includes: finding list (dependency-sorted), file contents (truncated 8K), critical rules:
45
+ 1. Apply each fix using Edit tool in order
46
+ 2. After each fix, run related tests
47
+ 3. Tests PASS -> finding is "fixed"
48
+ 4. Tests FAIL -> `git checkout -- {file}` -> mark "failed" -> continue
49
+ 5. No retry on failure. Rollback and move on
50
+ 6. If finding depends on previously failed finding -> mark "skipped"
51
+
52
+ Agent returns JSON: `{results:[{id, status: fixed|failed|skipped, file, error?}]}`
53
+ Fallback: check git diff per file if no structured output.
54
+
55
+ Write `<session>/fix/execution-results.json`: `{fixed[], failed[], skipped[]}`
56
+
57
+ ## Phase 4: Post-Fix Verification
58
+
59
+ 1. Run available verification tools on modified files:
60
+
61
+ | Tool | Command | Pass Criteria |
62
+ |------|---------|---------------|
63
+ | tsc | `npx tsc --noEmit` | 0 errors |
64
+ | eslint | `npx eslint <files>` | 0 errors |
65
+ | jest | `npx jest --passWithNoTests` | Tests pass |
66
+ | pytest | `pytest --tb=short` | Tests pass |
67
+ | semgrep | `semgrep --config auto <files> --json` | 0 results |
68
+
69
+ 2. If verification fails critically -> rollback last batch
70
+ 3. Write `<session>/fix/verify-results.json`
71
+ 4. Generate `<session>/fix/fix-summary.json`: `{fix_id, fix_date, scope, total, fixed, failed, skipped, fix_rate, verification}`
72
+ 5. Generate `<session>/fix/fix-summary.md` (human-readable)
73
+ 6. Update `<session>/.msg/meta.json` with fix results
74
+ 7. Contribute discoveries to `<session>/wisdom/` files
@@ -0,0 +1,66 @@
1
+ ---
2
+ role: reviewer
3
+ prefix: REV
4
+ inner_loop: false
5
+ message_types:
6
+ ---
7
+
8
+ # Finding Reviewer
9
+
10
+ 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.
11
+
12
+ ## Phase 2: Context & Triage
13
+
14
+ | Input | Source | Required |
15
+ |-------|--------|----------|
16
+ | Task description | From task subject/description | Yes |
17
+ | Session path | Extracted from task description | Yes |
18
+ | Scan results | <session>/scan/scan-results.json | Yes |
19
+ | .msg/meta.json | <session>/.msg/meta.json | No |
20
+
21
+ 1. Extract session path, input path, dimensions from task description
22
+ 2. Load review specs: Run `ccw spec load --category review` for review standards, checklists, and approval gates
23
+ 3. Load scan results. If missing or empty -> report clean, complete immediately
24
+ 3. Load wisdom files from `<session>/wisdom/`
25
+ 4. Triage findings into two buckets:
26
+
27
+ | Bucket | Criteria | Action |
28
+ |--------|----------|--------|
29
+ | deep_analysis | severity in [critical, high, medium], max 15, sorted critical-first | Enrich with root cause, impact, optimization |
30
+ | pass_through | remaining (low, info, or overflow) | Include in report without enrichment |
31
+
32
+ If deep_analysis empty -> skip Phase 3, go to Phase 4.
33
+
34
+ ## Phase 3: Deep Analysis (CLI Fan-out)
35
+
36
+ Split deep_analysis into two domain groups, run parallel CLI agents:
37
+
38
+ | Group | Dimensions | Focus |
39
+ |-------|-----------|-------|
40
+ | A | Security + Correctness | Root cause tracing, fix dependencies, blast radius |
41
+ | B | Performance + Maintainability | Optimization approaches, refactor tradeoffs |
42
+
43
+ If either group empty -> skip that agent.
44
+
45
+ Build prompt per group requesting 6 enrichment fields per finding:
46
+ - `root_cause`: `{description, related_findings[], is_symptom}`
47
+ - `impact`: `{scope: low/medium/high, affected_files[], blast_radius}`
48
+ - `optimization`: `{approach, alternative, tradeoff}`
49
+ - `fix_strategy`: minimal / refactor / skip
50
+ - `fix_complexity`: low / medium / high
51
+ - `fix_dependencies`: finding IDs that must be fixed first
52
+
53
+ Execute via `maestro delegate --role review --mode analysis --rule analysis-diagnose-bug-root-cause`. Parse JSON array responses, merge with originals (CLI-enriched replace originals, unenriched get defaults). Write `<session>/review/enriched-findings.json`.
54
+
55
+ ## Phase 4: Report Generation
56
+
57
+ 1. Combine enriched + pass_through findings
58
+ 2. Cross-correlate:
59
+ - **Critical files**: file appears in >=2 dimensions -> list with finding_count, severities
60
+ - **Root cause groups**: cluster findings sharing related_findings -> identify primary
61
+ - **Optimization suggestions**: from root cause groups + standalone enriched findings
62
+ 3. Compute metrics: by_dimension, by_severity, dimension_severity_matrix, fixable_count, auto_fixable_count
63
+ 4. Write `<session>/review/review-report.json`: `{review_id, review_date, findings[], critical_files[], optimization_suggestions[], root_cause_groups[], summary}`
64
+ 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
65
+ 6. Update `<session>/.msg/meta.json` with review summary
66
+ 7. Contribute discoveries to `<session>/wisdom/` files