maestro-flow 0.4.6 → 0.4.8

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 (105) hide show
  1. package/.claude/commands/maestro-ralph.md +548 -377
  2. package/.claude/commands/maestro.md +220 -191
  3. package/.codex/skills/maestro/SKILL.md +495 -462
  4. package/.codex/skills/maestro-collab/SKILL.md +218 -117
  5. package/.codex/skills/maestro-execute/SKILL.md +13 -11
  6. package/.codex/skills/maestro-milestone-audit/SKILL.md +12 -10
  7. package/.codex/skills/maestro-ralph/SKILL.md +491 -339
  8. package/.codex/skills/maestro-ui-codify/SKILL.md +18 -16
  9. package/.codex/skills/manage-codebase-rebuild/SKILL.md +20 -13
  10. package/.codex/skills/manage-issue-discover/SKILL.md +19 -17
  11. package/.codex/skills/quality-debug/SKILL.md +35 -31
  12. package/.codex/skills/quality-refactor/SKILL.md +20 -12
  13. package/.codex/skills/quality-review/SKILL.md +21 -17
  14. package/.codex/skills/team-coordinate/SKILL.md +462 -235
  15. package/.codex/skills/team-coordinate/specs/role-catalog.md +132 -0
  16. package/.codex/skills/team-lifecycle-v4/SKILL.md +445 -191
  17. package/.codex/skills/team-quality-assurance/SKILL.md +205 -161
  18. package/.codex/skills/team-review/SKILL.md +198 -159
  19. package/.codex/skills/team-tech-debt/SKILL.md +214 -144
  20. package/.codex/skills/team-testing/SKILL.md +210 -158
  21. package/dashboard/dist-server/dashboard/src/server/agents/claude-code-adapter.js +25 -33
  22. package/dashboard/dist-server/dashboard/src/server/agents/claude-code-adapter.js.map +1 -1
  23. package/dashboard/dist-server/dashboard/src/server/agents/claude-code-adapter.test.js +9 -3
  24. package/dashboard/dist-server/dashboard/src/server/agents/claude-code-adapter.test.js.map +1 -1
  25. package/dashboard/dist-server/dashboard/src/server/agents/codex-app-server-adapter.js +5 -2
  26. package/dashboard/dist-server/dashboard/src/server/agents/codex-app-server-adapter.js.map +1 -1
  27. package/dashboard/dist-server/dashboard/src/server/agents/codex-cli-adapter.js +20 -8
  28. package/dashboard/dist-server/dashboard/src/server/agents/codex-cli-adapter.js.map +1 -1
  29. package/dashboard/dist-server/dashboard/src/server/agents/gemini-a2a-adapter.js +6 -3
  30. package/dashboard/dist-server/dashboard/src/server/agents/gemini-a2a-adapter.js.map +1 -1
  31. package/dashboard/dist-server/dashboard/src/server/agents/gemini-a2a-adapter.test.js +7 -1
  32. package/dashboard/dist-server/dashboard/src/server/agents/gemini-a2a-adapter.test.js.map +1 -1
  33. package/dashboard/dist-server/dashboard/src/server/agents/opencode-adapter.d.ts +2 -0
  34. package/dashboard/dist-server/dashboard/src/server/agents/opencode-adapter.js +40 -15
  35. package/dashboard/dist-server/dashboard/src/server/agents/opencode-adapter.js.map +1 -1
  36. package/dashboard/dist-server/dashboard/src/server/agents/process-tree-kill.d.ts +1 -0
  37. package/dashboard/dist-server/dashboard/src/server/agents/process-tree-kill.js +59 -0
  38. package/dashboard/dist-server/dashboard/src/server/agents/process-tree-kill.js.map +1 -0
  39. package/dashboard/dist-server/dashboard/src/server/agents/process-tree-kill.test.d.ts +1 -0
  40. package/dashboard/dist-server/dashboard/src/server/agents/process-tree-kill.test.js +78 -0
  41. package/dashboard/dist-server/dashboard/src/server/agents/process-tree-kill.test.js.map +1 -0
  42. package/dashboard/dist-server/dashboard/src/server/agents/stale-handler.d.ts +25 -0
  43. package/dashboard/dist-server/dashboard/src/server/agents/stale-handler.js +40 -0
  44. package/dashboard/dist-server/dashboard/src/server/agents/stale-handler.js.map +1 -0
  45. package/dashboard/dist-server/dashboard/src/server/agents/stale-handler.test.d.ts +1 -0
  46. package/dashboard/dist-server/dashboard/src/server/agents/stale-handler.test.js +89 -0
  47. package/dashboard/dist-server/dashboard/src/server/agents/stale-handler.test.js.map +1 -0
  48. package/dashboard/dist-server/dashboard/src/server/agents/stream-json-adapter.js +19 -8
  49. package/dashboard/dist-server/dashboard/src/server/agents/stream-json-adapter.js.map +1 -1
  50. package/dashboard/dist-server/dashboard/src/server/agents/stream-monitor.d.ts +6 -0
  51. package/dashboard/dist-server/dashboard/src/server/agents/stream-monitor.js +7 -1
  52. package/dashboard/dist-server/dashboard/src/server/agents/stream-monitor.js.map +1 -1
  53. package/dashboard/dist-server/dashboard/src/server/agents/stream-monitor.test.d.ts +1 -0
  54. package/dashboard/dist-server/dashboard/src/server/agents/stream-monitor.test.js +46 -0
  55. package/dashboard/dist-server/dashboard/src/server/agents/stream-monitor.test.js.map +1 -0
  56. package/dashboard/dist-server/shared/agent-types.d.ts +6 -0
  57. package/dist/shared/agent-types.d.ts +6 -0
  58. package/dist/shared/agent-types.d.ts.map +1 -1
  59. package/dist/src/agents/cli-agent-runner.d.ts +3 -0
  60. package/dist/src/agents/cli-agent-runner.d.ts.map +1 -1
  61. package/dist/src/agents/cli-agent-runner.js +1 -0
  62. package/dist/src/agents/cli-agent-runner.js.map +1 -1
  63. package/dist/src/commands/delegate.d.ts +2 -0
  64. package/dist/src/commands/delegate.d.ts.map +1 -1
  65. package/dist/src/commands/delegate.js +18 -0
  66. package/dist/src/commands/delegate.js.map +1 -1
  67. package/dist/src/config/cli-tools-config.d.ts +3 -0
  68. package/dist/src/config/cli-tools-config.d.ts.map +1 -1
  69. package/dist/src/config/cli-tools-config.js.map +1 -1
  70. package/package.json +1 -1
  71. package/shared/agent-types.ts +237 -231
  72. package/.codex/skills/team-coordinate/roles/coordinator/commands/analyze-task.md +0 -247
  73. package/.codex/skills/team-coordinate/roles/coordinator/commands/dispatch.md +0 -126
  74. package/.codex/skills/team-coordinate/roles/coordinator/commands/monitor.md +0 -265
  75. package/.codex/skills/team-coordinate/roles/coordinator/role.md +0 -403
  76. package/.codex/skills/team-coordinate/specs/knowledge-transfer.md +0 -113
  77. package/.codex/skills/team-coordinate/specs/pipelines.md +0 -97
  78. package/.codex/skills/team-coordinate/specs/quality-gates.md +0 -112
  79. package/.codex/skills/team-coordinate/specs/role-spec-template.md +0 -192
  80. package/.codex/skills/team-executor/SKILL.md +0 -116
  81. package/.codex/skills/team-executor/roles/executor/commands/monitor.md +0 -213
  82. package/.codex/skills/team-executor/roles/executor/role.md +0 -173
  83. package/.codex/skills/team-executor/specs/session-schema.md +0 -230
  84. package/.codex/skills/team-lifecycle-v4/roles/coordinator/commands/analyze.md +0 -56
  85. package/.codex/skills/team-lifecycle-v4/roles/coordinator/commands/dispatch.md +0 -61
  86. package/.codex/skills/team-lifecycle-v4/roles/coordinator/commands/monitor.md +0 -113
  87. package/.codex/skills/team-lifecycle-v4/roles/coordinator/role.md +0 -189
  88. package/.codex/skills/team-lifecycle-v4/schemas/tasks-schema.md +0 -100
  89. package/.codex/skills/team-lifecycle-v4/specs/knowledge-transfer.md +0 -204
  90. package/.codex/skills/team-quality-assurance/roles/coordinator/commands/analyze.md +0 -72
  91. package/.codex/skills/team-quality-assurance/roles/coordinator/commands/dispatch.md +0 -108
  92. package/.codex/skills/team-quality-assurance/roles/coordinator/commands/monitor.md +0 -163
  93. package/.codex/skills/team-quality-assurance/roles/coordinator/role.md +0 -177
  94. package/.codex/skills/team-review/roles/coordinator/commands/analyze.md +0 -71
  95. package/.codex/skills/team-review/roles/coordinator/commands/dispatch.md +0 -90
  96. package/.codex/skills/team-review/roles/coordinator/commands/monitor.md +0 -135
  97. package/.codex/skills/team-review/roles/coordinator/role.md +0 -176
  98. package/.codex/skills/team-tech-debt/roles/coordinator/commands/analyze.md +0 -47
  99. package/.codex/skills/team-tech-debt/roles/coordinator/commands/dispatch.md +0 -163
  100. package/.codex/skills/team-tech-debt/roles/coordinator/commands/monitor.md +0 -133
  101. package/.codex/skills/team-tech-debt/roles/coordinator/role.md +0 -173
  102. package/.codex/skills/team-testing/roles/coordinator/commands/analyze.md +0 -70
  103. package/.codex/skills/team-testing/roles/coordinator/commands/dispatch.md +0 -106
  104. package/.codex/skills/team-testing/roles/coordinator/commands/monitor.md +0 -156
  105. package/.codex/skills/team-testing/roles/coordinator/role.md +0 -185
