maestro-flow 0.2.1 → 0.3.0

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 (143) hide show
  1. package/.claude/agents/team-supervisor.md +18 -8
  2. package/.claude/agents/team-worker.md +84 -2
  3. package/.claude/commands/manage-harvest.md +131 -0
  4. package/.claude/skills/team-coordinate/SKILL.md +266 -0
  5. package/.claude/skills/team-coordinate/roles/coordinator/commands/analyze-task.md +247 -0
  6. package/.claude/skills/team-coordinate/roles/coordinator/commands/dispatch.md +131 -0
  7. package/.claude/skills/team-coordinate/roles/coordinator/commands/monitor.md +358 -0
  8. package/.claude/skills/team-coordinate/roles/coordinator/role.md +363 -0
  9. package/.claude/skills/team-coordinate/specs/knowledge-transfer.md +111 -0
  10. package/.claude/skills/team-coordinate/specs/pipelines.md +97 -0
  11. package/.claude/skills/team-coordinate/specs/quality-gates.md +112 -0
  12. package/.claude/skills/team-coordinate/specs/role-spec-template.md +198 -0
  13. package/.claude/skills/team-executor/SKILL.md +189 -0
  14. package/.claude/skills/team-executor/roles/executor/commands/monitor.md +239 -0
  15. package/.claude/skills/team-executor/roles/executor/role.md +171 -0
  16. package/.claude/skills/team-executor/specs/session-schema.md +264 -0
  17. package/.claude/skills/team-lifecycle-v4/SKILL.md +209 -0
  18. package/.claude/skills/team-lifecycle-v4/roles/analyst/role.md +94 -0
  19. package/.claude/skills/team-lifecycle-v4/roles/coordinator/commands/analyze.md +56 -0
  20. package/.claude/skills/team-lifecycle-v4/roles/coordinator/commands/dispatch.md +56 -0
  21. package/.claude/skills/team-lifecycle-v4/roles/coordinator/commands/monitor.md +206 -0
  22. package/.claude/skills/team-lifecycle-v4/roles/coordinator/role.md +130 -0
  23. package/.claude/skills/team-lifecycle-v4/roles/executor/commands/fix.md +35 -0
  24. package/.claude/skills/team-lifecycle-v4/roles/executor/commands/implement.md +62 -0
  25. package/.claude/skills/team-lifecycle-v4/roles/executor/role.md +67 -0
  26. package/.claude/skills/team-lifecycle-v4/roles/planner/role.md +85 -0
  27. package/.claude/skills/team-lifecycle-v4/roles/reviewer/commands/review-code.md +34 -0
  28. package/.claude/skills/team-lifecycle-v4/roles/reviewer/commands/review-spec.md +44 -0
  29. package/.claude/skills/team-lifecycle-v4/roles/reviewer/role.md +69 -0
  30. package/.claude/skills/team-lifecycle-v4/roles/supervisor/role.md +192 -0
  31. package/.claude/skills/team-lifecycle-v4/roles/tester/role.md +87 -0
  32. package/.claude/skills/team-lifecycle-v4/roles/writer/role.md +95 -0
  33. package/.claude/skills/team-lifecycle-v4/specs/knowledge-transfer.md +114 -0
  34. package/.claude/skills/team-lifecycle-v4/specs/pipelines.md +140 -0
  35. package/.claude/skills/team-lifecycle-v4/specs/quality-gates.md +130 -0
  36. package/.claude/skills/team-lifecycle-v4/templates/architecture.md +254 -0
  37. package/.claude/skills/team-lifecycle-v4/templates/epics.md +196 -0
  38. package/.claude/skills/team-lifecycle-v4/templates/product-brief.md +133 -0
  39. package/.claude/skills/team-lifecycle-v4/templates/requirements.md +224 -0
  40. package/.claude/skills/team-quality-assurance/SKILL.md +147 -0
  41. package/.claude/skills/team-quality-assurance/roles/analyst/role.md +88 -0
  42. package/.claude/skills/team-quality-assurance/roles/coordinator/commands/analyze.md +72 -0
  43. package/.claude/skills/team-quality-assurance/roles/coordinator/commands/dispatch.md +111 -0
  44. package/.claude/skills/team-quality-assurance/roles/coordinator/commands/monitor.md +250 -0
  45. package/.claude/skills/team-quality-assurance/roles/coordinator/role.md +143 -0
  46. package/.claude/skills/team-quality-assurance/roles/executor/role.md +66 -0
  47. package/.claude/skills/team-quality-assurance/roles/generator/role.md +68 -0
  48. package/.claude/skills/team-quality-assurance/roles/scout/role.md +75 -0
  49. package/.claude/skills/team-quality-assurance/roles/strategist/role.md +71 -0
  50. package/.claude/skills/team-quality-assurance/specs/pipelines.md +115 -0
  51. package/.claude/skills/team-quality-assurance/specs/team-config.json +131 -0
  52. package/.claude/skills/team-review/SKILL.md +147 -0
  53. package/.claude/skills/team-review/roles/coordinator/commands/analyze.md +71 -0
  54. package/.claude/skills/team-review/roles/coordinator/commands/dispatch.md +91 -0
  55. package/.claude/skills/team-review/roles/coordinator/commands/monitor.md +224 -0
  56. package/.claude/skills/team-review/roles/coordinator/role.md +132 -0
  57. package/.claude/skills/team-review/roles/fixer/role.md +76 -0
  58. package/.claude/skills/team-review/roles/reviewer/role.md +68 -0
  59. package/.claude/skills/team-review/roles/scanner/role.md +79 -0
  60. package/.claude/skills/team-review/specs/dimensions.md +82 -0
  61. package/.claude/skills/team-review/specs/finding-schema.json +82 -0
  62. package/.claude/skills/team-review/specs/pipelines.md +102 -0
  63. package/.claude/skills/team-review/specs/team-config.json +27 -0
  64. package/.claude/skills/team-tech-debt/SKILL.md +128 -0
  65. package/.claude/skills/team-tech-debt/roles/assessor/role.md +77 -0
  66. package/.claude/skills/team-tech-debt/roles/coordinator/commands/analyze.md +47 -0
  67. package/.claude/skills/team-tech-debt/roles/coordinator/commands/dispatch.md +156 -0
  68. package/.claude/skills/team-tech-debt/roles/coordinator/commands/monitor.md +209 -0
  69. package/.claude/skills/team-tech-debt/roles/coordinator/role.md +123 -0
  70. package/.claude/skills/team-tech-debt/roles/executor/role.md +76 -0
  71. package/.claude/skills/team-tech-debt/roles/planner/role.md +69 -0
  72. package/.claude/skills/team-tech-debt/roles/scanner/role.md +90 -0
  73. package/.claude/skills/team-tech-debt/roles/validator/role.md +78 -0
  74. package/.claude/skills/team-tech-debt/specs/pipelines.md +47 -0
  75. package/.claude/skills/team-tech-debt/specs/team-config.json +129 -0
  76. package/.claude/skills/team-testing/SKILL.md +143 -0
  77. package/.claude/skills/team-testing/roles/analyst/role.md +103 -0
  78. package/.claude/skills/team-testing/roles/coordinator/commands/analyze.md +70 -0
  79. package/.claude/skills/team-testing/roles/coordinator/commands/dispatch.md +108 -0
  80. package/.claude/skills/team-testing/roles/coordinator/commands/monitor.md +257 -0
  81. package/.claude/skills/team-testing/roles/coordinator/role.md +134 -0
  82. package/.claude/skills/team-testing/roles/executor/role.md +99 -0
  83. package/.claude/skills/team-testing/roles/generator/role.md +98 -0
  84. package/.claude/skills/team-testing/roles/strategist/role.md +83 -0
  85. package/.claude/skills/team-testing/specs/pipelines.md +101 -0
  86. package/.claude/skills/team-testing/specs/team-config.json +93 -0
  87. package/.codex/skills/maestro-coordinate/SKILL.md +6 -6
  88. package/.codex/skills/maestro-overlay/SKILL.md +1 -3
  89. package/.codex/skills/manage-issue-analyze/SKILL.md +2 -2
  90. package/.codex/skills/quality-retrospective/SKILL.md +30 -31
  91. package/.codex/skills/team-coordinate/SKILL.md +16 -18
  92. package/.codex/skills/team-coordinate/roles/coordinator/commands/monitor.md +50 -7
  93. package/.codex/skills/team-coordinate/roles/coordinator/role.md +4 -4
  94. package/.codex/skills/team-coordinate/specs/knowledge-transfer.md +2 -0
  95. package/.codex/skills/team-executor/SKILL.md +11 -13
  96. package/.codex/skills/team-executor/roles/executor/commands/monitor.md +47 -11
  97. package/.codex/skills/team-lifecycle-v4/SKILL.md +27 -33
  98. package/.codex/skills/team-lifecycle-v4/instructions/agent-instruction.md +94 -0
  99. package/.codex/skills/team-lifecycle-v4/roles/coordinator/commands/dispatch.md +1 -1
  100. package/.codex/skills/team-lifecycle-v4/roles/coordinator/commands/monitor.md +94 -27
  101. package/.codex/skills/team-lifecycle-v4/roles/coordinator/role.md +12 -14
  102. package/.codex/skills/team-lifecycle-v4/roles/supervisor/role.md +1 -1
  103. package/.codex/skills/team-lifecycle-v4/specs/knowledge-transfer.md +69 -1
  104. package/.codex/skills/team-quality-assurance/SKILL.md +14 -16
  105. package/.codex/skills/team-quality-assurance/roles/coordinator/commands/monitor.md +60 -11
  106. package/.codex/skills/team-quality-assurance/roles/coordinator/role.md +4 -4
  107. package/.codex/skills/team-review/SKILL.md +14 -16
  108. package/.codex/skills/team-review/roles/coordinator/commands/monitor.md +47 -10
  109. package/.codex/skills/team-review/roles/coordinator/role.md +4 -4
  110. package/.codex/skills/team-tech-debt/SKILL.md +13 -15
  111. package/.codex/skills/team-tech-debt/roles/coordinator/commands/monitor.md +51 -12
  112. package/.codex/skills/team-tech-debt/roles/coordinator/role.md +4 -4
  113. package/.codex/skills/team-testing/SKILL.md +15 -17
  114. package/.codex/skills/team-testing/roles/coordinator/commands/monitor.md +51 -13
  115. package/.codex/skills/team-testing/roles/coordinator/role.md +4 -4
  116. package/dashboard/dist-server/dashboard/src/server/agents/stream-json-adapter.js +4 -0
  117. package/dashboard/dist-server/dashboard/src/server/agents/stream-json-adapter.js.map +1 -1
  118. package/dashboard/dist-server/dashboard/src/server/routes/cli-history.js +8 -1
  119. package/dashboard/dist-server/dashboard/src/server/routes/cli-history.js.map +1 -1
  120. package/dashboard/dist-server/dashboard/src/server/routes/mcp.js +20 -0
  121. package/dashboard/dist-server/dashboard/src/server/routes/mcp.js.map +1 -1
  122. package/dashboard/dist-server/dashboard/src/shared/constants.d.ts +1 -0
  123. package/dashboard/dist-server/dashboard/src/shared/constants.js +1 -0
  124. package/dashboard/dist-server/dashboard/src/shared/constants.js.map +1 -1
  125. package/dashboard/dist-server/src/agents/cli-history-store.js +21 -3
  126. package/dashboard/dist-server/src/agents/cli-history-store.js.map +1 -1
  127. package/dist/src/agents/cli-history-store.d.ts.map +1 -1
  128. package/dist/src/agents/cli-history-store.js +21 -3
  129. package/dist/src/agents/cli-history-store.js.map +1 -1
  130. package/dist/src/commands/cli.d.ts.map +1 -1
  131. package/dist/src/commands/cli.js +20 -8
  132. package/dist/src/commands/cli.js.map +1 -1
  133. package/dist/src/commands/uninstall-ui/UninstallFlow.d.ts.map +1 -1
  134. package/dist/src/commands/uninstall-ui/UninstallFlow.js +5 -4
  135. package/dist/src/commands/uninstall-ui/UninstallFlow.js.map +1 -1
  136. package/dist/src/commands/uninstall.js +1 -1
  137. package/dist/src/commands/uninstall.js.map +1 -1
  138. package/dist/src/core/manifest.d.ts.map +1 -1
  139. package/dist/src/core/manifest.js +9 -1
  140. package/dist/src/core/manifest.js.map +1 -1
  141. package/package.json +1 -1
  142. package/workflows/cli-tools-usage.md +6 -2
  143. package/workflows/harvest.md +420 -0
