claude-code-workflow 6.3.26 → 6.3.28

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (129) hide show
  1. package/.claude/CLAUDE.md +7 -1
  2. package/.claude/agents/action-planning-agent.md +1 -0
  3. package/.claude/agents/cli-discuss-agent.md +391 -0
  4. package/.claude/agents/cli-execution-agent.md +2 -0
  5. package/.claude/agents/cli-explore-agent.md +2 -1
  6. package/.claude/agents/cli-lite-planning-agent.md +1 -0
  7. package/.claude/agents/cli-planning-agent.md +1 -0
  8. package/.claude/agents/code-developer.md +1 -0
  9. package/.claude/agents/conceptual-planning-agent.md +2 -0
  10. package/.claude/agents/context-search-agent.md +1 -0
  11. package/.claude/agents/debug-explore-agent.md +2 -0
  12. package/.claude/agents/doc-generator.md +1 -0
  13. package/.claude/agents/issue-plan-agent.md +2 -1
  14. package/.claude/agents/issue-queue-agent.md +2 -1
  15. package/.claude/agents/memory-bridge.md +2 -0
  16. package/.claude/agents/test-context-search-agent.md +2 -0
  17. package/.claude/agents/test-fix-agent.md +1 -0
  18. package/.claude/agents/ui-design-agent.md +2 -0
  19. package/.claude/agents/universal-executor.md +1 -0
  20. package/.claude/commands/issue/execute.md +141 -163
  21. package/.claude/commands/workflow/lite-lite-lite.md +798 -0
  22. package/.claude/commands/workflow/multi-cli-plan.md +510 -0
  23. package/.claude/skills/ccw/SKILL.md +262 -372
  24. package/.claude/skills/ccw/command.json +547 -0
  25. package/.claude/skills/ccw-help/SKILL.md +46 -107
  26. package/.claude/skills/ccw-help/command.json +511 -0
  27. package/.claude/skills/skill-tuning/SKILL.md +303 -0
  28. package/.claude/skills/skill-tuning/phases/actions/action-abort.md +164 -0
  29. package/.claude/skills/skill-tuning/phases/actions/action-analyze-requirements.md +406 -0
  30. package/.claude/skills/skill-tuning/phases/actions/action-apply-fix.md +206 -0
  31. package/.claude/skills/skill-tuning/phases/actions/action-complete.md +195 -0
  32. package/.claude/skills/skill-tuning/phases/actions/action-diagnose-agent.md +317 -0
  33. package/.claude/skills/skill-tuning/phases/actions/action-diagnose-context.md +243 -0
  34. package/.claude/skills/skill-tuning/phases/actions/action-diagnose-dataflow.md +318 -0
  35. package/.claude/skills/skill-tuning/phases/actions/action-diagnose-docs.md +299 -0
  36. package/.claude/skills/skill-tuning/phases/actions/action-diagnose-memory.md +269 -0
  37. package/.claude/skills/skill-tuning/phases/actions/action-diagnose-token-consumption.md +200 -0
  38. package/.claude/skills/skill-tuning/phases/actions/action-gemini-analysis.md +322 -0
  39. package/.claude/skills/skill-tuning/phases/actions/action-generate-report.md +228 -0
  40. package/.claude/skills/skill-tuning/phases/actions/action-init.md +149 -0
  41. package/.claude/skills/skill-tuning/phases/actions/action-propose-fixes.md +317 -0
  42. package/.claude/skills/skill-tuning/phases/actions/action-verify.md +222 -0
  43. package/.claude/skills/skill-tuning/phases/orchestrator.md +377 -0
  44. package/.claude/skills/skill-tuning/phases/state-schema.md +378 -0
  45. package/.claude/skills/skill-tuning/specs/category-mappings.json +284 -0
  46. package/.claude/skills/skill-tuning/specs/dimension-mapping.md +212 -0
  47. package/.claude/skills/skill-tuning/specs/problem-taxonomy.md +318 -0
  48. package/.claude/skills/skill-tuning/specs/quality-gates.md +263 -0
  49. package/.claude/skills/skill-tuning/specs/skill-authoring-principles.md +189 -0
  50. package/.claude/skills/skill-tuning/specs/tuning-strategies.md +1537 -0
  51. package/.claude/skills/skill-tuning/templates/diagnosis-report.md +153 -0
  52. package/.claude/skills/skill-tuning/templates/fix-proposal.md +204 -0
  53. package/.claude/workflows/cli-templates/schemas/multi-cli-discussion-schema.json +421 -0
  54. package/.claude/workflows/cli-tools-usage.md +0 -41
  55. package/ccw/dist/core/auth/csrf-middleware.d.ts.map +1 -1
  56. package/ccw/dist/core/auth/csrf-middleware.js +3 -1
  57. package/ccw/dist/core/auth/csrf-middleware.js.map +1 -1
  58. package/ccw/dist/core/data-aggregator.d.ts +2 -0
  59. package/ccw/dist/core/data-aggregator.d.ts.map +1 -1
  60. package/ccw/dist/core/data-aggregator.js +5 -2
  61. package/ccw/dist/core/data-aggregator.js.map +1 -1
  62. package/ccw/dist/core/lite-scanner.d.ts +2 -1
  63. package/ccw/dist/core/lite-scanner.d.ts.map +1 -1
  64. package/ccw/dist/core/lite-scanner.js +295 -6
  65. package/ccw/dist/core/lite-scanner.js.map +1 -1
  66. package/ccw/dist/core/routes/codexlens/config-handlers.d.ts.map +1 -1
  67. package/ccw/dist/core/routes/codexlens/config-handlers.js +5 -5
  68. package/ccw/dist/core/routes/codexlens/config-handlers.js.map +1 -1
  69. package/ccw/dist/core/routes/session-routes.d.ts.map +1 -1
  70. package/ccw/dist/core/routes/session-routes.js +166 -48
  71. package/ccw/dist/core/routes/session-routes.js.map +1 -1
  72. package/ccw/dist/core/routes/system-routes.d.ts.map +1 -1
  73. package/ccw/dist/core/routes/system-routes.js +87 -0
  74. package/ccw/dist/core/routes/system-routes.js.map +1 -1
  75. package/ccw/dist/core/server.js +2 -2
  76. package/ccw/dist/core/server.js.map +1 -1
  77. package/ccw/scripts/IMPLEMENTATION-SUMMARY.md +226 -0
  78. package/ccw/scripts/QUICK-REFERENCE.md +135 -0
  79. package/ccw/scripts/README-memory-embedder.md +157 -0
  80. package/ccw/scripts/__pycache__/memory_embedder.cpython-313.pyc +0 -0
  81. package/ccw/scripts/__pycache__/test_memory_embedder.cpython-313-pytest-8.4.2.pyc +0 -0
  82. package/ccw/scripts/memory-embedder-example.ts +184 -0
  83. package/ccw/scripts/memory_embedder.py +428 -0
  84. package/ccw/scripts/test_memory_embedder.py +245 -0
  85. package/ccw/src/core/auth/csrf-middleware.ts +3 -1
  86. package/ccw/src/core/data-aggregator.ts +7 -2
  87. package/ccw/src/core/lite-scanner.ts +440 -6
  88. package/ccw/src/core/routes/codexlens/config-handlers.ts +12 -9
  89. package/ccw/src/core/routes/session-routes.ts +201 -48
  90. package/ccw/src/core/routes/system-routes.ts +102 -0
  91. package/ccw/src/core/server.ts +2 -2
  92. package/ccw/src/templates/dashboard-css/01-base.css +8 -0
  93. package/ccw/src/templates/dashboard-css/02-session.css +81 -0
  94. package/ccw/src/templates/dashboard-css/04-lite-tasks.css +2442 -0
  95. package/ccw/src/templates/dashboard-css/21-cli-toolmgmt.css +157 -0
  96. package/ccw/src/templates/dashboard-css/32-issue-manager.css +23 -0
  97. package/ccw/src/templates/dashboard-js/components/cli-stream-viewer.js +38 -4
  98. package/ccw/src/templates/dashboard-js/components/hook-manager.js +38 -13
  99. package/ccw/src/templates/dashboard-js/components/navigation.js +24 -4
  100. package/ccw/src/templates/dashboard-js/i18n.js +194 -6
  101. package/ccw/src/templates/dashboard-js/views/api-settings.js +32 -0
  102. package/ccw/src/templates/dashboard-js/views/claude-manager.js +44 -3
  103. package/ccw/src/templates/dashboard-js/views/cli-manager.js +303 -31
  104. package/ccw/src/templates/dashboard-js/views/history.js +44 -6
  105. package/ccw/src/templates/dashboard-js/views/home.js +1 -0
  106. package/ccw/src/templates/dashboard-js/views/issue-manager.js +54 -7
  107. package/ccw/src/templates/dashboard-js/views/lite-tasks.js +1817 -4
  108. package/ccw/src/templates/dashboard.html +5 -0
  109. package/package.json +2 -1
  110. package/.claude/skills/ccw/index/command-capabilities.json +0 -127
  111. package/.claude/skills/ccw/index/intent-rules.json +0 -136
  112. package/.claude/skills/ccw/index/workflow-chains.json +0 -451
  113. package/.claude/skills/ccw/phases/actions/bugfix.md +0 -218
  114. package/.claude/skills/ccw/phases/actions/coupled.md +0 -194
  115. package/.claude/skills/ccw/phases/actions/docs.md +0 -93
  116. package/.claude/skills/ccw/phases/actions/full.md +0 -154
  117. package/.claude/skills/ccw/phases/actions/issue.md +0 -201
  118. package/.claude/skills/ccw/phases/actions/rapid.md +0 -104
  119. package/.claude/skills/ccw/phases/actions/review-fix.md +0 -84
  120. package/.claude/skills/ccw/phases/actions/tdd.md +0 -66
  121. package/.claude/skills/ccw/phases/actions/ui.md +0 -79
  122. package/.claude/skills/ccw/phases/orchestrator.md +0 -435
  123. package/.claude/skills/ccw/specs/intent-classification.md +0 -336
  124. package/.claude/skills/ccw-help/index/all-agents.json +0 -82
  125. package/.claude/skills/ccw-help/index/all-commands.json +0 -882
  126. package/.claude/skills/ccw-help/index/by-category.json +0 -914
  127. package/.claude/skills/ccw-help/index/by-use-case.json +0 -896
  128. package/.claude/skills/ccw-help/index/command-relationships.json +0 -160
  129. package/.claude/skills/ccw-help/index/essential-commands.json +0 -112