@@ -1,247 +0,0 @@
1
- # Command: analyze-task
2
-
3
- ## Purpose
4
-
5
- Parse user task description -> detect required capabilities -> build dependency graph -> design dynamic roles with role-spec metadata. Outputs structured task-analysis.json with frontmatter fields for role-spec generation.
6
-
7
- ## CRITICAL CONSTRAINT
8
-
9
- **TEXT-LEVEL analysis only. MUST NOT read source code or explore codebase.**
10
-
11
- **Allowed:**
12
- - Parse user task description text
13
- - request_user_input for clarification
14
- - Keyword-to-capability mapping
15
- - Write `task-analysis.json`
16
-
17
- If task context requires codebase knowledge, set `needs_research: true`. Phase 2 will spawn researcher worker.
18
-
19
- ## When to Use
20
-
21
- | Trigger | Condition |
22
- |---------|-----------|
23
- | New task | Coordinator Phase 1 receives task description |
24
- | Re-analysis | User provides revised requirements |
25
- | Adapt | handleAdapt extends analysis for new capability |
26
-
27
- ## Strategy
28
-
29
- - **Delegation**: Inline execution (coordinator processes directly)
30
- - **Mode**: Text-level analysis only (no codebase reading)
31
- - **Output**: `<session>/task-analysis.json`
32
-
33
- ## Phase 2: Context Loading
34
-
35
- | Input | Source | Required |
36
- |-------|--------|----------|
37
- | Task description | User input from Phase 1 | Yes |
38
- | Clarification answers | request_user_input results (if any) | No |
39
- | Session folder | From coordinator Phase 2 | Yes |
40
-
41
- ## Phase 3: Task Analysis
42
-
43
- ### Step 1: Signal Detection
44
-
45
- Scan task description for capability keywords:
46
-
47
- | Signal | Keywords | Capability | Prefix | Responsibility Type |
48
- |--------|----------|------------|--------|---------------------|
49
- | Research | investigate, explore, compare, survey, find, research, discover, benchmark, study | researcher | RESEARCH | orchestration |
50
- | Writing | write, draft, document, article, report, blog, describe, explain, summarize, content | writer | DRAFT | code-gen (docs) |
51
- | Coding | implement, build, code, fix, refactor, develop, create app, program, migrate, port | developer | IMPL | code-gen (code) |
52
- | Design | design, architect, plan, structure, blueprint, model, schema, wireframe, layout | designer | DESIGN | orchestration |
53
- | Analysis | analyze, review, audit, assess, evaluate, inspect, examine, diagnose, profile | analyst | ANALYSIS | read-only |
54
- | Testing | test, verify, validate, QA, quality, check, assert, coverage, regression | tester | TEST | validation |
55
- | Planning | plan, breakdown, organize, schedule, decompose, roadmap, strategy, prioritize | planner | PLAN | orchestration |
56
-
57
- **Multi-match**: A task may trigger multiple capabilities.
58
-
59
- **No match**: Default to a single `general` capability with `TASK` prefix.
60
-
61
- ### Step 2: Artifact Inference
62
-
63
- Each capability produces default output artifacts:
64
-
65
- | Capability | Default Artifact | Format |
66
- |------------|-----------------|--------|
67
- | researcher | Research findings | `<session>/artifacts/research-findings.md` |
68
- | writer | Written document(s) | `<session>/artifacts/<doc-name>.md` |
69
- | developer | Code implementation | Source files + `<session>/artifacts/implementation-summary.md` |
70
- | designer | Design document | `<session>/artifacts/design-spec.md` |
71
- | analyst | Analysis report | `<session>/artifacts/analysis-report.md` |
72
- | tester | Test results | `<session>/artifacts/test-report.md` |
73
- | planner | Execution plan | `<session>/artifacts/execution-plan.md` |
74
-
75
- ### Step 2.5: Key File Inference
76
-
77
- For each task, infer relevant files based on capability type and task keywords:
78
-
79
- | Capability | File Inference Strategy |
80
- |------------|------------------------|
81
- | researcher | Extract domain keywords -> map to likely directories (e.g., "auth" -> `src/auth/**`, `middleware/auth.ts`) |
82
- | developer | Extract feature/module keywords -> map to source files (e.g., "payment" -> `src/payments/**`, `types/payment.ts`) |
83
- | designer | Look for architecture/config keywords -> map to config/schema files |
84
- | analyst | Extract target keywords -> map to files under analysis |
85
- | tester | Extract test target keywords -> map to source + test files |
86
- | writer | Extract documentation target -> map to relevant source files for context |
87
- | planner | No specific files (planning is abstract) |
88
-
89
- **Inference rules:**
90
- - Extract nouns and verbs from task description
91
- - Match against common directory patterns (src/, lib/, components/, services/, utils/)
92
- - Include related type definition files (types/, *.d.ts)
93
- - For "fix bug" tasks, include error-prone areas (error handlers, validation)
94
- - For "implement feature" tasks, include similar existing features as reference
95
-
96
- ### Step 3: Dependency Graph Construction
97
-
98
- Build a DAG of work streams using natural ordering tiers:
99
-
100
- | Tier | Capabilities | Description |
101
- |------|-------------|-------------|
102
- | 0 | researcher, planner | Knowledge gathering / planning |
103
- | 1 | designer | Design (requires context from tier 0 if present) |
104
- | 2 | writer, developer | Creation (requires design/plan if present) |
105
- | 3 | analyst, tester | Validation (requires artifacts to validate) |
106
-
107
- ### Step 4: Complexity Scoring
108
-
109
- | Factor | Weight | Condition |
110
- |--------|--------|-----------|
111
- | Capability count | +1 each | Number of distinct capabilities |
112
- | Cross-domain factor | +2 | Capabilities span 3+ tiers |
113
- | Parallel tracks | +1 each | Independent parallel work streams |
114
- | Serial depth | +1 per level | Longest dependency chain length |
115
-
116
- | Total Score | Complexity | Role Limit |
117
- |-------------|------------|------------|
118
- | 1-3 | Low | 1-2 roles |
119
- | 4-6 | Medium | 2-3 roles |
120
- | 7+ | High | 3-5 roles |
121
-
122
- ### Step 5: Role Minimization
123
-
124
- Apply merging rules to reduce role count (cap at 5).
125
-
126
- ### Step 6: Role-Spec Metadata Assignment
127
-
128
- For each role, determine frontmatter and generation hints:
129
-
130
- | Field | Derivation |
131
- |-------|------------|
132
- | `prefix` | From capability prefix (e.g., RESEARCH, DRAFT, IMPL) |
133
- | `inner_loop` | `true` if role has 2+ serial same-prefix tasks |
134
- | `CLI tools` | Suggested, not mandatory -- coordinator may adjust based on task needs |
135
- | `pattern_hint` | Reference pattern name from role-spec-template (research/document/code/analysis/validation) -- guides coordinator's Phase 2-4 composition, NOT a rigid template selector |
136
- | `output_type` | `artifact` (new files in session/artifacts/) / `codebase` (modify existing project files) / `mixed` (both) -- determines verification strategy in Behavioral Traits |
137
- | `message_types.success` | `<prefix>_complete` |
138
- | `message_types.error` | `error` |
139
-
140
- **output_type derivation**:
141
-
142
- | Task Signal | output_type | Example |
143
- |-------------|-------------|---------|
144
- | "write report", "analyze", "research" | `artifact` | New analysis-report.md in session |
145
- | "update docs", "modify code", "fix bug" | `codebase` | Modify existing project files |
146
- | "implement feature + write summary" | `mixed` | Code changes + implementation summary |
147
-
148
- ## Phase 4: Output
149
-
150
- Write `<session-folder>/task-analysis.json`:
151
-
152
- ```json
153
- {
154
- "task_description": "<original user input>",
155
- "capabilities": [
156
- {
157
- "name": "researcher",
158
- "prefix": "RESEARCH",
159
- "responsibility_type": "orchestration",
160
- "tasks": [
161
- {
162
- "id": "RESEARCH-001",
163
- "goal": "What this task achieves and why",
164
- "steps": [
165
- "step 1: specific action with clear verb",
166
- "step 2: specific action with clear verb",
167
- "step 3: specific action with clear verb"
168
- ],
169
- "key_files": [
170
- "src/path/to/relevant.ts",
171
- "src/path/to/other.ts"
172
- ],
173
- "upstream_artifacts": [],
174
- "success_criteria": "Measurable completion condition",
175
- "constraints": "Scope limits, focus areas"
176
- }
177
- ],
178
- "artifacts": ["research-findings.md"]
179
- }
180
- ],
181
- "dependency_graph": {
182
- "RESEARCH-001": [],
183
- "DRAFT-001": ["RESEARCH-001"],
184
- "ANALYSIS-001": ["DRAFT-001"]
185
- },
186
- "roles": [
187
- {
188
- "name": "researcher",
189
- "prefix": "RESEARCH",
190
- "responsibility_type": "orchestration",
191
- "task_count": 1,
192
- "inner_loop": false,
193
- "role_spec_metadata": {
194
- "CLI tools": ["explore"],
195
- "pattern_hint": "research",
196
- "output_type": "artifact",
197
- "message_types": {
198
- "success": "research_complete",
199
- "error": "error"
200
- }
201
- }
202
- }
203
- ],
204
- "complexity": {
205
- "capability_count": 2,
206
- "cross_domain_factor": false,
207
- "parallel_tracks": 0,
208
- "serial_depth": 2,
209
- "total_score": 3,
210
- "level": "low"
211
- },
212
- "needs_research": false,
213
- "artifacts": [
214
- { "name": "research-findings.md", "producer": "researcher", "path": "artifacts/research-findings.md" }
215
- ]
216
- }
217
- ```
218
-
219
- ## Complexity Interpretation
220
-
221
- **CRITICAL**: Complexity score is for **role design optimization**, NOT for skipping team workflow.
222
-
223
- | Complexity | Team Structure | Coordinator Action |
224
- |------------|----------------|-------------------|
225
- | Low (1-2 roles) | Minimal team | Generate 1-2 role-specs, create team, spawn workers |
226
- | Medium (2-3 roles) | Standard team | Generate role-specs, create team, spawn workers |
227
- | High (3-5 roles) | Full team | Generate role-specs, create team, spawn workers |
228
-
229
- **All complexity levels use team_worker architecture**:
230
- - Single-role tasks still spawn team_worker agent
231
- - Coordinator NEVER executes task work directly
232
- - Team infrastructure provides session management, message bus, fast-advance
233
-
234
- **Purpose of complexity score**:
235
- - Determine optimal role count (merge vs separate)
236
- - Guide dependency graph design
237
- - Inform user about task scope
238
- - NOT for deciding whether to use team workflow
239
-
240
- ## Error Handling
241
-
242
- | Scenario | Resolution |
243
- |----------|------------|
244
- | No capabilities detected | Default to single `general` role with TASK prefix |
245
- | Circular dependency in graph | Break cycle at lowest-tier edge, warn |
246
- | Task description too vague | Return minimal analysis, coordinator will request_user_input |
247
- | All capabilities merge into one | Valid -- single-role execution via team_worker |
@@ -1,126 +0,0 @@
1
- # Command: dispatch
2
-
3
- ## Purpose
4
-
5
- Create task chains from dynamic dependency graphs. Builds pipelines from the task-analysis.json produced by Phase 1. Workers are spawned as team_worker agents with role-spec paths.
6
-
7
- ## When to Use
8
-
9
- | Trigger | Condition |
10
- |---------|-----------|
11
- | After analysis | Phase 1 complete, task-analysis.json exists |
12
- | After adapt | handleAdapt created new roles, needs new tasks |
13
- | Re-dispatch | Pipeline restructuring (rare) |
14
-
15
- ## Strategy
16
-
17
- - **Delegation**: Inline execution (coordinator processes directly)
18
- - **Inputs**: task-analysis.json + team-session.json
19
- - **Output**: tasks.json with dependency chains
20
-
21
- ## Phase 2: Context Loading
22
-
23
- | Input | Source | Required |
24
- |-------|--------|----------|
25
- | Task analysis | `<session-folder>/task-analysis.json` | Yes |
26
- | Session file | `<session-folder>/team-session.json` | Yes |
27
- | Role registry | `team-session.json#roles` | Yes |
28
- | Scope | User requirements description | Yes |
29
-
30
- ## Phase 3: Task Chain Creation
31
-
32
- ### Workflow
33
-
34
- 1. **Read dependency graph** from `task-analysis.json#dependency_graph`
35
- 2. **Topological sort** tasks to determine creation order
36
- 3. **Validate** all task roles exist in role registry
37
- 4. **Build tasks array** (in topological order):
38
-
39
- ```json
40
- [
41
- {
42
- "id": "<PREFIX>-<NNN>",
43
- "title": "<PREFIX>-<NNN>",
44
- "description": "PURPOSE: <goal> | Success: <success_criteria>\nTASK:\n - <step 1>\n - <step 2>\n - <step 3>\nCONTEXT:\n - Session: <session-folder>\n - Upstream artifacts: <artifact-1.md>, <artifact-2.md>\n - Key files: <file1>, <file2>\n - Shared state: team_msg(operation=\"get_state\", session_id=<session-id>)\nEXPECTED: <deliverable path> + <quality criteria>\nCONSTRAINTS: <scope limits>\n---\nInnerLoop: <true|false>\nRoleSpec: <session-folder>/role-specs/<role-name>.md",
45
- "status": "pending",
46
- "role": "<role-name>",
47
- "prefix": "<PREFIX>",
48
- "deps": ["<dependency-list from graph>"],
49
- "findings": "",
50
- "error": ""
51
- }
52
- ]
53
- ```
54
-
55
- 5. **Write tasks.json** with the complete array
56
- 6. **Update team-session.json** with pipeline and tasks_total
57
- 7. **Validate** created chain
58
-
59
- ### Task Description Template
60
-
61
- Every task description includes structured fields for clarity:
62
-
63
- ```
64
- PURPOSE: <goal from task-analysis.json#tasks[].goal> | Success: <success_criteria from task-analysis.json#tasks[].success_criteria>
65
- TASK:
66
- - <step 1 from task-analysis.json#tasks[].steps[]>
67
- - <step 2 from task-analysis.json#tasks[].steps[]>
68
- - <step 3 from task-analysis.json#tasks[].steps[]>
69
- CONTEXT:
70
- - Session: <session-folder>
71
- - Upstream artifacts: <comma-separated list from task-analysis.json#tasks[].upstream_artifacts[]>
72
- - Key files: <comma-separated list from task-analysis.json#tasks[].key_files[]>
73
- - Shared state: team_msg(operation="get_state", session_id=<session-id>)
74
- EXPECTED: <artifact path from task-analysis.json#capabilities[].artifacts[]> + <quality criteria based on capability type>
75
- CONSTRAINTS: <constraints from task-analysis.json#tasks[].constraints>
76
- ---
77
- InnerLoop: <true|false>
78
- RoleSpec: <session-folder>/role-specs/<role-name>.md
79
- ```
80
-
81
- **Field Mapping**:
82
- - `PURPOSE`: From `task-analysis.json#capabilities[].tasks[].goal` + `success_criteria`
83
- - `TASK`: From `task-analysis.json#capabilities[].tasks[].steps[]`
84
- - `CONTEXT.Upstream artifacts`: From `task-analysis.json#capabilities[].tasks[].upstream_artifacts[]`
85
- - `CONTEXT.Key files`: From `task-analysis.json#capabilities[].tasks[].key_files[]`
86
- - `EXPECTED`: From `task-analysis.json#capabilities[].artifacts[]` + quality criteria
87
- - `CONSTRAINTS`: From `task-analysis.json#capabilities[].tasks[].constraints`
88
-
89
- ### InnerLoop Flag Rules
90
-
91
- | Condition | InnerLoop |
92
- |-----------|-----------|
93
- | Role has 2+ serial same-prefix tasks | true |
94
- | Role has 1 task | false |
95
- | Tasks are parallel (no dependency between them) | false |
96
-
97
- ### Dependency Validation
98
-
99
- | Check | Criteria |
100
- |-------|----------|
101
- | No orphan tasks | Every task is reachable from at least one root |
102
- | No circular deps | Topological sort succeeds without cycle |
103
- | All roles valid | Every task role exists in team-session.json#roles |
104
- | All deps valid | Every deps entry references an existing task id |
105
- | Session reference | Every task description contains `Session: <session-folder>` |
106
- | RoleSpec reference | Every task description contains `RoleSpec: <path>` |
107
-
108
- ## Phase 4: Validation
109
-
110
- | Check | Criteria |
111
- |-------|----------|
112
- | Task count | Matches dependency_graph node count |
113
- | Dependencies | Every deps entry references an existing task id |
114
- | Role assignment | Each task role is in role registry |
115
- | Session reference | Every task description contains `Session:` |
116
- | Pipeline integrity | No disconnected subgraphs (warn if found) |
117
-
118
- ## Error Handling
119
-
120
- | Scenario | Resolution |
121
- |----------|------------|
122
- | Circular dependency detected | Report cycle, halt task creation |
123
- | Role not in role registry | Error, coordinator must fix roles first |
124
- | Task creation fails | Log error, report to coordinator |
125
- | Duplicate task id | Skip creation, log warning |
126
- | Empty dependency graph | Error, task analysis may have failed |
@@ -1,265 +0,0 @@
1
- # Command: monitor
2
-
3
- ## Purpose
4
-
5
- Event-driven pipeline coordination with Spawn-and-Stop pattern. Role names are read from `team-session.json#roles`. Workers are spawned as `team_worker` agents with role-spec paths. Includes `handleComplete` for pipeline completion action and `handleAdapt` for mid-pipeline capability gap handling.
6
-
7
- ## When to Use
8
-
9
- | Trigger | Condition |
10
- |---------|-----------|
11
- | Worker result | Result from wait_agent contains [role-name] from session roles |
12
- | User command | "check", "status", "resume", "continue" |
13
- | Capability gap | Worker reports capability_gap |
14
- | Pipeline spawn | After dispatch, initial spawn needed |
15
- | Pipeline complete | All tasks done |
16
-
17
- ## Strategy
18
-
19
- - **Delegation**: Inline execution with handler routing
20
- - **Beat model**: ONE_STEP_PER_INVOCATION -- one handler then STOP
21
- - **Workers**: Spawned as team_worker via spawn_agent
22
-
23
- ## Constants
24
-
25
- | Constant | Value | Description |
26
- |----------|-------|-------------|
27
- | SPAWN_MODE | spawn_agent | All workers spawned via `spawn_agent` |
28
- | ONE_STEP_PER_INVOCATION | true | Coordinator does one operation then STOPS |
29
- | FAST_ADVANCE_AWARE | true | Workers may skip coordinator for simple linear successors |
30
- | WORKER_AGENT | team_worker | All workers spawned as team_worker agents |
31
-
32
- ## Phase 2: Context Loading
33
-
34
- | Input | Source | Required |
35
- |-------|--------|----------|
36
- | Session file | `<session-folder>/team-session.json` | Yes |
37
- | Task list | Read tasks.json | Yes |
38
- | Active workers | session.active_workers[] | Yes |
39
- | Role registry | session.roles[] | Yes |
40
-
41
- **Dynamic role resolution**: Known worker roles are loaded from `session.roles[].name`. Role-spec paths are in `session.roles[].role_spec`.
42
-
43
- ## Phase 3: Handler Routing
44
-
45
- ### Wake-up Source Detection
46
-
47
- Parse `$ARGUMENTS` to determine handler:
48
-
49
- | Priority | Condition | Handler |
50
- |----------|-----------|---------|
51
- | 1 | Message contains `[<role-name>]` from session roles | handleCallback |
52
- | 2 | Contains "capability_gap" | handleAdapt |
53
- | 3 | Contains "check" or "status" | handleCheck |
54
- | 4 | Contains "resume", "continue", or "next" | handleResume |
55
- | 5 | Pipeline detected as complete | handleComplete |
56
- | 6 | None of the above (initial spawn after dispatch) | handleSpawnNext |
57
-
58
- ---
59
-
60
- ### Handler: handleCallback
61
-
62
- Worker completed a task. Verify completion, update state, auto-advance.
63
-
64
- ```
65
- Match worker by role -> route:
66
- progress_update (not final) -> update state, keep in active_workers -> STOP
67
- completed -> remove from active_workers, close_agent, -> handleSpawnNext
68
- not_completed -> log progress -> STOP
69
- no_match -> scan all workers for completions -> process any found -> handleSpawnNext, else STOP
70
- ```
71
-
72
- **Fast-advance reconciliation**: On any callback/resume, sync `fast_advance` messages from team_msg into `active_workers`. Skip spawning tasks already `in_progress` via fast-advance.
73
-
74
- ---
75
-
76
- ### Handler: handleCheck
77
-
78
- Read-only status report with progress milestones. No pipeline advancement.
79
-
80
- 1. Read tasks.json + team_msg (type="progress", last=50) + team_msg (type="blocker", last=10)
81
- 2. Aggregate latest milestone per active worker
82
-
83
- **Output format**:
84
-
85
- ```
86
- [coordinator] Pipeline Status
87
- [coordinator] Progress: <completed>/<total> (<percent>%)
88
-
89
- [coordinator] Execution Graph:
90
- <visual representation of dependency graph with status icons>
91
-
92
- done=completed >>>=running o=pending .=not created
93
-
94
- [coordinator] Active Workers:
95
- > <subject> (<role>) - <milestone_phase> <pct>% - running <elapsed>
96
- ...
97
-
98
- [coordinator] Blockers: <count or "none">
99
- <task_id>: <blocker_detail> ← only if blockers exist
100
-
101
- [coordinator] Ready to spawn: <subjects>
102
- [coordinator] Commands: 'resume' to advance | 'check' to refresh
103
- ```
104
-
105
- **CLI equivalent for human monitoring** (works while coordinator is blocked):
106
- ```bash
107
- maestro agent-msg list -s "<session_id>" --type progress --last 10
108
- maestro agent-msg list -s "<session_id>" --type blocker
109
- ```
110
-
111
- Then STOP.
112
-
113
- ---
114
-
115
- ### Handler: handleResume
116
-
117
- **Agent Health Check** (v4): Cross-check `list_agents()` against session `active_workers`. Any agent not actually running -> reset task to pending, remove from active_workers.
118
-
119
- Check active worker completion, process results, advance pipeline.
120
-
121
- ```
122
- Load active_workers -> route:
123
- none -> handleSpawnNext
124
- has workers -> classify each: completed | in_progress | failed(reset to pending)
125
- some completed -> handleSpawnNext
126
- all running -> report status -> STOP
127
- all failed -> handleSpawnNext (retry)
128
- ```
129
-
130
- ---
131
-
132
- ### Handler: handleSpawnNext
133
-
134
- Find all ready tasks, spawn team_worker agents, update session, STOP.
135
-
136
- ```
137
- Classify tasks: completed | in_progress | ready (pending + all deps completed)
138
-
139
- Ready tasks -> route:
140
- none + in_progress exists -> report waiting -> STOP
141
- none + nothing in_progress -> PIPELINE_COMPLETE -> handleComplete
142
- has ready -> for each:
143
- skip if Inner Loop role already has active_worker
144
- else: set status="in_progress", log task_unblocked, spawn team_worker, add to active_workers
145
- Update session -> output summary -> STOP
146
- ```
147
-
148
- **Cross-Agent Supplementary Context** (v4): When spawning later-phase workers, use `send_message` (not `followup_task`) to deliver upstream results to already-running downstream workers as non-interrupting supplementary context.
149
-
150
- **Spawn worker call** (one per ready task):
151
-
152
- ```
153
- spawn_agent({ agent_type: "team_worker", task_name: taskId, message: <role-assignment> })
154
- ```
155
-
156
- **Role assignment message template**:
157
- ```
158
- ## Role Assignment
159
- role: <role> | role_spec: <session-folder>/role-specs/<role>.md
160
- session: <session-folder> | session_id: <session-id> | team_name: <team-name>
161
- requirement: <task-description> | inner_loop: <true|false>
162
- Read role_spec for Phase 2-4 instructions.
163
- ## Progress Milestones
164
- Report progress via team_msg at phase boundaries. Blockers via type="blocker". Completion via type="task_complete" after report_agent_job_result.
165
- ```
166
-
167
- **Result collection**: `wait_agent({ timeout_ms: 1800000 })` (30 min), drain progress from team_msg.
168
-
169
- **Timeout escalation**: STATUS_CHECK (3 min) -> FINALIZE with interrupt (3 min) -> mark timed_out with last progress context, close_agent. Normal completion -> process result, close_agent (use task_name, not agentId).
170
-
171
- ---
172
-
173
- ### Handler: handleComplete
174
-
175
- **Cleanup Verification** (v4): `list_agents()` -> close any still-running team agents.
176
-
177
- Pipeline complete. Execute completion action based on session configuration.
178
-
179
- ```
180
- Generate summary: deliverables + stats + verdicts
181
-
182
- Route by session.completion_action:
183
- "interactive" -> request_user_input with options:
184
- "Archive & Clean" -> status="completed", cleanup, output artifact paths
185
- "Keep Active" -> status="paused", output resume command
186
- "Export Results" -> prompt for target dir, copy deliverables, then Archive & Clean
187
- "auto_archive" -> Archive & Clean without prompt
188
- "auto_keep" -> Keep Active without prompt
189
-
190
- Fallback: default to Keep Active on failure.
191
- ```
192
-
193
- ---
194
-
195
- ### Handler: handleAdapt
196
-
197
- Handle mid-pipeline capability gap discovery. A worker reports `capability_gap` when it encounters work outside its scope.
198
-
199
- **CONSTRAINT**: Maximum 5 worker roles per session. handleAdapt MUST enforce this limit.
200
-
201
- ```
202
- Extract: gap_description, requesting_role, suggested_capability
203
- Validate: existing role covers gap? -> redirect -> STOP
204
- Enforce MAX 5 ROLES: count >= 5 -> attempt merge, else PAUSE for user
205
- Generate role-spec from template -> write to role-specs/<new-role>.md -> add to session.roles
206
- Create task(s) in tasks.json -> update session -> spawn team_worker -> STOP
207
- ```
208
-
209
- ---
210
-
211
- ### Worker Failure Handling
212
-
213
- When a worker has unexpected status (not completed, not in_progress):
214
-
215
- 1. Reset task -> pending in tasks.json
216
- 2. Log via team_msg (type: error)
217
- 3. Report to user: task reset, will retry on next resume
218
-
219
- ### Fast-Advance Failure Recovery
220
-
221
- When coordinator detects a fast-advanced task has failed:
222
-
223
- ```
224
- Detect: task in_progress with no active_worker (stale fast-advance)
225
- -> reset to pending, remove stale entry, log error, -> handleSpawnNext
226
- ```
227
-
228
- ### Fast-Advance State Sync
229
-
230
- On every coordinator wake (handleCallback, handleResume, handleCheck):
231
- 1. Read team_msg entries with `type="fast_advance"` since last coordinator wake
232
- 2. For each entry: sync `active_workers` with the spawned successor
233
- 3. This ensures coordinator's state reflects fast-advance decisions even before the successor's callback arrives
234
-
235
- ### Consensus-Blocked Handling
236
-
237
- ```
238
- Route by consensus_blocked severity:
239
- HIGH -> create REVISION task (max 1 per task, else PAUSE + escalate)
240
- MEDIUM -> proceed with warning, log to wisdom/issues.md, -> handleSpawnNext
241
- LOW -> proceed normally, treat as consensus_reached with notes
242
- ```
243
-
244
- ## Phase 4: Validation
245
-
246
- | Check | Criteria |
247
- |-------|----------|
248
- | Session state consistent | active_workers matches tasks.json in_progress tasks |
249
- | No orphaned tasks | Every in_progress task has an active_worker entry |
250
- | Dynamic roles valid | All task roles exist in session.roles |
251
- | Completion detection | readySubjects=0 + inProgressSubjects=0 -> PIPELINE_COMPLETE |
252
- | Fast-advance tracking | Detect tasks already in_progress via fast-advance, sync to active_workers |
253
-
254
- ## Error Handling
255
-
256
- | Scenario | Resolution |
257
- |----------|------------|
258
- | Session file not found | Error, suggest re-initialization |
259
- | Worker callback from unknown role | Log info, scan for other completions |
260
- | All workers still running on resume | Report status, suggest check later |
261
- | Pipeline stall (no ready, no running) | Check for missing tasks, report to user |
262
- | Fast-advance conflict | Coordinator reconciles, no duplicate spawns |
263
- | Dynamic role-spec file not found | Error, coordinator must regenerate from task-analysis |
264
- | capability_gap when role limit (5) reached | Attempt merge, else pause for user |
265
- | Completion action fails | Default to Keep Active, log warning |