claude-code-workflow 6.3.48 → 6.3.49

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 (211) hide show
  1. package/.claude/CLAUDE.md +6 -8
  2. package/.claude/agents/action-planning-agent.md +28 -45
  3. package/.claude/agents/cli-lite-planning-agent.md +93 -1
  4. package/.claude/agents/code-developer.md +144 -27
  5. package/.claude/commands/ccw-coordinator.md +175 -21
  6. package/.claude/commands/ccw-debug.md +832 -0
  7. package/.claude/commands/ccw.md +90 -9
  8. package/.claude/commands/cli/cli-init.md +1 -0
  9. package/.claude/commands/issue/convert-to-plan.md +718 -0
  10. package/.claude/commands/issue/from-brainstorm.md +382 -0
  11. package/.claude/commands/memory/tips.md +332 -0
  12. package/.claude/commands/workflow/analyze-with-file.md +804 -0
  13. package/.claude/commands/workflow/brainstorm/auto-parallel.md +18 -43
  14. package/.claude/commands/workflow/brainstorm/role-analysis.md +705 -0
  15. package/.claude/commands/workflow/brainstorm-with-file.md +1153 -0
  16. package/.claude/commands/workflow/debug-with-file.md +7 -5
  17. package/.claude/commands/workflow/execute.md +6 -4
  18. package/.claude/commands/workflow/lite-plan.md +2 -2
  19. package/.claude/commands/workflow/plan-verify.md +162 -327
  20. package/.claude/commands/workflow/plan.md +162 -26
  21. package/.claude/commands/workflow/replan.md +78 -2
  22. package/.claude/commands/workflow/{review-fix.md → review-cycle-fix.md} +6 -6
  23. package/.claude/commands/workflow/review-module-cycle.md +2 -2
  24. package/.claude/commands/workflow/review-session-cycle.md +2 -2
  25. package/.claude/commands/workflow/tools/conflict-resolution.md +16 -26
  26. package/.claude/commands/workflow/tools/context-gather.md +81 -118
  27. package/.claude/commands/workflow/tools/task-generate-agent.md +94 -10
  28. package/.claude/skills/ccw-help/command.json +4 -4
  29. package/.claude/skills/lite-skill-generator/SKILL.md +650 -0
  30. package/.claude/skills/lite-skill-generator/templates/simple-skill.md +68 -0
  31. package/.claude/skills/lite-skill-generator/templates/style-guide.md +64 -0
  32. package/.claude/skills/skill-generator/SKILL.md +277 -85
  33. package/.claude/skills/skill-generator/phases/01-requirements-discovery.md +4 -15
  34. package/.claude/skills/skill-generator/phases/02-structure-generation.md +72 -17
  35. package/.claude/skills/skill-generator/phases/03-phase-generation.md +218 -51
  36. package/.claude/skills/skill-generator/phases/04-specs-templates.md +111 -41
  37. package/.claude/skills/skill-generator/phases/05-validation.md +139 -56
  38. package/.claude/skills/skill-generator/templates/autonomous-action.md +78 -268
  39. package/.claude/skills/skill-generator/templates/autonomous-orchestrator.md +14 -0
  40. package/.claude/skills/skill-generator/templates/code-analysis-action.md +12 -0
  41. package/.claude/skills/skill-generator/templates/llm-action.md +12 -0
  42. package/.claude/skills/skill-generator/templates/script-template.md +368 -0
  43. package/.claude/skills/skill-generator/templates/sequential-phase.md +14 -0
  44. package/.claude/skills/skill-generator/templates/skill-md.md +14 -0
  45. package/.claude/skills/skill-tuning/SKILL.md +130 -266
  46. package/.claude/skills/skill-tuning/phases/orchestrator.md +95 -283
  47. package/.claude/skills/skill-tuning/specs/problem-taxonomy.md +90 -198
  48. package/.claude/skills/skill-tuning/specs/tuning-strategies.md +193 -1345
  49. package/.claude/workflows/cli-templates/schemas/plan-verify-agent-schema.json +47 -0
  50. package/.claude/workflows/cli-templates/schemas/verify-json-schema.json +158 -0
  51. package/.claude/workflows/cli-tools-usage.md +1 -1
  52. package/.codex/AGENTS.md +1 -3
  53. package/.codex/prompts/analyze-with-file.md +607 -0
  54. package/.codex/prompts/brainstorm-to-cycle.md +455 -0
  55. package/.codex/prompts/brainstorm-with-file.md +933 -0
  56. package/.codex/prompts/debug-with-file.md +15 -20
  57. package/.codex/skills/ccw-cli-tools/SKILL.md +559 -0
  58. package/ccw/dist/commands/cli.d.ts.map +1 -1
  59. package/ccw/dist/commands/cli.js +29 -5
  60. package/ccw/dist/commands/cli.js.map +1 -1
  61. package/ccw/dist/commands/issue.d.ts +2 -0
  62. package/ccw/dist/commands/issue.d.ts.map +1 -1
  63. package/ccw/dist/commands/issue.js +62 -20
  64. package/ccw/dist/commands/issue.js.map +1 -1
  65. package/ccw/dist/config/litellm-api-config-manager.d.ts.map +1 -1
  66. package/ccw/dist/config/litellm-api-config-manager.js +5 -3
  67. package/ccw/dist/config/litellm-api-config-manager.js.map +1 -1
  68. package/ccw/dist/config/litellm-provider-models.d.ts +73 -0
  69. package/ccw/dist/config/litellm-provider-models.d.ts.map +1 -0
  70. package/ccw/dist/config/litellm-provider-models.js +172 -0
  71. package/ccw/dist/config/litellm-provider-models.js.map +1 -0
  72. package/ccw/dist/config/provider-models.d.ts +25 -51
  73. package/ccw/dist/config/provider-models.d.ts.map +1 -1
  74. package/ccw/dist/config/provider-models.js +84 -149
  75. package/ccw/dist/config/provider-models.js.map +1 -1
  76. package/ccw/dist/config/storage-paths.d.ts.map +1 -1
  77. package/ccw/dist/config/storage-paths.js +23 -5
  78. package/ccw/dist/config/storage-paths.js.map +1 -1
  79. package/ccw/dist/core/auth/csrf-middleware.js +3 -3
  80. package/ccw/dist/core/auth/csrf-middleware.js.map +1 -1
  81. package/ccw/dist/core/dashboard-generator.d.ts.map +1 -1
  82. package/ccw/dist/core/dashboard-generator.js +3 -1
  83. package/ccw/dist/core/dashboard-generator.js.map +1 -1
  84. package/ccw/dist/core/routes/claude-routes.d.ts.map +1 -1
  85. package/ccw/dist/core/routes/claude-routes.js +206 -14
  86. package/ccw/dist/core/routes/claude-routes.js.map +1 -1
  87. package/ccw/dist/core/routes/cli-routes.d.ts.map +1 -1
  88. package/ccw/dist/core/routes/cli-routes.js.map +1 -1
  89. package/ccw/dist/core/routes/commands-routes.d.ts +7 -0
  90. package/ccw/dist/core/routes/commands-routes.d.ts.map +1 -0
  91. package/ccw/dist/core/routes/commands-routes.js +480 -0
  92. package/ccw/dist/core/routes/commands-routes.js.map +1 -0
  93. package/ccw/dist/core/routes/model-routes.d.ts +11 -0
  94. package/ccw/dist/core/routes/model-routes.d.ts.map +1 -0
  95. package/ccw/dist/core/routes/model-routes.js +112 -0
  96. package/ccw/dist/core/routes/model-routes.js.map +1 -0
  97. package/ccw/dist/core/routes/nav-status-routes.d.ts.map +1 -1
  98. package/ccw/dist/core/routes/nav-status-routes.js +84 -1
  99. package/ccw/dist/core/routes/nav-status-routes.js.map +1 -1
  100. package/ccw/dist/core/routes/provider-routes.d.ts +11 -0
  101. package/ccw/dist/core/routes/provider-routes.d.ts.map +1 -0
  102. package/ccw/dist/core/routes/provider-routes.js +67 -0
  103. package/ccw/dist/core/routes/provider-routes.js.map +1 -0
  104. package/ccw/dist/core/routes/skills-routes.d.ts.map +1 -1
  105. package/ccw/dist/core/routes/skills-routes.js +219 -7
  106. package/ccw/dist/core/routes/skills-routes.js.map +1 -1
  107. package/ccw/dist/core/routes/system-routes.d.ts.map +1 -1
  108. package/ccw/dist/core/routes/system-routes.js +58 -6
  109. package/ccw/dist/core/routes/system-routes.js.map +1 -1
  110. package/ccw/dist/core/server.d.ts.map +1 -1
  111. package/ccw/dist/core/server.js +13 -0
  112. package/ccw/dist/core/server.js.map +1 -1
  113. package/ccw/dist/mcp-server/index.js +2 -2
  114. package/ccw/dist/mcp-server/index.js.map +1 -1
  115. package/ccw/dist/tools/claude-cli-tools.d.ts +48 -11
  116. package/ccw/dist/tools/claude-cli-tools.d.ts.map +1 -1
  117. package/ccw/dist/tools/claude-cli-tools.js +146 -50
  118. package/ccw/dist/tools/claude-cli-tools.js.map +1 -1
  119. package/ccw/dist/tools/cli-config-manager.d.ts +1 -13
  120. package/ccw/dist/tools/cli-config-manager.d.ts.map +1 -1
  121. package/ccw/dist/tools/cli-config-manager.js +3 -27
  122. package/ccw/dist/tools/cli-config-manager.js.map +1 -1
  123. package/ccw/dist/tools/cli-executor-core.d.ts.map +1 -1
  124. package/ccw/dist/tools/cli-executor-core.js +7 -2
  125. package/ccw/dist/tools/cli-executor-core.js.map +1 -1
  126. package/ccw/dist/tools/cli-executor-state.d.ts.map +1 -1
  127. package/ccw/dist/tools/cli-history-store.d.ts +11 -0
  128. package/ccw/dist/tools/cli-history-store.d.ts.map +1 -1
  129. package/ccw/dist/tools/cli-history-store.js +82 -2
  130. package/ccw/dist/tools/cli-history-store.js.map +1 -1
  131. package/ccw/dist/tools/command-registry.d.ts +7 -0
  132. package/ccw/dist/tools/command-registry.d.ts.map +1 -1
  133. package/ccw/dist/tools/command-registry.js +14 -1
  134. package/ccw/dist/tools/command-registry.js.map +1 -1
  135. package/ccw/dist/tools/generate-module-docs.d.ts.map +1 -1
  136. package/ccw/dist/tools/generate-module-docs.js +11 -7
  137. package/ccw/dist/tools/generate-module-docs.js.map +1 -1
  138. package/ccw/dist/tools/litellm-executor.d.ts +1 -0
  139. package/ccw/dist/tools/litellm-executor.d.ts.map +1 -1
  140. package/ccw/dist/tools/litellm-executor.js +11 -9
  141. package/ccw/dist/tools/litellm-executor.js.map +1 -1
  142. package/ccw/dist/types/skill-types.d.ts +97 -0
  143. package/ccw/dist/types/skill-types.d.ts.map +1 -0
  144. package/ccw/dist/types/skill-types.js +6 -0
  145. package/ccw/dist/types/skill-types.js.map +1 -0
  146. package/ccw/src/commands/cli.ts +36 -5
  147. package/ccw/src/commands/issue.ts +81 -26
  148. package/ccw/src/config/litellm-api-config-manager.ts +5 -3
  149. package/ccw/src/config/litellm-provider-models.ts +222 -0
  150. package/ccw/src/config/provider-models.ts +91 -190
  151. package/ccw/src/config/storage-paths.ts +20 -5
  152. package/ccw/src/core/auth/csrf-middleware.ts +3 -3
  153. package/ccw/src/core/dashboard-generator.ts +3 -1
  154. package/ccw/src/core/routes/claude-routes.ts +233 -15
  155. package/ccw/src/core/routes/cli-routes.ts +2 -3
  156. package/ccw/src/core/routes/commands-routes.ts +620 -0
  157. package/ccw/src/core/routes/nav-status-routes.ts +95 -1
  158. package/ccw/src/core/routes/provider-routes.ts +78 -0
  159. package/ccw/src/core/routes/skills-routes.ts +266 -45
  160. package/ccw/src/core/routes/system-routes.ts +102 -50
  161. package/ccw/src/core/server.ts +13 -0
  162. package/ccw/src/mcp-server/index.ts +2 -2
  163. package/ccw/src/templates/dashboard-css/18-cli-settings.css +35 -0
  164. package/ccw/src/templates/dashboard-css/37-commands.css +193 -0
  165. package/ccw/src/templates/dashboard-js/components/navigation.js +4 -0
  166. package/ccw/src/templates/dashboard-js/i18n.js +116 -0
  167. package/ccw/src/templates/dashboard-js/views/cli-manager.js +249 -4
  168. package/ccw/src/templates/dashboard-js/views/commands-manager.js +503 -0
  169. package/ccw/src/templates/dashboard-js/views/issue-manager.js +7 -7
  170. package/ccw/src/templates/dashboard-js/views/mcp-manager.js +2 -7
  171. package/ccw/src/templates/dashboard-js/views/skills-manager.js +164 -23
  172. package/ccw/src/templates/dashboard.html +7 -0
  173. package/ccw/src/tools/claude-cli-tools.ts +170 -56
  174. package/ccw/src/tools/cli-config-manager.ts +2 -33
  175. package/ccw/src/tools/cli-executor-core.ts +8 -2
  176. package/ccw/src/tools/cli-history-store.ts +92 -2
  177. package/ccw/src/tools/command-registry.ts +16 -1
  178. package/ccw/src/tools/generate-module-docs.ts +11 -7
  179. package/ccw/src/tools/litellm-executor.ts +13 -9
  180. package/ccw/src/types/skill-types.ts +99 -0
  181. package/package.json +1 -1
  182. package/.claude/commands/enhance-prompt.md +0 -93
  183. package/.claude/commands/memory/code-map-memory.md +0 -687
  184. package/.claude/commands/memory/docs.md +0 -615
  185. package/.claude/commands/memory/load-skill-memory.md +0 -182
  186. package/.claude/commands/memory/skill-memory.md +0 -525
  187. package/.claude/commands/memory/swagger-docs.md +0 -773
  188. package/.claude/commands/memory/tech-research-rules.md +0 -310
  189. package/.claude/commands/memory/workflow-skill-memory.md +0 -517
  190. package/.claude/commands/task/breakdown.md +0 -208
  191. package/.claude/commands/task/create.md +0 -152
  192. package/.claude/commands/task/execute.md +0 -270
  193. package/.claude/commands/task/replan.md +0 -441
  194. package/.claude/commands/version.md +0 -254
  195. package/.claude/commands/workflow/action-plan-verify.md +0 -485
  196. package/.claude/commands/workflow/brainstorm/api-designer.md +0 -587
  197. package/.claude/commands/workflow/brainstorm/data-architect.md +0 -220
  198. package/.claude/commands/workflow/brainstorm/product-manager.md +0 -200
  199. package/.claude/commands/workflow/brainstorm/product-owner.md +0 -200
  200. package/.claude/commands/workflow/brainstorm/scrum-master.md +0 -200
  201. package/.claude/commands/workflow/brainstorm/subject-matter-expert.md +0 -200
  202. package/.claude/commands/workflow/brainstorm/system-architect.md +0 -389
  203. package/.claude/commands/workflow/brainstorm/ui-designer.md +0 -221
  204. package/.claude/commands/workflow/brainstorm/ux-expert.md +0 -221
  205. package/.claude/commands/workflow/debug.md +0 -331
  206. package/.claude/commands/workflow/develop-with-file.md +0 -1044
  207. package/.claude/skills/ccw-loop/README.md +0 -303
  208. package/.claude/skills/skill-generator/templates/script-bash.md +0 -277
  209. package/.claude/skills/skill-generator/templates/script-python.md +0 -198
  210. package/.codex/prompts/debug.md +0 -318
  211. package/ccw/src/core/routes/mcp-routes.ts.backup +0 -549