@@ -1,462 +1,352 @@
1
1
  ---
2
2
  name: ccw
3
- description: Stateless workflow orchestrator that automatically selects and executes the optimal workflow combination based on task intent. Supports rapid (lite-plan+execute), full (brainstorm+plan+execute), coupled (plan+execute), bugfix (lite-fix), and issue (multi-point fixes) workflows. Triggers on "ccw", "workflow", "自动工作流", "智能调度".
4
- allowed-tools: Task(*), SlashCommand(*), AskUserQuestion(*), Read(*), Bash(*), Grep(*)
3
+ description: Stateless workflow orchestrator. Auto-selects optimal workflow based on task intent. Triggers "ccw", "workflow".
4
+ allowed-tools: Task(*), SlashCommand(*), AskUserQuestion(*), Read(*), Bash(*), Grep(*), TodoWrite(*)
5
5
  ---
6
6
 
7
7
  # CCW - Claude Code Workflow Orchestrator
8
8
 
9
- 无状态工作流协调器,根据任务意图自动选择并执行最优工作流组合。
9
+ 无状态工作流协调器,根据任务意图自动选择最优工作流。
10
10
 
11
- ## Architecture Overview
11
+ ## Architecture
12
12
 
13
13
  ```
14
14
  ┌─────────────────────────────────────────────────────────────────┐
15
- │ CCW Orchestrator (Stateless)
15
+ │ CCW Orchestrator (CLI-Enhanced + Requirement Analysis)
16
16
  ├─────────────────────────────────────────────────────────────────┤
17
-
18
- Input Analysis
19
- ├─ Intent Classification (bugfix/feature/refactor/issue/...)
20
- ├─ Complexity Assessment (low/medium/high)
21
- ├─ Context Detection (codebase familiarity needed?)
22
- └─ Constraint Extraction (time/scope/quality)
23
-
24
- Workflow Selection (Decision Tree)
25
- │ ├─ 🐛 Bug? → lite-fix / lite-fix --hotfix │
26
- │ ├─ ❓ Unclear? → brainstorm → plan → execute │
27
- │ ├─ ⚡ Simple? → lite-plan → lite-execute │
28
- │ ├─ 🔧 Complex? → plan → execute │
29
- │ ├─ 📋 Issue? → issue:plan → issue:queue → issue:execute │
30
- │ └─ 🎨 UI? → ui-design → plan → execute │
31
- │ │
32
- │ Execution Dispatch │
33
- │ └─ SlashCommand("/workflow:xxx") or Task(agent) │
34
- │ │
17
+ Phase 1 Input Analysis (rule-based, fast path) │
18
+ Phase 1.5 CLI Classification (semantic, smart path) │
19
+ Phase 1.75 Requirement Clarification (clarity < 2)
20
+ Phase 2 │ Chain Selection (intent → workflow)
21
+ Phase 2.5 │ CLI Action Planning (high complexity)
22
+ Phase 3 │ User Confirmation (optional)
23
+ Phase 4 TODO Tracking Setup │
24
+ Phase 5 │ Execution Loop
35
25
  └─────────────────────────────────────────────────────────────────┘
36
26
  ```