@@ -48,18 +48,28 @@ Triggered when coordinator sends a checkpoint request message:
48
48
 
49
49
  1. **Parse request**: Extract `task_id` and `scope` from coordinator message
50
50
  2. **Claim task**: `TaskUpdate({ taskId: "<task_id>", status: "in_progress" })`
51
- 3. **Incremental context load**: Only load data new since last wake:
51
+ 3. **Read worker progress** (optional): Check progress milestones for risk assessment:
52
+ ```javascript
53
+ const progressMsgs = mcp__maestro__team_msg({
54
+ operation: "list", session_id: "<session_id>", type: "progress", last: 50
55
+ })
56
+ const blockerMsgs = mcp__maestro__team_msg({
57
+ operation: "list", session_id: "<session_id>", type: "blocker", last: 10
58
+ })
59
+ // Use progress data to assess worker health and identify stalled tasks
60
+ ```
61
+ 4. **Incremental context load**: Only load data new since last wake:
52
62
  - Role states: `team_msg(operation="get_state")` for newly completed roles
53
63
  - Message bus: `team_msg(operation="list", session_id, last=30)` for recent messages
54
64
  - Artifacts: Read files in scope not already in context_accumulator
55
65
  - Wisdom: Read `<session>/wisdom/*.md` for new entries
