claude-code-workflow 7.2.14 → 7.2.15

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 (75) hide show
  1. package/.claude/commands/workflow/analyze-with-file.md +7 -0
  2. package/.codex/skills/analyze-with-file/SKILL.md +1181 -1182
  3. package/.codex/skills/brainstorm/SKILL.md +723 -725
  4. package/.codex/skills/brainstorm-with-file/SKILL.md +10 -5
  5. package/.codex/skills/clean/SKILL.md +33 -26
  6. package/.codex/skills/collaborative-plan-with-file/SKILL.md +830 -831
  7. package/.codex/skills/csv-wave-pipeline/SKILL.md +906 -906
  8. package/.codex/skills/issue-discover/SKILL.md +57 -50
  9. package/.codex/skills/issue-discover/phases/01-issue-new.md +18 -11
  10. package/.codex/skills/issue-discover/phases/02-discover.md +31 -26
  11. package/.codex/skills/issue-discover/phases/03-discover-by-prompt.md +13 -11
  12. package/.codex/skills/issue-discover/phases/04-quick-execute.md +32 -27
  13. package/.codex/skills/parallel-dev-cycle/SKILL.md +402 -402
  14. package/.codex/skills/project-documentation-workflow/SKILL.md +13 -3
  15. package/.codex/skills/roadmap-with-file/SKILL.md +901 -897
  16. package/.codex/skills/session-sync/SKILL.md +222 -212
  17. package/.codex/skills/spec-add/SKILL.md +620 -613
  18. package/.codex/skills/spec-generator/SKILL.md +2 -2
  19. package/.codex/skills/spec-generator/phases/01-5-requirement-clarification.md +10 -10
  20. package/.codex/skills/spec-generator/phases/01-discovery.md +11 -18
  21. package/.codex/skills/spec-generator/phases/02-product-brief.md +5 -5
  22. package/.codex/skills/spec-generator/phases/03-requirements.md +7 -7
  23. package/.codex/skills/spec-generator/phases/04-architecture.md +4 -4
  24. package/.codex/skills/spec-generator/phases/05-epics-stories.md +5 -6
  25. package/.codex/skills/spec-generator/phases/06-readiness-check.md +10 -17
  26. package/.codex/skills/spec-generator/phases/07-issue-export.md +326 -329
  27. package/.codex/skills/spec-setup/SKILL.md +669 -657
  28. package/.codex/skills/team-arch-opt/SKILL.md +50 -50
  29. package/.codex/skills/team-arch-opt/agents/completion-handler.md +3 -3
  30. package/.codex/skills/team-brainstorm/SKILL.md +724 -725
  31. package/.codex/skills/team-coordinate/SKILL.md +51 -51
  32. package/.codex/skills/team-coordinate/agents/completion-handler.md +3 -3
  33. package/.codex/skills/team-coordinate/agents/plan-reviewer.md +4 -4
  34. package/.codex/skills/team-designer/SKILL.md +691 -691
  35. package/.codex/skills/team-designer/agents/requirement-clarifier.md +11 -12
  36. package/.codex/skills/team-executor/SKILL.md +45 -45
  37. package/.codex/skills/team-frontend/SKILL.md +45 -45
  38. package/.codex/skills/team-frontend/agents/completion-handler.md +3 -3
  39. package/.codex/skills/team-frontend/agents/qa-gate-reviewer.md +4 -4
  40. package/.codex/skills/team-frontend-debug/SKILL.md +50 -50
  41. package/.codex/skills/team-frontend-debug/agents/completion-handler.md +3 -3
  42. package/.codex/skills/team-frontend-debug/agents/conditional-skip-gate.md +4 -4
  43. package/.codex/skills/team-issue/SKILL.md +751 -740
  44. package/.codex/skills/team-iterdev/SKILL.md +825 -826
  45. package/.codex/skills/team-lifecycle-v4/SKILL.md +775 -775
  46. package/.codex/skills/team-lifecycle-v4/agents/quality-gate.md +165 -165
  47. package/.codex/skills/team-lifecycle-v4/agents/requirement-clarifier.md +163 -163
  48. package/.codex/skills/team-perf-opt/SKILL.md +50 -50
  49. package/.codex/skills/team-perf-opt/agents/completion-handler.md +3 -3
  50. package/.codex/skills/team-planex-v2/SKILL.md +652 -637
  51. package/.codex/skills/team-quality-assurance/SKILL.md +51 -52
  52. package/.codex/skills/team-review/SKILL.md +40 -40
  53. package/.codex/skills/team-roadmap-dev/SKILL.md +51 -51
  54. package/.codex/skills/team-roadmap-dev/agents/roadmap-discusser.md +8 -8
  55. package/.codex/skills/team-tech-debt/SKILL.md +50 -50
  56. package/.codex/skills/team-tech-debt/agents/plan-approver.md +5 -5
  57. package/.codex/skills/team-testing/SKILL.md +51 -52
  58. package/.codex/skills/team-uidesign/SKILL.md +40 -40
  59. package/.codex/skills/team-uidesign/agents/completion-handler.md +177 -177
  60. package/.codex/skills/team-ultra-analyze/SKILL.md +786 -787
  61. package/.codex/skills/team-ultra-analyze/agents/discussion-feedback.md +8 -8
  62. package/.codex/skills/team-ux-improve/SKILL.md +51 -52
  63. package/.codex/skills/team-ux-improve/agents/ux-designer.md +2 -2
  64. package/.codex/skills/team-ux-improve/agents/ux-explorer.md +1 -1
  65. package/.codex/skills/unified-execute-with-file/SKILL.md +797 -796
  66. package/.codex/skills/workflow-execute/SKILL.md +1117 -1118
  67. package/.codex/skills/workflow-lite-planex/SKILL.md +1144 -1141
  68. package/.codex/skills/workflow-plan/SKILL.md +631 -636
  69. package/.codex/skills/workflow-tdd-plan/SKILL.md +753 -759
  70. package/.codex/skills/workflow-test-fix-cycle/SKILL.md +402 -392
  71. package/README.md +25 -0
  72. package/ccw/dist/commands/install.d.ts.map +1 -1
  73. package/ccw/dist/commands/install.js +12 -0
  74. package/ccw/dist/commands/install.js.map +1 -1
  75. package/package.json +1 -1