37
27
 
38
- ## Workflow Combinations (组合技)
39
-
40
- ### 1. Rapid (快速迭代) ⚡
41
- **Pattern**: 多模型协作分析 + 直接执行
42
- **Commands**: `/workflow:lite-plan` → `/workflow:lite-execute`
43
- **When to use**:
44
- - 明确知道做什么和怎么做
45
- - 单一功能或小型改动
46
- - 快速原型验证
47
-
48
- ### 2. Full (完整流程) 📋
49
- **Pattern**: 分析 + 头脑风暴 + 规划 + 执行
50
- **Commands**: `/workflow:brainstorm:auto-parallel` → `/workflow:plan` → `/workflow:execute`
51
- **When to use**:
52
- - 不确定产品方向或技术方案
53
- - 需要多角色视角分析
54
- - 复杂新功能开发
55
-
56
- ### 3. Coupled (复杂耦合) 🔗
57
- **Pattern**: 完整规划 + 验证 + 执行
58
- **Commands**: `/workflow:plan` → `/workflow:action-plan-verify` → `/workflow:execute`
59
- **When to use**:
60
- - 跨模块依赖
61
- - 架构级变更
62
- - 团队协作项目
63
-
64
- ### 4. Bugfix (缺陷修复) 🐛
65
- **Pattern**: 智能诊断 + 修复
66
- **Commands**: `/workflow:lite-fix` or `/workflow:lite-fix --hotfix`
67
- **When to use**:
68
- - 任何有明确症状的Bug
69
- - 生产事故紧急修复
70
- - 根因不清楚需要诊断
71
-
72
- ### 5. Issue (长时间多点修复) 📌
73
- **Pattern**: Issue规划 + 队列 + 批量执行
74
- **Commands**: `/issue:plan` → `/issue:queue` → `/issue:execute`
75
- **When to use**:
76
- - 多个相关问题需要批量处理
77
- - 长时间跨度的修复任务
78
- - 需要优先级排序和冲突解决
79
-
80
- ### 6. UI-First (设计驱动) 🎨
81
- **Pattern**: UI设计 + 规划 + 执行
82
- **Commands**: `/workflow:ui-design:*` → `/workflow:plan` → `/workflow:execute`
83
- **When to use**:
84
- - 前端功能开发
85
- - 需要视觉参考
86
- - 设计系统集成
87
-
88
28
  ## Intent Classification
89
29
 
