claude-code-workflow 7.2.23 → 7.2.25

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 (212) hide show
  1. package/.ccw/workflows/cli-tools-usage.md +123 -521
  2. package/.claude/skills/brainstorm/SKILL.md +408 -408
  3. package/.claude/skills/review-cycle/SKILL.md +132 -132
  4. package/.claude/skills/spec-generator/SKILL.md +1 -1
  5. package/.claude/skills/team-designer/phases/02-scaffold-generation.md +1 -1
  6. package/.claude/skills/team-lifecycle-v4/SKILL.md +1 -1
  7. package/.claude/skills/team-review/SKILL.md +1 -1
  8. package/.claude/skills/team-ultra-analyze/SKILL.md +1 -1
  9. package/.claude/skills/workflow-multi-cli-plan/SKILL.md +1 -1
  10. package/.claude/skills/workflow-plan/SKILL.md +1 -1
  11. package/.claude/skills/workflow-test-fix/SKILL.md +1 -1
  12. package/.codex/skills/analyze-with-file/SKILL.md +966 -966
  13. package/.codex/skills/issue-discover/SKILL.md +361 -361
  14. package/.codex/skills/review-cycle/SKILL.md +1 -1
  15. package/.codex/skills/roadmap-with-file/SKILL.md +901 -901
  16. package/.codex/skills/spec-generator/SKILL.md +425 -425
  17. package/.codex/skills/spec-setup/SKILL.md +669 -669
  18. package/.codex/skills/team-arch-opt/SKILL.md +242 -175
  19. package/.codex/skills/team-arch-opt/roles/analyzer/role.md +78 -78
  20. package/.codex/skills/team-arch-opt/roles/coordinator/commands/analyze.md +57 -57
  21. package/.codex/skills/team-arch-opt/roles/coordinator/commands/monitor.md +246 -204
  22. package/.codex/skills/team-arch-opt/roles/coordinator/role.md +196 -184
  23. package/.codex/skills/team-arch-opt/roles/designer/role.md +115 -115
  24. package/.codex/skills/team-arch-opt/roles/refactorer/role.md +102 -102
  25. package/.codex/skills/team-arch-opt/roles/reviewer/role.md +111 -111
  26. package/.codex/skills/team-arch-opt/roles/validator/role.md +115 -115
  27. package/.codex/skills/team-arch-opt/specs/pipelines.md +102 -102
  28. package/.codex/skills/team-brainstorm/SKILL.md +72 -4
  29. package/.codex/skills/team-brainstorm/roles/challenger/role.md +61 -61
  30. package/.codex/skills/team-brainstorm/roles/coordinator/commands/analyze.md +58 -58
  31. package/.codex/skills/team-brainstorm/roles/coordinator/commands/monitor.md +212 -171
  32. package/.codex/skills/team-brainstorm/roles/coordinator/role.md +172 -160
  33. package/.codex/skills/team-brainstorm/roles/evaluator/role.md +56 -56
  34. package/.codex/skills/team-brainstorm/roles/ideator/role.md +69 -69
  35. package/.codex/skills/team-brainstorm/roles/synthesizer/role.md +57 -57
  36. package/.codex/skills/team-brainstorm/specs/pipelines.md +72 -72
  37. package/.codex/skills/team-coordinate/SKILL.md +71 -3
  38. package/.codex/skills/team-coordinate/roles/coordinator/commands/monitor.md +45 -5
  39. package/.codex/skills/team-coordinate/roles/coordinator/role.md +402 -389
  40. package/.codex/skills/team-coordinate/specs/knowledge-transfer.md +111 -111
  41. package/.codex/skills/team-coordinate/specs/pipelines.md +97 -97
  42. package/.codex/skills/team-coordinate/specs/quality-gates.md +112 -112
  43. package/.codex/skills/team-designer/SKILL.md +153 -153
  44. package/.codex/skills/team-designer/phases/01-requirements-analysis.md +250 -250
  45. package/.codex/skills/team-designer/phases/02-scaffold-generation.md +228 -228
  46. package/.codex/skills/team-designer/phases/03-content-generation.md +330 -330
  47. package/.codex/skills/team-designer/phases/04-validation.md +320 -320
  48. package/.codex/skills/team-executor/SKILL.md +29 -2
  49. package/.codex/skills/team-executor/roles/executor/commands/monitor.md +23 -15
  50. package/.codex/skills/team-frontend/SKILL.md +77 -3
  51. package/.codex/skills/team-frontend/roles/analyst/role.md +92 -92
  52. package/.codex/skills/team-frontend/roles/architect/role.md +86 -86
  53. package/.codex/skills/team-frontend/roles/coordinator/commands/analyze.md +52 -52
  54. package/.codex/skills/team-frontend/roles/coordinator/commands/monitor.md +222 -188
  55. package/.codex/skills/team-frontend/roles/coordinator/role.md +189 -177
  56. package/.codex/skills/team-frontend/roles/developer/role.md +93 -93
  57. package/.codex/skills/team-frontend/roles/qa/role.md +79 -79
  58. package/.codex/skills/team-frontend/specs/pipelines.md +76 -76
  59. package/.codex/skills/team-frontend-debug/SKILL.md +66 -3
  60. package/.codex/skills/team-frontend-debug/roles/analyzer/role.md +208 -208
  61. package/.codex/skills/team-frontend-debug/roles/coordinator/commands/analyze.md +174 -174
  62. package/.codex/skills/team-frontend-debug/roles/coordinator/commands/dispatch.md +198 -198
  63. package/.codex/skills/team-frontend-debug/roles/coordinator/commands/monitor.md +177 -143
  64. package/.codex/skills/team-frontend-debug/roles/coordinator/role.md +164 -152
  65. package/.codex/skills/team-frontend-debug/roles/fixer/role.md +147 -147
  66. package/.codex/skills/team-frontend-debug/roles/reproducer/role.md +147 -147
  67. package/.codex/skills/team-frontend-debug/roles/tester/role.md +231 -231
  68. package/.codex/skills/team-frontend-debug/roles/verifier/role.md +172 -172
  69. package/.codex/skills/team-frontend-debug/specs/debug-tools.md +215 -215
  70. package/.codex/skills/team-frontend-debug/specs/pipelines.md +94 -94
  71. package/.codex/skills/team-issue/SKILL.md +83 -4
  72. package/.codex/skills/team-issue/roles/coordinator/commands/analyze.md +64 -64
  73. package/.codex/skills/team-issue/roles/coordinator/commands/dispatch.md +273 -273
  74. package/.codex/skills/team-issue/roles/coordinator/commands/monitor.md +235 -194
  75. package/.codex/skills/team-issue/roles/coordinator/role.md +206 -194
  76. package/.codex/skills/team-issue/roles/explorer/role.md +94 -94
  77. package/.codex/skills/team-issue/roles/implementer/role.md +87 -87
  78. package/.codex/skills/team-issue/roles/integrator/role.md +84 -84
  79. package/.codex/skills/team-issue/roles/planner/role.md +81 -81
  80. package/.codex/skills/team-issue/roles/reviewer/role.md +86 -86
  81. package/.codex/skills/team-issue/specs/pipelines.md +124 -124
  82. package/.codex/skills/team-lifecycle-v4/MIGRATION-PLAN.md +6 -6
  83. package/.codex/skills/team-lifecycle-v4/SKILL.md +305 -242
  84. package/.codex/skills/team-lifecycle-v4/roles/coordinator/commands/dispatch.md +1 -1
  85. package/.codex/skills/team-lifecycle-v4/roles/coordinator/commands/monitor.md +66 -24
  86. package/.codex/skills/team-lifecycle-v4/roles/coordinator/role.md +13 -1
  87. package/.codex/skills/team-lifecycle-v4/roles/supervisor/role.md +1 -1
  88. package/.codex/skills/team-lifecycle-v4/templates/architecture.md +254 -254
  89. package/.codex/skills/team-lifecycle-v4/templates/epics.md +196 -196
  90. package/.codex/skills/team-lifecycle-v4/templates/product-brief.md +133 -133
  91. package/.codex/skills/team-lifecycle-v4/templates/requirements.md +224 -224
  92. package/.codex/skills/team-perf-opt/SKILL.md +68 -3
  93. package/.codex/skills/team-perf-opt/roles/benchmarker/role.md +89 -89
  94. package/.codex/skills/team-perf-opt/roles/coordinator/commands/analyze.md +61 -61
  95. package/.codex/skills/team-perf-opt/roles/coordinator/commands/monitor.md +35 -1
  96. package/.codex/skills/team-perf-opt/roles/coordinator/role.md +179 -167
  97. package/.codex/skills/team-perf-opt/roles/optimizer/role.md +97 -97
  98. package/.codex/skills/team-perf-opt/roles/profiler/role.md +73 -73
  99. package/.codex/skills/team-perf-opt/roles/reviewer/role.md +75 -75
  100. package/.codex/skills/team-perf-opt/roles/strategist/role.md +94 -94
  101. package/.codex/skills/team-perf-opt/specs/pipelines.md +65 -65
  102. package/.codex/skills/team-planex/SKILL.md +65 -3
  103. package/.codex/skills/team-planex/roles/coordinator/commands/analyze.md +52 -52
  104. package/.codex/skills/team-planex/roles/coordinator/commands/monitor.md +210 -164
  105. package/.codex/skills/team-planex/roles/coordinator/role.md +171 -159
  106. package/.codex/skills/team-planex/roles/executor/role.md +91 -91
  107. package/.codex/skills/team-planex/roles/planner/role.md +112 -112
  108. package/.codex/skills/team-planex/specs/pipelines.md +93 -93
  109. package/.codex/skills/team-quality-assurance/SKILL.md +60 -3
  110. package/.codex/skills/team-quality-assurance/roles/analyst/role.md +80 -80
  111. package/.codex/skills/team-quality-assurance/roles/coordinator/commands/analyze.md +72 -72
  112. package/.codex/skills/team-quality-assurance/roles/coordinator/commands/dispatch.md +108 -108
  113. package/.codex/skills/team-quality-assurance/roles/coordinator/commands/monitor.md +243 -209
  114. package/.codex/skills/team-quality-assurance/roles/coordinator/role.md +176 -164
  115. package/.codex/skills/team-quality-assurance/roles/executor/role.md +66 -66
  116. package/.codex/skills/team-quality-assurance/roles/generator/role.md +68 -68
  117. package/.codex/skills/team-quality-assurance/roles/scout/role.md +67 -67
  118. package/.codex/skills/team-quality-assurance/roles/strategist/role.md +71 -71
  119. package/.codex/skills/team-quality-assurance/specs/pipelines.md +115 -115
  120. package/.codex/skills/team-review/SKILL.md +58 -3
  121. package/.codex/skills/team-review/roles/coordinator/commands/analyze.md +71 -71
  122. package/.codex/skills/team-review/roles/coordinator/commands/dispatch.md +90 -90
  123. package/.codex/skills/team-review/roles/coordinator/commands/monitor.md +225 -185
  124. package/.codex/skills/team-review/roles/coordinator/role.md +175 -163
  125. package/.codex/skills/team-review/roles/fixer/role.md +76 -76
  126. package/.codex/skills/team-review/roles/reviewer/role.md +68 -68
  127. package/.codex/skills/team-review/roles/scanner/role.md +71 -71
  128. package/.codex/skills/team-review/specs/pipelines.md +102 -102
  129. package/.codex/skills/team-roadmap-dev/SKILL.md +55 -3
  130. package/.codex/skills/team-roadmap-dev/roles/coordinator/commands/analyze.md +61 -61
  131. package/.codex/skills/team-roadmap-dev/roles/coordinator/commands/monitor.md +502 -468
  132. package/.codex/skills/team-roadmap-dev/roles/coordinator/role.md +335 -322
  133. package/.codex/skills/team-roadmap-dev/roles/executor/role.md +71 -71
  134. package/.codex/skills/team-roadmap-dev/roles/planner/role.md +76 -76
  135. package/.codex/skills/team-roadmap-dev/roles/verifier/role.md +74 -74
  136. package/.codex/skills/team-roadmap-dev/specs/pipelines.md +93 -93
  137. package/.codex/skills/team-tech-debt/SKILL.md +56 -3
  138. package/.codex/skills/team-tech-debt/roles/assessor/role.md +69 -69
  139. package/.codex/skills/team-tech-debt/roles/coordinator/commands/analyze.md +47 -47
  140. package/.codex/skills/team-tech-debt/roles/coordinator/commands/monitor.md +272 -231
  141. package/.codex/skills/team-tech-debt/roles/coordinator/role.md +172 -160
  142. package/.codex/skills/team-tech-debt/roles/executor/role.md +76 -76
  143. package/.codex/skills/team-tech-debt/roles/planner/role.md +69 -69
  144. package/.codex/skills/team-tech-debt/roles/scanner/role.md +82 -82
  145. package/.codex/skills/team-tech-debt/roles/validator/role.md +75 -75
  146. package/.codex/skills/team-tech-debt/specs/pipelines.md +47 -47
  147. package/.codex/skills/team-testing/SKILL.md +72 -3
  148. package/.codex/skills/team-testing/roles/analyst/role.md +95 -95
  149. package/.codex/skills/team-testing/roles/coordinator/commands/analyze.md +70 -70
  150. package/.codex/skills/team-testing/roles/coordinator/commands/dispatch.md +106 -106
  151. package/.codex/skills/team-testing/roles/coordinator/commands/monitor.md +283 -242
  152. package/.codex/skills/team-testing/roles/coordinator/role.md +184 -172
  153. package/.codex/skills/team-testing/roles/executor/role.md +96 -96
  154. package/.codex/skills/team-testing/roles/generator/role.md +95 -95
  155. package/.codex/skills/team-testing/roles/strategist/role.md +83 -83
  156. package/.codex/skills/team-testing/specs/pipelines.md +101 -101
  157. package/.codex/skills/team-uidesign/SKILL.md +65 -3
  158. package/.codex/skills/team-uidesign/roles/coordinator/commands/analyze.md +59 -59
  159. package/.codex/skills/team-uidesign/roles/coordinator/commands/dispatch.md +156 -156
  160. package/.codex/skills/team-uidesign/roles/coordinator/commands/monitor.md +234 -194
  161. package/.codex/skills/team-uidesign/roles/coordinator/role.md +211 -199
  162. package/.codex/skills/team-uidesign/roles/designer/role.md +69 -69
  163. package/.codex/skills/team-uidesign/roles/implementer/role.md +72 -72
  164. package/.codex/skills/team-uidesign/roles/researcher/role.md +82 -82
  165. package/.codex/skills/team-uidesign/roles/reviewer/role.md +67 -67
  166. package/.codex/skills/team-uidesign/specs/pipelines.md +76 -76
  167. package/.codex/skills/team-ultra-analyze/SKILL.md +73 -3
  168. package/.codex/skills/team-ultra-analyze/roles/analyst/role.md +90 -90
  169. package/.codex/skills/team-ultra-analyze/roles/coordinator/commands/analyze.md +73 -73
  170. package/.codex/skills/team-ultra-analyze/roles/coordinator/commands/monitor.md +50 -9
  171. package/.codex/skills/team-ultra-analyze/roles/coordinator/role.md +255 -243
  172. package/.codex/skills/team-ultra-analyze/roles/discussant/role.md +104 -104
  173. package/.codex/skills/team-ultra-analyze/roles/explorer/role.md +74 -74
  174. package/.codex/skills/team-ultra-analyze/roles/synthesizer/role.md +78 -78
  175. package/.codex/skills/team-ultra-analyze/specs/pipelines.md +64 -64
  176. package/.codex/skills/team-ux-improve/SKILL.md +64 -3
  177. package/.codex/skills/team-ux-improve/roles/coordinator/commands/analyze.md +62 -62
  178. package/.codex/skills/team-ux-improve/roles/coordinator/commands/dispatch.md +233 -233
  179. package/.codex/skills/team-ux-improve/roles/coordinator/commands/monitor.md +195 -160
  180. package/.codex/skills/team-ux-improve/roles/coordinator/role.md +170 -158
  181. package/.codex/skills/team-ux-improve/roles/designer/role.md +122 -122
  182. package/.codex/skills/team-ux-improve/roles/diagnoser/role.md +93 -93
  183. package/.codex/skills/team-ux-improve/roles/explorer/role.md +77 -77
  184. package/.codex/skills/team-ux-improve/roles/implementer/role.md +102 -102
  185. package/.codex/skills/team-ux-improve/roles/scanner/role.md +93 -93
  186. package/.codex/skills/team-ux-improve/roles/tester/role.md +84 -84
  187. package/.codex/skills/team-ux-improve/specs/pipelines.md +54 -54
  188. package/.codex/skills/workflow-test-fix-cycle/SKILL.md +402 -402
  189. package/README.md +1 -0
  190. package/package.json +1 -1
  191. package/.claude/skills/team-iterdev/SKILL.md +0 -127
  192. package/.claude/skills/team-iterdev/roles/architect/role.md +0 -65
  193. package/.claude/skills/team-iterdev/roles/coordinator/commands/analyze.md +0 -62
  194. package/.claude/skills/team-iterdev/roles/coordinator/commands/dispatch.md +0 -234
  195. package/.claude/skills/team-iterdev/roles/coordinator/commands/monitor.md +0 -182
  196. package/.claude/skills/team-iterdev/roles/coordinator/role.md +0 -153
  197. package/.claude/skills/team-iterdev/roles/developer/role.md +0 -74
  198. package/.claude/skills/team-iterdev/roles/reviewer/role.md +0 -66
  199. package/.claude/skills/team-iterdev/roles/tester/role.md +0 -88
  200. package/.claude/skills/team-iterdev/specs/pipelines.md +0 -94
  201. package/.claude/skills/team-iterdev/specs/team-config.json +0 -172
  202. package/.codex/skills/team-iterdev/SKILL.md +0 -158
  203. package/.codex/skills/team-iterdev/roles/architect/role.md +0 -65
  204. package/.codex/skills/team-iterdev/roles/coordinator/commands/analyze.md +0 -62
  205. package/.codex/skills/team-iterdev/roles/coordinator/commands/dispatch.md +0 -187
  206. package/.codex/skills/team-iterdev/roles/coordinator/commands/monitor.md +0 -186
  207. package/.codex/skills/team-iterdev/roles/coordinator/role.md +0 -181
  208. package/.codex/skills/team-iterdev/roles/developer/role.md +0 -74
  209. package/.codex/skills/team-iterdev/roles/reviewer/role.md +0 -66
  210. package/.codex/skills/team-iterdev/roles/tester/role.md +0 -88
  211. package/.codex/skills/team-iterdev/specs/pipelines.md +0 -94
  212. package/.codex/skills/team-iterdev/specs/team-config.json +0 -172
