maestro-flow 0.4.5 → 0.4.7

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 (52) hide show
  1. package/.codex/skills/maestro-collab/SKILL.md +218 -117
  2. package/.codex/skills/maestro-execute/SKILL.md +13 -11
  3. package/.codex/skills/maestro-milestone-audit/SKILL.md +12 -10
  4. package/.codex/skills/maestro-ralph/SKILL.md +16 -4
  5. package/.codex/skills/maestro-ui-codify/SKILL.md +18 -16
  6. package/.codex/skills/manage-codebase-rebuild/SKILL.md +20 -13
  7. package/.codex/skills/manage-issue-discover/SKILL.md +19 -17
  8. package/.codex/skills/quality-debug/SKILL.md +35 -31
  9. package/.codex/skills/quality-refactor/SKILL.md +20 -12
  10. package/.codex/skills/quality-review/SKILL.md +21 -17
  11. package/.codex/skills/team-coordinate/SKILL.md +462 -235
  12. package/.codex/skills/team-coordinate/specs/role-catalog.md +132 -0
  13. package/.codex/skills/team-lifecycle-v4/SKILL.md +445 -191
  14. package/.codex/skills/team-quality-assurance/SKILL.md +205 -161
  15. package/.codex/skills/team-review/SKILL.md +198 -159
  16. package/.codex/skills/team-tech-debt/SKILL.md +214 -144
  17. package/.codex/skills/team-testing/SKILL.md +210 -158
  18. package/package.json +1 -1
  19. package/.codex/skills/team-coordinate/roles/coordinator/commands/analyze-task.md +0 -247
  20. package/.codex/skills/team-coordinate/roles/coordinator/commands/dispatch.md +0 -126
  21. package/.codex/skills/team-coordinate/roles/coordinator/commands/monitor.md +0 -265
  22. package/.codex/skills/team-coordinate/roles/coordinator/role.md +0 -403
  23. package/.codex/skills/team-coordinate/specs/knowledge-transfer.md +0 -113
  24. package/.codex/skills/team-coordinate/specs/pipelines.md +0 -97
  25. package/.codex/skills/team-coordinate/specs/quality-gates.md +0 -112
  26. package/.codex/skills/team-coordinate/specs/role-spec-template.md +0 -192
  27. package/.codex/skills/team-executor/SKILL.md +0 -116
  28. package/.codex/skills/team-executor/roles/executor/commands/monitor.md +0 -213
  29. package/.codex/skills/team-executor/roles/executor/role.md +0 -173
  30. package/.codex/skills/team-executor/specs/session-schema.md +0 -230
  31. package/.codex/skills/team-lifecycle-v4/roles/coordinator/commands/analyze.md +0 -56
  32. package/.codex/skills/team-lifecycle-v4/roles/coordinator/commands/dispatch.md +0 -61
  33. package/.codex/skills/team-lifecycle-v4/roles/coordinator/commands/monitor.md +0 -113
  34. package/.codex/skills/team-lifecycle-v4/roles/coordinator/role.md +0 -189
  35. package/.codex/skills/team-lifecycle-v4/schemas/tasks-schema.md +0 -100
  36. package/.codex/skills/team-lifecycle-v4/specs/knowledge-transfer.md +0 -204
  37. package/.codex/skills/team-quality-assurance/roles/coordinator/commands/analyze.md +0 -72
  38. package/.codex/skills/team-quality-assurance/roles/coordinator/commands/dispatch.md +0 -108
  39. package/.codex/skills/team-quality-assurance/roles/coordinator/commands/monitor.md +0 -163
  40. package/.codex/skills/team-quality-assurance/roles/coordinator/role.md +0 -177
  41. package/.codex/skills/team-review/roles/coordinator/commands/analyze.md +0 -71
  42. package/.codex/skills/team-review/roles/coordinator/commands/dispatch.md +0 -90
  43. package/.codex/skills/team-review/roles/coordinator/commands/monitor.md +0 -135
  44. package/.codex/skills/team-review/roles/coordinator/role.md +0 -176
  45. package/.codex/skills/team-tech-debt/roles/coordinator/commands/analyze.md +0 -47
  46. package/.codex/skills/team-tech-debt/roles/coordinator/commands/dispatch.md +0 -163
  47. package/.codex/skills/team-tech-debt/roles/coordinator/commands/monitor.md +0 -133
  48. package/.codex/skills/team-tech-debt/roles/coordinator/role.md +0 -173
  49. package/.codex/skills/team-testing/roles/coordinator/commands/analyze.md +0 -70
  50. package/.codex/skills/team-testing/roles/coordinator/commands/dispatch.md +0 -106
  51. package/.codex/skills/team-testing/roles/coordinator/commands/monitor.md +0 -156
  52. package/.codex/skills/team-testing/roles/coordinator/role.md +0 -185
