Add unit tests for various components and stores in the terminal dashboard

- Implement tests for AssociationHighlight, DashboardToolbar, QueuePanel, SessionGroupTree, and TerminalDashboardPage to ensure proper functionality and state management.
- Create tests for cliSessionStore, issueQueueIntegrationStore, queueExecutionStore, queueSchedulerStore, sessionManagerStore, and terminalGridStore to validate state resets and workspace scoping.
- Mock necessary dependencies and state management hooks to isolate tests and ensure accurate behavior.
This commit is contained in:
catlog22
2026-03-08 21:38:20 +08:00
parent 9aa07e8d01
commit 62d8aa3623
157 changed files with 36544 additions and 71 deletions

View File

@@ -0,0 +1,712 @@
---
name: team-frontend
description: Frontend development team with built-in ui-ux-pro-max design intelligence. Covers requirement analysis, design system generation, frontend implementation, and quality assurance. CSV wave pipeline with interactive QA gates.
argument-hint: "[-y|--yes] [-c|--concurrency N] [--continue] \"frontend task description\""
allowed-tools: spawn_agents_on_csv, spawn_agent, wait, send_input, close_agent, Read, Write, Edit, Bash, Glob, Grep, AskUserQuestion
---
## Auto Mode
When `--yes` or `-y`: Auto-confirm task decomposition, skip interactive validation, use defaults for scope/industry/constraints.
# Team Frontend Development
## Usage
```bash
$team-frontend "Build a SaaS dashboard with user management and analytics"
$team-frontend -c 3 "Create a healthcare patient portal with WCAG AA compliance"
$team-frontend -y "Implement e-commerce product listing page with dark mode"
$team-frontend --continue "fe-saas-dashboard-20260308"
```
**Flags**:
- `-y, --yes`: Skip all confirmations (auto mode)
- `-c, --concurrency N`: Max concurrent agents within each wave (default: 3)
- `--continue`: Resume existing session
**Output Directory**: `.workflow/.csv-wave/{session-id}/`
**Core Output**: `tasks.csv` (master state) + `results.csv` (final) + `discoveries.ndjson` (shared exploration) + `context.md` (human-readable report)
---
## Overview
Unified frontend development team: analyze requirements, retrieve design intelligence (ui-ux-pro-max), generate design token system, architect components, implement code, and run 5-dimension quality audit. Roles: analyst, architect, developer, qa -- dynamically assigned as CSV wave tasks with dependency ordering. Supports page (4-task), feature (5-task), and system (7-task) pipeline modes.
**Execution Model**: Hybrid -- CSV wave pipeline (primary) + individual agent spawn (secondary)
```
+-------------------------------------------------------------------+
| TEAM FRONTEND WORKFLOW |
+-------------------------------------------------------------------+
| |
| Phase 0: Pre-Wave Interactive (Requirement Clarification) |
| +- Parse frontend task description |
| +- Select scope (page/feature/system), industry, constraints |
| +- Output: refined requirements for decomposition |
| |
| Phase 1: Requirement -> CSV + Classification |
| +- Signal detection: keyword scan -> capability inference |
| +- Pipeline selection (page: 4-task, feature: 5-task, system) |
| +- Dependency graph from pipeline definition |
| +- Classify tasks: csv-wave | interactive (exec_mode) |
| +- Compute dependency waves (topological sort) |
| +- Generate tasks.csv with wave + exec_mode columns |
| +- User validates task breakdown (skip if -y) |
| |
| Phase 2: Wave Execution Engine (Extended) |
| +- For each wave (1..N): |
| | +- Execute pre-wave interactive tasks (if any) |
| | +- Build wave CSV (filter csv-wave tasks for this wave) |
| | +- Inject previous findings into prev_context column |
| | +- spawn_agents_on_csv(wave CSV) |
| | +- Execute post-wave interactive tasks (if any) |
| | +- Merge all results into master tasks.csv |
| | +- Check: any failed? -> skip dependents |
| | +- GC Loop: if QA fails, create DEV-fix + QA-recheck |
| +- discoveries.ndjson shared across all modes (append-only) |
| |
| Phase 3: Post-Wave Interactive (Completion Action) |
| +- Pipeline completion report with deliverables listing |
| +- Interactive completion choice (Archive/Keep/Export) |
| +- Final aggregation / report |
| |
| Phase 4: Results Aggregation |
| +- Export final results.csv |
| +- Generate context.md with all findings |
| +- Display summary: completed/failed/skipped per wave |
| +- Offer: view results | retry failed | done |
| |
+-------------------------------------------------------------------+
```
---
## Task Classification Rules
Each task is classified by `exec_mode`:
| exec_mode | Mechanism | Criteria |
|-----------|-----------|----------|
| `csv-wave` | `spawn_agents_on_csv` | One-shot, structured I/O, no multi-round interaction |
| `interactive` | `spawn_agent`/`wait`/`send_input`/`close_agent` | Multi-round, revision cycles, user approval |
**Classification Decision**:
| Task Property | Classification |
|---------------|---------------|
| Requirement analysis (analyst) | `csv-wave` |
| Architecture design (architect) | `csv-wave` |
| Code implementation (developer) | `csv-wave` |
| QA audit (qa) | `csv-wave` |
| Architecture review gate (qa approving architecture before dev starts) | `interactive` |
| GC loop revision (developer fixing QA issues) | `csv-wave` |
| Pipeline completion action | `interactive` |
---
## CSV Schema
### tasks.csv (Master State)
```csv
id,title,description,role,pipeline_mode,scope,review_type,deps,context_from,exec_mode,wave,status,findings,artifacts_produced,qa_score,qa_verdict,error
"ANALYZE-001","Requirement analysis + design intelligence","PURPOSE: Analyze frontend requirements and retrieve design intelligence | Success: design-intelligence.json produced","analyst","feature","full","","","","csv-wave","1","pending","","","","",""
"ARCH-001","Design token system + component architecture","PURPOSE: Define design token system and component specs | Success: design-tokens.json + component specs produced","architect","feature","full","","ANALYZE-001","ANALYZE-001","csv-wave","2","pending","","","","",""
"QA-001","Architecture review","PURPOSE: Review architecture artifacts before development | Success: Architecture approved","qa","feature","full","architecture-review","ARCH-001","ARCH-001","csv-wave","3","pending","","","","",""
```
**Columns**:
| Column | Phase | Description |
|--------|-------|-------------|
| `id` | Input | Unique task identifier (PREFIX-NNN format: ANALYZE, ARCH, DEV, QA) |
| `title` | Input | Short task title |
| `description` | Input | Detailed task description with PURPOSE/TASK/CONTEXT/EXPECTED/CONSTRAINTS |
| `role` | Input | Role name: `analyst`, `architect`, `developer`, `qa` |
| `pipeline_mode` | Input | Pipeline: `page`, `feature`, `system` |
| `scope` | Input | Task scope: `full`, `tokens`, `components` |
| `review_type` | Input | QA review type: `architecture-review`, `code-review`, `final` (empty for non-QA) |
| `deps` | Input | Semicolon-separated dependency task IDs |
| `context_from` | Input | Semicolon-separated task IDs whose findings this task needs |
| `exec_mode` | Input | `csv-wave` or `interactive` |
| `wave` | Computed | Wave number (computed by topological sort, 1-based) |
| `status` | Output | `pending` -> `completed` / `failed` / `skipped` |
| `findings` | Output | Key discoveries or implementation notes (max 500 chars) |
| `artifacts_produced` | Output | Semicolon-separated paths of produced artifacts |
| `qa_score` | Output | QA weighted score (0-10, empty for non-QA tasks) |
| `qa_verdict` | Output | QA verdict: `PASSED`, `PASSED_WITH_WARNINGS`, `FIX_REQUIRED` (empty for non-QA) |
| `error` | Output | Error message if failed (empty if success) |
### Per-Wave CSV (Temporary)
Each wave generates a temporary `wave-{N}.csv` with extra `prev_context` column (csv-wave tasks only).
---
## Agent Registry (Interactive Agents)
| Agent | Role File | Pattern | Responsibility | Position |
|-------|-----------|---------|----------------|----------|
| QA Gate Reviewer | agents/qa-gate-reviewer.md | 2.3 (send_input cycle) | Review QA verdict and handle GC loop decisions | post-wave |
| Completion Handler | agents/completion-handler.md | 2.3 (send_input cycle) | Handle pipeline completion action (Archive/Keep/Export) | standalone |
> **COMPACT PROTECTION**: Agent files are execution documents. When context compression occurs, **you MUST immediately `Read` the corresponding agent.md** to reload.
---
## Output Artifacts
| File | Purpose | Lifecycle |
|------|---------|-----------|
| `tasks.csv` | Master state -- all tasks with status/findings | Updated after each wave |
| `wave-{N}.csv` | Per-wave input (temporary, csv-wave tasks only) | Created before wave, deleted after |
| `results.csv` | Final export of all task results | Created in Phase 4 |
| `discoveries.ndjson` | Shared exploration board (all agents, both modes) | Append-only, carries across waves |
| `context.md` | Human-readable execution report | Created in Phase 4 |
| `task-analysis.json` | Phase 0/1 output: capabilities, pipeline, roles | Created in Phase 1 |
| `role-instructions/` | Per-role instruction templates for CSV agents | Created in Phase 1 |
| `artifacts/` | All deliverables: design-intelligence.json, design-tokens.json, component-specs/, QA audits | Created by agents |
| `interactive/{id}-result.json` | Results from interactive tasks | Created per interactive task |
---
## Session Structure
```
.workflow/.csv-wave/{session-id}/
+-- tasks.csv # Master state (all tasks, both modes)
+-- results.csv # Final results export
+-- discoveries.ndjson # Shared discovery board (all agents)
+-- context.md # Human-readable report
+-- task-analysis.json # Phase 1 analysis output
+-- wave-{N}.csv # Temporary per-wave input (csv-wave only)
+-- role-instructions/ # Per-role instruction templates
| +-- analyst.md
| +-- architect.md
| +-- developer.md
| +-- qa.md
+-- artifacts/ # All deliverables
| +-- analysis/
| | +-- design-intelligence.json
| | +-- requirements.md
| +-- architecture/
| | +-- design-tokens.json
| | +-- component-specs/
| | +-- project-structure.md
| +-- qa/
| | +-- audit-001.md
| +-- build/
+-- interactive/ # Interactive task artifacts
| +-- {id}-result.json
+-- wisdom/ # Cross-task knowledge
+-- learnings.md
+-- decisions.md
```
---
## Implementation
### Session Initialization
```javascript
const getUtc8ISOString = () => new Date(Date.now() + 8 * 60 * 60 * 1000).toISOString()
const AUTO_YES = $ARGUMENTS.includes('--yes') || $ARGUMENTS.includes('-y')
const continueMode = $ARGUMENTS.includes('--continue')
const concurrencyMatch = $ARGUMENTS.match(/(?:--concurrency|-c)\s+(\d+)/)
const maxConcurrency = concurrencyMatch ? parseInt(concurrencyMatch[1]) : 3
const requirement = $ARGUMENTS
.replace(/--yes|-y|--continue|--concurrency\s+\d+|-c\s+\d+/g, '')
.trim()
const slug = requirement.toLowerCase()
.replace(/[^a-z0-9\u4e00-\u9fa5]+/g, '-')
.substring(0, 40)
const dateStr = getUtc8ISOString().substring(0, 10).replace(/-/g, '')
const sessionId = `fe-${slug}-${dateStr}`
const sessionFolder = `.workflow/.csv-wave/${sessionId}`
Bash(`mkdir -p ${sessionFolder}/artifacts/analysis ${sessionFolder}/artifacts/architecture/component-specs ${sessionFolder}/artifacts/qa ${sessionFolder}/artifacts/build ${sessionFolder}/role-instructions ${sessionFolder}/interactive ${sessionFolder}/wisdom`)
Write(`${sessionFolder}/discoveries.ndjson`, '')
Write(`${sessionFolder}/wisdom/learnings.md`, '# Learnings\n')
Write(`${sessionFolder}/wisdom/decisions.md`, '# Decisions\n')
```
---
### Phase 0: Pre-Wave Interactive (Requirement Clarification)
**Objective**: Parse frontend task, clarify scope/industry/constraints, prepare for decomposition.
**Workflow**:
1. **Parse user task description** from $ARGUMENTS
2. **Check for existing sessions** (continue mode):
- Scan `.workflow/.csv-wave/fe-*/tasks.csv` for sessions with pending tasks
- If `--continue`: resume the specified or most recent session, skip to Phase 2
- If active session found: ask user whether to resume or start new
3. **Clarify scope and industry** (skip if AUTO_YES):
**Scope Selection**:
| Option | Pipeline | Task Count |
|--------|----------|------------|
| Single page | page | 4 tasks (linear) |
| Multi-component feature | feature | 5 tasks (with arch review gate) |
| Full frontend system | system | 7 tasks (dual-track parallel) |
**Industry Selection**:
| Option | Strictness |
|--------|------------|
| SaaS/Tech | standard |
| E-commerce/Retail | standard |
| Healthcare/Finance | strict (extra accessibility) |
| Other | standard |
**Design Constraints** (multi-select): Existing design system, WCAG AA, Responsive, Dark mode
4. **Record requirements**: mode, scope, industry, constraints
5. **Signal Detection** for pipeline selection:
| Signal | Keywords | Capability |
|--------|----------|------------|
| Analysis | analyze, requirements, design intelligence | analyst |
| Architecture | design tokens, component architecture, design system | architect |
| Implementation | implement, build, code, develop, page, component | developer |
| Quality | review, audit, quality, test, accessibility | qa |
6. **Complexity Scoring**:
| Factor | Points |
|--------|--------|
| ui-ux-pro-max integration needed | +1 |
| Existing design system detected | +1 |
| Accessibility strict mode (healthcare/finance) | +2 |
| Multiple tech stacks | +2 |
| Dark mode required | +1 |
Results: 1-2 page, 3-4 feature, 5+ system. Default: feature.
**Success Criteria**:
- Scope, industry, constraints determined
- Pipeline mode selected (page/feature/system)
---
### Phase 1: Requirement -> CSV + Classification
**Objective**: Build task dependency graph, generate tasks.csv and per-role instruction templates.
**Decomposition Rules**:
1. **Pipeline Selection** based on scope:
| Scope | Pipeline | Tasks |
|-------|----------|-------|
| page | ANALYZE-001 -> ARCH-001 -> DEV-001 -> QA-001 | 4 |
| feature | ANALYZE-001 -> ARCH-001 -> QA-001(arch) -> DEV-001 -> QA-002(code) | 5 |
| system | ANALYZE-001 -> ARCH-001 -> QA-001(arch) -> [ARCH-002 + DEV-001] -> QA-002 -> DEV-002 -> QA-003(final) | 7 |
2. **Task Description Template**: Every task description uses PURPOSE/TASK/CONTEXT/EXPECTED/CONSTRAINTS format (see dispatch.md for full templates)
3. **Role Instruction Generation**: Write per-role instruction templates to `role-instructions/{role}.md` using the base instruction template customized for each role (analyst, architect, developer, qa)
**Classification Rules**:
| Task Property | exec_mode |
|---------------|-----------|
| Analyst analysis pass | `csv-wave` |
| Architect design pass | `csv-wave` |
| Developer implementation pass | `csv-wave` |
| QA audit pass | `csv-wave` |
| All standard pipeline tasks | `csv-wave` |
**Wave Computation**: Kahn's BFS topological sort with depth tracking.
```javascript
// Generate per-role instruction templates
for (const role of ['analyst', 'architect', 'developer', 'qa']) {
const instruction = generateRoleInstruction(role, sessionFolder)
Write(`${sessionFolder}/role-instructions/${role}.md`, instruction)
}
// Generate tasks.csv from pipeline definition
const tasks = buildTasksCsv(pipelineMode, requirement, sessionFolder, industry, constraints)
Write(`${sessionFolder}/tasks.csv`, toCsv(tasks))
Write(`${sessionFolder}/task-analysis.json`, JSON.stringify(analysisResult, null, 2))
```
**User Validation**: Display task breakdown with wave + exec_mode assignment (skip if AUTO_YES).
**Success Criteria**:
- tasks.csv created with valid schema, wave, and exec_mode assignments
- Role instruction templates generated in role-instructions/
- task-analysis.json written
- No circular dependencies
- User approved (or AUTO_YES)
---
### Phase 2: Wave Execution Engine (Extended)
**Objective**: Execute tasks wave-by-wave with hybrid mechanism support and cross-wave context propagation.
```javascript
const masterCsv = Read(`${sessionFolder}/tasks.csv`)
let tasks = parseCsv(masterCsv)
const maxWave = Math.max(...tasks.map(t => t.wave))
let gcRound = 0
const MAX_GC_ROUNDS = 2
for (let wave = 1; wave <= maxWave; wave++) {
console.log(`\nWave ${wave}/${maxWave}`)
// 1. Separate tasks by exec_mode
const waveTasks = tasks.filter(t => t.wave === wave && t.status === 'pending')
const csvTasks = waveTasks.filter(t => t.exec_mode === 'csv-wave')
const interactiveTasks = waveTasks.filter(t => t.exec_mode === 'interactive')
// 2. Check dependencies -- skip tasks whose deps failed
for (const task of waveTasks) {
const depIds = (task.deps || '').split(';').filter(Boolean)
const depStatuses = depIds.map(id => tasks.find(t => t.id === id)?.status)
if (depStatuses.some(s => s === 'failed' || s === 'skipped')) {
task.status = 'skipped'
task.error = `Dependency failed: ${depIds.filter((id, i) =>
['failed','skipped'].includes(depStatuses[i])).join(', ')}`
}
}
// 3. Execute pre-wave interactive tasks (if any)
const preWaveInteractive = interactiveTasks.filter(t => t.status === 'pending')
for (const task of preWaveInteractive) {
Read(`agents/qa-gate-reviewer.md`)
const agent = spawn_agent({
message: `## TASK ASSIGNMENT\n\n### MANDATORY FIRST STEPS\n1. Read: agents/qa-gate-reviewer.md\n2. Read: ${sessionFolder}/discoveries.ndjson\n\nGoal: ${task.description}\nScope: ${task.title}\nSession: ${sessionFolder}\n\n### Previous Context\n${buildPrevContext(task, tasks)}`
})
const result = wait({ ids: [agent], timeout_ms: 600000 })
if (result.timed_out) {
send_input({ id: agent, message: "Please finalize and output current findings." })
wait({ ids: [agent], timeout_ms: 120000 })
}
Write(`${sessionFolder}/interactive/${task.id}-result.json`, JSON.stringify({
task_id: task.id, status: "completed", findings: parseFindings(result),
timestamp: getUtc8ISOString()
}))
close_agent({ id: agent })
task.status = 'completed'
task.findings = parseFindings(result)
}
// 4. Build prev_context for csv-wave tasks
const pendingCsvTasks = csvTasks.filter(t => t.status === 'pending')
for (const task of pendingCsvTasks) {
task.prev_context = buildPrevContext(task, tasks)
}
if (pendingCsvTasks.length > 0) {
// 5. Write wave CSV
Write(`${sessionFolder}/wave-${wave}.csv`, toCsv(pendingCsvTasks))
// 6. Build instruction per role group
const waveInstruction = buildWaveInstruction(pendingCsvTasks, sessionFolder, wave)
// 7. Execute wave via spawn_agents_on_csv
spawn_agents_on_csv({
csv_path: `${sessionFolder}/wave-${wave}.csv`,
id_column: "id",
instruction: waveInstruction,
max_concurrency: maxConcurrency,
max_runtime_seconds: 900,
output_csv_path: `${sessionFolder}/wave-${wave}-results.csv`,
output_schema: {
type: "object",
properties: {
id: { type: "string" },
status: { type: "string", enum: ["completed", "failed"] },
findings: { type: "string" },
artifacts_produced: { type: "string" },
qa_score: { type: "string" },
qa_verdict: { type: "string" },
error: { type: "string" }
}
}
})
// 8. Merge results into master CSV
const results = parseCsv(Read(`${sessionFolder}/wave-${wave}-results.csv`))
for (const r of results) {
const t = tasks.find(t => t.id === r.id)
if (t) Object.assign(t, r)
}
// 9. GC Loop Check: if a QA task returned FIX_REQUIRED
const qaResults = results.filter(r => r.id.startsWith('QA') && r.qa_verdict === 'FIX_REQUIRED')
for (const qr of qaResults) {
if (gcRound < MAX_GC_ROUNDS) {
gcRound++
// Create DEV-fix and QA-recheck tasks, append to tasks array
const fixId = `DEV-fix-${gcRound}`
const recheckId = `QA-recheck-${gcRound}`
tasks.push({
id: fixId, title: `Fix QA issues (round ${gcRound})`,
description: `PURPOSE: Fix issues from ${qr.id} audit | Success: All critical/high resolved\nTASK:\n- Load QA audit report\n- Fix critical/high issues\n- Re-validate\nCONTEXT:\n- Session: ${sessionFolder}\n- Upstream: ${sessionFolder}/artifacts/qa/\nEXPECTED: Fixed source files\nCONSTRAINTS: Targeted fixes only`,
role: 'developer', pipeline_mode: tasks[0].pipeline_mode, scope: 'full',
review_type: '', deps: qr.id, context_from: qr.id,
exec_mode: 'csv-wave', wave: wave + 1, status: 'pending',
findings: '', artifacts_produced: '', qa_score: '', qa_verdict: '', error: ''
})
tasks.push({
id: recheckId, title: `QA recheck (round ${gcRound})`,
description: `PURPOSE: Re-audit after fixes | Success: Score >= 8, critical == 0\nTASK:\n- Execute 5-dimension audit on fixed code\n- Focus on previously flagged issues\nCONTEXT:\n- Session: ${sessionFolder}\n- Review type: code-review\nEXPECTED: ${sessionFolder}/artifacts/qa/audit-recheck-${gcRound}.md`,
role: 'qa', pipeline_mode: tasks[0].pipeline_mode, scope: 'full',
review_type: 'code-review', deps: fixId, context_from: fixId,
exec_mode: 'csv-wave', wave: wave + 2, status: 'pending',
findings: '', artifacts_produced: '', qa_score: '', qa_verdict: '', error: ''
})
// Extend maxWave
}
}
}
// 10. Update master CSV
Write(`${sessionFolder}/tasks.csv`, toCsv(tasks))
// 11. Cleanup temp files
Bash(`rm -f ${sessionFolder}/wave-${wave}.csv ${sessionFolder}/wave-${wave}-results.csv`)
// 12. Display wave summary
const completed = waveTasks.filter(t => t.status === 'completed').length
const failed = waveTasks.filter(t => t.status === 'failed').length
const skipped = waveTasks.filter(t => t.status === 'skipped').length
console.log(`Wave ${wave} Complete: ${completed} completed, ${failed} failed, ${skipped} skipped`)
}
```
**Success Criteria**:
- All waves executed in order
- Both csv-wave and interactive tasks handled per wave
- Each wave's results merged into master CSV before next wave starts
- Dependent tasks skipped when predecessor failed
- GC loop (developer <-> qa) handled with max 2 rounds
- discoveries.ndjson accumulated across all waves and mechanisms
---
### Phase 3: Post-Wave Interactive (Completion Action)
**Objective**: Pipeline completion report with deliverables listing and interactive completion choice.
```javascript
const tasks = parseCsv(Read(`${sessionFolder}/tasks.csv`))
const completed = tasks.filter(t => t.status === 'completed')
const failed = tasks.filter(t => t.status === 'failed')
// List deliverables
const deliverables = [
{ name: "Design Intelligence", path: `${sessionFolder}/artifacts/analysis/design-intelligence.json` },
{ name: "Requirements", path: `${sessionFolder}/artifacts/analysis/requirements.md` },
{ name: "Design Tokens", path: `${sessionFolder}/artifacts/architecture/design-tokens.json` },
{ name: "Component Specs", path: `${sessionFolder}/artifacts/architecture/component-specs/` },
{ name: "Project Structure", path: `${sessionFolder}/artifacts/architecture/project-structure.md` },
{ name: "QA Audits", path: `${sessionFolder}/artifacts/qa/` }
]
console.log(`
============================================
FRONTEND TEAM COMPLETE
Pipeline: ${completed.length}/${tasks.length} tasks (${tasks[0]?.pipeline_mode} mode)
GC Rounds: ${gcRound}/${MAX_GC_ROUNDS}
Session: ${sessionFolder}
Deliverables:
${deliverables.map(d => ` - ${d.name}: ${d.path}`).join('\n')}
============================================
`)
if (!AUTO_YES) {
AskUserQuestion({
questions: [{
question: "Frontend pipeline complete. What would you like to do?",
header: "Completion",
multiSelect: false,
options: [
{ label: "Archive & Clean (Recommended)", description: "Archive session, output final summary" },
{ label: "Keep Active", description: "Keep session for follow-up work" },
{ label: "Export Results", description: "Export design tokens and component specs" }
]
}]
})
}
```
**Success Criteria**:
- Post-wave interactive processing complete
- User informed of deliverables and pipeline status
---
### Phase 4: Results Aggregation
**Objective**: Generate final results and human-readable report.
```javascript
Bash(`cp ${sessionFolder}/tasks.csv ${sessionFolder}/results.csv`)
const tasks = parseCsv(Read(`${sessionFolder}/tasks.csv`))
let contextMd = `# Frontend Development Report\n\n`
contextMd += `**Session**: ${sessionId}\n`
contextMd += `**Pipeline**: ${tasks[0]?.pipeline_mode} mode\n`
contextMd += `**Date**: ${getUtc8ISOString().substring(0, 10)}\n\n`
contextMd += `## Summary\n`
contextMd += `| Status | Count |\n|--------|-------|\n`
contextMd += `| Completed | ${tasks.filter(t => t.status === 'completed').length} |\n`
contextMd += `| Failed | ${tasks.filter(t => t.status === 'failed').length} |\n`
contextMd += `| Skipped | ${tasks.filter(t => t.status === 'skipped').length} |\n\n`
const maxWave = Math.max(...tasks.map(t => t.wave))
contextMd += `## Wave Execution\n\n`
for (let w = 1; w <= maxWave; w++) {
const waveTasks = tasks.filter(t => t.wave === w)
contextMd += `### Wave ${w}\n\n`
for (const t of waveTasks) {
const icon = t.status === 'completed' ? '[DONE]' : t.status === 'failed' ? '[FAIL]' : '[SKIP]'
contextMd += `${icon} **${t.title}** [${t.role}]`
if (t.qa_score) contextMd += ` Score: ${t.qa_score}/10 (${t.qa_verdict})`
contextMd += ` ${t.findings || ''}\n\n`
}
}
contextMd += `## QA Summary\n\n`
const qaResults = tasks.filter(t => t.role === 'qa' && t.qa_score)
for (const q of qaResults) {
contextMd += `- **${q.id}**: Score ${q.qa_score}/10 - ${q.qa_verdict}\n`
}
Write(`${sessionFolder}/context.md`, contextMd)
console.log(`Results exported to: ${sessionFolder}/results.csv`)
console.log(`Report generated at: ${sessionFolder}/context.md`)
```
**Success Criteria**:
- results.csv exported (all tasks, both modes)
- context.md generated with QA summary
- Summary displayed to user
---
## Shared Discovery Board Protocol
All agents (csv-wave and interactive) share a single `discoveries.ndjson` file for cross-task knowledge exchange.
**Format**: One JSON object per line (NDJSON):
```jsonl
{"ts":"2026-03-08T10:00:00Z","worker":"ANALYZE-001","type":"tech_stack_detected","data":{"stack":"react","framework":"nextjs","ui_lib":"shadcn"}}
{"ts":"2026-03-08T10:05:00Z","worker":"ARCH-001","type":"token_generated","data":{"category":"color","count":24,"supports_dark_mode":true}}
{"ts":"2026-03-08T10:10:00Z","worker":"DEV-001","type":"file_modified","data":{"file":"src/styles/tokens.css","change":"Generated CSS custom properties","lines_added":85}}
{"ts":"2026-03-08T10:15:00Z","worker":"QA-001","type":"issue_found","data":{"file":"src/components/Button.tsx","line":42,"severity":"high","description":"Missing cursor-pointer on button"}}
```
**Discovery Types**:
| Type | Data Schema | Description |
|------|-------------|-------------|
| `tech_stack_detected` | `{stack, framework, ui_lib}` | Tech stack identified by analyst |
| `design_pattern_found` | `{pattern_name, location, description}` | Existing design pattern in codebase |
| `token_generated` | `{category, count, supports_dark_mode}` | Design token category created |
| `file_modified` | `{file, change, lines_added}` | File change recorded |
| `issue_found` | `{file, line, severity, description}` | QA issue discovered |
| `anti_pattern_violation` | `{pattern, file, line, description}` | Industry anti-pattern detected |
| `artifact_produced` | `{name, path, producer, type}` | Deliverable created |
**Protocol**:
1. Agents MUST read discoveries.ndjson at start of execution
2. Agents MUST append relevant discoveries during execution
3. Agents MUST NOT modify or delete existing entries
4. Deduplication by `{type, data.file}` key
---
## Pipeline Definitions
### Page Mode (4 tasks, linear)
```
ANALYZE-001 --> ARCH-001 --> DEV-001 --> QA-001
[analyst] [architect] [developer] [qa:code-review]
wave 1 wave 2 wave 3 wave 4
```
### Feature Mode (5 tasks, with architecture review gate)
```
ANALYZE-001 --> ARCH-001 --> QA-001 --> DEV-001 --> QA-002
[analyst] [architect] [qa:arch] [developer] [qa:code-review]
wave 1 wave 2 wave 3 wave 4 wave 5
```
### System Mode (7 tasks, dual-track parallel)
```
ANALYZE-001 --> ARCH-001 --> QA-001 --> ARCH-002 --+
[analyst] [architect] [qa:arch] [architect] |
DEV-001 --+--> QA-002 --> DEV-002 --> QA-003
[dev:tokens] [qa] [dev:comp] [qa:final]
wave 1 wave 2 wave 3 wave 4 wave 5 wave 6 wave 7
```
### Generator-Critic Loop (developer <-> qa)
```
developer (Generator) -> QA artifact -> qa (Critic)
<- QA feedback <-
(max 2 rounds)
Convergence: qa.score >= 8 && qa.critical_count === 0
```
---
## Error Handling
| Error | Resolution |
|-------|------------|
| Circular dependency | Detect in wave computation, abort with error message |
| CSV agent timeout | Mark as failed in results, continue with wave |
| CSV agent failed | Mark as failed, skip dependent tasks in later waves |
| Interactive agent timeout | Urge convergence via send_input, then close if still timed out |
| Interactive agent failed | Mark as failed, skip dependents |
| All agents in wave failed | Log error, offer retry or abort |
| CSV parse error | Validate CSV format before execution, show line number |
| discoveries.ndjson corrupt | Ignore malformed lines, continue with valid entries |
| QA score < 6 over 2 GC rounds | Escalate to user for manual intervention |
| ui-ux-pro-max unavailable | Degrade to LLM general design knowledge |
| Task description too vague | AskUserQuestion for clarification in Phase 0 |
| Continue mode: no session found | List available sessions, prompt user to select |
---
## Core Rules
1. **Start Immediately**: First action is session initialization, then Phase 0/1
2. **Wave Order is Sacred**: Never execute wave N before wave N-1 completes and results are merged
3. **CSV is Source of Truth**: Master tasks.csv holds all state (both csv-wave and interactive)
4. **CSV First**: Default to csv-wave for tasks; only use interactive when interaction pattern requires it
5. **Context Propagation**: prev_context built from master CSV, not from memory
6. **Discovery Board is Append-Only**: Never clear, modify, or recreate discoveries.ndjson
7. **Skip on Failure**: If a dependency failed, skip the dependent task
8. **GC Loop Cap**: Max 2 generator-critic rounds between developer and qa
9. **Cleanup Temp Files**: Remove wave-{N}.csv after results are merged
10. **DO NOT STOP**: Continuous execution until all waves complete or all remaining tasks are skipped

View File

@@ -0,0 +1,131 @@
# Completion Handler Agent
Interactive agent for handling pipeline completion action. Presents deliverables summary and offers Archive/Keep/Export choices.
## Identity
- **Type**: `interactive`
- **Role File**: `agents/completion-handler.md`
- **Responsibility**: Present pipeline results, handle completion choice, execute cleanup or export
## Boundaries
### MUST
- Load role definition via MANDATORY FIRST STEPS pattern
- Read all task results from master CSV
- Present complete deliverables listing
- Wait for user choice before acting
- Produce structured output following template
### MUST NOT
- Skip the MANDATORY FIRST STEPS role loading
- Delete session files without user approval
- Modify task artifacts
- Produce unstructured output
---
## Toolbox
### Available Tools
| Tool | Type | Purpose |
|------|------|---------|
| `Read` | built-in | Load task results and artifacts |
| `AskUserQuestion` | built-in | Get user completion choice |
| `Write` | built-in | Store completion result |
| `Bash` | built-in | Execute archive/export operations |
---
## Execution
### Phase 1: Results Loading
**Objective**: Load all task results and build deliverables inventory
**Input**:
| Source | Required | Description |
|--------|----------|-------------|
| tasks.csv | Yes | Master state with all task results |
| Artifact files | No | Verify deliverables exist |
**Steps**:
1. Read master tasks.csv
2. Parse all completed tasks and their artifacts
3. Build deliverables inventory
4. Calculate pipeline statistics
**Output**: Deliverables summary ready for user
---
### Phase 2: Completion Choice
**Objective**: Present results and get user action
**Steps**:
1. Display pipeline summary with deliverables
2. Present completion choice:
```javascript
AskUserQuestion({
questions: [{
question: "Frontend pipeline complete. What would you like to do?",
header: "Completion",
multiSelect: false,
options: [
{ label: "Archive & Clean (Recommended)", description: "Archive session, output final summary" },
{ label: "Keep Active", description: "Keep session for follow-up work" },
{ label: "Export Results", description: "Export design tokens, component specs, and QA audits" }
]
}]
})
```
3. Handle response:
| Response | Action |
|----------|--------|
| Archive & Clean | Mark session as completed, output final summary |
| Keep Active | Mark session as paused, keep all artifacts |
| Export Results | Copy key artifacts to project directory |
**Output**: Completion action result
---
## Structured Output Template
```
## Summary
- Pipeline completed: <task-count> tasks
- Status: <all-pass|with-warnings|with-failures>
- QA final score: <score>/10
## Deliverables
- Design Intelligence: <path>
- Design Tokens: <path>
- Component Specs: <path>
- QA Audits: <path>
- Implementation: <file-count> files
## Action Taken
- Choice: <archive|keep|export>
- Session status: <completed|paused|exported>
```
---
## Error Handling
| Scenario | Resolution |
|----------|------------|
| tasks.csv not found | Report error, cannot complete |
| Artifacts missing | Report partial completion with gaps noted |
| User does not respond | Timeout, default to keep active |

View File

@@ -0,0 +1,153 @@
# QA Gate Reviewer Agent
Interactive agent for reviewing QA audit verdicts and handling the Generator-Critic (GC) loop decision. Spawned when a QA task returns FIX_REQUIRED and the coordinator needs to determine whether to create a fix cycle or escalate.
## Identity
- **Type**: `interactive`
- **Role File**: `agents/qa-gate-reviewer.md`
- **Responsibility**: Review QA audit verdicts, handle architecture review gates, manage GC loop decisions
## Boundaries
### MUST
- Load role definition via MANDATORY FIRST STEPS pattern
- Read the QA audit report being reviewed
- Present a clear summary of QA findings to the user
- Wait for user decision before proceeding (if not AUTO_YES)
- Produce structured output following template
- Include file:line references in findings
### MUST NOT
- Skip the MANDATORY FIRST STEPS role loading
- Auto-approve FIX_REQUIRED verdicts without checking GC round count
- Modify QA audit artifacts directly
- Produce unstructured output
- Exceed defined scope boundaries
---
## Toolbox
### Available Tools
| Tool | Type | Purpose |
|------|------|---------|
| `Read` | built-in | Load QA audit reports and context |
| `AskUserQuestion` | built-in | Get user decision on QA gate |
| `Write` | built-in | Store review result |
### Tool Usage Patterns
**Read Pattern**: Load context files before review
```
Read("<session>/artifacts/qa/audit-*.md")
Read("<session>/discoveries.ndjson")
```
**Write Pattern**: Store review result
```
Write("<session>/interactive/<task-id>-result.json", <result>)
```
---
## Execution
### Phase 1: Context Loading
**Objective**: Load QA audit report and GC loop state
**Input**:
| Source | Required | Description |
|--------|----------|-------------|
| QA audit report | Yes | The audit document to review |
| discoveries.ndjson | No | Shared discoveries for context |
| Master CSV (tasks.csv) | No | For GC round tracking |
**Steps**:
1. Extract session path from task assignment
2. Read the QA audit report referenced in the task description
3. Read discoveries.ndjson for additional context
4. Check current GC round count from session state
**Output**: QA verdict summary ready for review
---
### Phase 2: Gate Decision
**Objective**: Determine next action based on QA verdict
**Steps**:
1. Parse QA verdict from audit report:
| Verdict | GC Round | Action |
|---------|----------|--------|
| PASSED | any | Report approved, no fix cycle needed |
| PASSED_WITH_WARNINGS | any | Report approved with warnings noted |
| FIX_REQUIRED | < 2 | Create DEV-fix + QA-recheck tasks |
| FIX_REQUIRED | >= 2 | Escalate to user for manual intervention |
2. If escalation needed, present choice:
```javascript
AskUserQuestion({
questions: [{
question: "QA has flagged issues after 2 fix rounds. How would you like to proceed?",
header: "QA Gate",
multiSelect: false,
options: [
{ label: "Accept current state", description: "Proceed despite remaining issues" },
{ label: "Manual fix", description: "You will fix the issues manually" },
{ label: "Abort pipeline", description: "Stop the pipeline" }
]
}]
})
```
3. Handle response accordingly
**Output**: Gate decision with action directive
---
## Structured Output Template
```
## Summary
- QA audit reviewed: <audit-id>
- Verdict: <PASSED|PASSED_WITH_WARNINGS|FIX_REQUIRED>
- Score: <score>/10
- Decision: <approved|fix-cycle|escalated|aborted>
## Findings
- Critical issues: <count>
- High issues: <count>
- Medium issues: <count>
- Low issues: <count>
## Decision Details
- GC round: <current>/<max>
- Action: <proceed|create-fix-cycle|escalate|abort>
- User feedback: <if applicable>
## Open Questions
1. Any unresolved items from review
```
---
## Error Handling
| Scenario | Resolution |
|----------|------------|
| QA audit report not found | Report in Open Questions, ask for path |
| GC round state missing | Default to round 0 |
| User does not respond | Timeout, report partial with "awaiting-review" status |
| Processing failure | Output partial results with clear status indicator |

View File

@@ -0,0 +1,197 @@
# Agent Instruction Template -- Team Frontend
Base instruction template for CSV wave agents. The orchestrator dynamically customizes this per role during Phase 1, writing role-specific versions to `role-instructions/{role}.md`.
## Purpose
| Phase | Usage |
|-------|-------|
| Phase 1 | Coordinator generates per-role instruction from this template |
| Phase 2 | Injected as `instruction` parameter to `spawn_agents_on_csv` |
---
## Base Instruction Template
```markdown
## TASK ASSIGNMENT -- Team Frontend
### MANDATORY FIRST STEPS
1. Read shared discoveries: <session-folder>/discoveries.ndjson (if exists, skip if not)
2. Read project context: .workflow/project-tech.json (if exists)
---
## Your Task
**Task ID**: {id}
**Title**: {title}
**Role**: {role}
**Pipeline Mode**: {pipeline_mode}
**Scope**: {scope}
**Review Type**: {review_type}
### Task Description
{description}
### Previous Tasks' Findings (Context)
{prev_context}
---
## Execution Protocol
1. **Read discoveries**: Load <session-folder>/discoveries.ndjson for shared exploration findings
2. **Use context**: Apply previous tasks' findings from prev_context above
3. **Execute task**: Follow role-specific instructions below
4. **Share discoveries**: Append exploration findings to shared board:
```bash
echo '{"ts":"<ISO8601>","worker":"{id}","type":"<type>","data":{...}}' >> <session-folder>/discoveries.ndjson
```
5. **Report result**: Return JSON via report_agent_job_result
### Discovery Types to Share
- `tech_stack_detected`: {stack, framework, ui_lib} -- Tech stack identification
- `design_pattern_found`: {pattern_name, location, description} -- Existing design pattern
- `token_generated`: {category, count, supports_dark_mode} -- Design token category created
- `file_modified`: {file, change, lines_added} -- File change performed
- `issue_found`: {file, line, severity, description} -- Issue discovered
- `anti_pattern_violation`: {pattern, file, line, description} -- Anti-pattern detected
- `artifact_produced`: {name, path, producer, type} -- Deliverable created
---
## Output (report_agent_job_result)
Return JSON:
{
"id": "{id}",
"status": "completed" | "failed",
"findings": "Key discoveries and implementation notes (max 500 chars)",
"artifacts_produced": "semicolon-separated paths of produced files",
"qa_score": "",
"qa_verdict": "",
"error": ""
}
```
---
## Role-Specific Customization
The coordinator generates per-role instruction variants during Phase 1. Each variant adds role-specific execution guidance to Step 3.
### For Analyst Role
```
3. **Execute**:
- Detect tech stack from package.json (react, nextjs, vue, svelte, html-tailwind)
- Detect existing design system via Glob: **/*token*.*, **/*.css
- Retrieve design intelligence via ui-ux-pro-max skill:
- Full design system: Skill(skill="ui-ux-pro-max", args="<industry> <keywords> --design-system")
- UX guidelines: Skill(skill="ui-ux-pro-max", args="accessibility animation responsive --domain ux")
- Tech stack guide: Skill(skill="ui-ux-pro-max", args="<keywords> --stack <detected-stack>")
- Fallback if skill unavailable: generate from LLM general design knowledge
- Analyze existing codebase patterns (color palette, typography, spacing, components)
- Optional: WebSearch for "<industry> web design trends best practices"
- Compile design-intelligence.json with: _source, industry, detected_stack, design_system, ux_guidelines, stack_guidelines, recommendations
- Write requirements.md summarizing all requirements
- Output to <session-folder>/artifacts/analysis/
```
### For Architect Role
```
3. **Execute**:
- Load design-intelligence.json from analyst output
- Generate design token system (design-tokens.json) with categories:
- color: primary, secondary, background, surface, text, CTA (light + dark mode)
- typography: font families, font sizes (scale)
- spacing: xs through 2xl
- border-radius: sm, md, lg, full
- shadow: sm, md, lg
- transition: fast, normal, slow
- Use $type + $value format (Design Tokens Community Group)
- Generate component specs in component-specs/ directory:
- Design reference (style, stack)
- Props table (name, type, default, description)
- Variants table
- Accessibility requirements (role, keyboard, ARIA, contrast)
- Anti-patterns to avoid
- Generate project structure (project-structure.md) using stack-specific layout
- Output to <session-folder>/artifacts/architecture/
```
### For Developer Role
```
3. **Execute**:
- Load design tokens, component specs, and project structure from architect output
- Generate CSS custom properties from design-tokens.json:
- color -> --color-*, typography -> --font-*, --text-*, spacing -> --space-*
- Add @media (prefers-color-scheme: dark) override for color tokens
- Implement components following specs and coding standards:
- Use design token CSS variables -- never hardcode colors/spacing
- All interactive elements: cursor: pointer
- Transitions: 150-300ms via var(--duration-normal)
- Text contrast: minimum 4.5:1 ratio
- Include focus-visible styles for keyboard navigation
- Support prefers-reduced-motion
- Responsive: mobile-first with md/lg breakpoints
- No emoji as functional icons
- Self-validate: scan for hardcoded colors, missing cursor-pointer, missing focus styles
- Auto-fix where possible
- Output to src/ directory (codebase files) + implementation summary
```
### For QA Role
```
3. **Execute**:
- Load design intelligence and design tokens for compliance checks
- Collect files to review based on review_type:
- architecture-review: <session>/artifacts/architecture/**/*
- code-review: src/**/*.{tsx,jsx,vue,svelte,html,css}
- final: src/**/*.{tsx,jsx,vue,svelte,html,css}
- Execute 5-dimension audit:
- Dim 1 Code Quality (0.20): file length, console.log, empty catch, unused imports
- Dim 2 Accessibility (0.25): alt text, labels, headings, focus styles, ARIA
- Dim 3 Design Compliance (0.20): hardcoded colors, spacing, anti-patterns
- Dim 4 UX Best Practices (0.20): cursor-pointer, transitions, responsive, states
- Dim 5 Pre-Delivery (0.15): final checklist (code-review/final types only)
- Calculate weighted score: sum(dimension_score * weight)
- Determine verdict: score >= 8 AND critical == 0 -> PASSED; score >= 6 AND critical == 0 -> PASSED_WITH_WARNINGS; else -> FIX_REQUIRED
- Write audit report to <session-folder>/artifacts/qa/
- Set qa_score and qa_verdict in output
```
---
## Quality Requirements
All agents must verify before reporting complete:
| Requirement | Criteria |
|-------------|----------|
| Files produced | Verify all claimed artifacts exist via Read |
| Files modified | Verify content actually changed |
| Findings accuracy | Findings reflect actual work done |
| Discovery sharing | At least 1 discovery shared to board |
| Error reporting | Non-empty error field if status is failed |
| QA fields | qa_score and qa_verdict set for QA role tasks |
---
## Placeholder Reference
| Placeholder | Resolved By | When |
|-------------|------------|------|
| `<session-folder>` | Skill designer (Phase 1) | Literal path baked into instruction |
| `{id}` | spawn_agents_on_csv | Runtime from CSV row |
| `{title}` | spawn_agents_on_csv | Runtime from CSV row |
| `{description}` | spawn_agents_on_csv | Runtime from CSV row |
| `{role}` | spawn_agents_on_csv | Runtime from CSV row |
| `{pipeline_mode}` | spawn_agents_on_csv | Runtime from CSV row |
| `{scope}` | spawn_agents_on_csv | Runtime from CSV row |
| `{review_type}` | spawn_agents_on_csv | Runtime from CSV row |
| `{prev_context}` | spawn_agents_on_csv | Runtime from CSV row |

View File

@@ -0,0 +1,188 @@
# Team Frontend -- CSV Schema
## Master CSV: tasks.csv
### Column Definitions
#### Input Columns (Set by Decomposer)
| Column | Type | Required | Description | Example |
|--------|------|----------|-------------|---------|
| `id` | string | Yes | Unique task identifier (PREFIX-NNN) | `"ANALYZE-001"` |
| `title` | string | Yes | Short task title | `"Requirement analysis + design intelligence"` |
| `description` | string | Yes | Detailed task description (self-contained) with PURPOSE/TASK/CONTEXT/EXPECTED/CONSTRAINTS | `"PURPOSE: Analyze frontend requirements..."` |
| `role` | enum | Yes | Worker role: `analyst`, `architect`, `developer`, `qa` | `"analyst"` |
| `pipeline_mode` | enum | Yes | Pipeline mode: `page`, `feature`, `system` | `"feature"` |
| `scope` | enum | Yes | Task scope: `full`, `tokens`, `components` | `"full"` |
| `review_type` | string | No | QA review type: `architecture-review`, `code-review`, `final` (empty for non-QA tasks) | `"code-review"` |
| `deps` | string | No | Semicolon-separated dependency task IDs | `"ANALYZE-001"` |
| `context_from` | string | No | Semicolon-separated task IDs for context | `"ANALYZE-001"` |
| `exec_mode` | enum | Yes | Execution mechanism: `csv-wave` or `interactive` | `"csv-wave"` |
#### Computed Columns (Set by Wave Engine)
| Column | Type | Description | Example |
|--------|------|-------------|---------|
| `wave` | integer | Wave number (1-based, from topological sort) | `2` |
| `prev_context` | string | Aggregated findings from context_from tasks (per-wave CSV only) | `"[ANALYZE-001] Detected React + shadcn stack..."` |
#### Output Columns (Set by Agent)
| Column | Type | Description | Example |
|--------|------|-------------|---------|
| `status` | enum | `pending` -> `completed` / `failed` / `skipped` | `"completed"` |
| `findings` | string | Key discoveries (max 500 chars) | `"Generated 24 color tokens with dark mode..."` |
| `artifacts_produced` | string | Semicolon-separated paths of produced artifacts | `"artifacts/analysis/design-intelligence.json;artifacts/analysis/requirements.md"` |
| `qa_score` | string | QA weighted score 0-10 (empty for non-QA tasks) | `"8.5"` |
| `qa_verdict` | enum | `PASSED`, `PASSED_WITH_WARNINGS`, `FIX_REQUIRED` (empty for non-QA) | `"PASSED"` |
| `error` | string | Error message if failed | `""` |
---
### exec_mode Values
| Value | Mechanism | Description |
|-------|-----------|-------------|
| `csv-wave` | `spawn_agents_on_csv` | One-shot batch execution within wave |
| `interactive` | `spawn_agent`/`wait`/`send_input`/`close_agent` | Multi-round individual execution |
Interactive tasks appear in master CSV for dependency tracking but are NOT included in wave-{N}.csv files.
---
### Role Prefixes
| Role | Prefix | Responsibility Type |
|------|--------|---------------------|
| analyst | ANALYZE | read-only (analysis + design intelligence retrieval) |
| architect | ARCH | orchestration (design token + component spec generation) |
| developer | DEV | code-gen (implementation from specs) |
| qa | QA | validation (5-dimension quality audit) |
---
### Example Data
```csv
id,title,description,role,pipeline_mode,scope,review_type,deps,context_from,exec_mode,wave,status,findings,artifacts_produced,qa_score,qa_verdict,error
"ANALYZE-001","Requirement analysis","PURPOSE: Analyze frontend requirements and retrieve design intelligence via ui-ux-pro-max | Success: design-intelligence.json produced with industry-specific recommendations\nTASK:\n- Detect tech stack and existing design system\n- Retrieve design intelligence\n- Compile design-intelligence.json and requirements.md\nCONTEXT:\n- Session: .workflow/.csv-wave/fe-saas-dashboard-20260308\n- Industry: saas\nEXPECTED: artifacts/analysis/design-intelligence.json + requirements.md","analyst","feature","full","","","","csv-wave","1","pending","","","","",""
"ARCH-001","Design token system + architecture","PURPOSE: Define design token system and component architecture | Success: design-tokens.json + component specs\nTASK:\n- Load design intelligence from analyst\n- Generate design tokens (colors, typography, spacing, shadows)\n- Define component specs\n- Generate project structure\nCONTEXT:\n- Session: .workflow/.csv-wave/fe-saas-dashboard-20260308\n- Upstream: design-intelligence.json\nEXPECTED: artifacts/architecture/design-tokens.json + component-specs/ + project-structure.md","architect","feature","full","","ANALYZE-001","ANALYZE-001","csv-wave","2","pending","","","","",""
"QA-001","Architecture review","PURPOSE: Review architecture before development | Success: Architecture approved with score >= 8\nTASK:\n- Load design intelligence and tokens\n- Execute 5-dimension audit on architecture\n- Calculate score and verdict\nCONTEXT:\n- Session: .workflow/.csv-wave/fe-saas-dashboard-20260308\n- Review type: architecture-review\nEXPECTED: artifacts/qa/audit-001.md","qa","feature","full","architecture-review","ARCH-001","ARCH-001","csv-wave","3","pending","","","","",""
"DEV-001","Frontend implementation","PURPOSE: Implement frontend from architecture artifacts | Success: All planned files implemented\nTASK:\n- Generate CSS custom properties from design tokens\n- Implement components following specs\n- Self-validate: no hardcoded colors, cursor-pointer, focus styles\nCONTEXT:\n- Session: .workflow/.csv-wave/fe-saas-dashboard-20260308\n- Upstream: design-tokens.json, component-specs/\nEXPECTED: src/styles/tokens.css + component files","developer","feature","full","","QA-001","QA-001;ARCH-001","csv-wave","4","pending","","","","",""
"QA-002","Code review","PURPOSE: Execute 5-dimension quality audit | Success: Score >= 8 with 0 critical issues\nTASK:\n- Execute full audit (code quality, accessibility, design compliance, UX, pre-delivery)\n- Calculate weighted score\nCONTEXT:\n- Session: .workflow/.csv-wave/fe-saas-dashboard-20260308\n- Review type: code-review\nEXPECTED: artifacts/qa/audit-002.md","qa","feature","full","code-review","DEV-001","DEV-001","csv-wave","5","pending","","","","",""
```
---
### Column Lifecycle
```
Decomposer (Phase 1) Wave Engine (Phase 2) Agent (Execution)
--------------------- -------------------- -----------------
id ----------> id ----------> id
title ----------> title ----------> (reads)
description ----------> description ----------> (reads)
role ----------> role ----------> (reads)
pipeline_mode ---------> pipeline_mode ---------> (reads)
scope ----------> scope ----------> (reads)
review_type ----------> review_type ----------> (reads)
deps ----------> deps ----------> (reads)
context_from----------> context_from----------> (reads)
exec_mode ----------> exec_mode ----------> (reads)
wave ----------> (reads)
prev_context ----------> (reads)
status
findings
artifacts_produced
qa_score
qa_verdict
error
```
---
## Output Schema (JSON)
Agent output via `report_agent_job_result` (csv-wave tasks):
```json
{
"id": "ARCH-001",
"status": "completed",
"findings": "Generated design token system with 24 color tokens (light+dark), 7 typography scales, 6 spacing values. Created 3 component specs: Button, Card, Header. Project structure follows Next.js app router convention.",
"artifacts_produced": "artifacts/architecture/design-tokens.json;artifacts/architecture/component-specs/button.md;artifacts/architecture/project-structure.md",
"qa_score": "",
"qa_verdict": "",
"error": ""
}
```
QA agent output example:
```json
{
"id": "QA-001",
"status": "completed",
"findings": "Architecture review: 8.2/10. Color tokens complete, typography scale follows best practices. Minor: missing border-radius for 'pill' variant.",
"artifacts_produced": "artifacts/qa/audit-001.md",
"qa_score": "8.2",
"qa_verdict": "PASSED",
"error": ""
}
```
Interactive tasks output via structured text or JSON written to `interactive/{id}-result.json`.
---
## Discovery Types
| Type | Dedup Key | Data Schema | Description |
|------|-----------|-------------|-------------|
| `tech_stack_detected` | `data.stack` | `{stack, framework, ui_lib}` | Tech stack identified |
| `design_pattern_found` | `data.pattern_name+data.location` | `{pattern_name, location, description}` | Existing design pattern |
| `token_generated` | `data.category` | `{category, count, supports_dark_mode}` | Design token category created |
| `file_modified` | `data.file` | `{file, change, lines_added}` | File change recorded |
| `issue_found` | `data.file+data.line` | `{file, line, severity, description}` | QA issue discovered |
| `anti_pattern_violation` | `data.pattern+data.file` | `{pattern, file, line, description}` | Industry anti-pattern detected |
| `artifact_produced` | `data.path` | `{name, path, producer, type}` | Deliverable created |
### Discovery NDJSON Format
```jsonl
{"ts":"2026-03-08T10:00:00Z","worker":"ANALYZE-001","type":"tech_stack_detected","data":{"stack":"react","framework":"nextjs","ui_lib":"shadcn"}}
{"ts":"2026-03-08T10:05:00Z","worker":"ARCH-001","type":"token_generated","data":{"category":"color","count":24,"supports_dark_mode":true}}
{"ts":"2026-03-08T10:10:00Z","worker":"DEV-001","type":"file_modified","data":{"file":"src/styles/tokens.css","change":"Generated CSS custom properties from design tokens","lines_added":85}}
{"ts":"2026-03-08T10:15:00Z","worker":"QA-001","type":"issue_found","data":{"file":"src/components/Button.tsx","line":42,"severity":"high","description":"Missing cursor-pointer on interactive button element"}}
```
> Both csv-wave and interactive agents read/write the same discoveries.ndjson file.
---
## Cross-Mechanism Context Flow
| Source | Target | Mechanism |
|--------|--------|-----------|
| CSV task findings | Interactive task | Injected via spawn message or send_input |
| Interactive task result | CSV task prev_context | Read from interactive/{id}-result.json |
| Any agent discovery | Any agent | Shared via discoveries.ndjson |
---
## Validation Rules
| Rule | Check | Error |
|------|-------|-------|
| Unique IDs | No duplicate `id` values | "Duplicate task ID: {id}" |
| Valid deps | All dep IDs exist in tasks | "Unknown dependency: {dep_id}" |
| No self-deps | Task cannot depend on itself | "Self-dependency: {id}" |
| No circular deps | Topological sort completes | "Circular dependency detected involving: {ids}" |
| context_from valid | All context IDs exist and in earlier waves | "Invalid context_from: {id}" |
| exec_mode valid | Value is `csv-wave` or `interactive` | "Invalid exec_mode: {value}" |
| Description non-empty | Every task has description | "Empty description for task: {id}" |
| Status enum | status in {pending, completed, failed, skipped} | "Invalid status: {status}" |
| Role valid | role in {analyst, architect, developer, qa} | "Invalid role: {role}" |
| Pipeline mode valid | pipeline_mode in {page, feature, system} | "Invalid pipeline_mode: {mode}" |
| QA verdict valid | qa_verdict in {PASSED, PASSED_WITH_WARNINGS, FIX_REQUIRED, ""} | "Invalid qa_verdict: {verdict}" |
| Cross-mechanism deps | Interactive to CSV deps resolve correctly | "Cross-mechanism dependency unresolvable: {id}" |