@@ -1,966 +1,966 @@
1
- ---
2
- name: analyze-with-file
3
- description: Interactive collaborative analysis with documented discussions, inline exploration, and evolving understanding. Serial execution with no agent delegation.
4
- argument-hint: "TOPIC=\"<question or topic>\" [--depth=quick|standard|deep] [--continue]"
5
- ---
6
-
7
- # Codex Analyze-With-File Prompt
8
-
9
- ## Overview
10
-
11
- Interactive collaborative analysis workflow with **documented discussion process**. Records understanding evolution, facilitates multi-round Q&A, and uses inline search tools for deep exploration.
12
-
13
- **Core workflow**: Topic → Explore → Discuss → Document → Refine → Conclude → Plan Checklist
14
-
15
- **Key features**:
16
- - **Documented discussion timeline**: Captures understanding evolution across all phases
17
- - **Decision recording at every critical point**: Mandatory recording of key findings, direction changes, and trade-offs
18
- - **Multi-perspective analysis**: Supports up to 4 analysis perspectives (serial, inline)
19
- - **Interactive discussion**: Multi-round Q&A with user feedback and direction adjustments
20
- - **Plan output**: Generate structured plan checklist for downstream execution (e.g., `$csv-wave-pipeline`)
21
-
22
- ## Auto Mode
23
-
24
- When `--yes` or `-y`: Auto-confirm exploration decisions, use recommended analysis angles, skip interactive scoping.
25
-
26
- ## Quick Start
27
-
28
- ```bash
29
- # Basic usage
30
- /codex:analyze-with-file TOPIC="How to optimize this project's authentication architecture"
31
-
32
- # With depth selection
33
- /codex:analyze-with-file TOPIC="Performance bottleneck analysis" --depth=deep
34
-
35
- # Continue existing session
36
- /codex:analyze-with-file TOPIC="authentication architecture" --continue
37
-
38
- # Auto mode (skip confirmations)
39
- /codex:analyze-with-file -y TOPIC="Caching strategy analysis"
40
- ```
41
-
42
- ## Target Topic
43
-
44
- **$TOPIC**
45
-
46
- ## Configuration
47
-
48
- | Flag | Default | Description |
49
- |------|---------|-------------|
50
- | `-y, --yes` | false | Auto-confirm all decisions |
51
- | `--continue` | false | Continue existing session |
52
- | `--depth` | standard | Analysis depth: quick / standard / deep |
53
-
54
- **Session ID format**: `ANL-{slug}-{YYYY-MM-DD}`
55
- - slug: lowercase, alphanumeric + CJK characters, max 40 chars
56
- - date: YYYY-MM-DD (UTC+8)
57
- - Auto-detect continue: session folder + discussion.md exists → continue mode
58
-
59
- ## Analysis Flow
60
-
61
- ```
62
- Step 0: Session Setup
63
- ├─ Parse topic, flags (--depth, --continue, -y)
64
- ├─ Generate session ID: ANL-{slug}-{date}
65
- └─ Create session folder (or detect existing → continue mode)
66
-
67
- Step 1: Topic Understanding
68
- ├─ Parse topic, identify analysis dimensions
69
- ├─ Initial scoping with user (focus areas, perspectives, depth)
70
- └─ Initialize discussion.md
71
-
72
- Step 2: Exploration (Inline, No Agents)
73
- ├─ Detect codebase → search relevant modules, patterns
74
- │ ├─ Run `ccw spec load --category exploration` (if spec system available)
75
- │ ├─ Run `ccw spec load --category debug` (known issues and root-cause notes)
76
- │ └─ Use Grep, Glob, Read, mcp__ace-tool__search_context
77
- ├─ Multi-perspective analysis (if selected, serial)
78
- │ ├─ Single: Comprehensive analysis
79
- │ └─ Multi (≤4): Serial per-perspective analysis with synthesis
80
- ├─ Aggregate findings → explorations.json / perspectives.json
81
- ├─ Update discussion.md with Round 1
82
- │ ├─ Replace ## Current Understanding with initial findings
83
- │ └─ Update ## Table of Contents
84
- └─ Initial Intent Coverage Check (early drift detection)
85
-
86
- Step 3: Interactive Discussion (Multi-Round, max 5)
87
- ├─ Current Understanding Summary (round ≥ 2, before findings)
88
- ├─ Present exploration findings
89
- ├─ Gather user feedback
90
- ├─ Process response:
91
- │ ├─ Deepen → context-driven + heuristic options → deeper inline analysis
92
- │ ├─ Agree & Suggest → user-directed exploration
93
- │ ├─ Adjust → new inline analysis with adjusted focus
94
- │ ├─ Questions → direct answers with evidence
95
- │ └─ Complete → exit loop for synthesis
96
- ├─ Update discussion.md:
97
- │ ├─ Append round details + Narrative Synthesis
98
- │ ├─ Replace ## Current Understanding with latest state
99
- │ └─ Update ## Table of Contents
100
- ├─ Intent Drift Check (round ≥ 2, building on Phase 2 initial check)
101
- └─ Repeat until user selects complete or max rounds
102
-
103
- Step 4: Synthesis & Conclusion
104
- ├─ Intent Coverage Verification (mandatory gate)
105
- ├─ Findings-to-Recommendations Traceability (mandatory gate)
106
- ├─ Consolidate all insights → conclusions.json (with steps[] per recommendation)
107
- ├─ Update discussion.md with final synthesis
108
- ├─ Interactive Recommendation Review (per-recommendation confirm/modify/reject)
109
- └─ Offer options: generate plan / create issue / export / done
110
-
111
- Step 5: Plan Generation (Optional - produces plan only, NO code modifications)
112
- ├─ Generate inline plan checklist → appended to discussion.md
113
- └─ Remind user to execute via $csv-wave-pipeline
114
- ```
115
-
116
- ## Recording Protocol
117
-
118
- **CRITICAL**: During analysis, the following situations **MUST** trigger immediate recording to discussion.md:
119
-
120
- | Trigger | What to Record | Target Section |
121
- |---------|---------------|----------------|
122
- | **Direction choice** | What was chosen, why, what alternatives were discarded | `#### Decision Log` |
123
- | **Key finding** | Finding content, impact scope, confidence level, hypothesis impact | `#### Key Findings` |
124
- | **Assumption change** | Old assumption → new understanding, reason, impact | `#### Corrected Assumptions` |
125
- | **User feedback** | User's original input, rationale for adoption/adjustment | `#### User Input` |
126
- | **Disagreement & trade-off** | Conflicting viewpoints, trade-off basis, final choice | `#### Decision Log` |
127
- | **Scope adjustment** | Before/after scope, trigger reason | `#### Decision Log` |
128
-
129
- ### Decision Record Format
130
-
131
- ```markdown
132
- > **Decision**: [Description of the decision]
133
- > - **Context**: [What triggered this decision]
134
- > - **Options considered**: [Alternatives evaluated]
135
- > - **Chosen**: [Selected approach] — **Reason**: [Rationale]
136
- > - **Rejected**: [Why other options were discarded]
137
- > - **Impact**: [Effect on analysis direction/conclusions]
138
- ```
139
-
140
- ### Key Finding Record Format
141
-
142
- ```markdown
143
- > **Finding**: [Content]
144
- > - **Confidence**: [High/Medium/Low] — **Why**: [Evidence basis]
145
- > - **Hypothesis Impact**: [Confirms/Refutes/Modifies] hypothesis "[name]"
146
- > - **Scope**: [What areas this affects]
147
- ```
148
-
149
- ### Narrative Synthesis Format
150
-
151
- Append after each round update:
152
-
153
- ```markdown
154
- ### Round N: Narrative Synthesis
155
- **起点**: 基于上一轮的 [conclusions/questions],本轮从 [starting point] 切入。
156
- **关键进展**: [New findings] [confirmed/refuted/modified] 了之前关于 [hypothesis] 的理解。
157
- **决策影响**: 用户选择 [feedback type],导致分析方向 [adjusted/deepened/maintained]。
158
- **当前理解**: 经过本轮,核心认知更新为 [updated understanding]。
159
- **遗留问题**: [remaining questions driving next round]
160
- ```
161
-
162
- ### Recording Principles
163
-
164
- - **Immediacy**: Record decisions as they happen, not at the end of a phase
165
- - **Completeness**: Capture context, options, chosen approach, reason, and rejected alternatives
166
- - **Traceability**: Later phases must be able to trace back why a decision was made
167
- - **Depth**: Capture reasoning and hypothesis impact, not just outcomes
168
-
169
- ## Implementation Details
170
-
171
- ### Phase 0: Session Initialization
172
-
173
- ```javascript
174
- const getUtc8ISOString = () => new Date(Date.now() + 8 * 60 * 60 * 1000).toISOString()
175
-
176
- // Parse flags
177
- const autoYes = $ARGUMENTS.includes('--yes') || $ARGUMENTS.includes('-y')
178
- const continueMode = $ARGUMENTS.includes('--continue')
179
- const depthMatch = $ARGUMENTS.match(/--depth[=\s](quick|standard|deep)/)
180
- const analysisDepth = depthMatch ? depthMatch[1] : 'standard'
181
-
182
- // Extract topic
183
- const topic = $ARGUMENTS.replace(/--yes|-y|--continue|--depth[=\s]\w+|TOPIC=/g, '').replace(/^["']|["']$/g, '').trim()
184
-
185
- // Determine project root
186
- const projectRoot = Bash('git rev-parse --show-toplevel 2>/dev/null || pwd').trim()
187
-
188
- const slug = topic.toLowerCase().replace(/[^a-z0-9\u4e00-\u9fa5]+/g, '-').substring(0, 40)
189
- const dateStr = getUtc8ISOString().substring(0, 10)
190
- const sessionId = `ANL-${slug}-${dateStr}`
191
- const sessionFolder = `${projectRoot}/.workflow/.analysis/${sessionId}`
192
-
193
- // Auto-detect continue: session folder + discussion.md exists → continue mode
194
- // If continue → load discussion.md + explorations, resume from last round
195
- Bash(`mkdir -p ${sessionFolder}`)
196
- ```
197
-
198
- ### Phase 1: Topic Understanding
199
-
200
- **Objective**: Parse the topic, identify relevant analysis dimensions, scope the analysis with user input, and initialize the discussion document.
201
-
202
- ##### Step 1.1: Parse Topic & Identify Dimensions
203
-
204
- Match topic keywords against analysis dimensions (see [Dimensions Reference](#analysis-dimensions)):
205
-
206
- ```javascript
207
- // Match topic text against keyword lists from Dimensions Reference
208
- // If multiple dimensions match, include all
209
- // If none match, default to "architecture" and "implementation"
210
- const dimensions = identifyDimensions(topic, ANALYSIS_DIMENSIONS)
211
- ```
212
-
213
- ##### Step 1.2: Initial Scoping (New Session Only)
214
-
215
- For new sessions, gather user preferences (skipped in auto mode or continue mode):
216
-
217
- ```javascript
218
- if (!autoYes && !continueMode) {
219
- // 1. Focus areas (multi-select)
220
- // Generate directions dynamically from detected dimensions (see Dimension-Direction Mapping)
221
- const focusAreas = request_user_input({
222
- questions: [{
223
- header: "聚焦领域",
224
- id: "focus",
225
- question: "Select analysis focus areas:",
226
- options: generateFocusOptions(dimensions) // Dynamic based on dimensions
227
- }]
228
- })
229
-
230
- // 2. Analysis perspectives (multi-select, max 4)
231
- // Options from Perspectives Reference table
232
- const perspectives = request_user_input({
233
- questions: [{
234
- header: "分析视角",
235
- id: "perspectives",
236
- question: "Select analysis perspectives (single = focused, multi = broader coverage):",
237
- options: perspectiveOptions // See Perspectives Reference
238
- }]
239
- })
240
-
241
- // 3. Analysis depth (single-select, unless --depth already set)
242
- // Quick: surface level | Standard: moderate depth | Deep: comprehensive
243
- }
244
- ```
245
-
246
- ##### Step 1.3: Initialize discussion.md
247
-
248
- ```javascript
249
- const discussionMd = `# Analysis Discussion
250
-
251
- **Session ID**: ${sessionId}
252
- **Topic**: ${topic}
253
- **Started**: ${getUtc8ISOString()}
254
- **Dimensions**: ${dimensions.join(', ')}
255
- **Depth**: ${analysisDepth}
256
-
257
- ## Table of Contents
258
- <!-- TOC: Auto-updated after each round/phase. Links to major sections. -->
259
- - [Analysis Context](#analysis-context)
260
- - [Current Understanding](#current-understanding)
261
- - [Discussion Timeline](#discussion-timeline)
262
- - [Decision Trail](#decision-trail)
263
-
264
- ## Current Understanding
265
- <!-- REPLACEABLE BLOCK: Overwrite (not append) after each round with latest consolidated understanding.
266
- Follow Consolidation Rules: promote confirmed insights, track corrections, focus on current state. -->
267
-
268
- > To be populated after exploration.
269
-
270
- ## Analysis Context
271
- - Focus areas: ${focusAreas.join(', ')}
272
- - Perspectives: ${selectedPerspectives.map(p => p.name).join(', ')}
273
- - Depth: ${analysisDepth}
274
-
275
- ## Initial Questions
276
- ${generateInitialQuestions(topic, dimensions).map(q => `- ${q}`).join('\n')}
277
-
278
- ## Initial Decisions
279
- > Record why these dimensions and focus areas were selected.
280
-
281
- ---
282
-
283
- ## Discussion Timeline
284
-
285
- > Rounds will be appended below as analysis progresses.
286
- > Each round MUST include a Decision Log section for any decisions made.
287
-
288
- ---
289
-
290
- ## Decision Trail
291
-
292
- > Consolidated critical decisions across all rounds (populated in Phase 4).
293
- `
294
- Write(`${sessionFolder}/discussion.md`, discussionMd)
295
- ```
296
-
297
- **Success Criteria**:
298
- - Session folder created with discussion.md initialized
299
- - Analysis dimensions identified and user preferences captured
300
- - **Initial decisions recorded**: Dimension selection rationale, excluded dimensions with reasons
301
-
302
- ### Phase 2: Exploration
303
-
304
- **Objective**: Gather codebase context and execute analysis to build understanding. All exploration done inline — no agent delegation.
305
-
306
- ##### Step 2.1: Detect Codebase & Explore
307
-
308
- ```javascript
309
- const hasCodebase = Bash(`
310
- test -f package.json && echo "nodejs" ||
311
- test -f go.mod && echo "golang" ||
312
- test -f Cargo.toml && echo "rust" ||
313
- test -f pyproject.toml && echo "python" ||
314
- test -f pom.xml && echo "java" ||
315
- test -d src && echo "generic" ||
316
- echo "none"
317
- `).trim()
318
-
319
- if (hasCodebase !== 'none') {
320
- // 1. Read project metadata (if exists)
321
- // - Run `ccw spec load --category exploration` (load project specs)
322
- // - Run `ccw spec load --category debug` (known issues and root-cause notes)
323
- // - .workflow/specs/*.md (project conventions)
324
-
325
- // 2. Search codebase for relevant content
326
- // Use: Grep, Glob, Read, or mcp__ace-tool__search_context
327
- // Focus on: modules/components, patterns/structure, integration points, config/dependencies
328
-
329
- // 3. Write findings
330
- Write(`${sessionFolder}/exploration-codebase.json`, JSON.stringify({
331
- project_type: hasCodebase,
332
- relevant_files: [...], // [{path, relevance, summary}]
333
- patterns: [...], // [{pattern, files, description}]
334
- constraints: [...], // Architectural constraints found
335
- integration_points: [...], // [{location, description}]
336
- key_findings: [...], // Main insights from code search
337
- _metadata: { timestamp: getUtc8ISOString(), exploration_scope: '...' }
338
- }, null, 2))
339
- }
340
- ```
341
-
342
- ##### Step 2.2: Multi-Perspective Analysis
343
-
344
- Analyze from each selected perspective. All analysis done inline by the AI.
345
-
346
- **Single perspective** (default):
347
- ```javascript
348
- // Analyze comprehensively across all identified dimensions
349
- // Use exploration-codebase.json as context
350
- const findings = {
351
- session_id: sessionId, timestamp: getUtc8ISOString(),
352
- topic, dimensions,
353
- sources: [...], // [{type, file, summary}]
354
- key_findings: [...], // Main insights
355
- discussion_points: [...], // Questions for user engagement
356
- open_questions: [...] // Unresolved questions
357
- }
358
- Write(`${sessionFolder}/explorations.json`, JSON.stringify(findings, null, 2))
359
- ```
360
-
361
- **Multi-perspective** (2-4 perspectives, serial):
362
- ```javascript
363
- // Analyze each perspective sequentially, write individual findings
364
- selectedPerspectives.forEach(perspective => {
365
- Write(`${sessionFolder}/explorations/${perspective.name}.json`, JSON.stringify({
366
- perspective: perspective.name,
367
- relevant_files: [...], patterns: [...],
368
- key_findings: [...], perspective_insights: [...], open_questions: [...],
369
- _metadata: { timestamp: getUtc8ISOString() }
370
- }, null, 2))
371
- })
372
- ```
373
-
374
- ##### Step 2.3: Aggregate Findings
375
-
376
- ```javascript
377
- // Single perspective → explorations.json already written
378
- // Multi-perspective → synthesize into perspectives.json
379
- if (selectedPerspectives.length > 1) {
380
- const synthesis = {
381
- session_id: sessionId, timestamp: getUtc8ISOString(), topic, dimensions,
382
- perspectives: selectedPerspectives.map(p => ({
383
- name: p.name,
384
- findings: readJson(`${sessionFolder}/explorations/${p.name}.json`).key_findings,
385
- insights: readJson(`${sessionFolder}/explorations/${p.name}.json`).perspective_insights,
386
- questions: readJson(`${sessionFolder}/explorations/${p.name}.json`).open_questions
387
- })),
388
- synthesis: {
389
- convergent_themes: [...], // What all perspectives agree on
390
- conflicting_views: [...], // Where perspectives differ
391
- unique_contributions: [...] // Insights unique to specific perspectives
392
- },
393
- aggregated_findings: [...], discussion_points: [...], open_questions: [...]
394
- }
395
- Write(`${sessionFolder}/perspectives.json`, JSON.stringify(synthesis, null, 2))
396
- }
397
- ```
398
-
399
- ##### Step 2.4: Update discussion.md
400
-
401
- Append Round 1 with exploration results using the [Round Documentation Pattern](#round-documentation-pattern).
402
-
403
- **Single perspective**: Sources analyzed, key findings with evidence, discussion points, open questions.
404
-
405
- **Multi-perspective**: Per-perspective summary (brief), then synthesis (convergent themes, conflicting views, unique contributions), discussion points, open questions.
406
-
407
- ##### Step 2.5: Initial Intent Coverage Check
408
-
409
- Perform the FIRST intent coverage check before entering Phase 3:
410
-
411
- ```javascript
412
- // Re-read original user intent from discussion.md header
413
- // Check each intent item against Round 1 findings
414
- appendToDiscussion(`
415
- #### Initial Intent Coverage Check (Post-Exploration)
416
- ${originalIntents.map((intent, i) => {
417
- const status = assessCoverage(intent, explorationFindings)
418
- return `- ${status.icon} Intent ${i+1}: ${intent} — ${status.detail}`
419
- }).join('\n')}
420
-
421
- > 接下来的讨论将重点关注未覆盖 (❌) 和进行中 (🔄) 的意图。
422
- `)
423
- ```
424
-
425
- **Success Criteria**:
426
- - exploration-codebase.json created with codebase context (if codebase exists)
427
- - explorations.json (single) or perspectives.json (multi) created with findings
428
- - discussion.md updated with Round 1 results
429
- - **Initial Intent Coverage Check** completed — early drift detection
430
- - **Key findings recorded** with evidence references and confidence levels
431
- - **Exploration decisions recorded** (why certain perspectives/search strategies were chosen)
432
-
433
- ### Phase 3: Interactive Discussion
434
-
435
- **Objective**: Iteratively refine understanding through multi-round user-guided discussion cycles. **Max Rounds**: 5.
436
-
437
- ##### Step 3.1: Present Findings & Gather Direction
438
-
439
- **Current Understanding Summary** (Round >= 2, BEFORE presenting new findings):
440
- - Generate 1-2 sentence recap of established consensus and last round's direction
441
- - Example: "到目前为止,我们已确认 [established facts]。上一轮 [key action/direction]。现在,这是新一轮的发现:"
442
-
443
- ```javascript
444
- if (!autoYes) {
445
- const feedback = request_user_input({
446
- questions: [{
447
- header: "分析方向",
448
- id: "direction",
449
- question: `Analysis round ${round}: Feedback on current findings?`,
450
- options: [
451
- { label: "Deepen(Recommended)", description: "Analysis direction is correct, investigate deeper" },
452
- { label: "Adjust Direction", description: "Different understanding or focus needed" },
453
- { label: "Analysis Complete", description: "Sufficient information obtained, proceed to synthesis" }
454
- ]
455
- }]
456
- })
457
- }
458
- ```
459
-
460
- ##### Step 3.2: Process User Response
461
-
462
- **Recording Checkpoint**: Regardless of option selected, MUST record to discussion.md:
463
- - User's original choice and expression
464
- - Impact on analysis direction
465
- - If direction changed, record a full Decision Record (see [Recording Protocol](#recording-protocol))
466
-
467
- | Response | Action |
468
- |----------|--------|
469
- | **Deepen** | Generate 2-3 context-driven options (unresolved questions, low-confidence findings, unexplored dimensions) + 1-2 heuristic options that break current frame (e.g., "compare with best practices in [related domain]", "analyze under extreme load scenarios", "review from security audit perspective", "explore simpler architectural alternatives"). Execute selected direction via inline search. Merge new findings. Record confirmed assumptions and exploration angles. |
470
- | **Agree & Suggest** | Ask user for specific direction (free text). Execute user's direction via inline search. Record user-driven rationale and findings. |
471
- | **Adjust Direction** | Ask user for new focus. Analyze from adjusted perspective. Compare new insights with prior analysis. Identify what was missed. Record trigger reason, old vs new direction, expected impact. |
472
- | **Specific Questions** | Capture questions. Answer with codebase search evidence. Rate confidence per answer. Document Q&A. Record knowledge gaps revealed. |
473
- | **Analysis Complete** | Record why concluding at this round. Exit loop → Phase 4. |
474
-
475
- ##### Step 3.3: Document Each Round
476
-
477
- Update discussion.md using the [Round Documentation Pattern](#round-documentation-pattern).
478
-
479
- **Append** to Discussion Timeline: User Direction, Decision Log, Key Findings, Analysis Results, Corrected Assumptions, Open Items, Narrative Synthesis.
480
-
481
- **Replace** (not append):
482
-
483
- | Section | Update Rule |
484
- |---------|-------------|
485
- | `## Current Understanding` | Overwrite with latest consolidated understanding. Follow [Consolidation Rules](#consolidation-rules). |
486
- | `## Table of Contents` | Update links to include new Round N sections |
487
-
488
- ##### Step 3.4: Intent Drift Check (every round >= 2)
489
-
490
- Re-read original intent from discussion.md header. Compare against the Initial Intent Coverage Check from Phase 2:
491
-
492
- ```markdown
493
- #### Intent Coverage Check
494
- - ✅ Intent 1: [addressed in Round N]
495
- - 🔄 Intent 2: [in-progress, current focus]
496
- - ⚠️ Intent 3: [implicitly absorbed by X — needs explicit confirmation]
497
- - ❌ Intent 4: [not yet discussed]
498
- ```
499
-
500
- - If any item is "implicitly absorbed" (⚠️), note explicitly — absorbed ≠ addressed
501
- - If ❌ or ⚠️ items exist → **proactively surface** to user: "以下原始意图尚未充分覆盖:[list]。是否需要调整优先级?"
502
-
503
- **Success Criteria**:
504
- - User feedback processed for each round
505
- - discussion.md updated with all rounds, assumptions documented and corrected
506
- - **All decision points recorded** with Decision Record format
507
- - **Direction changes documented** with before/after comparison
508
-
509
- ### Phase 4: Synthesis & Conclusion
510
-
511
- **Objective**: Consolidate insights, generate conclusions and recommendations.
512
-
513
- ##### Step 4.0: Intent Coverage Verification (MANDATORY gate)
514
-
515
- For EACH original intent item, determine coverage status:
516
-
517
- - **✅ Addressed**: Explicitly discussed and concluded
518
- - **🔀 Transformed**: Original intent evolved — document transformation chain
519
- - **⚠️ Absorbed**: Implicitly covered — flag for confirmation
520
- - **❌ Missed**: Not discussed — MUST address or explicitly defer
521
-
522
- Write "Intent Coverage Matrix" to discussion.md:
523
-
524
- ```markdown
525
- ### Intent Coverage Matrix
526
- | # | Original Intent | Status | Where Addressed | Notes |
527
- |---|----------------|--------|-----------------|-------|
528
- | 1 | [intent text] | ✅ Addressed | Round N, Conclusion #M | |
529
- | 2 | [intent text] | 🔀 Transformed | Round N → Round M | Original: X → Final: Y |
530
- | 3 | [intent text] | ❌ Missed | — | Reason for omission |
531
- ```
532
-
533
- **Gate**: If any item is ❌ Missed, MUST either (a) add a discussion round to address it, or (b) explicitly confirm with user that it is intentionally deferred.
534
-
535
- ##### Step 4.1: Findings-to-Recommendations Traceability (MANDATORY gate)
536
-
537
- Collect ALL actionable findings from every round and map each to a disposition.
538
-
539
- **Actionable finding sources**: key findings with actionable implications, technical solutions (proposed/validated), identified gaps (API-frontend gaps, missing features, design issues), corrected assumptions that imply fixes.
540
-
541
- | Disposition | Meaning |
542
- |-------------|---------|
543
- | recommendation | Converted to a numbered recommendation |
544
- | absorbed | Covered by another recommendation (specify which) |
545
- | deferred | Explicitly out-of-scope with reason |
546
- | informational | Pure insight, no action needed |
547
-
548
- ```javascript
549
- const findingsCoverage = allFindings.map(f => ({
550
- finding: f.summary, round: f.round,
551
- disposition: null, // MUST be assigned before proceeding
552
- target: null, // e.g., "Rec #1" or "→ Rec #3" or "Reason: ..."
553
- reason: null
554
- }))
555
-
556
- // Gate: ALL findings MUST have a disposition. Do NOT proceed with any disposition = null.
557
- ```
558
-
559
- Append Findings Coverage Matrix to discussion.md:
560
-
561
- ```markdown
562
- ### Findings Coverage Matrix
563
- | # | Finding (Round) | Disposition | Target |
564
- |---|----------------|-------------|--------|
565
- | 1 | [finding] (R1) | recommendation | Rec #1 |
566
- | 2 | [finding] (R2) | absorbed | → Rec #1 |
567
- ```
568
-
569
- ##### Step 4.2: Consolidate Insights
570
-
571
- ```javascript
572
- const conclusions = {
573
- session_id: sessionId, topic,
574
- completed: getUtc8ISOString(),
575
- total_rounds: roundCount,
576
- summary: '...', // Executive summary
577
- key_conclusions: [ // Main conclusions
578
- { point: '...', evidence: '...', confidence: 'high|medium|low' }
579
- ],
580
- recommendations: [ // MUST include all findings with disposition = 'recommendation'
581
- {
582
- action: '...', // What to do (imperative verb + target)
583
- rationale: '...', // Why this matters
584
- priority: 'high|medium|low',
585
- evidence_refs: ['file:line', ...],
586
- steps: [ // Granular sub-steps for execution
587
- { description: '...', target: 'file/module', verification: 'how to verify done' }
588
- ],
589
- review_status: 'accepted|modified|rejected|pending'
590
- }
591
- ],
592
- open_questions: [...],
593
- follow_up_suggestions: [
594
- { type: 'issue|task|research', summary: '...' }
595
- ],
596
- decision_trail: [ // Consolidated decisions from all phases
597
- { round: 1, decision: '...', context: '...', options_considered: [...], chosen: '...', rejected_reasons: '...', reason: '...', impact: '...' }
598
- ],
599
- narrative_trail: [ // From Narrative Synthesis per round
600
- { round: 1, starting_point: '...', key_progress: '...', hypothesis_impact: '...', updated_understanding: '...', remaining_questions: '...' }
601
- ],
602
- intent_coverage: [ // From Step 4.0
603
- { intent: '...', status: 'addressed|transformed|absorbed|missed', where_addressed: '...', notes: '...' }
604
- ],
605
- findings_coverage: findingsCoverage // From Step 4.1
606
- }
607
- Write(`${sessionFolder}/conclusions.json`, JSON.stringify(conclusions, null, 2))
608
- ```
609
-
610
- ##### Step 4.3: Final discussion.md Update
611
-
612
- **Synthesis & Conclusions**: Executive Summary, Key Conclusions (ranked by confidence), Recommendations (prioritized), Remaining Open Questions.
613
-
614
- **Current Understanding (Final)**:
615
-
616
- | Subsection | Content |
617
- |------------|---------|
618
- | What We Established | Confirmed points and validated findings |
619
- | What Was Clarified | Important corrections (~~wrong→right~~) |
620
- | Key Insights | Valuable learnings for future reference |
621
-
622
- **Decision Trail**:
623
-
624
- | Subsection | Content |
625
- |------------|---------|
626
- | Critical Decisions | Pivotal decisions that shaped the outcome |
627
- | Direction Changes | Timeline of scope/focus adjustments with rationale |
628
- | Trade-offs Made | Key trade-offs and why certain paths were chosen |
629
-
630
- **Session Statistics**: Total discussion rounds, key findings count, dimensions covered, artifacts generated, **decision count**.
631
-
632
- ##### Step 4.4: Interactive Recommendation Review (skip in auto mode)
633
-
634
- Walk through each recommendation one-by-one (ordered by priority: high → medium → low):
635
-
636
- ```javascript
637
- for (const [index, rec] of sortedRecs.entries()) {
638
- const review = request_user_input({
639
- questions: [{
640
- header: `建议#${index + 1}`,
641
- id: `rec_${index + 1}`,
642
- question: `Recommendation #${index + 1}: "${rec.action}" (${rec.priority} priority, ${rec.steps.length} steps). Your decision:`,
643
- options: [
644
- { label: "Accept(Recommended)", description: "Accept this recommendation as-is" },
645
- { label: "Modify", description: "Adjust scope, steps, or priority" },
646
- { label: "Reject", description: "Remove this recommendation" }
647
- ]
648
- }]
649
- })
650
- // Accept → "accepted" | Modify → gather text → "modified" | Reject → gather reason → "rejected"
651
- // Accept All Remaining → mark all remaining as "accepted", break loop
652
- // Record review decision to discussion.md Decision Log + update conclusions.json
653
- }
654
- ```
655
-
656
- **Review Summary** (append to discussion.md):
657
- ```markdown
658
- ### Recommendation Review Summary
659
- | # | Action | Priority | Steps | Review Status | Notes |
660
- |---|--------|----------|-------|---------------|-------|
661
- | 1 | [action] | high | 3 | ✅ Accepted | |
662
- | 2 | [action] | medium | 2 | ✏️ Modified | [modification notes] |
663
- | 3 | [action] | low | 1 | ❌ Rejected | [reason] |
664
- ```
665
-
666
- ##### Step 4.5: Post-Completion Options
667
-
668
- Assess recommendation complexity, then offer appropriate next steps:
669
-
670
- | Complexity | Condition | Available Options |
671
- |------------|-----------|-------------------|
672
- | `none` | No recommendations | Done, Create Issue, Export Report |
673
- | `simple` | ≤2 low-priority items | Done, Create Issue, Export Report |
674
- | `moderate` | 1-2 medium-priority | Generate Plan, Create Issue, Export Report, Done |
675
- | `complex` | ≥3 or any high-priority | Generate Plan, Create Issue, Export Report, Done |
676
-
677
- | Selection | Action |
678
- |-----------|--------|
679
- | Generate Plan | → Phase 5 (plan only, NO code modifications) |
680
- | Create Issue | `Skill(skill="issue:new", args="...")` (only reviewed recs) |
681
- | Export Report | Copy discussion.md + conclusions.json to user-specified location |
682
- | Done | Display artifact paths, end |
683
-
684
- Auto mode: generate plan only for moderate/complex, skip for simple/none.
685
-
686
- **Success Criteria**:
687
- - conclusions.json created with complete synthesis including findings_coverage[]
688
- - **Findings Coverage Matrix** — all actionable findings mapped to disposition
689
- - **Intent Coverage Matrix** — all original intents accounted for
690
- - **Complete decision trail** documented and traceable
691
-
692
- ### Phase 5: Plan Generation (Optional — NO code modifications)
693
-
694
- **Trigger**: User selects "Generate Plan" in Phase 4. In auto mode, triggered only for `moderate`/`complex`.
695
-
696
- ```javascript
697
- const planChecklist = recs
698
- .filter(r => r.review_status !== 'rejected')
699
- .map((rec, index) => {
700
- const files = rec.evidence_refs
701
- ?.filter(ref => ref.includes(':'))
702
- .map(ref => ref.split(':')[0]) || []
703
-
704
- return `### ${index + 1}. ${rec.action}
705
- - **Priority**: ${rec.priority}
706
- - **Rationale**: ${rec.rationale}
707
- - **Target files**: ${files.join(', ') || 'TBD'}
708
- - **Evidence**: ${rec.evidence_refs?.join(', ') || 'N/A'}
709
- - [ ] Ready for execution`
710
- }).join('\n\n')
711
-
712
- appendToDiscussion(`
713
- ## Plan Checklist
714
-
715
- > **This is a plan only — no code was modified.**
716
- > To execute, use: \`$csv-wave-pipeline "<requirement summary>"\`
717
-
718
- - **Recommendations**: ${recs.length}
719
- - **Generated**: ${getUtc8ISOString()}
720
-
721
- ${planChecklist}
722
-
723
- ---
724
-
725
- ### Next Step: Execute
726
-
727
- Run \`$csv-wave-pipeline\` to execute these recommendations as wave-based batch tasks:
728
-
729
- \`\`\`bash
730
- $csv-wave-pipeline "${topic}"
731
- \`\`\`
732
- `)
733
- ```
734
-
735
- **Success Criteria**:
736
- - Plan checklist in discussion.md with all accepted recommendations
737
- - User reminded about `$csv-wave-pipeline` for execution
738
- - **No source code modified**
739
-
740
- ## Templates
741
-
742
- ### Round Documentation Pattern
743
-
744
- Each discussion round follows this structure in discussion.md:
745
-
746
- ```markdown
747
- ### Round N - [Deepen|Adjust|Suggest|Q&A] (timestamp)
748
-
749
- #### User Input
750
- What the user indicated they wanted to focus on
751
-
752
- #### Decision Log
753
- <!-- Use Decision Record Format from Recording Protocol -->
754
-
755
- #### Key Findings
756
- <!-- Use Key Finding Record Format from Recording Protocol -->
757
-
758
- #### Analysis Results
759
- Detailed findings from this round's analysis
760
- - Finding 1 (evidence: file:line)
761
- - Finding 2 (evidence: file:line)
762
-
763
- #### Corrected Assumptions
764
- - ~~Previous assumption~~ → Corrected understanding
765
- - Reason: Why the assumption was wrong
766
-
767
- #### Open Items
768
- Remaining questions or areas for investigation
769
-
770
- #### Narrative Synthesis
771
- <!-- Use Narrative Synthesis Format from Recording Protocol -->
772
- ```
773
-
774
- ### discussion.md Evolution Summary
775
-
776
- - **Header**: Session ID, topic, start time, dimensions
777
- - **Analysis Context**: Focus areas, perspectives, depth level
778
- - **Initial Questions**: Key questions to guide the analysis
779
- - **Initial Decisions**: Why these dimensions and focus areas were selected
780
- - **Discussion Timeline**: Round-by-round findings
781
- - Round 1: Exploration Results + Decision Log + Narrative Synthesis
782
- - Round 2-N: Current Understanding Summary + User feedback + direction adjustments + new insights + Decision Log + Key Findings + Narrative Synthesis
783
- - **Decision Trail**: Consolidated critical decisions across all rounds
784
- - **Synthesis & Conclusions**: Summary, key conclusions, recommendations
785
- - **Current Understanding (Final)**: Consolidated insights
786
- - **Session Statistics**: Rounds completed, findings count, artifacts generated, decision count
787
-
788
- ## Reference
789
-
790
- ### Output Structure
791
-
792
- ```
793
- {projectRoot}/.workflow/.analysis/ANL-{slug}-{date}/
794
- ├── discussion.md # Evolution of understanding & discussions
795
- ├── exploration-codebase.json # Phase 2: Codebase context
796
- ├── explorations/ # Phase 2: Multi-perspective explorations (if selected)
797
- │ ├── technical.json
798
- │ ├── architectural.json
799
- │ └── ...
800
- ├── explorations.json # Phase 2: Single perspective aggregated findings
801
- ├── perspectives.json # Phase 2: Multi-perspective findings with synthesis
802
- └── conclusions.json # Phase 4: Final synthesis with recommendations
803
- ```
804
-
805
- > **Phase 5** appends a plan checklist to `discussion.md`. No additional files are generated.
806
-
807
- | File | Phase | Description |
808
- |------|-------|-------------|
809
- | `discussion.md` | 1-5 | Session metadata → discussion timeline → conclusions. Plan checklist appended here. |
810
- | `exploration-codebase.json` | 2 | Codebase context: relevant files, patterns, constraints |
811
- | `explorations/*.json` | 2 | Per-perspective exploration results (multi only) |
812
- | `explorations.json` | 2 | Single perspective aggregated findings |
813
- | `perspectives.json` | 2 | Multi-perspective findings with cross-perspective synthesis |
814
- | `conclusions.json` | 4 | Final synthesis: conclusions, recommendations, findings_coverage, open questions |
815
-
816
- ### Analysis Dimensions
817
-
818
- | Dimension | Keywords | Description |
819
- |-----------|----------|-------------|
820
- | architecture | 架构, architecture, design, structure, 设计, pattern | System design, component interactions, design patterns |
821
- | implementation | 实现, implement, code, coding, 代码, logic | Code patterns, implementation details, algorithms |
822
- | performance | 性能, performance, optimize, bottleneck, 优化, speed | Bottlenecks, optimization opportunities, resource usage |
823
- | security | 安全, security, auth, permission, 权限, vulnerability | Vulnerabilities, authentication, access control |
824
- | concept | 概念, concept, theory, principle, 原理, understand | Foundational ideas, principles, theory |
825
- | comparison | 比较, compare, vs, difference, 区别, versus | Comparing solutions, evaluating alternatives |
826
- | decision | 决策, decision, choice, tradeoff, 选择, trade-off | Trade-offs, impact analysis, decision rationale |
827
-
828
- ### Analysis Perspectives
829
-
830
- Optional multi-perspective analysis (single perspective is default, max 4):
831
-
832
- | Perspective | Focus | Best For |
833
- |------------|-------|----------|
834
- | **Technical** | Implementation patterns, code structure, technical feasibility | Understanding how and technical details |
835
- | **Architectural** | System design, scalability, component interactions | Understanding structure and organization |
836
- | **Security** | Security patterns, vulnerabilities, access control | Identifying security risks |
837
- | **Performance** | Bottlenecks, optimization, resource utilization | Finding performance issues |
838
-
839
- **Selection**: User can multi-select up to 4 perspectives in Phase 1, or default to single comprehensive view.
840
-
841
- ### Analysis Depth Levels
842
-
843
- | Depth | Scope | Description |
844
- |-------|-------|-------------|
845
- | Quick | Surface level understanding | Fast overview, minimal exploration |
846
- | Standard | Moderate depth with good coverage | Balanced analysis (default) |
847
- | Deep | Comprehensive detailed analysis | Thorough multi-round investigation |
848
-
849
- ### Dimension-Direction Mapping
850
-
851
- When user selects focus areas, generate directions dynamically:
852
-
853
- | Dimension | Possible Directions |
854
- |-----------|-------------------|
855
- | architecture | System Design, Component Interactions, Technology Choices, Integration Points, Design Patterns, Scalability Strategy |
856
- | implementation | Code Structure, Implementation Details, Code Patterns, Error Handling, Testing Approach, Algorithm Analysis |
857
- | performance | Performance Bottlenecks, Optimization Opportunities, Resource Utilization, Caching Strategy, Concurrency Issues |
858
- | security | Security Vulnerabilities, Authentication/Authorization, Access Control, Data Protection, Input Validation |
859
- | concept | Conceptual Foundation, Core Mechanisms, Fundamental Patterns, Theory & Principles, Trade-offs & Reasoning |
860
- | comparison | Solution Comparison, Pros & Cons Analysis, Technology Evaluation, Approach Differences |
861
- | decision | Decision Criteria, Trade-off Analysis, Risk Assessment, Impact Analysis, Implementation Implications |
862
-
863
- **Implementation**: Present 2-3 top dimension-related directions, allow user to multi-select and add custom directions.
864
-
865
- ### Consolidation Rules
866
-
867
- When updating "Current Understanding" in discussion.md:
868
-
869
- | Rule | Description |
870
- |------|-------------|
871
- | Promote confirmed insights | Move validated findings to "What We Established" |
872
- | Track corrections | Keep important wrong→right transformations |
873
- | Focus on current state | What do we know NOW, not the journey |
874
- | Avoid timeline repetition | Don't copy discussion details into consolidated section |
875
- | Preserve key learnings | Keep insights valuable for future reference |
876
-
877
- **Example**:
878
-
879
- Bad (cluttered):
880
- ```markdown
881
- ## Current Understanding
882
- In round 1 we discussed X, then in round 2 user said Y...
883
- ```
884
-
885
- Good (consolidated):
886
- ```markdown
887
- ## Current Understanding
888
-
889
- ### What We Established
890
- - The authentication flow uses JWT with refresh tokens
891
- - Rate limiting is implemented at API gateway level
892
-
893
- ### What Was Clarified
894
- - ~~Assumed Redis for sessions~~ → Actually uses database-backed sessions
895
-
896
- ### Key Insights
897
- - Current architecture supports horizontal scaling
898
- ```
899
-
900
- ### Error Handling
901
-
902
- | Situation | Action | Recovery |
903
- |-----------|--------|----------|
904
- | No codebase detected | Normal flow, pure topic analysis | Proceed without exploration-codebase.json |
905
- | Codebase search fails | Continue with available context | Note limitation in discussion.md |
906
- | No relevant findings | Broaden search keywords | Ask user for clarification |
907
- | User timeout in discussion | Save state, show resume command | Use `--continue` to resume |
908
- | Max rounds reached (5) | Force synthesis phase | Highlight remaining questions in conclusions |
909
- | Session folder conflict | Append timestamp suffix | Create unique folder and continue |
910
- | Plan generation: no recommendations | No plan to generate | Inform user, suggest lite-plan |
911
-
912
- ## Best Practices
913
-
914
- ### Core Principles
915
-
916
- 1. **No code modifications**: This skill is strictly read-only and plan-only. Phase 5 generates plan checklists but does NOT modify source code. Use `$csv-wave-pipeline` for execution.
917
- 2. **Record Decisions Immediately**: Never defer recording — capture decisions as they happen using the Decision Record format
918
- 3. **Evidence-Based**: Every conclusion should reference specific code or patterns with confidence levels
919
- 4. **Embrace Corrections**: Track wrong→right transformations as valuable learnings
920
-
921
- ### Before Starting
922
-
923
- 1. **Clear Topic Definition**: Detailed topics lead to better dimension identification
924
- 2. **User Context**: Understanding focus preferences helps scope the analysis
925
- 3. **Perspective Selection**: Choose 2-4 perspectives for complex topics, single for focused queries
926
- 4. **Scope Understanding**: Being clear about depth expectations sets correct analysis intensity
927
-
928
- ### During Analysis
929
-
930
- 1. **Review Findings**: Check exploration results before proceeding to discussion
931
- 2. **Document Assumptions**: Track what you think is true for correction later
932
- 3. **Use Continue Mode**: Resume sessions to build on previous findings
933
- 4. **Iterate Thoughtfully**: Each discussion round should meaningfully refine understanding
934
- 5. **Link Decisions to Outcomes**: Explicitly reference which decisions led to which outcomes
935
-
936
- ### Documentation Practices
937
-
938
- 1. **Timeline Clarity**: Use clear timestamps for traceability
939
- 2. **Evolution Tracking**: Document how understanding changed across rounds
940
- 3. **Multi-Perspective Synthesis**: When using multiple perspectives, document convergent/conflicting themes
941
-
942
- ## When to Use
943
-
944
- **Use analyze-with-file when:**
945
- - Exploring complex topics collaboratively with documented trail
946
- - Need multi-round iterative refinement of understanding
947
- - Decision-making requires exploring multiple perspectives
948
- - Building shared understanding before implementation
949
- - Want to document how understanding evolved
950
-
951
- **Use Plan Generation (Phase 5) when:**
952
- - Analysis conclusions contain clear, actionable recommendations
953
- - Simple: 1-2 items → inline plan checklist in discussion.md
954
- - Complex: 3+ recommendations → detailed plan checklist
955
- - **Then execute via**: `$csv-wave-pipeline` for wave-based batch execution
956
-
957
- **Consider alternatives when:**
958
- - Specific bug diagnosis needed → use `debug-with-file`
959
- - Generating new ideas/solutions → use `brainstorm-with-file`
960
- - Complex planning with parallel perspectives → use `collaborative-plan-with-file`
961
- - Ready to implement → use `lite-plan`
962
- - Requirement decomposition needed → use `req-plan-with-file`
963
-
964
- ---
965
-
966
- **Now execute the analyze-with-file workflow for topic**: $TOPIC
1
+ ---
2
+ name: analyze-with-file
3
+ description: Interactive collaborative analysis with documented discussions, inline exploration, and evolving understanding.
4
+ argument-hint: "TOPIC=\"<question or topic>\" [--depth=quick|standard|deep] [--continue]"
5
+ ---
6
+
7
+ # Codex Analyze-With-File Prompt
8
+
9
+ ## Overview
10
+
11
+ Interactive collaborative analysis workflow with **documented discussion process**. Records understanding evolution, facilitates multi-round Q&A, and uses inline search tools for deep exploration.
12
+
13
+ **Core workflow**: Topic → Explore → Discuss → Document → Refine → Conclude → Plan Checklist
14
+
15
+ **Key features**:
16
+ - **Documented discussion timeline**: Captures understanding evolution across all phases
17
+ - **Decision recording at every critical point**: Mandatory recording of key findings, direction changes, and trade-offs
18
+ - **Multi-perspective analysis**: Supports up to 4 analysis perspectives (serial, inline)
19
+ - **Interactive discussion**: Multi-round Q&A with user feedback and direction adjustments
20
+ - **Plan output**: Generate structured plan checklist for downstream execution (e.g., `$csv-wave-pipeline`)
21
+
22
+ ## Auto Mode
23
+
24
+ When `--yes` or `-y`: Auto-confirm exploration decisions, use recommended analysis angles, skip interactive scoping.
25
+
26
+ ## Quick Start
27
+
28
+ ```bash
29
+ # Basic usage
30
+ /codex:analyze-with-file TOPIC="How to optimize this project's authentication architecture"
31
+
32
+ # With depth selection
33
+ /codex:analyze-with-file TOPIC="Performance bottleneck analysis" --depth=deep
34
+
35
+ # Continue existing session
36
+ /codex:analyze-with-file TOPIC="authentication architecture" --continue
37
+
38
+ # Auto mode (skip confirmations)
39
+ /codex:analyze-with-file -y TOPIC="Caching strategy analysis"
40
+ ```
41
+
42
+ ## Target Topic
43
+
44
+ **$TOPIC**
45
+
46
+ ## Configuration
47
+
48
+ | Flag | Default | Description |
49
+ |------|---------|-------------|
50
+ | `-y, --yes` | false | Auto-confirm all decisions |
51
+ | `--continue` | false | Continue existing session |
52
+ | `--depth` | standard | Analysis depth: quick / standard / deep |
53
+
54
+ **Session ID format**: `ANL-{slug}-{YYYY-MM-DD}`
55
+ - slug: lowercase, alphanumeric + CJK characters, max 40 chars
56
+ - date: YYYY-MM-DD (UTC+8)
57
+ - Auto-detect continue: session folder + discussion.md exists → continue mode
58
+
59
+ ## Analysis Flow
60
+
61
+ ```
62
+ Step 0: Session Setup
63
+ ├─ Parse topic, flags (--depth, --continue, -y)
64
+ ├─ Generate session ID: ANL-{slug}-{date}
65
+ └─ Create session folder (or detect existing → continue mode)
66
+
67
+ Step 1: Topic Understanding
68
+ ├─ Parse topic, identify analysis dimensions
69
+ ├─ Initial scoping with user (focus areas, perspectives, depth)
70
+ └─ Initialize discussion.md
71
+
72
+ Step 2: Exploration (Inline, No Agents)
73
+ ├─ Detect codebase → search relevant modules, patterns
74
+ │ ├─ Run `ccw spec load --category exploration` (if spec system available)
75
+ │ ├─ Run `ccw spec load --category debug` (known issues and root-cause notes)
76
+ │ └─ Use Grep, Glob, Read, mcp__ace-tool__search_context
77
+ ├─ Multi-perspective analysis (if selected, serial)
78
+ │ ├─ Single: Comprehensive analysis
79
+ │ └─ Multi (≤4): Serial per-perspective analysis with synthesis
80
+ ├─ Aggregate findings → explorations.json / perspectives.json
81
+ ├─ Update discussion.md with Round 1
82
+ │ ├─ Replace ## Current Understanding with initial findings
83
+ │ └─ Update ## Table of Contents
84
+ └─ Initial Intent Coverage Check (early drift detection)
85
+
86
+ Step 3: Interactive Discussion (Multi-Round, max 5)
87
+ ├─ Current Understanding Summary (round ≥ 2, before findings)
88
+ ├─ Present exploration findings
89
+ ├─ Gather user feedback
90
+ ├─ Process response:
91
+ │ ├─ Deepen → context-driven + heuristic options → deeper inline analysis
92
+ │ ├─ Agree & Suggest → user-directed exploration
93
+ │ ├─ Adjust → new inline analysis with adjusted focus
94
+ │ ├─ Questions → direct answers with evidence
95
+ │ └─ Complete → exit loop for synthesis
96
+ ├─ Update discussion.md:
97
+ │ ├─ Append round details + Narrative Synthesis
98
+ │ ├─ Replace ## Current Understanding with latest state
99
+ │ └─ Update ## Table of Contents
100
+ ├─ Intent Drift Check (round ≥ 2, building on Phase 2 initial check)
101
+ └─ Repeat until user selects complete or max rounds
102
+
103
+ Step 4: Synthesis & Conclusion
104
+ ├─ Intent Coverage Verification (mandatory gate)
105
+ ├─ Findings-to-Recommendations Traceability (mandatory gate)
106
+ ├─ Consolidate all insights → conclusions.json (with steps[] per recommendation)
107
+ ├─ Update discussion.md with final synthesis
108
+ ├─ Interactive Recommendation Review (per-recommendation confirm/modify/reject)
109
+ └─ Offer options: generate plan / create issue / export / done
110
+
111
+ Step 5: Plan Generation (Optional - produces plan only, NO code modifications)
112
+ ├─ Generate inline plan checklist → appended to discussion.md
113
+ └─ Remind user to execute via $csv-wave-pipeline
114
+ ```
115
+
116
+ ## Recording Protocol
117
+
118
+ **CRITICAL**: During analysis, the following situations **MUST** trigger immediate recording to discussion.md:
119
+
120
+ | Trigger | What to Record | Target Section |
121
+ |---------|---------------|----------------|
122
+ | **Direction choice** | What was chosen, why, what alternatives were discarded | `#### Decision Log` |
123
+ | **Key finding** | Finding content, impact scope, confidence level, hypothesis impact | `#### Key Findings` |
124
+ | **Assumption change** | Old assumption → new understanding, reason, impact | `#### Corrected Assumptions` |
125
+ | **User feedback** | User's original input, rationale for adoption/adjustment | `#### User Input` |
126
+ | **Disagreement & trade-off** | Conflicting viewpoints, trade-off basis, final choice | `#### Decision Log` |
127
+ | **Scope adjustment** | Before/after scope, trigger reason | `#### Decision Log` |
128
+
129
+ ### Decision Record Format
130
+
131
+ ```markdown
132
+ > **Decision**: [Description of the decision]
133
+ > - **Context**: [What triggered this decision]
134
+ > - **Options considered**: [Alternatives evaluated]
135
+ > - **Chosen**: [Selected approach] — **Reason**: [Rationale]
136
+ > - **Rejected**: [Why other options were discarded]
137
+ > - **Impact**: [Effect on analysis direction/conclusions]
138
+ ```
139
+
140
+ ### Key Finding Record Format
141
+
142
+ ```markdown
143
+ > **Finding**: [Content]
144
+ > - **Confidence**: [High/Medium/Low] — **Why**: [Evidence basis]
145
+ > - **Hypothesis Impact**: [Confirms/Refutes/Modifies] hypothesis "[name]"
146
+ > - **Scope**: [What areas this affects]
147
+ ```
148
+
149
+ ### Narrative Synthesis Format
150
+
151
+ Append after each round update:
152
+
153
+ ```markdown
154
+ ### Round N: Narrative Synthesis
155
+ **起点**: 基于上一轮的 [conclusions/questions],本轮从 [starting point] 切入。
156
+ **关键进展**: [New findings] [confirmed/refuted/modified] 了之前关于 [hypothesis] 的理解。
157
+ **决策影响**: 用户选择 [feedback type],导致分析方向 [adjusted/deepened/maintained]。
158
+ **当前理解**: 经过本轮,核心认知更新为 [updated understanding]。
159
+ **遗留问题**: [remaining questions driving next round]
160
+ ```
161
+
162
+ ### Recording Principles
163
+
164
+ - **Immediacy**: Record decisions as they happen, not at the end of a phase
165
+ - **Completeness**: Capture context, options, chosen approach, reason, and rejected alternatives
166
+ - **Traceability**: Later phases must be able to trace back why a decision was made
167
+ - **Depth**: Capture reasoning and hypothesis impact, not just outcomes
168
+
169
+ ## Implementation Details
170
+
171
+ ### Phase 0: Session Initialization
172
+
173
+ ```javascript
174
+ const getUtc8ISOString = () => new Date(Date.now() + 8 * 60 * 60 * 1000).toISOString()
175
+
176
+ // Parse flags
177
+ const autoYes = $ARGUMENTS.includes('--yes') || $ARGUMENTS.includes('-y')
178
+ const continueMode = $ARGUMENTS.includes('--continue')
179
+ const depthMatch = $ARGUMENTS.match(/--depth[=\s](quick|standard|deep)/)
180
+ const analysisDepth = depthMatch ? depthMatch[1] : 'standard'
181
+
182
+ // Extract topic
183
+ const topic = $ARGUMENTS.replace(/--yes|-y|--continue|--depth[=\s]\w+|TOPIC=/g, '').replace(/^["']|["']$/g, '').trim()
184
+
185
+ // Determine project root
186
+ const projectRoot = Bash('git rev-parse --show-toplevel 2>/dev/null || pwd').trim()
187
+
188
+ const slug = topic.toLowerCase().replace(/[^a-z0-9\u4e00-\u9fa5]+/g, '-').substring(0, 40)
189
+ const dateStr = getUtc8ISOString().substring(0, 10)
190
+ const sessionId = `ANL-${slug}-${dateStr}`
191
+ const sessionFolder = `${projectRoot}/.workflow/.analysis/${sessionId}`
192
+
193
+ // Auto-detect continue: session folder + discussion.md exists → continue mode
194
+ // If continue → load discussion.md + explorations, resume from last round
195
+ Bash(`mkdir -p ${sessionFolder}`)
196
+ ```
197
+
198
+ ### Phase 1: Topic Understanding
199
+
200
+ **Objective**: Parse the topic, identify relevant analysis dimensions, scope the analysis with user input, and initialize the discussion document.
201
+
202
+ ##### Step 1.1: Parse Topic & Identify Dimensions
203
+
204
+ Match topic keywords against analysis dimensions (see [Dimensions Reference](#analysis-dimensions)):
205
+
206
+ ```javascript
207
+ // Match topic text against keyword lists from Dimensions Reference
208
+ // If multiple dimensions match, include all
209
+ // If none match, default to "architecture" and "implementation"
210
+ const dimensions = identifyDimensions(topic, ANALYSIS_DIMENSIONS)
211
+ ```
212
+
213
+ ##### Step 1.2: Initial Scoping (New Session Only)
214
+
215
+ For new sessions, gather user preferences (skipped in auto mode or continue mode):
216
+
217
+ ```javascript
218
+ if (!autoYes && !continueMode) {
219
+ // 1. Focus areas (multi-select)
220
+ // Generate directions dynamically from detected dimensions (see Dimension-Direction Mapping)
221
+ const focusAreas = request_user_input({
222
+ questions: [{
223
+ header: "聚焦领域",
224
+ id: "focus",
225
+ question: "Select analysis focus areas:",
226
+ options: generateFocusOptions(dimensions) // Dynamic based on dimensions
227
+ }]
228
+ })
229
+
230
+ // 2. Analysis perspectives (multi-select, max 4)
231
+ // Options from Perspectives Reference table
232
+ const perspectives = request_user_input({
233
+ questions: [{
234
+ header: "分析视角",
235
+ id: "perspectives",
236
+ question: "Select analysis perspectives (single = focused, multi = broader coverage):",
237
+ options: perspectiveOptions // See Perspectives Reference
238
+ }]
239
+ })
240
+
241
+ // 3. Analysis depth (single-select, unless --depth already set)
242
+ // Quick: surface level | Standard: moderate depth | Deep: comprehensive
243
+ }
244
+ ```
245
+
246
+ ##### Step 1.3: Initialize discussion.md
247
+
248
+ ```javascript
249
+ const discussionMd = `# Analysis Discussion
250
+
251
+ **Session ID**: ${sessionId}
252
+ **Topic**: ${topic}
253
+ **Started**: ${getUtc8ISOString()}
254
+ **Dimensions**: ${dimensions.join(', ')}
255
+ **Depth**: ${analysisDepth}
256
+
257
+ ## Table of Contents
258
+ <!-- TOC: Auto-updated after each round/phase. Links to major sections. -->
259
+ - [Analysis Context](#analysis-context)
260
+ - [Current Understanding](#current-understanding)
261
+ - [Discussion Timeline](#discussion-timeline)
262
+ - [Decision Trail](#decision-trail)
263
+
264
+ ## Current Understanding
265
+ <!-- REPLACEABLE BLOCK: Overwrite (not append) after each round with latest consolidated understanding.
266
+ Follow Consolidation Rules: promote confirmed insights, track corrections, focus on current state. -->
267
+
268
+ > To be populated after exploration.
269
+
270
+ ## Analysis Context
271
+ - Focus areas: ${focusAreas.join(', ')}
272
+ - Perspectives: ${selectedPerspectives.map(p => p.name).join(', ')}
273
+ - Depth: ${analysisDepth}
274
+
275
+ ## Initial Questions
276
+ ${generateInitialQuestions(topic, dimensions).map(q => `- ${q}`).join('\n')}
277
+
278
+ ## Initial Decisions
279
+ > Record why these dimensions and focus areas were selected.
280
+
281
+ ---
282
+
283
+ ## Discussion Timeline
284
+
285
+ > Rounds will be appended below as analysis progresses.
286
+ > Each round MUST include a Decision Log section for any decisions made.
287
+
288
+ ---
289
+
290
+ ## Decision Trail
291
+
292
+ > Consolidated critical decisions across all rounds (populated in Phase 4).
293
+ `
294
+ Write(`${sessionFolder}/discussion.md`, discussionMd)
295
+ ```
296
+
297
+ **Success Criteria**:
298
+ - Session folder created with discussion.md initialized
299
+ - Analysis dimensions identified and user preferences captured
300
+ - **Initial decisions recorded**: Dimension selection rationale, excluded dimensions with reasons
301
+
302
+ ### Phase 2: Exploration
303
+
304
+ **Objective**: Gather codebase context and execute analysis to build understanding. All exploration done inline — no agent delegation.
305
+
306
+ ##### Step 2.1: Detect Codebase & Explore
307
+
308
+ ```javascript
309
+ const hasCodebase = Bash(`
310
+ test -f package.json && echo "nodejs" ||
311
+ test -f go.mod && echo "golang" ||
312
+ test -f Cargo.toml && echo "rust" ||
313
+ test -f pyproject.toml && echo "python" ||
314
+ test -f pom.xml && echo "java" ||
315
+ test -d src && echo "generic" ||
316
+ echo "none"
317
+ `).trim()
318
+
319
+ if (hasCodebase !== 'none') {
320
+ // 1. Read project metadata (if exists)
321
+ // - Run `ccw spec load --category exploration` (load project specs)
322
+ // - Run `ccw spec load --category debug` (known issues and root-cause notes)
323
+ // - .workflow/specs/*.md (project conventions)
324
+
325
+ // 2. Search codebase for relevant content
326
+ // Use: Grep, Glob, Read, or mcp__ace-tool__search_context
327
+ // Focus on: modules/components, patterns/structure, integration points, config/dependencies
328
+
329
+ // 3. Write findings
330
+ Write(`${sessionFolder}/exploration-codebase.json`, JSON.stringify({
331
+ project_type: hasCodebase,
332
+ relevant_files: [...], // [{path, relevance, summary}]
333
+ patterns: [...], // [{pattern, files, description}]
334
+ constraints: [...], // Architectural constraints found
335
+ integration_points: [...], // [{location, description}]
336
+ key_findings: [...], // Main insights from code search
337
+ _metadata: { timestamp: getUtc8ISOString(), exploration_scope: '...' }
338
+ }, null, 2))
339
+ }
340
+ ```
341
+
342
+ ##### Step 2.2: Multi-Perspective Analysis
343
+
344
+ Analyze from each selected perspective. All analysis done inline by the AI.
345
+
346
+ **Single perspective** (default):
347
+ ```javascript
348
+ // Analyze comprehensively across all identified dimensions
349
+ // Use exploration-codebase.json as context
350
+ const findings = {
351
+ session_id: sessionId, timestamp: getUtc8ISOString(),
352
+ topic, dimensions,
353
+ sources: [...], // [{type, file, summary}]
354
+ key_findings: [...], // Main insights
355
+ discussion_points: [...], // Questions for user engagement
356
+ open_questions: [...] // Unresolved questions
357
+ }
358
+ Write(`${sessionFolder}/explorations.json`, JSON.stringify(findings, null, 2))
359
+ ```
360
+
361
+ **Multi-perspective** (2-4 perspectives, serial):
362
+ ```javascript
363
+ // Analyze each perspective sequentially, write individual findings
364
+ selectedPerspectives.forEach(perspective => {
365
+ Write(`${sessionFolder}/explorations/${perspective.name}.json`, JSON.stringify({
366
+ perspective: perspective.name,
367
+ relevant_files: [...], patterns: [...],
368
+ key_findings: [...], perspective_insights: [...], open_questions: [...],
369
+ _metadata: { timestamp: getUtc8ISOString() }
370
+ }, null, 2))
371
+ })
372
+ ```
373
+
374
+ ##### Step 2.3: Aggregate Findings
375
+
376
+ ```javascript
377
+ // Single perspective → explorations.json already written
378
+ // Multi-perspective → synthesize into perspectives.json
379
+ if (selectedPerspectives.length > 1) {
380
+ const synthesis = {
381
+ session_id: sessionId, timestamp: getUtc8ISOString(), topic, dimensions,
382
+ perspectives: selectedPerspectives.map(p => ({
383
+ name: p.name,
384
+ findings: readJson(`${sessionFolder}/explorations/${p.name}.json`).key_findings,
385
+ insights: readJson(`${sessionFolder}/explorations/${p.name}.json`).perspective_insights,
386
+ questions: readJson(`${sessionFolder}/explorations/${p.name}.json`).open_questions
387
+ })),
388
+ synthesis: {
389
+ convergent_themes: [...], // What all perspectives agree on
390
+ conflicting_views: [...], // Where perspectives differ
391
+ unique_contributions: [...] // Insights unique to specific perspectives
392
+ },
393
+ aggregated_findings: [...], discussion_points: [...], open_questions: [...]
394
+ }
395
+ Write(`${sessionFolder}/perspectives.json`, JSON.stringify(synthesis, null, 2))
396
+ }
397
+ ```
398
+
399
+ ##### Step 2.4: Update discussion.md
400
+
401
+ Append Round 1 with exploration results using the [Round Documentation Pattern](#round-documentation-pattern).
402
+
403
+ **Single perspective**: Sources analyzed, key findings with evidence, discussion points, open questions.
404
+
405
+ **Multi-perspective**: Per-perspective summary (brief), then synthesis (convergent themes, conflicting views, unique contributions), discussion points, open questions.
406
+
407
+ ##### Step 2.5: Initial Intent Coverage Check
408
+
409
+ Perform the FIRST intent coverage check before entering Phase 3:
410
+
411
+ ```javascript
412
+ // Re-read original user intent from discussion.md header
413
+ // Check each intent item against Round 1 findings
414
+ appendToDiscussion(`
415
+ #### Initial Intent Coverage Check (Post-Exploration)
416
+ ${originalIntents.map((intent, i) => {
417
+ const status = assessCoverage(intent, explorationFindings)
418
+ return `- ${status.icon} Intent ${i+1}: ${intent} — ${status.detail}`
419
+ }).join('\n')}
420
+
421
+ > 接下来的讨论将重点关注未覆盖 (❌) 和进行中 (🔄) 的意图。
422
+ `)
423
+ ```
424
+
425
+ **Success Criteria**:
426
+ - exploration-codebase.json created with codebase context (if codebase exists)
427
+ - explorations.json (single) or perspectives.json (multi) created with findings
428
+ - discussion.md updated with Round 1 results
429
+ - **Initial Intent Coverage Check** completed — early drift detection
430
+ - **Key findings recorded** with evidence references and confidence levels
431
+ - **Exploration decisions recorded** (why certain perspectives/search strategies were chosen)
432
+
433
+ ### Phase 3: Interactive Discussion
434
+
435
+ **Objective**: Iteratively refine understanding through multi-round user-guided discussion cycles. **Max Rounds**: 5.
436
+
437
+ ##### Step 3.1: Present Findings & Gather Direction
438
+
439
+ **Current Understanding Summary** (Round >= 2, BEFORE presenting new findings):
440
+ - Generate 1-2 sentence recap of established consensus and last round's direction
441
+ - Example: "到目前为止,我们已确认 [established facts]。上一轮 [key action/direction]。现在,这是新一轮的发现:"
442
+
443
+ ```javascript
444
+ if (!autoYes) {
445
+ const feedback = request_user_input({
446
+ questions: [{
447
+ header: "分析方向",
448
+ id: "direction",
449
+ question: `Analysis round ${round}: Feedback on current findings?`,
450
+ options: [
451
+ { label: "Deepen(Recommended)", description: "Analysis direction is correct, investigate deeper" },
452
+ { label: "Adjust Direction", description: "Different understanding or focus needed" },
453
+ { label: "Analysis Complete", description: "Sufficient information obtained, proceed to synthesis" }
454
+ ]
455
+ }]
456
+ })
457
+ }
458
+ ```
459
+
460
+ ##### Step 3.2: Process User Response
461
+
462
+ **Recording Checkpoint**: Regardless of option selected, MUST record to discussion.md:
463
+ - User's original choice and expression
464
+ - Impact on analysis direction
465
+ - If direction changed, record a full Decision Record (see [Recording Protocol](#recording-protocol))
466
+
467
+ | Response | Action |
468
+ |----------|--------|
469
+ | **Deepen** | Generate 2-3 context-driven options (unresolved questions, low-confidence findings, unexplored dimensions) + 1-2 heuristic options that break current frame (e.g., "compare with best practices in [related domain]", "analyze under extreme load scenarios", "review from security audit perspective", "explore simpler architectural alternatives"). Execute selected direction via inline search. Merge new findings. Record confirmed assumptions and exploration angles. |
470
+ | **Agree & Suggest** | Ask user for specific direction (free text). Execute user's direction via inline search. Record user-driven rationale and findings. |
471
+ | **Adjust Direction** | Ask user for new focus. Analyze from adjusted perspective. Compare new insights with prior analysis. Identify what was missed. Record trigger reason, old vs new direction, expected impact. |
472
+ | **Specific Questions** | Capture questions. Answer with codebase search evidence. Rate confidence per answer. Document Q&A. Record knowledge gaps revealed. |
473
+ | **Analysis Complete** | Record why concluding at this round. Exit loop → Phase 4. |
474
+
475
+ ##### Step 3.3: Document Each Round
476
+
477
+ Update discussion.md using the [Round Documentation Pattern](#round-documentation-pattern).
478
+
479
+ **Append** to Discussion Timeline: User Direction, Decision Log, Key Findings, Analysis Results, Corrected Assumptions, Open Items, Narrative Synthesis.
480
+
481
+ **Replace** (not append):
482
+
483
+ | Section | Update Rule |
484
+ |---------|-------------|
485
+ | `## Current Understanding` | Overwrite with latest consolidated understanding. Follow [Consolidation Rules](#consolidation-rules). |
486
+ | `## Table of Contents` | Update links to include new Round N sections |
487
+
488
+ ##### Step 3.4: Intent Drift Check (every round >= 2)
489
+
490
+ Re-read original intent from discussion.md header. Compare against the Initial Intent Coverage Check from Phase 2:
491
+
492
+ ```markdown
493
+ #### Intent Coverage Check
494
+ - ✅ Intent 1: [addressed in Round N]
495
+ - 🔄 Intent 2: [in-progress, current focus]
496
+ - ⚠️ Intent 3: [implicitly absorbed by X — needs explicit confirmation]
497
+ - ❌ Intent 4: [not yet discussed]
498
+ ```
499
+
500
+ - If any item is "implicitly absorbed" (⚠️), note explicitly — absorbed ≠ addressed
501
+ - If ❌ or ⚠️ items exist → **proactively surface** to user: "以下原始意图尚未充分覆盖:[list]。是否需要调整优先级?"
502
+
503
+ **Success Criteria**:
504
+ - User feedback processed for each round
505
+ - discussion.md updated with all rounds, assumptions documented and corrected
506
+ - **All decision points recorded** with Decision Record format
507
+ - **Direction changes documented** with before/after comparison
508
+
509
+ ### Phase 4: Synthesis & Conclusion
510
+
511
+ **Objective**: Consolidate insights, generate conclusions and recommendations.
512
+
513
+ ##### Step 4.0: Intent Coverage Verification (MANDATORY gate)
514
+
515
+ For EACH original intent item, determine coverage status:
516
+
517
+ - **✅ Addressed**: Explicitly discussed and concluded
518
+ - **🔀 Transformed**: Original intent evolved — document transformation chain
519
+ - **⚠️ Absorbed**: Implicitly covered — flag for confirmation
520
+ - **❌ Missed**: Not discussed — MUST address or explicitly defer
521
+
522
+ Write "Intent Coverage Matrix" to discussion.md:
523
+
524
+ ```markdown
525
+ ### Intent Coverage Matrix
526
+ | # | Original Intent | Status | Where Addressed | Notes |
527
+ |---|----------------|--------|-----------------|-------|
528
+ | 1 | [intent text] | ✅ Addressed | Round N, Conclusion #M | |
529
+ | 2 | [intent text] | 🔀 Transformed | Round N → Round M | Original: X → Final: Y |
530
+ | 3 | [intent text] | ❌ Missed | — | Reason for omission |
531
+ ```
532
+
533
+ **Gate**: If any item is ❌ Missed, MUST either (a) add a discussion round to address it, or (b) explicitly confirm with user that it is intentionally deferred.
534
+
535
+ ##### Step 4.1: Findings-to-Recommendations Traceability (MANDATORY gate)
536
+
537
+ Collect ALL actionable findings from every round and map each to a disposition.
538
+
539
+ **Actionable finding sources**: key findings with actionable implications, technical solutions (proposed/validated), identified gaps (API-frontend gaps, missing features, design issues), corrected assumptions that imply fixes.
540
+
541
+ | Disposition | Meaning |
542
+ |-------------|---------|
543
+ | recommendation | Converted to a numbered recommendation |
544
+ | absorbed | Covered by another recommendation (specify which) |
545
+ | deferred | Explicitly out-of-scope with reason |
546
+ | informational | Pure insight, no action needed |
547
+
548
+ ```javascript
549
+ const findingsCoverage = allFindings.map(f => ({
550
+ finding: f.summary, round: f.round,
551
+ disposition: null, // MUST be assigned before proceeding
552
+ target: null, // e.g., "Rec #1" or "→ Rec #3" or "Reason: ..."
553
+ reason: null
554
+ }))
555
+
556
+ // Gate: ALL findings MUST have a disposition. Do NOT proceed with any disposition = null.
557
+ ```
558
+
559
+ Append Findings Coverage Matrix to discussion.md:
560
+
561
+ ```markdown
562
+ ### Findings Coverage Matrix
563
+ | # | Finding (Round) | Disposition | Target |
564
+ |---|----------------|-------------|--------|
565
+ | 1 | [finding] (R1) | recommendation | Rec #1 |
566
+ | 2 | [finding] (R2) | absorbed | → Rec #1 |
567
+ ```
568
+
569
+ ##### Step 4.2: Consolidate Insights
570
+
571
+ ```javascript
572
+ const conclusions = {
573
+ session_id: sessionId, topic,
574
+ completed: getUtc8ISOString(),
575
+ total_rounds: roundCount,
576
+ summary: '...', // Executive summary
577
+ key_conclusions: [ // Main conclusions
578
+ { point: '...', evidence: '...', confidence: 'high|medium|low' }
579
+ ],
580
+ recommendations: [ // MUST include all findings with disposition = 'recommendation'
581
+ {
582
+ action: '...', // What to do (imperative verb + target)
583
+ rationale: '...', // Why this matters
584
+ priority: 'high|medium|low',
585
+ evidence_refs: ['file:line', ...],
586
+ steps: [ // Granular sub-steps for execution
587
+ { description: '...', target: 'file/module', verification: 'how to verify done' }
588
+ ],
589
+ review_status: 'accepted|modified|rejected|pending'
590
+ }
591
+ ],
592
+ open_questions: [...],
593
+ follow_up_suggestions: [
594
+ { type: 'issue|task|research', summary: '...' }
595
+ ],
596
+ decision_trail: [ // Consolidated decisions from all phases
597
+ { round: 1, decision: '...', context: '...', options_considered: [...], chosen: '...', rejected_reasons: '...', reason: '...', impact: '...' }
598
+ ],
599
+ narrative_trail: [ // From Narrative Synthesis per round
600
+ { round: 1, starting_point: '...', key_progress: '...', hypothesis_impact: '...', updated_understanding: '...', remaining_questions: '...' }
601
+ ],
602
+ intent_coverage: [ // From Step 4.0
603
+ { intent: '...', status: 'addressed|transformed|absorbed|missed', where_addressed: '...', notes: '...' }
604
+ ],
605
+ findings_coverage: findingsCoverage // From Step 4.1
606
+ }
607
+ Write(`${sessionFolder}/conclusions.json`, JSON.stringify(conclusions, null, 2))
608
+ ```
609
+
610
+ ##### Step 4.3: Final discussion.md Update
611
+
612
+ **Synthesis & Conclusions**: Executive Summary, Key Conclusions (ranked by confidence), Recommendations (prioritized), Remaining Open Questions.
613
+
614
+ **Current Understanding (Final)**:
615
+
616
+ | Subsection | Content |
617
+ |------------|---------|
618
+ | What We Established | Confirmed points and validated findings |
619
+ | What Was Clarified | Important corrections (~~wrong→right~~) |
620
+ | Key Insights | Valuable learnings for future reference |
621
+
622
+ **Decision Trail**:
623
+
624
+ | Subsection | Content |
625
+ |------------|---------|
626
+ | Critical Decisions | Pivotal decisions that shaped the outcome |
627
+ | Direction Changes | Timeline of scope/focus adjustments with rationale |
628
+ | Trade-offs Made | Key trade-offs and why certain paths were chosen |
629
+
630
+ **Session Statistics**: Total discussion rounds, key findings count, dimensions covered, artifacts generated, **decision count**.
631
+
632
+ ##### Step 4.4: Interactive Recommendation Review (skip in auto mode)
633
+
634
+ Walk through each recommendation one-by-one (ordered by priority: high → medium → low):
635
+
636
+ ```javascript
637
+ for (const [index, rec] of sortedRecs.entries()) {
638
+ const review = request_user_input({
639
+ questions: [{
640
+ header: `建议#${index + 1}`,
641
+ id: `rec_${index + 1}`,
642
+ question: `Recommendation #${index + 1}: "${rec.action}" (${rec.priority} priority, ${rec.steps.length} steps). Your decision:`,
643
+ options: [
644
+ { label: "Accept(Recommended)", description: "Accept this recommendation as-is" },
645
+ { label: "Modify", description: "Adjust scope, steps, or priority" },
646
+ { label: "Reject", description: "Remove this recommendation" }
647
+ ]
648
+ }]
649
+ })
650
+ // Accept → "accepted" | Modify → gather text → "modified" | Reject → gather reason → "rejected"
651
+ // Accept All Remaining → mark all remaining as "accepted", break loop
652
+ // Record review decision to discussion.md Decision Log + update conclusions.json
653
+ }
654
+ ```
655
+
656
+ **Review Summary** (append to discussion.md):
657
+ ```markdown
658
+ ### Recommendation Review Summary
659
+ | # | Action | Priority | Steps | Review Status | Notes |
660
+ |---|--------|----------|-------|---------------|-------|
661
+ | 1 | [action] | high | 3 | ✅ Accepted | |
662
+ | 2 | [action] | medium | 2 | ✏️ Modified | [modification notes] |
663
+ | 3 | [action] | low | 1 | ❌ Rejected | [reason] |
664
+ ```
665
+
666
+ ##### Step 4.5: Post-Completion Options
667
+
668
+ Assess recommendation complexity, then offer appropriate next steps:
669
+
670
+ | Complexity | Condition | Available Options |
671
+ |------------|-----------|-------------------|
672
+ | `none` | No recommendations | Done, Create Issue, Export Report |
673
+ | `simple` | ≤2 low-priority items | Done, Create Issue, Export Report |
674
+ | `moderate` | 1-2 medium-priority | Generate Plan, Create Issue, Export Report, Done |
675
+ | `complex` | ≥3 or any high-priority | Generate Plan, Create Issue, Export Report, Done |
676
+
677
+ | Selection | Action |
678
+ |-----------|--------|
679
+ | Generate Plan | → Phase 5 (plan only, NO code modifications) |
680
+ | Create Issue | `Skill(skill="issue:new", args="...")` (only reviewed recs) |
681
+ | Export Report | Copy discussion.md + conclusions.json to user-specified location |
682
+ | Done | Display artifact paths, end |
683
+
684
+ Auto mode: generate plan only for moderate/complex, skip for simple/none.
685
+
686
+ **Success Criteria**:
687
+ - conclusions.json created with complete synthesis including findings_coverage[]
688
+ - **Findings Coverage Matrix** — all actionable findings mapped to disposition
689
+ - **Intent Coverage Matrix** — all original intents accounted for
690
+ - **Complete decision trail** documented and traceable
691
+
692
+ ### Phase 5: Plan Generation (Optional — NO code modifications)
693
+
694
+ **Trigger**: User selects "Generate Plan" in Phase 4. In auto mode, triggered only for `moderate`/`complex`.
695
+
696
+ ```javascript
697
+ const planChecklist = recs
698
+ .filter(r => r.review_status !== 'rejected')
699
+ .map((rec, index) => {
700
+ const files = rec.evidence_refs
701
+ ?.filter(ref => ref.includes(':'))
702
+ .map(ref => ref.split(':')[0]) || []
703
+
704
+ return `### ${index + 1}. ${rec.action}
705
+ - **Priority**: ${rec.priority}
706
+ - **Rationale**: ${rec.rationale}
707
+ - **Target files**: ${files.join(', ') || 'TBD'}
708
+ - **Evidence**: ${rec.evidence_refs?.join(', ') || 'N/A'}
709
+ - [ ] Ready for execution`
710
+ }).join('\n\n')
711
+
712
+ appendToDiscussion(`
713
+ ## Plan Checklist
714
+
715
+ > **This is a plan only — no code was modified.**
716
+ > To execute, use: \`$csv-wave-pipeline "<requirement summary>"\`
717
+
718
+ - **Recommendations**: ${recs.length}
719
+ - **Generated**: ${getUtc8ISOString()}
720
+
721
+ ${planChecklist}
722
+
723
+ ---
724
+
725
+ ### Next Step: Execute
726
+
727
+ Run \`$csv-wave-pipeline\` to execute these recommendations as wave-based batch tasks:
728
+
729
+ \`\`\`bash
730
+ $csv-wave-pipeline "${topic}"
731
+ \`\`\`
732
+ `)
733
+ ```
734
+
735
+ **Success Criteria**:
736
+ - Plan checklist in discussion.md with all accepted recommendations
737
+ - User reminded about `$csv-wave-pipeline` for execution
738
+ - **No source code modified**
739
+
740
+ ## Templates
741
+
742
+ ### Round Documentation Pattern
743
+
744
+ Each discussion round follows this structure in discussion.md:
745
+
746
+ ```markdown
747
+ ### Round N - [Deepen|Adjust|Suggest|Q&A] (timestamp)
748
+
749
+ #### User Input
750
+ What the user indicated they wanted to focus on
751
+
752
+ #### Decision Log
753
+ <!-- Use Decision Record Format from Recording Protocol -->
754
+
755
+ #### Key Findings
756
+ <!-- Use Key Finding Record Format from Recording Protocol -->
757
+
758
+ #### Analysis Results
759
+ Detailed findings from this round's analysis
760
+ - Finding 1 (evidence: file:line)
761
+ - Finding 2 (evidence: file:line)
762
+
763
+ #### Corrected Assumptions
764
+ - ~~Previous assumption~~ → Corrected understanding
765
+ - Reason: Why the assumption was wrong
766
+
767
+ #### Open Items
768
+ Remaining questions or areas for investigation
769
+
770
+ #### Narrative Synthesis
771
+ <!-- Use Narrative Synthesis Format from Recording Protocol -->
772
+ ```
773
+
774
+ ### discussion.md Evolution Summary
775
+
776
+ - **Header**: Session ID, topic, start time, dimensions
777
+ - **Analysis Context**: Focus areas, perspectives, depth level
778
+ - **Initial Questions**: Key questions to guide the analysis
779
+ - **Initial Decisions**: Why these dimensions and focus areas were selected
780
+ - **Discussion Timeline**: Round-by-round findings
781
+ - Round 1: Exploration Results + Decision Log + Narrative Synthesis
782
+ - Round 2-N: Current Understanding Summary + User feedback + direction adjustments + new insights + Decision Log + Key Findings + Narrative Synthesis
783
+ - **Decision Trail**: Consolidated critical decisions across all rounds
784
+ - **Synthesis & Conclusions**: Summary, key conclusions, recommendations
785
+ - **Current Understanding (Final)**: Consolidated insights
786
+ - **Session Statistics**: Rounds completed, findings count, artifacts generated, decision count
787
+
788
+ ## Reference
789
+
790
+ ### Output Structure
791
+
792
+ ```
793
+ {projectRoot}/.workflow/.analysis/ANL-{slug}-{date}/
794
+ ├── discussion.md # Evolution of understanding & discussions
795
+ ├── exploration-codebase.json # Phase 2: Codebase context
796
+ ├── explorations/ # Phase 2: Multi-perspective explorations (if selected)
797
+ │ ├── technical.json
798
+ │ ├── architectural.json
799
+ │ └── ...
800
+ ├── explorations.json # Phase 2: Single perspective aggregated findings
801
+ ├── perspectives.json # Phase 2: Multi-perspective findings with synthesis
802
+ └── conclusions.json # Phase 4: Final synthesis with recommendations
803
+ ```
804
+
805
+ > **Phase 5** appends a plan checklist to `discussion.md`. No additional files are generated.
806
+
807
+ | File | Phase | Description |
808
+ |------|-------|-------------|
809
+ | `discussion.md` | 1-5 | Session metadata → discussion timeline → conclusions. Plan checklist appended here. |
810
+ | `exploration-codebase.json` | 2 | Codebase context: relevant files, patterns, constraints |
811
+ | `explorations/*.json` | 2 | Per-perspective exploration results (multi only) |
812
+ | `explorations.json` | 2 | Single perspective aggregated findings |
813
+ | `perspectives.json` | 2 | Multi-perspective findings with cross-perspective synthesis |
814
+ | `conclusions.json` | 4 | Final synthesis: conclusions, recommendations, findings_coverage, open questions |
815
+
816
+ ### Analysis Dimensions
817
+
818
+ | Dimension | Keywords | Description |
819
+ |-----------|----------|-------------|
820
+ | architecture | 架构, architecture, design, structure, 设计, pattern | System design, component interactions, design patterns |
821
+ | implementation | 实现, implement, code, coding, 代码, logic | Code patterns, implementation details, algorithms |
822
+ | performance | 性能, performance, optimize, bottleneck, 优化, speed | Bottlenecks, optimization opportunities, resource usage |
823
+ | security | 安全, security, auth, permission, 权限, vulnerability | Vulnerabilities, authentication, access control |
824
+ | concept | 概念, concept, theory, principle, 原理, understand | Foundational ideas, principles, theory |
825
+ | comparison | 比较, compare, vs, difference, 区别, versus | Comparing solutions, evaluating alternatives |
826
+ | decision | 决策, decision, choice, tradeoff, 选择, trade-off | Trade-offs, impact analysis, decision rationale |
827
+
828
+ ### Analysis Perspectives
829
+
830
+ Optional multi-perspective analysis (single perspective is default, max 4):
831
+
832
+ | Perspective | Focus | Best For |
833
+ |------------|-------|----------|
834
+ | **Technical** | Implementation patterns, code structure, technical feasibility | Understanding how and technical details |
835
+ | **Architectural** | System design, scalability, component interactions | Understanding structure and organization |
836
+ | **Security** | Security patterns, vulnerabilities, access control | Identifying security risks |
837
+ | **Performance** | Bottlenecks, optimization, resource utilization | Finding performance issues |
838
+
839
+ **Selection**: User can multi-select up to 4 perspectives in Phase 1, or default to single comprehensive view.
840
+
841
+ ### Analysis Depth Levels
842
+
843
+ | Depth | Scope | Description |
844
+ |-------|-------|-------------|
845
+ | Quick | Surface level understanding | Fast overview, minimal exploration |
846
+ | Standard | Moderate depth with good coverage | Balanced analysis (default) |
847
+ | Deep | Comprehensive detailed analysis | Thorough multi-round investigation |
848
+
849
+ ### Dimension-Direction Mapping
850
+
851
+ When user selects focus areas, generate directions dynamically:
852
+
853
+ | Dimension | Possible Directions |
854
+ |-----------|-------------------|
855
+ | architecture | System Design, Component Interactions, Technology Choices, Integration Points, Design Patterns, Scalability Strategy |
856
+ | implementation | Code Structure, Implementation Details, Code Patterns, Error Handling, Testing Approach, Algorithm Analysis |
857
+ | performance | Performance Bottlenecks, Optimization Opportunities, Resource Utilization, Caching Strategy, Concurrency Issues |
858
+ | security | Security Vulnerabilities, Authentication/Authorization, Access Control, Data Protection, Input Validation |
859
+ | concept | Conceptual Foundation, Core Mechanisms, Fundamental Patterns, Theory & Principles, Trade-offs & Reasoning |
860
+ | comparison | Solution Comparison, Pros & Cons Analysis, Technology Evaluation, Approach Differences |
861
+ | decision | Decision Criteria, Trade-off Analysis, Risk Assessment, Impact Analysis, Implementation Implications |
862
+
863
+ **Implementation**: Present 2-3 top dimension-related directions, allow user to multi-select and add custom directions.
864
+
865
+ ### Consolidation Rules
866
+
867
+ When updating "Current Understanding" in discussion.md:
868
+
869
+ | Rule | Description |
870
+ |------|-------------|
871
+ | Promote confirmed insights | Move validated findings to "What We Established" |
872
+ | Track corrections | Keep important wrong→right transformations |
873
+ | Focus on current state | What do we know NOW, not the journey |
874
+ | Avoid timeline repetition | Don't copy discussion details into consolidated section |
875
+ | Preserve key learnings | Keep insights valuable for future reference |
876
+
877
+ **Example**:
878
+
879
+ Bad (cluttered):
880
+ ```markdown
881
+ ## Current Understanding
882
+ In round 1 we discussed X, then in round 2 user said Y...
883
+ ```
884
+
885
+ Good (consolidated):
886
+ ```markdown
887
+ ## Current Understanding
888
+
889
+ ### What We Established
890
+ - The authentication flow uses JWT with refresh tokens
891
+ - Rate limiting is implemented at API gateway level
892
+
893
+ ### What Was Clarified
894
+ - ~~Assumed Redis for sessions~~ → Actually uses database-backed sessions
895
+
896
+ ### Key Insights
897
+ - Current architecture supports horizontal scaling
898
+ ```
899
+
900
+ ### Error Handling
901
+
902
+ | Situation | Action | Recovery |
903
+ |-----------|--------|----------|
904
+ | No codebase detected | Normal flow, pure topic analysis | Proceed without exploration-codebase.json |
905
+ | Codebase search fails | Continue with available context | Note limitation in discussion.md |
906
+ | No relevant findings | Broaden search keywords | Ask user for clarification |
907
+ | User timeout in discussion | Save state, show resume command | Use `--continue` to resume |
908
+ | Max rounds reached (5) | Force synthesis phase | Highlight remaining questions in conclusions |
909
+ | Session folder conflict | Append timestamp suffix | Create unique folder and continue |
910
+ | Plan generation: no recommendations | No plan to generate | Inform user, suggest lite-plan |
911
+
912
+ ## Best Practices
913
+
914
+ ### Core Principles
915
+
916
+ 1. **No code modifications**: This skill is strictly read-only and plan-only. Phase 5 generates plan checklists but does NOT modify source code. Use `$csv-wave-pipeline` for execution.
917
+ 2. **Record Decisions Immediately**: Never defer recording — capture decisions as they happen using the Decision Record format
918
+ 3. **Evidence-Based**: Every conclusion should reference specific code or patterns with confidence levels
919
+ 4. **Embrace Corrections**: Track wrong→right transformations as valuable learnings
920
+
921
+ ### Before Starting
922
+
923
+ 1. **Clear Topic Definition**: Detailed topics lead to better dimension identification
924
+ 2. **User Context**: Understanding focus preferences helps scope the analysis
925
+ 3. **Perspective Selection**: Choose 2-4 perspectives for complex topics, single for focused queries
926
+ 4. **Scope Understanding**: Being clear about depth expectations sets correct analysis intensity
927
+
928
+ ### During Analysis
929
+
930
+ 1. **Review Findings**: Check exploration results before proceeding to discussion
931
+ 2. **Document Assumptions**: Track what you think is true for correction later
932
+ 3. **Use Continue Mode**: Resume sessions to build on previous findings
933
+ 4. **Iterate Thoughtfully**: Each discussion round should meaningfully refine understanding
934
+ 5. **Link Decisions to Outcomes**: Explicitly reference which decisions led to which outcomes
935
+
936
+ ### Documentation Practices
937
+
938
+ 1. **Timeline Clarity**: Use clear timestamps for traceability
939
+ 2. **Evolution Tracking**: Document how understanding changed across rounds
940
+ 3. **Multi-Perspective Synthesis**: When using multiple perspectives, document convergent/conflicting themes
941
+
942
+ ## When to Use
943
+
944
+ **Use analyze-with-file when:**
945
+ - Exploring complex topics collaboratively with documented trail
946
+ - Need multi-round iterative refinement of understanding
947
+ - Decision-making requires exploring multiple perspectives
948
+ - Building shared understanding before implementation
949
+ - Want to document how understanding evolved
950
+
951
+ **Use Plan Generation (Phase 5) when:**
952
+ - Analysis conclusions contain clear, actionable recommendations
953
+ - Simple: 1-2 items → inline plan checklist in discussion.md
954
+ - Complex: 3+ recommendations → detailed plan checklist
955
+ - **Then execute via**: `$csv-wave-pipeline` for wave-based batch execution
956
+
957
+ **Consider alternatives when:**
958
+ - Specific bug diagnosis needed → use `debug-with-file`
959
+ - Generating new ideas/solutions → use `brainstorm-with-file`
960
+ - Complex planning with parallel perspectives → use `collaborative-plan-with-file`
961
+ - Ready to implement → use `lite-plan`
962
+ - Requirement decomposition needed → use `req-plan-with-file`
963
+
964
+ ---
965
+
966
+ **Now execute the analyze-with-file workflow for topic**: $TOPIC