90
- ```javascript
91
- function classifyIntent(input) {
92
- const text = input.toLowerCase()
93
-
94
- // Priority 1: Bug keywords
95
- if (/\b(fix|bug|error|issue|crash|broken|fail|wrong|incorrect)\b/.test(text)) {
96
- if (/\b(hotfix|urgent|production|critical|emergency)\b/.test(text)) {
97
- return { type: 'bugfix', mode: 'hotfix', workflow: 'lite-fix --hotfix' }
98
- }
99
- return { type: 'bugfix', mode: 'standard', workflow: 'lite-fix' }
100
- }
101
-
102
- // Priority 2: Issue batch keywords
103
- if (/\b(issues?|batch|queue|多个|批量)\b/.test(text) && /\b(fix|resolve|处理)\b/.test(text)) {
104
- return { type: 'issue', workflow: 'issue:plan issue:queue → issue:execute' }
105
- }
106
-
107
- // Priority 3: Uncertainty keywords → Full workflow
108
- if (/\b(不确定|不知道|explore|研究|分析一下|怎么做|what if|should i|探索)\b/.test(text)) {
109
- return { type: 'exploration', workflow: 'brainstorm → plan → execute' }
110
- }
111
-
112
- // Priority 4: UI/Design keywords
113
- if (/\b(ui|界面|design|设计|component|组件|style|样式|layout|布局)\b/.test(text)) {
114
- return { type: 'ui', workflow: 'ui-design → plan → execute' }
115
- }
116
-
117
- // Priority 5: Complexity assessment for remaining
118
- const complexity = assessComplexity(text)
119
-
120
- if (complexity === 'high') {
121
- return { type: 'feature', complexity: 'high', workflow: 'plan → verify → execute' }
122
- }
123
-
124
- if (complexity === 'medium') {
125
- return { type: 'feature', complexity: 'medium', workflow: 'lite-plan → lite-execute' }
126
- }
127
-
128
- return { type: 'feature', complexity: 'low', workflow: 'lite-plan → lite-execute' }
129
- }
30
+ ### Priority Order
31
+
32
+ | Priority | Intent | Patterns | Flow |
33
+ |----------|--------|----------|------|
34
+ | 1 | bugfix/hotfix | `urgent,production,critical` + bug | `bugfix.hotfix` |
35
+ | 1 | bugfix | `fix,bug,error,crash,fail` | `bugfix.standard` |
36
+ | 2 | issue batch | `issues,batch` + `fix,resolve` | `issue` |
37
+ | 3 | exploration | `不确定,explore,研究,what if` | `full` |
38
+ | 3 | multi-perspective | `多视角,权衡,比较方案,cross-verify` | `multi-cli-plan` |
39
+ | 4 | quick-task | `快速,简单,small,quick` + feature | `lite-lite-lite` |
40
+ | 5 | ui design | `ui,design,component,style` | `ui` |
41
+ | 6 | tdd | `tdd,test-driven,先写测试` | `tdd` |
42
+ | 7 | review | `review,审查,code review` | `review-fix` |
43
+ | 8 | documentation | `文档,docs,readme` | `docs` |
44
+ | 99 | feature | complexity-based | `rapid`/`coupled` |
45
+
46
+ ### Complexity Assessment
130
47
 
48
+ ```javascript
131
49
  function assessComplexity(text) {
132
50
  let score = 0
133
-
134
- // Architecture keywords
135
- if (/\b(refactor|重构|migrate|迁移|architect|架构|system|系统)\b/.test(text)) score += 2
136
-
137
- // Multi-module keywords
138
- if (/\b(multiple|多个|across|跨|all|所有|entire|整个)\b/.test(text)) score += 2
139
-
140
- // Integration keywords
141
- if (/\b(integrate|集成|connect|连接|api|database|数据库)\b/.test(text)) score += 1
142
-
143
- // Security/Performance keywords
144
- if (/\b(security|安全|performance|性能|scale|扩展)\b/.test(text)) score += 1
145
-
146
- if (score >= 4) return 'high'
147
- if (score >= 2) return 'medium'
148
- return 'low'
51
+ if (/refactor|重构|migrate|迁移|architect|架构|system|系统/.test(text)) score += 2
52
+ if (/multiple|多个|across|跨|all|所有|entire|整个/.test(text)) score += 2
53
+ if (/integrate|集成|api|database|数据库/.test(text)) score += 1
54
+ if (/security|安全|performance|性能|scale|扩展/.test(text)) score += 1
55
+ return score >= 4 ? 'high' : score >= 2 ? 'medium' : 'low'
149
56
  }
150
57
  ```
151
58
 
152
- ## Execution Flow
59
+ | Complexity | Flow |
60
+ |------------|------|
61
+ | high | `coupled` (plan → verify → execute) |
62
+ | medium/low | `rapid` (lite-plan → lite-execute) |
153
63
 
154
- ### Phase 1: Input Analysis
64
+ ### Dimension Extraction (WHAT/WHERE/WHY/HOW)
155
65
 
156
- ```javascript
157
- // Parse user input
158
- const input = userInput.trim()
159
-
160
- // Check for explicit workflow request
161
- if (input.startsWith('/workflow:') || input.startsWith('/issue:')) {
162
- // User explicitly requested a workflow, pass through
163
- SlashCommand(input)
164
- return
165
- }
66
+ 从用户输入提取四个维度,用于需求澄清和工作流选择:
166
67
 
167
- // Classify intent
168
- const intent = classifyIntent(input)
68
+ | 维度 | 提取内容 | 示例模式 |
69
+ |------|----------|----------|
70
+ | **WHAT** | action + target | `创建/修复/重构/优化/分析` + 目标对象 |
71
+ | **WHERE** | scope + paths | `file/module/system` + 文件路径 |
72
+ | **WHY** | goal + motivation | `为了.../因为.../目的是...` |
73
+ | **HOW** | constraints + preferences | `必须.../不要.../应该...` |
169
74
 
170
- console.log(`
171
- ## Intent Analysis
75
+ **Clarity Score** (0-3):
76
+ - +0.5: 有明确 action
77
+ - +0.5: 有具体 target
78
+ - +0.5: 有文件路径
79
+ - +0.5: scope 不是 unknown
80
+ - +0.5: 有明确 goal
81
+ - +0.5: 有约束条件
82
+ - -0.5: 包含不确定词 (`不知道/maybe/怎么`)
172
83
 
173
- **Input**: ${input.substring(0, 100)}...
174
- **Classification**: ${intent.type}
175
- **Complexity**: ${intent.complexity || 'N/A'}
176
- **Recommended Workflow**: ${intent.workflow}
177
- `)
178
- ```
84
+ ### Requirement Clarification
179
85
 
180
- ### Phase 2: User Confirmation (Optional)
86
+ `clarity_score < 2` 时触发需求澄清:
181
87
 
182
88
  ```javascript
