Skip to content

Commit 7af258f

Browse files
author
catlog22
committed
feat(routing): add greenfield task type and narrow roadmap detection
- Add dedicated greenfield (0→1) task type with complexity-adaptive routing (low→brainstorm-to-plan, medium→greenfield-plan, high→greenfield-phased) - Narrow roadmap regex to only /roadmap|路线.*图/ to prevent false matches - Change brainstorm-to-plan chain from lite-plan to workflow-plan→execute - Sync all changes between ccw.md and ccw-coordinator.md
1 parent 8ad2830 commit 7af258f

2 files changed

Lines changed: 69 additions & 24 deletions

File tree

.claude/commands/ccw-coordinator.md

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ Interactive orchestration tool: analyze task → discover commands → recommend
3030
| `workflow:roadmap-with-file` | strategic requirement roadmap → issue creation → execution-plan.json |
3131
| `workflow:integration-test-cycle` | explore → test dev → test-fix cycle → reflection |
3232
| `workflow:refactor-cycle` | tech debt discovery → prioritize → execute → validate |
33-
| `team-planex` | planner + executor wave pipeline(适合大量零散 issue 或 roadmap 产出的清晰 issue,实现 0→1 开发|
33+
| `team-planex` | planner + executor wave pipeline(适合大量零散 issue 或 roadmap 产出的清晰 issue)|
3434

3535
## Core Concept: Minimum Execution Units (最小执行单元)
3636

@@ -85,7 +85,7 @@ Interactive orchestration tool: analyze task → discover commands → recommend
8585
| Unit Name | Commands | Purpose | Output |
8686
|-----------|----------|---------|--------|
8787
| **Analyze to Plan** | analyze-with-file → lite-plan | Collaborative analysis → auto chain to lite-plan | discussion.md + code |
88-
| **Brainstorm to Plan** | brainstorm-with-file → lite-plan | Multi-perspective ideation → auto chain to lite-plan | brainstorm.md + code |
88+
| **Brainstorm to Plan** | brainstorm-with-file → plan → execute | Multi-perspective ideation → formal planning | brainstorm.md + code |
8989
| **Debug With File** | debug-with-file | Hypothesis-driven debugging with documentation | understanding.md |
9090
| **Collaborative Plan** | collaborative-plan-with-file → unified-execute-with-file | Multi-agent collaborative planning and execution | plan-note.md + code |
9191
| **Roadmap Plan** | roadmap-with-file → team-planex | Requirement decomposition and wave execution | execution-plan.json + code |
@@ -118,7 +118,7 @@ Interactive orchestration tool: analyze task → discover commands → recommend
118118
| issue:queue | issue:execute | Issue Workflow, Rapid-to-Issue, Brainstorm-to-Issue |
119119
| issue:from-brainstorm | issue:queue | Brainstorm-to-Issue |
120120
| analyze-with-file | lite-plan (auto) | Analyze to Plan |
121-
| brainstorm-with-file | lite-plan (auto), issue:from-brainstorm | Brainstorm to Plan, Brainstorm-to-Issue |
121+
| brainstorm-with-file | plan (auto), issue:from-brainstorm | Brainstorm to Plan, Brainstorm-to-Issue |
122122
| collaborative-plan-with-file | unified-execute-with-file | Collaborative Plan |
123123
| roadmap-with-file | team-planex | Roadmap Plan |
124124
| unified-execute-with-file | (terminal) | Collaborative Plan |
@@ -165,11 +165,13 @@ function detectTaskType(text) {
165165
if (/urgent|production|critical/.test(text) && /fix|bug/.test(text)) return 'bugfix-hotfix';
166166
// With-File workflow patterns (specific keywords - must come before generic bugfix)
167167
if (/brainstorm.*issue|头脑风暴.*issue|idea.*issue|想法.*issue|.*头脑风暴|convert.*brainstorm/.test(text)) return 'brainstorm-to-issue';
168+
// 0→1 Greenfield detection (priority over brainstorm/roadmap)
169+
if (/从零开始|from scratch|0.*to.*1|greenfield|全新.*开发|新项目|new project|build.*from.*ground/.test(text)) return 'greenfield';
168170
if (/brainstorm|ideation|头脑风暴|创意|发散思维|creative thinking/.test(text)) return 'brainstorm-file';
169171
if (/debug.*document|hypothesis.*debug|深度调试|假设.*验证|systematic debug/.test(text)) return 'debug-file';
170172
if (/analyze.*document|collaborative analysis|协作分析|深度.*理解/.test(text)) return 'analyze-file';
171173
if (/collaborative.*plan|协作.*规划|多人.*规划|multi.*agent.*plan|Plan Note|分工.*规划/.test(text)) return 'collaborative-plan';
172-
if (/roadmap|需求.*规划|需求.*拆解|requirement.*plan|progressive.*plan|路线.*/.test(text)) return 'roadmap';
174+
if (/roadmap|路线.*/.test(text)) return 'roadmap'; // Narrowed: only explicit roadmap keywords
173175
if (/spec.*gen|specification|PRD|产品需求|产品文档|产品规格/.test(text)) return 'spec-driven';
174176
// Cycle workflow patterns
175177
if (/integration.*test|集成测试|端到端.*测试|e2e.*test|integration.*cycle/.test(text)) return 'integration-test';
@@ -407,7 +409,7 @@ const commandPorts = {
407409
output: ['brainstorm-document'],
408410
tags: ['brainstorm', 'with-file'],
409411
atomic_group: 'brainstorm-to-plan',
410-
note: 'Auto chains to lite-plan with brainstorm artifacts'
412+
note: 'Auto chains to workflow-plan with brainstorm artifacts'
411413
},
412414
'issue:from-brainstorm': {
413415
name: 'issue:from-brainstorm',
@@ -515,8 +517,10 @@ function determinePortFlow(taskType, constraints) {
515517
// Issue workflow types
516518
'issue-batch': { inputPort: 'codebase', outputPort: 'completed-issues' },
517519
'issue-transition': { inputPort: 'requirement', outputPort: 'completed-issues' },
518-
// With-File workflow types (auto chain to lite-plan)
519-
'brainstorm-file': { inputPort: 'exploration-topic', outputPort: 'code' },
520+
// 0→1 Greenfield (exploration → formal planning → execution)
521+
'greenfield': { inputPort: 'exploration-topic', outputPort: 'test-passed' },
522+
// With-File workflow types (auto chain to plan)
523+
'brainstorm-file': { inputPort: 'exploration-topic', outputPort: 'test-passed' },
520524
'brainstorm-to-issue': { inputPort: 'brainstorm-document', outputPort: 'completed-issues' },
521525
'debug-file': { inputPort: 'bug-report', outputPort: 'understanding-document' },
522526
'analyze-file': { inputPort: 'analysis-topic', outputPort: 'code' },
@@ -957,7 +961,8 @@ Task: <description>
957961
| **issue-batch** | 代码库 →【discover → plan → queue → execute】→ 完成 issues | Issue Workflow |
958962
| **issue-transition** | 需求 →【lite-plan → convert-to-plan → queue → execute】→ 完成 issues | Rapid-to-Issue |
959963
| **analyze-file** | 分析主题 →【analyze-with-file → lite-plan → lite-execute】→ 代码 | Analyze to Plan |
960-
| **brainstorm-file** | 主题 →【brainstorm-with-file → lite-plan → lite-execute】→ 代码 | Brainstorm to Plan |
964+
| **greenfield** | 需求 →【brainstorm-with-file → plan → execute】→ 代码 → test | Greenfield (01) |
965+
| **brainstorm-file** | 主题 →【brainstorm-with-file → plan → execute】→ 代码 → test | Brainstorm to Plan |
961966
| **brainstorm-to-issue** | brainstorm.md →【from-brainstorm → queue → execute】→ 完成 issues | Brainstorm to Issue |
962967
| **debug-file** | Bug报告 → debug-with-file → understanding.md (自包含) | Debug With File |
963968
| **collaborative-plan** | 需求 →【collaborative-plan-with-file → unified-execute-with-file】→ 代码 | Collaborative Plan |

.claude/commands/ccw.md

Lines changed: 56 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ Main process orchestrator: intent analysis → workflow selection → command ch
2828
| `workflow:roadmap-with-file` | strategic requirement roadmap → issue creation → execution-plan.json |
2929
| `workflow:integration-test-cycle` | explore → test dev → test-fix cycle → reflection |
3030
| `workflow:refactor-cycle` | tech debt discovery → prioritize → execute → validate |
31-
| `team-planex` | planner + executor wave pipeline(适合大量零散 issue 或 roadmap 产出的清晰 issue,实现 0→1 开发|
31+
| `team-planex` | planner + executor wave pipeline(适合大量零散 issue 或 roadmap 产出的清晰 issue)|
3232

3333
## Core Concept: Self-Contained Skills (自包含 Skill)
3434

@@ -51,9 +51,11 @@ Main process orchestrator: intent analysis → workflow selection → command ch
5151
| 代码审查 | `review-cycle` | 内部完成 review→fix |
5252
| 多CLI协作 | `workflow-multi-cli-plan` | ACE context → CLI discussion → plan → execute |
5353
| 分析→规划 | `workflow:analyze-with-file``workflow-lite-plan` | 协作分析产物自动传递给 lite-plan |
54-
| 头脑风暴→规划 | `workflow:brainstorm-with-file``workflow-lite-plan` | 头脑风暴产物自动传递给 lite-plan |
54+
| 头脑风暴→规划 | `workflow:brainstorm-with-file``workflow-plan``workflow-execute` | 头脑风暴产物自动传递给正式规划 |
55+
| 0→1 开发(小) | `workflow:brainstorm-with-file``workflow-plan``workflow-execute` | 小规模从零开始,探索+正式规划+实现 |
56+
| 0→1 开发(中/大) | `workflow:brainstorm-with-file``workflow-plan``workflow-execute` | 探索后正式规划+执行 |
5557
| 协作规划 | `workflow:collaborative-plan-with-file``workflow:unified-execute-with-file` | 多 agent 协作规划→通用执行 |
56-
| 需求路线图 | `workflow:roadmap-with-file``team-planex` | 需求拆解→issue 创建→wave pipeline 执行 |
58+
| 需求路线图 | `workflow:roadmap-with-file``team-planex` | 需求拆解→issue 创建→wave pipeline 执行(需明确 roadmap 关键词)|
5759
| 集成测试循环 | `workflow:integration-test-cycle` | 自迭代集成测试闭环 |
5860
| 重构循环 | `workflow:refactor-cycle` | 技术债务发现→重构→验证 |
5961

@@ -124,12 +126,14 @@ function detectTaskType(text) {
124126
const patterns = {
125127
'bugfix-hotfix': /urgent|production|critical/ && /fix|bug/,
126128
// With-File workflows (documented exploration → auto chain to lite-plan)
129+
// 0→1 Greenfield detection (priority over brainstorm/roadmap)
130+
'greenfield': /从零开始|from scratch|0.*to.*1|greenfield|全新.*开发|新项目|new project|build.*from.*ground/,
127131
'brainstorm': /brainstorm|ideation|头脑风暴|创意|发散思维|creative thinking|multi-perspective.*think|compare perspectives|探索.*可能/,
128132
'brainstorm-to-issue': /brainstorm.*issue|头脑风暴.*issue|idea.*issue|想法.*issue|.*头脑风暴|convert.*brainstorm/,
129133
'debug-file': /debug.*document|hypothesis.*debug|troubleshoot.*track|investigate.*log|调试.*记录|假设.*验证|systematic debug|深度调试/,
130134
'analyze-file': /analyze.*document|explore.*concept|understand.*architecture|investigate.*discuss|collaborative analysis|分析.*讨论|深度.*理解|协作.*分析/,
131135
'collaborative-plan': /collaborative.*plan|协作.*规划|多人.*规划|multi.*agent.*plan|Plan Note|分工.*规划/,
132-
'roadmap': /roadmap|需求.*规划|需求.*拆解|requirement.*plan|progressive.*plan|路线.*/,
136+
'roadmap': /roadmap|路线.*/, // Narrowed: only explicit roadmap keywords (需求规划/需求拆解 moved to greenfield routing)
133137
'spec-driven': /spec.*gen|specification|PRD|产品需求|产品文档|产品规格/,
134138
// Cycle workflows (self-iterating with reflection)
135139
'integration-test': /integration.*test|集成测试|端到端.*测试|e2e.*test|integration.*cycle/,
@@ -184,13 +188,18 @@ async function clarifyRequirements(analysis) {
184188
function selectWorkflow(analysis) {
185189
const levelMap = {
186190
'bugfix-hotfix': { level: 2, flow: 'bugfix.hotfix' },
191+
// 0→1 Greenfield (complexity-adaptive routing)
192+
'greenfield': { level: analysis.complexity === 'high' ? 4 : 3,
193+
flow: analysis.complexity === 'high' ? 'greenfield-phased' // large: brainstorm → workflow-plan → execute
194+
: analysis.complexity === 'medium' ? 'greenfield-plan' // medium: brainstorm → workflow-plan → execute
195+
: 'brainstorm-to-plan' }, // small: brainstorm → workflow-plan
187196
// With-File workflows → auto chain to lite-plan
188-
'brainstorm': { level: 4, flow: 'brainstorm-to-plan' }, // brainstorm-with-file → lite-plan
197+
'brainstorm': { level: 4, flow: 'brainstorm-to-plan' }, // brainstorm-with-file → workflow-plan
189198
'brainstorm-to-issue': { level: 4, flow: 'brainstorm-to-issue' }, // Brainstorm → Issue workflow
190199
'debug-file': { level: 3, flow: 'debug-with-file' }, // Hypothesis-driven debugging (standalone)
191200
'analyze-file': { level: 3, flow: 'analyze-to-plan' }, // analyze-with-file → lite-plan
192201
'collaborative-plan': { level: 3, flow: 'collaborative-plan' }, // Multi-agent collaborative planning
193-
'roadmap': { level: 4, flow: 'roadmap' }, // roadmap → team-planex
202+
'roadmap': { level: 4, flow: 'roadmap' }, // roadmap → team-planex (explicit roadmap only)
194203
'spec-driven': { level: 4, flow: 'spec-driven' }, // spec-generator → plan → execute
195204
// Cycle workflows (self-iterating with reflection)
196205
'integration-test': { level: 3, flow: 'integration-test-cycle' },
@@ -266,7 +275,11 @@ function buildCommandChain(workflow, analysis) {
266275

267276
'brainstorm-to-plan': [
268277
{ cmd: 'workflow:brainstorm-with-file', args: `"${analysis.goal}"` },
269-
{ cmd: 'workflow-lite-plan', args: '' } // auto receives brainstorm artifacts (brainstorm.md)
278+
{ cmd: 'workflow-plan', args: '' }, // formal planning with brainstorm artifacts
279+
{ cmd: 'workflow-execute', args: '' },
280+
...(analysis.constraints?.includes('skip-tests') ? [] : [
281+
{ cmd: 'workflow-test-fix', args: '' }
282+
])
270283
],
271284

272285
'debug-with-file': [
@@ -281,6 +294,26 @@ function buildCommandChain(workflow, analysis) {
281294
{ cmd: 'issue:execute', args: '--queue auto' }
282295
],
283296

297+
// 0→1 Greenfield (complexity-adaptive)
298+
'greenfield-plan': [
299+
{ cmd: 'workflow:brainstorm-with-file', args: `"${analysis.goal}"` },
300+
{ cmd: 'workflow-plan', args: '' }, // formal planning after exploration
301+
{ cmd: 'workflow-execute', args: '' },
302+
...(analysis.constraints?.includes('skip-tests') ? [] : [
303+
{ cmd: 'workflow-test-fix', args: '' }
304+
])
305+
],
306+
307+
'greenfield-phased': [
308+
{ cmd: 'workflow:brainstorm-with-file', args: `"${analysis.goal}"` },
309+
{ cmd: 'workflow-plan', args: '' }, // formal planning after exploration
310+
{ cmd: 'workflow-execute', args: '' },
311+
{ cmd: 'review-cycle', args: '' },
312+
...(analysis.constraints?.includes('skip-tests') ? [] : [
313+
{ cmd: 'workflow-test-fix', args: '' }
314+
])
315+
],
316+
284317
// Universal Plan+Execute
285318
'collaborative-plan': [
286319
{ cmd: 'workflow:collaborative-plan-with-file', args: `"${analysis.goal}"` },
@@ -338,7 +371,7 @@ function buildCommandChain(workflow, analysis) {
338371
{ cmd: 'workflow-execute', args: '' }
339372
],
340373

341-
// Level 4 - Full Exploration
374+
// Level 4 - Full Exploration (brainstorm → formal planning → execute)
342375
'full': [
343376
{ cmd: 'brainstorm', args: `"${analysis.goal}"` },
344377
{ cmd: 'workflow-plan', args: '' },
@@ -600,10 +633,12 @@ Phase 5: Execute Command Chain
600633
| "Use issue workflow" | issue-transition | 2.5 | workflow-lite-plan(plan-only) → convert-to-plan → queue → execute |
601634
| "协作分析: 认证架构" | analyze-file | 3 | analyze-with-file → workflow-lite-plan |
602635
| "深度调试 WebSocket" | debug-file | 3 | workflow:debug-with-file |
603-
| "头脑风暴: 通知系统" | brainstorm | 4 | brainstorm-with-file → workflow-lite-plan |
636+
| "从零开始: 用户系统" | greenfield (medium) | 3 | brainstorm-with-file → workflow-plan → workflow-execute → workflow-test-fix |
637+
| "greenfield: 大型平台" | greenfield (high) | 4 | brainstorm-with-file → workflow-plan → workflow-execute → review-cycle → workflow-test-fix |
638+
| "头脑风暴: 通知系统" | brainstorm | 4 | brainstorm-with-file → workflow-plan → workflow-execute → workflow-test-fix |
604639
| "从头脑风暴创建 issue" | brainstorm-to-issue | 4 | issue:from-brainstorm → issue:queue → issue:execute |
605640
| "协作规划: 实时通知系统" | collaborative-plan | 3 | collaborative-plan-with-file → unified-execute-with-file |
606-
| "需求路线图: OAuth + 2FA" | roadmap | 4 | roadmap-with-file → team-planex |
641+
| "roadmap: OAuth + 2FA" | roadmap | 4 | roadmap-with-file → team-planex |
607642
| "specification: 用户系统" | spec-driven | 4 | spec-generator → workflow-plan → workflow-execute → workflow-test-fix |
608643
| "集成测试: 支付流程" | integration-test | 3 | workflow:integration-test-cycle |
609644
| "重构 auth 模块" | refactor | 3 | workflow:refactor-cycle |
@@ -687,13 +722,13 @@ todos = [
687722
688723
| Workflow | Purpose | Auto Chain | Output Folder |
689724
|----------|---------|------------|---------------|
690-
| **brainstorm-with-file** | Multi-perspective ideation | → workflow-lite-plan (auto) | `.workflow/.brainstorm/` |
725+
| **brainstorm-with-file** | Multi-perspective ideation | → workflow-plan → workflow-execute (auto) | `.workflow/.brainstorm/` |
691726
| **debug-with-file** | Hypothesis-driven debugging | Standalone (self-contained) | `.workflow/.debug/` |
692727
| **analyze-with-file** | Collaborative analysis | → workflow-lite-plan (auto) | `.workflow/.analysis/` |
693728
| **collaborative-plan-with-file** | Multi-agent collaborative planning | → unified-execute-with-file | `.workflow/.planning/` |
694729
| **roadmap-with-file** | Strategic requirement roadmap | → team-planex | `.workflow/.planning/` |
695730
696-
**Auto Chain Mechanism**: When `analyze-with-file` or `brainstorm-with-file` completes, its artifacts (discussion.md / brainstorm.md) are automatically passed to `workflow-lite-plan` as context input. No user intervention needed.
731+
**Auto Chain Mechanism**: When `analyze-with-file` completes, its artifacts (discussion.md) are automatically passed to `workflow-lite-plan`. When `brainstorm-with-file` completes, its artifacts (brainstorm.md) are passed to `workflow-plan` for formal planning. No user intervention needed.
697732
698733
**Detection Keywords**:
699734
- **brainstorm**: 头脑风暴, 创意, 发散思维, multi-perspective, compare perspectives
@@ -752,9 +787,14 @@ todos = [
752787
# Multi-CLI collaborative planning
753788
/ccw "multi-cli plan: 支付网关API设计" # → workflow-multi-cli-plan → workflow-test-fix
754789
755-
# With-File workflows → auto chain to lite-plan
790+
# 0→1 Greenfield development (exploration-first)
791+
/ccw "从零开始: 用户认证系统" # → brainstorm-with-file → workflow-plan → workflow-execute → workflow-test-fix
792+
/ccw "new project: 数据导出模块" # → brainstorm-with-file → workflow-plan → workflow-execute → workflow-test-fix
793+
/ccw "全新开发: 实时通知系统" # → brainstorm-with-file → workflow-plan → workflow-execute → review-cycle → workflow-test-fix
794+
795+
# With-File workflows → auto chain
756796
/ccw "协作分析: 理解现有认证架构的设计决策" # → analyze-with-file → workflow-lite-plan
757-
/ccw "头脑风暴: 用户通知系统重新设计" # → brainstorm-with-file → workflow-lite-plan
797+
/ccw "头脑风暴: 用户通知系统重新设计" # → brainstorm-with-file → workflow-plan → workflow-execute → workflow-test-fix
758798
/ccw "深度调试: 系统随机崩溃问题" # → debug-with-file (standalone)
759799
/ccw "从头脑风暴 BS-通知系统-2025-01-28 创建 issue" # → brainstorm-to-issue (bridge)
760800
@@ -763,8 +803,8 @@ todos = [
763803
764804
# Collaborative planning & requirement workflows
765805
/ccw "协作规划: 实时通知系统架构" # → collaborative-plan-with-file → unified-execute
766-
/ccw "需求路线图: 用户认证 OAuth + 2FA" # → roadmap-with-file → team-planex
767-
/ccw "roadmap: 数据导出功能路线图" # → roadmap-with-file → team-planex
806+
/ccw "roadmap: 用户认证 OAuth + 2FA 路线图" # → roadmap-with-file → team-planex (explicit roadmap only)
807+
/ccw "roadmap: 数据导出功能路线图" # → roadmap-with-file → team-planex (explicit roadmap only)
768808
769809
# Team workflows (kept: team-planex)
770810
/ccw "team planex: 用户认证系统" # → team-planex (planner + executor wave pipeline)

0 commit comments

Comments
 (0)