@@ -0,0 +1,804 @@
1
+ ---
2
+ name: analyze-with-file
3
+ description: Interactive collaborative analysis with documented discussions, CLI-assisted exploration, and evolving understanding
4
+ argument-hint: "[-y|--yes] [-c|--continue] \"topic or question\""
5
+ allowed-tools: TodoWrite(*), Task(*), AskUserQuestion(*), Read(*), Grep(*), Glob(*), Bash(*), Edit(*), Write(*)
6
+ ---
7
+
8
+ ## Auto Mode
9
+
10
+ When `--yes` or `-y`: Auto-confirm exploration decisions, use recommended analysis angles.
11
+
12
+ # Workflow Analyze-With-File Command (/workflow:analyze-with-file)
13
+
14
+ ## Overview
15
+
16
+ Interactive collaborative analysis workflow with **documented discussion process**. Records understanding evolution, facilitates multi-round Q&A, and uses CLI tools (Gemini/Codex) for deep exploration.
17
+
18
+ **Core workflow**: Topic → Explore → Discuss → Document → Refine → Conclude
19
+
20
+ **Key features**:
21
+ - **discussion.md**: Timeline of discussions and understanding evolution
22
+ - **Multi-round Q&A**: Iterative clarification with user
23
+ - **CLI-assisted exploration**: Gemini/Codex for codebase and concept analysis
24
+ - **Consolidated insights**: Synthesizes discussions into actionable conclusions
25
+ - **Flexible continuation**: Resume analysis sessions to build on previous work
26
+
27
+ ## Usage
28
+
29
+ ```bash
30
+ /workflow:analyze-with-file [FLAGS] <TOPIC_OR_QUESTION>
31
+
32
+ # Flags
33
+ -y, --yes Skip confirmations, use recommended settings
34
+ -c, --continue Continue existing session (auto-detected if exists)
35
+
36
+ # Arguments
37
+ <topic-or-question> Analysis topic, question, or concept to explore (required)
38
+
39
+ # Examples
40
+ /workflow:analyze-with-file "如何优化这个项目的认证架构"
41
+ /workflow:analyze-with-file --continue "认证架构" # Continue existing session
42
+ /workflow:analyze-with-file -y "性能瓶颈分析" # Auto mode
43
+ ```
44
+
45
+ ## Execution Process
46
+
47
+ ```
48
+ Session Detection:
49
+ ├─ Check if analysis session exists for topic
50
+ ├─ EXISTS + discussion.md exists → Continue mode
51
+ └─ NOT_FOUND → New session mode
52
+
53
+ Phase 1: Topic Understanding
54
+ ├─ Parse topic/question
55
+ ├─ Identify analysis dimensions (architecture, implementation, concept, etc.)
56
+ ├─ Initial scoping with user (AskUserQuestion)
57
+ └─ Document initial understanding in discussion.md
58
+
59
+ Phase 2: CLI Exploration (Parallel)
60
+ ├─ Launch cli-explore-agent for codebase context
61
+ ├─ Use Gemini/Codex for deep analysis
62
+ └─ Aggregate findings into exploration summary
63
+
64
+ Phase 3: Interactive Discussion (Multi-Round)
65
+ ├─ Present exploration findings
66
+ ├─ Facilitate Q&A with user (AskUserQuestion)
67
+ ├─ Capture user insights and requirements
68
+ ├─ Update discussion.md with each round
69
+ └─ Repeat until user is satisfied or clarity achieved
70
+
71
+ Phase 4: Synthesis & Conclusion
72
+ ├─ Consolidate all insights
73
+ ├─ Update discussion.md with conclusions
74
+ ├─ Generate actionable recommendations
75
+ └─ Optional: Create follow-up tasks or issues
76
+
77
+ Output:
78
+ ├─ .workflow/.analysis/{slug}-{date}/discussion.md (evolving document)
79
+ ├─ .workflow/.analysis/{slug}-{date}/explorations.json (CLI findings)
80
+ └─ .workflow/.analysis/{slug}-{date}/conclusions.json (final synthesis)
81
+ ```
82
+
83
+ ## Implementation
84
+
85
+ ### Session Setup & Mode Detection
86
+
87
+ ```javascript
88
+ const getUtc8ISOString = () => new Date(Date.now() + 8 * 60 * 60 * 1000).toISOString()
89
+
90
+ const topicSlug = topic_or_question.toLowerCase().replace(/[^a-z0-9\u4e00-\u9fa5]+/g, '-').substring(0, 40)
91
+ const dateStr = getUtc8ISOString().substring(0, 10)
92
+
93
+ const sessionId = `ANL-${topicSlug}-${dateStr}`
94
+ const sessionFolder = `.workflow/.analysis/${sessionId}`
95
+ const discussionPath = `${sessionFolder}/discussion.md`
96
+ const explorationsPath = `${sessionFolder}/explorations.json`
97
+ const conclusionsPath = `${sessionFolder}/conclusions.json`
98
+
99
+ // Auto-detect mode
100
+ const sessionExists = fs.existsSync(sessionFolder)
101
+ const hasDiscussion = sessionExists && fs.existsSync(discussionPath)
102
+ const forcesContinue = $ARGUMENTS.includes('--continue') || $ARGUMENTS.includes('-c')
103
+
104
+ const mode = (hasDiscussion || forcesContinue) ? 'continue' : 'new'
105
+
106
+ if (!sessionExists) {
107
+ bash(`mkdir -p ${sessionFolder}`)
108
+ }
109
+ ```
110
+
111
+ ---
112
+
113
+ ### Phase 1: Topic Understanding
114
+
115
+ **Step 1.1: Parse Topic & Identify Dimensions**
116
+
117
+ ```javascript
118
+ // Analyze topic to determine analysis dimensions
119
+ const ANALYSIS_DIMENSIONS = {
120
+ architecture: ['架构', 'architecture', 'design', 'structure', '设计'],
121
+ implementation: ['实现', 'implement', 'code', 'coding', '代码'],
122
+ performance: ['性能', 'performance', 'optimize', 'bottleneck', '优化'],
123
+ security: ['安全', 'security', 'auth', 'permission', '权限'],
124
+ concept: ['概念', 'concept', 'theory', 'principle', '原理'],
125
+ comparison: ['比较', 'compare', 'vs', 'difference', '区别'],
126
+ decision: ['决策', 'decision', 'choice', 'tradeoff', '选择']
127
+ }
128
+
129
+ function identifyDimensions(topic) {
130
+ const text = topic.toLowerCase()
131
+ const matched = []
132
+
133
+ for (const [dimension, keywords] of Object.entries(ANALYSIS_DIMENSIONS)) {
134
+ if (keywords.some(k => text.includes(k))) {
135
+ matched.push(dimension)
136
+ }
137
+ }
138
+
139
+ return matched.length > 0 ? matched : ['general']
140
+ }
141
+
142
+ const dimensions = identifyDimensions(topic_or_question)
143
+ ```
144
+
145
+ **Step 1.2: Initial Scoping (New Session Only)**
146
+
147
+ ```javascript
148
+ const autoYes = $ARGUMENTS.includes('--yes') || $ARGUMENTS.includes('-y')
149
+
150
+ if (mode === 'new' && !autoYes) {
151
+ // Ask user to scope the analysis
152
+ AskUserQuestion({
153
+ questions: [
154
+ {
155
+ question: `分析范围: "${topic_or_question}"\n\n您想重点关注哪些方面?`,
156
+ header: "Focus",
157
+ multiSelect: true,
158
+ options: [
159
+ { label: "代码实现", description: "分析现有代码实现" },
160
+ { label: "架构设计", description: "架构层面的分析" },
161
+ { label: "最佳实践", description: "行业最佳实践对比" },
162
+ { label: "问题诊断", description: "识别潜在问题" }
163
+ ]
164
+ },
165
+ {
166
+ question: "分析深度?",
167
+ header: "Depth",
168
+ multiSelect: false,
169
+ options: [
170
+ { label: "Quick Overview", description: "快速概览 (10-15分钟)" },
171
+ { label: "Standard Analysis", description: "标准分析 (30-60分钟)" },
172
+ { label: "Deep Dive", description: "深度分析 (1-2小时)" }
173
+ ]
174
+ }
175
+ ]
176
+ })
177
+ }
178
+ ```
179
+
180
+ **Step 1.3: Create/Update discussion.md**
181
+
182
+ For new session:
183
+ ```markdown
184
+ # Analysis Discussion
185
+
186
+ **Session ID**: ${sessionId}
187
+ **Topic**: ${topic_or_question}
188
+ **Started**: ${getUtc8ISOString()}
189
+ **Dimensions**: ${dimensions.join(', ')}
190
+
191
+ ---
192
+
193
+ ## User Context
194
+
195
+ **Focus Areas**: ${userFocusAreas.join(', ')}
196
+ **Analysis Depth**: ${analysisDepth}
197
+
198
+ ---
199
+
200
+ ## Discussion Timeline
201
+
202
+ ### Round 1 - Initial Understanding (${timestamp})
203
+
204
+ #### Topic Analysis
205
+
206
+ Based on the topic "${topic_or_question}":
207
+
208
+ - **Primary dimensions**: ${dimensions.join(', ')}
209
+ - **Initial scope**: ${initialScope}
210
+ - **Key questions to explore**:
211
+ - ${question1}
212
+ - ${question2}
213
+ - ${question3}
214
+
215
+ #### Next Steps
216
+
217
+ - Launch CLI exploration for codebase context
218
+ - Gather external insights via Gemini
219
+ - Prepare discussion points for user
220
+
221
+ ---
222
+
223
+ ## Current Understanding
224
+
225
+ ${initialUnderstanding}
226
+ ```
227
+
228
+ For continue session, append:
229
+ ```markdown
230
+ ### Round ${n} - Continuation (${timestamp})
231
+
232
+ #### Previous Context
233
+
234
+ Resuming analysis based on prior discussion.
235
+
236
+ #### New Focus
237
+
238
+ ${newFocusFromUser}
239
+ ```
240
+
241
+ ---
242
+
243
+ ### Phase 2: CLI Exploration
244
+
245
+ **Step 2.1: Launch Parallel Explorations**
246
+
247
+ ```javascript
248
+ const explorationPromises = []
249
+
250
+ // CLI Explore Agent for codebase
251
+ if (dimensions.includes('implementation') || dimensions.includes('architecture')) {
252
+ explorationPromises.push(
253
+ Task(
254
+ subagent_type="cli-explore-agent",
255
+ run_in_background=false,
256
+ description=`Explore codebase: ${topicSlug}`,
257
+ prompt=`
258
+ ## Analysis Context
259
+ Topic: ${topic_or_question}
260
+ Dimensions: ${dimensions.join(', ')}
261
+ Session: ${sessionFolder}
262
+
263
+ ## MANDATORY FIRST STEPS
264
+ 1. Run: ccw tool exec get_modules_by_depth '{}'
265
+ 2. Execute relevant searches based on topic keywords
266
+ 3. Read: .workflow/project-tech.json (if exists)
267
+
268
+ ## Exploration Focus
269
+ ${dimensions.map(d => `- ${d}: Identify relevant code patterns and structures`).join('\n')}
270
+
271
+ ## Output
272
+ Write findings to: ${sessionFolder}/exploration-codebase.json
273
+
274
+ Schema:
275
+ {
276
+ "relevant_files": [{path, relevance, rationale}],
277
+ "patterns": [],
278
+ "key_findings": [],
279
+ "questions_for_user": [],
280
+ "_metadata": { "exploration_type": "codebase", "timestamp": "..." }
281
+ }
282
+ `
283
+ )
284
+ )
285
+ }
286
+
287
+ // Gemini CLI for deep analysis
288
+ explorationPromises.push(
289
+ Bash({
290
+ command: `ccw cli -p "
291
+ PURPOSE: Analyze topic '${topic_or_question}' from ${dimensions.join(', ')} perspectives
292
+ Success criteria: Actionable insights with clear reasoning
293
+
294
+ TASK:
295
+ • Identify key considerations for this topic
296
+ • Analyze common patterns and anti-patterns
297
+ • Highlight potential issues or opportunities
298
+ • Generate discussion points for user clarification
299
+
300
+ MODE: analysis
301
+
302
+ CONTEXT: @**/* | Topic: ${topic_or_question}
303
+
304
+ EXPECTED:
305
+ - Structured analysis with clear sections
306
+ - Specific insights tied to evidence
307
+ - Questions to deepen understanding
308
+ - Recommendations with rationale
309
+
310
+ CONSTRAINTS: Focus on ${dimensions.join(', ')}
311
+ " --tool gemini --mode analysis`,
312
+ run_in_background: true
313
+ })
314
+ )
315
+ ```
316
+
317
+ **Step 2.2: Aggregate Findings**
318
+
319
+ ```javascript
320
+ // After explorations complete, aggregate into explorations.json
321
+ const explorations = {
322
+ session_id: sessionId,
323
+ timestamp: getUtc8ISOString(),
324
+ topic: topic_or_question,
325
+ dimensions: dimensions,
326
+ sources: [
327
+ { type: "codebase", file: "exploration-codebase.json" },
328
+ { type: "gemini", summary: geminiOutput }
329
+ ],
330
+ key_findings: [...],
331
+ discussion_points: [...],
332
+ open_questions: [...]
333
+ }
334
+
335
+ Write(explorationsPath, JSON.stringify(explorations, null, 2))
336
+ ```
337
+
338
+ **Step 2.3: Update discussion.md**
339
+
340
+ ```markdown
341
+ #### Exploration Results (${timestamp})
342
+
343
+ **Sources Analyzed**:
344
+ ${sources.map(s => `- ${s.type}: ${s.summary}`).join('\n')}
345
+
346
+ **Key Findings**:
347
+ ${keyFindings.map((f, i) => `${i+1}. ${f}`).join('\n')}
348
+
349
+ **Points for Discussion**:
350
+ ${discussionPoints.map((p, i) => `${i+1}. ${p}`).join('\n')}
351
+
352
+ **Open Questions**:
353
+ ${openQuestions.map((q, i) => `- ${q}`).join('\n')}
354
+ ```
355
+
356
+ ---
357
+
358
+ ### Phase 3: Interactive Discussion (Multi-Round)
359
+
360
+ **Step 3.1: Present Findings & Gather Feedback**
361
+
362
+ ```javascript
363
+ // Maximum discussion rounds
364
+ const MAX_ROUNDS = 5
365
+ let roundNumber = 1
366
+ let discussionComplete = false
367
+
368
+ while (!discussionComplete && roundNumber <= MAX_ROUNDS) {
369
+ // Display current findings
370
+ console.log(`
371
+ ## Discussion Round ${roundNumber}
372
+
373
+ ${currentFindings}
374
+
375
+ ### Key Points for Your Input
376
+ ${discussionPoints.map((p, i) => `${i+1}. ${p}`).join('\n')}
377
+ `)
378
+
379
+ // Gather user input
380
+ const userResponse = AskUserQuestion({
381
+ questions: [
382
+ {
383
+ question: "对以上分析有什么看法或补充?",
384
+ header: "Feedback",
385
+ multiSelect: false,
386
+ options: [
387
+ { label: "同意,继续深入", description: "分析方向正确,继续探索" },
388
+ { label: "需要调整方向", description: "我有不同的理解或重点" },
389
+ { label: "分析完成", description: "已获得足够信息" },
390
+ { label: "有具体问题", description: "我想问一些具体问题" }
391
+ ]
392
+ }
393
+ ]
394
+ })
395
+
396
+ // Process user response
397
+ switch (userResponse.feedback) {
398
+ case "同意,继续深入":
399
+ // Deepen analysis in current direction
400
+ await deepenAnalysis()
401
+ break
402
+ case "需要调整方向":
403
+ // Get user's adjusted focus
404
+ const adjustment = AskUserQuestion({
405
+ questions: [{
406
+ question: "请说明您希望调整的方向或重点:",
407
+ header: "Direction",
408
+ multiSelect: false,
409
+ options: [
410
+ { label: "更多代码细节", description: "深入代码实现" },
411
+ { label: "更多架构视角", description: "关注整体设计" },
412
+ { label: "更多实践对比", description: "对比最佳实践" }
413
+ ]
414
+ }]
415
+ })
416
+ await adjustAnalysisDirection(adjustment)
417
+ break
418
+ case "分析完成":
419
+ discussionComplete = true
420
+ break
421
+ case "有具体问题":
422
+ // Let user ask specific questions, then answer
423
+ await handleUserQuestions()
424
+ break
425
+ }
426
+
427
+ // Update discussion.md with this round
428
+ updateDiscussionDocument(roundNumber, userResponse, findings)
429
+ roundNumber++
430
+ }
431
+ ```
432
+
433
+ **Step 3.2: Document Each Round**
434
+
435
+ Append to discussion.md:
436
+ ```markdown
437
+ ### Round ${n} - Discussion (${timestamp})
438
+
439
+ #### User Input
440
+
441
+ ${userInputSummary}
442
+
443
+ ${userResponse === 'adjustment' ? `
444
+ **Direction Adjustment**: ${adjustmentDetails}
445
+ ` : ''}
446
+
447
+ ${userResponse === 'questions' ? `
448
+ **User Questions**:
449
+ ${userQuestions.map((q, i) => `${i+1}. ${q}`).join('\n')}
450
+
451
+ **Answers**:
452
+ ${answers.map((a, i) => `${i+1}. ${a}`).join('\n')}
453
+ ` : ''}
454
+
455
+ #### Updated Understanding
456
+
457
+ Based on user feedback:
458
+ - ${insight1}
459
+ - ${insight2}
460
+
461
+ #### Corrected Assumptions
462
+
463
+ ${corrections.length > 0 ? corrections.map(c => `
464
+ - ~~${c.wrong}~~ → ${c.corrected}
465
+ - Reason: ${c.reason}
466
+ `).join('\n') : 'None'}
467
+
468
+ #### New Insights
469
+
470
+ ${newInsights.map(i => `- ${i}`).join('\n')}
471
+ ```
472
+
473
+ ---
474
+
475
+ ### Phase 4: Synthesis & Conclusion
476
+
477
+ **Step 4.1: Consolidate Insights**
478
+
479
+ ```javascript
480
+ const conclusions = {
481
+ session_id: sessionId,
482
+ topic: topic_or_question,
483
+ completed: getUtc8ISOString(),
484
+ total_rounds: roundNumber,
485
+
486
+ summary: "...",
487
+
488
+ key_conclusions: [
489
+ { point: "...", evidence: "...", confidence: "high|medium|low" }
490
+ ],
491
+
492
+ recommendations: [
493
+ { action: "...", rationale: "...", priority: "high|medium|low" }
494
+ ],
495
+
496
+ open_questions: [...],
497
+
498
+ follow_up_suggestions: [
499
+ { type: "issue", summary: "..." },
500
+ { type: "task", summary: "..." }
501
+ ]
502
+ }
503
+
504
+ Write(conclusionsPath, JSON.stringify(conclusions, null, 2))
505
+ ```
506
+
507
+ **Step 4.2: Final discussion.md Update**
508
+
509
+ ```markdown
510
+ ---
511
+
512
+ ## Conclusions (${timestamp})
513
+
514
+ ### Summary
515
+
516
+ ${summaryParagraph}
517
+
518
+ ### Key Conclusions
519
+
520
+ ${conclusions.key_conclusions.map((c, i) => `
521
+ ${i+1}. **${c.point}** (Confidence: ${c.confidence})
522
+ - Evidence: ${c.evidence}
523
+ `).join('\n')}
524
+
525
+ ### Recommendations
526
+
527
+ ${conclusions.recommendations.map((r, i) => `
528
+ ${i+1}. **${r.action}** (Priority: ${r.priority})
529
+ - Rationale: ${r.rationale}
530
+ `).join('\n')}
531
+
532
+ ### Remaining Questions
533
+
534
+ ${conclusions.open_questions.map(q => `- ${q}`).join('\n')}
535
+
536
+ ---
537
+
538
+ ## Current Understanding (Final)
539
+
540
+ ### What We Established
541
+
542
+ ${establishedPoints.map(p => `- ${p}`).join('\n')}
543
+
544
+ ### What Was Clarified/Corrected
545
+
546
+ ${corrections.map(c => `- ~~${c.original}~~ → ${c.corrected}`).join('\n')}
547
+
548
+ ### Key Insights
549
+
550
+ ${keyInsights.map(i => `- ${i}`).join('\n')}
551
+
552
+ ---
553
+
554
+ ## Session Statistics
555
+
556
+ - **Total Rounds**: ${totalRounds}
557
+ - **Duration**: ${duration}
558
+ - **Sources Used**: ${sources.join(', ')}
559
+ - **Artifacts Generated**: discussion.md, explorations.json, conclusions.json
560
+ ```
561
+
562
+ **Step 4.3: Post-Completion Options**
563
+
564
+ ```javascript
565
+ AskUserQuestion({
566
+ questions: [{
567
+ question: "分析完成。是否需要后续操作?",
568
+ header: "Next Steps",
569
+ multiSelect: true,
570
+ options: [
571
+ { label: "创建Issue", description: "将结论转为可执行的Issue" },
572
+ { label: "生成任务", description: "创建实施任务" },
573
+ { label: "导出报告", description: "生成独立的分析报告" },
574
+ { label: "完成", description: "不需要后续操作" }
575
+ ]
576
+ }]
577
+ })
578
+
579
+ // Handle selections
580
+ if (selection.includes("创建Issue")) {
581
+ SlashCommand("/issue:new", `${topic_or_question} - 分析结论实施`)
582
+ }
583
+ if (selection.includes("生成任务")) {
584
+ SlashCommand("/workflow:lite-plan", `实施分析结论: ${summary}`)
585
+ }
586
+ if (selection.includes("导出报告")) {
587
+ exportAnalysisReport(sessionFolder)
588
+ }
589
+ ```
590
+
591
+ ---
592
+
593
+ ## Session Folder Structure
594
+
595
+ ```
596
+ .workflow/.analysis/ANL-{slug}-{date}/
597
+ ├── discussion.md # Evolution of understanding & discussions
598
+ ├── explorations.json # CLI exploration findings
599
+ ├── conclusions.json # Final synthesis
600
+ └── exploration-*.json # Individual exploration results (optional)
601
+ ```
602
+
603
+ ## Discussion Document Template
604
+
605
+ ```markdown
606
+ # Analysis Discussion
607
+
608
+ **Session ID**: ANL-xxx-2025-01-25
609
+ **Topic**: [topic or question]
610
+ **Started**: 2025-01-25T10:00:00+08:00
611
+ **Dimensions**: [architecture, implementation, ...]
612
+
613
+ ---
614
+
615
+ ## User Context
616
+
617
+ **Focus Areas**: [user-selected focus]
618
+ **Analysis Depth**: [quick|standard|deep]
619
+
620
+ ---
621
+
622
+ ## Discussion Timeline
623
+
624
+ ### Round 1 - Initial Understanding (2025-01-25 10:00)
625
+
626
+ #### Topic Analysis
627
+ ...
628
+
629
+ #### Exploration Results
630
+ ...
631
+
632
+ ### Round 2 - Discussion (2025-01-25 10:15)
633
+
634
+ #### User Input
635
+ ...
636
+
637
+ #### Updated Understanding
638
+ ...
639
+
640
+ #### Corrected Assumptions
641
+ - ~~[wrong]~~ → [corrected]
642
+
643
+ ### Round 3 - Deep Dive (2025-01-25 10:30)
644
+ ...
645
+
646
+ ---
647
+
648
+ ## Conclusions (2025-01-25 11:00)
649
+
650
+ ### Summary
651
+ ...
652
+
653
+ ### Key Conclusions
654
+ ...
655
+
656
+ ### Recommendations
657
+ ...
658
+
659
+ ---
660
+
661
+ ## Current Understanding (Final)
662
+
663
+ ### What We Established
664
+ - [confirmed points]
665
+
666
+ ### What Was Clarified/Corrected
667
+ - ~~[original assumption]~~ → [corrected understanding]
668
+
669
+ ### Key Insights
670
+ - [insights gained]
671
+
672
+ ---
673
+
674
+ ## Session Statistics
675
+
676
+ - **Total Rounds**: 3
677
+ - **Duration**: 1 hour
678
+ - **Sources Used**: codebase exploration, Gemini analysis
679
+ - **Artifacts Generated**: discussion.md, explorations.json, conclusions.json
680
+ ```
681
+
682
+ ## Iteration Flow
683
+
684
+ ```
685
+ First Call (/workflow:analyze-with-file "topic"):
686
+ ├─ No session exists → New mode
687
+ ├─ Identify analysis dimensions
688
+ ├─ Scope with user (unless --yes)
689
+ ├─ Create discussion.md with initial understanding
690
+ ├─ Launch CLI explorations
691
+ └─ Enter discussion loop
692
+
693
+ Continue Call (/workflow:analyze-with-file --continue "topic"):
694
+ ├─ Session exists → Continue mode
695
+ ├─ Load discussion.md
696
+ ├─ Resume from last round
697
+ └─ Continue discussion loop
698
+
699
+ Discussion Loop:
700
+ ├─ Present current findings
701
+ ├─ Gather user feedback (AskUserQuestion)
702
+ ├─ Process response:
703
+ │ ├─ Agree → Deepen analysis
704
+ │ ├─ Adjust → Change direction
705
+ │ ├─ Question → Answer then continue
706
+ │ └─ Complete → Exit loop
707
+ ├─ Update discussion.md
708
+ └─ Repeat until complete or max rounds
709
+
710
+ Completion:
711
+ ├─ Generate conclusions.json
712
+ ├─ Update discussion.md with final synthesis
713
+ └─ Offer follow-up options (issue, task, report)
714
+ ```
715
+
716
+ ## CLI Integration Points
717
+
718
+ ### 1. Codebase Exploration (cli-explore-agent)
719
+
720
+ **Purpose**: Gather relevant code context
721
+
722
+ **When**: Topic involves implementation or architecture analysis
723
+
724
+ ### 2. Gemini Deep Analysis
725
+
726
+ **Purpose**: Conceptual analysis, pattern identification, best practices
727
+
728
+ **Prompt Pattern**:
729
+ ```
730
+ PURPOSE: Analyze topic + identify insights
731
+ TASK: Explore dimensions + generate discussion points
732
+ CONTEXT: Codebase + topic
733
+ EXPECTED: Structured analysis + questions
734
+ ```
735
+
736
+ ### 3. Follow-up CLI Calls
737
+
738
+ **Purpose**: Deepen specific areas based on user feedback
739
+
740
+ **Dynamic invocation** based on discussion direction
741
+
742
+ ## Consolidation Rules
743
+
744
+ When updating "Current Understanding":
745
+
746
+ 1. **Promote confirmed insights**: Move validated findings to "What We Established"
747
+ 2. **Track corrections**: Keep important wrong→right transformations
748
+ 3. **Focus on current state**: What do we know NOW
749
+ 4. **Avoid timeline repetition**: Don't copy discussion details
750
+ 5. **Preserve key learnings**: Keep insights valuable for future reference
751
+
752
+ **Bad (cluttered)**:
753
+ ```markdown
754
+ ## Current Understanding
755
+
756
+ In round 1 we discussed X, then in round 2 user said Y, and we explored Z...
757
+ ```
758
+
759
+ **Good (consolidated)**:
760
+ ```markdown
761
+ ## Current Understanding
762
+
763
+ ### What We Established
764
+ - The authentication flow uses JWT with refresh tokens
765
+ - Rate limiting is implemented at API gateway level
766
+
767
+ ### What Was Clarified
768
+ - ~~Assumed Redis for sessions~~ → Actually uses database-backed sessions
769
+
770
+ ### Key Insights
771
+ - Current architecture supports horizontal scaling
772
+ - Security audit recommended before production
773
+ ```
774
+
775
+ ## Error Handling
776
+
777
+ | Situation | Action |
778
+ |-----------|--------|
779
+ | CLI exploration fails | Continue with available context, note limitation |
780
+ | User timeout in discussion | Save state, show resume command |
781
+ | Max rounds reached | Force synthesis, offer continuation option |
782
+ | No relevant findings | Broaden search, ask user for clarification |
783
+ | Session folder conflict | Append timestamp suffix |
784
+ | Gemini unavailable | Fallback to Codex or manual analysis |
785
+
786
+
787
+ ## Usage Recommendations
788
+
789
+ Use `/workflow:analyze-with-file` when:
790
+ - Exploring a complex topic collaboratively
791
+ - Need documented discussion trail
792
+ - Decision-making requires multiple perspectives
793
+ - Want to iterate on understanding with user input
794
+ - Building shared understanding before implementation
795
+
796
+ Use `/workflow:debug-with-file` when:
797
+ - Diagnosing specific bugs
798
+ - Need hypothesis-driven investigation
799
+ - Focus on evidence and verification
800
+
801
+ Use `/workflow:lite-plan` when:
802
+ - Ready to implement (past analysis phase)
803
+ - Need structured task breakdown
804
+ - Focus on execution planning