183
- // For high-complexity or ambiguous intents, confirm with user
184
- if (intent.complexity === 'high' || intent.type === 'exploration') {
185
- const confirmation = AskUserQuestion({
186
- questions: [{
187
- question: `Recommended: ${intent.workflow}. Proceed?`,
188
- header: "Workflow",
189
- multiSelect: false,
190
- options: [
191
- { label: `${intent.workflow} (Recommended)`, description: "Use recommended workflow" },
192
- { label: "Rapid (lite-plan)", description: "Quick iteration" },
193
- { label: "Full (brainstorm+plan)", description: "Complete exploration" },
194
- { label: "Manual", description: "I'll specify the commands" }
195
- ]
196
- }]
197
- })
198
-
199
- // Adjust workflow based on user selection
200
- intent.workflow = mapSelectionToWorkflow(confirmation)
89
+ if (dimensions.clarity_score < 2) {
90
+ const questions = generateClarificationQuestions(dimensions)
91
+ // 生成问题:目标是什么? 范围是什么? 有什么约束?
92
+ AskUserQuestion({ questions })
201
93
  }
202
94
  ```
203
95
 
204
- ### Phase 3: Workflow Dispatch
96
+ **澄清问题类型**:
97
+ - 目标不明确 → "你想要对什么进行操作?"
98
+ - 范围不明确 → "操作的范围是什么?"
99
+ - 目的不明确 → "这个操作的主要目标是什么?"
100
+ - 复杂操作 → "有什么特殊要求或限制?"
205
101
 
206
- ```javascript
207
- switch (intent.workflow) {
208
- case 'lite-fix':
209
- SlashCommand('/workflow:lite-fix', args: input)
210
- break
211
-
212
- case 'lite-fix --hotfix':
213
- SlashCommand('/workflow:lite-fix --hotfix', args: input)
214
- break
215
-
216
- case 'lite-plan → lite-execute':
217
- SlashCommand('/workflow:lite-plan', args: input)
218
- // lite-plan will automatically dispatch to lite-execute
219
- break
220
-
221
- case 'plan → verify → execute':
222
- SlashCommand('/workflow:plan', args: input)
223
- // After plan, prompt for verify and execute
224
- break
225
-
226
- case 'brainstorm → plan → execute':
227
- SlashCommand('/workflow:brainstorm:auto-parallel', args: input)
228
- // After brainstorm, continue with plan
229
- break
230
-
231
- case 'issue:plan → issue:queue → issue:execute':
232
- SlashCommand('/issue:plan', args: input)
233
- // Issue workflow handles queue and execute
234
- break
235
-
236
- case 'ui-design → plan → execute':
237
- // Determine UI design subcommand
238
- if (hasReference(input)) {
239
- SlashCommand('/workflow:ui-design:imitate-auto', args: input)
240
- } else {
241
- SlashCommand('/workflow:ui-design:explore-auto', args: input)
242
- }
243
- break
244
- }
245
- ```
246
-
247
- ## CLI Tool Integration
102
+ ## TODO Tracking Protocol
248
103
 
249
- CCW **隐式调用** CLI 工具以获得三大优势:
104
+ ### CRITICAL: Append-Only Rule
250
105
 
251
- ### 1. Token 效率 (Context Efficiency)
106
+ CCW 创建的 Todo **必须附加到现有列表**,不能覆盖用户的其他 Todo。
252
107
 
253
- CLI 工具在单独进程中运行,可以处理大量代码上下文而不消耗主会话 token:
108
+ ### Implementation
254
109
 
255
- | 场景 | 触发条件 | 自动注入 |
256
- |------|----------|----------|
257
- | 大量代码上下文 | 文件读取 ≥ 50k 字符 | `gemini --mode analysis` |
258
- | 多模块分析 | 涉及 ≥ 5 个模块 | `gemini --mode analysis` |
259
- | 代码审查 | review 步骤 | `gemini --mode analysis` |
260
-
261
- ### 2. 多模型视角 (Multi-Model Perspectives)
110
+ ```javascript
111
+ // 1. 使用 CCW 前缀隔离工作流 todo
112
+ const prefix = `CCW:${flowName}`
262
113
 
263
- 不同模型有不同优势,CCW 根据任务类型自动选择:
114
+ // 2. 创建新 todo 时使用前缀格式
115
+ TodoWrite({
116
+ todos: [
117
+ ...existingNonCCWTodos, // 保留用户的 todo
118
+ { content: `${prefix}: [1/N] /command:step1`, status: "in_progress", activeForm: "..." },
119
+ { content: `${prefix}: [2/N] /command:step2`, status: "pending", activeForm: "..." }
120
+ ]
121
+ })
264
122
 
265
- | Tool | 核心优势 | 最佳场景 | 触发关键词 |
266
- |------|----------|----------|------------|
267
- | Gemini | 超长上下文、深度分析、架构理解、执行流追踪 | 代码库理解、架构评估、根因分析 | "分析", "理解", "设计", "架构", "诊断" |
268
- | Qwen | 代码模式识别、多维度分析 | Gemini备选、第二视角验证 | "评估", "对比", "验证" |
269
- | Codex | 精确代码生成、自主执行、数学推理 | 功能实现、重构、测试 | "实现", "重构", "修复", "生成", "测试" |
123
+ // 3. 更新状态时只修改匹配前缀的 todo
124
+ ```
270
125
 
271
- ### 3. 增强能力 (Enhanced Capabilities)
126
+ ### Todo Format
272
127
 
273
- #### Debug 能力增强
274
128
  ```
275
- 触发条件: intent === 'bugfix' AND root_cause_unclear
276
- 自动注入: gemini --mode analysis (执行流追踪)
277
- 用途: 假设驱动调试、状态机错误诊断、并发问题排查
129
+ CCW:{flow}: [{N}/{Total}] /command:name
278
130
  ```
279
131
 
280
- #### 规划能力增强
132
+ ### Visual Example
133
+
281
134
  ```
282
- 触发条件: complexity === 'high' OR intent === 'exploration'
283
- 自动注入: gemini --mode analysis (架构分析)
284
- 用途: 复杂任务先用CLI分析获取多模型视角
135
+ CCW:rapid: [1/2] /workflow:lite-plan
136
+ CCW:rapid: [2/2] /workflow:lite-execute
137
+ 用户自己的 todo(保留不动)
285
138
  ```
286
139
 
287
- ### 隐式注入规则 (Implicit Injection Rules)
140
+ ### Status Management
288
141
 
289
- CCW 在以下条件自动注入 CLI 调用(无需用户显式请求):
142
+ - 开始工作流:创建所有步骤 todo,第一步 `in_progress`
143
+ - 完成步骤:当前步骤 `completed`,下一步 `in_progress`
144
+ - 工作流结束:所有 CCW todo 标记 `completed`
145
+
146
+ ## Execution Flow
290
147
 
291
148
  ```javascript
292
- const implicitRules = {
293
- // 上下文收集:大量代码使用CLI可节省主会话token
294
- context_gathering: {
295
- trigger: 'file_read >= 50k chars OR module_count >= 5',
296
- inject: 'gemini --mode analysis'
297
- },
298
-
299
- // 规划前分析:复杂任务先用CLI分析
300
- pre_planning_analysis: {
301
- trigger: 'complexity === "high" OR intent === "exploration"',
302
- inject: 'gemini --mode analysis'
303
- },
304
-
305
- // 调试诊断:利用Gemini的执行流追踪能力
306
- debug_diagnosis: {
307
- trigger: 'intent === "bugfix" AND root_cause_unclear',
308
- inject: 'gemini --mode analysis'
309
- },
310
-
311
- // 代码审查:用CLI减少token占用
312
- code_review: {
313
- trigger: 'step === "review"',
314
- inject: 'gemini --mode analysis'
315
- },
316
-
317
- // 多任务执行:用Codex自主完成
318
- implementation: {
319
- trigger: 'step === "execute" AND task_count >= 3',
320
- inject: 'codex --mode write'
321
- }
149
+ // 1. Check explicit command
150
+ if (input.startsWith('/workflow:') || input.startsWith('/issue:')) {
151
+ SlashCommand(input)
152
+ return
322
153
  }
323
- ```
324
154
 
325
- ### 用户语义触发 (Semantic Tool Assignment)
155
+ // 2. Classify intent
156
+ const intent = classifyIntent(input) // See command.json intent_rules
326
157
 
327
- ```javascript
328
- // 用户可以通过自然语言指定工具偏好
329
- const toolHints = {
330
- gemini: /用\s*gemini|gemini\s*分析|让\s*gemini|深度分析|架构理解/i,
331
- qwen: /用\s*qwen|qwen\s*评估|让\s*qwen|第二视角/i,
332
- codex: /用\s*codex|codex\s*实现|让\s*codex|自主完成|批量修改/i
333
- }
158
+ // 3. Select flow
159
+ const flow = selectFlow(intent) // See command.json flows
334
160
 
335
- function detectToolPreference(input) {
336
- for (const [tool, pattern] of Object.entries(toolHints)) {
337
- if (pattern.test(input)) return tool
338
- }
339
- return null // Auto-select based on task type
340
- }
161
+ // 4. Create todos with CCW prefix
162
+ createWorkflowTodos(flow)
163
+
164
+ // 5. Dispatch first command
165
+ SlashCommand(flow.steps[0].command, args: input)
341
166
  ```
342
167
 
343
- ### 独立 CLI 工作流 (Standalone CLI Workflows)
168
+ ## CLI Tool Integration
344
169
 
345
- 直接调用 CLI 进行特定任务:
170
+ CCW 在特定条件下自动注入 CLI 调用:
346
171
 
347
- | Workflow | 命令 | 用途 |
348
- |----------|------|------|
349
- | CLI Analysis | `ccw cli --tool gemini` | 大型代码库快速理解、架构评估 |
350
- | CLI Implement | `ccw cli --tool codex` | 明确需求的自主实现 |
351
- | CLI Debug | `ccw cli --tool gemini` | 复杂bug根因分析、执行流追踪 |
172
+ | Condition | CLI Inject |
173
+ |-----------|------------|
174
+ | 大量代码上下文 (≥50k chars) | `gemini --mode analysis` |
175
+ | 高复杂度任务 | `gemini --mode analysis` |
176
+ | Bug 诊断 | `gemini --mode analysis` |
177
+ | 多任务执行 (≥3 tasks) | `codex --mode write` |
352
178
 
353
- ## Index Files (Dynamic Coordination)
179
+ ### CLI Enhancement Phases
354
180
 
355
- CCW 使用索引文件实现智能命令协调:
181
+ **Phase 1.5: CLI-Assisted Classification**
356
182
 
357
- | Index | Purpose |
358
- |-------|---------|
359
- | [index/command-capabilities.json](index/command-capabilities.json) | 命令能力分类(explore, plan, execute, test, review...) |
360
- | [index/workflow-chains.json](index/workflow-chains.json) | 预定义工作流链(rapid, full, coupled, bugfix, issue, tdd, ui...) |
183
+ 当规则匹配不明确时,使用 CLI 辅助分类:
361
184
 
362
- ### 能力分类
185
+ | 触发条件 | 说明 |
186
+ |----------|------|
187
+ | matchCount < 2 | 多个意图模式匹配 |
188
+ | complexity = high | 高复杂度任务 |
189
+ | input > 100 chars | 长输入需要语义理解 |
363
190
 
364
- ```
365
- capabilities:
366
- ├── explore - 代码探索、上下文收集
367
- ├── brainstorm - 多角色分析、方案探索
368
- ├── plan - 任务规划、分解
369
- ├── verify - 计划验证、质量检查
370
- ├── execute - 任务执行、代码实现
371
- ├── bugfix - Bug诊断、修复
372
- ├── test - 测试生成、执行
373
- ├── review - 代码审查、质量分析
374
- ├── issue - 批量问题管理
375
- ├── ui-design - UI设计、原型
376
- ├── memory - 文档、知识管理
377
- ├── session - 会话管理
378
- └── debug - 调试、问题排查
379
- ```
191
+ **Phase 2.5: CLI-Assisted Action Planning**
380
192
 
381
- ## TODO Tracking Integration
193
+ 高复杂度任务的工作流优化:
382
194
 
383
- CCW 自动使用 TodoWrite 跟踪工作流执行进度:
195
+ | 触发条件 | 说明 |
196
+ |----------|------|
197
+ | complexity = high | 高复杂度任务 |
198
+ | steps >= 3 | 多步骤工作流 |
199
+ | input > 200 chars | 复杂需求描述 |
384
200
 
385
- ```javascript
386
- // 工作流启动时自动创建 TODO 列表
387
- TodoWrite({
388
- todos: [
389
- { content: "CCW: Rapid Iteration (2 steps)", status: "in_progress", activeForm: "Running workflow" },
390
- { content: "[1/2] /workflow:lite-plan", status: "in_progress", activeForm: "Executing lite-plan" },
391
- { content: "[2/2] /workflow:lite-execute", status: "pending", activeForm: "Executing lite-execute" }
392
- ]
393
- })
201
+ CLI 可返回建议:`use_default` | `modify` (调整步骤) | `upgrade` (升级工作流)
394
202
 
395
- // 每个步骤完成后自动更新状态
396
- // 支持暂停、继续、跳过操作
397
- ```
203
+ ## Continuation Commands
204
+
205
+ 工作流执行中的用户控制命令:
206
+
207
+ | 命令 | 作用 |
208
+ |------|------|
209
+ | `continue` | 继续执行下一步 |
210
+ | `skip` | 跳过当前步骤 |
211
+ | `abort` | 终止工作流 |
212
+ | `/workflow:*` | 切换到指定命令 |
213
+ | 自然语言 | 重新分析意图 |
214
+
215
+ ## Workflow Flow Details
216
+
217
+ ### Issue Workflow (两阶段生命周期)
218
+
219
+ Issue 工作流设计为两阶段生命周期,支持在项目迭代过程中积累问题并集中解决。
220
+
221
+ **Phase 1: Accumulation (积累阶段)**
222
+ - 触发:任务完成后的 review、代码审查发现、测试失败
223
+ - 活动:需求扩展、bug 分析、测试覆盖、安全审查
224
+ - 命令:`/issue:discover`, `/issue:discover-by-prompt`, `/issue:new`
225
+
226
+ **Phase 2: Batch Resolution (批量解决阶段)**
227
+ - 触发:积累足够 issue 后的集中处理
228
+ - 流程:plan → queue → execute
229
+ - 命令:`/issue:plan --all-pending` → `/issue:queue` → `/issue:execute`
398
230
 
399
- **进度可视化**:
400
231
  ```
401
- CCW: Rapid Iteration (2 steps)
402
- ✓ [1/2] /workflow:lite-plan
403
- [2/2] /workflow:lite-execute
232
+ 任务完成 discover 积累 issue → ... → plan all → queue → parallel execute
233
+ ↑ ↓
234
+ └────── 迭代循环 ───────┘
404
235
  ```
405
236
 
406
- **控制命令**:
407
- | Input | Action |
408
- |-------|--------|
409
- | `continue` | 执行下一步 |
410
- | `skip` | 跳过当前步骤 |
411
- | `abort` | 停止工作流 |
412
- | `/workflow:*` | 执行指定命令 |
237
+ ### lite-lite-lite vs multi-cli-plan
238
+
239
+ | 维度 | lite-lite-lite | multi-cli-plan |
240
+ |------|---------------|----------------|
241
+ | **产物** | 无文件 | IMPL_PLAN.md + plan.json + synthesis.json |
242
+ | **状态** | 无状态 | 持久化 session |
243
+ | **CLI选择** | 自动分析任务类型选择 | 配置驱动 |
244
+ | **迭代** | 通过 AskUser | 多轮收敛 |
245
+ | **执行** | 直接执行 | 通过 lite-execute |
246
+ | **适用** | 快速修复、简单功能 | 复杂多步骤实现 |
247
+
248
+ **选择指南**:
249
+ - 任务清晰、改动范围小 → `lite-lite-lite`
250
+ - 需要多视角分析、复杂架构 → `multi-cli-plan`
413
251
 
414
- ## Reference Documents
252
+ ### multi-cli-plan vs lite-plan
415
253
 
416
- | Document | Purpose |
417
- |----------|---------|
418
- | [phases/orchestrator.md](phases/orchestrator.md) | 编排器决策逻辑 + TODO 跟踪 |
419
- | [phases/actions/rapid.md](phases/actions/rapid.md) | 快速迭代组合 |
420
- | [phases/actions/full.md](phases/actions/full.md) | 完整流程组合 |
421
- | [phases/actions/coupled.md](phases/actions/coupled.md) | 复杂耦合组合 |
422
- | [phases/actions/bugfix.md](phases/actions/bugfix.md) | 缺陷修复组合 |
423
- | [phases/actions/issue.md](phases/actions/issue.md) | Issue工作流组合 |
424
- | [specs/intent-classification.md](specs/intent-classification.md) | 意图分类规范 |
425
- | [WORKFLOW_DECISION_GUIDE.md](/WORKFLOW_DECISION_GUIDE.md) | 工作流决策指南 |
254
+ | 维度 | multi-cli-plan | lite-plan |
255
+ |------|---------------|-----------|
256
+ | **上下文** | ACE 语义搜索 | 手动文件模式 |
257
+ | **分析** | CLI 交叉验证 | 单次规划 |
258
+ | **迭代** | 多轮直到收敛 | 单轮 |
259
+ | **置信度** | 高 (共识驱动) | (单一视角) |
260
+ | **适用** | 需要多视角的复杂任务 | 直接明确的实现 |
426
261
 
427
- ## Examples
262
+ **选择指南**:
263
+ - 需求明确、路径清晰 → `lite-plan`
264
+ - 需要权衡、多方案比较 → `multi-cli-plan`
265
+
266
+ ## Artifact Flow Protocol
267
+
268
+ 工作流产出的自动流转机制,支持不同格式产出间的意图提取和完成度判断。
269
+
270
+ ### 产出格式
271
+
272
+ | 命令 | 产出位置 | 格式 | 关键字段 |
273
+ |------|----------|------|----------|
274
+ | `/workflow:lite-plan` | memory://plan | structured_plan | tasks, files, dependencies |
275
+ | `/workflow:plan` | .workflow/{session}/IMPL_PLAN.md | markdown_plan | phases, tasks, risks |
276
+ | `/workflow:execute` | execution_log.json | execution_report | completed_tasks, errors |
277
+ | `/workflow:test-cycle-execute` | test_results.json | test_report | pass_rate, failures, coverage |
278
+ | `/workflow:review-session-cycle` | review_report.md | review_report | findings, severity_counts |
279
+
280
+ ### 意图提取 (Intent Extraction)
281
+
282
+ 流转到下一步时,自动提取关键信息:
428
283
 
429
- ### Example 1: Bug Fix
430
284
  ```
431
- User: 用户登录失败,返回 401 错误
432
- CCW: Intent=bugfix, Workflow=lite-fix
433
- → /workflow:lite-fix "用户登录失败,返回 401 错误"
285
+ plan execute:
286
+ 提取: tasks (未完成), priority_order, files_to_modify, context_summary
287
+
288
+ execute → test:
289
+ 提取: modified_files, test_scope (推断), pending_verification
290
+
291
+ test → fix:
292
+ 条件: pass_rate < 0.95
293
+ 提取: failures, error_messages, affected_files, suggested_fixes
294
+
295
+ review → fix:
296
+ 条件: critical > 0 OR high > 3
297
+ 提取: findings (critical/high), fix_priority, affected_files
434
298
  ```
435
299
 
436
- ### Example 2: New Feature (Simple)
300
+ ### 完成度判断
301
+
302
+ **Test 完成度路由**:
437
303
  ```
438
- User: 添加用户头像上传功能
439
- CCW: Intent=feature, Complexity=low, Workflow=lite-planlite-execute
440
- /workflow:lite-plan "添加用户头像上传功能"
304
+ pass_rate >= 0.95 AND coverage >= 0.80 → complete
305
+ pass_rate >= 0.95 AND coverage < 0.80 add_more_tests
306
+ pass_rate >= 0.80 fix_failures_then_continue
307
+ pass_rate < 0.80 → major_fix_required
441
308
  ```
442
309
 
443
- ### Example 3: Complex Refactoring
310
+ **Review 完成度路由**:
444
311
  ```
445
- User: 重构整个认证模块,迁移到 OAuth2
446
- CCW: Intent=feature, Complexity=high, Workflow=plan→verify→execute
447
- /workflow:plan "重构整个认证模块,迁移到 OAuth2"
312
+ critical == 0 AND high <= 3 → complete_or_optional_fix
313
+ critical > 0 → mandatory_fix
314
+ high > 3 → recommended_fix
448
315
  ```
449
316
 
450
- ### Example 4: Exploration
317
+ ### 流转决策模式
318
+
319
+ **plan_execute_test**:
451
320
  ```
452
- User: 我想优化系统性能,但不知道从哪入手
453
- CCW: Intent=exploration, Workflow=brainstorm→plan→execute
454
- /workflow:brainstorm:auto-parallel "探索系统性能优化方向"
321
+ plan → execute → test
322
+ (if test fail)
323
+ extract_failures fix → test (max 3 iterations)
324
+ ↓ (if still fail)
325
+ manual_intervention
455
326
  ```
456
327
 
457
- ### Example 5: Multi-Model Collaboration
328
+ **iterative_improvement**:
458
329
  ```
459
- User: gemini 分析现有架构,然后让 codex 实现优化
460
- CCW: Detects tool preferences, executes in sequence
461
- → Gemini CLI (analysis) → Codex CLI (implementation)
330
+ execute test fix → test → ...
331
+ loop until: pass_rate >= 0.95 OR iterations >= 3
462
332
  ```
333
+
334
+ ### 使用示例
335
+
336
+ ```javascript
337
+ // 执行完成后,根据产出决定下一步
338
+ const result = await execute(plan)
339
+
340
+ // 提取意图流转到测试
341
+ const testContext = extractIntent('execute_to_test', result)
342
+ // testContext = { modified_files, test_scope, pending_verification }
343
+
344
+ // 测试完成后,根据完成度决定路由
345
+ const testResult = await test(testContext)
346
+ const nextStep = evaluateCompletion('test', testResult)
347
+ // nextStep = 'fix_failures_then_continue' if pass_rate = 0.85
348
+ ```
349
+
350
+ ## Reference
351
+
352
+ - [command.json](command.json) - 命令元数据、Flow 定义、意图规则、Artifact Flow