@@ -1,775 +1,775 @@
1
- ---
2
- name: team-lifecycle-v4
3
- description: Full lifecycle team skill — specification, planning, implementation, testing, and review. Supports spec-only, impl-only, full-lifecycle, and frontend pipelines with optional supervisor checkpoints.
4
- argument-hint: "[-y|--yes] [-c|--concurrency N] [--continue] \"task description\""
5
- allowed-tools: spawn_agents_on_csv, spawn_agent, wait, send_input, close_agent, Read, Write, Edit, Bash, Glob, Grep, AskUserQuestion
6
- ---
7
-
8
- ## Auto Mode
9
-
10
- When `--yes` or `-y`: Auto-confirm task decomposition, skip interactive validation, use defaults.
11
-
12
- # Team Lifecycle v4
13
-
14
- ## Usage
15
-
16
- ```bash
17
- $team-lifecycle-v4 "Design and implement a user authentication system"
18
- $team-lifecycle-v4 -c 4 "Full lifecycle: build a REST API for order management"
19
- $team-lifecycle-v4 -y "Implement dark mode toggle in settings page"
20
- $team-lifecycle-v4 --continue "tlv4-auth-system-20260308"
21
- ```
22
-
23
- **Flags**:
24
- - `-y, --yes`: Skip all confirmations (auto mode)
25
- - `-c, --concurrency N`: Max concurrent agents within each wave (default: 3)
26
- - `--continue`: Resume existing session
27
- - `--no-supervision`: Skip CHECKPOINT tasks (supervisor opt-out)
28
-
29
- **Output Directory**: `.workflow/.csv-wave/{session-id}/`
30
- **Core Output**: `tasks.csv` (master state) + `results.csv` (final) + `discoveries.ndjson` (shared exploration) + `context.md` (human-readable report)
31
-
32
- ---
33
-
34
- ## Overview
35
-
36
- Full lifecycle software development orchestration: requirement analysis, specification writing (product brief, requirements, architecture, epics), quality gating, implementation planning, code implementation, testing, and code review. Supports multiple pipeline modes with optional supervisor checkpoints at phase transition points.
37
-
38
- **Execution Model**: Hybrid -- CSV wave pipeline (primary) + individual agent spawn (secondary for supervisor checkpoints and requirement clarification)
39
-
40
- ```
41
- +-------------------------------------------------------------------------+
42
- | TEAM LIFECYCLE v4 WORKFLOW |
43
- +--------------------------------------------------------------------------+
44
- | |
45
- | Phase 0: Pre-Wave Interactive |
46
- | +-- Requirement clarification + pipeline selection |
47
- | +-- Complexity scoring + signal detection |
48
- | +-- Output: refined requirements for decomposition |
49
- | |
50
- | Phase 1: Requirement -> CSV + Classification |
51
- | +-- Parse task into lifecycle tasks per selected pipeline |
52
- | +-- Assign roles: analyst, writer, planner, executor, tester, |
53
- | | reviewer, supervisor |
54
- | +-- Classify tasks: csv-wave | interactive (exec_mode) |
55
- | +-- Compute dependency waves (topological sort -> depth grouping) |
56
- | +-- Generate tasks.csv with wave + exec_mode columns |
57
- | +-- User validates task breakdown (skip if -y) |
58
- | |
59
- | Phase 2: Wave Execution Engine (Extended) |
60
- | +-- For each wave (1..N): |
61
- | | +-- Execute pre-wave interactive tasks (if any) |
62
- | | +-- Build wave CSV (filter csv-wave tasks for this wave) |
63
- | | +-- Inject previous findings into prev_context column |
64
- | | +-- spawn_agents_on_csv(wave CSV) |
65
- | | +-- Execute post-wave interactive tasks (if any) |
66
- | | +-- Handle CHECKPOINT tasks via interactive supervisor |
67
- | | +-- Merge all results into master tasks.csv |
68
- | | +-- Check: any failed? -> skip dependents |
69
- | +-- discoveries.ndjson shared across all modes (append-only) |
70
- | |
71
- | Phase 3: Post-Wave Interactive |
72
- | +-- Quality gate evaluation (QUALITY-001) |
73
- | +-- User approval checkpoint before implementation |
74
- | +-- Complexity-based implementation routing |
75
- | |
76
- | Phase 4: Results Aggregation |
77
- | +-- Export final results.csv |
78
- | +-- Generate context.md with all findings |
79
- | +-- Display summary: completed/failed/skipped per wave |
80
- | +-- Offer: view results | retry failed | done |
81
- | |
82
- +--------------------------------------------------------------------------+
83
- ```
84
-
85
- ---
86
-
87
- ## Task Classification Rules
88
-
89
- Each task is classified by `exec_mode`:
90
-
91
- | exec_mode | Mechanism | Criteria |
92
- |-----------|-----------|----------|
93
- | `csv-wave` | `spawn_agents_on_csv` | One-shot, structured I/O, no multi-round interaction |
94
- | `interactive` | `spawn_agent`/`wait`/`send_input`/`close_agent` | Multi-round, clarification, checkpoint evaluation |
95
-
96
- **Classification Decision**:
97
-
98
- | Task Property | Classification |
99
- |---------------|---------------|
100
- | Research / analysis (RESEARCH-*) | `csv-wave` |
101
- | Document generation (DRAFT-*) | `csv-wave` |
102
- | Implementation planning (PLAN-*) | `csv-wave` |
103
- | Code implementation (IMPL-*) | `csv-wave` |
104
- | Test execution (TEST-*) | `csv-wave` |
105
- | Code review (REVIEW-*) | `csv-wave` |
106
- | Quality gate scoring (QUALITY-*) | `csv-wave` |
107
- | Supervisor checkpoints (CHECKPOINT-*) | `interactive` |
108
- | Requirement clarification (Phase 0) | `interactive` |
109
- | Quality gate user approval | `interactive` |
110
-
111
- ---
112
-
113
- ## CSV Schema
114
-
115
- ### tasks.csv (Master State)
116
-
117
- ```csv
118
- id,title,description,role,pipeline_phase,deps,context_from,exec_mode,wave,status,findings,quality_score,supervision_verdict,error
119
- "RESEARCH-001","Domain research","Explore domain, extract structured context, identify constraints","analyst","research","","","csv-wave","1","pending","","","",""
120
- "DRAFT-001","Product brief","Generate product brief from research context","writer","product-brief","RESEARCH-001","RESEARCH-001","csv-wave","2","pending","","","",""
121
- "CHECKPOINT-001","Brief-PRD consistency","Verify terminology alignment and scope consistency between brief and PRD","supervisor","checkpoint","DRAFT-002","DRAFT-001;DRAFT-002","interactive","4","pending","","","",""
122
- ```
123
-
124
- **Columns**:
125
-
126
- | Column | Phase | Description |
127
- |--------|-------|-------------|
128
- | `id` | Input | Unique task identifier (string) |
129
- | `title` | Input | Short task title |
130
- | `description` | Input | Detailed task description |
131
- | `role` | Input | Worker role: analyst, writer, planner, executor, tester, reviewer, supervisor |
132
- | `pipeline_phase` | Input | Lifecycle phase: research, product-brief, requirements, architecture, epics, checkpoint, readiness, planning, implementation, validation, review |
133
- | `deps` | Input | Semicolon-separated dependency task IDs |
134
- | `context_from` | Input | Semicolon-separated task IDs whose findings this task needs |
135
- | `exec_mode` | Input | `csv-wave` or `interactive` |
136
- | `wave` | Computed | Wave number (computed by topological sort, 1-based) |
137
- | `status` | Output | `pending` -> `completed` / `failed` / `skipped` |
138
- | `findings` | Output | Key discoveries or implementation notes (max 500 chars) |
139
- | `quality_score` | Output | Quality gate score (0-100) for QUALITY-* tasks |
140
- | `supervision_verdict` | Output | `pass` / `warn` / `block` for CHECKPOINT-* tasks |
141
- | `error` | Output | Error message if failed (empty if success) |
142
-
143
- ### Per-Wave CSV (Temporary)
144
-
145
- Each wave generates a temporary `wave-{N}.csv` with extra `prev_context` column (csv-wave tasks only).
146
-
147
- ---
148
-
149
- ## Agent Registry (Interactive Agents)
150
-
151
- | Agent | Role File | Pattern | Responsibility | Position |
152
- |-------|-----------|---------|----------------|----------|
153
- | requirement-clarifier | agents/requirement-clarifier.md | 2.3 (wait-respond) | Parse task, detect signals, select pipeline mode | standalone (Phase 0) |
154
- | supervisor | agents/supervisor.md | 2.3 (wait-respond) | Verify cross-artifact consistency at phase transitions | post-wave (after checkpoint dependencies complete) |
155
- | quality-gate | agents/quality-gate.md | 2.3 (wait-respond) | Evaluate quality and present user approval | post-wave (after QUALITY-001 completes) |
156
-
157
- > **COMPACT PROTECTION**: Agent files are execution documents. When context compression occurs, **you MUST immediately `Read` the corresponding agent.md** to reload.
158
-
159
- ---
160
-
161
- ## Output Artifacts
162
-
163
- | File | Purpose | Lifecycle |
164
- |------|---------|-----------|
165
- | `tasks.csv` | Master state -- all tasks with status/findings | Updated after each wave |
166
- | `wave-{N}.csv` | Per-wave input (temporary, csv-wave tasks only) | Created before wave, deleted after |
167
- | `results.csv` | Final export of all task results | Created in Phase 4 |
168
- | `discoveries.ndjson` | Shared exploration board (all agents, both modes) | Append-only, carries across waves |
169
- | `context.md` | Human-readable execution report | Created in Phase 4 |
170
- | `interactive/{id}-result.json` | Results from interactive tasks | Created per interactive task |
171
-
172
- ---
173
-
174
- ## Session Structure
175
-
176
- ```
177
- .workflow/.csv-wave/{session-id}/
178
- +-- tasks.csv # Master state (all tasks, both modes)
179
- +-- results.csv # Final results export
180
- +-- discoveries.ndjson # Shared discovery board (all agents)
181
- +-- context.md # Human-readable report
182
- +-- wave-{N}.csv # Temporary per-wave input (csv-wave only)
183
- +-- spec/ # Specification artifacts
184
- | +-- spec-config.json
185
- | +-- discovery-context.json
186
- | +-- product-brief.md
187
- | +-- requirements/
188
- | +-- architecture.md
189
- | +-- epics.md
190
- +-- plan/ # Implementation plan
191
- | +-- plan.json
192
- | +-- .task/TASK-*.json
193
- +-- artifacts/ # Review and checkpoint reports
194
- | +-- CHECKPOINT-*-report.md
195
- | +-- review-report.md
196
- +-- wisdom/ # Cross-task knowledge
197
- +-- explorations/ # Shared exploration cache
198
- +-- interactive/ # Interactive task artifacts
199
- +-- {id}-result.json
200
- ```
201
-
202
- ---
203
-
204
- ## Implementation
205
-
206
- ### Session Initialization
207
-
208
- ```javascript
209
- const getUtc8ISOString = () => new Date(Date.now() + 8 * 60 * 60 * 1000).toISOString()
210
-
211
- // Parse flags
212
- const AUTO_YES = $ARGUMENTS.includes('--yes') || $ARGUMENTS.includes('-y')
213
- const continueMode = $ARGUMENTS.includes('--continue')
214
- const noSupervision = $ARGUMENTS.includes('--no-supervision')
215
- const concurrencyMatch = $ARGUMENTS.match(/(?:--concurrency|-c)\s+(\d+)/)
216
- const maxConcurrency = concurrencyMatch ? parseInt(concurrencyMatch[1]) : 3
217
-
218
- // Clean requirement text (remove flags)
219
- const requirement = $ARGUMENTS
220
- .replace(/--yes|-y|--continue|--no-supervision|--concurrency\s+\d+|-c\s+\d+/g, '')
221
- .trim()
222
-
223
- const slug = requirement.toLowerCase()
224
- .replace(/[^a-z0-9\u4e00-\u9fa5]+/g, '-')
225
- .substring(0, 40)
226
- const dateStr = getUtc8ISOString().substring(0, 10).replace(/-/g, '')
227
- let sessionId = `tlv4-${slug}-${dateStr}`
228
- let sessionFolder = `.workflow/.csv-wave/${sessionId}`
229
-
230
- // Continue mode: find existing session
231
- if (continueMode) {
232
- const existing = Bash(`ls -dt .workflow/.csv-wave/tlv4-* 2>/dev/null | head -1`).trim()
233
- if (existing) {
234
- sessionId = existing.split('/').pop()
235
- sessionFolder = existing
236
- // Read existing tasks.csv, find incomplete waves, resume from Phase 2
237
- }
238
- }
239
-
240
- Bash(`mkdir -p ${sessionFolder}/{spec,plan,plan/.task,artifacts,wisdom,explorations,interactive}`)
241
- ```
242
-
243
- ---
244
-
245
- ### Phase 0: Pre-Wave Interactive
246
-
247
- **Objective**: Clarify requirement, detect capabilities, select pipeline mode.
248
-
249
- **Execution**:
250
-
251
- ```javascript
252
- const clarifier = spawn_agent({
253
- message: `
254
- ## TASK ASSIGNMENT
255
-
256
- ### MANDATORY FIRST STEPS (Agent Execute)
257
- 1. **Read role definition**: ~ or <project>/.codex/skills/team-lifecycle-v4/agents/requirement-clarifier.md (MUST read first)
258
- 2. Read: .workflow/project-tech.json (if exists)
259
-
260
- ---
261
-
262
- Goal: Analyze task requirement and select appropriate pipeline
263
- Requirement: ${requirement}
264
-
265
- ### Task
266
- 1. Parse task description for capability signals:
267
- - spec/design/document/requirements -> spec-only
268
- - implement/build/fix/code -> impl-only
269
- - full/lifecycle/end-to-end -> full-lifecycle
270
- - frontend/UI/react/vue -> fe-only or fullstack
271
- 2. Score complexity (per capability +1, cross-domain +2, parallel tracks +1, serial depth >3 +1)
272
- 3. Return structured result with pipeline_type, capabilities, complexity
273
- `
274
- })
275
-
276
- const clarifierResult = wait({ ids: [clarifier], timeout_ms: 120000 })
277
- if (clarifierResult.timed_out) {
278
- send_input({ id: clarifier, message: "Please finalize and output current findings." })
279
- wait({ ids: [clarifier], timeout_ms: 60000 })
280
- }
281
- close_agent({ id: clarifier })
282
-
283
- Write(`${sessionFolder}/interactive/requirement-clarifier-result.json`, JSON.stringify({
284
- task_id: "requirement-clarification",
285
- status: "completed",
286
- pipeline_type: parsedPipelineType,
287
- capabilities: parsedCapabilities,
288
- complexity: parsedComplexity,
289
- timestamp: getUtc8ISOString()
290
- }))
291
- ```
292
-
293
- If not AUTO_YES, confirm pipeline selection:
294
-
295
- ```javascript
296
- if (!AUTO_YES) {
297
- const answer = AskUserQuestion({
298
- questions: [{
299
- question: `Requirement: "${requirement}"\nDetected pipeline: ${pipeline_type} (complexity: ${complexity.level})\nRoles: ${capabilities.map(c => c.name).join(', ')}\n\nApprove?`,
300
- header: "Pipeline Selection",
301
- multiSelect: false,
302
- options: [
303
- { label: "Approve", description: `Use ${pipeline_type} pipeline` },
304
- { label: "Spec Only", description: "Research -> draft specs -> quality gate" },
305
- { label: "Impl Only", description: "Plan -> implement -> test + review" },
306
- { label: "Full Lifecycle", description: "Spec pipeline + implementation pipeline" }
307
- ]
308
- }]
309
- })
310
- }
311
- ```
312
-
313
- **Success Criteria**:
314
- - Refined requirements available for Phase 1 decomposition
315
- - Interactive agents closed, results stored
316
-
317
- ---
318
-
319
- ### Phase 1: Requirement -> CSV + Classification
320
-
321
- **Objective**: Build tasks.csv from selected pipeline mode with proper wave assignments.
322
-
323
- **Decomposition Rules**:
324
-
325
- | Pipeline | Tasks | Wave Structure |
326
- |----------|-------|---------------|
327
- | spec-only | RESEARCH-001 -> DRAFT-001 -> DRAFT-002 -> [CHECKPOINT-001] -> DRAFT-003 -> DRAFT-004 -> [CHECKPOINT-002] -> QUALITY-001 | 8 waves (6 csv + 2 interactive checkpoints) |
328
- | impl-only | PLAN-001 -> [CHECKPOINT-003] -> IMPL-001 -> TEST-001 + REVIEW-001 | 4 waves (3 csv + 1 interactive) |
329
- | full-lifecycle | spec-only pipeline + impl-only pipeline (PLAN blocked by QUALITY-001) | 12 waves |
330
-
331
- **Pipeline Task Definitions**:
332
-
333
- #### Spec-Only Pipeline
334
-
335
- | Task ID | Role | Wave | Deps | exec_mode | Description |
336
- |---------|------|------|------|-----------|-------------|
337
- | RESEARCH-001 | analyst | 1 | (none) | csv-wave | Research domain, extract structured context |
338
- | DRAFT-001 | writer | 2 | RESEARCH-001 | csv-wave | Generate product brief |
339
- | DRAFT-002 | writer | 3 | DRAFT-001 | csv-wave | Generate requirements PRD |
340
- | CHECKPOINT-001 | supervisor | 4 | DRAFT-002 | interactive | Brief-PRD consistency check |
341
- | DRAFT-003 | writer | 5 | CHECKPOINT-001 | csv-wave | Generate architecture design |
342
- | DRAFT-004 | writer | 6 | DRAFT-003 | csv-wave | Generate epics and stories |
343
- | CHECKPOINT-002 | supervisor | 7 | DRAFT-004 | interactive | Full spec consistency check |
344
- | QUALITY-001 | reviewer | 8 | CHECKPOINT-002 | csv-wave | Quality gate scoring |
345
-
346
- #### Impl-Only Pipeline
347
-
348
- | Task ID | Role | Wave | Deps | exec_mode | Description |
349
- |---------|------|------|------|-----------|-------------|
350
- | PLAN-001 | planner | 1 | (none) | csv-wave | Break down into implementation steps |
351
- | CHECKPOINT-003 | supervisor | 2 | PLAN-001 | interactive | Plan-input alignment check |
352
- | IMPL-001 | executor | 3 | CHECKPOINT-003 | csv-wave | Execute implementation plan |
353
- | TEST-001 | tester | 4 | IMPL-001 | csv-wave | Run tests, fix failures |
354
- | REVIEW-001 | reviewer | 4 | IMPL-001 | csv-wave | Code review |
355
-
356
- When `--no-supervision` is set, skip all CHECKPOINT-* tasks entirely, adjust wave numbers and dependencies accordingly (e.g., DRAFT-003 depends directly on DRAFT-002).
357
-
358
- **Classification Rules**:
359
-
360
- All lifecycle work tasks (research, drafting, planning, implementation, testing, review, quality) are `csv-wave`. Supervisor checkpoints are `interactive` (post-wave, spawned by orchestrator to verify cross-artifact consistency). Quality gate user approval is `interactive`.
361
-
362
- **Wave Computation**: Kahn's BFS topological sort with depth tracking (csv-wave tasks only).
363
-
364
- **User Validation**: Display task breakdown with wave + exec_mode assignment (skip if AUTO_YES).
365
-
366
- **Success Criteria**:
367
- - tasks.csv created with valid schema, wave, and exec_mode assignments
368
- - No circular dependencies
369
- - User approved (or AUTO_YES)
370
-
371
- ---
372
-
373
- ### Phase 2: Wave Execution Engine (Extended)
374
-
375
- **Objective**: Execute tasks wave-by-wave with hybrid mechanism support and cross-wave context propagation.
376
-
377
- ```javascript
378
- const failedIds = new Set()
379
- const skippedIds = new Set()
380
-
381
- for (let wave = 1; wave <= maxWave; wave++) {
382
- console.log(`\n## Wave ${wave}/${maxWave}\n`)
383
-
384
- // 1. Read current master CSV
385
- const masterCsv = parseCsv(Read(`${sessionFolder}/tasks.csv`))
386
-
387
- // 2. Separate csv-wave and interactive tasks for this wave
388
- const waveTasks = masterCsv.filter(row => parseInt(row.wave) === wave)
389
- const csvTasks = waveTasks.filter(t => t.exec_mode === 'csv-wave')
390
- const interactiveTasks = waveTasks.filter(t => t.exec_mode === 'interactive')
391
-
392
- // 3. Skip tasks whose deps failed
393
- const executableCsvTasks = []
394
- for (const task of csvTasks) {
395
- const deps = task.deps.split(';').filter(Boolean)
396
- if (deps.some(d => failedIds.has(d) || skippedIds.has(d))) {
397
- skippedIds.add(task.id)
398
- updateMasterCsvRow(sessionFolder, task.id, {
399
- status: 'skipped', error: 'Dependency failed or skipped'
400
- })
401
- continue
402
- }
403
- executableCsvTasks.push(task)
404
- }
405
-
406
- // 4. Build prev_context for each csv-wave task
407
- for (const task of executableCsvTasks) {
408
- const contextIds = task.context_from.split(';').filter(Boolean)
409
- const prevFindings = contextIds
410
- .map(id => {
411
- const prevRow = masterCsv.find(r => r.id === id)
412
- if (prevRow && prevRow.status === 'completed' && prevRow.findings) {
413
- return `[Task ${id}: ${prevRow.title}] ${prevRow.findings}`
414
- }
415
- // Check interactive results
416
- try {
417
- const interactiveResult = JSON.parse(Read(`${sessionFolder}/interactive/${id}-result.json`))
418
- return `[Task ${id}] ${JSON.stringify(interactiveResult.key_findings || interactiveResult.findings || '')}`
419
- } catch { return null }
420
- })
421
- .filter(Boolean)
422
- .join('\n')
423
- task.prev_context = prevFindings || 'No previous context available'
424
- }
425
-
426
- // 5. Write wave CSV and execute csv-wave tasks
427
- if (executableCsvTasks.length > 0) {
428
- const waveHeader = 'id,title,description,role,pipeline_phase,deps,context_from,exec_mode,wave,prev_context'
429
- const waveRows = executableCsvTasks.map(t =>
430
- [t.id, t.title, t.description, t.role, t.pipeline_phase, t.deps, t.context_from, t.exec_mode, t.wave, t.prev_context]
431
- .map(cell => `"${String(cell).replace(/"/g, '""')}"`)
432
- .join(',')
433
- )
434
- Write(`${sessionFolder}/wave-${wave}.csv`, [waveHeader, ...waveRows].join('\n'))
435
-
436
- const waveResult = spawn_agents_on_csv({
437
- csv_path: `${sessionFolder}/wave-${wave}.csv`,
438
- id_column: "id",
439
- instruction: Read(`~ or <project>/.codex/skills/team-lifecycle-v4/instructions/agent-instruction.md`)
440
- .replace(/{session-id}/g, sessionId),
441
- max_concurrency: maxConcurrency,
442
- max_runtime_seconds: 900,
443
- output_csv_path: `${sessionFolder}/wave-${wave}-results.csv`,
444
- output_schema: {
445
- type: "object",
446
- properties: {
447
- id: { type: "string" },
448
- status: { type: "string", enum: ["completed", "failed"] },
449
- findings: { type: "string" },
450
- quality_score: { type: "string" },
451
- supervision_verdict: { type: "string" },
452
- error: { type: "string" }
453
- },
454
- required: ["id", "status", "findings"]
455
- }
456
- })
457
-
458
- // Merge results into master CSV
459
- const waveResults = parseCsv(Read(`${sessionFolder}/wave-${wave}-results.csv`))
460
- for (const result of waveResults) {
461
- updateMasterCsvRow(sessionFolder, result.id, {
462
- status: result.status,
463
- findings: result.findings || '',
464
- quality_score: result.quality_score || '',
465
- supervision_verdict: result.supervision_verdict || '',
466
- error: result.error || ''
467
- })
468
- if (result.status === 'failed') failedIds.add(result.id)
469
- }
470
-
471
- Bash(`rm -f "${sessionFolder}/wave-${wave}.csv"`)
472
- }
473
-
474
- // 6. Execute post-wave interactive tasks (supervisor checkpoints)
475
- for (const task of interactiveTasks) {
476
- if (task.status !== 'pending') continue
477
- const deps = task.deps.split(';').filter(Boolean)
478
- if (deps.some(d => failedIds.has(d) || skippedIds.has(d))) {
479
- skippedIds.add(task.id)
480
- continue
481
- }
482
-
483
- // Spawn supervisor agent for CHECKPOINT tasks
484
- const supervisorAgent = spawn_agent({
485
- message: `
486
- ## TASK ASSIGNMENT
487
-
488
- ### MANDATORY FIRST STEPS (Agent Execute)
489
- 1. **Read role definition**: ~ or <project>/.codex/skills/team-lifecycle-v4/agents/supervisor.md (MUST read first)
490
- 2. Read: ${sessionFolder}/discoveries.ndjson (shared discoveries)
491
-
492
- ---
493
-
494
- Goal: Execute checkpoint verification
495
- Session: ${sessionFolder}
496
- Task ID: ${task.id}
497
- Description: ${task.description}
498
- Scope: ${task.deps}
499
-
500
- ### Context
501
- Read upstream artifacts and verify cross-artifact consistency.
502
- Produce verdict: pass (score >= 0.8), warn (0.5-0.79), block (< 0.5).
503
- Write report to ${sessionFolder}/artifacts/${task.id}-report.md.
504
- `
505
- })
506
-
507
- const checkpointResult = wait({ ids: [supervisorAgent], timeout_ms: 300000 })
508
- if (checkpointResult.timed_out) {
509
- send_input({ id: supervisorAgent, message: "Please finalize your checkpoint evaluation now." })
510
- wait({ ids: [supervisorAgent], timeout_ms: 120000 })
511
- }
512
- close_agent({ id: supervisorAgent })
513
-
514
- // Parse checkpoint verdict
515
- Write(`${sessionFolder}/interactive/${task.id}-result.json`, JSON.stringify({
516
- task_id: task.id, status: "completed",
517
- supervision_verdict: parsedVerdict,
518
- supervision_score: parsedScore,
519
- timestamp: getUtc8ISOString()
520
- }))
521
-
522
- // Handle verdict
523
- if (parsedVerdict === 'block') {
524
- if (!AUTO_YES) {
525
- const answer = AskUserQuestion({
526
- questions: [{
527
- question: `Checkpoint ${task.id} BLOCKED (score: ${parsedScore}). What to do?`,
528
- header: "Checkpoint Blocked",
529
- options: [
530
- { label: "Override", description: "Proceed despite block" },
531
- { label: "Revise upstream", description: "Go back and fix issues" },
532
- { label: "Abort", description: "Stop pipeline" }
533
- ]
534
- }]
535
- })
536
- // Handle user choice
537
- }
538
- }
539
-
540
- updateMasterCsvRow(sessionFolder, task.id, {
541
- status: 'completed',
542
- findings: `Checkpoint verdict: ${parsedVerdict} (score: ${parsedScore})`,
543
- supervision_verdict: parsedVerdict
544
- })
545
- }
546
-
547
- // 7. Handle special post-wave logic
548
- // After QUALITY-001: pause for user approval before implementation
549
- // After PLAN-001: read complexity for conditional routing
550
- }
551
- ```
552
-
553
- **Success Criteria**:
554
- - All waves executed in order
555
- - Both csv-wave and interactive tasks handled per wave
556
- - Each wave's results merged into master CSV before next wave starts
557
- - Dependent tasks skipped when predecessor failed
558
- - discoveries.ndjson accumulated across all waves and mechanisms
559
- - Supervisor checkpoints evaluated with proper verdict routing
560
-
561
- ---
562
-
563
- ### Phase 3: Post-Wave Interactive
564
-
565
- **Objective**: Handle quality gate user approval and complexity-based implementation routing.
566
-
567
- After QUALITY-001 completes (spec pipelines):
568
- 1. Read quality score from QUALITY-001 findings
569
- 2. If score >= 80%: present user approval for implementation (if full-lifecycle)
570
- 3. If score 60-79%: suggest revisions, offer retry
571
- 4. If score < 60%: return to writer for rework
572
-
573
- After PLAN-001 completes (impl pipelines):
574
- 1. Read plan.json complexity assessment
575
- 2. Route by complexity:
576
- - Low (1-2 modules): direct IMPL-001
577
- - Medium (3-4 modules): parallel IMPL-{1..N}
578
- - High (5+ modules): detailed architecture first, then parallel IMPL
579
-
580
- **Success Criteria**:
581
- - Post-wave interactive processing complete
582
- - Interactive agents closed, results stored
583
-
584
- ---
585
-
586
- ### Phase 4: Results Aggregation
587
-
588
- **Objective**: Generate final results and human-readable report.
589
-
590
- ```javascript
591
- const masterCsv = Read(`${sessionFolder}/tasks.csv`)
592
- Write(`${sessionFolder}/results.csv`, masterCsv)
593
-
594
- const tasks = parseCsv(masterCsv)
595
- const completed = tasks.filter(t => t.status === 'completed')
596
- const failed = tasks.filter(t => t.status === 'failed')
597
- const skipped = tasks.filter(t => t.status === 'skipped')
598
-
599
- const contextContent = `# Team Lifecycle v4 Report
600
-
601
- **Session**: ${sessionId}
602
- **Requirement**: ${requirement}
603
- **Pipeline**: ${pipeline_type}
604
- **Completed**: ${getUtc8ISOString()}
605
-
606
- ---
607
-
608
- ## Summary
609
-
610
- | Metric | Count |
611
- |--------|-------|
612
- | Total Tasks | ${tasks.length} |
613
- | Completed | ${completed.length} |
614
- | Failed | ${failed.length} |
615
- | Skipped | ${skipped.length} |
616
- | Supervision | ${noSupervision ? 'Disabled' : 'Enabled'} |
617
-
618
- ---
619
-
620
- ## Pipeline Execution
621
-
622
- ${waveDetails}
623
-
624
- ---
625
-
626
- ## Deliverables
627
-
628
- ${deliverablesList}
629
-
630
- ---
631
-
632
- ## Quality Gates
633
-
634
- ${qualityGateResults}
635
-
636
- ---
637
-
638
- ## Checkpoint Reports
639
-
640
- ${checkpointResults}
641
- `
642
-
643
- Write(`${sessionFolder}/context.md`, contextContent)
644
- ```
645
-
646
- If not AUTO_YES, offer completion action:
647
-
648
- ```javascript
649
- if (!AUTO_YES) {
650
- AskUserQuestion({
651
- questions: [{
652
- question: "Pipeline complete. What would you like to do?",
653
- header: "Completion",
654
- multiSelect: false,
655
- options: [
656
- { label: "Archive & Clean (Recommended)", description: "Archive session" },
657
- { label: "Keep Active", description: "Keep session for follow-up work" },
658
- { label: "Export Results", description: "Export deliverables to target directory" }
659
- ]
660
- }]
661
- })
662
- }
663
- ```
664
-
665
- **Success Criteria**:
666
- - results.csv exported (all tasks, both modes)
667
- - context.md generated
668
- - All interactive agents closed
669
- - Summary displayed to user
670
-
671
- ---
672
-
673
- ## Shared Discovery Board Protocol
674
-
675
- All agents across all waves share `discoveries.ndjson`. This enables cross-role knowledge sharing.
676
-
677
- **Discovery Types**:
678
-
679
- | Type | Dedup Key | Data Schema | Description |
680
- |------|-----------|-------------|-------------|
681
- | `research` | `data.dimension` | `{dimension, findings[], constraints[], integration_points[]}` | Research findings |
682
- | `spec_artifact` | `data.doc_type` | `{doc_type, path, sections[], key_decisions[]}` | Specification document artifact |
683
- | `exploration` | `data.angle` | `{angle, relevant_files[], patterns[], recommendations[]}` | Codebase exploration finding |
684
- | `plan_task` | `data.task_id` | `{task_id, title, files[], complexity, convergence_criteria[]}` | Implementation task definition |
685
- | `implementation` | `data.task_id` | `{task_id, files_modified[], approach, changes_summary}` | Implementation result |
686
- | `test_result` | `data.framework` | `{framework, pass_rate, failures[], fix_iterations}` | Test execution result |
687
- | `review_finding` | `data.file` | `{file, line, severity, dimension, description, suggested_fix}` | Code review finding |
688
- | `checkpoint` | `data.checkpoint_id` | `{checkpoint_id, verdict, score, risks[], blocks[]}` | Supervisor checkpoint result |
689
- | `quality_gate` | `data.gate_id` | `{gate_id, score, dimensions{}, verdict}` | Quality gate assessment |
690
-
691
- **Format**: NDJSON, each line is self-contained JSON:
692
-
693
- ```jsonl
694
- {"ts":"2026-03-08T10:00:00+08:00","worker":"RESEARCH-001","type":"research","data":{"dimension":"domain","findings":["Auth system needs OAuth2 + RBAC"],"constraints":["Must support SSO"],"integration_points":["User service API"]}}
695
- {"ts":"2026-03-08T10:15:00+08:00","worker":"DRAFT-001","type":"spec_artifact","data":{"doc_type":"product-brief","path":"spec/product-brief.md","sections":["Vision","Problem","Users","Goals"],"key_decisions":["OAuth2 over custom auth"]}}
696
- {"ts":"2026-03-08T11:00:00+08:00","worker":"CHECKPOINT-001","type":"checkpoint","data":{"checkpoint_id":"CHECKPOINT-001","verdict":"pass","score":0.90,"risks":[],"blocks":[]}}
697
- ```
698
-
699
- **Protocol Rules**:
700
- 1. Read board before own work -> leverage existing context
701
- 2. Write discoveries immediately via `echo >>` -> don't batch
702
- 3. Deduplicate -- check existing entries by type + dedup key
703
- 4. Append-only -- never modify or delete existing lines
704
-
705
- ---
706
-
707
- ## Error Handling
708
-
709
- | Error | Resolution |
710
- |-------|------------|
711
- | Circular dependency | Detect in wave computation, abort with error message |
712
- | CSV agent timeout | Mark as failed in results, continue with wave |
713
- | CSV agent failed | Mark as failed, skip dependent tasks in later waves |
714
- | Interactive agent timeout | Urge convergence via send_input, then close if still timed out |
715
- | Interactive agent failed | Mark as failed, skip dependents |
716
- | Supervisor checkpoint blocked | AskUserQuestion: Override / Revise / Abort |
717
- | Quality gate failed (< 60%) | Return to writer for rework |
718
- | All agents in wave failed | Log error, offer retry or abort |
719
- | CSV parse error | Validate CSV format before execution, show line number |
720
- | discoveries.ndjson corrupt | Ignore malformed lines, continue with valid entries |
721
- | CLI tool fails | Agent fallback to direct implementation |
722
- | Continue mode: no session found | List available sessions, prompt user to select |
723
-
724
- ---
725
-
726
- ## Core Rules
727
-
728
- 1. **Start Immediately**: First action is session initialization, then Phase 0/1
729
- 2. **Wave Order is Sacred**: Never execute wave N before wave N-1 completes and results are merged
730
- 3. **CSV is Source of Truth**: Master tasks.csv holds all state (both csv-wave and interactive)
731
- 4. **CSV First**: Default to csv-wave for tasks; only use interactive when interaction pattern requires it
732
- 5. **Context Propagation**: prev_context built from master CSV, not from memory
733
- 6. **Discovery Board is Append-Only**: Never clear, modify, or recreate discoveries.ndjson -- both mechanisms share it
734
- 7. **Skip on Failure**: If a dependency failed, skip the dependent task (regardless of mechanism)
735
- 8. **Lifecycle Balance**: Every spawn_agent MUST have a matching close_agent
736
- 9. **Cleanup Temp Files**: Remove wave-{N}.csv after results are merged
737
- 10. **DO NOT STOP**: Continuous execution until all waves complete or all remaining tasks are skipped
738
-
739
-
740
- ---
741
-
742
- ## Coordinator Role Constraints (Main Agent)
743
-
744
- **CRITICAL**: The coordinator (main agent executing this skill) is responsible for **orchestration only**, NOT implementation.
745
-
746
- 15. **Coordinator Does NOT Execute Code**: The main agent MUST NOT write, modify, or implement any code directly. All implementation work is delegated to spawned team agents. The coordinator only:
747
- - Spawns agents with task assignments
748
- - Waits for agent callbacks
749
- - Merges results and coordinates workflow
750
- - Manages workflow transitions between phases
751
-
752
- 16. **Patient Waiting is Mandatory**: Agent execution takes significant time (typically 10-30 minutes per phase, sometimes longer). The coordinator MUST:
753
- - Wait patiently for `wait()` calls to complete
754
- - NOT skip workflow steps due to perceived delays
755
- - NOT assume agents have failed just because they're taking time
756
- - Trust the timeout mechanisms defined in the skill
757
-
758
- 17. **Use send_input for Clarification**: When agents need guidance or appear stuck, the coordinator MUST:
759
- - Use `send_input()` to ask questions or provide clarification
760
- - NOT skip the agent or move to next phase prematurely
761
- - Give agents opportunity to respond before escalating
762
- - Example: `send_input({ id: agent_id, message: "Please provide status update or clarify blockers" })`
763
-
764
- 18. **No Workflow Shortcuts**: The coordinator MUST NOT:
765
- - Skip phases or stages defined in the workflow
766
- - Bypass required approval or review steps
767
- - Execute dependent tasks before prerequisites complete
768
- - Assume task completion without explicit agent callback
769
- - Make up or fabricate agent results
770
-
771
- 19. **Respect Long-Running Processes**: This is a complex multi-agent workflow that requires patience:
772
- - Total execution time may range from 30-90 minutes or longer
773
- - Each phase may take 10-30 minutes depending on complexity
774
- - The coordinator must remain active and attentive throughout the entire process
775
- - Do not terminate or skip steps due to time concerns
1
+ ---
2
+ name: team-lifecycle-v4
3
+ description: Full lifecycle team skill — specification, planning, implementation, testing, and review. Supports spec-only, impl-only, full-lifecycle, and frontend pipelines with optional supervisor checkpoints.
4
+ argument-hint: "[-y|--yes] [-c|--concurrency N] [--continue] \"task description\""
5
+ allowed-tools: spawn_agents_on_csv, spawn_agent, wait, send_input, close_agent, Read, Write, Edit, Bash, Glob, Grep, request_user_input
6
+ ---
7
+
8
+ ## Auto Mode
9
+
10
+ When `--yes` or `-y`: Auto-confirm task decomposition, skip interactive validation, use defaults.
11
+
12
+ # Team Lifecycle v4
13
+
14
+ ## Usage
15
+
16
+ ```bash
17
+ $team-lifecycle-v4 "Design and implement a user authentication system"
18
+ $team-lifecycle-v4 -c 4 "Full lifecycle: build a REST API for order management"
19
+ $team-lifecycle-v4 -y "Implement dark mode toggle in settings page"
20
+ $team-lifecycle-v4 --continue "tlv4-auth-system-20260308"
21
+ ```
22
+
23
+ **Flags**:
24
+ - `-y, --yes`: Skip all confirmations (auto mode)
25
+ - `-c, --concurrency N`: Max concurrent agents within each wave (default: 3)
26
+ - `--continue`: Resume existing session
27
+ - `--no-supervision`: Skip CHECKPOINT tasks (supervisor opt-out)
28
+
29
+ **Output Directory**: `.workflow/.csv-wave/{session-id}/`
30
+ **Core Output**: `tasks.csv` (master state) + `results.csv` (final) + `discoveries.ndjson` (shared exploration) + `context.md` (human-readable report)
31
+
32
+ ---
33
+
34
+ ## Overview
35
+
36
+ Full lifecycle software development orchestration: requirement analysis, specification writing (product brief, requirements, architecture, epics), quality gating, implementation planning, code implementation, testing, and code review. Supports multiple pipeline modes with optional supervisor checkpoints at phase transition points.
37
+
38
+ **Execution Model**: Hybrid -- CSV wave pipeline (primary) + individual agent spawn (secondary for supervisor checkpoints and requirement clarification)
39
+
40
+ ```
41
+ +-------------------------------------------------------------------------+
42
+ | TEAM LIFECYCLE v4 WORKFLOW |
43
+ +--------------------------------------------------------------------------+
44
+ | |
45
+ | Phase 0: Pre-Wave Interactive |
46
+ | +-- Requirement clarification + pipeline selection |
47
+ | +-- Complexity scoring + signal detection |
48
+ | +-- Output: refined requirements for decomposition |
49
+ | |
50
+ | Phase 1: Requirement -> CSV + Classification |
51
+ | +-- Parse task into lifecycle tasks per selected pipeline |
52
+ | +-- Assign roles: analyst, writer, planner, executor, tester, |
53
+ | | reviewer, supervisor |
54
+ | +-- Classify tasks: csv-wave | interactive (exec_mode) |
55
+ | +-- Compute dependency waves (topological sort -> depth grouping) |
56
+ | +-- Generate tasks.csv with wave + exec_mode columns |
57
+ | +-- User validates task breakdown (skip if -y) |
58
+ | |
59
+ | Phase 2: Wave Execution Engine (Extended) |
60
+ | +-- For each wave (1..N): |
61
+ | | +-- Execute pre-wave interactive tasks (if any) |
62
+ | | +-- Build wave CSV (filter csv-wave tasks for this wave) |
63
+ | | +-- Inject previous findings into prev_context column |
64
+ | | +-- spawn_agents_on_csv(wave CSV) |
65
+ | | +-- Execute post-wave interactive tasks (if any) |
66
+ | | +-- Handle CHECKPOINT tasks via interactive supervisor |
67
+ | | +-- Merge all results into master tasks.csv |
68
+ | | +-- Check: any failed? -> skip dependents |
69
+ | +-- discoveries.ndjson shared across all modes (append-only) |
70
+ | |
71
+ | Phase 3: Post-Wave Interactive |
72
+ | +-- Quality gate evaluation (QUALITY-001) |
73
+ | +-- User approval checkpoint before implementation |
74
+ | +-- Complexity-based implementation routing |
75
+ | |
76
+ | Phase 4: Results Aggregation |
77
+ | +-- Export final results.csv |
78
+ | +-- Generate context.md with all findings |
79
+ | +-- Display summary: completed/failed/skipped per wave |
80
+ | +-- Offer: view results | retry failed | done |
81
+ | |
82
+ +--------------------------------------------------------------------------+
83
+ ```
84
+
85
+ ---
86
+
87
+ ## Task Classification Rules
88
+
89
+ Each task is classified by `exec_mode`:
90
+
91
+ | exec_mode | Mechanism | Criteria |
92
+ |-----------|-----------|----------|
93
+ | `csv-wave` | `spawn_agents_on_csv` | One-shot, structured I/O, no multi-round interaction |
94
+ | `interactive` | `spawn_agent`/`wait`/`send_input`/`close_agent` | Multi-round, clarification, checkpoint evaluation |
95
+
96
+ **Classification Decision**:
97
+
98
+ | Task Property | Classification |
99
+ |---------------|---------------|
100
+ | Research / analysis (RESEARCH-*) | `csv-wave` |
101
+ | Document generation (DRAFT-*) | `csv-wave` |
102
+ | Implementation planning (PLAN-*) | `csv-wave` |
103
+ | Code implementation (IMPL-*) | `csv-wave` |
104
+ | Test execution (TEST-*) | `csv-wave` |
105
+ | Code review (REVIEW-*) | `csv-wave` |
106
+ | Quality gate scoring (QUALITY-*) | `csv-wave` |
107
+ | Supervisor checkpoints (CHECKPOINT-*) | `interactive` |
108
+ | Requirement clarification (Phase 0) | `interactive` |
109
+ | Quality gate user approval | `interactive` |
110
+
111
+ ---
112
+
113
+ ## CSV Schema
114
+
115
+ ### tasks.csv (Master State)
116
+
117
+ ```csv
118
+ id,title,description,role,pipeline_phase,deps,context_from,exec_mode,wave,status,findings,quality_score,supervision_verdict,error
119
+ "RESEARCH-001","Domain research","Explore domain, extract structured context, identify constraints","analyst","research","","","csv-wave","1","pending","","","",""
120
+ "DRAFT-001","Product brief","Generate product brief from research context","writer","product-brief","RESEARCH-001","RESEARCH-001","csv-wave","2","pending","","","",""
121
+ "CHECKPOINT-001","Brief-PRD consistency","Verify terminology alignment and scope consistency between brief and PRD","supervisor","checkpoint","DRAFT-002","DRAFT-001;DRAFT-002","interactive","4","pending","","","",""
122
+ ```
123
+
124
+ **Columns**:
125
+
126
+ | Column | Phase | Description |
127
+ |--------|-------|-------------|
128
+ | `id` | Input | Unique task identifier (string) |
129
+ | `title` | Input | Short task title |
130
+ | `description` | Input | Detailed task description |
131
+ | `role` | Input | Worker role: analyst, writer, planner, executor, tester, reviewer, supervisor |
132
+ | `pipeline_phase` | Input | Lifecycle phase: research, product-brief, requirements, architecture, epics, checkpoint, readiness, planning, implementation, validation, review |
133
+ | `deps` | Input | Semicolon-separated dependency task IDs |
134
+ | `context_from` | Input | Semicolon-separated task IDs whose findings this task needs |
135
+ | `exec_mode` | Input | `csv-wave` or `interactive` |
136
+ | `wave` | Computed | Wave number (computed by topological sort, 1-based) |
137
+ | `status` | Output | `pending` -> `completed` / `failed` / `skipped` |
138
+ | `findings` | Output | Key discoveries or implementation notes (max 500 chars) |
139
+ | `quality_score` | Output | Quality gate score (0-100) for QUALITY-* tasks |
140
+ | `supervision_verdict` | Output | `pass` / `warn` / `block` for CHECKPOINT-* tasks |
141
+ | `error` | Output | Error message if failed (empty if success) |
142
+
143
+ ### Per-Wave CSV (Temporary)
144
+
145
+ Each wave generates a temporary `wave-{N}.csv` with extra `prev_context` column (csv-wave tasks only).
146
+
147
+ ---
148
+
149
+ ## Agent Registry (Interactive Agents)
150
+
151
+ | Agent | Role File | Pattern | Responsibility | Position |
152
+ |-------|-----------|---------|----------------|----------|
153
+ | requirement-clarifier | agents/requirement-clarifier.md | 2.3 (wait-respond) | Parse task, detect signals, select pipeline mode | standalone (Phase 0) |
154
+ | supervisor | agents/supervisor.md | 2.3 (wait-respond) | Verify cross-artifact consistency at phase transitions | post-wave (after checkpoint dependencies complete) |
155
+ | quality-gate | agents/quality-gate.md | 2.3 (wait-respond) | Evaluate quality and present user approval | post-wave (after QUALITY-001 completes) |
156
+
157
+ > **COMPACT PROTECTION**: Agent files are execution documents. When context compression occurs, **you MUST immediately `Read` the corresponding agent.md** to reload.
158
+
159
+ ---
160
+
161
+ ## Output Artifacts
162
+
163
+ | File | Purpose | Lifecycle |
164
+ |------|---------|-----------|
165
+ | `tasks.csv` | Master state -- all tasks with status/findings | Updated after each wave |
166
+ | `wave-{N}.csv` | Per-wave input (temporary, csv-wave tasks only) | Created before wave, deleted after |
167
+ | `results.csv` | Final export of all task results | Created in Phase 4 |
168
+ | `discoveries.ndjson` | Shared exploration board (all agents, both modes) | Append-only, carries across waves |
169
+ | `context.md` | Human-readable execution report | Created in Phase 4 |
170
+ | `interactive/{id}-result.json` | Results from interactive tasks | Created per interactive task |
171
+
172
+ ---
173
+
174
+ ## Session Structure
175
+
176
+ ```
177
+ .workflow/.csv-wave/{session-id}/
178
+ +-- tasks.csv # Master state (all tasks, both modes)
179
+ +-- results.csv # Final results export
180
+ +-- discoveries.ndjson # Shared discovery board (all agents)
181
+ +-- context.md # Human-readable report
182
+ +-- wave-{N}.csv # Temporary per-wave input (csv-wave only)
183
+ +-- spec/ # Specification artifacts
184
+ | +-- spec-config.json
185
+ | +-- discovery-context.json
186
+ | +-- product-brief.md
187
+ | +-- requirements/
188
+ | +-- architecture.md
189
+ | +-- epics.md
190
+ +-- plan/ # Implementation plan
191
+ | +-- plan.json
192
+ | +-- .task/TASK-*.json
193
+ +-- artifacts/ # Review and checkpoint reports
194
+ | +-- CHECKPOINT-*-report.md
195
+ | +-- review-report.md
196
+ +-- wisdom/ # Cross-task knowledge
197
+ +-- explorations/ # Shared exploration cache
198
+ +-- interactive/ # Interactive task artifacts
199
+ +-- {id}-result.json
200
+ ```
201
+
202
+ ---
203
+
204
+ ## Implementation
205
+
206
+ ### Session Initialization
207
+
208
+ ```javascript
209
+ const getUtc8ISOString = () => new Date(Date.now() + 8 * 60 * 60 * 1000).toISOString()
210
+
211
+ // Parse flags
212
+ const AUTO_YES = $ARGUMENTS.includes('--yes') || $ARGUMENTS.includes('-y')
213
+ const continueMode = $ARGUMENTS.includes('--continue')
214
+ const noSupervision = $ARGUMENTS.includes('--no-supervision')
215
+ const concurrencyMatch = $ARGUMENTS.match(/(?:--concurrency|-c)\s+(\d+)/)
216
+ const maxConcurrency = concurrencyMatch ? parseInt(concurrencyMatch[1]) : 3
217
+
218
+ // Clean requirement text (remove flags)
219
+ const requirement = $ARGUMENTS
220
+ .replace(/--yes|-y|--continue|--no-supervision|--concurrency\s+\d+|-c\s+\d+/g, '')
221
+ .trim()
222
+
223
+ const slug = requirement.toLowerCase()
224
+ .replace(/[^a-z0-9\u4e00-\u9fa5]+/g, '-')
225
+ .substring(0, 40)
226
+ const dateStr = getUtc8ISOString().substring(0, 10).replace(/-/g, '')
227
+ let sessionId = `tlv4-${slug}-${dateStr}`
228
+ let sessionFolder = `.workflow/.csv-wave/${sessionId}`
229
+
230
+ // Continue mode: find existing session
231
+ if (continueMode) {
232
+ const existing = Bash(`ls -dt .workflow/.csv-wave/tlv4-* 2>/dev/null | head -1`).trim()
233
+ if (existing) {
234
+ sessionId = existing.split('/').pop()
235
+ sessionFolder = existing
236
+ // Read existing tasks.csv, find incomplete waves, resume from Phase 2
237
+ }
238
+ }
239
+
240
+ Bash(`mkdir -p ${sessionFolder}/{spec,plan,plan/.task,artifacts,wisdom,explorations,interactive}`)
241
+ ```
242
+
243
+ ---
244
+
245
+ ### Phase 0: Pre-Wave Interactive
246
+
247
+ **Objective**: Clarify requirement, detect capabilities, select pipeline mode.
248
+
249
+ **Execution**:
250
+
251
+ ```javascript
252
+ const clarifier = spawn_agent({
253
+ message: `
254
+ ## TASK ASSIGNMENT
255
+
256
+ ### MANDATORY FIRST STEPS (Agent Execute)
257
+ 1. **Read role definition**: ~ or <project>/.codex/skills/team-lifecycle-v4/agents/requirement-clarifier.md (MUST read first)
258
+ 2. Read: .workflow/project-tech.json (if exists)
259
+
260
+ ---
261
+
262
+ Goal: Analyze task requirement and select appropriate pipeline
263
+ Requirement: ${requirement}
264
+
265
+ ### Task
266
+ 1. Parse task description for capability signals:
267
+ - spec/design/document/requirements -> spec-only
268
+ - implement/build/fix/code -> impl-only
269
+ - full/lifecycle/end-to-end -> full-lifecycle
270
+ - frontend/UI/react/vue -> fe-only or fullstack
271
+ 2. Score complexity (per capability +1, cross-domain +2, parallel tracks +1, serial depth >3 +1)
272
+ 3. Return structured result with pipeline_type, capabilities, complexity
273
+ `
274
+ })
275
+
276
+ const clarifierResult = wait({ ids: [clarifier], timeout_ms: 120000 })
277
+ if (clarifierResult.timed_out) {
278
+ send_input({ id: clarifier, message: "Please finalize and output current findings." })
279
+ wait({ ids: [clarifier], timeout_ms: 60000 })
280
+ }
281
+ close_agent({ id: clarifier })
282
+
283
+ Write(`${sessionFolder}/interactive/requirement-clarifier-result.json`, JSON.stringify({
284
+ task_id: "requirement-clarification",
285
+ status: "completed",
286
+ pipeline_type: parsedPipelineType,
287
+ capabilities: parsedCapabilities,
288
+ complexity: parsedComplexity,
289
+ timestamp: getUtc8ISOString()
290
+ }))
291
+ ```
292
+
293
+ If not AUTO_YES, confirm pipeline selection:
294
+
295
+ ```javascript
296
+ if (!AUTO_YES) {
297
+ const answer = request_user_input({
298
+ questions: [{
299
+ question: `Requirement: "${requirement}" — Detected: ${pipeline_type}. Approve or override?`,
300
+ header: "Pipeline",
301
+ id: "pipeline_select",
302
+ options: [
303
+ { label: "Approve (Recommended)", description: `Use ${pipeline_type} pipeline (complexity: ${complexity.level})` },
304
+ { label: "Spec Only", description: "Research -> draft specs -> quality gate" },
305
+ { label: "Impl/Full", description: "Implementation pipeline or full lifecycle" }
306
+ ]
307
+ }]
308
+ })
309
+ }
310
+ ```
311
+
312
+ **Success Criteria**:
313
+ - Refined requirements available for Phase 1 decomposition
314
+ - Interactive agents closed, results stored
315
+
316
+ ---
317
+
318
+ ### Phase 1: Requirement -> CSV + Classification
319
+
320
+ **Objective**: Build tasks.csv from selected pipeline mode with proper wave assignments.
321
+
322
+ **Decomposition Rules**:
323
+
324
+ | Pipeline | Tasks | Wave Structure |
325
+ |----------|-------|---------------|
326
+ | spec-only | RESEARCH-001 -> DRAFT-001 -> DRAFT-002 -> [CHECKPOINT-001] -> DRAFT-003 -> DRAFT-004 -> [CHECKPOINT-002] -> QUALITY-001 | 8 waves (6 csv + 2 interactive checkpoints) |
327
+ | impl-only | PLAN-001 -> [CHECKPOINT-003] -> IMPL-001 -> TEST-001 + REVIEW-001 | 4 waves (3 csv + 1 interactive) |
328
+ | full-lifecycle | spec-only pipeline + impl-only pipeline (PLAN blocked by QUALITY-001) | 12 waves |
329
+
330
+ **Pipeline Task Definitions**:
331
+
332
+ #### Spec-Only Pipeline
333
+
334
+ | Task ID | Role | Wave | Deps | exec_mode | Description |
335
+ |---------|------|------|------|-----------|-------------|
336
+ | RESEARCH-001 | analyst | 1 | (none) | csv-wave | Research domain, extract structured context |
337
+ | DRAFT-001 | writer | 2 | RESEARCH-001 | csv-wave | Generate product brief |
338
+ | DRAFT-002 | writer | 3 | DRAFT-001 | csv-wave | Generate requirements PRD |
339
+ | CHECKPOINT-001 | supervisor | 4 | DRAFT-002 | interactive | Brief-PRD consistency check |
340
+ | DRAFT-003 | writer | 5 | CHECKPOINT-001 | csv-wave | Generate architecture design |
341
+ | DRAFT-004 | writer | 6 | DRAFT-003 | csv-wave | Generate epics and stories |
342
+ | CHECKPOINT-002 | supervisor | 7 | DRAFT-004 | interactive | Full spec consistency check |
343
+ | QUALITY-001 | reviewer | 8 | CHECKPOINT-002 | csv-wave | Quality gate scoring |
344
+
345
+ #### Impl-Only Pipeline
346
+
347
+ | Task ID | Role | Wave | Deps | exec_mode | Description |
348
+ |---------|------|------|------|-----------|-------------|
349
+ | PLAN-001 | planner | 1 | (none) | csv-wave | Break down into implementation steps |
350
+ | CHECKPOINT-003 | supervisor | 2 | PLAN-001 | interactive | Plan-input alignment check |
351
+ | IMPL-001 | executor | 3 | CHECKPOINT-003 | csv-wave | Execute implementation plan |
352
+ | TEST-001 | tester | 4 | IMPL-001 | csv-wave | Run tests, fix failures |
353
+ | REVIEW-001 | reviewer | 4 | IMPL-001 | csv-wave | Code review |
354
+
355
+ When `--no-supervision` is set, skip all CHECKPOINT-* tasks entirely, adjust wave numbers and dependencies accordingly (e.g., DRAFT-003 depends directly on DRAFT-002).
356
+
357
+ **Classification Rules**:
358
+
359
+ All lifecycle work tasks (research, drafting, planning, implementation, testing, review, quality) are `csv-wave`. Supervisor checkpoints are `interactive` (post-wave, spawned by orchestrator to verify cross-artifact consistency). Quality gate user approval is `interactive`.
360
+
361
+ **Wave Computation**: Kahn's BFS topological sort with depth tracking (csv-wave tasks only).
362
+
363
+ **User Validation**: Display task breakdown with wave + exec_mode assignment (skip if AUTO_YES).
364
+
365
+ **Success Criteria**:
366
+ - tasks.csv created with valid schema, wave, and exec_mode assignments
367
+ - No circular dependencies
368
+ - User approved (or AUTO_YES)
369
+
370
+ ---
371
+
372
+ ### Phase 2: Wave Execution Engine (Extended)
373
+
374
+ **Objective**: Execute tasks wave-by-wave with hybrid mechanism support and cross-wave context propagation.
375
+
376
+ ```javascript
377
+ const failedIds = new Set()
378
+ const skippedIds = new Set()
379
+
380
+ for (let wave = 1; wave <= maxWave; wave++) {
381
+ console.log(`\n## Wave ${wave}/${maxWave}\n`)
382
+
383
+ // 1. Read current master CSV
384
+ const masterCsv = parseCsv(Read(`${sessionFolder}/tasks.csv`))
385
+
386
+ // 2. Separate csv-wave and interactive tasks for this wave
387
+ const waveTasks = masterCsv.filter(row => parseInt(row.wave) === wave)
388
+ const csvTasks = waveTasks.filter(t => t.exec_mode === 'csv-wave')
389
+ const interactiveTasks = waveTasks.filter(t => t.exec_mode === 'interactive')
390
+
391
+ // 3. Skip tasks whose deps failed
392
+ const executableCsvTasks = []
393
+ for (const task of csvTasks) {
394
+ const deps = task.deps.split(';').filter(Boolean)
395
+ if (deps.some(d => failedIds.has(d) || skippedIds.has(d))) {
396
+ skippedIds.add(task.id)
397
+ updateMasterCsvRow(sessionFolder, task.id, {
398
+ status: 'skipped', error: 'Dependency failed or skipped'
399
+ })
400
+ continue
401
+ }
402
+ executableCsvTasks.push(task)
403
+ }
404
+
405
+ // 4. Build prev_context for each csv-wave task
406
+ for (const task of executableCsvTasks) {
407
+ const contextIds = task.context_from.split(';').filter(Boolean)
408
+ const prevFindings = contextIds
409
+ .map(id => {
410
+ const prevRow = masterCsv.find(r => r.id === id)
411
+ if (prevRow && prevRow.status === 'completed' && prevRow.findings) {
412
+ return `[Task ${id}: ${prevRow.title}] ${prevRow.findings}`
413
+ }
414
+ // Check interactive results
415
+ try {
416
+ const interactiveResult = JSON.parse(Read(`${sessionFolder}/interactive/${id}-result.json`))
417
+ return `[Task ${id}] ${JSON.stringify(interactiveResult.key_findings || interactiveResult.findings || '')}`
418
+ } catch { return null }
419
+ })
420
+ .filter(Boolean)
421
+ .join('\n')
422
+ task.prev_context = prevFindings || 'No previous context available'
423
+ }
424
+
425
+ // 5. Write wave CSV and execute csv-wave tasks
426
+ if (executableCsvTasks.length > 0) {
427
+ const waveHeader = 'id,title,description,role,pipeline_phase,deps,context_from,exec_mode,wave,prev_context'
428
+ const waveRows = executableCsvTasks.map(t =>
429
+ [t.id, t.title, t.description, t.role, t.pipeline_phase, t.deps, t.context_from, t.exec_mode, t.wave, t.prev_context]
430
+ .map(cell => `"${String(cell).replace(/"/g, '""')}"`)
431
+ .join(',')
432
+ )
433
+ Write(`${sessionFolder}/wave-${wave}.csv`, [waveHeader, ...waveRows].join('\n'))
434
+
435
+ const waveResult = spawn_agents_on_csv({
436
+ csv_path: `${sessionFolder}/wave-${wave}.csv`,
437
+ id_column: "id",
438
+ instruction: Read(`~ or <project>/.codex/skills/team-lifecycle-v4/instructions/agent-instruction.md`)
439
+ .replace(/{session-id}/g, sessionId),
440
+ max_concurrency: maxConcurrency,
441
+ max_runtime_seconds: 900,
442
+ output_csv_path: `${sessionFolder}/wave-${wave}-results.csv`,
443
+ output_schema: {
444
+ type: "object",
445
+ properties: {
446
+ id: { type: "string" },
447
+ status: { type: "string", enum: ["completed", "failed"] },
448
+ findings: { type: "string" },
449
+ quality_score: { type: "string" },
450
+ supervision_verdict: { type: "string" },
451
+ error: { type: "string" }
452
+ },
453
+ required: ["id", "status", "findings"]
454
+ }
455
+ })
456
+
457
+ // Merge results into master CSV
458
+ const waveResults = parseCsv(Read(`${sessionFolder}/wave-${wave}-results.csv`))
459
+ for (const result of waveResults) {
460
+ updateMasterCsvRow(sessionFolder, result.id, {
461
+ status: result.status,
462
+ findings: result.findings || '',
463
+ quality_score: result.quality_score || '',
464
+ supervision_verdict: result.supervision_verdict || '',
465
+ error: result.error || ''
466
+ })
467
+ if (result.status === 'failed') failedIds.add(result.id)
468
+ }
469
+
470
+ Bash(`rm -f "${sessionFolder}/wave-${wave}.csv"`)
471
+ }
472
+
473
+ // 6. Execute post-wave interactive tasks (supervisor checkpoints)
474
+ for (const task of interactiveTasks) {
475
+ if (task.status !== 'pending') continue
476
+ const deps = task.deps.split(';').filter(Boolean)
477
+ if (deps.some(d => failedIds.has(d) || skippedIds.has(d))) {
478
+ skippedIds.add(task.id)
479
+ continue
480
+ }
481
+
482
+ // Spawn supervisor agent for CHECKPOINT tasks
483
+ const supervisorAgent = spawn_agent({
484
+ message: `
485
+ ## TASK ASSIGNMENT
486
+
487
+ ### MANDATORY FIRST STEPS (Agent Execute)
488
+ 1. **Read role definition**: ~ or <project>/.codex/skills/team-lifecycle-v4/agents/supervisor.md (MUST read first)
489
+ 2. Read: ${sessionFolder}/discoveries.ndjson (shared discoveries)
490
+
491
+ ---
492
+
493
+ Goal: Execute checkpoint verification
494
+ Session: ${sessionFolder}
495
+ Task ID: ${task.id}
496
+ Description: ${task.description}
497
+ Scope: ${task.deps}
498
+
499
+ ### Context
500
+ Read upstream artifacts and verify cross-artifact consistency.
501
+ Produce verdict: pass (score >= 0.8), warn (0.5-0.79), block (< 0.5).
502
+ Write report to ${sessionFolder}/artifacts/${task.id}-report.md.
503
+ `
504
+ })
505
+
506
+ const checkpointResult = wait({ ids: [supervisorAgent], timeout_ms: 300000 })
507
+ if (checkpointResult.timed_out) {
508
+ send_input({ id: supervisorAgent, message: "Please finalize your checkpoint evaluation now." })
509
+ wait({ ids: [supervisorAgent], timeout_ms: 120000 })
510
+ }
511
+ close_agent({ id: supervisorAgent })
512
+
513
+ // Parse checkpoint verdict
514
+ Write(`${sessionFolder}/interactive/${task.id}-result.json`, JSON.stringify({
515
+ task_id: task.id, status: "completed",
516
+ supervision_verdict: parsedVerdict,
517
+ supervision_score: parsedScore,
518
+ timestamp: getUtc8ISOString()
519
+ }))
520
+
521
+ // Handle verdict
522
+ if (parsedVerdict === 'block') {
523
+ if (!AUTO_YES) {
524
+ const answer = request_user_input({
525
+ questions: [{
526
+ question: `Checkpoint ${task.id} BLOCKED (score: ${parsedScore}). Choose action.`,
527
+ header: "Blocked",
528
+ id: "blocked_action",
529
+ options: [
530
+ { label: "Override", description: "Proceed despite block" },
531
+ { label: "Revise upstream", description: "Go back and fix issues" },
532
+ { label: "Abort", description: "Stop pipeline" }
533
+ ]
534
+ }]
535
+ })
536
+ // Handle user choice
537
+ }
538
+ }
539
+
540
+ updateMasterCsvRow(sessionFolder, task.id, {
541
+ status: 'completed',
542
+ findings: `Checkpoint verdict: ${parsedVerdict} (score: ${parsedScore})`,
543
+ supervision_verdict: parsedVerdict
544
+ })
545
+ }
546
+
547
+ // 7. Handle special post-wave logic
548
+ // After QUALITY-001: pause for user approval before implementation
549
+ // After PLAN-001: read complexity for conditional routing
550
+ }
551
+ ```
552
+
553
+ **Success Criteria**:
554
+ - All waves executed in order
555
+ - Both csv-wave and interactive tasks handled per wave
556
+ - Each wave's results merged into master CSV before next wave starts
557
+ - Dependent tasks skipped when predecessor failed
558
+ - discoveries.ndjson accumulated across all waves and mechanisms
559
+ - Supervisor checkpoints evaluated with proper verdict routing
560
+
561
+ ---
562
+
563
+ ### Phase 3: Post-Wave Interactive
564
+
565
+ **Objective**: Handle quality gate user approval and complexity-based implementation routing.
566
+
567
+ After QUALITY-001 completes (spec pipelines):
568
+ 1. Read quality score from QUALITY-001 findings
569
+ 2. If score >= 80%: present user approval for implementation (if full-lifecycle)
570
+ 3. If score 60-79%: suggest revisions, offer retry
571
+ 4. If score < 60%: return to writer for rework
572
+
573
+ After PLAN-001 completes (impl pipelines):
574
+ 1. Read plan.json complexity assessment
575
+ 2. Route by complexity:
576
+ - Low (1-2 modules): direct IMPL-001
577
+ - Medium (3-4 modules): parallel IMPL-{1..N}
578
+ - High (5+ modules): detailed architecture first, then parallel IMPL
579
+
580
+ **Success Criteria**:
581
+ - Post-wave interactive processing complete
582
+ - Interactive agents closed, results stored
583
+
584
+ ---
585
+
586
+ ### Phase 4: Results Aggregation
587
+
588
+ **Objective**: Generate final results and human-readable report.
589
+
590
+ ```javascript
591
+ const masterCsv = Read(`${sessionFolder}/tasks.csv`)
592
+ Write(`${sessionFolder}/results.csv`, masterCsv)
593
+
594
+ const tasks = parseCsv(masterCsv)
595
+ const completed = tasks.filter(t => t.status === 'completed')
596
+ const failed = tasks.filter(t => t.status === 'failed')
597
+ const skipped = tasks.filter(t => t.status === 'skipped')
598
+
599
+ const contextContent = `# Team Lifecycle v4 Report
600
+
601
+ **Session**: ${sessionId}
602
+ **Requirement**: ${requirement}
603
+ **Pipeline**: ${pipeline_type}
604
+ **Completed**: ${getUtc8ISOString()}
605
+
606
+ ---
607
+
608
+ ## Summary
609
+
610
+ | Metric | Count |
611
+ |--------|-------|
612
+ | Total Tasks | ${tasks.length} |
613
+ | Completed | ${completed.length} |
614
+ | Failed | ${failed.length} |
615
+ | Skipped | ${skipped.length} |
616
+ | Supervision | ${noSupervision ? 'Disabled' : 'Enabled'} |
617
+
618
+ ---
619
+
620
+ ## Pipeline Execution
621
+
622
+ ${waveDetails}
623
+
624
+ ---
625
+
626
+ ## Deliverables
627
+
628
+ ${deliverablesList}
629
+
630
+ ---
631
+
632
+ ## Quality Gates
633
+
634
+ ${qualityGateResults}
635
+
636
+ ---
637
+
638
+ ## Checkpoint Reports
639
+
640
+ ${checkpointResults}
641
+ `
642
+
643
+ Write(`${sessionFolder}/context.md`, contextContent)
644
+ ```
645
+
646
+ If not AUTO_YES, offer completion action:
647
+
648
+ ```javascript
649
+ if (!AUTO_YES) {
650
+ request_user_input({
651
+ questions: [{
652
+ question: "Pipeline complete. Choose next action.",
653
+ header: "Done",
654
+ id: "completion",
655
+ options: [
656
+ { label: "Archive (Recommended)", description: "Archive session" },
657
+ { label: "Keep Active", description: "Keep session for follow-up work" },
658
+ { label: "Export Results", description: "Export deliverables to target directory" }
659
+ ]
660
+ }]
661
+ })
662
+ }
663
+ ```
664
+
665
+ **Success Criteria**:
666
+ - results.csv exported (all tasks, both modes)
667
+ - context.md generated
668
+ - All interactive agents closed
669
+ - Summary displayed to user
670
+
671
+ ---
672
+
673
+ ## Shared Discovery Board Protocol
674
+
675
+ All agents across all waves share `discoveries.ndjson`. This enables cross-role knowledge sharing.
676
+
677
+ **Discovery Types**:
678
+
679
+ | Type | Dedup Key | Data Schema | Description |
680
+ |------|-----------|-------------|-------------|
681
+ | `research` | `data.dimension` | `{dimension, findings[], constraints[], integration_points[]}` | Research findings |
682
+ | `spec_artifact` | `data.doc_type` | `{doc_type, path, sections[], key_decisions[]}` | Specification document artifact |
683
+ | `exploration` | `data.angle` | `{angle, relevant_files[], patterns[], recommendations[]}` | Codebase exploration finding |
684
+ | `plan_task` | `data.task_id` | `{task_id, title, files[], complexity, convergence_criteria[]}` | Implementation task definition |
685
+ | `implementation` | `data.task_id` | `{task_id, files_modified[], approach, changes_summary}` | Implementation result |
686
+ | `test_result` | `data.framework` | `{framework, pass_rate, failures[], fix_iterations}` | Test execution result |
687
+ | `review_finding` | `data.file` | `{file, line, severity, dimension, description, suggested_fix}` | Code review finding |
688
+ | `checkpoint` | `data.checkpoint_id` | `{checkpoint_id, verdict, score, risks[], blocks[]}` | Supervisor checkpoint result |
689
+ | `quality_gate` | `data.gate_id` | `{gate_id, score, dimensions{}, verdict}` | Quality gate assessment |
690
+
691
+ **Format**: NDJSON, each line is self-contained JSON:
692
+
693
+ ```jsonl
694
+ {"ts":"2026-03-08T10:00:00+08:00","worker":"RESEARCH-001","type":"research","data":{"dimension":"domain","findings":["Auth system needs OAuth2 + RBAC"],"constraints":["Must support SSO"],"integration_points":["User service API"]}}
695
+ {"ts":"2026-03-08T10:15:00+08:00","worker":"DRAFT-001","type":"spec_artifact","data":{"doc_type":"product-brief","path":"spec/product-brief.md","sections":["Vision","Problem","Users","Goals"],"key_decisions":["OAuth2 over custom auth"]}}
696
+ {"ts":"2026-03-08T11:00:00+08:00","worker":"CHECKPOINT-001","type":"checkpoint","data":{"checkpoint_id":"CHECKPOINT-001","verdict":"pass","score":0.90,"risks":[],"blocks":[]}}
697
+ ```
698
+
699
+ **Protocol Rules**:
700
+ 1. Read board before own work -> leverage existing context
701
+ 2. Write discoveries immediately via `echo >>` -> don't batch
702
+ 3. Deduplicate -- check existing entries by type + dedup key
703
+ 4. Append-only -- never modify or delete existing lines
704
+
705
+ ---
706
+
707
+ ## Error Handling
708
+
709
+ | Error | Resolution |
710
+ |-------|------------|
711
+ | Circular dependency | Detect in wave computation, abort with error message |
712
+ | CSV agent timeout | Mark as failed in results, continue with wave |
713
+ | CSV agent failed | Mark as failed, skip dependent tasks in later waves |
714
+ | Interactive agent timeout | Urge convergence via send_input, then close if still timed out |
715
+ | Interactive agent failed | Mark as failed, skip dependents |
716
+ | Supervisor checkpoint blocked | request_user_input: Override / Revise / Abort |
717
+ | Quality gate failed (< 60%) | Return to writer for rework |
718
+ | All agents in wave failed | Log error, offer retry or abort |
719
+ | CSV parse error | Validate CSV format before execution, show line number |
720
+ | discoveries.ndjson corrupt | Ignore malformed lines, continue with valid entries |
721
+ | CLI tool fails | Agent fallback to direct implementation |
722
+ | Continue mode: no session found | List available sessions, prompt user to select |
723
+
724
+ ---
725
+
726
+ ## Core Rules
727
+
728
+ 1. **Start Immediately**: First action is session initialization, then Phase 0/1
729
+ 2. **Wave Order is Sacred**: Never execute wave N before wave N-1 completes and results are merged
730
+ 3. **CSV is Source of Truth**: Master tasks.csv holds all state (both csv-wave and interactive)
731
+ 4. **CSV First**: Default to csv-wave for tasks; only use interactive when interaction pattern requires it
732
+ 5. **Context Propagation**: prev_context built from master CSV, not from memory
733
+ 6. **Discovery Board is Append-Only**: Never clear, modify, or recreate discoveries.ndjson -- both mechanisms share it
734
+ 7. **Skip on Failure**: If a dependency failed, skip the dependent task (regardless of mechanism)
735
+ 8. **Lifecycle Balance**: Every spawn_agent MUST have a matching close_agent
736
+ 9. **Cleanup Temp Files**: Remove wave-{N}.csv after results are merged
737
+ 10. **DO NOT STOP**: Continuous execution until all waves complete or all remaining tasks are skipped
738
+
739
+
740
+ ---
741
+
742
+ ## Coordinator Role Constraints (Main Agent)
743
+
744
+ **CRITICAL**: The coordinator (main agent executing this skill) is responsible for **orchestration only**, NOT implementation.
745
+
746
+ 15. **Coordinator Does NOT Execute Code**: The main agent MUST NOT write, modify, or implement any code directly. All implementation work is delegated to spawned team agents. The coordinator only:
747
+ - Spawns agents with task assignments
748
+ - Waits for agent callbacks
749
+ - Merges results and coordinates workflow
750
+ - Manages workflow transitions between phases
751
+
752
+ 16. **Patient Waiting is Mandatory**: Agent execution takes significant time (typically 10-30 minutes per phase, sometimes longer). The coordinator MUST:
753
+ - Wait patiently for `wait()` calls to complete
754
+ - NOT skip workflow steps due to perceived delays
755
+ - NOT assume agents have failed just because they're taking time
756
+ - Trust the timeout mechanisms defined in the skill
757
+
758
+ 17. **Use send_input for Clarification**: When agents need guidance or appear stuck, the coordinator MUST:
759
+ - Use `send_input()` to ask questions or provide clarification
760
+ - NOT skip the agent or move to next phase prematurely
761
+ - Give agents opportunity to respond before escalating
762
+ - Example: `send_input({ id: agent_id, message: "Please provide status update or clarify blockers" })`
763
+
764
+ 18. **No Workflow Shortcuts**: The coordinator MUST NOT:
765
+ - Skip phases or stages defined in the workflow
766
+ - Bypass required approval or review steps
767
+ - Execute dependent tasks before prerequisites complete
768
+ - Assume task completion without explicit agent callback
769
+ - Make up or fabricate agent results
770
+
771
+ 19. **Respect Long-Running Processes**: This is a complex multi-agent workflow that requires patience:
772
+ - Total execution time may range from 30-90 minutes or longer
773
+ - Each phase may take 10-30 minutes depending on complexity
774
+ - The coordinator must remain active and attentive throughout the entire process
775
+ - Do not terminate or skip steps due to time concerns