@@ -1,191 +1,445 @@
1
- ---
2
- name: team-lifecycle-v4
3
- description: Full lifecycle team -- plan, develop, test, review
4
- allowed-tools: spawn_agent(*), wait_agent(*), send_message(*), followup_task(*), close_agent(*), list_agents(*), report_agent_job_result(*), Read(*), Write(*), Edit(*), Bash(*), Glob(*), Grep(*), request_user_input(*), mcp__maestro-tools__team_msg(*)
5
- ---
6
-
7
- <purpose>
8
- Orchestrate multi-agent software development: specification -> planning -> implementation -> testing -> review.
9
-
10
- ```
11
- Skill(skill="team-lifecycle-v4", args="task description")
12
- |
13
- SKILL.md (this file) = Router
14
- |
15
- +--------------+--------------+
16
- | |
17
- no --role flag --role <name>
18
- | |
19
- Coordinator Worker
20
- roles/coordinator/role.md roles/<name>/role.md
21
- |
22
- +-- analyze -> dispatch -> spawn -> wait -> collect
23
- |
24
- +--------+---+--------+
25
- v v v
26
- spawn_agent ... spawn_agent
27
- (team_worker) (team_supervisor)
28
- per-task resident agent
29
- lifecycle followup_task-driven
30
- | |
31
- +-- wait_agent --------+
32
- |
33
- collect results
34
- ```
35
-
36
- </purpose>
37
-
38
- <context>
39
- ### Role Registry
40
-
41
- | Role | Path | Prefix | Inner Loop |
42
- |------|------|--------|------------|
43
- | coordinator | [roles/coordinator/role.md](roles/coordinator/role.md) | -- | -- |
44
- | analyst | [roles/analyst/role.md](roles/analyst/role.md) | RESEARCH-* | false |
45
- | writer | [roles/writer/role.md](roles/writer/role.md) | DRAFT-* | true |
46
- | planner | [roles/planner/role.md](roles/planner/role.md) | PLAN-* | true |
47
- | executor | [roles/executor/role.md](roles/executor/role.md) | IMPL-* | true |
48
- | tester | [roles/tester/role.md](roles/tester/role.md) | TEST-* | false |
49
- | reviewer | [roles/reviewer/role.md](roles/reviewer/role.md) | REVIEW-*, QUALITY-*, IMPROVE-* | false |
50
- | supervisor | [roles/supervisor/role.md](roles/supervisor/role.md) | CHECKPOINT-* | false |
51
-
52
- ### Role Router
53
-
54
- Parse `$ARGUMENTS`:
55
- - Has `--role <name>` -> Read `roles/<name>/role.md`, execute Phase 2-4
56
- - No `--role` -> `roles/coordinator/role.md`, execute entry router
57
-
58
- ### Delegation Lock
59
-
60
- **Coordinator is a PURE ORCHESTRATOR. It coordinates, it does NOT do.**
61
-
62
- Before calling ANY tool, apply this check:
63
-
64
- | Tool Call | Verdict | Reason |
65
- |-----------|---------|--------|
66
- | `spawn_agent`, `wait_agent`, `close_agent`, `send_message`, `followup_task` | ALLOWED | Orchestration |
67
- | `list_agents` | ALLOWED | Agent health check |
68
- | `request_user_input` | ALLOWED | User interaction |
69
- | `mcp__maestro-tools__team_msg` | ALLOWED | Message bus |
70
- | `Read/Write` on `.workflow/.team/` files | ALLOWED | Session state |
71
- | `Read` on `roles/`, `commands/`, `specs/`, `templates/` | ALLOWED | Loading own instructions |
72
- | `Read/Grep/Glob` on project source code | BLOCKED | Delegate to worker |
73
- | `Edit` on any file outside `.workflow/` | BLOCKED | Delegate to worker |
74
- | `Bash("maestro delegate ...")` | BLOCKED | Only workers call CLI |
75
- | `Bash` running build/test/lint commands | BLOCKED | Delegate to worker |
76
-
77
- **If a tool call is BLOCKED**: STOP. Create a task, spawn a worker.
78
-
79
- **No exceptions for "simple" tasks.** Even a single-file read-and-report MUST go through spawn_agent.
80
-
81
- ### Shared Constants
82
-
83
- - **Session prefix**: `TLV4`
84
- - **Session path**: `.workflow/.team/TLV4-<slug>-<date>/`
85
- - **State file**: `<session>/tasks.json`
86
- - **Discovery files**: `<session>/discoveries/{task_id}.json`
87
- - **CLI tools**: `maestro delegate --mode analysis` (read-only), `maestro delegate --mode write` (modifications)
88
-
89
- ### Worker Spawn Template
90
-
91
- Spawn via `team-worker` agent. Message includes: role, role_spec path (`<skill_root>/roles/<role>/role.md`), session folder/id, requirement, inner_loop flag, task context (id, title, description, pipeline_phase), upstream context. Worker executes: Phase 1 (discovery) -> role Phase 2-4 -> Phase 5 (report).
92
-
93
- ### Supervisor Spawn Template
94
-
95
- Supervisor is a **resident agent** (`team_supervisor`), independent from team_worker.
96
-
97
- - **Spawn** (Phase 2, once): Load role-spec from `roles/supervisor/role.md`, init baseline context, go idle
98
- - **Wake** (per CHECKPOINT): `followup_task` with checkpoint task_id, upstream scope, progress. `wait_agent` (30 min)
99
- - **Shutdown**: `close_agent({ target: "supervisor" })` at pipeline end
100
-
101
- ### Model Selection Guide
102
-
103
- | Role | reasoning_effort |
104
- |------|-------------------|
105
- | Analyst (RESEARCH-*) | medium |
106
- | Writer (DRAFT-*) | high |
107
- | Planner (PLAN-*) | high |
108
- | Executor (IMPL-*) | high |
109
- | Tester (TEST-*) | high |
110
- | Reviewer (REVIEW-*, QUALITY-*, IMPROVE-*) | high |
111
- | Supervisor (CHECKPOINT-*) | medium |
112
-
113
- Override via `model`/`reasoning_effort` params in spawn_agent for cost optimization.
114
-
115
- ### v4 Agent Coordination
116
-
117
- **Message Semantics**: `send_message` for supplementary info to workers. `followup_task` to wake supervisor for checkpoints. `list_agents` for health checks.
118
-
119
- **CRITICAL**: Supervisor is a **resident agent** woken via `followup_task`, NOT `send_message`. Regular workers are one-shot; supervisor persists across checkpoints.
120
-
121
- **Agent Health Check**: Reconcile `tasks.json.active_agents` with `list_agents({})`. Reset orphaned tasks to pending. If supervisor missing but CHECKPOINT tasks pending, respawn.
122
-
123
- **Named Targeting**: `send_message({ target: "IMPL-001" })`, `followup_task({ target: "supervisor" })`, `close_agent({ target: ... })`.
124
-
125
- ### User Commands
126
-
127
- | Command | Action |
128
- |---------|--------|
129
- | `check` / `status` | View execution status graph |
130
- | `resume` / `continue` | Advance to next step |
131
- | `revise <TASK-ID> [feedback]` | Revise specific task |
132
- | `feedback <text>` | Inject feedback for revision |
133
- | `recheck` | Re-run quality check |
134
- | `improve [dimension]` | Auto-improve weakest dimension |
135
-
136
- ### Completion Action
137
-
138
- Present choice via `request_user_input`: **Archive & Clean** (recommended), **Keep Active**, **Export Results**.
139
-
140
- ### Specs Reference
141
-
142
- - [specs/pipelines.md](specs/pipelines.md) -- Pipeline definitions and task registry
143
- - [specs/quality-gates.md](specs/quality-gates.md) -- Quality gate criteria and scoring
144
- - [specs/knowledge-transfer.md](specs/knowledge-transfer.md) -- Artifact and state transfer protocols
145
-
146
- ### Session Directory
147
-
148
- ```
149
- .workflow/.team/TLV4-<slug>-<date>/
150
- +-- tasks.json # Task state (JSON)
151
- +-- discoveries/ # Per-task findings ({task_id}.json)
152
- +-- spec/ # Spec phase outputs
153
- +-- plan/ # Implementation plan
154
- +-- artifacts/ # All deliverables
155
- +-- wisdom/ # Cross-task knowledge
156
- +-- explorations/ # Shared explore cache
157
- +-- discussions/ # Discuss round records
158
- ```
159
- </context>
160
-
161
- <execution>
162
-
163
- ### Wave Execution Engine
164
-
165
- Per wave: load state from `tasks.json` -> skip tasks with failed deps -> build upstream context from `discoveries/{id}.json` -> separate regular vs CHECKPOINT tasks -> spawn regular workers (`wait_agent` 30 min, timeout: STATUS_CHECK 3 min -> FINALIZE 3 min -> close) -> collect results to `discoveries/`, update `tasks.json` -> execute checkpoints via `followup_task` to supervisor -> handle `block` verdict (prompt: Override/Revise/Abort) -> persist state.
166
- </execution>
167
-
168
- <error_codes>
169
-
170
- | Scenario | Resolution |
171
- |----------|------------|
172
- | Unknown command | Error with available command list |
173
- | Role not found | Error with role registry |
174
- | CLI tool fails | Worker fallback to direct implementation |
175
- | Supervisor crash | Respawn with `recovery: true`, auto-rebuilds from existing reports |
176
- | Supervisor not ready for CHECKPOINT | Spawn/respawn supervisor, wait for ready, then wake |
177
- | Completion action fails | Default to Keep Active |
178
- | Worker timeout | Mark task as failed, continue wave |
179
- | Discovery file missing | Mark task as failed with "No discovery file produced" |
180
- </error_codes>
181
-
182
- <success_criteria>
183
- - [ ] Role router correctly dispatches to coordinator or worker based on --role flag
184
- - [ ] Coordinator spawns workers with correct role-spec paths and task context
185
- - [ ] Supervisor spawned once and woken via followup_task for checkpoints
186
- - [ ] Wave execution engine processes tasks in dependency order
187
- - [ ] Checkpoint verdicts respected (block prompts user, pass continues)
188
- - [ ] Session state persisted in tasks.json after each wave
189
- - [ ] Agent health reconciled on resume (orphaned tasks reset to pending)
190
- - [ ] Completion action presented and handled correctly
191
- </success_criteria>
1
+ ---
2
+ name: team-lifecycle-v4
3
+ description: Full lifecycle team -- plan, develop, test, review
4
+ argument-hint: "[task description] [-y|--yes] [-c|--concurrency N] [--continue] [--pipeline spec-only|impl-only|full-lifecycle]"
5
+ allowed-tools: spawn_agents_on_csv, Read, Write, Edit, Bash, Glob, Grep, request_user_input
6
+ ---
7
+
8
+ <purpose>
9
+ Wave-based lifecycle orchestration via `spawn_agents_on_csv`. Fixed roles with pre-defined pipelines: specification → planning → implementation → testing → review.
10
+
11
+ **Core workflow**: Select Pipeline → Build CSV from Pipeline Definition → Wave-by-Wave Execution → Aggregate Results
12
+
13
+ ```
14
+ +-------------------------------------------------------------------+
15
+ | LIFECYCLE V4 CSV WAVE WORKFLOW |
16
+ +-------------------------------------------------------------------+
17
+ | |
18
+ | Phase 1: Pipeline Selection + CSV Generation |
19
+ | +-- Detect pipeline from keywords or --pipeline flag |
20
+ | +-- Load pipeline definition from specs/pipelines.md |
21
+ | +-- Build tasks.csv with wave assignments |
22
+ | +-- User validates (skip if -y) |
23
+ | |
24
+ | Phase 2: Wave Execution Engine |
25
+ | +-- For each wave N (sequential): |
26
+ | | +-- Build prev_context from upstream findings |
27
+ | | +-- spawn_agents_on_csv(wave-N.csv) |
28
+ | | +-- Each agent reads its role.md for domain logic |
29
+ | | +-- Merge results → master tasks.csv |
30
+ | | +-- CHECKPOINT waves: supervisor verifies quality |
31
+ | | +-- User approval at checkpoints (skip if -y) |
32
+ | +-- discoveries.ndjson shared across all waves |
33
+ | |
34
+ | Phase 3: Results Aggregation |
35
+ | +-- Export results.csv |
36
+ | +-- Generate context.md |
37
+ | +-- Display summary with deliverables |
38
+ | |
39
+ +-------------------------------------------------------------------+
40
+ ```
41
+
42
+ </purpose>
43
+
44
+ <context>
45
+ ```bash
46
+ $team-lifecycle-v4 "build user authentication system"
47
+ $team-lifecycle-v4 -y --pipeline spec-only "design payment module"
48
+ $team-lifecycle-v4 --pipeline impl-only "implement auth from existing spec"
49
+ $team-lifecycle-v4 --continue "20260518-tlv4-auth-system"
50
+ ```
51
+
52
+ **Flags**:
53
+ - `-y, --yes`: Skip confirmations and checkpoint approvals
54
+ - `-c, --concurrency N`: Max concurrent agents per wave (default: 3)
55
+ - `--continue`: Resume existing session
56
+ - `--pipeline`: Force pipeline (spec-only, impl-only, full-lifecycle)
57
+ - `--no-supervision`: Skip CHECKPOINT tasks (opt-out from supervisor quality gates)
58
+
59
+ ### Role Registry (Fixed)
60
+
61
+ | Role | Path | Prefix |
62
+ |------|------|--------|
63
+ | analyst | [roles/analyst/role.md](roles/analyst/role.md) | RESEARCH-* |
64
+ | writer | [roles/writer/role.md](roles/writer/role.md) | DRAFT-* |
65
+ | planner | [roles/planner/role.md](roles/planner/role.md) | PLAN-* |
66
+ | executor | [roles/executor/role.md](roles/executor/role.md) | IMPL-* |
67
+ | tester | [roles/tester/role.md](roles/tester/role.md) | TEST-* |
68
+ | reviewer | [roles/reviewer/role.md](roles/reviewer/role.md) | REVIEW-*, QUALITY-* |
69
+ | supervisor | [roles/supervisor/role.md](roles/supervisor/role.md) | CHECKPOINT-* |
70
+
71
+ ### Session Structure
72
+
73
+ ```
74
+ .workflow/.csv-wave/{YYYYMMDD}-tlv4-{slug}/
75
+ +-- tasks.csv (master state)
76
+ +-- results.csv (final export)
77
+ +-- discoveries.ndjson (cross-wave shared)
78
+ +-- context.md (human-readable report)
79
+ +-- spec/ (spec phase outputs)
80
+ +-- plan/ (implementation plan)
81
+ +-- artifacts/ (all deliverables)
82
+ +-- wave-{N}.csv (temporary)
83
+ +-- wave-{N}-results.csv (temporary)
84
+ ```
85
+
86
+ **Output**: tasks.csv, results.csv, discoveries.ndjson, context.md, spec/, plan/, artifacts/
87
+
88
+ ### Specs Reference
89
+
90
+ | Spec | Purpose |
91
+ |------|---------|
92
+ | [specs/pipelines.md](specs/pipelines.md) | Pipeline definitions, task registry, wave assignments |
93
+ | [specs/quality-gates.md](specs/quality-gates.md) | Quality thresholds and scoring dimensions |
94
+
95
+ ### Templates Reference
96
+
97
+ | Template | Used By |
98
+ |----------|---------|
99
+ | [templates/product-brief.md](templates/product-brief.md) | writer (DRAFT-001) |
100
+ | [templates/requirements.md](templates/requirements.md) | writer (DRAFT-002) |
101
+ | [templates/architecture.md](templates/architecture.md) | writer (DRAFT-003) |
102
+ | [templates/epics.md](templates/epics.md) | writer (DRAFT-004) |
103
+ </context>
104
+
105
+ <csv_schema>
106
+
107
+ ### tasks.csv (Master State)
108
+
109
+ ```csv
110
+ id,title,description,role,pipeline_phase,deps,context_from,wave
111
+ "RESEARCH-001","Domain research","PURPOSE: Research domain, competitors, constraints | Success: Discovery context packaged\nTASK:\n - Analyze problem space\n - Explore codebase patterns\n - Package context\nEXPECTED: spec/discovery-context.json\nCONSTRAINTS: Read-only","analyst","research","","","1"
112
+ "DRAFT-001","Product brief","PURPOSE: Create product brief | Success: Self-validated document\nTASK:\n - Apply templates/product-brief.md\n - Define vision, problem, users, goals\n - Self-validate against quality-gates.md §3.1\nEXPECTED: spec/product-brief.md\nCONSTRAINTS: Follow template","writer","product-brief","RESEARCH-001","RESEARCH-001","2"
113
+ ```
114
+
115
+ **Input columns** (present in initial tasks.csv and wave-N.csv):
116
+
117
+ | Column | Description |
118
+ |--------|-------------|
119
+ | `id` | Task ID: `{PREFIX}-{NNN}` |
120
+ | `title` | Short task title |
121
+ | `description` | Task instructions (PURPOSE/TASK/EXPECTED/CONSTRAINTS) |
122
+ | `role` | Fixed role name from registry |
123
+ | `pipeline_phase` | Phase identifier (research, product-brief, requirements, etc.) |
124
+ | `deps` | Semicolon-separated dependency task IDs |
125
+ | `context_from` | Semicolon-separated task IDs for context |
126
+ | `wave` | Wave number |
127
+
128
+ **Lifecycle columns** (initialized with defaults, updated during execution):
129
+
130
+ | Column | Initial Value | Description |
131
+ |--------|--------------|-------------|
132
+ | `status` | `pending` | Task lifecycle: pending completed/failed/blocked/skipped |
133
+ | `findings` | `""` | Populated from output_schema merge |
134
+ | `files_modified` | `""` | Populated from output_schema merge |
135
+ | `quality_score` | `""` | Populated from output_schema merge |
136
+ | `error` | `""` | Populated from output_schema merge |
137
+
138
+ **Dynamic column** (added to wave-N.csv only, not in initial tasks.csv):
139
+
140
+ | Column | Description |
141
+ |--------|-------------|
142
+ | `prev_context` | Concatenated findings from context_from tasks, format: `--- TASK-ID: {id} ---\n{findings}` |
143
+
144
+ **Output columns** (via `output_schema` only, NOT in any CSV input):
145
+
146
+ | Column | Description |
147
+ |--------|-------------|
148
+ | `result_status` | completed / failed / blocked (maps to master `status`) |
149
+ | `findings` | Key findings (max 500 chars) |
150
+ | `files_modified` | Semicolon-separated paths |
151
+ | `quality_score` | Numeric quality score (0-100) |
152
+ | `error` | Error message if failed |
153
+
154
+ **Column separation rule**: Input/lifecycle columns and output_schema MUST NOT share names. `result_status` → master `status` during merge.
155
+
156
+ ### Pipeline Wave Assignments
157
+
158
+ #### spec-only (8 waves)
159
+
160
+ | Wave | Task | Role | Notes |
161
+ |------|------|------|-------|
162
+ | 1 | RESEARCH-001 | analyst | Domain research |
163
+ | 2 | DRAFT-001 | writer | Product brief |
164
+ | 3 | DRAFT-002 | writer | Requirements PRD |
165
+ | 4 | CHECKPOINT-001 | supervisor | Brief↔PRD consistency |
166
+ | 5 | DRAFT-003 | writer | Architecture |
167
+ | 6 | DRAFT-004 | writer | Epics & stories |
168
+ | 7 | CHECKPOINT-002 | supervisor | Full spec consistency |
169
+ | 8 | QUALITY-001 | reviewer | Readiness gate |
170
+
171
+ #### impl-only (5 waves)
172
+
173
+ | Wave | Task | Role | Notes |
174
+ |------|------|------|-------|
175
+ | 1 | PLAN-001 | planner | Implementation planning |
176
+ | 2 | CHECKPOINT-003 | supervisor | Plan↔input alignment |
177
+ | 3 | IMPL-001(~N) | executor | Implementation (parallel if multiple) |
178
+ | 4 | TEST-001 + REVIEW-001 | tester + reviewer | Validation (parallel) |
179
+ | 5 | (reserved) | | For IMPROVE tasks if review finds issues |
180
+
181
+ #### full-lifecycle (13 waves)
182
+
183
+ spec-only waves 1-8 + user approval checkpoint + impl-only waves shifted.
184
+
185
+ | Wave | Task | Role |
186
+ |------|------|------|
187
+ | 1-8 | (spec-only pipeline) | (see above) |
188
+ | 9 | PLAN-001 | planner |
189
+ | 10 | CHECKPOINT-003 | supervisor |
190
+ | 11 | IMPL-001(~N) | executor |
191
+ | 12 | TEST-001 + REVIEW-001 | tester + reviewer |
192
+ | 13 | (reserved) | — |
193
+ </csv_schema>
194
+
195
+ <invariants>
196
+ 1. **Start Immediately**: First action is session initialization
197
+ 2. **Wave Order is Sacred**: Execute waves sequentially
198
+ 3. **CSV is Source of Truth**: Master tasks.csv holds all state
199
+ 4. **Column Separation Rule**: Input and output_schema columns MUST NOT share names
200
+ 5. **Context Propagation**: prev_context from master CSV findings
201
+ 6. **Discovery Board is Append-Only**: Never clear/modify discoveries.ndjson
202
+ 7. **Cascading Skip on Failure**: Failed tasks cascade to dependents
203
+ 8. **Cleanup Temp Files**: Delete wave-N.csv and wave-N-results.csv after merge
204
+ 9. **Checkpoint Pause**: After CHECKPOINT waves, pause for user approval (skip if -y)
205
+ 10. **DO NOT STOP**: Continuous execution between checkpoints
206
+ 11. **Role Files are Authoritative**: Agents read roles/{role}/role.md for domain logic
207
+ </invariants>
208
+
209
+ <state_machine>
210
+
211
+ <states>
212
+ S_PARSE — Parse arguments, detect pipeline PERSIST: —
213
+ S_PIPELINE — Select and validate pipeline PERSIST: —
214
+ S_CSV_GEN — Generate tasks.csv from pipeline definition PERSIST: tasks.csv
215
+ S_WAVE_{N} — Execute wave N PERSIST: findings in master CSV
216
+ S_CHECKPOINT — User approval after checkpoint wave PERSIST: —
217
+ S_AGGREGATE — Generate report, export results PERSIST: context.md, results.csv
218
+ </states>
219
+
220
+ <transitions>
221
+ S_PARSE → S_PIPELINE WHEN: new session
222
+ S_PARSE → S_WAVE_{N} WHEN: --continue (resume at first pending wave)
223
+ S_PIPELINE → S_CSV_GEN
224
+ S_CSV_GEN → S_WAVE_1
225
+
226
+ S_WAVE_{N} → S_CHECKPOINT WHEN: wave N was a CHECKPOINT task
227
+ S_WAVE_{N} → S_WAVE_{N+1} WHEN: wave N not checkpoint, more waves
228
+ S_WAVE_{N} → S_AGGREGATE WHEN: last wave complete
229
+
230
+ S_CHECKPOINT → S_WAVE_{N+1} WHEN: user approves or -y
231
+ S_CHECKPOINT → S_WAVE_{N} WHEN: user requests revision (re-run checkpoint)
232
+ S_CHECKPOINT → S_AGGREGATE WHEN: user aborts
233
+ </transitions>
234
+
235
+ <actions>
236
+
237
+ ### Session Initialization (S_PARSE)
238
+
239
+ ```
240
+ Parse from $ARGUMENTS:
241
+ AUTO_YES ← --yes | -y
242
+ continueMode ← --continue
243
+ maxConcurrency ← --concurrency | -c N (default: 3)
244
+ pipelineFlag ← --pipeline spec-only|impl-only|full-lifecycle
245
+ noSupervision ← --no-supervision (skip CHECKPOINT tasks)
246
+ taskDescription ← remaining text
247
+
248
+ Derive:
249
+ dateStr ← UTC+8 YYYYMMDD
250
+ slug ← first 3 meaningful words, kebab-case
251
+ sessionId ← "{dateStr}-tlv4-{slug}"
252
+ sessionFolder ← ".workflow/.csv-wave/{sessionId}"
253
+ skillRoot ← resolve path to this skill directory
254
+
255
+ mkdir -p {sessionFolder}/{spec,plan,artifacts}
256
+ ```
257
+
258
+ ### Pipeline Selection (S_PIPELINE)
259
+
260
+ 1. If `--pipeline` flag → use specified pipeline
261
+ 2. Else scan task description keywords against [specs/pipelines.md](specs/pipelines.md) §1:
262
+ - spec/design/document/requirements → `spec-only`
263
+ - implement/build/fix/code → `impl-only`
264
+ - full/lifecycle/end-to-end → `full-lifecycle`
265
+ - Ambiguous → `request_user_input`
266
+ 3. Validate pipeline selection
267
+
268
+ ### CSV Generation (S_CSV_GEN)
269
+
270
+ 1. Load pipeline definition from [specs/pipelines.md](specs/pipelines.md)
271
+ 2. **Supervision opt-out**: if `--no-supervision`, filter out all CHECKPOINT-* tasks from pipeline. Adjust deps: tasks that depended on CHECKPOINT tasks now depend on the CHECKPOINT's upstream instead.
272
+ 3. For each task in pipeline, build CSV row:
273
+ - `id`: from task registry (RESEARCH-001, DRAFT-001, etc.)
274
+ - `description`: PURPOSE/TASK/EXPECTED/CONSTRAINTS with session-specific context
275
+ - `role`: from registry
276
+ - `pipeline_phase`: from registry
277
+ - `deps`: from pipeline dependency chain
278
+ - `context_from`: same as deps (upstream findings needed)
279
+ - `wave`: from pipeline wave assignment table (recalculate if checkpoints removed)
280
+ 4. Initialize lifecycle columns: `status=pending`, empty `findings`/`files_modified`/`quality_score`/`error`
281
+ 5. Write `tasks.csv`
282
+ 6. Write empty `discoveries.ndjson`
283
+ 7. User validation (skip if `-y`): display pipeline, task count, wave structure
284
+
285
+ ### Wave Execution Engine (S_WAVE_{N})
286
+
287
+ For each wave N:
288
+
289
+ #### Step 1: Skip check
290
+ - If all tasks in wave N are already completed/skipped → skip to next wave
291
+ - If any dep is failed/blocked → cascade skip
292
+
293
+ #### Step 2: Build prev_context
294
+ For each task in wave N:
295
+ - Read `context_from` task IDs → extract their `findings` from master CSV
296
+ - Concatenate as `prev_context`
297
+
298
+ #### Step 3: Write wave-{N}.csv
299
+ Extract wave N rows + add `prev_context` column.
300
+
301
+ #### Step 4: Execute
302
+
303
+ ```javascript
304
+ spawn_agents_on_csv({
305
+ csv_path: `${sessionFolder}/wave-${N}.csv`,
306
+ id_column: "id",
307
+ instruction: buildLifecycleInstruction(sessionFolder, skillRoot),
308
+ max_concurrency: maxConcurrency,
309
+ max_runtime_seconds: 3600,
310
+ output_csv_path: `${sessionFolder}/wave-${N}-results.csv`,
311
+ output_schema: {
312
+ id,
313
+ result_status, // completed | failed | blocked
314
+ findings, // key findings (max 500 chars)
315
+ files_modified, // semicolon-separated paths
316
+ quality_score, // 0-100
317
+ error // error message
318
+ }
319
+ })
320
+ ```
321
+
322
+ #### Step 5: Merge + Cleanup
323
+ 1. Map `result_status` → master `status`
324
+ 2. Copy `findings`, `files_modified`, `quality_score`, `error`
325
+ 3. Delete `wave-{N}.csv` AND `wave-{N}-results.csv`
326
+ 4. Cascade skip failed task dependents
327
+
328
+ #### Step 6: Checkpoint handling
329
+ If wave N was a CHECKPOINT task:
330
+ - Read supervisor's `findings` and `quality_score`
331
+ - If quality_score >= 80 (pass) → continue
332
+ - If 60-79 (review) → display warnings, continue (or pause if not -y)
333
+ - If < 60 (fail) → pause for user: Revise / Override / Abort
334
+
335
+ ### Instruction Builder
336
+
337
+ ```
338
+ You are a team-lifecycle-v4 agent executing a software development task.
339
+
340
+ ## Your Identity
341
+ - Role: read from your CSV row 'role' column
342
+ - Task: read from your CSV row 'description' column (PURPOSE/TASK/EXPECTED/CONSTRAINTS)
343
+ - Phase: read from your CSV row 'pipeline_phase' column
344
+
345
+ ## Role Definition
346
+ Read your detailed role instructions from:
347
+ {skillRoot}/roles/{role}/role.md
348
+
349
+ Follow the execution protocol defined in your role.md (Phase 2-4 structure).
350
+
351
+ For roles with commands/ subdirectory, load the relevant command file based on your task type.
352
+
353
+ ## Context
354
+ - Session: {sessionFolder}
355
+ - Discovery board: {sessionFolder}/discoveries.ndjson (read before work, append findings)
356
+ - Previous context: read your CSV row 'prev_context' column
357
+ - Templates: {skillRoot}/templates/ (for writer role)
358
+ - Quality gates: {skillRoot}/specs/quality-gates.md
359
+
360
+ ## Quality Contract
361
+ 1. Verify all outputs exist before reporting completed
362
+ 2. Include quality_score (0-100) based on specs/quality-gates.md criteria
363
+ 3. Retry on verification failure (max 2 retries)
364
+ 4. Report blocked if still failing after retries
365
+
366
+ ## Discovery Protocol
367
+ Write task output to {sessionFolder}/discoveries/{task_id}.json:
368
+ {
369
+ "task_id": "<id>", "role": "<role>", "status": "<result_status>",
370
+ "findings": "<summary>", "quality_score": <N>,
371
+ "artifacts_produced": ["<paths>"], "files_modified": ["<paths>"]
372
+ }
373
+
374
+ Append to {sessionFolder}/discoveries.ndjson:
375
+ {"ts":"<ISO>","worker":"<id>","type":"<pipeline_phase>","data":{...}}
376
+
377
+ ## Output
378
+ Return via output_schema:
379
+ - result_status: completed | failed | blocked
380
+ - findings: key findings (max 500 chars)
381
+ - files_modified: semicolon-separated paths
382
+ - quality_score: 0-100 per quality-gates.md
383
+ - error: error message if not completed
384
+ ```
385
+
386
+ ### Results Aggregation (S_AGGREGATE)
387
+
388
+ 1. Export `results.csv`
389
+ 2. Generate `context.md`:
390
+ - Pipeline type, task count, completed/failed/skipped
391
+ - Per-wave results with quality scores
392
+ - Checkpoint verdicts
393
+ - Files modified
394
+ - Discovery summary
395
+ - Next steps (if spec-only: suggest impl-only; if impl: suggest deploy)
396
+ 3. Display completion report
397
+
398
+ </actions>
399
+ </state_machine>
400
+
401
+ <discovery_board>
402
+
403
+ | Type | Dedup Key | Data |
404
+ |------|-----------|------|
405
+ | research_finding | topic | {topic, evidence, implications} |
406
+ | spec_artifact | doc_type | {doc_type, path, summary, quality_score} |
407
+ | architecture_decision | subject | {subject, choice, rationale, alternatives[]} |
408
+ | implementation_note | module | {module, pattern, files[], notes} |
409
+ | test_result | suite | {suite, pass_rate, failures[], coverage} |
410
+ | review_finding | dimension | {dimension, severity, location, recommendation} |
411
+ | checkpoint_verdict | checkpoint_id | {id, score, checks[], verdict} |
412
+
413
+ Protocol: read before work, append-only, dedup by type+key.
414
+ </discovery_board>
415
+
416
+ <error_codes>
417
+
418
+ | Condition | Recovery |
419
+ |-----------|----------|
420
+ | Pipeline detection ambiguous | request_user_input for pipeline selection |
421
+ | RESEARCH-001 failed | Abort spec pipeline (no context for drafting) |
422
+ | DRAFT task failed | Skip subsequent DRAFTs, proceed to checkpoint |
423
+ | CHECKPOINT verdict: block | Pause for user (Revise/Override/Abort) |
424
+ | PLAN-001 failed | Abort impl pipeline |
425
+ | IMPL task failed | Cascade skip to TEST + REVIEW |
426
+ | Session not found (--continue) | Error with available sessions |
427
+ | Role file missing | Error with role registry |
428
+ | Quality score < 60 after revision | Escalate to user |
429
+ </error_codes>
430
+
431
+ <success_criteria>
432
+ - [ ] Pipeline selected and validated
433
+ - [ ] tasks.csv generated with correct wave assignments
434
+ - [ ] Each wave executed via spawn_agents_on_csv
435
+ - [ ] Agents read role.md for domain-specific logic
436
+ - [ ] Column separation rule maintained
437
+ - [ ] wave-N.csv and wave-N-results.csv deleted after merge
438
+ - [ ] Checkpoint waves pause for user approval (unless -y)
439
+ - [ ] Quality scores reported per task
440
+ - [ ] discoveries.ndjson append-only
441
+ - [ ] results.csv and context.md generated
442
+ - [ ] Session resumable via --continue
443
+ - [ ] Spec artifacts written to spec/ directory
444
+ - [ ] Plan artifacts written to plan/ directory
445
+ </success_criteria>