claude-code-workflow 7.2.29 → 7.3.0
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.
- package/.ccw/workflows/cli-templates/schemas/plan-overview-base-schema.json +2 -2
- package/.ccw/workflows/cli-templates/schemas/task-schema.json +14 -7
- package/.claude/agents/action-planning-agent.md +7 -4
- package/.claude/agents/cli-explore-agent.md +77 -63
- package/.claude/agents/cli-lite-planning-agent.md +11 -10
- package/.claude/agents/issue-plan-agent.md +421 -426
- package/.claude/commands/workflow/spec/setup.md +1 -1
- package/.claude/commands/workflow-skill.md +130 -0
- package/.claude/skills/ccw-chain/SKILL.md +92 -0
- package/.claude/skills/ccw-chain/chains/ccw-cycle.json +31 -0
- package/.claude/skills/ccw-chain/chains/ccw-exploration.json +58 -0
- package/.claude/skills/ccw-chain/chains/ccw-issue.json +44 -0
- package/.claude/skills/ccw-chain/chains/ccw-lightweight.json +71 -0
- package/.claude/skills/ccw-chain/chains/ccw-main.json +65 -0
- package/.claude/skills/ccw-chain/chains/ccw-standard.json +51 -0
- package/.claude/skills/ccw-chain/chains/ccw-team.json +15 -0
- package/.claude/skills/ccw-chain/chains/ccw-with-file.json +47 -0
- package/.claude/skills/ccw-chain/specs/auto-mode.md +47 -0
- package/.claude/skills/chain-loader/SKILL.md +78 -0
- package/.claude/skills/chain-loader/phases/01-analyze-skill.md +53 -0
- package/.claude/skills/chain-loader/phases/02-design-graph.md +73 -0
- package/.claude/skills/chain-loader/phases/03-generate-validate.md +75 -0
- package/.claude/skills/chain-loader/specs/chain-schema.md +126 -0
- package/.claude/skills/chain-loader/specs/design-patterns.md +99 -0
- package/.claude/skills/chain-loader/templates/chain-json.md +63 -0
- package/.claude/skills/review-cycle/phases/review-module.md +764 -764
- package/.claude/skills/review-cycle/phases/review-session.md +775 -775
- package/.claude/skills/workflow-multi-cli-plan/SKILL.md +2 -2
- package/.claude/skills/workflow-plan/SKILL.md +1 -0
- package/.claude/skills/workflow-plan/phases/01-session-discovery.md +19 -2
- package/.claude/skills/workflow-plan/phases/02-context-gathering.md +2 -2
- package/.claude/skills/workflow-plan/phases/03-conflict-resolution.md +422 -422
- package/.claude/skills/workflow-plan/phases/04-task-generation.md +9 -1
- package/.claude/skills/workflow-plan/phases/05-plan-verify.md +395 -395
- package/.claude/skills/workflow-tdd-plan/phases/02-context-gathering.md +407 -407
- package/.claude/skills/workflow-tdd-plan/phases/04-conflict-resolution.md +426 -426
- package/.claude/skills/workflow-test-fix/phases/02-test-context-gather.md +493 -493
- package/.codex/skills/analyze-with-file/SKILL.md +383 -134
- package/.codex/skills/brainstorm/SKILL.md +3 -3
- package/.codex/skills/brainstorm-with-file/SKILL.md +208 -88
- package/.codex/skills/clean/SKILL.md +1 -1
- package/.codex/skills/csv-wave-pipeline/SKILL.md +2 -2
- package/.codex/skills/investigate/orchestrator.md +24 -0
- package/.codex/skills/issue-discover/SKILL.md +374 -361
- package/.codex/skills/issue-discover/phases/01-issue-new.md +1 -1
- package/.codex/skills/issue-discover/phases/02-discover.md +2 -2
- package/.codex/skills/issue-discover/phases/03-discover-by-prompt.md +1 -1
- package/.codex/skills/issue-discover/phases/04-quick-execute.md +2 -2
- package/.codex/skills/parallel-dev-cycle/SKILL.md +44 -37
- package/.codex/skills/project-documentation-workflow/SKILL.md +1 -1
- package/.codex/skills/review-cycle/SKILL.md +31 -12
- package/.codex/skills/roadmap-with-file/SKILL.md +141 -133
- package/.codex/skills/security-audit/orchestrator.md +29 -0
- package/.codex/skills/session-sync/SKILL.md +1 -1
- package/.codex/skills/ship/orchestrator.md +24 -0
- package/.codex/skills/spec-add/SKILL.md +5 -5
- package/.codex/skills/spec-generator/SKILL.md +33 -2
- package/.codex/skills/spec-generator/phases/01-5-requirement-clarification.md +3 -3
- package/.codex/skills/spec-generator/phases/01-discovery.md +1 -1
- package/.codex/skills/spec-generator/phases/02-product-brief.md +1 -1
- package/.codex/skills/spec-generator/phases/03-requirements.md +1 -1
- package/.codex/skills/spec-generator/phases/04-architecture.md +1 -1
- package/.codex/skills/spec-generator/phases/05-epics-stories.md +1 -1
- package/.codex/skills/spec-generator/phases/06-readiness-check.md +1 -1
- package/.codex/skills/spec-generator/phases/07-issue-export.md +1 -1
- package/.codex/skills/spec-setup/SKILL.md +669 -669
- package/.codex/skills/team-arch-opt/specs/team-config.json +1 -1
- package/.codex/skills/team-brainstorm/SKILL.md +259 -259
- package/.codex/skills/team-coordinate/SKILL.md +359 -359
- package/.codex/skills/team-coordinate/roles/coordinator/commands/monitor.md +1 -1
- package/.codex/skills/team-designer/SKILL.md +27 -1
- package/.codex/skills/team-designer/phases/01-requirements-analysis.md +2 -2
- package/.codex/skills/team-designer/phases/02-scaffold-generation.md +1 -1
- package/.codex/skills/team-designer/phases/04-validation.md +1 -1
- package/.codex/skills/team-executor/SKILL.md +218 -218
- package/.codex/skills/team-frontend/SKILL.md +227 -227
- package/.codex/skills/team-frontend-debug/SKILL.md +278 -278
- package/.codex/skills/team-frontend-debug/roles/coordinator/commands/analyze.md +2 -2
- package/.codex/skills/team-interactive-craft/SKILL.md +220 -220
- package/.codex/skills/team-interactive-craft/roles/coordinator/role.md +209 -209
- package/.codex/skills/team-issue/SKILL.md +269 -269
- package/.codex/skills/team-issue/roles/coordinator/role.md +1 -1
- package/.codex/skills/team-lifecycle-v4/SKILL.md +305 -305
- package/.codex/skills/team-motion-design/SKILL.md +222 -222
- package/.codex/skills/team-motion-design/roles/coordinator/role.md +210 -210
- package/.codex/skills/team-perf-opt/SKILL.md +258 -258
- package/.codex/skills/team-perf-opt/specs/team-config.json +1 -1
- package/.codex/skills/team-planex/SKILL.md +216 -216
- package/.codex/skills/team-quality-assurance/SKILL.md +229 -229
- package/.codex/skills/team-review/SKILL.md +227 -227
- package/.codex/skills/team-roadmap-dev/SKILL.md +238 -238
- package/.codex/skills/team-roadmap-dev/roles/coordinator/commands/roadmap-discuss.md +5 -5
- package/.codex/skills/team-tech-debt/SKILL.md +206 -206
- package/.codex/skills/team-tech-debt/roles/coordinator/commands/monitor.md +1 -1
- package/.codex/skills/team-testing/SKILL.md +237 -237
- package/.codex/skills/team-ui-polish/SKILL.md +218 -218
- package/.codex/skills/team-ui-polish/roles/coordinator/role.md +213 -213
- package/.codex/skills/team-uidesign/SKILL.md +219 -219
- package/.codex/skills/team-uidesign/roles/coordinator/role.md +2 -2
- package/.codex/skills/team-ultra-analyze/SKILL.md +260 -260
- package/.codex/skills/team-ultra-analyze/roles/coordinator/commands/monitor.md +1 -1
- package/.codex/skills/team-ultra-analyze/roles/coordinator/role.md +1 -1
- package/.codex/skills/team-ux-improve/SKILL.md +227 -227
- package/.codex/skills/team-ux-improve/roles/coordinator/role.md +1 -1
- package/.codex/skills/team-ux-improve/specs/team-config.json +1 -1
- package/.codex/skills/team-visual-a11y/SKILL.md +319 -319
- package/.codex/skills/team-visual-a11y/roles/coordinator/role.md +213 -213
- package/.codex/skills/workflow-execute/SKILL.md +5 -5
- package/.codex/skills/workflow-lite-planex/SKILL.md +3 -3
- package/.codex/skills/workflow-plan/SKILL.md +3 -3
- package/.codex/skills/workflow-tdd-plan/SKILL.md +4 -4
- package/.codex/skills/workflow-test-fix-cycle/SKILL.md +403 -402
- package/README.md +14 -0
- package/ccw/dist/cli.d.ts.map +1 -1
- package/ccw/dist/cli.js +16 -0
- package/ccw/dist/cli.js.map +1 -1
- package/ccw/dist/commands/chain-loader.d.ts +2 -0
- package/ccw/dist/commands/chain-loader.d.ts.map +1 -0
- package/ccw/dist/commands/chain-loader.js +11 -0
- package/ccw/dist/commands/chain-loader.js.map +1 -0
- package/ccw/dist/commands/install.d.ts.map +1 -1
- package/ccw/dist/commands/install.js +52 -1
- package/ccw/dist/commands/install.js.map +1 -1
- package/ccw/dist/commands/launcher.d.ts +2 -0
- package/ccw/dist/commands/launcher.d.ts.map +1 -0
- package/ccw/dist/commands/launcher.js +434 -0
- package/ccw/dist/commands/launcher.js.map +1 -0
- package/ccw/dist/core/routes/litellm-api-routes.d.ts.map +1 -1
- package/ccw/dist/core/routes/litellm-api-routes.js +0 -23
- package/ccw/dist/core/routes/litellm-api-routes.js.map +1 -1
- package/ccw/dist/tools/chain-loader.d.ts +10 -0
- package/ccw/dist/tools/chain-loader.d.ts.map +1 -0
- package/ccw/dist/tools/chain-loader.js +1054 -0
- package/ccw/dist/tools/chain-loader.js.map +1 -0
- package/ccw/dist/tools/index.d.ts.map +1 -1
- package/ccw/dist/tools/index.js +2 -0
- package/ccw/dist/tools/index.js.map +1 -1
- package/ccw/dist/tools/json-builder.js +20 -0
- package/ccw/dist/tools/json-builder.js.map +1 -1
- package/ccw/dist/tools/skill-context-loader.d.ts.map +1 -1
- package/ccw/dist/tools/skill-context-loader.js +12 -26
- package/ccw/dist/tools/skill-context-loader.js.map +1 -1
- package/ccw/dist/types/chain-types.d.ts +112 -0
- package/ccw/dist/types/chain-types.d.ts.map +1 -0
- package/ccw/dist/types/chain-types.js +5 -0
- package/ccw/dist/types/chain-types.js.map +1 -0
- package/ccw/dist/utils/chain-visualizer.d.ts +13 -0
- package/ccw/dist/utils/chain-visualizer.d.ts.map +1 -0
- package/ccw/dist/utils/chain-visualizer.js +164 -0
- package/ccw/dist/utils/chain-visualizer.js.map +1 -0
- package/ccw/scripts/prepublish-clean.mjs +0 -1
- package/package.json +1 -3
- package/.claude/commands/cli/cli-init.md +0 -441
- package/.claude/commands/cli/codex-review.md +0 -361
- package/.claude/commands/flow-create.md +0 -663
- package/.claude/skills/team-edict.zip +0 -0
- package/ccw-litellm/README.md +0 -180
- package/ccw-litellm/pyproject.toml +0 -35
- package/ccw-litellm/src/ccw_litellm/__init__.py +0 -47
- package/ccw-litellm/src/ccw_litellm/cli.py +0 -108
- package/ccw-litellm/src/ccw_litellm/clients/__init__.py +0 -12
- package/ccw-litellm/src/ccw_litellm/clients/litellm_embedder.py +0 -270
- package/ccw-litellm/src/ccw_litellm/clients/litellm_llm.py +0 -198
- package/ccw-litellm/src/ccw_litellm/config/__init__.py +0 -22
- package/ccw-litellm/src/ccw_litellm/config/loader.py +0 -343
- package/ccw-litellm/src/ccw_litellm/config/models.py +0 -162
- package/ccw-litellm/src/ccw_litellm/interfaces/__init__.py +0 -14
- package/ccw-litellm/src/ccw_litellm/interfaces/embedder.py +0 -52
- package/ccw-litellm/src/ccw_litellm/interfaces/llm.py +0 -45
|
@@ -8,16 +8,19 @@ argument-hint: "TOPIC=\"<question or topic>\" [--depth=quick|standard|deep] [--c
|
|
|
8
8
|
|
|
9
9
|
## Overview
|
|
10
10
|
|
|
11
|
-
Interactive collaborative analysis workflow with **documented discussion process**. Records understanding evolution, facilitates multi-round Q&A, and uses inline search
|
|
11
|
+
Interactive collaborative analysis workflow with **documented discussion process**. Records understanding evolution, facilitates multi-round Q&A, and uses inline search + external research for deep exploration.
|
|
12
12
|
|
|
13
|
-
**Core workflow**: Topic → Explore → Discuss → Document → Refine → Conclude →
|
|
13
|
+
**Core workflow**: Topic → Explore → Research → Discuss → Document → Refine → Conclude → Next Step
|
|
14
14
|
|
|
15
15
|
**Key features**:
|
|
16
16
|
- **Documented discussion timeline**: Captures understanding evolution across all phases
|
|
17
17
|
- **Decision recording at every critical point**: Mandatory recording of key findings, direction changes, and trade-offs
|
|
18
|
+
- **Technical solution tracking**: Records proposed/validated/rejected solutions with evidence and alternatives
|
|
18
19
|
- **Multi-perspective analysis**: Supports up to 4 analysis perspectives (serial, inline)
|
|
19
|
-
- **
|
|
20
|
-
- **
|
|
20
|
+
- **External research**: Web search for best practices, patterns, and industry standards via `web.run`
|
|
21
|
+
- **Interactive discussion**: Multi-round Q&A with user feedback, direction adjustments, and research requests
|
|
22
|
+
- **Progress tracking**: `functions.update_plan` for real-time phase progress visibility
|
|
23
|
+
- **Structured handoff**: Terminal gate with execution planning, issue creation, or completion
|
|
21
24
|
|
|
22
25
|
## Auto Mode
|
|
23
26
|
|
|
@@ -62,18 +65,20 @@ When `--yes` or `-y`: Auto-confirm exploration decisions, use recommended analys
|
|
|
62
65
|
Step 0: Session Setup
|
|
63
66
|
├─ Parse topic, flags (--depth, --continue, -y)
|
|
64
67
|
├─ Generate session ID: ANL-{slug}-{date}
|
|
65
|
-
|
|
68
|
+
├─ Create session folder (or detect existing → continue mode)
|
|
69
|
+
└─ Initialize progress tracking: functions.update_plan([...phases])
|
|
66
70
|
|
|
67
71
|
Step 1: Topic Understanding
|
|
68
72
|
├─ Parse topic, identify analysis dimensions
|
|
69
|
-
├─ Initial scoping with user (focus
|
|
73
|
+
├─ Initial scoping with user: functions.request_user_input (focus, perspectives, depth)
|
|
70
74
|
└─ Initialize discussion.md
|
|
71
75
|
|
|
72
|
-
Step 2: Exploration (Inline
|
|
76
|
+
Step 2: Exploration (Inline + External Research)
|
|
73
77
|
├─ Detect codebase → search relevant modules, patterns
|
|
74
|
-
│ ├─
|
|
75
|
-
│ ├─
|
|
78
|
+
│ ├─ functions.exec_command('ccw spec load --category exploration')
|
|
79
|
+
│ ├─ functions.exec_command('ccw spec load --category debug')
|
|
76
80
|
│ └─ Use Grep, Glob, Read, mcp__ace-tool__search_context
|
|
81
|
+
├─ External research (if topic warrants): web.run for best practices, patterns
|
|
77
82
|
├─ Multi-perspective analysis (if selected, serial)
|
|
78
83
|
│ ├─ Single: Comprehensive analysis
|
|
79
84
|
│ └─ Multi (≤4): Serial per-perspective analysis with synthesis
|
|
@@ -86,13 +91,15 @@ Step 2: Exploration (Inline, No Agents)
|
|
|
86
91
|
Step 3: Interactive Discussion (Multi-Round, max 5)
|
|
87
92
|
├─ Current Understanding Summary (round ≥ 2, before findings)
|
|
88
93
|
├─ Present exploration findings
|
|
89
|
-
├─ Gather user feedback
|
|
94
|
+
├─ Gather user feedback: functions.request_user_input
|
|
90
95
|
├─ Process response:
|
|
91
96
|
│ ├─ Deepen → context-driven + heuristic options → deeper inline analysis
|
|
92
|
-
│ ├─
|
|
97
|
+
│ ├─ External Research → web.run for specific tech/pattern investigation
|
|
93
98
|
│ ├─ Adjust → new inline analysis with adjusted focus
|
|
94
99
|
│ ├─ Questions → direct answers with evidence
|
|
95
100
|
│ └─ Complete → exit loop for synthesis
|
|
101
|
+
├─ Record-Before-Continue: write findings to discussion.md BEFORE updating
|
|
102
|
+
├─ Technical Solution Triggers: detect and record proposed solutions
|
|
96
103
|
├─ Update discussion.md:
|
|
97
104
|
│ ├─ Append round details + Narrative Synthesis
|
|
98
105
|
│ ├─ Replace ## Current Understanding with latest state
|
|
@@ -105,12 +112,11 @@ Step 4: Synthesis & Conclusion
|
|
|
105
112
|
├─ Findings-to-Recommendations Traceability (mandatory gate)
|
|
106
113
|
├─ Consolidate all insights → conclusions.json (with steps[] per recommendation)
|
|
107
114
|
├─ Update discussion.md with final synthesis
|
|
108
|
-
├─ Interactive Recommendation Review (
|
|
109
|
-
└─
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
└─ Remind user to execute via $csv-wave-pipeline
|
|
115
|
+
├─ Interactive Recommendation Review: functions.request_user_input (batch confirm)
|
|
116
|
+
└─ MANDATORY Terminal Gate: functions.request_user_input (next step selection)
|
|
117
|
+
├─ 执行任务 → Build implementation scope → handoff to downstream planning
|
|
118
|
+
├─ 产出Issue → functions.exec_command('ccw issue create')
|
|
119
|
+
└─ 完成 → Display artifact paths, end
|
|
114
120
|
```
|
|
115
121
|
|
|
116
122
|
## Recording Protocol
|
|
@@ -125,6 +131,7 @@ Step 5: Plan Generation (Optional - produces plan only, NO code modifications)
|
|
|
125
131
|
| **User feedback** | User's original input, rationale for adoption/adjustment | `#### User Input` |
|
|
126
132
|
| **Disagreement & trade-off** | Conflicting viewpoints, trade-off basis, final choice | `#### Decision Log` |
|
|
127
133
|
| **Scope adjustment** | Before/after scope, trigger reason | `#### Decision Log` |
|
|
134
|
+
| **Technical solution proposed/validated/rejected** | Solution, rationale, alternatives, status, evidence | `#### Technical Solutions` |
|
|
128
135
|
|
|
129
136
|
### Decision Record Format
|
|
130
137
|
|
|
@@ -146,6 +153,20 @@ Step 5: Plan Generation (Optional - produces plan only, NO code modifications)
|
|
|
146
153
|
> - **Scope**: [What areas this affects]
|
|
147
154
|
```
|
|
148
155
|
|
|
156
|
+
### Technical Solution Record Format
|
|
157
|
+
|
|
158
|
+
Record when: an implementation approach is described with specific files/patterns, 2+ alternatives are compared, user confirms/modifies/rejects an approach, or a concrete code change strategy emerges.
|
|
159
|
+
|
|
160
|
+
```markdown
|
|
161
|
+
> **Solution**: [Description — what approach, pattern, or implementation]
|
|
162
|
+
> - **Status**: [Proposed / Validated / Rejected]
|
|
163
|
+
> - **Problem**: [What problem this solves]
|
|
164
|
+
> - **Rationale**: [Why this approach]
|
|
165
|
+
> - **Alternatives**: [Other options considered and why not chosen]
|
|
166
|
+
> - **Evidence**: [file:line or code anchor references]
|
|
167
|
+
> - **Next Action**: [Follow-up required or none]
|
|
168
|
+
```
|
|
169
|
+
|
|
149
170
|
### Narrative Synthesis Format
|
|
150
171
|
|
|
151
172
|
Append after each round update:
|
|
@@ -183,7 +204,7 @@ const analysisDepth = depthMatch ? depthMatch[1] : 'standard'
|
|
|
183
204
|
const topic = $ARGUMENTS.replace(/--yes|-y|--continue|--depth[=\s]\w+|TOPIC=/g, '').replace(/^["']|["']$/g, '').trim()
|
|
184
205
|
|
|
185
206
|
// Determine project root
|
|
186
|
-
const projectRoot =
|
|
207
|
+
const projectRoot = functions.exec_command('git rev-parse --show-toplevel 2>/dev/null || pwd').trim()
|
|
187
208
|
|
|
188
209
|
const slug = topic.toLowerCase().replace(/[^a-z0-9\u4e00-\u9fa5]+/g, '-').substring(0, 40)
|
|
189
210
|
const dateStr = getUtc8ISOString().substring(0, 10)
|
|
@@ -192,7 +213,16 @@ const sessionFolder = `${projectRoot}/.workflow/.analysis/${sessionId}`
|
|
|
192
213
|
|
|
193
214
|
// Auto-detect continue: session folder + discussion.md exists → continue mode
|
|
194
215
|
// If continue → load discussion.md + explorations, resume from last round
|
|
195
|
-
|
|
216
|
+
functions.exec_command(`mkdir -p ${sessionFolder}`)
|
|
217
|
+
|
|
218
|
+
// Initialize progress tracking (MANDATORY)
|
|
219
|
+
functions.update_plan([
|
|
220
|
+
{ id: "phase-1", title: "Phase 1: Topic Understanding", status: "in_progress" },
|
|
221
|
+
{ id: "phase-2", title: "Phase 2: Exploration & Research", status: "pending" },
|
|
222
|
+
{ id: "phase-3", title: "Phase 3: Interactive Discussion", status: "pending" },
|
|
223
|
+
{ id: "phase-4", title: "Phase 4: Synthesis & Conclusion", status: "pending" },
|
|
224
|
+
{ id: "next-step", title: "GATE: Post-Completion Next Step", status: "pending" }
|
|
225
|
+
])
|
|
196
226
|
```
|
|
197
227
|
|
|
198
228
|
### Phase 1: Topic Understanding
|
|
@@ -216,30 +246,41 @@ For new sessions, gather user preferences (skipped in auto mode or continue mode
|
|
|
216
246
|
|
|
217
247
|
```javascript
|
|
218
248
|
if (!autoYes && !continueMode) {
|
|
219
|
-
//
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
249
|
+
// Single call with up to 3 questions (functions.request_user_input constraint: 1-4 questions, 2-4 options each)
|
|
250
|
+
const scoping = functions.request_user_input({
|
|
251
|
+
questions: [
|
|
252
|
+
{
|
|
253
|
+
id: "focus",
|
|
254
|
+
header: "聚焦领域",
|
|
255
|
+
question: "Select analysis focus areas:",
|
|
256
|
+
multiSelect: true,
|
|
257
|
+
options: generateFocusOptions(dimensions) // Dynamic from Dimension-Direction Mapping, max 4
|
|
258
|
+
},
|
|
259
|
+
{
|
|
260
|
+
id: "perspectives",
|
|
261
|
+
header: "分析视角",
|
|
262
|
+
question: "Select analysis perspectives (single = focused, multi = broader):",
|
|
263
|
+
multiSelect: true,
|
|
264
|
+
options: [
|
|
265
|
+
{ label: "Technical", description: "Implementation patterns, code structure, feasibility" },
|
|
266
|
+
{ label: "Architectural", description: "System design, scalability, interactions" },
|
|
267
|
+
{ label: "Security", description: "Security patterns, vulnerabilities, access control" },
|
|
268
|
+
{ label: "Performance", description: "Bottlenecks, optimization, resource utilization" }
|
|
269
|
+
] // max 4 perspectives
|
|
270
|
+
},
|
|
271
|
+
{
|
|
272
|
+
id: "depth",
|
|
273
|
+
header: "分析深度",
|
|
274
|
+
question: "Analysis depth level:",
|
|
275
|
+
multiSelect: false,
|
|
276
|
+
options: [
|
|
277
|
+
{ label: "Standard(Recommended)", description: "Balanced analysis with good coverage" },
|
|
278
|
+
{ label: "Quick Overview", description: "Fast surface-level understanding" },
|
|
279
|
+
{ label: "Deep Dive", description: "Comprehensive multi-round investigation" }
|
|
280
|
+
]
|
|
281
|
+
}
|
|
282
|
+
]
|
|
239
283
|
})
|
|
240
|
-
|
|
241
|
-
// 3. Analysis depth (single-select, unless --depth already set)
|
|
242
|
-
// Quick: surface level | Standard: moderate depth | Deep: comprehensive
|
|
243
284
|
}
|
|
244
285
|
```
|
|
245
286
|
|
|
@@ -299,14 +340,16 @@ Write(`${sessionFolder}/discussion.md`, discussionMd)
|
|
|
299
340
|
- Analysis dimensions identified and user preferences captured
|
|
300
341
|
- **Initial decisions recorded**: Dimension selection rationale, excluded dimensions with reasons
|
|
301
342
|
|
|
343
|
+
**Progress**: `functions.update_plan([{id: "phase-1", status: "completed"}, {id: "phase-2", status: "in_progress"}])`
|
|
344
|
+
|
|
302
345
|
### Phase 2: Exploration
|
|
303
346
|
|
|
304
|
-
**Objective**: Gather codebase context
|
|
347
|
+
**Objective**: Gather codebase context, execute external research, and build understanding. All exploration done inline — no agent delegation.
|
|
305
348
|
|
|
306
349
|
##### Step 2.1: Detect Codebase & Explore
|
|
307
350
|
|
|
308
351
|
```javascript
|
|
309
|
-
const hasCodebase =
|
|
352
|
+
const hasCodebase = functions.exec_command(`
|
|
310
353
|
test -f package.json && echo "nodejs" ||
|
|
311
354
|
test -f go.mod && echo "golang" ||
|
|
312
355
|
test -f Cargo.toml && echo "rust" ||
|
|
@@ -318,8 +361,8 @@ const hasCodebase = Bash(`
|
|
|
318
361
|
|
|
319
362
|
if (hasCodebase !== 'none') {
|
|
320
363
|
// 1. Read project metadata (if exists)
|
|
321
|
-
// -
|
|
322
|
-
// -
|
|
364
|
+
// - functions.exec_command('ccw spec load --category exploration')
|
|
365
|
+
// - functions.exec_command('ccw spec load --category debug')
|
|
323
366
|
// - .workflow/specs/*.md (project conventions)
|
|
324
367
|
|
|
325
368
|
// 2. Search codebase for relevant content
|
|
@@ -329,7 +372,7 @@ if (hasCodebase !== 'none') {
|
|
|
329
372
|
// 3. Write findings
|
|
330
373
|
Write(`${sessionFolder}/exploration-codebase.json`, JSON.stringify({
|
|
331
374
|
project_type: hasCodebase,
|
|
332
|
-
relevant_files: [...], // [{path, relevance, summary}]
|
|
375
|
+
relevant_files: [...], // [{path, relevance, summary, dimensions[]}]
|
|
333
376
|
patterns: [...], // [{pattern, files, description}]
|
|
334
377
|
constraints: [...], // Architectural constraints found
|
|
335
378
|
integration_points: [...], // [{location, description}]
|
|
@@ -339,6 +382,44 @@ if (hasCodebase !== 'none') {
|
|
|
339
382
|
}
|
|
340
383
|
```
|
|
341
384
|
|
|
385
|
+
##### Step 2.1b: External Research (Parallel with Exploration)
|
|
386
|
+
|
|
387
|
+
Determine if external research adds value — skip for purely internal codebase questions (e.g., "how does module X work"), run for topics involving technology choices, best practices, architecture patterns, or comparison.
|
|
388
|
+
|
|
389
|
+
```javascript
|
|
390
|
+
const needsResearch = dimensions.some(d =>
|
|
391
|
+
['architecture', 'comparison', 'decision', 'performance', 'security'].includes(d)
|
|
392
|
+
) || topic.match(/best practice|pattern|vs|compare|approach|standard|library|framework/i)
|
|
393
|
+
|
|
394
|
+
if (needsResearch) {
|
|
395
|
+
// Use web.run for external research
|
|
396
|
+
const researchQueries = [
|
|
397
|
+
`${topic} best practices ${getUtc8ISOString().substring(0,4)}`,
|
|
398
|
+
`${topic} common pitfalls and known issues`,
|
|
399
|
+
...dimensions.filter(d => ['architecture','security','performance'].includes(d))
|
|
400
|
+
.map(d => `${topic} ${d} patterns and recommendations`)
|
|
401
|
+
]
|
|
402
|
+
|
|
403
|
+
const researchFindings = []
|
|
404
|
+
for (const query of researchQueries.slice(0, 3)) {
|
|
405
|
+
const result = web.run({ search_query: query })
|
|
406
|
+
researchFindings.push({ query, result })
|
|
407
|
+
}
|
|
408
|
+
|
|
409
|
+
// Write research findings
|
|
410
|
+
Write(`${sessionFolder}/research.json`, JSON.stringify({
|
|
411
|
+
topic, timestamp: getUtc8ISOString(),
|
|
412
|
+
findings: [...], // [{finding, detail, confidence, source_url}]
|
|
413
|
+
best_practices: [...], // [{practice, rationale, source}]
|
|
414
|
+
alternatives: [...], // [{option, pros, cons, verdict}]
|
|
415
|
+
pitfalls: [...], // [{issue, mitigation, source}]
|
|
416
|
+
codebase_gaps: [...], // [{gap, current_approach, recommended_approach}]
|
|
417
|
+
sources: [...], // [{title, url, key_takeaway}]
|
|
418
|
+
_metadata: { queries_executed: researchQueries.length }
|
|
419
|
+
}, null, 2))
|
|
420
|
+
}
|
|
421
|
+
```
|
|
422
|
+
|
|
342
423
|
##### Step 2.2: Multi-Perspective Analysis
|
|
343
424
|
|
|
344
425
|
Analyze from each selected perspective. All analysis done inline by the AI.
|
|
@@ -390,10 +471,26 @@ if (selectedPerspectives.length > 1) {
|
|
|
390
471
|
conflicting_views: [...], // Where perspectives differ
|
|
391
472
|
unique_contributions: [...] // Insights unique to specific perspectives
|
|
392
473
|
},
|
|
474
|
+
// Merge research findings if available
|
|
475
|
+
external_research: fileExists(`${sessionFolder}/research.json`)
|
|
476
|
+
? { findings: research.findings, best_practices: research.best_practices, codebase_gaps: research.codebase_gaps }
|
|
477
|
+
: null,
|
|
393
478
|
aggregated_findings: [...], discussion_points: [...], open_questions: [...]
|
|
394
479
|
}
|
|
395
480
|
Write(`${sessionFolder}/perspectives.json`, JSON.stringify(synthesis, null, 2))
|
|
396
481
|
}
|
|
482
|
+
|
|
483
|
+
// For single perspective, merge research into explorations.json
|
|
484
|
+
if (selectedPerspectives.length <= 1 && fileExists(`${sessionFolder}/research.json`)) {
|
|
485
|
+
const research = readJson(`${sessionFolder}/research.json`)
|
|
486
|
+
// Merge research best_practices[] and pitfalls[] into discussion points
|
|
487
|
+
// Cross-reference: flag gaps where codebase patterns diverge from research best practices
|
|
488
|
+
explorations.external_research = {
|
|
489
|
+
findings: research.findings, best_practices: research.best_practices,
|
|
490
|
+
codebase_gaps: research.codebase_gaps, sources: research.sources
|
|
491
|
+
}
|
|
492
|
+
Write(`${sessionFolder}/explorations.json`, JSON.stringify(explorations, null, 2))
|
|
493
|
+
}
|
|
397
494
|
```
|
|
398
495
|
|
|
399
496
|
##### Step 2.4: Update discussion.md
|
|
@@ -424,16 +521,33 @@ ${originalIntents.map((intent, i) => {
|
|
|
424
521
|
|
|
425
522
|
**Success Criteria**:
|
|
426
523
|
- exploration-codebase.json created with codebase context (if codebase exists)
|
|
524
|
+
- research.json created with external findings (if topic warrants research)
|
|
427
525
|
- explorations.json (single) or perspectives.json (multi) created with findings
|
|
526
|
+
- Research best practices merged; codebase gaps flagged
|
|
428
527
|
- discussion.md updated with Round 1 results
|
|
429
528
|
- **Initial Intent Coverage Check** completed — early drift detection
|
|
430
529
|
- **Key findings recorded** with evidence references and confidence levels
|
|
431
530
|
- **Exploration decisions recorded** (why certain perspectives/search strategies were chosen)
|
|
432
531
|
|
|
532
|
+
**Progress**: `functions.update_plan([{id: "phase-2", status: "completed"}, {id: "phase-3", status: "in_progress"}])`
|
|
533
|
+
|
|
433
534
|
### Phase 3: Interactive Discussion
|
|
434
535
|
|
|
435
536
|
**Objective**: Iteratively refine understanding through multi-round user-guided discussion cycles. **Max Rounds**: 5.
|
|
436
537
|
|
|
538
|
+
**Cumulative Context Rule**: Every analysis action in Phase 3 MUST include a summary of ALL prior findings to avoid re-discovering known information:
|
|
539
|
+
|
|
540
|
+
```javascript
|
|
541
|
+
const allFindings = readJson(`${sessionFolder}/explorations.json`) // or perspectives.json
|
|
542
|
+
const priorContext = `
|
|
543
|
+
## KNOWN FINDINGS (DO NOT re-discover)
|
|
544
|
+
- Established files: ${allFindings.sources?.map(s => s.file).join(', ')}
|
|
545
|
+
- Key findings: ${allFindings.key_findings?.join('; ')}
|
|
546
|
+
- Open questions: ${allFindings.open_questions?.join('; ')}
|
|
547
|
+
## NEW TASK: Focus ONLY on unexplored areas below.
|
|
548
|
+
`
|
|
549
|
+
```
|
|
550
|
+
|
|
437
551
|
##### Step 3.1: Present Findings & Gather Direction
|
|
438
552
|
|
|
439
553
|
**Current Understanding Summary** (Round >= 2, BEFORE presenting new findings):
|
|
@@ -442,15 +556,17 @@ ${originalIntents.map((intent, i) => {
|
|
|
442
556
|
|
|
443
557
|
```javascript
|
|
444
558
|
if (!autoYes) {
|
|
445
|
-
const feedback = request_user_input({
|
|
559
|
+
const feedback = functions.request_user_input({
|
|
446
560
|
questions: [{
|
|
447
|
-
header: "
|
|
561
|
+
header: "分析反馈",
|
|
448
562
|
id: "direction",
|
|
449
563
|
question: `Analysis round ${round}: Feedback on current findings?`,
|
|
564
|
+
multiSelect: false,
|
|
450
565
|
options: [
|
|
451
|
-
{ label: "
|
|
452
|
-
{ label: "
|
|
453
|
-
{ label: "
|
|
566
|
+
{ label: "继续深入(Recommended)", description: "Direction correct — deepen or specify direction" },
|
|
567
|
+
{ label: "外部研究", description: "Need external research on specific technology/pattern" },
|
|
568
|
+
{ label: "调整方向", description: "Different focus or specific questions to address" },
|
|
569
|
+
{ label: "分析完成", description: "Sufficient information, proceed to synthesis" }
|
|
454
570
|
]
|
|
455
571
|
}]
|
|
456
572
|
})
|
|
@@ -459,6 +575,17 @@ if (!autoYes) {
|
|
|
459
575
|
|
|
460
576
|
##### Step 3.2: Process User Response
|
|
461
577
|
|
|
578
|
+
**Record-Before-Continue Rule**: Each path below MUST write findings and discussion synthesis to `discussion.md` BEFORE proceeding to Step 3.3. After analysis returns results:
|
|
579
|
+
- Append exploration results, reasoning, and any technical approaches to current round section
|
|
580
|
+
- Apply **Technical Solution Triggers** — if an implementation approach is described, 2+ alternatives compared, or user confirms/rejects an approach → record using Technical Solution Record Format
|
|
581
|
+
- **Ambiguity Check**: For each Technical Solution with Status `Proposed`, verify no unresolved alternatives remain. If solution lists 2+ options without a chosen one:
|
|
582
|
+
```markdown
|
|
583
|
+
> **⚠️ Ambiguity**: [Solution] has [N] unresolved alternatives: [list]
|
|
584
|
+
> - **Needs**: [Decision criteria or exploration to resolve]
|
|
585
|
+
```
|
|
586
|
+
Surface unresolved ambiguities to user in the next feedback round.
|
|
587
|
+
- Only THEN proceed to Step 3.3 for Current Understanding replacement and TOC update
|
|
588
|
+
|
|
462
589
|
**Recording Checkpoint**: Regardless of option selected, MUST record to discussion.md:
|
|
463
590
|
- User's original choice and expression
|
|
464
591
|
- Impact on analysis direction
|
|
@@ -466,11 +593,54 @@ if (!autoYes) {
|
|
|
466
593
|
|
|
467
594
|
| Response | Action |
|
|
468
595
|
|----------|--------|
|
|
469
|
-
|
|
|
470
|
-
|
|
|
471
|
-
|
|
|
472
|
-
|
|
|
473
|
-
|
|
596
|
+
| **继续深入** | Sub-question to choose direction (see below). Execute via inline search. Merge new findings. Record confirmed assumptions and exploration angles. |
|
|
597
|
+
| **外部研究** | Ask user for research topic → `web.run({search_query: ...})` → merge findings into explorations.json `external_research` section → record as Key Findings in discussion.md |
|
|
598
|
+
| **调整方向** | Ask user for new focus. Analyze from adjusted perspective. Compare new insights with prior analysis. Record trigger, old vs new direction, expected impact. |
|
|
599
|
+
| **分析完成** | Record why concluding at this round. Exit loop → Phase 4. |
|
|
600
|
+
|
|
601
|
+
**继续深入** sub-options (dynamically generated, max 4 total):
|
|
602
|
+
|
|
603
|
+
```javascript
|
|
604
|
+
const deepenOptions = functions.request_user_input({
|
|
605
|
+
questions: [{
|
|
606
|
+
header: "深入方向",
|
|
607
|
+
id: "deepen_dir",
|
|
608
|
+
question: `Where to focus next?`,
|
|
609
|
+
multiSelect: false,
|
|
610
|
+
options: [
|
|
611
|
+
// Max 3 context-driven from: unresolved questions, low-confidence findings, unexplored dimensions
|
|
612
|
+
...generateContextDrivenOptions(allFindings.open_questions, lowConfidenceFindings).slice(0, 3),
|
|
613
|
+
// 1 heuristic option that breaks current frame
|
|
614
|
+
{ label: "换角度审视", description: "Compare with best practices / review from different perspective / explore simpler alternatives" }
|
|
615
|
+
] // Total max 4. "Other" auto-provided for user-specified custom direction
|
|
616
|
+
}]
|
|
617
|
+
})
|
|
618
|
+
```
|
|
619
|
+
|
|
620
|
+
**外部研究** flow:
|
|
621
|
+
|
|
622
|
+
```javascript
|
|
623
|
+
const researchTopic = functions.request_user_input({
|
|
624
|
+
questions: [{
|
|
625
|
+
header: "研究主题",
|
|
626
|
+
id: "research",
|
|
627
|
+
question: "What specific technology/pattern/approach needs external research?",
|
|
628
|
+
multiSelect: false,
|
|
629
|
+
options: [
|
|
630
|
+
// Dynamic from context: unresolved tech questions, unvalidated patterns
|
|
631
|
+
...generateResearchSuggestions(allFindings).slice(0, 3),
|
|
632
|
+
{ label: "自定义", description: "Enter custom research topic (via Other)" }
|
|
633
|
+
]
|
|
634
|
+
}]
|
|
635
|
+
})
|
|
636
|
+
|
|
637
|
+
// Execute research
|
|
638
|
+
const researchResult = web.run({ search_query: `${researchTopic} best practices ${currentYear}` })
|
|
639
|
+
|
|
640
|
+
// Merge into explorations.json external_research section
|
|
641
|
+
// Update research.json (append, don't overwrite)
|
|
642
|
+
// Record findings as Key Findings in discussion.md
|
|
643
|
+
```
|
|
474
644
|
|
|
475
645
|
##### Step 3.3: Document Each Round
|
|
476
646
|
|
|
@@ -504,8 +674,11 @@ Re-read original intent from discussion.md header. Compare against the Initial I
|
|
|
504
674
|
- User feedback processed for each round
|
|
505
675
|
- discussion.md updated with all rounds, assumptions documented and corrected
|
|
506
676
|
- **All decision points recorded** with Decision Record format
|
|
677
|
+
- **Technical solutions tracked** with Solution Record format where applicable
|
|
507
678
|
- **Direction changes documented** with before/after comparison
|
|
508
679
|
|
|
680
|
+
**Progress**: `functions.update_plan([{id: "phase-3", status: "completed"}, {id: "phase-4", status: "in_progress"}])`
|
|
681
|
+
|
|
509
682
|
### Phase 4: Synthesis & Conclusion
|
|
510
683
|
|
|
511
684
|
**Objective**: Consolidate insights, generate conclusions and recommendations.
|
|
@@ -631,25 +804,33 @@ Write(`${sessionFolder}/conclusions.json`, JSON.stringify(conclusions, null, 2))
|
|
|
631
804
|
|
|
632
805
|
##### Step 4.4: Interactive Recommendation Review (skip in auto mode)
|
|
633
806
|
|
|
634
|
-
|
|
807
|
+
Batch-confirm via **single `functions.request_user_input` call** (up to 4 questions, ordered by priority high→medium→low):
|
|
635
808
|
|
|
636
809
|
```javascript
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
810
|
+
// 1. Display all recommendations with numbering
|
|
811
|
+
console.log(sortedRecs.map((rec, i) =>
|
|
812
|
+
`${i+1}. **${rec.action}** [${rec.priority}] — ${rec.rationale} (${rec.steps.length} steps)`
|
|
813
|
+
).join('\n'))
|
|
814
|
+
|
|
815
|
+
// 2. Batch review (max 4 per call, one question per recommendation)
|
|
816
|
+
const batchSize = 4
|
|
817
|
+
for (let batch = 0; batch < sortedRecs.length; batch += batchSize) {
|
|
818
|
+
const batchRecs = sortedRecs.slice(batch, batch + batchSize)
|
|
819
|
+
const review = functions.request_user_input({
|
|
820
|
+
questions: batchRecs.map((rec, i) => ({
|
|
821
|
+
header: `建议#${batch + i + 1}`,
|
|
822
|
+
id: `rec_${batch + i + 1}`,
|
|
823
|
+
question: `"${rec.action}" (${rec.priority}, ${rec.steps.length} steps):`,
|
|
824
|
+
multiSelect: false,
|
|
643
825
|
options: [
|
|
644
|
-
{ label: "
|
|
645
|
-
{ label: "
|
|
646
|
-
{ label: "
|
|
826
|
+
{ label: "确认(Recommended)", description: "Accept as-is" },
|
|
827
|
+
{ label: "修改", description: "Adjust scope/steps" },
|
|
828
|
+
{ label: "删除", description: "Not needed" }
|
|
647
829
|
]
|
|
648
|
-
}
|
|
830
|
+
}))
|
|
649
831
|
})
|
|
650
|
-
//
|
|
651
|
-
//
|
|
652
|
-
// Record review decision to discussion.md Decision Log + update conclusions.json
|
|
832
|
+
// 确认 → "accepted" | 修改 → follow up for details → "modified" | 删除 → "rejected"
|
|
833
|
+
// Record all review decisions to discussion.md + update conclusions.json
|
|
653
834
|
}
|
|
654
835
|
```
|
|
655
836
|
|
|
@@ -663,79 +844,135 @@ for (const [index, rec] of sortedRecs.entries()) {
|
|
|
663
844
|
| 3 | [action] | low | 1 | ❌ Rejected | [reason] |
|
|
664
845
|
```
|
|
665
846
|
|
|
666
|
-
##### Step 4.5:
|
|
847
|
+
##### Step 4.5: MANDATORY Terminal Gate — Next Step Selection
|
|
667
848
|
|
|
668
|
-
|
|
849
|
+
> **CRITICAL**: This is a **terminal gate**. The workflow is INCOMPLETE if this step is not executed. After recommendation review, you MUST immediately proceed here.
|
|
669
850
|
|
|
670
|
-
|
|
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 |
|
|
851
|
+
**Progress**: `functions.update_plan([{id: "phase-4", status: "completed"}, {id: "next-step", status: "in_progress"}])`
|
|
676
852
|
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
853
|
+
```javascript
|
|
854
|
+
const nextStep = functions.request_user_input({
|
|
855
|
+
questions: [{
|
|
856
|
+
header: "Next Step",
|
|
857
|
+
id: "next_step",
|
|
858
|
+
question: "What would you like to do with the analysis results?",
|
|
859
|
+
multiSelect: false,
|
|
860
|
+
options: [
|
|
861
|
+
{ label: "执行任务(Recommended)", description: "Build implementation scope and hand off to planning" },
|
|
862
|
+
{ label: "产出Issue", description: "Convert recommendations to tracked issues" },
|
|
863
|
+
{ label: "完成", description: "Analysis sufficient, no further action needed" }
|
|
864
|
+
]
|
|
865
|
+
}]
|
|
866
|
+
})
|
|
867
|
+
```
|
|
683
868
|
|
|
684
|
-
|
|
869
|
+
**Handle user selection**:
|
|
685
870
|
|
|
686
|
-
**
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
871
|
+
**"执行任务"** → Implementation Scoping + Handoff:
|
|
872
|
+
|
|
873
|
+
**Step A: Build Implementation Scope** — Transform recommendations into actionable specs:
|
|
874
|
+
```javascript
|
|
875
|
+
const actionableRecs = conclusions.recommendations
|
|
876
|
+
.filter(r => r.review_status === 'accepted' || r.review_status === 'modified')
|
|
877
|
+
.sort((a, b) => (a.priority === 'high' ? 0 : 1) - (b.priority === 'high' ? 0 : 1))
|
|
878
|
+
|
|
879
|
+
const implScope = actionableRecs.map(rec => ({
|
|
880
|
+
objective: rec.action,
|
|
881
|
+
rationale: rec.rationale,
|
|
882
|
+
priority: rec.priority,
|
|
883
|
+
target_files: rec.steps.flatMap(s => s.target ? [s.target] : []),
|
|
884
|
+
acceptance_criteria: rec.steps.map(s => s.verification || s.description),
|
|
885
|
+
change_summary: rec.steps.map(s => `${s.target || 'TBD'}: ${s.description}`).join('; ')
|
|
886
|
+
}))
|
|
887
|
+
```
|
|
691
888
|
|
|
692
|
-
|
|
889
|
+
**Step B: User Scope Confirmation** (skip in auto mode):
|
|
890
|
+
```javascript
|
|
891
|
+
if (!autoYes) {
|
|
892
|
+
// Present implementation scope summary
|
|
893
|
+
console.log(`## Implementation Scope (${implScope.length} items)`)
|
|
894
|
+
implScope.forEach((item, i) => {
|
|
895
|
+
console.log(`${i+1}. **${item.objective}** [${item.priority}]`)
|
|
896
|
+
console.log(` Files: ${item.target_files.join(', ') || 'TBD by planning'}`)
|
|
897
|
+
console.log(` Done when: ${item.acceptance_criteria.join(' + ')}`)
|
|
898
|
+
})
|
|
693
899
|
|
|
694
|
-
|
|
900
|
+
const scopeConfirm = functions.request_user_input({
|
|
901
|
+
questions: [{
|
|
902
|
+
header: "Scope确认",
|
|
903
|
+
id: "scope",
|
|
904
|
+
question: "Implementation scope correct?",
|
|
905
|
+
multiSelect: false,
|
|
906
|
+
options: [
|
|
907
|
+
{ label: "确认执行(Recommended)", description: "Scope is clear, proceed to planning" },
|
|
908
|
+
{ label: "调整范围", description: "Narrow or expand scope before planning" },
|
|
909
|
+
{ label: "补充标准", description: "Add/refine acceptance criteria" }
|
|
910
|
+
]
|
|
911
|
+
}]
|
|
912
|
+
})
|
|
913
|
+
// Handle 调整范围 / 补充标准 → update implScope, re-confirm
|
|
914
|
+
}
|
|
915
|
+
```
|
|
695
916
|
|
|
917
|
+
**Step C: Build Structured Handoff**:
|
|
696
918
|
```javascript
|
|
697
|
-
const
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
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')
|
|
919
|
+
const handoff = {
|
|
920
|
+
source: 'analyze-with-file',
|
|
921
|
+
session_id: sessionId,
|
|
922
|
+
session_folder: sessionFolder,
|
|
923
|
+
summary: conclusions.summary,
|
|
924
|
+
implementation_scope: implScope,
|
|
925
|
+
key_findings: conclusions.key_conclusions?.slice(0, 5) || [],
|
|
926
|
+
decision_context: conclusions.decision_trail?.slice(-3) || []
|
|
927
|
+
}
|
|
711
928
|
|
|
929
|
+
// Append plan checklist to discussion.md
|
|
712
930
|
appendToDiscussion(`
|
|
713
931
|
## Plan Checklist
|
|
714
932
|
|
|
715
933
|
> **This is a plan only — no code was modified.**
|
|
716
|
-
> To execute, use: \`$csv-wave-pipeline "<requirement summary>"\`
|
|
717
934
|
|
|
718
|
-
- **Recommendations**: ${
|
|
935
|
+
- **Recommendations**: ${actionableRecs.length}
|
|
719
936
|
- **Generated**: ${getUtc8ISOString()}
|
|
720
937
|
|
|
721
|
-
${
|
|
938
|
+
${implScope.map((item, i) => `### ${i+1}. ${item.objective}
|
|
939
|
+
- **Priority**: ${item.priority}
|
|
940
|
+
- **Rationale**: ${item.rationale}
|
|
941
|
+
- **Target files**: ${item.target_files.join(', ') || 'TBD'}
|
|
942
|
+
- **Acceptance criteria**: ${item.acceptance_criteria.join('; ')}
|
|
943
|
+
- [ ] Ready for execution`).join('\n\n')}
|
|
944
|
+
`)
|
|
722
945
|
|
|
723
|
-
|
|
946
|
+
// Hand off to downstream planning tool
|
|
947
|
+
functions.exec_command(`echo '${JSON.stringify(handoff)}' > ${sessionFolder}/handoff-spec.json`)
|
|
948
|
+
```
|
|
724
949
|
|
|
725
|
-
|
|
950
|
+
**"产出Issue"** → Convert recommendations to issues:
|
|
951
|
+
```javascript
|
|
952
|
+
for (const rec of actionableRecs) {
|
|
953
|
+
const issueJson = JSON.stringify({
|
|
954
|
+
title: rec.action,
|
|
955
|
+
context: `${rec.action}\n\nRationale: ${rec.rationale}\nEvidence: ${rec.evidence_refs?.join(', ')}`,
|
|
956
|
+
priority: rec.priority === 'high' ? 2 : 3,
|
|
957
|
+
source: 'discovery',
|
|
958
|
+
labels: dimensions
|
|
959
|
+
})
|
|
960
|
+
functions.exec_command(`echo '${issueJson}' | ccw issue create`)
|
|
961
|
+
}
|
|
962
|
+
// Display created issue IDs with next step hint
|
|
963
|
+
```
|
|
726
964
|
|
|
727
|
-
|
|
965
|
+
**"完成"** → Display artifact paths, end.
|
|
728
966
|
|
|
729
|
-
|
|
730
|
-
$csv-wave-pipeline "${topic}"
|
|
731
|
-
\`\`\`
|
|
732
|
-
`)
|
|
733
|
-
```
|
|
967
|
+
**Progress**: `functions.update_plan([{id: "next-step", status: "completed"}])`
|
|
734
968
|
|
|
735
969
|
**Success Criteria**:
|
|
736
|
-
-
|
|
737
|
-
-
|
|
738
|
-
- **
|
|
970
|
+
- conclusions.json created with complete synthesis including findings_coverage[]
|
|
971
|
+
- **Findings Coverage Matrix** — all actionable findings mapped to disposition
|
|
972
|
+
- **Intent Coverage Matrix** — all original intents accounted for
|
|
973
|
+
- **Complete decision trail** documented and traceable
|
|
974
|
+
- **Terminal gate executed** — `next-step` is completed
|
|
975
|
+
- **No source code modified** — analysis is read-only throughout
|
|
739
976
|
|
|
740
977
|
## Templates
|
|
741
978
|
|
|
@@ -744,7 +981,7 @@ $csv-wave-pipeline "${topic}"
|
|
|
744
981
|
Each discussion round follows this structure in discussion.md:
|
|
745
982
|
|
|
746
983
|
```markdown
|
|
747
|
-
### Round N - [Deepen|Adjust|
|
|
984
|
+
### Round N - [Deepen|Research|Adjust|Q&A] (timestamp)
|
|
748
985
|
|
|
749
986
|
#### User Input
|
|
750
987
|
What the user indicated they wanted to focus on
|
|
@@ -755,6 +992,10 @@ What the user indicated they wanted to focus on
|
|
|
755
992
|
#### Key Findings
|
|
756
993
|
<!-- Use Key Finding Record Format from Recording Protocol -->
|
|
757
994
|
|
|
995
|
+
#### Technical Solutions
|
|
996
|
+
<!-- Use Technical Solution Record Format from Recording Protocol -->
|
|
997
|
+
<!-- Only if implementation approaches were discussed this round -->
|
|
998
|
+
|
|
758
999
|
#### Analysis Results
|
|
759
1000
|
Detailed findings from this round's analysis
|
|
760
1001
|
- Finding 1 (evidence: file:line)
|
|
@@ -793,25 +1034,29 @@ Remaining questions or areas for investigation
|
|
|
793
1034
|
{projectRoot}/.workflow/.analysis/ANL-{slug}-{date}/
|
|
794
1035
|
├── discussion.md # Evolution of understanding & discussions
|
|
795
1036
|
├── exploration-codebase.json # Phase 2: Codebase context
|
|
1037
|
+
├── research.json # Phase 2: External research findings (if topic warrants)
|
|
796
1038
|
├── explorations/ # Phase 2: Multi-perspective explorations (if selected)
|
|
797
1039
|
│ ├── technical.json
|
|
798
1040
|
│ ├── architectural.json
|
|
799
1041
|
│ └── ...
|
|
800
1042
|
├── explorations.json # Phase 2: Single perspective aggregated findings
|
|
801
1043
|
├── perspectives.json # Phase 2: Multi-perspective findings with synthesis
|
|
802
|
-
|
|
1044
|
+
├── conclusions.json # Phase 4: Final synthesis with recommendations
|
|
1045
|
+
└── handoff-spec.json # Phase 4: Structured handoff (if "执行任务" selected)
|
|
803
1046
|
```
|
|
804
1047
|
|
|
805
|
-
> **Phase
|
|
1048
|
+
> **Phase 4 Terminal Gate** determines which additional artifacts are generated (plan checklist in discussion.md, handoff-spec.json, or issues).
|
|
806
1049
|
|
|
807
1050
|
| File | Phase | Description |
|
|
808
1051
|
|------|-------|-------------|
|
|
809
|
-
| `discussion.md` | 1-
|
|
1052
|
+
| `discussion.md` | 1-4 | Session metadata → discussion timeline → conclusions. Plan checklist appended if "执行任务". |
|
|
810
1053
|
| `exploration-codebase.json` | 2 | Codebase context: relevant files, patterns, constraints |
|
|
1054
|
+
| `research.json` | 2-3 | External research: best practices, pitfalls, codebase gaps (web.run results) |
|
|
811
1055
|
| `explorations/*.json` | 2 | Per-perspective exploration results (multi only) |
|
|
812
1056
|
| `explorations.json` | 2 | Single perspective aggregated findings |
|
|
813
1057
|
| `perspectives.json` | 2 | Multi-perspective findings with cross-perspective synthesis |
|
|
814
1058
|
| `conclusions.json` | 4 | Final synthesis: conclusions, recommendations, findings_coverage, open questions |
|
|
1059
|
+
| `handoff-spec.json` | 4 | Structured handoff for downstream planning (if "执行任务" selected) |
|
|
815
1060
|
|
|
816
1061
|
### Analysis Dimensions
|
|
817
1062
|
|
|
@@ -907,16 +1152,20 @@ Good (consolidated):
|
|
|
907
1152
|
| User timeout in discussion | Save state, show resume command | Use `--continue` to resume |
|
|
908
1153
|
| Max rounds reached (5) | Force synthesis phase | Highlight remaining questions in conclusions |
|
|
909
1154
|
| Session folder conflict | Append timestamp suffix | Create unique folder and continue |
|
|
910
|
-
| Plan generation: no recommendations | No plan to generate | Inform user, suggest
|
|
1155
|
+
| Plan generation: no recommendations | No plan to generate | Inform user, suggest alternative |
|
|
1156
|
+
| Web research fails | Continue with codebase-only analysis | Note limitation, flag as codebase_gaps |
|
|
1157
|
+
| Research conflicts with codebase | Flag as codebase_gaps | Surface divergence for user review |
|
|
911
1158
|
|
|
912
1159
|
## Best Practices
|
|
913
1160
|
|
|
914
1161
|
### Core Principles
|
|
915
1162
|
|
|
916
|
-
1. **No code modifications**: This skill is strictly read-only and plan-only. Phase
|
|
1163
|
+
1. **No code modifications**: This skill is strictly read-only and plan-only. Phase 4 generates plan checklists and handoff specs but does NOT modify source code.
|
|
917
1164
|
2. **Record Decisions Immediately**: Never defer recording — capture decisions as they happen using the Decision Record format
|
|
918
|
-
3. **
|
|
919
|
-
4. **
|
|
1165
|
+
3. **Track Technical Solutions**: Record proposed/validated/rejected solutions with Technical Solution Record format
|
|
1166
|
+
4. **Evidence-Based**: Every conclusion should reference specific code or patterns with confidence levels
|
|
1167
|
+
5. **Embrace Corrections**: Track wrong→right transformations as valuable learnings
|
|
1168
|
+
6. **Cumulative Context**: Always include prior findings in follow-up analysis to avoid re-discovery
|
|
920
1169
|
|
|
921
1170
|
### Before Starting
|
|
922
1171
|
|
|
@@ -947,19 +1196,19 @@ Good (consolidated):
|
|
|
947
1196
|
- Decision-making requires exploring multiple perspectives
|
|
948
1197
|
- Building shared understanding before implementation
|
|
949
1198
|
- Want to document how understanding evolved
|
|
1199
|
+
- Need external research integrated with codebase analysis
|
|
950
1200
|
|
|
951
|
-
**Use
|
|
1201
|
+
**Use Terminal Gate (Phase 4) when:**
|
|
952
1202
|
- Analysis conclusions contain clear, actionable recommendations
|
|
953
|
-
-
|
|
954
|
-
-
|
|
955
|
-
-
|
|
1203
|
+
- **执行任务**: Build implementation scope → handoff to downstream planning
|
|
1204
|
+
- **产出Issue**: Convert recommendations to tracked issues via `ccw issue create`
|
|
1205
|
+
- **完成**: Analysis is sufficient, no further action needed
|
|
956
1206
|
|
|
957
1207
|
**Consider alternatives when:**
|
|
958
1208
|
- Specific bug diagnosis needed → use `debug-with-file`
|
|
959
1209
|
- Generating new ideas/solutions → use `brainstorm-with-file`
|
|
960
1210
|
- Complex planning with parallel perspectives → use `collaborative-plan-with-file`
|
|
961
1211
|
- Ready to implement → use `lite-plan`
|
|
962
|
-
- Requirement decomposition needed → use `req-plan-with-file`
|
|
963
1212
|
|
|
964
1213
|
---
|
|
965
1214
|
|