workflow-lite-plan
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseAuto Mode
自动模式
When or : Auto-confirm decomposition, skip interactive validation, use defaults.
--yes-y当传入 或 参数时:自动确认拆解结果,跳过交互校验,使用默认配置。
--yes-yWorkflow Lite Planex
Workflow Lite Planex
Usage
使用方法
bash
$workflow-lite-plan "Implement user authentication with OAuth, JWT, and 2FA"
$workflow-lite-plan -c 4 "Refactor payment module with Stripe and PayPal"
$workflow-lite-plan -y "Build notification system with email and SMS"
$workflow-lite-plan --continue "auth-20260228"Flags:
- : Skip all confirmations (auto mode)
-y, --yes - : Max concurrent agents within each wave (default: 4)
-c, --concurrency N - : Resume existing session
--continue
Output Directory:
.workflow/.lite-plan/{session-id}/bash
$workflow-lite-plan "Implement user authentication with OAuth, JWT, and 2FA"
$workflow-lite-plan -c 4 "Refactor payment module with Stripe and PayPal"
$workflow-lite-plan -y "Build notification system with email and SMS"
$workflow-lite-plan --continue "auth-20260228"参数说明:
- : 跳过所有确认步骤(自动模式)
-y, --yes - : 每轮波浪中最大并发Agent数(默认值:4)
-c, --concurrency N - : 恢复已有的会话
--continue
输出目录:
.workflow/.lite-plan/{session-id}/Overview
概述
Explore-first wave-based pipeline using . Two-stage CSV execution: explore.csv (codebase discovery) → tasks.csv (implementation), with cross-phase context propagation via linking ( → ).
spawn_agents_on_csvcontext_fromE*T*Core workflow: Decompose → Wave Explore → Synthesize & Plan → Wave Execute → Aggregate
┌──────────────────────────────────────────────────────────────────────┐
│ WORKFLOW LITE PLANEX │
├──────────────────────────────────────────────────────────────────────┤
│ │
│ Phase 1: Requirement → explore.csv │
│ ├─ Analyze complexity → select exploration angles (1-4) │
│ ├─ Generate explore.csv (1 row per angle) │
│ └─ User validates (skip if -y) │
│ │
│ Phase 2: Wave Explore (spawn_agents_on_csv) │
│ ├─ For each explore wave: │
│ │ ├─ Build wave CSV from explore.csv │
│ │ ├─ spawn_agents_on_csv(explore instruction template) │
│ │ └─ Merge findings/key_files into explore.csv │
│ └─ discoveries.ndjson shared across agents │
│ │
│ Phase 3: Synthesize & Plan → tasks.csv │
│ ├─ Read all explore findings → cross-reference │
│ ├─ Resolve conflicts between angles │
│ ├─ Decompose into execution tasks with context_from: E*;T* │
│ ├─ Compute dependency waves (topological sort) │
│ └─ User validates (skip if -y) │
│ │
│ Phase 4: Wave Execute (spawn_agents_on_csv) │
│ ├─ For each task wave: │
│ │ ├─ Build prev_context from explore.csv + tasks.csv │
│ │ ├─ Build wave CSV with prev_context column │
│ │ ├─ spawn_agents_on_csv(execute instruction template) │
│ │ └─ Merge results into tasks.csv │
│ └─ discoveries.ndjson carries across all waves │
│ │
│ Phase 5: Aggregate │
│ ├─ Export results.csv │
│ ├─ Generate context.md with all findings │
│ └─ Display summary │
│ │
└──────────────────────────────────────────────────────────────────────┘基于实现的探索优先波浪式流水线。分两个阶段执行CSV:explore.csv(代码库调研)→ tasks.csv(功能实现),通过关联实现跨阶段上下文传递( → )。
spawn_agents_on_csvcontext_fromE*T*核心工作流: 需求拆解 → 波浪式探索 → 结果整合与规划 → 波浪式执行 → 结果聚合
┌──────────────────────────────────────────────────────────────────────┐
│ WORKFLOW LITE PLANEX │
├──────────────────────────────────────────────────────────────────────┤
│ │
│ Phase 1: Requirement → explore.csv │
│ ├─ Analyze complexity → select exploration angles (1-4) │
│ ├─ Generate explore.csv (1 row per angle) │
│ └─ User validates (skip if -y) │
│ │
│ Phase 2: Wave Explore (spawn_agents_on_csv) │
│ ├─ For each explore wave: │
│ │ ├─ Build wave CSV from explore.csv │
│ │ ├─ spawn_agents_on_csv(explore instruction template) │
│ │ └─ Merge findings/key_files into explore.csv │
│ └─ discoveries.ndjson shared across agents │
│ │
│ Phase 3: Synthesize & Plan → tasks.csv │
│ ├─ Read all explore findings → cross-reference │
│ ├─ Resolve conflicts between angles │
│ ├─ Decompose into execution tasks with context_from: E*;T* │
│ ├─ Compute dependency waves (topological sort) │
│ └─ User validates (skip if -y) │
│ │
│ Phase 4: Wave Execute (spawn_agents_on_csv) │
│ ├─ For each task wave: │
│ │ ├─ Build prev_context from explore.csv + tasks.csv │
│ │ ├─ Build wave CSV with prev_context column │
│ │ ├─ spawn_agents_on_csv(execute instruction template) │
│ │ └─ Merge results into tasks.csv │
│ └─ discoveries.ndjson carries across all waves │
│ │
│ Phase 5: Aggregate │
│ ├─ Export results.csv │
│ ├─ Generate context.md with all findings │
│ └─ Display summary │
│ │
└──────────────────────────────────────────────────────────────────────┘Context Flow
上下文流转
explore.csv tasks.csv
┌──────────┐ ┌──────────┐
│ E1: arch │──────────→│ T1: setup│ context_from: E1;E2
│ findings │ │ prev_ctx │← E1+E2 findings
├──────────┤ ├──────────┤
│ E2: deps │──────────→│ T2: impl │ context_from: E1;T1
│ findings │ │ prev_ctx │← E1+T1 findings
├──────────┤ ├──────────┤
│ E3: test │──┐ ┌───→│ T3: test │ context_from: E3;T2
│ findings │ └───┘ │ prev_ctx │← E3+T2 findings
└──────────┘ └──────────┘
Two context channels:
1. Directed: context_from → prev_context (CSV findings lookup)
2. Broadcast: discoveries.ndjson (append-only shared board)
context_from prefix: E* → explore.csv lookup, T* → tasks.csv lookupexplore.csv tasks.csv
┌──────────┐ ┌──────────┐
│ E1: arch │──────────→│ T1: setup│ context_from: E1;E2
│ findings │ │ prev_ctx │← E1+E2 findings
├──────────┤ ├──────────┤
│ E2: deps │──────────→│ T2: impl │ context_from: E1;T1
│ findings │ │ prev_ctx │← E1+T1 findings
├──────────┤ ├──────────┤
│ E3: test │──┐ ┌───→│ T3: test │ context_from: E3;T2
│ findings │ └───┘ │ prev_ctx │← E3+T2 findings
└──────────┘ └──────────┘
两种上下文通道:
1. 定向传递: context_from → prev_context(CSV发现结果查询)
2. 广播传递: discoveries.ndjson(仅追加的共享看板)
context_from前缀说明: E* → 从explore.csv查询,T* → 从tasks.csv查询CSV Schemas
CSV结构定义
explore.csv
explore.csv
csv
id,angle,description,focus,deps,wave,status,findings,key_files,error
"E1","architecture","Explore codebase architecture for: auth system","architecture","","1","pending","","",""
"E2","dependencies","Explore dependency landscape for: auth system","dependencies","","1","pending","","",""
"E3","testing","Explore test infrastructure for: auth system","testing","","1","pending","","",""Columns:
| Column | Phase | Description |
|---|---|---|
| Input | Exploration ID: E1, E2, ... |
| Input | Exploration angle name |
| Input | What to explore from this angle |
| Input | Keywords and focus areas |
| Input | Semicolon-separated dep IDs (usually empty — all wave 1) |
| Computed | Wave number (usually 1 for all explorations) |
| Output | |
| Output | Discoveries (max 800 chars) |
| Output | Relevant files (semicolon-separated) |
| Output | Error message if failed |
csv
id,angle,description,focus,deps,wave,status,findings,key_files,error
"E1","architecture","Explore codebase architecture for: auth system","architecture","","1","pending","","",""
"E2","dependencies","Explore dependency landscape for: auth system","dependencies","","1","pending","","",""
"E3","testing","Explore test infrastructure for: auth system","testing","","1","pending","","",""字段说明:
| 字段 | 所属阶段 | 说明 |
|---|---|---|
| 输入 | 探索任务ID: E1, E2, ... |
| 输入 | 探索角度名称 |
| 输入 | 该角度下需要探索的内容 |
| 输入 | 关键词与重点关注领域 |
| 输入 | 分号分隔的依赖ID(通常为空,所有探索任务都在第一轮) |
| 计算生成 | 轮次编号(通常所有探索任务都在第1轮) |
| 输出 | |
| 输出 | 探索发现(最多800字符) |
| 输出 | 关联的核心文件(分号分隔) |
| 输出 | 执行失败时的错误信息 |
tasks.csv
tasks.csv
csv
id,title,description,test,acceptance_criteria,scope,hints,execution_directives,deps,context_from,wave,status,findings,files_modified,tests_passed,acceptance_met,error
"T1","Setup types","Create type definitions","Verify types compile with tsc","All interfaces exported","src/types/**","Follow existing patterns || src/types/index.ts","tsc --noEmit","","E1;E2","1","pending","","","","",""
"T2","Implement core","Implement core auth logic","Unit test: login returns token","Login flow works end-to-end","src/auth/**","Reuse BaseService || src/services/Base.ts","npm test -- --grep auth","T1","E1;E2;T1","2","pending","","","","",""Columns:
| Column | Phase | Description |
|---|---|---|
| Input | Task ID: T1, T2, ... |
| Input | Short task title |
| Input | Self-contained task description — what to implement |
| Input | Test cases: what tests to write and how to verify (unit/integration/edge) |
| Input | Measurable conditions that define "done" |
| Input | Target file/directory glob — constrains agent write area, prevents cross-task file conflicts |
| Input | Implementation tips + reference files. Format: |
| Input | Execution constraints: commands to run for verification, tool restrictions |
| Input | Dependency task IDs: T1;T2 (semicolon-separated) |
| Input | Context source IDs: E1;E2;T1 — |
| Computed | Wave number (computed by topological sort, 1-based) |
| Output | |
| Output | Execution findings (max 500 chars) |
| Output | Semicolon-separated file paths |
| Output | Whether all defined test cases passed (true/false) |
| Output | Summary of which acceptance criteria were met/unmet |
| Output | Error message if failed (empty if success) |
csv
id,title,description,test,acceptance_criteria,scope,hints,execution_directives,deps,context_from,wave,status,findings,files_modified,tests_passed,acceptance_met,error
"T1","Setup types","Create type definitions","Verify types compile with tsc","All interfaces exported","src/types/**","Follow existing patterns || src/types/index.ts","tsc --noEmit","","E1;E2","1","pending","","","","",""
"T2","Implement core","Implement core auth logic","Unit test: login returns token","Login flow works end-to-end","src/auth/**","Reuse BaseService || src/services/Base.ts","npm test -- --grep auth","T1","E1;E2;T1","2","pending","","","","",""字段说明:
| 字段 | 所属阶段 | 说明 |
|---|---|---|
| 输入 | 任务ID: T1, T2, ... |
| 输入 | 简短的任务标题 |
| 输入 | 独立完整的任务描述,说明需要实现的内容 |
| 输入 | 测试用例:需要编写的测试内容与验证方式(单元/集成/边界场景) |
| 输入 | 定义「完成」的可量化条件 |
| 输入 | 目标文件/目录通配符,限制Agent的写入范围,避免跨任务文件冲突 |
| 输入 | 实现提示 + 参考文件,格式:`提示文本 |
| 输入 | 执行约束:验证用的命令、工具限制 |
| 输入 | 依赖的任务ID,格式T1;T2(分号分隔) |
| 输入 | 上下文来源ID:E1;E2;T1 — |
| 计算生成 | 轮次编号(通过拓扑排序计算,从1开始) |
| 输出 | |
| 输出 | 执行发现(最多500字符) |
| 输出 | 分号分隔的修改文件路径 |
| 输出 | 所有定义的测试用例是否通过(true/false) |
| 输出 | 验收条件满足/未满足的总结 |
| 输出 | 执行失败时的错误信息(成功则为空) |
Per-Wave CSV (Temporary)
每轮临时CSV
Each wave generates a temporary CSV with an extra column.
prev_contextExplore wave: — same columns as explore.csv (no prev_context, explorations are independent).
explore-wave-{N}.csvExecute wave: — all task columns + :
task-wave-{N}.csvprev_contextcsv
id,title,description,test,acceptance_criteria,scope,hints,execution_directives,deps,context_from,wave,prev_context
"T2","Implement core","Implement core auth logic","Unit test: login returns token","Login flow works end-to-end","src/auth/**","Reuse BaseService || src/services/Base.ts","npm test -- --grep auth","T1","E1;E2;T1","2","[Explore architecture] Found BaseService pattern in src/services/\n[Task T1] Created types at src/types/auth.ts"The column is built from by looking up completed rows' in both explore.csv () and tasks.csv ().
prev_contextcontext_fromfindingsE*T*每轮执行会生成带额外字段的临时CSV。
prev_context探索轮次: — 字段与explore.csv一致(无prev_context,探索任务相互独立)。
explore-wave-{N}.csv执行轮次: — 包含所有任务字段 + :
task-wave-{N}.csvprev_contextcsv
id,title,description,test,acceptance_criteria,scope,hints,execution_directives,deps,context_from,wave,prev_context
"T2","Implement core","Implement core auth logic","Unit test: login returns token","Login flow works end-to-end","src/auth/**","Reuse BaseService || src/services/Base.ts","npm test -- --grep auth","T1","E1;E2;T1","2","[Explore architecture] Found BaseService pattern in src/services/\n[Task T1] Created types at src/types/auth.ts"prev_contextcontext_fromE*T*findingsOutput Artifacts
输出产物
| File | Purpose | Lifecycle |
|---|---|---|
| Exploration state — angles with findings/key_files | Updated after Phase 2 |
| Execution state — tasks with results | Updated after each wave in Phase 4 |
| Per-wave explore input (temporary) | Created before wave, deleted after |
| Per-wave execute input (temporary) | Created before wave, deleted after |
| Final results export | Created in Phase 5 |
| Shared discovery board (all agents, all phases) | Append-only |
| Human-readable execution report | Created in Phase 5 |
| 文件 | 用途 | 生命周期 |
|---|---|---|
| 探索状态 — 存储各探索角度的发现结果与核心文件 | 第2阶段完成后更新 |
| 执行状态 — 存储任务执行结果 | 第4阶段每轮执行完成后更新 |
| 每轮探索的输入文件(临时) | 轮次开始前创建,执行完成后删除 |
| 每轮执行的输入文件(临时) | 轮次开始前创建,执行完成后删除 |
| 最终结果导出文件 | 第5阶段生成 |
| 共享发现看板(所有Agent、所有阶段共享) | 仅追加写入 |
| 可读的执行报告 | 第5阶段生成 |
Session Structure
会话目录结构
.workflow/.lite-plan/{session-id}/
├── explore.csv # Exploration state
├── tasks.csv # Execution state
├── results.csv # Final results export
├── discoveries.ndjson # Shared discovery board
├── context.md # Full context summary
├── explore-wave-{N}.csv # Temporary per-wave explore input (cleaned up)
└── task-wave-{N}.csv # Temporary per-wave execute input (cleaned up).workflow/.lite-plan/{session-id}/
├── explore.csv # 探索状态
├── tasks.csv # 执行状态
├── results.csv # 最终结果导出
├── discoveries.ndjson # 共享发现看板
├── context.md # 完整上下文总结
├── explore-wave-{N}.csv # 每轮探索的临时输入文件(执行后清理)
└── task-wave-{N}.csv # 每轮执行的临时输入文件(执行后清理)Implementation
实现逻辑
Session Initialization
会话初始化
javascript
const getUtc8ISOString = () => new Date(Date.now() + 8 * 60 * 60 * 1000).toISOString()
// Parse flags
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]) : 4
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 = `wpp-${slug}-${dateStr}`
const sessionFolder = `.workflow/.lite-plan/${sessionId}`
// Continue mode: find existing session
if (continueMode) {
const existing = Bash(`ls -t .workflow/.lite-plan/ 2>/dev/null | head -1`).trim()
if (existing) {
sessionId = existing
sessionFolder = `.workflow/.lite-plan/${sessionId}`
// Check which phase to resume: if tasks.csv exists → Phase 4, else → Phase 2
}
}
Bash(`mkdir -p ${sessionFolder}`)javascript
const getUtc8ISOString = () => new Date(Date.now() + 8 * 60 * 60 * 1000).toISOString()
// Parse flags
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]) : 4
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 = `wpp-${slug}-${dateStr}`
const sessionFolder = `.workflow/.lite-plan/${sessionId}`
// Continue mode: find existing session
if (continueMode) {
const existing = Bash(`ls -t .workflow/.lite-plan/ 2>/dev/null | head -1`).trim()
if (existing) {
sessionId = existing
sessionFolder = `.workflow/.lite-plan/${sessionId}`
// Check which phase to resume: if tasks.csv exists → Phase 4, else → Phase 2
}
}
Bash(`mkdir -p ${sessionFolder}`)Phase 1: Requirement → explore.csv
第1阶段:需求拆解生成explore.csv
Objective: Analyze requirement complexity, select exploration angles, generate explore.csv.
Steps:
-
Analyze & Decomposejavascript
Bash({ command: `ccw cli -p "PURPOSE: Analyze requirement complexity and select 1-4 exploration angles for codebase discovery before implementation.
TASK:
• Classify requirement type (feature/bugfix/refactor/security/performance)
• Assess complexity (Low: 1 angle, Medium: 2-3, High: 3-4)
• Select exploration angles from: architecture, dependencies, integration-points, testing, patterns, security, performance, state-management, error-handling, edge-cases
• For each angle, define focus keywords and what to discover
MODE: analysis
CONTEXT: @**/*
EXPECTED: JSON object: {type: string, complexity: string, angles: [{id: string, angle: string, description: string, focus: string}]}. Each angle id = E1, E2, etc.
CONSTRAINTS: 1-4 angles | Angles must be distinct | Each angle must have clear focus
REQUIREMENT: ${requirement}" --tool gemini --mode analysis --rule planning-breakdown-task-steps`,
run_in_background: true
})
// Wait for CLI completion via hook callback
// Parse JSON from CLI output → { type, complexity, angles[] }
2. **Generate explore.csv**
```javascript
const header = 'id,angle,description,focus,deps,wave,status,findings,key_files,error'
const rows = angles.map(a =>
[a.id, a.angle, a.description, a.focus, '', '1', 'pending', '', '', '']
.map(v => `"${String(v).replace(/"/g, '""')}"`)
.join(',')
)
Write(`${sessionFolder}/explore.csv`, [header, ...rows].join('\n'))-
User Validation (skip if AUTO_YES)javascript
if (!AUTO_YES) { console.log(`\n## Exploration Plan (${angles.length} angles)\n`) angles.forEach(a => console.log(` - [${a.id}] ${a.angle}: ${a.focus}`)) const answer = AskUserQuestion({ questions: [{ question: "Approve exploration angles?", header: "Validation", multiSelect: false, options: [ { label: "Approve", description: "Proceed with wave exploration" }, { label: "Modify", description: `Edit ${sessionFolder}/explore.csv manually, then --continue` }, { label: "Cancel", description: "Abort" } ] }] }) if (answer.Validation === "Modify") { console.log(`Edit: ${sessionFolder}/explore.csv\nResume: $workflow-lite-plan --continue`) return } else if (answer.Validation === "Cancel") { return } }
Success Criteria:
- explore.csv created with 1-4 exploration angles
- User approved (or AUTO_YES)
目标: 分析需求复杂度,选择探索角度,生成explore.csv。
步骤:
-
分析与拆解javascript
Bash({ command: `ccw cli -p "PURPOSE: Analyze requirement complexity and select 1-4 exploration angles for codebase discovery before implementation.
TASK:
• Classify requirement type (feature/bugfix/refactor/security/performance)
• Assess complexity (Low: 1 angle, Medium: 2-3, High: 3-4)
• Select exploration angles from: architecture, dependencies, integration-points, testing, patterns, security, performance, state-management, error-handling, edge-cases
• For each angle, define focus keywords and what to discover
MODE: analysis
CONTEXT: @**/*
EXPECTED: JSON object: {type: string, complexity: string, angles: [{id: string, angle: string, description: string, focus: string}]}. Each angle id = E1, E2, etc.
CONSTRAINTS: 1-4 angles | Angles must be distinct | Each angle must have clear focus
REQUIREMENT: ${requirement}" --tool gemini --mode analysis --rule planning-breakdown-task-steps`,
run_in_background: true
})
// Wait for CLI completion via hook callback
// Parse JSON from CLI output → { type, complexity, angles[] }
2. **生成explore.csv**
```javascript
const header = 'id,angle,description,focus,deps,wave,status,findings,key_files,error'
const rows = angles.map(a =>
[a.id, a.angle, a.description, a.focus, '', '1', 'pending', '', '', '']
.map(v => `"${String(v).replace(/"/g, '""')}"`)
.join(',')
)
Write(`${sessionFolder}/explore.csv`, [header, ...rows].join('\n'))-
用户校验(AUTO_YES模式下跳过)javascript
if (!AUTO_YES) { console.log(`\n## Exploration Plan (${angles.length} angles)\n`) angles.forEach(a => console.log(` - [${a.id}] ${a.angle}: ${a.focus}`)) const answer = AskUserQuestion({ questions: [{ question: "Approve exploration angles?", header: "Validation", multiSelect: false, options: [ { label: "Approve", description: "Proceed with wave exploration" }, { label: "Modify", description: `Edit ${sessionFolder}/explore.csv manually, then --continue` }, { label: "Cancel", description: "Abort" } ] }] }) if (answer.Validation === "Modify") { console.log(`Edit: ${sessionFolder}/explore.csv\nResume: $workflow-lite-plan --continue`) return } else if (answer.Validation === "Cancel") { return } }
成功条件:
- 生成的explore.csv包含1-4个探索角度
- 用户确认通过(或AUTO_YES模式)
Phase 2: Wave Explore (spawn_agents_on_csv)
第2阶段:波浪式探索(spawn_agents_on_csv)
Objective: Execute exploration via . Each angle produces findings and key_files.
spawn_agents_on_csvSteps:
-
Explore Wave Loopjavascript
const exploreCSV = parseCsv(Read(`${sessionFolder}/explore.csv`)) const maxExploreWave = Math.max(...exploreCSV.map(r => parseInt(r.wave))) for (let wave = 1; wave <= maxExploreWave; wave++) { const waveTasks = exploreCSV.filter(r => parseInt(r.wave) === wave && r.status === 'pending' ) if (waveTasks.length === 0) continue // Skip rows with failed dependencies const executableTasks = [] for (const task of waveTasks) { const deps = (task.deps || '').split(';').filter(Boolean) if (deps.some(d => { const dep = exploreCSV.find(r => r.id === d) return !dep || dep.status !== 'completed' })) { task.status = 'skipped' task.error = 'Dependency failed/skipped' continue } executableTasks.push(task) } if (executableTasks.length === 0) continue // Write explore wave CSV const waveHeader = 'id,angle,description,focus,deps,wave' const waveRows = executableTasks.map(t => [t.id, t.angle, t.description, t.focus, t.deps, t.wave] .map(v => `"${String(v).replace(/"/g, '""')}"`) .join(',') ) Write(`${sessionFolder}/explore-wave-${wave}.csv`, [waveHeader, ...waveRows].join('\n')) // Execute explore wave console.log(` Exploring ${executableTasks.length} angles (wave ${wave})...`) spawn_agents_on_csv({ csv_path: `${sessionFolder}/explore-wave-${wave}.csv`, id_column: "id", instruction: buildExploreInstruction(sessionFolder), max_concurrency: maxConcurrency, max_runtime_seconds: 300, output_csv_path: `${sessionFolder}/explore-wave-${wave}-results.csv`, output_schema: { type: "object", properties: { id: { type: "string" }, status: { type: "string", enum: ["completed", "failed"] }, findings: { type: "string" }, key_files: { type: "array", items: { type: "string" } }, error: { type: "string" } }, required: ["id", "status", "findings"] } }) // Merge results into explore.csv const waveResults = parseCsv(Read(`${sessionFolder}/explore-wave-${wave}-results.csv`)) for (const result of waveResults) { updateMasterCsvRow(`${sessionFolder}/explore.csv`, result.id, { status: result.status, findings: result.findings || '', key_files: Array.isArray(result.key_files) ? result.key_files.join(';') : (result.key_files || ''), error: result.error || '' }) } // Cleanup temporary wave CSV Bash(`rm -f "${sessionFolder}/explore-wave-${wave}.csv" "${sessionFolder}/explore-wave-${wave}-results.csv"`) } -
Explore Instruction Templatejavascript
function buildExploreInstruction(sessionFolder) { return `
目标: 通过执行探索任务,每个角度产出发现结果与核心文件列表。
spawn_agents_on_csv步骤:
-
探索轮次循环javascript
const exploreCSV = parseCsv(Read(`${sessionFolder}/explore.csv`)) const maxExploreWave = Math.max(...exploreCSV.map(r => parseInt(r.wave))) for (let wave = 1; wave <= maxExploreWave; wave++) { const waveTasks = exploreCSV.filter(r => parseInt(r.wave) === wave && r.status === 'pending' ) if (waveTasks.length === 0) continue // Skip rows with failed dependencies const executableTasks = [] for (const task of waveTasks) { const deps = (task.deps || '').split(';').filter(Boolean) if (deps.some(d => { const dep = exploreCSV.find(r => r.id === d) return !dep || dep.status !== 'completed' })) { task.status = 'skipped' task.error = 'Dependency failed/skipped' continue } executableTasks.push(task) } if (executableTasks.length === 0) continue // Write explore wave CSV const waveHeader = 'id,angle,description,focus,deps,wave' const waveRows = executableTasks.map(t => [t.id, t.angle, t.description, t.focus, t.deps, t.wave] .map(v => `"${String(v).replace(/"/g, '""')}"`) .join(',') ) Write(`${sessionFolder}/explore-wave-${wave}.csv`, [waveHeader, ...waveRows].join('\n')) // Execute explore wave console.log(` Exploring ${executableTasks.length} angles (wave ${wave})...`) spawn_agents_on_csv({ csv_path: `${sessionFolder}/explore-wave-${wave}.csv`, id_column: "id", instruction: buildExploreInstruction(sessionFolder), max_concurrency: maxConcurrency, max_runtime_seconds: 300, output_csv_path: `${sessionFolder}/explore-wave-${wave}-results.csv`, output_schema: { type: "object", properties: { id: { type: "string" }, status: { type: "string", enum: ["completed", "failed"] }, findings: { type: "string" }, key_files: { type: "array", items: { type: "string" } }, error: { type: "string" } }, required: ["id", "status", "findings"] } }) // Merge results into explore.csv const waveResults = parseCsv(Read(`${sessionFolder}/explore-wave-${wave}-results.csv`)) for (const result of waveResults) { updateMasterCsvRow(`${sessionFolder}/explore.csv`, result.id, { status: result.status, findings: result.findings || '', key_files: Array.isArray(result.key_files) ? result.key_files.join(';') : (result.key_files || ''), error: result.error || '' }) } // Cleanup temporary wave CSV Bash(`rm -f "${sessionFolder}/explore-wave-${wave}.csv" "${sessionFolder}/explore-wave-${wave}-results.csv"`) } -
探索指令模板javascript
function buildExploreInstruction(sessionFolder) { return `
EXPLORATION ASSIGNMENT
EXPLORATION ASSIGNMENT
MANDATORY FIRST STEPS
MANDATORY FIRST STEPS
- Read shared discoveries: ${sessionFolder}/discoveries.ndjson (if exists, skip if not)
- Read project context: .workflow/project-tech.json (if exists)
- Read shared discoveries: ${sessionFolder}/discoveries.ndjson (if exists, skip if not)
- Read project context: .workflow/project-tech.json (if exists)
Your Exploration
Your Exploration
Exploration ID: {id}
Angle: {angle}
Description: {description}
Focus: {focus}
Exploration ID: {id}
Angle: {angle}
Description: {description}
Focus: {focus}
Exploration Protocol
Exploration Protocol
- Read discoveries: Load ${sessionFolder}/discoveries.ndjson for shared findings
- Explore: Search the codebase from the {angle} perspective
- Discover: Find relevant files, patterns, integration points, constraints
- Share discoveries: Append findings to shared board: ```bash echo '{"ts":"<ISO8601>","worker":"{id}","type":"<type>","data":{...}}' >> ${sessionFolder}/discoveries.ndjson ```
- Report result: Return JSON via report_agent_job_result
- Read discoveries: Load ${sessionFolder}/discoveries.ndjson for shared findings
- Explore: Search the codebase from the {angle} perspective
- Discover: Find relevant files, patterns, integration points, constraints
- Share discoveries: Append findings to shared board: ```bash echo '{"ts":"<ISO8601>","worker":"{id}","type":"<type>","data":{...}}' >> ${sessionFolder}/discoveries.ndjson ```
- Report result: Return JSON via report_agent_job_result
What to Look For
What to Look For
- Existing patterns and conventions to follow
- Integration points and module boundaries
- Dependencies and constraints
- Test infrastructure and coverage
- Risks and potential blockers
- Existing patterns and conventions to follow
- Integration points and module boundaries
- Dependencies and constraints
- Test infrastructure and coverage
- Risks and potential blockers
Discovery Types to Share
Discovery Types to Share
- `code_pattern`: {name, file, description} — reusable patterns found
- `integration_point`: {file, description, exports[]} — module connection points
- `convention`: {naming, imports, formatting} — code style conventions
- `tech_stack`: {framework, version, config} — technology stack details
- `code_pattern`: {name, file, description} — reusable patterns found
- `integration_point`: {file, description, exports[]} — module connection points
- `convention`: {naming, imports, formatting} — code style conventions
- `tech_stack`: {framework, version, config} — technology stack details
Output (report_agent_job_result)
Output (report_agent_job_result)
Return JSON:
{
"id": "{id}",
"status": "completed" | "failed",
"findings": "Concise summary of ${'{'}angle{'}'} discoveries (max 800 chars)",
"key_files": ["relevant/file1.ts", "relevant/file2.ts"],
"error": ""
}
`
}
**Success Criteria**:
- All explore angles executed
- explore.csv updated with findings and key_files
- discoveries.ndjson accumulated
---Return JSON:
{
"id": "{id}",
"status": "completed" | "failed",
"findings": "Concise summary of ${'{'}angle{'}'} discoveries (max 800 chars)",
"key_files": ["relevant/file1.ts", "relevant/file2.ts"],
"error": ""
}
`
}
**成功条件**:
- 所有探索角度执行完毕
- explore.csv已更新发现结果与核心文件
- discoveries.ndjson已累计所有探索内容
---Phase 3: Synthesize & Plan → tasks.csv
第3阶段:结果整合与规划生成tasks.csv
Objective: Read exploration findings, cross-reference, resolve conflicts, generate tasks.csv with context_from linking to E* rows.
Steps:
-
Synthesize Exploration Findingsjavascript
const exploreCSV = parseCsv(Read(`${sessionFolder}/explore.csv`)) const completed = exploreCSV.filter(r => r.status === 'completed') // Cross-reference: find shared files across angles const fileRefs = {} completed.forEach(r => { (r.key_files || '').split(';').filter(Boolean).forEach(f => { if (!fileRefs[f]) fileRefs[f] = [] fileRefs[f].push({ angle: r.angle, id: r.id }) }) }) const sharedFiles = Object.entries(fileRefs).filter(([_, refs]) => refs.length > 1) // Build synthesis context for task decomposition const synthesisContext = completed.map(r => `[${r.id}: ${r.angle}] ${r.findings}\n Key files: ${r.key_files || 'none'}` ).join('\n\n') const sharedFilesContext = sharedFiles.length > 0 ? `\nShared files (referenced by multiple angles):\n${sharedFiles.map(([f, refs]) => ` ${f} ← ${refs.map(r => r.id).join(', ')}` ).join('\n')}` : '' -
Decompose into Tasksjavascript
Bash({ command: `ccw cli -p "PURPOSE: Based on exploration findings, decompose requirement into 3-10 atomic execution tasks. Each task must include test cases, acceptance criteria, and link to relevant exploration findings.
TASK:
• Use exploration findings to inform task decomposition
• Each task must be self-contained with specific implementation instructions
• Link tasks to exploration rows via context_from (E1, E2, etc.)
• Define dependencies between tasks (T1 must finish before T2, etc.)
• For each task: define test cases, acceptance criteria, scope, hints, and execution directives
• Ensure same-wave tasks have non-overlapping scopes
MODE: analysis
CONTEXT: @**/*
EXPECTED: JSON object with tasks array. Each task: {id: string, title: string, description: string, test: string, acceptance_criteria: string, scope: string, hints: string, execution_directives: string, deps: string[], context_from: string[]}.
- id: T1, T2, etc.
- description: what to implement (specific enough for an agent)
- test: what tests to write (e.g. 'Unit test: X returns Y')
- acceptance_criteria: what defines done (e.g. 'API returns 200')
- scope: target glob (e.g. 'src/auth/**') — non-overlapping within same wave
- hints: tips + ref files (format: 'tips || file1;file2')
- execution_directives: verification commands (e.g. 'npm test --bail')
- deps: task IDs that must complete first (T*)
- context_from: explore (E*) and task (T*) IDs whose findings are needed CONSTRAINTS: 3-10 tasks | Atomic | No circular deps | Concrete test/acceptance_criteria | Non-overlapping scopes per wave
EXPLORATION FINDINGS:
${synthesisContext}
${sharedFilesContext}
REQUIREMENT: ${requirement}" --tool gemini --mode analysis --rule planning-breakdown-task-steps`,
run_in_background: true
})
// Wait for CLI completion → decomposedTasks[]
3. **Compute Waves & Write tasks.csv**
```javascript
const { waveAssignment, maxWave } = computeWaves(decomposedTasks)
const header = 'id,title,description,test,acceptance_criteria,scope,hints,execution_directives,deps,context_from,wave,status,findings,files_modified,tests_passed,acceptance_met,error'
const rows = decomposedTasks.map(task => {
const wave = waveAssignment.get(task.id)
return [
task.id,
csvEscape(task.title),
csvEscape(task.description),
csvEscape(task.test),
csvEscape(task.acceptance_criteria),
csvEscape(task.scope),
csvEscape(task.hints),
csvEscape(task.execution_directives),
task.deps.join(';'),
task.context_from.join(';'),
wave,
'pending', '', '', '', '', ''
].map(cell => `"${String(cell).replace(/"/g, '""')}"`).join(',')
})
Write(`${sessionFolder}/tasks.csv`, [header, ...rows].join('\n'))-
User Validation (skip if AUTO_YES)javascript
if (!AUTO_YES) { console.log(`
目标: 读取探索发现结果,交叉校验,解决冲突,生成带关联E*行的tasks.csv。
context_from步骤:
-
整合探索发现结果javascript
const exploreCSV = parseCsv(Read(`${sessionFolder}/explore.csv`)) const completed = exploreCSV.filter(r => r.status === 'completed') // Cross-reference: find shared files across angles const fileRefs = {} completed.forEach(r => { (r.key_files || '').split(';').filter(Boolean).forEach(f => { if (!fileRefs[f]) fileRefs[f] = [] fileRefs[f].push({ angle: r.angle, id: r.id }) }) }) const sharedFiles = Object.entries(fileRefs).filter(([_, refs]) => refs.length > 1) // Build synthesis context for task decomposition const synthesisContext = completed.map(r => `[${r.id}: ${r.angle}] ${r.findings}\n Key files: ${r.key_files || 'none'}` ).join('\n\n') const sharedFilesContext = sharedFiles.length > 0 ? `\nShared files (referenced by multiple angles):\n${sharedFiles.map(([f, refs]) => ` ${f} ← ${refs.map(r => r.id).join(', ')}` ).join('\n')}` : '' -
拆解为执行任务javascript
Bash({ command: `ccw cli -p "PURPOSE: Based on exploration findings, decompose requirement into 3-10 atomic execution tasks. Each task must include test cases, acceptance criteria, and link to relevant exploration findings.
TASK:
• Use exploration findings to inform task decomposition
• Each task must be self-contained with specific implementation instructions
• Link tasks to exploration rows via context_from (E1, E2, etc.)
• Define dependencies between tasks (T1 must finish before T2, etc.)
• For each task: define test cases, acceptance criteria, scope, hints, and execution directives
• Ensure same-wave tasks have non-overlapping scopes
MODE: analysis
CONTEXT: @**/*
EXPECTED: JSON object with tasks array. Each task: {id: string, title: string, description: string, test: string, acceptance_criteria: string, scope: string, hints: string, execution_directives: string, deps: string[], context_from: string[]}.
- id: T1, T2, etc.
- description: what to implement (specific enough for an agent)
- test: what tests to write (e.g. 'Unit test: X returns Y')
- acceptance_criteria: what defines done (e.g. 'API returns 200')
- scope: target glob (e.g. 'src/auth/**') — non-overlapping within same wave
- hints: tips + ref files (format: 'tips || file1;file2')
- execution_directives: verification commands (e.g. 'npm test --bail')
- deps: task IDs that must complete first (T*)
- context_from: explore (E*) and task (T*) IDs whose findings are needed CONSTRAINTS: 3-10 tasks | Atomic | No circular deps | Concrete test/acceptance_criteria | Non-overlapping scopes per wave
EXPLORATION FINDINGS:
${synthesisContext}
${sharedFilesContext}
REQUIREMENT: ${requirement}" --tool gemini --mode analysis --rule planning-breakdown-task-steps`,
run_in_background: true
})
// Wait for CLI completion → decomposedTasks[]
3. **计算轮次并写入tasks.csv**
```javascript
const { waveAssignment, maxWave } = computeWaves(decomposedTasks)
const header = 'id,title,description,test,acceptance_criteria,scope,hints,execution_directives,deps,context_from,wave,status,findings,files_modified,tests_passed,acceptance_met,error'
const rows = decomposedTasks.map(task => {
const wave = waveAssignment.get(task.id)
return [
task.id,
csvEscape(task.title),
csvEscape(task.description),
csvEscape(task.test),
csvEscape(task.acceptance_criteria),
csvEscape(task.scope),
csvEscape(task.hints),
csvEscape(task.execution_directives),
task.deps.join(';'),
task.context_from.join(';'),
wave,
'pending', '', '', '', '', ''
].map(cell => `"${String(cell).replace(/"/g, '""')}"`).join(',')
})
Write(`${sessionFolder}/tasks.csv`, [header, ...rows].join('\n'))-
用户校验(AUTO_YES模式下跳过)javascript
if (!AUTO_YES) { console.log(`
Execution Plan
Execution Plan
Explore: ${completed.length} angles completed
Shared files: ${sharedFiles.length}
Tasks: ${decomposedTasks.length} across ${maxWave} waves
${Array.from({length: maxWave}, (_, i) => i + 1).map(w => {
const wt = decomposedTasks.filter(t => waveAssignment.get(t.id) === w)
return - [${t.id}] ${t.title} (scope: ${t.scope}, from: ${t.context_from.join(';')})
}).join('\n')}
`)
### Wave ${w} (${wt.length} tasks, concurrent) ${wt.map(t => ).join('\n')} const answer = AskUserQuestion({
questions: [{
question: `Proceed with ${decomposedTasks.length} tasks across ${maxWave} waves?`,
header: "Confirm",
multiSelect: false,
options: [
{ label: "Execute", description: "Proceed with wave execution" },
{ label: "Modify", description: `Edit ${sessionFolder}/tasks.csv then --continue` },
{ label: "Cancel", description: "Abort" }
]
}]
})
if (answer.Confirm === "Modify") {
console.log(`Edit: ${sessionFolder}/tasks.csv\nResume: $workflow-lite-plan --continue`)
return
} else if (answer.Confirm === "Cancel") {
return
}}
**Success Criteria**:
- tasks.csv created with context_from linking to E* rows
- No circular dependencies
- User approved (or AUTO_YES)
---Explore: ${completed.length} angles completed
Shared files: ${sharedFiles.length}
Tasks: ${decomposedTasks.length} across ${maxWave} waves
${Array.from({length: maxWave}, (_, i) => i + 1).map(w => {
const wt = decomposedTasks.filter(t => waveAssignment.get(t.id) === w)
return - [${t.id}] ${t.title} (scope: ${t.scope}, from: ${t.context_from.join(';')})
}).join('\n')}
`)
### Wave ${w} (${wt.length} tasks, concurrent) ${wt.map(t => ).join('\n')} const answer = AskUserQuestion({
questions: [{
question: `Proceed with ${decomposedTasks.length} tasks across ${maxWave} waves?`,
header: "Confirm",
multiSelect: false,
options: [
{ label: "Execute", description: "Proceed with wave execution" },
{ label: "Modify", description: `Edit ${sessionFolder}/tasks.csv then --continue` },
{ label: "Cancel", description: "Abort" }
]
}]
})
if (answer.Confirm === "Modify") {
console.log(`Edit: ${sessionFolder}/tasks.csv\nResume: $workflow-lite-plan --continue`)
return
} else if (answer.Confirm === "Cancel") {
return
}}
**成功条件**:
- 生成的tasks.csv包含关联E*行的context_from字段
- 无循环依赖
- 用户确认通过(或AUTO_YES模式)
---Phase 4: Wave Execute (spawn_agents_on_csv)
第4阶段:波浪式执行(spawn_agents_on_csv)
Objective: Execute tasks wave-by-wave via . Each wave's prev_context is built from both explore.csv and tasks.csv.
spawn_agents_on_csvSteps:
-
Wave Loopjavascript
const exploreCSV = parseCsv(Read(`${sessionFolder}/explore.csv`)) const failedIds = new Set() const skippedIds = new Set() for (let wave = 1; wave <= maxWave; wave++) { console.log(`\n## Wave ${wave}/${maxWave}\n`) // Re-read master CSV const masterCsv = parseCsv(Read(`${sessionFolder}/tasks.csv`)) const waveTasks = masterCsv.filter(row => parseInt(row.wave) === wave) // Skip tasks whose deps failed const executableTasks = [] for (const task of waveTasks) { const deps = (task.deps || '').split(';').filter(Boolean) if (deps.some(d => failedIds.has(d) || skippedIds.has(d))) { skippedIds.add(task.id) updateMasterCsvRow(`${sessionFolder}/tasks.csv`, task.id, { status: 'skipped', error: 'Dependency failed or skipped' }) console.log(` [${task.id}] ${task.title} → SKIPPED (dependency failed)`) continue } executableTasks.push(task) } if (executableTasks.length === 0) { console.log(` No executable tasks in wave ${wave}`) continue } // Build prev_context for each task (cross-phase: E* + T*) for (const task of executableTasks) { task.prev_context = buildPrevContext(task.context_from, exploreCSV, masterCsv) } // Write wave CSV const waveHeader = 'id,title,description,test,acceptance_criteria,scope,hints,execution_directives,deps,context_from,wave,prev_context' const waveRows = executableTasks.map(t => [t.id, t.title, t.description, t.test, t.acceptance_criteria, t.scope, t.hints, t.execution_directives, t.deps, t.context_from, t.wave, t.prev_context] .map(cell => `"${String(cell).replace(/"/g, '""')}"`) .join(',') ) Write(`${sessionFolder}/task-wave-${wave}.csv`, [waveHeader, ...waveRows].join('\n')) // Execute wave console.log(` Executing ${executableTasks.length} tasks (concurrency: ${maxConcurrency})...`) spawn_agents_on_csv({ csv_path: `${sessionFolder}/task-wave-${wave}.csv`, id_column: "id", instruction: buildExecuteInstruction(sessionFolder, wave), max_concurrency: maxConcurrency, max_runtime_seconds: 600, output_csv_path: `${sessionFolder}/task-wave-${wave}-results.csv`, output_schema: { type: "object", properties: { id: { type: "string" }, status: { type: "string", enum: ["completed", "failed"] }, findings: { type: "string" }, files_modified: { type: "array", items: { type: "string" } }, tests_passed: { type: "boolean" }, acceptance_met: { type: "string" }, error: { type: "string" } }, required: ["id", "status", "findings", "tests_passed"] } }) // Merge results into master CSV const waveResults = parseCsv(Read(`${sessionFolder}/task-wave-${wave}-results.csv`)) for (const result of waveResults) { updateMasterCsvRow(`${sessionFolder}/tasks.csv`, result.id, { status: result.status, findings: result.findings || '', files_modified: Array.isArray(result.files_modified) ? result.files_modified.join(';') : (result.files_modified || ''), tests_passed: String(result.tests_passed ?? ''), acceptance_met: result.acceptance_met || '', error: result.error || '' }) if (result.status === 'failed') { failedIds.add(result.id) console.log(` [${result.id}] → FAILED: ${result.error}`) } else { console.log(` [${result.id}] → COMPLETED${result.tests_passed ? ' ✓tests' : ''}`) } } // Cleanup Bash(`rm -f "${sessionFolder}/task-wave-${wave}.csv" "${sessionFolder}/task-wave-${wave}-results.csv"`) console.log(` Wave ${wave} done: ${waveResults.filter(r => r.status === 'completed').length} completed, ${waveResults.filter(r => r.status === 'failed').length} failed`) } -
prev_context Builder (Cross-Phase)The key function linking exploration context to execution:javascript
function buildPrevContext(contextFrom, exploreCSV, tasksCSV) { if (!contextFrom) return 'No previous context available' const ids = contextFrom.split(';').filter(Boolean) const entries = [] ids.forEach(id => { if (id.startsWith('E')) { // ← Look up in explore.csv (cross-phase link) const row = exploreCSV.find(r => r.id === id) if (row && row.status === 'completed' && row.findings) { entries.push(`[Explore ${row.angle}] ${row.findings}`) if (row.key_files) entries.push(` Key files: ${row.key_files}`) } } else if (id.startsWith('T')) { // ← Look up in tasks.csv (same-phase link) const row = tasksCSV.find(r => r.id === id) if (row && row.status === 'completed' && row.findings) { entries.push(`[Task ${row.id}: ${row.title}] ${row.findings}`) if (row.files_modified) entries.push(` Modified: ${row.files_modified}`) } } }) return entries.length > 0 ? entries.join('\n') : 'No previous context available' } -
Execute Instruction Templatejavascript
function buildExecuteInstruction(sessionFolder, wave) { return `
目标: 通过逐轮执行任务,每轮的prev_context由explore.csv和tasks.csv共同构建。
spawn_agents_on_csv步骤:
-
轮次循环javascript
const exploreCSV = parseCsv(Read(`${sessionFolder}/explore.csv`)) const failedIds = new Set() const skippedIds = new Set() for (let wave = 1; wave <= maxWave; wave++) { console.log(`\n## Wave ${wave}/${maxWave}\n`) // Re-read master CSV const masterCsv = parseCsv(Read(`${sessionFolder}/tasks.csv`)) const waveTasks = masterCsv.filter(row => parseInt(row.wave) === wave) // Skip tasks whose deps failed const executableTasks = [] for (const task of waveTasks) { const deps = (task.deps || '').split(';').filter(Boolean) if (deps.some(d => failedIds.has(d) || skippedIds.has(d))) { skippedIds.add(task.id) updateMasterCsvRow(`${sessionFolder}/tasks.csv`, task.id, { status: 'skipped', error: 'Dependency failed or skipped' }) console.log(` [${task.id}] ${task.title} → SKIPPED (dependency failed)`) continue } executableTasks.push(task) } if (executableTasks.length === 0) { console.log(` No executable tasks in wave ${wave}`) continue } // Build prev_context for each task (cross-phase: E* + T*) for (const task of executableTasks) { task.prev_context = buildPrevContext(task.context_from, exploreCSV, masterCsv) } // Write wave CSV const waveHeader = 'id,title,description,test,acceptance_criteria,scope,hints,execution_directives,deps,context_from,wave,prev_context' const waveRows = executableTasks.map(t => [t.id, t.title, t.description, t.test, t.acceptance_criteria, t.scope, t.hints, t.execution_directives, t.deps, t.context_from, t.wave, t.prev_context] .map(cell => `"${String(cell).replace(/"/g, '""')}"`) .join(',') ) Write(`${sessionFolder}/task-wave-${wave}.csv`, [waveHeader, ...waveRows].join('\n')) // Execute wave console.log(` Executing ${executableTasks.length} tasks (concurrency: ${maxConcurrency})...`) spawn_agents_on_csv({ csv_path: `${sessionFolder}/task-wave-${wave}.csv`, id_column: "id", instruction: buildExecuteInstruction(sessionFolder, wave), max_concurrency: maxConcurrency, max_runtime_seconds: 600, output_csv_path: `${sessionFolder}/task-wave-${wave}-results.csv`, output_schema: { type: "object", properties: { id: { type: "string" }, status: { type: "string", enum: ["completed", "failed"] }, findings: { type: "string" }, files_modified: { type: "array", items: { type: "string" } }, tests_passed: { type: "boolean" }, acceptance_met: { type: "string" }, error: { type: "string" } }, required: ["id", "status", "findings", "tests_passed"] } }) // Merge results into master CSV const waveResults = parseCsv(Read(`${sessionFolder}/task-wave-${wave}-results.csv`)) for (const result of waveResults) { updateMasterCsvRow(`${sessionFolder}/tasks.csv`, result.id, { status: result.status, findings: result.findings || '', files_modified: Array.isArray(result.files_modified) ? result.files_modified.join(';') : (result.files_modified || ''), tests_passed: String(result.tests_passed ?? ''), acceptance_met: result.acceptance_met || '', error: result.error || '' }) if (result.status === 'failed') { failedIds.add(result.id) console.log(` [${result.id}] → FAILED: ${result.error}`) } else { console.log(` [${result.id}] → COMPLETED${result.tests_passed ? ' ✓tests' : ''}`) } } // Cleanup Bash(`rm -f "${sessionFolder}/task-wave-${wave}.csv" "${sessionFolder}/task-wave-${wave}-results.csv"`) console.log(` Wave ${wave} done: ${waveResults.filter(r => r.status === 'completed').length} completed, ${waveResults.filter(r => r.status === 'failed').length} failed`) } -
prev_context构建器(跨阶段)
这是关联探索上下文与执行的核心函数:
javascript
function buildPrevContext(contextFrom, exploreCSV, tasksCSV) {
if (!contextFrom) return 'No previous context available'
const ids = contextFrom.split(';').filter(Boolean)
const entries = []
ids.forEach(id => {
if (id.startsWith('E')) {
// ← Look up in explore.csv (cross-phase link)
const row = exploreCSV.find(r => r.id === id)
if (row && row.status === 'completed' && row.findings) {
entries.push(`[Explore ${row.angle}] ${row.findings}`)
if (row.key_files) entries.push(` Key files: ${row.key_files}`)
}
} else if (id.startsWith('T')) {
// ← Look up in tasks.csv (same-phase link)
const row = tasksCSV.find(r => r.id === id)
if (row && row.status === 'completed' && row.findings) {
entries.push(`[Task ${row.id}: ${row.title}] ${row.findings}`)
if (row.files_modified) entries.push(` Modified: ${row.files_modified}`)
}
}
})
return entries.length > 0 ? entries.join('\n') : 'No previous context available'
}-
执行指令模板javascript
function buildExecuteInstruction(sessionFolder, wave) { return `
TASK ASSIGNMENT
TASK ASSIGNMENT
MANDATORY FIRST STEPS
MANDATORY FIRST STEPS
- Read shared discoveries: ${sessionFolder}/discoveries.ndjson (if exists, skip if not)
- Read project context: .workflow/project-tech.json (if exists)
- Read shared discoveries: ${sessionFolder}/discoveries.ndjson (if exists, skip if not)
- Read project context: .workflow/project-tech.json (if exists)
Your Task
Your Task
Task ID: {id}
Title: {title}
Description: {description}
Scope: {scope}
Task ID: {id}
Title: {title}
Description: {description}
Scope: {scope}
Implementation Hints & Reference Files
Implementation Hints & Reference Files
{hints}
Format: `tips text || file1;file2`. Read ALL reference files (after ||) before starting. Apply tips (before ||) as guidance.
{hints}
Format: `tips text || file1;file2`. Read ALL reference files (after ||) before starting. Apply tips (before ||) as guidance.
Execution Directives
Execution Directives
{execution_directives}
Commands to run for verification, tool restrictions, or environment requirements.
{execution_directives}
Commands to run for verification, tool restrictions, or environment requirements.
Test Cases
Test Cases
{test}
{test}
Acceptance Criteria
Acceptance Criteria
{acceptance_criteria}
{acceptance_criteria}
Previous Context (from exploration and predecessor tasks)
Previous Context (from exploration and predecessor tasks)
{prev_context}
{prev_context}
Execution Protocol
Execution Protocol
- Read references: Parse {hints} — read all files listed after `||` to understand existing patterns
- Read discoveries: Load ${sessionFolder}/discoveries.ndjson for shared exploration findings
- Use context: Apply previous tasks' findings from prev_context above
- Stay in scope: ONLY create/modify files within {scope} — do NOT touch files outside this boundary
- Apply hints: Follow implementation tips from {hints} (before `||`)
- Execute: Implement the task as described
- Write tests: Implement the test cases defined above
- Run directives: Execute commands from {execution_directives} to verify your work
- Verify acceptance: Ensure all acceptance criteria are met before reporting completion
- Share discoveries: Append exploration findings to shared board: ```bash echo '{"ts":"<ISO8601>","worker":"{id}","type":"<type>","data":{...}}' >> ${sessionFolder}/discoveries.ndjson ```
- Report result: Return JSON via report_agent_job_result
- Read references: Parse {hints} — read all files listed after `||` to understand existing patterns
- Read discoveries: Load ${sessionFolder}/discoveries.ndjson for shared exploration findings
- Use context: Apply previous tasks' findings from prev_context above
- Stay in scope: ONLY create/modify files within {scope} — do NOT touch files outside this boundary
- Apply hints: Follow implementation tips from {hints} (before `||`)
- Execute: Implement the task as described
- Write tests: Implement the test cases defined above
- Run directives: Execute commands from {execution_directives} to verify your work
- Verify acceptance: Ensure all acceptance criteria are met before reporting completion
- Share discoveries: Append exploration findings to shared board: ```bash echo '{"ts":"<ISO8601>","worker":"{id}","type":"<type>","data":{...}}' >> ${sessionFolder}/discoveries.ndjson ```
- Report result: Return JSON via report_agent_job_result
Discovery Types to Share
Discovery Types to Share
- `code_pattern`: {name, file, description} — reusable patterns found
- `integration_point`: {file, description, exports[]} — module connection points
- `convention`: {naming, imports, formatting} — code style conventions
- `blocker`: {issue, severity, impact} — blocking issues encountered
- `code_pattern`: {name, file, description} — reusable patterns found
- `integration_point`: {file, description, exports[]} — module connection points
- `convention`: {naming, imports, formatting} — code style conventions
- `blocker`: {issue, severity, impact} — blocking issues encountered
Output (report_agent_job_result)
Output (report_agent_job_result)
Return JSON:
{
"id": "{id}",
"status": "completed" | "failed",
"findings": "Key discoveries and implementation notes (max 500 chars)",
"files_modified": ["path1", "path2"],
"tests_passed": true | false,
"acceptance_met": "Summary of which acceptance criteria were met/unmet",
"error": ""
}
IMPORTANT: Set status to "completed" ONLY if:
- All test cases pass
- All acceptance criteria are met
Otherwise set status to "failed" with details in error field.
`
}
undefined
-
Master CSV Update Helperjavascript
function updateMasterCsvRow(csvPath, taskId, updates) { const content = Read(csvPath) const lines = content.split('\n') const header = lines[0].split(',') for (let i = 1; i < lines.length; i++) { const cells = parseCsvLine(lines[i]) if (cells[0] === taskId || cells[0] === `"${taskId}"`) { for (const [col, val] of Object.entries(updates)) { const colIdx = header.indexOf(col) if (colIdx >= 0) { cells[colIdx] = `"${String(val).replace(/"/g, '""')}"` } } lines[i] = cells.join(',') break } } Write(csvPath, lines.join('\n')) }
Success Criteria:
- All waves executed in order
- Each wave's results merged into master CSV before next wave starts
- Dependent tasks skipped when predecessor failed
- discoveries.ndjson accumulated across all phases
Return JSON:
{
"id": "{id}",
"status": "completed" | "failed",
"findings": "Key discoveries and implementation notes (max 500 chars)",
"files_modified": ["path1", "path2"],
"tests_passed": true | false,
"acceptance_met": "Summary of which acceptance criteria were met/unmet",
"error": ""
}
IMPORTANT: Set status to "completed" ONLY if:
- All test cases pass
- All acceptance criteria are met
Otherwise set status to "failed" with details in error field.
`
}
undefined
-
主CSV更新辅助函数javascript
function updateMasterCsvRow(csvPath, taskId, updates) { const content = Read(csvPath) const lines = content.split('\n') const header = lines[0].split(',') for (let i = 1; i < lines.length; i++) { const cells = parseCsvLine(lines[i]) if (cells[0] === taskId || cells[0] === `"${taskId}"`) { for (const [col, val] of Object.entries(updates)) { const colIdx = header.indexOf(col) if (colIdx >= 0) { cells[colIdx] = `"${String(val).replace(/"/g, '""')}"` } } lines[i] = cells.join(',') break } } Write(csvPath, lines.join('\n')) }
成功条件:
- 所有轮次按顺序执行完毕
- 每轮执行结果在进入下一轮前合并到主CSV
- 前置任务失败时自动跳过依赖任务
- discoveries.ndjson累计所有阶段的发现内容
Phase 5: Results Aggregation
第5阶段:结果聚合
Objective: Generate final results and human-readable report.
Steps:
-
Export results.csvjavascript
const masterCsv = Read(`${sessionFolder}/tasks.csv`) Write(`${sessionFolder}/results.csv`, masterCsv) -
Generate context.mdjavascript
const finalTasks = parseCsv(masterCsv) const exploreCSV = parseCsv(Read(`${sessionFolder}/explore.csv`)) const completed = finalTasks.filter(t => t.status === 'completed') const failed = finalTasks.filter(t => t.status === 'failed') const skipped = finalTasks.filter(t => t.status === 'skipped') const contextContent = `# Lite Planex Execution Report
Session: ${sessionId}
Requirement: ${requirement}
Completed: ${getUtc8ISOString()}
Waves: ${maxWave} | Concurrency: ${maxConcurrency}
目标: 生成最终结果与可读报告。
步骤:
-
导出results.csvjavascript
const masterCsv = Read(`${sessionFolder}/tasks.csv`) Write(`${sessionFolder}/results.csv`, masterCsv) -
生成context.mdjavascript
const finalTasks = parseCsv(masterCsv) const exploreCSV = parseCsv(Read(`${sessionFolder}/explore.csv`)) const completed = finalTasks.filter(t => t.status === 'completed') const failed = finalTasks.filter(t => t.status === 'failed') const skipped = finalTasks.filter(t => t.status === 'skipped') const contextContent = `# Lite Planex Execution Report
Session: ${sessionId}
Requirement: ${requirement}
Completed: ${getUtc8ISOString()}
Waves: ${maxWave} | Concurrency: ${maxConcurrency}
Summary
Summary
| Metric | Count |
|---|---|
| Explore Angles | ${exploreCSV.length} |
| Total Tasks | ${finalTasks.length} |
| Completed | ${completed.length} |
| Failed | ${failed.length} |
| Skipped | ${skipped.length} |
| Waves | ${maxWave} |
| Metric | Count |
|---|---|
| Explore Angles | ${exploreCSV.length} |
| Total Tasks | ${finalTasks.length} |
| Completed | ${completed.length} |
| Failed | ${failed.length} |
| Skipped | ${skipped.length} |
| Waves | ${maxWave} |
Exploration Results
Exploration Results
${exploreCSV.map(e => ).join('\n\n')}
### ${e.id}: ${e.angle} (${e.status}) ${e.findings || 'N/A'} Key files: ${e.key_files || 'none'}${exploreCSV.map(e => ).join('\n\n')}
### ${e.id}: ${e.angle} (${e.status}) ${e.findings || 'N/A'} Key files: ${e.key_files || 'none'}Task Results
Task Results
${finalTasks.map(t => `### ${t.id}: ${t.title} (${t.status})
| Field | Value |
|---|---|
| Wave | ${t.wave} |
| Scope | ${t.scope |
| Dependencies | ${t.deps |
| Context From | ${t.context_from |
| Tests Passed | ${t.tests_passed |
| Acceptance Met | ${t.acceptance_met |
| Error | ${t.error |
Description: ${t.description}
Test Cases: ${t.test || 'N/A'}
Acceptance Criteria: ${t.acceptance_criteria || 'N/A'}
Hints: ${t.hints || 'N/A'}
Execution Directives: ${t.execution_directives || 'N/A'}
Findings: ${t.findings || 'N/A'}
Files Modified: ${t.files_modified || 'none'}`).join('\n\n---\n\n')}
${finalTasks.map(t => `### ${t.id}: ${t.title} (${t.status})
| Field | Value |
|---|---|
| Wave | ${t.wave} |
| Scope | ${t.scope |
| Dependencies | ${t.deps |
| Context From | ${t.context_from |
| Tests Passed | ${t.tests_passed |
| Acceptance Met | ${t.acceptance_met |
| Error | ${t.error |
Description: ${t.description}
Test Cases: ${t.test || 'N/A'}
Acceptance Criteria: ${t.acceptance_criteria || 'N/A'}
Hints: ${t.hints || 'N/A'}
Execution Directives: ${t.execution_directives || 'N/A'}
Findings: ${t.findings || 'N/A'}
Files Modified: ${t.files_modified || 'none'}`).join('\n\n---\n\n')}
All Modified Files
All Modified Files
${[...new Set(finalTasks.flatMap(t => (t.files_modified || '').split(';')).filter(Boolean))].map(f => '- ' + f).join('\n') || 'None'}
`
Write(, contextContent)
${sessionFolder}/context.md
3. **Display Summary**
```javascript
console.log(`${[...new Set(finalTasks.flatMap(t => (t.files_modified || '').split(';')).filter(Boolean))].map(f => '- ' + f).join('\n') || 'None'}
`
Write(, contextContent)
${sessionFolder}/context.md
3. **展示总结**
```javascript
console.log(`Lite Planex Complete
Lite Planex Complete
- Session: ${sessionId}
- Explore: ${exploreCSV.filter(r => r.status === 'completed').length}/${exploreCSV.length} angles
- Tasks: ${completed.length}/${finalTasks.length} completed, ${failed.length} failed, ${skipped.length} skipped
- Waves: ${maxWave}
Results: ${sessionFolder}/results.csv
Report: ${sessionFolder}/context.md
Discoveries: ${sessionFolder}/discoveries.ndjson
`)
4. **Offer Next Steps** (skip if AUTO_YES)
```javascript
if (!AUTO_YES && failed.length > 0) {
const answer = AskUserQuestion({
questions: [{
question: `${failed.length} tasks failed. Next action?`,
header: "Next Step",
multiSelect: false,
options: [
{ label: "Retry Failed", description: `Re-execute ${failed.length} failed tasks with updated context` },
{ label: "View Report", description: "Display context.md" },
{ label: "Done", description: "Complete session" }
]
}]
})
if (answer['Next Step'] === "Retry Failed") {
for (const task of failed) {
updateMasterCsvRow(`${sessionFolder}/tasks.csv`, task.id, { status: 'pending', error: '' })
}
for (const task of skipped) {
updateMasterCsvRow(`${sessionFolder}/tasks.csv`, task.id, { status: 'pending', error: '' })
}
// Re-execute Phase 4
} else if (answer['Next Step'] === "View Report") {
console.log(Read(`${sessionFolder}/context.md`))
}
}Success Criteria:
- results.csv exported
- context.md generated with full field coverage
- Summary displayed to user
- Session: ${sessionId}
- Explore: ${exploreCSV.filter(r => r.status === 'completed').length}/${exploreCSV.length} angles
- Tasks: ${completed.length}/${finalTasks.length} completed, ${failed.length} failed, ${skipped.length} skipped
- Waves: ${maxWave}
Results: ${sessionFolder}/results.csv
Report: ${sessionFolder}/context.md
Discoveries: ${sessionFolder}/discoveries.ndjson
`)
4. **提供后续操作选项**(AUTO_YES模式下跳过)
```javascript
if (!AUTO_YES && failed.length > 0) {
const answer = AskUserQuestion({
questions: [{
question: `${failed.length} tasks failed. Next action?`,
header: "Next Step",
multiSelect: false,
options: [
{ label: "Retry Failed", description: `Re-execute ${failed.length} failed tasks with updated context` },
{ label: "View Report", description: "Display context.md" },
{ label: "Done", description: "Complete session" }
]
}]
})
if (answer['Next Step'] === "Retry Failed") {
for (const task of failed) {
updateMasterCsvRow(`${sessionFolder}/tasks.csv`, task.id, { status: 'pending', error: '' })
}
for (const task of skipped) {
updateMasterCsvRow(`${sessionFolder}/tasks.csv`, task.id, { status: 'pending', error: '' })
}
// Re-execute Phase 4
} else if (answer['Next Step'] === "View Report") {
console.log(Read(`${sessionFolder}/context.md`))
}
}成功条件:
- results.csv导出完成
- 包含所有字段的context.md生成完成
- 总结信息已展示给用户
Wave Computation (Kahn's BFS)
轮次计算(Kahn's BFS算法)
javascript
function computeWaves(tasks) {
const taskMap = new Map(tasks.map(t => [t.id, t]))
const inDegree = new Map(tasks.map(t => [t.id, 0]))
const adjList = new Map(tasks.map(t => [t.id, []]))
for (const task of tasks) {
for (const dep of task.deps) {
if (taskMap.has(dep)) {
adjList.get(dep).push(task.id)
inDegree.set(task.id, inDegree.get(task.id) + 1)
}
}
}
const queue = []
const waveAssignment = new Map()
for (const [id, deg] of inDegree) {
if (deg === 0) {
queue.push([id, 1])
waveAssignment.set(id, 1)
}
}
let maxWave = 1
let idx = 0
while (idx < queue.length) {
const [current, depth] = queue[idx++]
for (const next of adjList.get(current)) {
const newDeg = inDegree.get(next) - 1
inDegree.set(next, newDeg)
const nextDepth = Math.max(waveAssignment.get(next) || 0, depth + 1)
waveAssignment.set(next, nextDepth)
if (newDeg === 0) {
queue.push([next, nextDepth])
maxWave = Math.max(maxWave, nextDepth)
}
}
}
for (const task of tasks) {
if (!waveAssignment.has(task.id)) {
throw new Error(`Circular dependency detected involving task ${task.id}`)
}
}
return { waveAssignment, maxWave }
}javascript
function computeWaves(tasks) {
const taskMap = new Map(tasks.map(t => [t.id, t]))
const inDegree = new Map(tasks.map(t => [t.id, 0]))
const adjList = new Map(tasks.map(t => [t.id, []]))
for (const task of tasks) {
for (const dep of task.deps) {
if (taskMap.has(dep)) {
adjList.get(dep).push(task.id)
inDegree.set(task.id, inDegree.get(task.id) + 1)
}
}
}
const queue = []
const waveAssignment = new Map()
for (const [id, deg] of inDegree) {
if (deg === 0) {
queue.push([id, 1])
waveAssignment.set(id, 1)
}
}
let maxWave = 1
let idx = 0
while (idx < queue.length) {
const [current, depth] = queue[idx++]
for (const next of adjList.get(current)) {
const newDeg = inDegree.get(next) - 1
inDegree.set(next, newDeg)
const nextDepth = Math.max(waveAssignment.get(next) || 0, depth + 1)
waveAssignment.set(next, nextDepth)
if (newDeg === 0) {
queue.push([next, nextDepth])
maxWave = Math.max(maxWave, nextDepth)
}
}
}
for (const task of tasks) {
if (!waveAssignment.has(task.id)) {
throw new Error(`Circular dependency detected involving task ${task.id}`)
}
}
return { waveAssignment, maxWave }
}Shared Discovery Board Protocol
共享发现看板协议
All agents across all phases share . This eliminates redundant codebase exploration.
discoveries.ndjsonjsonl
{"ts":"2026-02-28T10:00:00+08:00","worker":"E1","type":"code_pattern","data":{"name":"repository-pattern","file":"src/repos/Base.ts","description":"Abstract CRUD repository"}}
{"ts":"2026-02-28T10:01:00+08:00","worker":"T2","type":"integration_point","data":{"file":"src/auth/index.ts","description":"Auth module entry","exports":["authenticate","authorize"]}}Types: , , , , ,
Rules: Read first → write immediately → deduplicate → append-only
code_patternintegration_pointconventionblockertech_stacktest_command所有阶段的所有Agent共享,可避免重复的代码库探索。
discoveries.ndjsonjsonl
{"ts":"2026-02-28T10:00:00+08:00","worker":"E1","type":"code_pattern","data":{"name":"repository-pattern","file":"src/repos/Base.ts","description":"Abstract CRUD repository"}}
{"ts":"2026-02-28T10:01:00+08:00","worker":"T2","type":"integration_point","data":{"file":"src/auth/index.ts","description":"Auth module entry","exports":["authenticate","authorize"]}}支持类型: , , , , ,
使用规则: 先读取 → 立即写入 → 自动去重 → 仅追加写入
code_patternintegration_pointconventionblockertech_stacktest_commandError Handling
错误处理
| Error | Resolution |
|---|---|
| Explore agent failure | Mark as failed in explore.csv, exclude from planning |
| All explores failed | Fallback: plan directly from requirement without exploration |
| Circular dependency | Abort wave computation, report cycle |
| Execute agent timeout | Mark as failed in results, continue with wave |
| Execute agent failed | Mark as failed, skip dependent tasks in later waves |
| CSV parse error | Validate CSV format before execution, show line number |
| discoveries.ndjson corrupt | Ignore malformed lines, continue with valid entries |
| Continue mode: no session | List available sessions, prompt user to select |
| 错误场景 | 解决方式 |
|---|---|
| 探索Agent执行失败 | 在explore.csv中标记为失败,规划阶段排除该结果 |
| 所有探索任务均失败 | 降级方案:跳过探索,直接基于需求生成规划 |
| 循环依赖 | 终止轮次计算,报告循环链路 |
| 执行Agent超时 | 在结果中标记为失败,继续执行当前轮次其他任务 |
| 执行Agent失败 | 标记为失败,后续轮次跳过依赖该任务的所有任务 |
| CSV解析错误 | 执行前校验CSV格式,展示错误行号 |
| discoveries.ndjson损坏 | 忽略格式错误的行,继续使用有效条目 |
| 恢复模式下无匹配会话 | 列出可用会话,提示用户选择 |
Core Rules
核心规则
- Explore Before Execute: Phase 2 completes before Phase 4 starts
- Wave Order is Sacred: Never execute wave N before wave N-1 completes and results are merged
- CSV is Source of Truth: Master CSVs hold all state — always read before wave, always write after
- Cross-Phase Context: prev_context built from both explore.csv (E*) and tasks.csv (T*), not from memory
- E ↔ T Linking**: tasks.csv references explore.csv rows for cross-phase context
context_from - Discovery Board is Append-Only: Never clear, modify, or recreate discoveries.ndjson
- Skip on Failure: If a dependency failed, skip the dependent task (cascade)
- Cleanup Temp Files: Remove wave CSVs after results are merged
- DO NOT STOP: Continuous execution until all waves complete or all remaining tasks are skipped
- 先探索后执行: 第2阶段全部完成后才会启动第4阶段
- 严格遵守轮次顺序: 前一轮执行完成且结果合并前,绝不执行后一轮任务
- CSV是唯一可信数据源: 主CSV存储所有状态,每轮执行前必须读取,执行后必须写入
- 跨阶段上下文: prev_context从explore.csv(E*)和tasks.csv(T*)构建,不从内存读取
- E ↔ T关联**: tasks.csv的字段引用explore.csv行实现跨阶段上下文传递
context_from - 发现看板仅追加: 绝不清除、修改或重建discoveries.ndjson
- 失败自动级联跳过: 依赖任务失败时,自动跳过所有下游依赖任务
- 临时文件自动清理: 结果合并后自动删除轮次临时CSV文件
- 执行不中断: 持续执行直到所有轮次完成或剩余任务全部被跳过
Best Practices
最佳实践
- Exploration Angles: 1 for simple, 3-4 for complex; avoid redundant angles
- Context Linking: Link every task to at least one explore row (E*) — exploration was done for a reason
- Task Granularity: 3-10 tasks optimal; too many = overhead, too few = no parallelism
- Minimize Cross-Wave Deps: More tasks in wave 1 = more parallelism
- Specific Descriptions: Agent sees only its CSV row + prev_context — make description self-contained
- Non-Overlapping Scopes: Same-wave tasks must not write to the same files
- Concurrency Tuning: for serial (max context sharing);
-c 1for I/O-bound tasks-c 8
- 探索角度设置: 简单需求1个,复杂需求3-4个,避免冗余角度
- 上下文关联: 每个任务至少关联一个探索行(E*),探索结果应当被充分利用
- 任务粒度: 3-10个任务为最优,任务过多会增加 overhead,过少则无法并行
- 最小化跨轮次依赖: 第1轮任务越多,并行度越高
- 描述尽可能具体: Agent只能看到自己的CSV行 + prev_context,要保证描述独立完整
- 范围不重叠: 同一轮次的任务不能写入相同文件
- 并发数调优: 为串行执行(上下文共享最多);
-c 1适合I/O密集型任务-c 8
Usage Recommendations
使用场景推荐
| Scenario | Recommended Approach |
|---|---|
| Complex feature (unclear architecture) | |
| Simple known-pattern task | |
| Independent parallel tasks | |
| Diamond dependency (A→B,C→D) | |
| Unknown codebase | |
| 场景 | 推荐用法 |
|---|---|
| 复杂功能(架构不清晰) | |
| 简单已知模式的任务 | |
| 独立可并行的任务 | |
| 菱形依赖(A→B,C→D) | |
| 不熟悉的代码库 | |