56
- 4. **Execute checks**: Follow checkpoint-specific instructions from role_spec body
57
- 5. **Write report**: Output to `<session>/artifacts/CHECKPOINT-NNN-report.md`
58
- 6. **Complete task**: `TaskUpdate({ taskId: "<task_id>", status: "completed" })`
59
- 7. **Publish state**: Log `state_update` via `team_msg` with verdict, score, findings
60
- 8. **Accumulate context**: Append checkpoint results to `context_accumulator`
61
- 9. **Report to coordinator**: SendMessage with verdict summary, findings, quality trend
62
- 10. **Go idle**: Wait for next checkpoint request or shutdown
66
+ 5. **Execute checks**: Follow checkpoint-specific instructions from role_spec body
67
+ 6. **Write report**: Output to `<session>/artifacts/CHECKPOINT-NNN-report.md`
68
+ 7. **Complete task**: `TaskUpdate({ taskId: "<task_id>", status: "completed" })`
69
+ 8. **Publish state**: Log `state_update` via `team_msg` with verdict, score, findings
70
+ 9. **Accumulate context**: Append checkpoint results to `context_accumulator`
71
+ 10. **Report to coordinator**: SendMessage with verdict summary, findings, quality trend
72
+ 11. **Go idle**: Wait for next checkpoint request or shutdown
63
73
 
64
74
  ### 4. Crash Recovery
65
75
 
@@ -80,6 +80,10 @@ Follow the instructions loaded from the role_spec body. This contains the domain
80
80
  - Use CLI tools (`maestro cli`) or direct tools (Read, Grep, Glob) for analysis — see @~/.maestro/templates/search-tools.md for tool selection
