From 2dcd1637f0b3c85aab7626e7ea24bb214c52625d Mon Sep 17 00:00:00 2001 From: catlog22 Date: Sat, 24 Jan 2026 14:27:58 +0800 Subject: [PATCH] refactor: enhance documentation on Minimum Execution Units and command grouping in CCW --- .claude/commands/ccw-coordinator.md | 253 ++++++++++++++++++++++------ .claude/commands/ccw.md | 131 +++++++++----- 2 files changed, 294 insertions(+), 90 deletions(-) diff --git a/.claude/commands/ccw-coordinator.md b/.claude/commands/ccw-coordinator.md index c1b2b154..6e8f6196 100644 --- a/.claude/commands/ccw-coordinator.md +++ b/.claude/commands/ccw-coordinator.md @@ -11,6 +11,75 @@ Interactive orchestration tool: analyze task → discover commands → recommend **Execution Model**: Pseudocode guidance. Claude intelligently executes each phase based on context. +## Core Concept: Minimum Execution Units (最小执行单元) + +### What is a Minimum Execution Unit? + +**Definition**: A set of commands that must execute together as an atomic group to achieve a meaningful workflow milestone. Splitting these commands breaks the logical flow and creates incomplete states. + +**Why This Matters**: +- **Prevents Incomplete States**: Avoid stopping after task generation without execution +- **User Experience**: User gets complete results, not intermediate artifacts requiring manual follow-up +- **Workflow Integrity**: Maintains logical coherence of multi-step operations + +### Minimum Execution Units + +**Planning + Execution Units** (规划+执行单元): + +| Unit Name | Commands | Purpose | Output | +|-----------|----------|---------|--------| +| **Quick Implementation** | lite-plan → lite-execute | Lightweight plan and immediate execution | Working code | +| **Multi-CLI Planning** | multi-cli-plan → lite-execute | Multi-perspective analysis and execution | Working code | +| **Bug Fix** | lite-fix → lite-execute | Quick bug diagnosis and fix execution | Fixed code | +| **Full Planning + Execution** | plan → execute | Detailed planning and execution | Working code | +| **Verified Planning + Execution** | plan → plan-verify → execute | Planning with verification and execution | Working code | +| **Replanning + Execution** | replan → execute | Update plan and execute changes | Working code | +| **TDD Planning + Execution** | tdd-plan → execute | Test-driven development planning and execution | Working code | +| **Test Generation + Execution** | test-gen → execute | Generate test suite and execute | Generated tests | + +**Testing Units** (测试单元): + +| Unit Name | Commands | Purpose | Output | +|-----------|----------|---------|--------| +| **Test Validation** | test-fix-gen → test-cycle-execute | Generate test tasks and execute test-fix cycle | Tests passed | + +**Review Units** (审查单元): + +| Unit Name | Commands | Purpose | Output | +|-----------|----------|---------|--------| +| **Code Review (Session)** | review-session-cycle → review-fix | Complete review cycle and apply fixes | Fixed code | +| **Code Review (Module)** | review-module-cycle → review-fix | Module review cycle and apply fixes | Fixed code | + +### Command-to-Unit Mapping (命令与最小单元的映射) + +| Command | Can Precede | Atomic Units | +|---------|-----------|--------------| +| lite-plan | lite-execute | Quick Implementation | +| multi-cli-plan | lite-execute | Multi-CLI Planning | +| lite-fix | lite-execute | Bug Fix | +| plan | plan-verify, execute | Full Planning + Execution, Verified Planning + Execution | +| plan-verify | execute | Verified Planning + Execution | +| replan | execute | Replanning + Execution | +| test-gen | execute | Test Generation + Execution | +| tdd-plan | execute | TDD Planning + Execution | +| review-session-cycle | review-fix | Code Review (Session) | +| review-module-cycle | review-fix | Code Review (Module) | +| test-fix-gen | test-cycle-execute | Test Validation | + +### Atomic Group Rules + +1. **Never Split Units**: Coordinator must recommend complete units, not partial chains +2. **Multi-Unit Participation**: Some commands can participate in multiple units (e.g., plan → execute or plan → plan-verify → execute) +3. **User Override**: User can explicitly request partial execution (advanced mode) +4. **Visualization**: Pipeline view shows unit boundaries with `【 】` markers +5. **Validation**: Before execution, verify all unit commands are included + +**Example Pipeline with Units**: +``` +需求 → 【lite-plan → lite-execute】→ 代码 → 【test-fix-gen → test-cycle-execute】→ 测试通过 + └──── Quick Implementation ────┘ └────── Test Validation ──────┘ +``` + ## 3-Phase Workflow ### Phase 1: Analyze Requirements @@ -77,37 +146,71 @@ const commandPorts = { name: 'lite-plan', input: ['requirement'], // 输入端口:需求 output: ['plan'], // 输出端口:计划 - tags: ['planning'] + tags: ['planning'], + atomic_group: 'quick-implementation' // 最小单元:与 lite-execute 绑定 }, 'lite-execute': { name: 'lite-execute', - input: ['plan'], // 输入端口:计划 + input: ['plan', 'multi-cli-plan', 'lite-fix'], // 输入端口:可接受多种规划输出 output: ['code'], // 输出端口:代码 - tags: ['execution'] + tags: ['execution'], + atomic_groups: [ // 可参与多个最小单元 + 'quick-implementation', // lite-plan → lite-execute + 'multi-cli-planning', // multi-cli-plan → lite-execute + 'bug-fix' // lite-fix → lite-execute + ] }, 'plan': { name: 'plan', input: ['requirement'], output: ['detailed-plan'], - tags: ['planning'] + tags: ['planning'], + atomic_groups: [ // 可参与多个最小单元 + 'full-planning-execution', // plan → execute + 'verified-planning-execution' // plan → plan-verify → execute + ] + }, + 'plan-verify': { + name: 'plan-verify', + input: ['detailed-plan'], + output: ['verified-plan'], + tags: ['planning'], + atomic_group: 'verified-planning-execution' // 最小单元:plan → plan-verify → execute + }, + 'replan': { + name: 'replan', + input: ['session', 'feedback'], // 输入端口:会话或反馈 + output: ['replan'], // 输出端口:更新后的计划(供 execute 执行) + tags: ['planning'], + atomic_group: 'replanning-execution' // 最小单元:与 execute 绑定 }, 'execute': { name: 'execute', - input: ['detailed-plan'], // 从 plan 的输出匹配 + input: ['detailed-plan', 'verified-plan', 'replan', 'test-tasks', 'tdd-tasks'], // 可接受多种规划输出 output: ['code'], - tags: ['execution'] + tags: ['execution'], + atomic_groups: [ // 可参与多个最小单元 + 'full-planning-execution', // plan → execute + 'verified-planning-execution', // plan → plan-verify → execute + 'replanning-execution', // replan → execute + 'test-generation-execution', // test-gen → execute + 'tdd-planning-execution' // tdd-plan → execute + ] }, 'test-cycle-execute': { name: 'test-cycle-execute', - input: ['code'], // 输入端口:代码 + input: ['test-tasks'], // 输入端口:测试任务(需先test-fix-gen生成) output: ['test-passed'], // 输出端口:测试通过 - tags: ['testing'] + tags: ['testing'], + atomic_group: 'test-validation', // 最小单元:与 test-fix-gen 绑定 + note: '需要先执行test-fix-gen生成测试任务,再由此命令执行测试周期' }, 'tdd-plan': { name: 'tdd-plan', input: ['requirement'], - output: ['tdd-tasks'], // TDD 任务 - tags: ['planning', 'tdd'] + output: ['tdd-tasks'], // TDD 任务(供 execute 执行) + tags: ['planning', 'tdd'], + atomic_group: 'tdd-planning-execution' // 最小单元:与 execute 绑定 }, 'execute': { name: 'execute', @@ -124,8 +227,9 @@ const commandPorts = { 'lite-fix': { name: 'lite-fix', input: ['bug-report'], // 输入端口:bug 报告 - output: ['fixed-code'], // 输出端口:修复后的代码 - tags: ['bugfix'] + output: ['lite-fix'], // 输出端口:修复计划(供 lite-execute 执行) + tags: ['bugfix'], + atomic_group: 'bug-fix' // 最小单元:与 lite-execute 绑定 }, 'debug': { name: 'debug', @@ -136,14 +240,17 @@ const commandPorts = { 'test-gen': { name: 'test-gen', input: ['code', 'session'], // 可接受代码或会话 - output: ['tests'], - tags: ['testing'] + output: ['test-tasks'], // 输出测试任务(IMPL-001,IMPL-002),供 execute 执行 + tags: ['testing'], + atomic_group: 'test-generation-execution' // 最小单元:与 execute 绑定 }, 'test-fix-gen': { name: 'test-fix-gen', input: ['failing-tests', 'session'], - output: ['test-tasks'], - tags: ['testing'] + output: ['test-tasks'], // 输出测试任务,针对特定问题生成测试并在测试中修正 + tags: ['testing'], + atomic_group: 'test-validation', // 最小单元:与 test-cycle-execute 绑定 + note: '生成测试任务供test-cycle-execute执行' }, 'review': { name: 'review', @@ -153,9 +260,10 @@ const commandPorts = { }, 'review-fix': { name: 'review-fix', - input: ['review-findings'], + input: ['review-findings', 'review-verified'], // Accept output from review-session-cycle or review-module-cycle output: ['fixed-code'], - tags: ['review'] + tags: ['review'], + atomic_group: 'code-review' // 最小单元:与 review-session-cycle/review-module-cycle 绑定 }, 'brainstorm:auto-parallel': { name: 'brainstorm:auto-parallel', @@ -166,8 +274,9 @@ const commandPorts = { 'multi-cli-plan': { name: 'multi-cli-plan', input: ['requirement'], - output: ['comparison-plan'], // 对比分析计划 - tags: ['planning', 'multi-cli'] + output: ['multi-cli-plan'], // 对比分析计划(供 lite-execute 执行) + tags: ['planning', 'multi-cli'], + atomic_group: 'multi-cli-planning' // 最小单元:与 lite-execute 绑定 }, 'plan-verify': { name: 'plan-verify', @@ -179,13 +288,15 @@ const commandPorts = { name: 'review-session-cycle', input: ['code', 'session'], // 可接受代码或会话 output: ['review-verified'], // 输出端口:审查通过 - tags: ['review'] + tags: ['review'], + atomic_group: 'code-review' // 最小单元:与 review-fix 绑定 }, 'review-module-cycle': { name: 'review-module-cycle', input: ['module-pattern'], // 输入端口:模块模式 output: ['review-verified'], // 输出端口:审查通过 - tags: ['review'] + tags: ['review'], + atomic_group: 'code-review' // 最小单元:与 review-fix 绑定 } }; ``` @@ -639,13 +750,17 @@ Complexity: simple Constraints: [] Task Type: feature -Pipeline: -需求 → lite-plan → 计划 → lite-execute → 代码 → test-cycle-execute → 测试通过 +Pipeline (with Minimum Execution Units): +需求 →【lite-plan → lite-execute】→ 代码 →【test-fix-gen → test-cycle-execute】→ 测试通过 Chain: +# Unit 1: Quick Implementation 1. /workflow:lite-plan --yes "Add API endpoint..." 2. /workflow:lite-execute --yes --in-memory -3. /workflow:test-cycle-execute --yes --session="WFS-xxx" + +# Unit 2: Test Validation +3. /workflow:test-fix-gen --yes --session="WFS-xxx" +4. /workflow:test-cycle-execute --yes --session="WFS-test-xxx" ``` ### Complex Feature with Verification @@ -656,16 +771,26 @@ Complexity: complex Constraints: [no breaking changes] Task Type: feature -Pipeline: -需求 → plan → 详细计划 → plan-verify → 验证计划 → execute → 代码 - → review-session-cycle → 审查通过 → test-cycle-execute → 测试通过 +Pipeline (with Minimum Execution Units): +需求 →【plan → plan-verify】→ 验证计划 → execute → 代码 + →【review-session-cycle → review-fix】→ 修复代码 + →【test-fix-gen → test-cycle-execute】→ 测试通过 Chain: +# Unit 1: Full Planning (plan + plan-verify) 1. /workflow:plan --yes "Implement OAuth2..." 2. /workflow:plan-verify --yes --session="WFS-xxx" + +# Execution phase 3. /workflow:execute --yes --resume-session="WFS-xxx" + +# Unit 2: Code Review (review-session-cycle + review-fix) 4. /workflow:review-session-cycle --yes --session="WFS-xxx" -5. /workflow:test-cycle-execute --yes --session="WFS-xxx" +5. /workflow:review-fix --yes --session="WFS-xxx" + +# Unit 3: Test Validation (test-fix-gen + test-cycle-execute) +6. /workflow:test-fix-gen --yes --session="WFS-xxx" +7. /workflow:test-cycle-execute --yes --session="WFS-test-xxx" ``` ### Quick Bug Fix @@ -677,11 +802,12 @@ Constraints: [urgent] Task Type: bugfix Pipeline: -Bug报告 → lite-fix → 修复代码 → test-cycle-execute → 测试通过 +Bug报告 → lite-fix → 修复代码 → test-fix-gen → 测试任务 → test-cycle-execute → 测试通过 Chain: 1. /workflow:lite-fix --yes "Fix login timeout..." -2. /workflow:test-cycle-execute --yes --session="WFS-xxx" +2. /workflow:test-fix-gen --yes --session="WFS-xxx" +3. /workflow:test-cycle-execute --yes --session="WFS-test-xxx" ``` ### Skip Tests @@ -757,18 +883,22 @@ Chain: ### Test Generation from Implementation ``` -Goal: Generate tests for completed user registration feature +Goal: Generate comprehensive tests for completed user registration feature Scope: [auth, tests] Complexity: medium Constraints: [] Task Type: test-gen -Pipeline: -代码 → test-gen → 测试 → test-cycle-execute → 测试通过 +Pipeline (with Minimum Execution Units): +代码/会话 →【test-gen → execute】→ 测试通过 Chain: +# Unit: Test Generation (test-gen + execute) 1. /workflow:test-gen --yes "WFS-registration-20250124" -2. /workflow:test-cycle-execute --yes --session="WFS-test-xxx" +2. /workflow:execute --yes --session="WFS-test-registration" + +Note: test-gen creates IMPL-001 (test generation) and IMPL-002 (test execution & fix) + execute runs both tasks - this is a Minimum Execution Unit ``` ### Review + Fix Workflow @@ -779,13 +909,18 @@ Complexity: medium Constraints: [] Task Type: review -Pipeline: -代码 → review → 审查发现 → review-fix → 修复代码 → test-cycle-execute → 测试通过 +Pipeline (with Minimum Execution Units): +代码 →【review-session-cycle → review-fix】→ 修复代码 + →【test-fix-gen → test-cycle-execute】→ 测试通过 Chain: -1. /workflow:review --yes --session="WFS-payment-impl" +# Unit 1: Code Review (review-session-cycle + review-fix) +1. /workflow:review-session-cycle --yes --session="WFS-payment-impl" 2. /workflow:review-fix --yes --session="WFS-payment-impl" -3. /workflow:test-cycle-execute --yes --session="WFS-payment-impl" + +# Unit 2: Test Validation (test-fix-gen + test-cycle-execute) +3. /workflow:test-fix-gen --yes --session="WFS-payment-impl" +4. /workflow:test-cycle-execute --yes --session="WFS-test-payment-impl" ``` ### Brainstorm Workflow (Uncertain Requirements) @@ -798,14 +933,15 @@ Task Type: brainstorm Pipeline: 探索主题 → brainstorm:auto-parallel → 分析结果 → plan → 详细计划 - → plan-verify → 验证计划 → execute → 代码 → test-cycle-execute → 测试通过 + → plan-verify → 验证计划 → execute → 代码 → test-fix-gen → 测试任务 → test-cycle-execute → 测试通过 Chain: 1. /workflow:brainstorm:auto-parallel --yes "Explore solutions for real-time..." 2. /workflow:plan --yes "Implement chosen notification approach..." 3. /workflow:plan-verify --yes --session="WFS-xxx" 4. /workflow:execute --yes --resume-session="WFS-xxx" -5. /workflow:test-cycle-execute --yes --session="WFS-xxx" +5. /workflow:test-fix-gen --yes --session="WFS-xxx" +6. /workflow:test-cycle-execute --yes --session="WFS-test-xxx" ``` ### Multi-CLI Plan (Multi-Perspective Analysis) @@ -817,12 +953,13 @@ Constraints: [] Task Type: multi-cli Pipeline: -需求 → multi-cli-plan → 对比计划 → lite-execute → 代码 → test-cycle-execute → 测试通过 +需求 → multi-cli-plan → 对比计划 → lite-execute → 代码 → test-fix-gen → 测试任务 → test-cycle-execute → 测试通过 Chain: 1. /workflow:multi-cli-plan --yes "Compare microservices vs monolith..." 2. /workflow:lite-execute --yes --in-memory -3. /workflow:test-cycle-execute --yes --session="WFS-xxx" +3. /workflow:test-fix-gen --yes --session="WFS-xxx" +4. /workflow:test-cycle-execute --yes --session="WFS-test-xxx" ``` ## Execution Flow @@ -886,18 +1023,32 @@ All from `~/.claude/commands/workflow/`: **Tools**: context-gather, test-context-gather, task-generate, conflict-resolution, action-plan-verify **Utility**: clean, init, replan +### Testing Commands Distinction + +| Command | Purpose | Output | Follow-up | +|---------|---------|--------|-----------| +| **test-gen** | 广泛测试示例生成并进行测试 | test-tasks (IMPL-001, IMPL-002) | `/workflow:execute` | +| **test-fix-gen** | 针对特定问题生成测试并在测试中修正 | test-tasks | `/workflow:test-cycle-execute` | +| **test-cycle-execute** | 执行测试周期(迭代测试和修复) | test-passed | N/A (终点) | + +**流程说明**: +- **test-gen → execute**: 生成全面的测试套件,execute 执行生成和测试 +- **test-fix-gen → test-cycle-execute**: 针对特定问题生成修复任务,test-cycle-execute 迭代测试和修复直到通过 + ### Task Type Routing (Pipeline View) +**Note**: `【 】` marks Minimum Execution Units (最小执行单元) - these commands must execute together. + | Task Type | Pipeline | |-----------|----------| -| **feature** (simple) | 需求 → lite-plan → 计划 → lite-execute → 代码 → test-cycle-execute → 测试通过 | -| **feature** (complex) | 需求 → plan → 详细计划 → plan-verify → 验证计划 → execute → 代码 → review-session-cycle → 审查通过 → test-cycle-execute → 测试通过 | -| **bugfix** | Bug报告 → lite-fix → 修复代码 → test-cycle-execute → 测试通过 | +| **feature** (simple) | 需求 →【lite-plan → lite-execute】→ 代码 →【test-fix-gen → test-cycle-execute】→ 测试通过 | +| **feature** (complex) | 需求 →【plan → plan-verify】→ 验证计划 → execute → 代码 →【review-session-cycle → review-fix】→ 修复代码 →【test-fix-gen → test-cycle-execute】→ 测试通过 | +| **bugfix** | Bug报告 → lite-fix → 修复代码 →【test-fix-gen → test-cycle-execute】→ 测试通过 | | **tdd** | 需求 → tdd-plan → TDD任务 → execute → 代码 → tdd-verify → TDD验证通过 | -| **test-fix** | 失败测试 → test-fix-gen → 测试任务 → test-cycle-execute → 测试通过 | -| **test-gen** | 代码 → test-gen → 测试 → test-cycle-execute → 测试通过 | -| **review** | 代码 → review → 审查发现 → review-fix → 修复代码 → test-cycle-execute → 测试通过 | -| **brainstorm** | 探索主题 → brainstorm:auto-parallel → 分析结果 → plan → 详细计划 → execute → 代码 → test-cycle-execute → 测试通过 | -| **multi-cli** | 需求 → multi-cli-plan → 对比计划 → lite-execute → 代码 → test-cycle-execute → 测试通过 | +| **test-fix** | 失败测试 →【test-fix-gen → test-cycle-execute】→ 测试通过 | +| **test-gen** | 代码/会话 →【test-gen → execute】→ 测试通过 | +| **review** | 代码 →【review-session-cycle/review-module-cycle → review-fix】→ 修复代码 →【test-fix-gen → test-cycle-execute】→ 测试通过 | +| **brainstorm** | 探索主题 → brainstorm:auto-parallel → 分析结果 →【plan → plan-verify】→ 验证计划 → execute → 代码 →【test-fix-gen → test-cycle-execute】→ 测试通过 | +| **multi-cli** | 需求 → multi-cli-plan → 对比计划 → lite-execute → 代码 →【test-fix-gen → test-cycle-execute】→ 测试通过 | Use `CommandRegistry.getAllCommandsSummary()` to discover all commands dynamically. diff --git a/.claude/commands/ccw.md b/.claude/commands/ccw.md index 6f8e361d..15691705 100644 --- a/.claude/commands/ccw.md +++ b/.claude/commands/ccw.md @@ -9,6 +9,28 @@ allowed-tools: SlashCommand(*), TodoWrite(*), AskUserQuestion(*), Read(*), Grep( Main process orchestrator: intent analysis → workflow selection → command chain execution. +## Core Concept: Minimum Execution Units (最小执行单元) + +**Definition**: A set of commands that must execute together as an atomic group to achieve a meaningful workflow milestone. + +**Why This Matters**: +- **Prevents Incomplete States**: Avoid stopping after task generation without execution +- **User Experience**: User gets complete results, not intermediate artifacts requiring manual follow-up +- **Workflow Integrity**: Maintains logical coherence of multi-step operations + +**Key Units in CCW**: + +| Unit Type | Pattern | Example | +|-----------|---------|---------| +| **Planning + Execution** | plan-cmd → execute-cmd | lite-plan → lite-execute | +| **Testing** | test-gen-cmd → test-exec-cmd | test-fix-gen → test-cycle-execute | +| **Review** | review-cmd → fix-cmd | review-session-cycle → review-fix | + +**Atomic Rules**: +1. CCW automatically groups commands into minimum units - never splits them +2. Pipeline visualization shows units with `【 】` markers +3. Error handling preserves unit boundaries (retry/skip affects whole unit) + ## Execution Model **Synchronous (Main Process)**: Commands execute via SlashCommand in main process, blocking until complete. @@ -105,7 +127,7 @@ function selectWorkflow(analysis) { return buildCommandChain(selected, analysis); } -// Build command chain (port-based matching) +// Build command chain (port-based matching with Minimum Execution Units) function buildCommandChain(workflow, analysis) { const chains = { // Level 1 - Rapid @@ -115,17 +137,24 @@ function buildCommandChain(workflow, analysis) { // Level 2 - Lightweight 'rapid': [ - { cmd: '/workflow:lite-plan', args: `"${analysis.goal}"` }, - { cmd: '/workflow:lite-execute', args: '--in-memory' }, + // Unit: Quick Implementation【lite-plan → lite-execute】 + { cmd: '/workflow:lite-plan', args: `"${analysis.goal}"`, unit: 'quick-impl' }, + { cmd: '/workflow:lite-execute', args: '--in-memory', unit: 'quick-impl' }, + // Unit: Test Validation【test-fix-gen → test-cycle-execute】 ...(analysis.constraints?.includes('skip-tests') ? [] : [ - { cmd: '/workflow:test-cycle-execute', args: '' } + { cmd: '/workflow:test-fix-gen', args: '', unit: 'test-validation' }, + { cmd: '/workflow:test-cycle-execute', args: '', unit: 'test-validation' } ]) ], 'bugfix.standard': [ - { cmd: '/workflow:lite-fix', args: `"${analysis.goal}"` }, + // Unit: Bug Fix【lite-fix → lite-execute】 + { cmd: '/workflow:lite-fix', args: `"${analysis.goal}"`, unit: 'bug-fix' }, + { cmd: '/workflow:lite-execute', args: '--in-memory', unit: 'bug-fix' }, + // Unit: Test Validation【test-fix-gen → test-cycle-execute】 ...(analysis.constraints?.includes('skip-tests') ? [] : [ - { cmd: '/workflow:test-cycle-execute', args: '' } + { cmd: '/workflow:test-fix-gen', args: '', unit: 'test-validation' }, + { cmd: '/workflow:test-cycle-execute', args: '', unit: 'test-validation' } ]) ], @@ -134,59 +163,80 @@ function buildCommandChain(workflow, analysis) { ], 'multi-cli-plan': [ - { cmd: '/workflow:multi-cli-plan', args: `"${analysis.goal}"` }, - { cmd: '/workflow:lite-execute', args: '--in-memory' }, + // Unit: Multi-CLI Planning【multi-cli-plan → lite-execute】 + { cmd: '/workflow:multi-cli-plan', args: `"${analysis.goal}"`, unit: 'multi-cli' }, + { cmd: '/workflow:lite-execute', args: '--in-memory', unit: 'multi-cli' }, + // Unit: Test Validation【test-fix-gen → test-cycle-execute】 ...(analysis.constraints?.includes('skip-tests') ? [] : [ - { cmd: '/workflow:test-cycle-execute', args: '' } + { cmd: '/workflow:test-fix-gen', args: '', unit: 'test-validation' }, + { cmd: '/workflow:test-cycle-execute', args: '', unit: 'test-validation' } ]) ], 'docs': [ - { cmd: '/workflow:lite-plan', args: `"${analysis.goal}"` }, - { cmd: '/workflow:lite-execute', args: '--in-memory' } + // Unit: Quick Implementation【lite-plan → lite-execute】 + { cmd: '/workflow:lite-plan', args: `"${analysis.goal}"`, unit: 'quick-impl' }, + { cmd: '/workflow:lite-execute', args: '--in-memory', unit: 'quick-impl' } ], // Level 3 - Standard 'coupled': [ - { cmd: '/workflow:plan', args: `"${analysis.goal}"` }, - { cmd: '/workflow:plan-verify', args: '' }, + // Unit: Verified Planning【plan → plan-verify】 + { cmd: '/workflow:plan', args: `"${analysis.goal}"`, unit: 'verified-planning' }, + { cmd: '/workflow:plan-verify', args: '', unit: 'verified-planning' }, + // Execution { cmd: '/workflow:execute', args: '' }, - { cmd: '/workflow:review-session-cycle', args: '' }, + // Unit: Code Review【review-session-cycle → review-fix】 + { cmd: '/workflow:review-session-cycle', args: '', unit: 'code-review' }, + { cmd: '/workflow:review-fix', args: '', unit: 'code-review' }, + // Unit: Test Validation【test-fix-gen → test-cycle-execute】 ...(analysis.constraints?.includes('skip-tests') ? [] : [ - { cmd: '/workflow:test-cycle-execute', args: '' } + { cmd: '/workflow:test-fix-gen', args: '', unit: 'test-validation' }, + { cmd: '/workflow:test-cycle-execute', args: '', unit: 'test-validation' } ]) ], 'tdd': [ - { cmd: '/workflow:tdd-plan', args: `"${analysis.goal}"` }, - { cmd: '/workflow:execute', args: '' }, + // Unit: TDD Planning + Execution【tdd-plan → execute】 + { cmd: '/workflow:tdd-plan', args: `"${analysis.goal}"`, unit: 'tdd-planning' }, + { cmd: '/workflow:execute', args: '', unit: 'tdd-planning' }, + // TDD Verification { cmd: '/workflow:tdd-verify', args: '' } ], 'test-fix-gen': [ - { cmd: '/workflow:test-fix-gen', args: `"${analysis.goal}"` }, - { cmd: '/workflow:test-cycle-execute', args: '' } + // Unit: Test Validation【test-fix-gen → test-cycle-execute】 + { cmd: '/workflow:test-fix-gen', args: `"${analysis.goal}"`, unit: 'test-validation' }, + { cmd: '/workflow:test-cycle-execute', args: '', unit: 'test-validation' } ], 'review-fix': [ - { cmd: '/workflow:review', args: '' }, - { cmd: '/workflow:review-fix', args: '' }, - { cmd: '/workflow:test-cycle-execute', args: '' } + // Unit: Code Review【review-session-cycle → review-fix】 + { cmd: '/workflow:review-session-cycle', args: '', unit: 'code-review' }, + { cmd: '/workflow:review-fix', args: '', unit: 'code-review' }, + // Unit: Test Validation【test-fix-gen → test-cycle-execute】 + { cmd: '/workflow:test-fix-gen', args: '', unit: 'test-validation' }, + { cmd: '/workflow:test-cycle-execute', args: '', unit: 'test-validation' } ], 'ui': [ { cmd: '/workflow:ui-design:explore-auto', args: `"${analysis.goal}"` }, - { cmd: '/workflow:plan', args: '' }, - { cmd: '/workflow:execute', args: '' } + // Unit: Planning + Execution【plan → execute】 + { cmd: '/workflow:plan', args: '', unit: 'plan-execute' }, + { cmd: '/workflow:execute', args: '', unit: 'plan-execute' } ], // Level 4 - Brainstorm 'full': [ { cmd: '/workflow:brainstorm:auto-parallel', args: `"${analysis.goal}"` }, - { cmd: '/workflow:plan', args: '' }, - { cmd: '/workflow:plan-verify', args: '' }, + // Unit: Verified Planning【plan → plan-verify】 + { cmd: '/workflow:plan', args: '', unit: 'verified-planning' }, + { cmd: '/workflow:plan-verify', args: '', unit: 'verified-planning' }, + // Execution { cmd: '/workflow:execute', args: '' }, - { cmd: '/workflow:test-cycle-execute', args: '' } + // Unit: Test Validation【test-fix-gen → test-cycle-execute】 + { cmd: '/workflow:test-fix-gen', args: '', unit: 'test-validation' }, + { cmd: '/workflow:test-cycle-execute', args: '', unit: 'test-validation' } ], // Issue Workflow @@ -351,15 +401,17 @@ Phase 5: Execute Command Chain --- -## Pipeline Examples +## Pipeline Examples (with Minimum Execution Units) -| Input | Type | Level | Commands | -|-------|------|-------|----------| -| "Add API endpoint" | feature (low) | 2 | lite-plan → lite-execute → test-cycle-execute | -| "Fix login timeout" | bugfix | 2 | lite-fix → test-cycle-execute | -| "OAuth2 system" | feature (high) | 3 | plan → plan-verify → execute → review-session-cycle → test-cycle-execute | -| "Implement with TDD" | tdd | 3 | tdd-plan → execute → tdd-verify | -| "Uncertain: real-time arch" | exploration | 4 | brainstorm:auto-parallel → plan → plan-verify → execute → test-cycle-execute | +**Note**: `【 】` marks Minimum Execution Units - commands execute together as atomic groups. + +| Input | Type | Level | Pipeline (with Units) | +|-------|------|-------|-----------------------| +| "Add API endpoint" | feature (low) | 2 |【lite-plan → lite-execute】→【test-fix-gen → test-cycle-execute】| +| "Fix login timeout" | bugfix | 2 |【lite-fix → lite-execute】→【test-fix-gen → test-cycle-execute】| +| "OAuth2 system" | feature (high) | 3 |【plan → plan-verify】→ execute →【review-session-cycle → review-fix】→【test-fix-gen → test-cycle-execute】| +| "Implement with TDD" | tdd | 3 |【tdd-plan → execute】→ tdd-verify | +| "Uncertain: real-time arch" | exploration | 4 | brainstorm:auto-parallel →【plan → plan-verify】→ execute →【test-fix-gen → test-cycle-execute】| --- @@ -368,10 +420,11 @@ Phase 5: Execute Command Chain 1. **Main Process Execution** - Use SlashCommand in main process, no external CLI 2. **Intent-Driven** - Auto-select workflow based on task intent 3. **Port-Based Chaining** - Build command chain using port matching -4. **Progressive Clarification** - Low clarity triggers clarification phase -5. **TODO Tracking** - Use CCW prefix to isolate workflow todos -6. **Error Resilient** - Support retry/skip/abort error handling -7. **User Control** - Optional user confirmation at each phase +4. **Minimum Execution Units** - Commands grouped into atomic units, never split (e.g., lite-plan → lite-execute) +5. **Progressive Clarification** - Low clarity triggers clarification phase +6. **TODO Tracking** - Use CCW prefix to isolate workflow todos +7. **Unit-Aware Error Handling** - Retry/skip/abort affects whole unit, not individual commands +8. **User Control** - Optional user confirmation at each phase ---