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,112 +0,0 @@
1
- # Quality Gates
2
-
3
- ## 1. Quality Thresholds
4
-
5
- | Result | Score | Action |
6
- |--------|-------|--------|
7
- | Pass | >= 80% | Report completed |
8
- | Review | 60-79% | Report completed with warnings |
9
- | Fail | < 60% | Retry Phase 3 (max 2 retries) |
10
-
11
- ## 2. Scoring Dimensions
12
-
13
- | Dimension | Weight | Criteria |
14
- |-----------|--------|----------|
15
- | Completeness | 25% | All required outputs present with substantive content |
16
- | Consistency | 25% | Terminology, formatting, cross-references are uniform |
17
- | Accuracy | 25% | Outputs are factually correct and verifiable against sources |
18
- | Depth | 25% | Sufficient detail for downstream consumers to act on deliverables |
19
-
20
- **Score** = weighted average of all dimensions (0-100 per dimension).
21
-
22
- ## 3. Dynamic Role Quality Checks
23
-
24
- Quality checks vary by `output_type` (from task-analysis.json role metadata).
25
-
26
- ### output_type: artifact
27
-
28
- | Check | Pass Criteria |
29
- |-------|---------------|
30
- | Artifact exists | File written to `<session>/artifacts/` |
31
- | Content non-empty | Substantive content, not just headers |
32
- | Format correct | Expected format (MD, JSON) matches deliverable |
33
- | Cross-references | All references to upstream artifacts resolve |
34
-
35
- ### output_type: codebase
36
-
37
- | Check | Pass Criteria |
38
- |-------|---------------|
39
- | Files modified | Claimed files actually changed (Read to confirm) |
40
- | Syntax valid | No syntax errors in modified files |
41
- | No regressions | Existing functionality preserved |
42
- | Summary artifact | Implementation summary written to artifacts/ |
43
-
44
- ### output_type: mixed
45
-
46
- All checks from both `artifact` and `codebase` apply.
47
-
48
- ## 4. Verification Protocol
49
-
50
- Derived from Behavioral Traits in [role-spec-template.md](role-spec-template.md).
51
-
52
- | Step | Action | Required |
53
- |------|--------|----------|
54
- | 1 | Verify all claimed files exist via Read | Yes |
55
- | 2 | Confirm artifact written to `<session>/artifacts/` | Yes |
56
- | 3 | Check verification summary fields present | Yes |
57
- | 4 | Score against quality dimensions | Yes |
58
- | 5 | Apply threshold -> Pass/Review/Fail | Yes |
59
-
60
- **On Fail**: Retry Phase 3 (max 2 retries). After 2 retries, report `partial_completion`.
61
-
62
- **On Review**: Proceed with warnings logged to `<session>/wisdom/issues.md`.
63
-
64
- ## 5. Code Review Dimensions
65
-
66
- For REVIEW-* or validation tasks during implementation pipelines.
67
-
68
- ### Quality
69
-
70
- | Check | Severity |
71
- |-------|----------|
72
- | Empty catch blocks | Error |
73
- | `as any` type casts | Warning |
74
- | `@ts-ignore` / `@ts-expect-error` | Warning |
75
- | `console.log` in production code | Warning |
76
- | Unused imports/variables | Info |
77
-
78
- ### Security
79
-
80
- | Check | Severity |
81
- |-------|----------|
82
- | Hardcoded secrets/credentials | Error |
83
- | SQL injection vectors | Error |
84
- | `eval()` or `Function()` usage | Error |
85
- | `innerHTML` assignment | Warning |
86
- | Missing input validation | Warning |
87
-
88
- ### Architecture
89
-
90
- | Check | Severity |
91
- |-------|----------|
92
- | Circular dependencies | Error |
93
- | Deep cross-boundary imports (3+ levels) | Warning |
94
- | Files > 500 lines | Warning |
95
- | Functions > 50 lines | Info |
96
-
97
- ### Requirements Coverage
98
-
99
- | Check | Severity |
100
- |-------|----------|
101
- | Core functionality implemented | Error if missing |
102
- | Acceptance criteria covered | Error if missing |
103
- | Edge cases handled | Warning |
104
- | Error states handled | Warning |
105
-
106
- ## 6. Issue Classification
107
-
108
- | Class | Label | Action |
109
- |-------|-------|--------|
110
- | Error | Must fix | Blocks progression, must resolve before proceeding |
111
- | Warning | Should fix | Should resolve, can proceed with justification |
112
- | Info | Nice to have | Optional improvement, log for future |
@@ -1,192 +0,0 @@
1
- # Dynamic Role-Spec Template
2
-
3
- Template used by coordinator to generate lightweight worker role-spec files at runtime. Each generated role-spec is written to `<session>/role-specs/<role-name>.md`.
4
-
5
- **Key difference from v1**: Role-specs contain ONLY Phase 2-4 domain logic + YAML frontmatter. All shared behavior (Phase 1 Task Discovery, Phase 5 Report/Fast-Advance, Message Bus, Consensus, Inner Loop) is built into the `team-worker` agent.
6
-
7
- ## Template
8
-
9
- ```markdown
10
- ---
11
- role: <role_name>
12
- prefix: <PREFIX>
13
- inner_loop: <true|false>
14
- CLI tools: [<CLI tool-names>]
15
- message_types:
16
- success: <prefix>_complete
17
- error: error
18
- ---
19
-
20
- # <Role Name> — Phase 2-4
21
-
22
- ## Phase 2: <phase2_name>
23
-
24
- <phase2_content>
25
-
26
- ## Phase 3: <phase3_name>
27
-
28
- <phase3_content>
29
-
30
- ## Phase 4: <phase4_name>
31
-
32
- <phase4_content>
33
-
34
- ## Error Handling
35
-
36
- | Scenario | Resolution |
37
- |----------|------------|
38
- <error_entries>
39
- ```
40
-
41
- ## Frontmatter Fields
42
-
43
- | Field | Required | Description |
44
- |-------|----------|-------------|
45
- | `role` | Yes | Role name matching session registry |
46
- | `prefix` | Yes | Task prefix to filter (e.g., RESEARCH, DRAFT, IMPL) |
47
- | `inner_loop` | Yes | Whether team-worker loops through same-prefix tasks |
48
- | `CLI tools` | No | Array of CLI tool types this role may call |
49
- | `output_tag` | Yes | Output tag for all messages, e.g., `[researcher]` |
50
- | `message_types` | Yes | Message type mapping for team_msg |
51
- | `message_types.success` | Yes | Type string for successful completion |
52
- | `message_types.error` | Yes | Type string for errors (usually "error") |
53
-
54
- ## Design Rules
55
-
56
- | Rule | Description |
57
- |------|-------------|
58
- | Phase 2-4 only | No Phase 1 (Task Discovery) or Phase 5 (Report) — team-worker handles these |
59
- | No message bus code | No team_msg calls — team-worker handles logging |
60
- | No consensus handling | No consensus_reached/blocked logic — team-worker handles routing |
61
- | No inner loop logic | No Phase 5-L/5-F — team-worker handles looping |
62
- | ~80 lines target | Lightweight, domain-focused |
63
- | No pseudocode | Decision tables + text + tool calls only |
64
- | `<placeholder>` notation | Use angle brackets for variable substitution |
65
- | Reference CLI tools by name | team-worker resolves invocation from its delegation templates |
66
-
67
- ## Generated Role-Spec Structure
68
-
69
- Every generated role-spec MUST include these blocks:
70
-
71
- ### Identity Block (mandatory — first section of generated spec)
72
-
73
- ```
74
- Tag: [<role_name>] | Prefix: <PREFIX>-*
75
- Responsibility: <one-line from task analysis>
76
- ```
77
-
78
- ### Boundaries Block (mandatory — after Identity)
79
-
80
- ```
81
- ### MUST
82
- - <3-5 rules derived from task analysis>
83
-
84
- ### MUST NOT
85
- - Execute work outside assigned prefix
86
- - Modify artifacts from other roles
87
- - Skip Phase 4 verification
88
- ```
89
-
90
- ## Behavioral Traits
91
-
92
- All dynamically generated role-specs MUST embed these traits into Phase 4. Coordinator copies this section verbatim into every generated role-spec as a Phase 4 appendix.
93
-
94
- **Design principle**: Constrain behavioral characteristics (accuracy, feedback, quality gates), NOT specific actions (which tool, which CLI tool, which path). Tasks are diverse — the coordinator composes task-specific Phase 2-3 instructions, while these traits ensure execution quality regardless of task type.
95
-
96
- ### Accuracy — outputs must be verifiable
97
-
98
- - Files claimed as **created** → Read to confirm file exists and has content
99
- - Files claimed as **modified** → Read to confirm content actually changed
100
- - Analysis claimed as **complete** → artifact file exists in `<session>/artifacts/`
101
-
102
- ### Feedback Contract — completion report must include evidence
103
-
104
- Phase 4 must produce a verification summary with these fields:
105
-
106
- | Field | When Required | Content |
107
- |-------|---------------|---------|
108
- | `files_produced` | New files created | Path list |
109
- | `files_modified` | Existing files changed | Path + before/after line count |
110
- | `artifacts_written` | Always | Paths in `<session>/artifacts/` |
111
- | `verification_method` | Always | How verified: Read confirm / syntax check / diff |
112
-
113
- ### Quality Gate — verify before reporting complete
114
-
115
- - Phase 4 MUST verify Phase 3's **actual output** (not planned output)
116
- - Verification fails → retry Phase 3 (max 2 retries)
117
- - Still fails → report `partial_completion` with details, NOT `completed`
118
- - Update shared state via `team_msg(operation="log", type="state_update", data={...})` after verification passes
119
-
120
- Quality thresholds from [specs/quality-gates.md](quality-gates.md):
121
- - Pass >= 80%: report completed
122
- - Review 60-79%: report completed with warnings
123
- - Fail < 60%: retry Phase 3 (max 2)
124
-
125
- ### Error Protocol
126
-
127
- - Primary approach fails → try alternative (different CLI tool / different tool)
128
- - 2 retries exhausted → escalate to coordinator with failure details
129
- - NEVER: skip verification and report completed
130
-
131
- ---
132
-
133
- ## Reference Patterns
134
-
135
- Coordinator MAY reference these patterns when composing Phase 2-4 content for a role-spec. These are **structural guidance, not mandatory templates**. The task description determines specific behavior — patterns only suggest common phase structures.
136
-
137
- ### Research / Exploration
138
-
139
- - Phase 2: Define exploration scope + load prior knowledge from shared state and wisdom
140
- - Phase 3: Explore via CLI tools, direct tool calls, or codebase search — approach chosen by agent
141
- - Phase 4: Verify findings documented (Behavioral Traits) + update shared state
142
-
143
- ### Document / Content
144
-
145
- - Phase 2: Load upstream artifacts + read target files (if modifying existing docs)
146
- - Phase 3: Create new documents OR modify existing documents — determined by task, not template
147
- - Phase 4: Verify documents exist with expected content (Behavioral Traits) + update shared state
148
-
149
- ### Code Implementation
150
-
151
- - Phase 2: Load design/spec artifacts from upstream
152
- - Phase 3: Implement code changes — CLI tool choice and approach determined by task complexity
153
- - Phase 4: Syntax check + file verification (Behavioral Traits) + update shared state
154
-
155
- ### Analysis / Audit
156
-
157
- - Phase 2: Load analysis targets (artifacts or source files)
158
- - Phase 3: Multi-dimension analysis — perspectives and depth determined by task
159
- - Phase 4: Verify report exists + severity classification (Behavioral Traits) + update shared state
160
-
161
- ### Validation / Testing
162
-
163
- - Phase 2: Detect test framework + identify changed files from upstream
164
- - Phase 3: Run test-fix cycle — iteration count and strategy determined by task
165
- - Phase 4: Verify pass rate + coverage (Behavioral Traits) + update shared state
166
-
167
- ---
168
-
169
- ## Knowledge Transfer Protocol
170
-
171
- Full protocol: [specs/knowledge-transfer.md](knowledge-transfer.md)
172
-
173
- Generated role-specs Phase 2 MUST declare which upstream sources to load.
174
- Generated role-specs Phase 4 MUST include state update and artifact publishing.
175
-
176
- ---
177
-
178
- ## Generated Role-Spec Validation
179
-
180
- Coordinator verifies before writing each role-spec:
181
-
182
- | Check | Criteria |
183
- |-------|----------|
184
- | Frontmatter complete | All required fields present (role, prefix, inner_loop, output_tag, message_types, CLI tools) |
185
- | Identity block | Tag, prefix, responsibility defined |
186
- | Boundaries | MUST and MUST NOT rules present |
187
- | Phase 2 | Context loading sources specified |
188
- | Phase 3 | Execution goal clear, not prescriptive about tools |
189
- | Phase 4 | Behavioral Traits copied verbatim |
190
- | Error Handling | Table with 3+ scenarios |
191
- | Line count | Target ~80 lines (max 120) |
192
- | No built-in overlap | No Phase 1/5, no message bus code, no consensus handling |
@@ -1,116 +0,0 @@
1
- ---
2
- name: team-executor
3
- description: Resume team-coordinate sessions for pure execution
4
- allowed-tools: spawn_agent(*), wait_agent(*), send_message(*), followup_task(*), close_agent(*), list_agents(*), report_agent_job_result(*), request_user_input(*), Read(*), Write(*), Edit(*), Bash(*), Glob(*), Grep(*), mcp__maestro-tools__team_msg(*)
5
- ---
6
-
7
- <purpose>
8
- Lightweight session execution skill: load session -> reconcile state -> spawn team-worker agents -> execute -> deliver. **No analysis, no role generation** -- only executes existing team-coordinate sessions.
9
-
10
- ```
11
- Skill(skill="team-executor")
12
- args="--session=<path>" [REQUIRED]
13
- |
14
- Session Validation
15
- |
16
- +-- valid? --+-- NO --> Error immediately
17
- +-- YES -> Orchestration Mode -> executor
18
- |
19
- +-------+-------+-------+
20
- v v v v
21
- [team-worker agents loaded from session role-specs]
22
- ```
23
-
24
- </purpose>
25
-
26
- <context>
27
- $ARGUMENTS — session path (required).
28
-
29
- **Parse:** `--session=<path>` — Path to team-coordinate session folder (REQUIRED)
30
-
31
- **Validation Steps:**
32
- 1. Check `--session` provided
33
- 2. Directory exists at path
34
- 3. `team-session.json` exists and valid JSON
35
- 4. `task-analysis.json` exists and valid JSON
36
- 5. `role-specs/` directory has at least one `.md` file
37
- 6. Each role in `team-session.json#roles` has corresponding `.md` in `role-specs/`
38
-
39
- **Dispatch:**
40
- | Scenario | Action |
41
- |----------|--------|
42
- | No `--session` | ERROR immediately |
43
- | `--session` invalid | ERROR with specific reason |
44
- | Valid session | Orchestration Mode -> executor |
45
-
46
- **User Commands** (wake paused executor):
47
- | Command | Action |
48
- |---------|--------|
49
- | `check` / `status` | Output execution status graph, no advancement |
50
- | `resume` / `continue` | Check worker states, advance next step |
51
-
52
- **Role Registry:**
53
- | Role | File | Type |
54
- |------|------|------|
55
- | executor | [roles/executor/role.md](roles/executor/role.md) | built-in orchestrator |
56
- | (dynamic) | `<session>/role-specs/<role-name>.md` | loaded from session |
57
-
58
- **Integration with team-coordinate:**
59
- | Scenario | Skill |
60
- |----------|-------|
61
- | New task, no session | team-coordinate |
62
- | Existing session, resume execution | **team-executor** |
63
- | Session needs new roles | team-coordinate (with resume) |
64
- | Pure execution, no analysis | **team-executor** |
65
- </context>
66
-
67
- <execution>
68
-
69
- ### Orchestration Lifecycle
70
-
71
- Validate session -> Phase 0 (reconcile state, reset interrupted tasks, detect orphans) -> Phase 1 (spawn first batch workers, STOP) -> callback loop (advance next step) -> Phase 2 (report + completion action).
72
-
73
- ### Worker Spawn Template
74
-
75
- Spawn via `team-worker` agent with role-spec path from session. Message includes: role, role_spec, session folder/id, requirement, inner_loop flag, task context, upstream context. After spawning: `wait_agent` (30 min). Timeout: STATUS_CHECK (3 min) -> FINALIZE (3 min) -> mark timed_out, close.
76
-
77
- ### Model Selection
78
-
79
- Implementation/fix roles: `reasoning_effort: "high"`. Verification/test: `"medium"`. Default: `"high"`.
80
-
81
- ### State Reconciliation
82
-
83
- On resume: compare `list_agents({})` with task-analysis.json. Reset orphaned tasks to pending.
84
-
85
- ### Worker Communication
86
-
87
- `send_message` (supplementary context), `followup_task` (assign work to inner_loop worker), `close_agent` (cleanup).
88
-
89
- ### Completion Action
90
-
91
- Present choice: **Archive & Clean** (mark completed, output summary), **Keep Active** (mark paused, output resume command), **Export Results** (prompt path, copy, archive).
92
- </execution>
93
-
94
- <error_codes>
95
- | Scenario | Resolution |
96
- |----------|------------|
97
- | No --session provided | ERROR immediately with usage message |
98
- | Session directory not found | ERROR with path, suggest checking path |
99
- | team-session.json missing | ERROR, session incomplete, suggest re-run team-coordinate |
100
- | task-analysis.json missing | ERROR, session incomplete, suggest re-run team-coordinate |
101
- | No role-specs in session | ERROR, session incomplete, suggest re-run team-coordinate |
102
- | Role-spec file not found | ERROR with expected path |
103
- | capability_gap reported | Warn only, cannot generate new role-specs |
104
- | Fast-advance spawns wrong task | Executor reconciles on next callback |
105
- | Completion action fails | Default to Keep Active, log warning |
106
- </error_codes>
107
-
108
- <success_criteria>
109
- - [ ] Session validated (all required files present)
110
- - [ ] State reconciled on resume (orphaned tasks reset)
111
- - [ ] Team-worker agents spawned with correct role-specs
112
- - [ ] Workers complete or timeout handled gracefully
113
- - [ ] Pipeline advances step-by-step through all tasks
114
- - [ ] Completion action presented and executed
115
- - [ ] Session state updated throughout lifecycle
116
- </success_criteria>
@@ -1,213 +0,0 @@
1
- # Command: monitor
2
-
3
- ## Purpose
4
-
5
- Synchronous pipeline coordination using spawn_agent + wait_agent for team-executor v2. Role names are read from `tasks.json#roles`. Workers are spawned as `team_worker` agents with role-spec paths. **handleAdapt is LIMITED**: only warns, cannot generate new role-specs. Includes `handleComplete` for pipeline completion action.
6
-
7
- ## Constants
8
-
9
- | Constant | Value | Description |
10
- |----------|-------|-------------|
11
- | WORKER_AGENT | team_worker | All workers spawned via spawn_agent |
12
- | ONE_STEP_PER_INVOCATION | false | Synchronous wait loop |
13
- | FAST_ADVANCE_AWARE | true | Workers may skip executor for simple linear successors |
14
- | ROLE_GENERATION | disabled | handleAdapt cannot generate new role-specs |
15
-
16
- ## Phase 2: Context Loading
17
-
18
- | Input | Source | Required |
19
- |-------|--------|----------|
20
- | Session file | `<session-folder>/tasks.json` | Yes |
21
- | Active agents | tasks.json active_agents | Yes |
22
- | Role registry | tasks.json roles[] | Yes |
23
-
24
- **Dynamic role resolution**: Known worker roles are loaded from `tasks.json roles[].name`. Role-spec paths are in `tasks.json roles[].role_spec`.
25
-
26
- ## Phase 3: Handler Routing
27
-
28
- ### Wake-up Source Detection
29
-
30
- Parse `$ARGUMENTS` to determine handler:
31
-
32
- | Priority | Condition | Handler |
33
- |----------|-----------|---------|
34
- | 1 | Message contains `[<role-name>]` from session roles | handleCallback |
35
- | 2 | Contains "capability_gap" | handleAdapt |
36
- | 3 | Contains "check" or "status" | handleCheck |
37
- | 4 | Contains "resume", "continue", or "next" | handleResume |
38
- | 5 | Pipeline detected as complete | handleComplete |
39
- | 6 | None of the above (initial spawn after dispatch) | handleSpawnNext |
40
-
41
- ---
42
-
43
- ### Handler: handleCallback
44
-
45
- Worker completed a task. Verify completion, update state, auto-advance.
46
-
47
- ```
48
- Match agent by role -> route:
49
- progress_update (not final) -> update state, keep in active_agents -> STOP
50
- completed -> close_agent, remove from active_agents, -> handleSpawnNext
51
- not_completed -> log progress -> STOP
52
- no_match -> scan all agents for completions -> process any found -> handleSpawnNext, else STOP
53
- ```
54
-
55
- **Fast-advance note**: Check if expected next task is already `in_progress` (fast-advanced). If yes -> skip spawning, sync active_agents.
56
-
57
- ---
58
-
59
- ### Handler: handleCheck
60
-
61
- Read-only status report. No pipeline advancement.
62
-
63
- Read team_msg (type="progress", last=50) + team_msg (type="blocker", last=10). Aggregate per-worker milestones.
64
-
65
- **Output format**:
66
- ```
67
- [executor] Pipeline Status — Progress: <completed>/<total> (<percent>%)
68
- [executor] Execution Graph: <dependency graph with status icons> done=completed >>>=running o=pending .=not created
69
- [executor] Active Workers: <task_id> <role> <milestone_phase> <pct>% "<summary>" <time_ago>
70
- [executor] Blockers: <task_id> <role> "<blocker_summary>" <time_ago> (omit if none)
71
- [executor] Ready to spawn: <subjects>
72
- [executor] Commands: 'resume' to advance | 'check' to refresh
73
- ```
74
-
75
- **CLI monitoring**: `maestro agent-msg list -s "<session_id>" --type progress --last 10`
76
-
77
- Then STOP.
78
-
79
- ---
80
-
81
- ### Handler: handleResume
82
-
83
- Check active agent completion, process results, advance pipeline.
84
-
85
- ```
86
- Load active_agents -> route:
87
- none -> handleSpawnNext
88
- has agents -> classify each: completed(close_agent) | in_progress | failed(reset to pending)
89
- some completed -> handleSpawnNext
90
- all running -> report status -> STOP
91
- all failed -> handleSpawnNext (retry)
92
- ```
93
-
94
- ---
95
-
96
- ### Handler: handleSpawnNext
97
-
98
- Find all ready tasks, spawn team_worker agents, wait for completion, process results.
99
-
100
- ```
101
- Classify tasks: completed | in_progress | ready (pending + all deps completed)
102
-
103
- Ready tasks -> route:
104
- none + in_progress exists -> report waiting -> STOP
105
- none + nothing in_progress -> PIPELINE_COMPLETE -> handleComplete
106
- has ready -> for each:
107
- skip if Inner Loop role already has active_agent
108
- else: set status="in_progress", log task_unblocked, spawn team_worker, add to active_agents
109
- ```
110
-
111
- **Spawn worker message template**:
112
- ```
113
- ## Role Assignment
114
- role: <role> | role_spec: <session-folder>/role-specs/<role>.md
115
- session: <session-folder> | session_id: <session-id> | team_name: <team-name>
116
- requirement: <task-description> | inner_loop: <true|false>
117
- Read role_spec for Phase 2-4 instructions.
118
- ## Task Context
119
- task_id: <taskId> | title: <task-title> | description: <task-description>
120
- ## Upstream Context
121
- <prevContext>
122
- ## Progress Milestones
123
- Report progress via team_msg at phase boundaries. Blockers via type="blocker". Completion via type="task_complete" after report_agent_job_result.
124
- ```
125
-
126
- ### Wait and Process Results
127
-
128
- `wait_agent({ timeout_ms: 1800000 })` (30 min), drain progress from team_msg.
129
-
130
- **Timeout escalation**: STATUS_CHECK (3 min) -> FINALIZE with interrupt (3 min) -> mark timed_out with last progress context, close_agent.
131
-
132
- **Normal completion**: Read `discoveries/{task_id}.json` for status/findings/error. Missing file -> status="failed". Close each agent.
133
-
134
- ### Persist and Loop
135
-
136
- Write tasks.json -> more tasks ready? -> loop handleSpawnNext. All done -> handleComplete. Blocked -> report, STOP.
137
-
138
- ---
139
-
140
- ### Handler: handleComplete
141
-
142
- Pipeline complete. Execute completion action.
143
-
144
- ```
145
- Generate summary: deliverables + stats + duration
146
-
147
- Route by completion_action:
148
- "interactive" -> request_user_input:
149
- "Archive & Clean" -> rm session folder, output summary
150
- "Keep Active" -> status="paused", output resume command
151
- "Export Results" -> copy artifacts, then Archive & Clean
152
- "auto_archive" -> Archive & Clean without prompt
153
- "auto_keep" -> Keep Active without prompt
154
- ```
155
-
156
- **Fallback**: If completion action fails, default to Keep Active, log warning.
157
-
158
- ---
159
-
160
- ### Handler: handleAdapt (LIMITED)
161
-
162
- **UNLIKE team-coordinate, executor CANNOT generate new role-specs.**
163
-
164
- ```
165
- Log capability_gap via team_msg (type: warning)
166
- Existing role covers gap? -> redirect -> STOP
167
- Genuine gap -> report to user: "Options: 1. Continue 2. Re-run team-coordinate 3. Manually add role-spec"
168
- Continue with existing roles
169
- ```
170
-
171
- ---
172
-
173
- ### Worker Failure Handling
174
-
175
- 1. Reset task -> pending in tasks.json
176
- 2. Log via team_msg (type: error)
177
- 3. Report to user: task reset, will retry on next resume
178
-
179
- ### Fast-Advance Failure Recovery
180
-
181
- Detect orphaned tasks (in_progress without active_agents, > 5 minutes) -> reset to pending -> handleSpawnNext.
182
-
183
- ### Consensus-Blocked Handling
184
-
185
- ```
186
- Route by consensus_blocked severity:
187
- HIGH -> create REVISION task (max 1, else PAUSE + escalate)
188
- MEDIUM -> proceed with warning, log to wisdom/issues.md
189
- LOW -> proceed normally as consensus_reached with notes
190
- ```
191
-
192
- ## Phase 4: Validation
193
-
194
- | Check | Criteria |
195
- |-------|----------|
196
- | Session state consistent | active_agents matches tasks.json in_progress tasks |
197
- | No orphaned tasks | Every in_progress task has an active_agents entry |
198
- | Dynamic roles valid | All task owners exist in tasks.json roles |
199
- | Completion detection | readyTasks=0 + inProgressTasks=0 -> PIPELINE_COMPLETE |
200
- | Fast-advance tracking | Detect fast-advanced tasks, sync to active_agents |
201
-
202
- ## Error Handling
203
-
204
- | Scenario | Resolution |
205
- |----------|------------|
206
- | Session file not found | Error, suggest re-run team-coordinate |
207
- | Unknown role in callback | Log info, scan for other completions |
208
- | All workers still running on resume | Report status, suggest check later |
209
- | Pipeline stall | Check for missing tasks, report to user |
210
- | Fast-advance conflict | Executor reconciles, no duplicate spawns |
211
- | Role-spec file not found | Error, cannot proceed |
212
- | capability_gap | WARN only, cannot generate new role-specs |
213
- | Completion action fails | Default to Keep Active, log warning |