81
81
  - If agent delegation is needed, send a request to the coordinator via SendMessage
82
82
 
83
+ ### Context-Aware Signal Emission (Optional)
84
+
85
+ During Phase 2-4 execution, if you detect codebase signals relevant to specialist injection (SQL usage, auth modules, ML imports, performance-sensitive code, etc.), include `tech_profile` in your Phase 5 state_update data. This enables the coordinator to evaluate specialist injection for the pipeline.
86
+
83
87
  ### 6. Publish Results
84
88
 
85
89
  After execution, publish contributions:
@@ -88,20 +92,98 @@ After execution, publish contributions:
88
92
  2. Prepare state data for the reporting phase
89
93
  3. Append discoveries to wisdom files (`learnings.md`, `decisions.md`, `issues.md`)
90
94
 
95
+ ### Progress Milestone Protocol
96
+
97
+ Report progress via `mcp__maestro__team_msg` at natural phase boundaries. This enables coordinator status dashboards and timeout forensics.
98
+
99
+ **Milestone Reporting** — at each phase boundary:
100
+
101
+ ```javascript
102
+ mcp__maestro__team_msg({
103
+ operation: "log",
104
+ session_id: "<session_id>",
105
+ from: "<task_id>",
106
+ to: "coordinator",
107
+ type: "progress",
108
+ summary: "[<task_id>] <brief phase description> (<pct>%)",
109
+ data: {
110
+ task_id: "<task_id>",
111
+ role: "<role>",
112
+ status: "in_progress",
113
+ progress_pct: <0-100>,
114
+ phase: "<what just completed>",
115
+ key_info: "<most important finding or decision>"
116
+ }
117
+ })
118
+ ```
119
+
120
+ **Role-Specific Milestones**:
121
+
122
+ | Role | ~30% | ~60% | ~90% |
123
+ |------|------|------|------|
124
+ | analyst/researcher | Context loaded | Core analysis done | Verification complete |
125
+ | writer/drafter | Sources gathered | Draft written | Self-review done |
126
+ | planner | Requirements parsed | Plan structured | Dependencies validated |
127
+ | executor/implementer | Context loaded | Core changes done | Tests passing |
128
+ | reviewer/tester | Scope mapped | Reviews/tests done | Report compiled |
129
+
130
+ **Blocker Reporting** — immediately on errors (don't wait for next milestone):
131
+
132
+ ```javascript
133
+ mcp__maestro__team_msg({
134
+ operation: "log",
135
+ session_id: "<session_id>",
136
+ from: "<task_id>",
137
+ to: "coordinator",
138
+ type: "blocker",
139
+ summary: "[<task_id>] BLOCKED: <brief description>",
140
+ data: {
141
+ task_id: "<task_id>",
142
+ role: "<role>",
143
+ blocker_detail: "<what is blocking>",
144
+ severity: "high|medium",
145
+ attempted: "<what was tried>"
146
+ }
147
+ })
148
+ ```
149
+
150
+ **Completion Report** — after final report SendMessage:
151
+
152
+ ```javascript
153
+ mcp__maestro__team_msg({
154
+ operation: "log",
155
+ session_id: "<session_id>",
156
+ from: "<task_id>",
157
+ to: "coordinator",
158
+ type: "task_complete",
159
+ summary: "[<task_id>] Complete: <one-line result>",
160
+ data: {
161
+ task_id: "<task_id>",
162
+ role: "<role>",
163
+ status: "completed",
164
+ progress_pct: 100,
165
+ artifact: "<artifact_path>",
166
+ files_modified: []
167
+ }
168
+ })
169
+ ```
170
+
171
+ **Overhead Rule**: Max 3-4 milestone messages per task. Each summary < 200 chars. Only report at natural phase boundaries, not every minor step.
172
+
91
173
  ### 7. Report and Advance
92
174
 
93
175
  Determine report variant based on loop state:
94
176
 
95
177
  **Loop continuation** (inner_loop=true AND more same-prefix tasks pending):
96
178
  1. `TaskUpdate` -- mark current task `completed`
97
- 2. Log `state_update` via `team_msg` with task results
179
+ 2. Log `state_update` via `team_msg` with task results and optional `tech_profile` (if codebase signals detected in Phase 2-4)
98
180
  3. Accumulate summary to in-memory `context_accumulator`
99
181
  4. Interrupt check: consensus_blocked HIGH or errors >= 3 -- SendMessage and STOP
100
182
  5. Return to step 3 (Task Discovery)
101
183
 
102
184
  **Final report** (no more same-prefix tasks OR inner_loop=false):
103
185
  1. `TaskUpdate` -- mark current task `completed`
104
- 2. Log `state_update` via `team_msg`
186
+ 2. Log `state_update` via `team_msg` (include `tech_profile` if codebase signals detected)
105
187
  3. Compile and send final report via SendMessage to coordinator:
106
188
  - Tasks completed (count + list)
107
189
  - Artifacts produced (paths)
@@ -0,0 +1,131 @@
1
+ ---
2
+ name: manage-harvest
3
+ description: Extract knowledge from workflow artifacts and route to wiki / spec / issue stores
4
+ argument-hint: "[<session-id|path>] [--to wiki|spec|issue|auto] [--source <type>] [--recent N] [--dry-run] [-y]"
5
+ allowed-tools:
6
+ - Read
7
+ - Write
8
+ - Edit
9
+ - Bash
10
+ - Glob
11
+ - Grep
12
+ - Agent
13
+ - AskUserQuestion
14
+ ---
15
+ <purpose>
16
+ Extract knowledge fragments from workflow artifacts (analysis results, brainstorm outputs, debug sessions, lite-plan/fix results, scratchpad notes, completed sessions) and route them into the project's three knowledge stores: wiki entries, spec conventions, and trackable issues.
17
+
18
+ Complements `quality-retrospective` (which is phase-scoped) by harvesting from **any** workflow artifact. Prevents knowledge loss from completed analysis and planning sessions that would otherwise only exist as stale files.
19
+
20
+ **Closed-loop**: harvest extracts → wiki/spec/issue stores → downstream commands consume (wiki-digest, spec-load, manage-issue-plan).
21
+ </purpose>
22
+
23
+ <required_reading>
24
+ @workflows/harvest.md
25
+ </required_reading>
26
+
27
+ <deferred_reading>
28
+ - @workflows/issue.md (issues.jsonl schema for issue routing — read when creating issues in Stage 6c)
29
+ - @workflows/specs-add.md (spec entry format — read when routing to spec in Stage 6b)
30
+ </deferred_reading>
31
+
32
+ <context>
33
+ Arguments: $ARGUMENTS
34
+
35
+ **Modes (auto-detected):**
36
+ - No arguments → `scan` mode: discover all harvestable artifacts, interactive selection
37
+ - `<session-id>` (e.g., `ANL-auth-20260410`, `WFS-xxx`) → `session` mode: harvest specific session
38
+ - `<path>` (e.g., `.workflow/.analysis/ANL-auth-20260410/`) → `path` mode: harvest from explicit directory
39
+
40
+ **Flags:**
41
+ - `--to <target>` — Force routing: `wiki`, `spec`, `issue`, `auto` (default: `auto`)
42
+ - `--source <type>` — Filter source type: `analysis`, `brainstorm`, `debug`, `lite-plan`, `lite-fix`, `scratchpad`, `session`, `learning`, `all` (default: `all`)
43
+ - `--recent N` — Only artifacts updated within last N days (default: 30)
44
+ - `--dry-run` — Preview extraction and routing without writing
45
+ - `-y` / `--yes` — Skip confirmation prompts
46
+ - `--min-confidence N` — Minimum extraction confidence 0.0-1.0 (default: 0.5)
47
+
48
+ **Source registry (scan paths):**
49
+ | Source Type | Scan Path | Key Files |
50
+ |-------------|-----------|-----------|
51
+ | `analysis` | `.workflow/.analysis/ANL-*/` | `conclusions.json`, `*.md` |
52
+ | `brainstorm` | `.workflow/scratch/brainstorm-*/` | `guidance-specification.md` |
53
+ | `lite-plan` | `.workflow/.lite-plan/*/` | `plan.json`, `plan-overview.md` |
54
+ | `lite-fix` | `.workflow/.lite-fix/*/` | `fix-plan.json` |
55
+ | `debug` | `.workflow/.debug/*/` | `debug-log.md`, `hypothesis-*.md` |
56
+ | `scratchpad` | `.workflow/.scratchpad/` | `*.md`, `*.json` |
57
+ | `session` | `.workflow/active/WFS-*/` | `workflow-session.json` |
58
+ | `learning` | `.workflow/learning/` | `lessons.jsonl`, `digest-*.md` |
59
+
60
+ **Storage written:**
61
+ - `.workflow/harvest/harvest-log.jsonl` — provenance log (prevents duplicate harvesting)
62
+ - `.workflow/harvest/harvest-report-{date}.md` — per-run report
63
+ - Wiki entries via `maestro wiki create`
64
+ - Spec entries via `Skill({ skill: "spec-add" })`
65
+ - Issue entries appended to `.workflow/issues/issues.jsonl`
66
+
67
+ **Storage read (never modified):**
68
+ - All artifact source files (read-only until routing stage)
69
+ - `.workflow/harvest/harvest-log.jsonl` (dedup check)
70
+ </context>
71
+
72
+ <execution>
73
+ Follow 'workflows/harvest.md' Stages 1–8 in order. Key invariants:
74
+
75
+ 1. **Read-only until Stage 6** — Stages 1–5 must not write anything. All extraction and classification happens in-memory.
76
+ 2. **Dedup before write** — Stage 7 (dedup_check) runs BEFORE each write in Stage 6. Check harvest-log.jsonl, wiki search, issues.jsonl, and learnings.md for existing matches.
77
+ 3. **Stable fragment IDs** — `HRV-{8 hex}` from `hash(source_id + content_hash)` so re-runs on same artifacts do not create duplicates.
78
+ 4. **Reuse existing routing infrastructure**:
79
+ - Wiki: `maestro wiki create --type <type> --slug harvest-<source_type>-<short_id>`
80
+ - Spec: `Skill({ skill: "spec-add", args: "<type> <content>" })`
81
+ - Issue: append to `issues.jsonl` matching canonical schema from `workflows/issue.md`
82
+ 5. **Never modify source artifacts** — harvest is purely extractive. Source files remain untouched.
83
+ 6. **Confidence filtering** — fragments below `--min-confidence` are logged but not routed.
84
+ 7. **Provenance tracking** — every routed item logged to `harvest-log.jsonl` with fragment_id, source reference, and target reference.
85
+
86
+ **Fragment extraction uses source-specific parsing** (see harvest.md Stage 3b for per-source patterns). The agent should read each artifact file and identify discrete knowledge items: findings, decisions, patterns, bugs, risks, tasks, lessons, recommendations.
87
+
88
+ **Classification uses category-to-target mapping** (see harvest.md Stage 4). Override with `--to` flag if user wants all items in one store.
89
+
90
+ **Next-step routing on completion:**
91
+ - Review wiki entries → `maestro wiki list --type note`
92
+ - Connect wiki graph → `Skill({ skill: "wiki-connect", args: "--fix" })`
93
+ - Triage issues → `Skill({ skill: "manage-issue", args: "list --source harvest" })`
94
+ - View specs → `Skill({ skill: "spec-load", args: "--category general" })`
95
+ - Full retrospective → `Skill({ skill: "quality-retrospective" })`
96
+ </execution>
97
+
98
+ <error_codes>
99
+ | Code | Severity | Condition | Recovery |
100
+ |------|----------|-----------|----------|
101
+ | E001 | error | `.workflow/` not initialized | Run `Skill({ skill: "maestro-init" })` first |
102
+ | E002 | error | Invalid `--to` target (must be: wiki, spec, issue, auto) | Display valid options |
103
+ | E003 | error | Invalid `--source` type | Display valid source types from registry |
104
+ | E004 | error | Session ID not found in any source path | Show available sessions with `--source all` |
105
+ | E005 | error | Path does not exist or contains no parseable artifacts | Verify path and file structure |
106
+ | W001 | warning | No harvestable artifacts found within `--recent` window | Widen time window or check `.workflow/` contents |
107
+ | W002 | warning | `maestro wiki create` failed — wiki entries saved to `.workflow/harvest/wiki-pending-*.md` | Apply pending entries manually or retry |
108
+ | W003 | warning | Some fragments below confidence threshold — logged but not routed | Lower `--min-confidence` to include |
109
+ | W004 | warning | Duplicate fragments skipped | Review harvest-log.jsonl for prior routing |
110
+ | W005 | warning | `.workflow/issues/` directory missing | Auto-create directory and empty issues.jsonl |
111
+ </error_codes>
112
+
113
+ <success_criteria>
114
+ - [ ] Mode correctly resolved (scan / session / path)
115
+ - [ ] Source artifacts discovered and listed with metadata
116
+ - [ ] User selected artifact(s) to harvest (or auto-selected via session/path mode)
117
+ - [ ] All files in selected artifacts loaded and parsed
118
+ - [ ] Knowledge fragments extracted with category, confidence, tags
119
+ - [ ] Fragments filtered by `--min-confidence`
120
+ - [ ] Routing classification applied (auto or forced by `--to`)
121
+ - [ ] Dedup check passed against harvest-log.jsonl and existing stores
122
+ - [ ] If `--dry-run`: preview displayed, no files written
123
+ - [ ] If not dry-run: all routed items written to target stores
124
+ - [ ] Wiki entries created via `maestro wiki create` (or fallback to pending files)
125
+ - [ ] Spec entries added via `spec-add` mechanism
126
+ - [ ] Issue entries appended to `issues.jsonl` with canonical schema
127
+ - [ ] `harvest-log.jsonl` updated with provenance for each routed item
128
+ - [ ] `harvest-report-{date}.md` written with full summary
129
+ - [ ] No source artifacts modified
130
+ - [ ] Summary displayed with counts and next-step routing
131
+ </success_criteria>
@@ -0,0 +1,266 @@
1
+ ---
2
+ name: team-coordinate
3
+ description: Universal team coordination skill with dynamic role generation. Uses team-worker agent architecture with role-spec files. Only coordinator is built-in -- all worker roles are generated at runtime as role-specs and spawned via team-worker agent. Beat/cadence model for orchestration. Triggers on "Team Coordinate ".
4
+ allowed-tools: TeamCreate(*), TeamDelete(*), SendMessage(*), TaskCreate(*), TaskUpdate(*), TaskList(*), TaskGet(*), Agent(*), AskUserQuestion(*), Read(*), Write(*), Edit(*), Bash(*), Glob(*), Grep(*), mcp__ccw-tools__team_msg(*)
5
+ ---
6
+
7
+ # Team Coordinate
8
+
9
+ Universal team coordination skill: analyze task -> generate role-specs -> dispatch -> execute -> deliver. Only the **coordinator** is built-in. All worker roles are **dynamically generated** as lightweight role-spec files and spawned via the `team-worker` agent.
10
+
11
+
12
+ ## Architecture
13
+
14
+ ```
15
+ +---------------------------------------------------+
16
+ | Skill(skill="team-coordinate") |
17
+ | args="task description" |
18
+ +-------------------+-------------------------------+
19
+ |
20
+ Orchestration Mode (auto -> coordinator)
21
+ |
22
+ Coordinator (built-in)
23
+ Phase 0-5 orchestration
24
+ |
25
+ +-------+-------+-------+-------+
26
+ v v v v v
27
+ [team-worker agents, each loaded with a dynamic role-spec]
28
+ (roles generated at runtime from task analysis)
29
+
30
+ CLI Tools (callable by any worker):
31
+ maestro cli --mode analysis - analysis and exploration
32
+ maestro cli --mode write - code generation and modification
33
+ ```
34
+
35
+ ## Shared Constants
36
+
37
+ | Constant | Value |
38
+ |----------|-------|
39
+ | Session prefix | `TC` |
40
+ | Session path | `.workflow/.team/TC-<slug>-<date>/` |
41
+ | Worker agent | `team-worker` |
42
+ | Message bus | `mcp__ccw-tools__team_msg(session_id=<session-id>, ...)` |
43
+ | CLI analysis | `maestro cli --mode analysis` |
44
+ | CLI write | `maestro cli --mode write` |
45
+ | Max roles | 5 |
46
+
47
+ ## Role Router
48
+
49
+ This skill is **coordinator-only**. Workers do NOT invoke this skill -- they are spawned as `team-worker` agents directly.
50
+
51
+ ### Input Parsing
52
+
53
+ Parse `$ARGUMENTS`. No `--role` needed -- always routes to coordinator.
54
+
55
+ ### Role Registry
56
+
57
+ Only coordinator is statically registered. All other roles are dynamic, stored as role-specs in session.
58
+
59
+ | Role | File | Type |
60
+ |------|------|------|
61
+ | coordinator | [roles/coordinator/role.md](roles/coordinator/role.md) | built-in orchestrator |
62
+ | (dynamic) | `<session>/role-specs/<role-name>.md` | runtime-generated role-spec |
63
+
64
+ ### CLI Tool Usage
65
+
66
+ Workers can use CLI tools for analysis and code operations:
67
+
68
+ | Tool | Purpose |
69
+ |------|---------|
70
+ | maestro cli --mode analysis | Analysis, exploration, pattern discovery |
71
+ | maestro cli --mode write | Code generation, modification, refactoring |
72
+
73
+ ### Dispatch
74
+
75
+ Always route to coordinator. Coordinator reads `roles/coordinator/role.md` and executes its phases.
76
+
77
+ ### Orchestration Mode
78
+
79
+ User just provides task description.
80
+
81
+ **Invocation**: `Skill(skill="team-coordinate", args="task description")`
82
+
83
+ **Lifecycle**:
84
+ ```
85
+ User provides task description
86
+ -> coordinator Phase 1: task analysis (detect capabilities, build dependency graph)
87
+ -> coordinator Phase 2: generate role-specs + initialize session
88
+ -> coordinator Phase 3: create task chain from dependency graph
89
+ -> coordinator Phase 4: spawn first batch workers (background) -> STOP
90
+ -> Worker executes -> SendMessage callback -> coordinator advances next step
91
+ -> Loop until pipeline complete -> Phase 5 report + completion action
92
+ ```
93
+
94
+ **User Commands** (wake paused coordinator):
95
+
96
+ | Command | Action |
97
+ |---------|--------|
98
+ | `check` / `status` | Output execution status graph, no advancement |
99
+ | `resume` / `continue` | Check worker states, advance next step |
100
+ | `revise <TASK-ID> [feedback]` | Revise specific task with optional feedback |
101
+ | `feedback <text>` | Inject feedback into active pipeline |
102
+ | `improve [dimension]` | Auto-improve weakest quality dimension |
103
+
104
+ ---
105
+
106
+ ## Coordinator Spawn Template
107
+
108
+ ### v2 Worker Spawn (all roles)
109
+
110
+ When coordinator spawns workers, use `team-worker` agent with role-spec path:
111
+
112
+ ```
113
+ Agent({
114
+ subagent_type: "team-worker",
115
+ description: "Spawn <role> worker",
116
+ team_name: <team-name>,
117
+ name: "<role>",
118
+ run_in_background: true,
119
+ prompt: `## Role Assignment
120
+ role: <role>
121
+ role_spec: <session-folder>/role-specs/<role>.md
122
+ session: <session-folder>
123
+ session_id: <session-id>
124
+ team_name: <team-name>
125
+ requirement: <task-description>
126
+ inner_loop: <true|false>
127
+
128
+ ## Progress Milestones
129
+ session_id: <session-id>
130
+ Report progress via team_msg at natural phase boundaries (context loaded -> core work done -> verification).
131
+ Report blockers immediately via team_msg type="blocker".
132
+ Report completion via team_msg type="task_complete" after final SendMessage.
133
+
134
+ Read role_spec file to load Phase 2-4 domain instructions.
135
+ Execute built-in Phase 1 (task discovery) -> role-spec Phase 2-4 -> built-in Phase 5 (report).`
136
+ })
137
+ ```
138
+
139
+ **Inner Loop roles** (role has 2+ serial same-prefix tasks): Set `inner_loop: true`. The team-worker agent handles the loop internally.
140
+
141
+ **Single-task roles**: Set `inner_loop: false`.
142
+
143
+ ---
144
+
145
+ ## Completion Action
146
+
147
+ When pipeline completes (all tasks done), coordinator presents an interactive choice:
148
+
149
+ ```
150
+ AskUserQuestion({
151
+ questions: [{
152
+ question: "Team pipeline complete. What would you like to do?",
153
+ header: "Completion",
154
+ multiSelect: false,
155
+ options: [
156
+ { label: "Archive & Clean (Recommended)", description: "Archive session, clean up team" },
157
+ { label: "Keep Active", description: "Keep session for follow-up work" },
158
+ { label: "Export Results", description: "Export deliverables to target directory, then clean" }
159
+ ]
160
+ }]
161
+ })
162
+ ```
163
+
164
+ ### Action Handlers
165
+
166
+ | Choice | Steps |
167
+ |--------|-------|
168
+ | Archive & Clean | Update session status="completed" -> TeamDelete -> output final summary with artifact paths |
169
+ | Keep Active | Update session status="paused" -> output: "Resume with: Skill(skill='team-coordinate', args='resume')" |
170
+ | Export Results | AskUserQuestion(target path) -> copy artifacts to target -> Archive & Clean |
171
+
172
+ ---
173
+
174
+ ## Specs Reference
175
+
176
+ | Spec | Purpose |
177
+ |------|---------|
178
+ | [specs/pipelines.md](specs/pipelines.md) | Dynamic pipeline model, task naming, dependency graph |
179
+ | [specs/role-spec-template.md](specs/role-spec-template.md) | Template for dynamic role-spec generation |
180
+ | [specs/quality-gates.md](specs/quality-gates.md) | Quality thresholds and scoring dimensions |
181
+ | [specs/knowledge-transfer.md](specs/knowledge-transfer.md) | Context transfer protocols between roles |
182
+
183
+ ---
184
+
185
+ ## Session Directory
186
+
187
+ ```
188
+ .workflow/.team/TC-<slug>-<date>/
189
+ +-- team-session.json # Session state + dynamic role registry
190
+ +-- task-analysis.json # Phase 1 output: capabilities, dependency graph
191
+ +-- role-specs/ # Dynamic role-spec definitions (generated Phase 2)
192
+ | +-- <role-1>.md # Lightweight: frontmatter + Phase 2-4 only
193
+ | +-- <role-2>.md
194
+ +-- artifacts/ # All MD deliverables from workers
195
+ | +-- <artifact>.md
196
+ +-- .msg/ # Team message bus + state
197
+ | +-- messages.jsonl # Message log
198
+ | +-- meta.json # Session metadata + cross-role state
199
+ +-- wisdom/ # Cross-task knowledge
200
+ | +-- learnings.md
201
+ | +-- decisions.md
202
+ | +-- issues.md
203
+ +-- explorations/ # Shared explore cache
204
+ | +-- cache-index.json
205
+ | +-- explore-<angle>.json
206
+ +-- discussions/ # Inline discuss records
207
+ | +-- <round>.md
208
+ ```
209
+
210
+ ### team-session.json Schema
211
+
212
+ ```json
213
+ {
214
+ "session_id": "TC-<slug>-<date>",
215
+ "task_description": "<original user input>",
216
+ "status": "active | paused | completed",
217
+ "team_name": "<team-name>",
218
+ "roles": [
219
+ {
220
+ "name": "<role-name>",
221
+ "prefix": "<PREFIX>",
222
+ "responsibility_type": "<type>",
223
+ "inner_loop": false,
224
+ "role_spec": "role-specs/<role-name>.md"
225
+ }
226
+ ],
227
+ "pipeline": {
228
+ "dependency_graph": {},
229
+ "tasks_total": 0,
230
+ "tasks_completed": 0
231
+ },
232
+ "active_workers": [],
233
+ "completed_tasks": [],
234
+ "completion_action": "interactive",
235
+ "created_at": "<timestamp>"
236
+ }
237
+ ```
238
+
239
+ ---
240
+
241
+ ## Session Resume
242
+
243
+ Coordinator supports `resume` / `continue` for interrupted sessions:
244
+
245
+ 1. Scan `.workflow/.team/TC-*/team-session.json` for active/paused sessions
246
+ 2. Multiple matches -> AskUserQuestion for selection
247
+ 3. Audit TaskList -> reconcile session state <-> task status
248
+ 4. Reset in_progress -> pending (interrupted tasks)
249
+ 5. Rebuild team and spawn needed workers only
250
+ 6. Create missing tasks, set dependencies via TaskUpdate({ addBlockedBy })
251
+ 7. Kick first executable task -> Phase 4 coordination loop
252
+
253
+ ---
254
+
255
+ ## Error Handling
256
+
257
+ | Scenario | Resolution |
258
+ |----------|------------|
259
+ | Unknown command | Error with available command list |
260
+ | Dynamic role-spec not found | Error, coordinator may need to regenerate |
261
+ | Command file not found | Fallback to inline execution |
262
+ | CLI tool fails | Worker proceeds with direct implementation, logs warning |
263
+ | Explore cache corrupt | Clear cache, re-explore |
264
+ | Fast-advance spawns wrong task | Coordinator reconciles on next callback |
265
+ | capability_gap reported | Coordinator generates new role-spec via handleAdapt |
266
+ | Completion action fails | Default to Keep Active, log warning |