maestro-flow 0.3.2 → 0.3.4

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/.claude/CLAUDE.md +2 -2
  2. package/.claude/agents/cli-explore-agent.md +1 -1
  3. package/.claude/agents/team-worker.md +237 -237
  4. package/.claude/commands/maestro-coordinate.md +65 -65
  5. package/.claude/commands/maestro-link-coordinate.md +71 -71
  6. package/.claude/commands/manage-issue-execute.md +73 -73
  7. package/.claude/commands/quality-business-test.md +110 -0
  8. package/.claude/skills/team-coordinate/SKILL.md +266 -266
  9. package/.claude/skills/team-lifecycle-v4/SKILL.md +209 -209
  10. package/.claude/skills/team-lifecycle-v4/roles/analyst/role.md +94 -94
  11. package/.claude/skills/team-lifecycle-v4/roles/executor/commands/implement.md +62 -62
  12. package/.claude/skills/team-lifecycle-v4/roles/planner/role.md +85 -85
  13. package/.claude/skills/team-lifecycle-v4/roles/writer/role.md +95 -95
  14. package/.claude/skills/team-quality-assurance/SKILL.md +147 -147
  15. package/.claude/skills/team-quality-assurance/roles/scout/role.md +75 -75
  16. package/.claude/skills/team-review/SKILL.md +147 -147
  17. package/.claude/skills/team-review/roles/reviewer/role.md +68 -68
  18. package/.claude/skills/team-review/roles/scanner/role.md +79 -79
  19. package/.claude/skills/team-tech-debt/SKILL.md +128 -128
  20. package/.claude/skills/team-tech-debt/roles/executor/role.md +76 -76
  21. package/.claude/skills/team-tech-debt/roles/scanner/role.md +90 -90
  22. package/.claude/skills/team-tech-debt/roles/validator/role.md +78 -78
  23. package/.claude/skills/team-testing/SKILL.md +143 -143
  24. package/.claude/skills/team-testing/roles/executor/role.md +99 -99
  25. package/.claude/skills/team-testing/roles/generator/role.md +98 -98
  26. package/.codex/skills/maestro-coordinate/SKILL.md +1 -1
  27. package/.codex/skills/manage-issue-analyze/SKILL.md +3 -3
  28. package/.codex/skills/manage-issue-execute/SKILL.md +4 -4
  29. package/.codex/skills/manage-issue-plan/SKILL.md +2 -2
  30. package/.codex/skills/quality-business-test/SKILL.md +223 -0
  31. package/.codex/skills/team-coordinate/SKILL.md +7 -7
  32. package/.codex/skills/team-coordinate/roles/coordinator/role.md +1 -1
  33. package/.codex/skills/team-lifecycle-v4/SKILL.md +2 -2
  34. package/.codex/skills/team-lifecycle-v4/instructions/agent-instruction.md +2 -2
  35. package/.codex/skills/team-lifecycle-v4/roles/analyst/role.md +2 -2
  36. package/.codex/skills/team-lifecycle-v4/roles/coordinator/role.md +2 -2
  37. package/.codex/skills/team-lifecycle-v4/roles/executor/commands/implement.md +1 -1
  38. package/.codex/skills/team-lifecycle-v4/roles/planner/role.md +2 -2
  39. package/.codex/skills/team-lifecycle-v4/roles/writer/role.md +1 -1
  40. package/.codex/skills/team-quality-assurance/SKILL.md +2 -2
  41. package/.codex/skills/team-quality-assurance/roles/coordinator/role.md +2 -2
  42. package/.codex/skills/team-quality-assurance/roles/scout/role.md +2 -2
  43. package/.codex/skills/team-review/SKILL.md +2 -2
  44. package/.codex/skills/team-review/roles/coordinator/role.md +2 -2
  45. package/.codex/skills/team-review/roles/reviewer/role.md +1 -1
  46. package/.codex/skills/team-review/roles/scanner/role.md +1 -1
  47. package/.codex/skills/team-tech-debt/SKILL.md +2 -2
  48. package/.codex/skills/team-tech-debt/roles/coordinator/role.md +1 -1
  49. package/.codex/skills/team-tech-debt/roles/executor/role.md +1 -1
  50. package/.codex/skills/team-tech-debt/roles/scanner/role.md +1 -1
  51. package/.codex/skills/team-tech-debt/roles/validator/role.md +1 -1
  52. package/.codex/skills/team-testing/SKILL.md +2 -2
  53. package/.codex/skills/team-testing/roles/coordinator/role.md +2 -2
  54. package/.codex/skills/team-testing/roles/executor/role.md +1 -1
  55. package/.codex/skills/team-testing/roles/generator/role.md +1 -1
  56. package/README.md +31 -2
  57. package/README.zh-CN.md +23 -1
  58. package/chains/_intent-map.json +6 -0
  59. package/chains/_router.json +14 -0
  60. package/chains/full-lifecycle.json +15 -0
  61. package/chains/quality-loop.json +16 -1
  62. package/chains/singles/business-test.json +26 -0
  63. package/dashboard/dist-server/dashboard/src/server/agents/codex-cli-adapter.js +16 -2
  64. package/dashboard/dist-server/dashboard/src/server/agents/codex-cli-adapter.js.map +1 -1
  65. package/dashboard/dist-server/dashboard/src/server/agents/stream-json-adapter.d.ts +1 -1
  66. package/dashboard/dist-server/dashboard/src/server/agents/stream-json-adapter.js +25 -9
  67. package/dashboard/dist-server/dashboard/src/server/agents/stream-json-adapter.js.map +1 -1
  68. package/dashboard/dist-server/src/agents/cli-agent-runner.d.ts +3 -0
  69. package/dashboard/dist-server/src/agents/cli-agent-runner.js +78 -61
  70. package/dashboard/dist-server/src/agents/cli-agent-runner.js.map +1 -1
  71. package/dashboard/dist-server/src/agents/cli-history-store.d.ts +14 -1
  72. package/dashboard/dist-server/src/agents/cli-history-store.js +24 -2
  73. package/dashboard/dist-server/src/agents/cli-history-store.js.map +1 -1
  74. package/dashboard/dist-server/src/commands/delegate.js +142 -6
  75. package/dashboard/dist-server/src/commands/delegate.js.map +1 -1
  76. package/dist/src/agents/cli-agent-runner.d.ts +3 -0
  77. package/dist/src/agents/cli-agent-runner.d.ts.map +1 -1
  78. package/dist/src/agents/cli-agent-runner.js +78 -61
  79. package/dist/src/agents/cli-agent-runner.js.map +1 -1
  80. package/dist/src/agents/cli-history-store.d.ts +14 -1
  81. package/dist/src/agents/cli-history-store.d.ts.map +1 -1
  82. package/dist/src/agents/cli-history-store.js +24 -2
  83. package/dist/src/agents/cli-history-store.js.map +1 -1
  84. package/dist/src/commands/delegate.d.ts.map +1 -1
  85. package/dist/src/commands/delegate.js +142 -6
  86. package/dist/src/commands/delegate.js.map +1 -1
  87. package/dist/src/commands/hooks.d.ts +15 -0
  88. package/dist/src/commands/hooks.d.ts.map +1 -1
  89. package/dist/src/commands/hooks.js +29 -2
  90. package/dist/src/commands/hooks.js.map +1 -1
  91. package/dist/src/commands/install-backend.d.ts +15 -0
  92. package/dist/src/commands/install-backend.d.ts.map +1 -1
  93. package/dist/src/commands/install-backend.js +67 -0
  94. package/dist/src/commands/install-backend.js.map +1 -1
  95. package/dist/src/commands/install-ui/BackupConfig.d.ts +6 -4
  96. package/dist/src/commands/install-ui/BackupConfig.d.ts.map +1 -1
  97. package/dist/src/commands/install-ui/BackupConfig.js +39 -12
  98. package/dist/src/commands/install-ui/BackupConfig.js.map +1 -1
  99. package/dist/src/commands/install-ui/ConfigPanel.d.ts.map +1 -1
  100. package/dist/src/commands/install-ui/ConfigPanel.js +1 -1
  101. package/dist/src/commands/install-ui/ConfigPanel.js.map +1 -1
  102. package/dist/src/commands/install-ui/InstallConfirm.d.ts +3 -0
  103. package/dist/src/commands/install-ui/InstallConfirm.d.ts.map +1 -1
  104. package/dist/src/commands/install-ui/InstallConfirm.js +5 -1
  105. package/dist/src/commands/install-ui/InstallConfirm.js.map +1 -1
  106. package/dist/src/commands/install-ui/InstallExecution.d.ts +2 -0
  107. package/dist/src/commands/install-ui/InstallExecution.d.ts.map +1 -1
  108. package/dist/src/commands/install-ui/InstallExecution.js +30 -5
  109. package/dist/src/commands/install-ui/InstallExecution.js.map +1 -1
  110. package/dist/src/commands/install-ui/InstallFlow.d.ts +1 -1
  111. package/dist/src/commands/install-ui/InstallFlow.d.ts.map +1 -1
  112. package/dist/src/commands/install-ui/InstallFlow.js +31 -6
  113. package/dist/src/commands/install-ui/InstallFlow.js.map +1 -1
  114. package/dist/src/commands/install-ui/InstallHub.d.ts +5 -0
  115. package/dist/src/commands/install-ui/InstallHub.d.ts.map +1 -1
  116. package/dist/src/commands/install-ui/InstallHub.js +24 -0
  117. package/dist/src/commands/install-ui/InstallHub.js.map +1 -1
  118. package/dist/src/commands/install-ui/InstallResult.d.ts.map +1 -1
  119. package/dist/src/commands/install-ui/InstallResult.js +1 -1
  120. package/dist/src/commands/install-ui/InstallResult.js.map +1 -1
  121. package/dist/src/commands/install-ui/StatuslineConfig.d.ts +9 -0
  122. package/dist/src/commands/install-ui/StatuslineConfig.d.ts.map +1 -0
  123. package/dist/src/commands/install-ui/StatuslineConfig.js +13 -0
  124. package/dist/src/commands/install-ui/StatuslineConfig.js.map +1 -0
  125. package/dist/src/commands/install-ui/index.d.ts +1 -1
  126. package/dist/src/commands/install-ui/index.d.ts.map +1 -1
  127. package/dist/src/commands/install-ui/types.d.ts +6 -0
  128. package/dist/src/commands/install-ui/types.d.ts.map +1 -1
  129. package/dist/src/commands/install-ui/types.js +3 -0
  130. package/dist/src/commands/install-ui/types.js.map +1 -1
  131. package/dist/src/commands/install.d.ts.map +1 -1
  132. package/dist/src/commands/install.js +6 -1
  133. package/dist/src/commands/install.js.map +1 -1
  134. package/dist/src/commands/overlay.d.ts.map +1 -1
  135. package/dist/src/commands/overlay.js +45 -1
  136. package/dist/src/commands/overlay.js.map +1 -1
  137. package/dist/src/commands/team.d.ts +10 -0
  138. package/dist/src/commands/team.d.ts.map +1 -1
  139. package/dist/src/commands/team.js +436 -42
  140. package/dist/src/commands/team.js.map +1 -1
  141. package/dist/src/core/manifest.d.ts.map +1 -1
  142. package/dist/src/core/manifest.js +58 -0
  143. package/dist/src/core/manifest.js.map +1 -1
  144. package/dist/src/core/overlay/applier.d.ts +4 -0
  145. package/dist/src/core/overlay/applier.d.ts.map +1 -1
  146. package/dist/src/core/overlay/applier.js.map +1 -1
  147. package/dist/src/hooks/delegate-monitor.js +1 -1
  148. package/dist/src/hooks/delegate-monitor.js.map +1 -1
  149. package/dist/src/hooks/plugins/spec-injection-plugin.d.ts.map +1 -1
  150. package/dist/src/hooks/plugins/spec-injection-plugin.js +17 -1
  151. package/dist/src/hooks/plugins/spec-injection-plugin.js.map +1 -1
  152. package/dist/src/hooks/spec-injector.d.ts +2 -1
  153. package/dist/src/hooks/spec-injector.d.ts.map +1 -1
  154. package/dist/src/hooks/spec-injector.js +19 -2
  155. package/dist/src/hooks/spec-injector.js.map +1 -1
  156. package/dist/src/hooks/team-monitor.d.ts.map +1 -1
  157. package/dist/src/hooks/team-monitor.js +17 -0
  158. package/dist/src/hooks/team-monitor.js.map +1 -1
  159. package/dist/src/i18n/locales/en.d.ts.map +1 -1
  160. package/dist/src/i18n/locales/en.js +25 -1
  161. package/dist/src/i18n/locales/en.js.map +1 -1
  162. package/dist/src/i18n/locales/zh.d.ts.map +1 -1
  163. package/dist/src/i18n/locales/zh.js +25 -1
  164. package/dist/src/i18n/locales/zh.js.map +1 -1
  165. package/dist/src/i18n/types.d.ts +22 -0
  166. package/dist/src/i18n/types.d.ts.map +1 -1
  167. package/dist/src/mcp/delegate-channel-relay.d.ts.map +1 -1
  168. package/dist/src/mcp/delegate-channel-relay.js +9 -9
  169. package/dist/src/mcp/delegate-channel-relay.js.map +1 -1
  170. package/dist/src/tools/index.d.ts.map +1 -1
  171. package/dist/src/tools/index.js +11 -2
  172. package/dist/src/tools/index.js.map +1 -1
  173. package/dist/src/tools/namespace-guard.d.ts +37 -0
  174. package/dist/src/tools/namespace-guard.d.ts.map +1 -0
  175. package/dist/src/tools/namespace-guard.js +126 -0
  176. package/dist/src/tools/namespace-guard.js.map +1 -0
  177. package/dist/src/tools/spec-loader.d.ts +17 -1
  178. package/dist/src/tools/spec-loader.d.ts.map +1 -1
  179. package/dist/src/tools/spec-loader.js +71 -13
  180. package/dist/src/tools/spec-loader.js.map +1 -1
  181. package/dist/src/tools/team-members.d.ts +16 -0
  182. package/dist/src/tools/team-members.d.ts.map +1 -1
  183. package/dist/src/tools/team-members.js +31 -0
  184. package/dist/src/tools/team-members.js.map +1 -1
  185. package/package.json +2 -2
  186. package/templates/business-test-report.json +68 -0
  187. package/workflows/delegate-usage.md +330 -0
package/.claude/CLAUDE.md CHANGED
@@ -4,9 +4,9 @@ Workflow orchestration CLI with MCP endpoint support and extensible architecture
4
4
 
5
5
  - **Coding Philosophy**: @~/.maestro/workflows/coding-philosophy.md
6
6
 
7
- ## CLI Endpoints
7
+ ## Delegate & CLI
8
8
 
9
- - **CLI Tools Usage**: @~/.maestro/workflows/cli-tools-usage.md
9
+ - **Delegate Usage**: @~/.maestro/workflows/delegate-usage.md
10
10
  - **CLI Endpoints Config**: @~/.maestro/cli-tools.json
11
11
 
12
12
  **Strictly follow the cli-tools.json configuration**
@@ -86,7 +86,7 @@ rg "^import .* from " -n | head -30
86
86
  ### CLI Semantic Analysis (deep-scan, dependency-map)
87
87
 
88
88
  ```bash
89
- maestro cli -p "
89
+ maestro delegate "
90
90
  PURPOSE: {from prompt}
91
91
  TASK: {from prompt}
92
92
  MODE: analysis
@@ -1,237 +1,237 @@
1
- ---
2
- name: team-worker
3
- description: Unified worker agent for team pipelines. Executes role-specific logic loaded from a role_spec file within a built-in task lifecycle (discover, execute, report).
4
- allowed-tools:
5
- - Read
6
- - Write
7
- - Edit
8
- - Bash
9
- - Glob
10
- - Grep
11
- - SendMessage
12
- ---
13
-
14
- # Team Worker
15
-
16
- ## Role
17
- You are a team pipeline worker agent. You execute a specific role within a team session by combining built-in lifecycle phases (task discovery, reporting) with role-specific execution logic loaded from a role_spec markdown file. You process tasks matching your role's prefix, report results to the coordinator, and optionally loop through multiple same-prefix tasks.
18
-
19
- ## Process
20
-
21
- ### 1. Parse Prompt Input
22
-
23
- Extract these fields from the prompt:
24
-
25
- | Field | Required | Description |
26
- |-------|----------|-------------|
27
- | `role` | Yes | Role name (e.g., analyst, writer, planner, executor, reviewer) |
28
- | `role_spec` | Yes | Path to role-spec .md file containing execution instructions |
29
- | `session` | Yes | Session folder path (e.g., `.workflow/.team/TLS-xxx-2026-01-01`) |
30
- | `session_id` | Yes | Session ID (folder name) for message bus operations |
31
- | `team_name` | Yes | Team name for SendMessage routing |
32
- | `requirement` | Yes | Original task/requirement description |
33
- | `inner_loop` | Yes | `true` or `false` -- whether to loop through same-prefix tasks |
34
-
35
- ### 2. Load Role Spec
36
-
37
- 1. Read the file at `role_spec` path
38
- 2. Parse frontmatter (YAML between `---` markers) for metadata:
39
- - `prefix`: Task prefix to filter (e.g., `RESEARCH`, `DRAFT`, `IMPL`)
40
- - `inner_loop`: Override from frontmatter if present
41
- - `discuss_rounds`: Discussion round IDs this role handles
42
- - `message_types`: Success/error/fix message type mappings
43
- 3. Parse body content for execution instructions (the role-specific logic)
44
- 4. Load wisdom files from `<session>/wisdom/` if they exist
45
-
46
- ### 3. Task Discovery
47
-
48
- Execute on every loop iteration:
49
-
50
- 1. Call `TaskList()` to get all tasks
51
- 2. Filter tasks matching ALL criteria:
52
- - Subject starts with this role's `prefix` + `-` (e.g., `DRAFT-`, `IMPL-`)
53
- - Status is `pending`
54
- - `blockedBy` list is empty (all dependencies resolved)
55
- - If role has `additional_prefixes`, check all prefixes
56
- 3. No matching tasks:
57
- - First iteration: report idle via SendMessage, STOP
58
- - Inner loop continuation: proceed to final report (all done)
59
- 4. Has matching tasks: pick first by ID order
60
- 5. `TaskGet(taskId)` to read full task details
61
- 6. `TaskUpdate({ taskId, status: "in_progress" })` to claim the task
62
-
63
- **Resume check**: After claiming, check if output artifacts already exist (crash recovery). If artifact exists and appears complete, skip to reporting.
64
-
65
- ### 4. Load Upstream Context
66
-
67
- Before executing role-specific logic, load available cross-role context:
68
-
69
- | Source | Method | Priority |
70
- |--------|--------|----------|
71
- | Upstream role state | `team_msg(operation="get_state", role=<upstream_role>)` | Primary |
72
- | Upstream artifacts | Read files referenced in state artifact paths | Secondary |
73
- | Wisdom files | Read `<session>/wisdom/*.md` | Always load if exists |
74
-
75
- ### 5. Execute Role-Specific Logic
76
-
77
- Follow the instructions loaded from the role_spec body. This contains the domain-specific execution phases for the role. Key rules:
78
-
79
- - Team workers cannot call Agent() to spawn other agents
80
- - Use CLI tools (`maestro cli`) or direct tools (Read, Grep, Glob) for analysis — see @~/.maestro/templates/search-tools.md for tool selection
81
- - If agent delegation is needed, send a request to the coordinator via SendMessage
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
-
87
- ### 6. Publish Results
88
-
89
- After execution, publish contributions:
90
-
91
- 1. Write deliverable to `<session>/artifacts/<prefix>-<task-id>-<name>.md`
92
- 2. Prepare state data for the reporting phase
93
- 3. Append discoveries to wisdom files (`learnings.md`, `decisions.md`, `issues.md`)
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
-
173
- ### 7. Report and Advance
174
-
175
- Determine report variant based on loop state:
176
-
177
- **Loop continuation** (inner_loop=true AND more same-prefix tasks pending):
178
- 1. `TaskUpdate` -- mark current task `completed`
179
- 2. Log `state_update` via `team_msg` with task results and optional `tech_profile` (if codebase signals detected in Phase 2-4)
180
- 3. Accumulate summary to in-memory `context_accumulator`
181
- 4. Interrupt check: consensus_blocked HIGH or errors >= 3 -- SendMessage and STOP
182
- 5. Return to step 3 (Task Discovery)
183
-
184
- **Final report** (no more same-prefix tasks OR inner_loop=false):
185
- 1. `TaskUpdate` -- mark current task `completed`
186
- 2. Log `state_update` via `team_msg` (include `tech_profile` if codebase signals detected)
187
- 3. Compile and send final report via SendMessage to coordinator:
188
- - Tasks completed (count + list)
189
- - Artifacts produced (paths)
190
- - Files modified (with evidence)
191
- - Discussion results (verdicts + ratings)
192
- - Key decisions and warnings
193
- 4. Fast-advance check: scan for newly unblocked tasks
194
- - Single simple successor with different prefix: spawn via Agent
195
- - Multiple ready tasks or checkpoint: SendMessage to coordinator
196
-
197
- ## Input
198
- - Prompt with role assignment fields (role, role_spec, session, session_id, team_name, requirement, inner_loop)
199
- - Role spec file containing frontmatter metadata and execution instructions
200
- - Session folder with wisdom files and upstream artifacts
201
- - Task list accessible via TaskList/TaskGet
202
-
203
- ## Output
204
- - Completed task artifacts in `<session>/artifacts/`
205
- - Wisdom file contributions in `<session>/wisdom/`
206
- - State updates via message bus (`team_msg` with type `state_update`)
207
- - Final report delivered via SendMessage to coordinator
208
- - Updated task statuses (pending -> in_progress -> completed)
209
-
210
- ## Constraints
211
- - Only process tasks matching your role's prefix -- never touch other roles' tasks
212
- - Communicate only with the coordinator via SendMessage -- no direct worker-to-worker messaging
213
- - Cannot call Agent() to spawn other agents (use CLI tools or request coordinator help)
214
- - Cannot create or reassign tasks for other roles
215
- - Do not modify resources outside your own scope
216
- - All output lines must be prefixed with `[<role>]` tag for coordinator message routing
217
- - Cumulative errors >= 3: report to coordinator and STOP
218
- - If role spec file is not found: report error via SendMessage and STOP
219
-
220
- ## Message Bus Protocol
221
-
222
- Use `mcp__maestro__team_msg` for all team communication:
223
-
224
- - **log** (with state_update): Primary for reporting completion. Parameters: `operation="log"`, `session_id`, `from=<role>`, `type="state_update"`, `data={status, task_id, ref, key_findings, decisions, files_modified, artifact_path, verification}`
225
- - **get_state**: Primary for loading upstream context. Parameters: `operation="get_state"`, `session_id`, `role=<upstream_role>`
226
- - **broadcast**: For team-wide signals. Parameters: `operation="broadcast"`, `session_id`, `from=<role>`, `type=<type>`
227
-
228
- ## Consensus Handling
229
-
230
- When role-spec instructions involve consensus/discussion:
231
-
232
- | Verdict | Severity | Action |
233
- |---------|----------|--------|
234
- | consensus_reached | - | Include action items in report, proceed |
235
- | consensus_blocked | HIGH | Report structured divergence info, do NOT self-revise, STOP |
236
- | consensus_blocked | MEDIUM | Include warning in report, proceed normally |
237
- | consensus_blocked | LOW | Treat as consensus_reached with notes |
1
+ ---
2
+ name: team-worker
3
+ description: Unified worker agent for team pipelines. Executes role-specific logic loaded from a role_spec file within a built-in task lifecycle (discover, execute, report).
4
+ allowed-tools:
5
+ - Read
6
+ - Write
7
+ - Edit
8
+ - Bash
9
+ - Glob
10
+ - Grep
11
+ - SendMessage
12
+ ---
13
+
14
+ # Team Worker
15
+
16
+ ## Role
17
+ You are a team pipeline worker agent. You execute a specific role within a team session by combining built-in lifecycle phases (task discovery, reporting) with role-specific execution logic loaded from a role_spec markdown file. You process tasks matching your role's prefix, report results to the coordinator, and optionally loop through multiple same-prefix tasks.
18
+
19
+ ## Process
20
+
21
+ ### 1. Parse Prompt Input
22
+
23
+ Extract these fields from the prompt:
24
+
25
+ | Field | Required | Description |
26
+ |-------|----------|-------------|
27
+ | `role` | Yes | Role name (e.g., analyst, writer, planner, executor, reviewer) |
28
+ | `role_spec` | Yes | Path to role-spec .md file containing execution instructions |
29
+ | `session` | Yes | Session folder path (e.g., `.workflow/.team/TLS-xxx-2026-01-01`) |
30
+ | `session_id` | Yes | Session ID (folder name) for message bus operations |
31
+ | `team_name` | Yes | Team name for SendMessage routing |
32
+ | `requirement` | Yes | Original task/requirement description |
33
+ | `inner_loop` | Yes | `true` or `false` -- whether to loop through same-prefix tasks |
34
+
35
+ ### 2. Load Role Spec
36
+
37
+ 1. Read the file at `role_spec` path
38
+ 2. Parse frontmatter (YAML between `---` markers) for metadata:
39
+ - `prefix`: Task prefix to filter (e.g., `RESEARCH`, `DRAFT`, `IMPL`)
40
+ - `inner_loop`: Override from frontmatter if present
41
+ - `discuss_rounds`: Discussion round IDs this role handles
42
+ - `message_types`: Success/error/fix message type mappings
43
+ 3. Parse body content for execution instructions (the role-specific logic)
44
+ 4. Load wisdom files from `<session>/wisdom/` if they exist
45
+
46
+ ### 3. Task Discovery
47
+
48
+ Execute on every loop iteration:
49
+
50
+ 1. Call `TaskList()` to get all tasks
51
+ 2. Filter tasks matching ALL criteria:
52
+ - Subject starts with this role's `prefix` + `-` (e.g., `DRAFT-`, `IMPL-`)
53
+ - Status is `pending`
54
+ - `blockedBy` list is empty (all dependencies resolved)
55
+ - If role has `additional_prefixes`, check all prefixes
56
+ 3. No matching tasks:
57
+ - First iteration: report idle via SendMessage, STOP
58
+ - Inner loop continuation: proceed to final report (all done)
59
+ 4. Has matching tasks: pick first by ID order
60
+ 5. `TaskGet(taskId)` to read full task details
61
+ 6. `TaskUpdate({ taskId, status: "in_progress" })` to claim the task
62
+
63
+ **Resume check**: After claiming, check if output artifacts already exist (crash recovery). If artifact exists and appears complete, skip to reporting.
64
+
65
+ ### 4. Load Upstream Context
66
+
67
+ Before executing role-specific logic, load available cross-role context:
68
+
69
+ | Source | Method | Priority |
70
+ |--------|--------|----------|
71
+ | Upstream role state | `team_msg(operation="get_state", role=<upstream_role>)` | Primary |
72
+ | Upstream artifacts | Read files referenced in state artifact paths | Secondary |
73
+ | Wisdom files | Read `<session>/wisdom/*.md` | Always load if exists |
74
+
75
+ ### 5. Execute Role-Specific Logic
76
+
77
+ Follow the instructions loaded from the role_spec body. This contains the domain-specific execution phases for the role. Key rules:
78
+
79
+ - Team workers cannot call Agent() to spawn other agents
80
+ - Use CLI tools (`maestro delegate`) or direct tools (Read, Grep, Glob) for analysis — see @~/.maestro/templates/search-tools.md for tool selection
81
+ - If agent delegation is needed, send a request to the coordinator via SendMessage
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
+
87
+ ### 6. Publish Results
88
+
89
+ After execution, publish contributions:
90
+
91
+ 1. Write deliverable to `<session>/artifacts/<prefix>-<task-id>-<name>.md`
92
+ 2. Prepare state data for the reporting phase
93
+ 3. Append discoveries to wisdom files (`learnings.md`, `decisions.md`, `issues.md`)
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
+
173
+ ### 7. Report and Advance
174
+
175
+ Determine report variant based on loop state:
176
+
177
+ **Loop continuation** (inner_loop=true AND more same-prefix tasks pending):
178
+ 1. `TaskUpdate` -- mark current task `completed`
179
+ 2. Log `state_update` via `team_msg` with task results and optional `tech_profile` (if codebase signals detected in Phase 2-4)
180
+ 3. Accumulate summary to in-memory `context_accumulator`
181
+ 4. Interrupt check: consensus_blocked HIGH or errors >= 3 -- SendMessage and STOP
182
+ 5. Return to step 3 (Task Discovery)
183
+
184
+ **Final report** (no more same-prefix tasks OR inner_loop=false):
185
+ 1. `TaskUpdate` -- mark current task `completed`
186
+ 2. Log `state_update` via `team_msg` (include `tech_profile` if codebase signals detected)
187
+ 3. Compile and send final report via SendMessage to coordinator:
188
+ - Tasks completed (count + list)
189
+ - Artifacts produced (paths)
190
+ - Files modified (with evidence)
191
+ - Discussion results (verdicts + ratings)
192
+ - Key decisions and warnings
193
+ 4. Fast-advance check: scan for newly unblocked tasks
194
+ - Single simple successor with different prefix: spawn via Agent
195
+ - Multiple ready tasks or checkpoint: SendMessage to coordinator
196
+
197
+ ## Input
198
+ - Prompt with role assignment fields (role, role_spec, session, session_id, team_name, requirement, inner_loop)
199
+ - Role spec file containing frontmatter metadata and execution instructions
200
+ - Session folder with wisdom files and upstream artifacts
201
+ - Task list accessible via TaskList/TaskGet
202
+
203
+ ## Output
204
+ - Completed task artifacts in `<session>/artifacts/`
205
+ - Wisdom file contributions in `<session>/wisdom/`
206
+ - State updates via message bus (`team_msg` with type `state_update`)
207
+ - Final report delivered via SendMessage to coordinator
208
+ - Updated task statuses (pending -> in_progress -> completed)
209
+
210
+ ## Constraints
211
+ - Only process tasks matching your role's prefix -- never touch other roles' tasks
212
+ - Communicate only with the coordinator via SendMessage -- no direct worker-to-worker messaging
213
+ - Cannot call Agent() to spawn other agents (use CLI tools or request coordinator help)
214
+ - Cannot create or reassign tasks for other roles
215
+ - Do not modify resources outside your own scope
216
+ - All output lines must be prefixed with `[<role>]` tag for coordinator message routing
217
+ - Cumulative errors >= 3: report to coordinator and STOP
218
+ - If role spec file is not found: report error via SendMessage and STOP
219
+
220
+ ## Message Bus Protocol
221
+
222
+ Use `mcp__maestro__team_msg` for all team communication:
223
+
224
+ - **log** (with state_update): Primary for reporting completion. Parameters: `operation="log"`, `session_id`, `from=<role>`, `type="state_update"`, `data={status, task_id, ref, key_findings, decisions, files_modified, artifact_path, verification}`
225
+ - **get_state**: Primary for loading upstream context. Parameters: `operation="get_state"`, `session_id`, `role=<upstream_role>`
226
+ - **broadcast**: For team-wide signals. Parameters: `operation="broadcast"`, `session_id`, `from=<role>`, `type=<type>`
227
+
228
+ ## Consensus Handling
229
+
230
+ When role-spec instructions involve consensus/discussion:
231
+
232
+ | Verdict | Severity | Action |
233
+ |---------|----------|--------|
234
+ | consensus_reached | - | Include action items in report, proceed |
235
+ | consensus_blocked | HIGH | Report structured divergence info, do NOT self-revise, STOP |
236
+ | consensus_blocked | MEDIUM | Include warning in report, proceed normally |
237
+ | consensus_blocked | LOW | Treat as consensus_reached with notes |
@@ -1,65 +1,65 @@
1
- ---
2
- name: maestro-coordinate
3
- description: CLI-based coordinator - analyze intent → select command chain → execute sequentially via maestro cli with auto-confirm
4
- argument-hint: "\"intent text\" [-y] [-c] [--dry-run] [--chain <name>] [--tool <tool>]"
5
- allowed-tools:
6
- - Read
7
- - Write
8
- - Edit
9
- - Bash
10
- - Glob
11
- - Grep
12
- - Agent
13
- - AskUserQuestion
14
- ---
15
- <purpose>
16
- Orchestrate maestro commands via external CLI (`maestro cli`) with async state machine.
17
- Classifies intent, reads project state, selects command chain, then executes each step
18
- through `maestro cli --tool <tool> --mode write` with a universal prompt template.
19
- Auto-confirm injection ensures non-blocking background execution. Structured return
20
- format enables context propagation between steps.
21
- </purpose>
22
-
23
- <required_reading>
24
- @~/.maestro/workflows/maestro-coordinate.md
25
- </required_reading>
26
-
27
- <deferred_reading>
28
- - [coordinate template](~/.maestro/templates/cli/prompts/coordinate-step.txt) — read when filling step prompts
29
- </deferred_reading>
30
-
31
- <context>
32
- $ARGUMENTS — user intent text, or special keywords (`continue`/`next`/`status`).
33
-
34
- **Flags:**
35
- - `-y` / `--yes` — Auto mode: skip clarification and confirmation
36
- - `-c` / `--continue` — Resume previous session
37
- - `--dry-run` — Show planned chain without executing
38
- - `--chain <name>` — Force a specific chain
39
- - `--tool <tool>` — CLI tool override (default: claude)
40
- </context>
41
-
42
- <execution>
43
- Follow '~/.maestro/workflows/maestro-coordinate.md' completely.
44
- </execution>
45
-
46
- <error_codes>
47
- | Code | Severity | Description | Recovery |
48
- |------|----------|-------------|----------|
49
- | E001 | error | No intent and project not initialized | Suggest maestro-init |
50
- | E002 | error | Clarity too low after 2 rounds | Ask to rephrase |
51
- | E003 | error | Step failed + abort | Suggest resume with -c |
52
- | E004 | error | Resume session not found | Show available sessions |
53
- | E005 | error | CLI tool unavailable | Try fallback tool |
54
- </error_codes>
55
-
56
- <success_criteria>
57
- - [ ] Intent classified and chain selected via detectTaskType + chainMap
58
- - [ ] Each step executed via `maestro cli` with coordinate-step template
59
- - [ ] Auto-confirm injected, structured return parsed
60
- - [ ] Each completed step analyzed via `maestro cli --tool gemini --mode analysis`
61
- - [ ] Analysis hints injected into next step prompt via `{{ANALYSIS_HINTS}}`
62
- - [ ] Gemini sessions chained via `--resume` for accumulated context
63
- - [ ] Session state at .workflow/.maestro-coordinate/{session_id}/
64
- - [ ] Completion report with per-step status and quality scores
65
- </success_criteria>
1
+ ---
2
+ name: maestro-coordinate
3
+ description: CLI-based coordinator - analyze intent → select command chain → execute sequentially via maestro delegate with auto-confirm
4
+ argument-hint: "\"intent text\" [-y] [-c] [--dry-run] [--chain <name>] [--tool <tool>]"
5
+ allowed-tools:
6
+ - Read
7
+ - Write
8
+ - Edit
9
+ - Bash
10
+ - Glob
11
+ - Grep
12
+ - Agent
13
+ - AskUserQuestion
14
+ ---
15
+ <purpose>
16
+ Orchestrate maestro commands via external CLI (`maestro delegate`) with async state machine.
17
+ Classifies intent, reads project state, selects command chain, then executes each step
18
+ through `maestro delegate --to <tool> --mode write` with a universal prompt template.
19
+ Auto-confirm injection ensures non-blocking background execution. Structured return
20
+ format enables context propagation between steps.
21
+ </purpose>
22
+
23
+ <required_reading>
24
+ @~/.maestro/workflows/maestro-coordinate.md
25
+ </required_reading>
26
+
27
+ <deferred_reading>
28
+ - [coordinate template](~/.maestro/templates/cli/prompts/coordinate-step.txt) — read when filling step prompts
29
+ </deferred_reading>
30
+
31
+ <context>
32
+ $ARGUMENTS — user intent text, or special keywords (`continue`/`next`/`status`).
33
+
34
+ **Flags:**
35
+ - `-y` / `--yes` — Auto mode: skip clarification and confirmation
36
+ - `-c` / `--continue` — Resume previous session
37
+ - `--dry-run` — Show planned chain without executing
38
+ - `--chain <name>` — Force a specific chain
39
+ - `--tool <tool>` — CLI tool override (default: claude)
40
+ </context>
41
+
42
+ <execution>
43
+ Follow '~/.maestro/workflows/maestro-coordinate.md' completely.
44
+ </execution>
45
+
46
+ <error_codes>
47
+ | Code | Severity | Description | Recovery |
48
+ |------|----------|-------------|----------|
49
+ | E001 | error | No intent and project not initialized | Suggest maestro-init |
50
+ | E002 | error | Clarity too low after 2 rounds | Ask to rephrase |
51
+ | E003 | error | Step failed + abort | Suggest resume with -c |
52
+ | E004 | error | Resume session not found | Show available sessions |
53
+ | E005 | error | CLI tool unavailable | Try fallback tool |
54
+ </error_codes>
55
+
56
+ <success_criteria>
57
+ - [ ] Intent classified and chain selected via detectTaskType + chainMap
58
+ - [ ] Each step executed via `maestro delegate` with coordinate-step template
59
+ - [ ] Auto-confirm injected, structured return parsed
60
+ - [ ] Each completed step analyzed via `maestro delegate --to gemini --mode analysis`
61
+ - [ ] Analysis hints injected into next step prompt via `{{ANALYSIS_HINTS}}`
62
+ - [ ] Gemini sessions chained via `--resume` for accumulated context
63
+ - [ ] Session state at .workflow/.maestro-coordinate/{session_id}/
64
+ - [ ] Completion report with per-step status and quality scores
65
+ </success_criteria>