claude-code-workflow 7.2.11 → 7.2.12

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 (29) hide show
  1. package/.claude/commands/workflow/analyze-with-file.md +108 -54
  2. package/.claude/commands/workflow-tune.md +811 -0
  3. package/.claude/skills/workflow-lite-execute/SKILL.md +106 -14
  4. package/.claude/skills/workflow-lite-plan/SKILL.md +34 -72
  5. package/.claude/skills/workflow-lite-test-review/SKILL.md +39 -26
  6. package/package.json +1 -1
  7. package/.claude/commands/ddd/auto.md +0 -359
  8. package/.claude/commands/ddd/doc-generate.md +0 -222
  9. package/.claude/commands/ddd/doc-refresh.md +0 -218
  10. package/.claude/commands/ddd/execute.md +0 -416
  11. package/.claude/commands/ddd/index-build.md +0 -212
  12. package/.claude/commands/ddd/plan.md +0 -611
  13. package/.claude/commands/ddd/scan.md +0 -365
  14. package/.claude/commands/ddd/sync.md +0 -353
  15. package/.claude/commands/ddd/update.md +0 -160
  16. package/.claude/commands/idaw/add.md +0 -287
  17. package/.claude/commands/idaw/resume.md +0 -442
  18. package/.claude/commands/idaw/run-coordinate.md +0 -648
  19. package/.claude/commands/idaw/run.md +0 -539
  20. package/.claude/commands/idaw/status.md +0 -182
  21. package/.claude/skills/workflow-tune/SKILL.md +0 -487
  22. package/.claude/skills/workflow-tune/phases/01-setup.md +0 -548
  23. package/.claude/skills/workflow-tune/phases/02-step-execute.md +0 -197
  24. package/.claude/skills/workflow-tune/phases/03-step-analyze.md +0 -386
  25. package/.claude/skills/workflow-tune/phases/04-synthesize.md +0 -257
  26. package/.claude/skills/workflow-tune/phases/05-optimize-report.md +0 -246
  27. package/.claude/skills/workflow-tune/specs/workflow-eval-criteria.md +0 -57
  28. package/.claude/skills/workflow-tune/templates/step-analysis-prompt.md +0 -88
  29. package/.claude/skills/workflow-tune/templates/synthesis-prompt.md +0 -90
@@ -78,10 +78,10 @@ All `AskUserQuestion` calls MUST comply:
78
78
  |-------|----------|-------------|
79
79
  | 1 | `discussion.md` | Initialized with TOC, Current Understanding block, timeline, metadata |
80
80
  | 1 | Session variables | Dimensions, focus areas, analysis depth |
81
- | 2 | `exploration-codebase.json` | Single codebase context from cli-explore-agent |
82
- | 2 | `explorations/*.json` | Multi-perspective codebase explorations (parallel, up to 4) |
83
- | 2 | `explorations.json` | Single perspective aggregated findings |
84
- | 2 | `perspectives.json` | Multi-perspective findings (up to 4) with synthesis |
81
+ | 2 | `exploration-codebase.json` | Shared Layer 1 discovery (files, modules, patterns) — always created |
82
+ | 2 | `explorations/*.json` | Per-perspective Layer 2-3 deep-dives (multi-perspective only, max 4) |
83
+ | 2 | `explorations.json` | Single perspective aggregated findings (Layer 1 + CLI analysis) |
84
+ | 2 | `perspectives.json` | Multi-perspective findings (Layer 1 shared + per-perspective deep-dives) with synthesis |
85
85
  | 2 | Updated `discussion.md` | Round 1 + Initial Intent Coverage Check + Current Understanding replaced |
86
86
  | 3 | Updated `discussion.md` | Round 2-N: feedback, insights, narrative synthesis; TOC + Current Understanding updated each round |
87
87
  | 4 | `conclusions.json` | Final synthesis with recommendations (incl. steps[] + review_status) |
@@ -141,92 +141,124 @@ All `AskUserQuestion` calls MUST comply:
141
141
  <step name="cli_exploration">
142
142
  **Phase 2: Codebase exploration FIRST, then CLI analysis.**
143
143
 
144
- **Step 1: Codebase Exploration** (cli-explore-agent, parallel up to 6)
144
+ **Step 1: Codebase Exploration** (cli-explore-agent, 1 shared + N perspective-specific)
145
145
 
146
- - **Single**: General codebase analysis -> `{sessionFolder}/exploration-codebase.json`
147
- - **Multi-perspective**: Parallel per-perspective -> `{sessionFolder}/explorations/{perspective}.json`
148
- - **Common tasks**: `ccw tool exec get_modules_by_depth '{}'`, keyword searches, read `.workflow/project-tech.json`
146
+ Two-phase approach to avoid redundant file discovery:
147
+
148
+ **Phase A Shared Discovery** (1 agent, always runs):
149
+ One cli-explore-agent performs Layer 1 (breadth) for ALL perspectives -> `{sessionFolder}/exploration-codebase.json`
149
150
 
150
151
  ```javascript
151
- // Template for cli-explore-agent (single or per-perspective)
152
+ // Shared Layer 1 discovery runs ONCE regardless of perspective count
152
153
  Agent({
153
154
  subagent_type: "cli-explore-agent",
154
155
  run_in_background: false,
155
- description: `Explore codebase: ${topicSlug}`,
156
+ description: `Discover codebase: ${topicSlug}`,
156
157
  prompt: `
157
158
  ## Analysis Context
158
159
  Topic: ${topic_or_question}
159
160
  Dimensions: ${dimensions.join(', ')}
160
- // For multi-perspective, add: Perspective: ${perspective.name} - ${perspective.focus}
161
161
  Session: ${sessionFolder}
162
162
 
163
163
  ## MANDATORY FIRST STEPS
164
164
  1. Run: ccw tool exec get_modules_by_depth '{}'
165
165
  2. Read: .workflow/project-tech.json (if exists)
166
166
 
167
- ## Layered Exploration (MUST follow all 3 layers)
167
+ ## Layer 1 Module Discovery (Breadth ONLY)
168
+ - Search by topic keywords across ALL dimensions: ${dimensions.join(', ')}
169
+ - Identify ALL relevant files, map module boundaries and entry points
170
+ - Categorize files by dimension/perspective relevance
171
+ - Output: relevant_files[] with annotations + dimension tags, initial patterns[]
172
+
173
+ ## Output
174
+ Write to: ${sessionFolder}/exploration-codebase.json
175
+ Schema: {relevant_files: [{path, annotation, dimensions[]}], patterns[], module_map: {}, questions_for_user, _metadata}
176
+ `
177
+ })
178
+ ```
179
+
180
+ **Phase B — Perspective Deep-Dive** (parallel, only for multi-perspective, max 4):
181
+ Each perspective agent receives shared Layer 1 results, performs only Layer 2-3 on its relevant subset.
182
+ Skip if single-perspective (single mode proceeds directly to Step 2 CLI analysis with Layer 1 results).
183
+
184
+ ```javascript
185
+ // Per-perspective Layer 2-3 — receives shared discovery, avoids re-scanning
186
+ // Only runs in multi-perspective mode
187
+ const sharedDiscovery = readJSON(`${sessionFolder}/exploration-codebase.json`)
188
+ const perspectiveFiles = sharedDiscovery.relevant_files
189
+ .filter(f => f.dimensions.includes(perspective.dimension))
190
+
191
+ selectedPerspectives.forEach(perspective => {
192
+ Agent({
193
+ subagent_type: "cli-explore-agent",
194
+ run_in_background: false,
195
+ description: `Deep-dive: ${perspective.name}`,
196
+ prompt: `
197
+ ## Analysis Context
198
+ Topic: ${topic_or_question}
199
+ Perspective: ${perspective.name} - ${perspective.focus}
200
+ Session: ${sessionFolder}
168
201
 
169
- ### Layer 1 — Module Discovery (Breadth)
170
- - Search by topic keywords, identify ALL relevant files
171
- - Map module boundaries and entry points -> relevant_files[] with annotations
202
+ ## SHARED DISCOVERY (Layer 1 already completed DO NOT re-scan)
203
+ Relevant files for this perspective:
204
+ ${perspectiveFiles.map(f => `- ${f.path}: ${f.annotation}`).join('\n')}
205
+ Patterns found: ${sharedDiscovery.patterns.join(', ')}
172
206
 
173
- ### Layer 2 — Structure Tracing (Depth)
174
- - Top 3-5 key files: trace call chains 2-3 levels deep
207
+ ## Layer 2 — Structure Tracing (Depth)
208
+ - From the relevant files above, pick top 3-5 key files for this perspective
209
+ - Trace call chains 2-3 levels deep
175
210
  - Identify data flow paths and dependencies -> call_chains[], data_flows[]
176
211
 
177
- ### Layer 3 — Code Anchor Extraction (Detail)
212
+ ## Layer 3 — Code Anchor Extraction (Detail)
178
213
  - Each key finding: extract code snippet (20-50 lines) with file:line
179
- - Annotate WHY this matters -> code_anchors[]
214
+ - Annotate WHY this matters for ${perspective.name} -> code_anchors[]
180
215
 
181
216
  ## Output
182
- Write to: ${sessionFolder}/exploration-codebase.json
183
- // Multi-perspective: ${sessionFolder}/explorations/${perspective.name}.json
184
-
185
- Schema: {relevant_files, patterns, key_findings, code_anchors: [{file, lines, snippet, significance}], call_chains: [{entry, chain, files}], questions_for_user, _metadata}
217
+ Write to: ${sessionFolder}/explorations/${perspective.name}.json
218
+ Schema: {perspective, relevant_files, key_findings, code_anchors: [{file, lines, snippet, significance}], call_chains: [{entry, chain, files}], questions_for_user, _metadata}
186
219
  `
220
+ })
187
221
  })
188
222
  ```
189
223
 
190
- **Step 2: CLI Analysis** (AFTER exploration)
224
+ **Step 2: CLI Deep Analysis** (AFTER exploration, single-perspective ONLY)
191
225
 
192
- - **Single**: Comprehensive CLI analysis with exploration context
193
- - **Multi (up to 4)**: Parallel CLI calls per perspective
226
+ - **Single-perspective**: CLI does Layer 2-3 depth analysis (explore agent only did Layer 1)
227
+ - **Multi-perspective**: SKIP this step perspective agents in Step 1 Phase B already did Layer 2-3
194
228
  - Execution: `Bash` with `run_in_background: true`
195
229
 
196
230
  ```javascript
197
- // Build shared exploration context for CLI prompts
198
- const explorationContext = `
199
- PRIOR EXPLORATION CONTEXT:
200
- - Key files: ${explorationResults.relevant_files.slice(0,5).map(f => f.path).join(', ')}
201
- - Patterns: ${explorationResults.patterns.slice(0,3).join(', ')}
202
- - Findings: ${explorationResults.key_findings.slice(0,3).join(', ')}
203
- - Code anchors:
204
- ${(explorationResults.code_anchors || []).slice(0,5).map(a => ` [${a.file}:${a.lines}] ${a.significance}\n \`\`\`\n ${a.snippet}\n \`\`\``).join('\n')}
205
- - Call chains: ${(explorationResults.call_chains || []).slice(0,3).map(c => `${c.entry} -> ${c.chain.join(' -> ')}`).join('; ')}`
206
-
207
- // Single perspective (for multi: loop selectedPerspectives with perspective.purpose/tasks/constraints)
208
- Bash({
209
- command: `ccw cli -p "
210
- PURPOSE: Analyze '${topic_or_question}' from ${dimensions.join(', ')} perspectives
211
- Success: Actionable insights with clear reasoning
231
+ // ONLY for single-perspective mode multi-perspective already has deep-dive agents
232
+ if (selectedPerspectives.length <= 1) {
233
+ const sharedDiscovery = readJSON(`${sessionFolder}/exploration-codebase.json`)
234
+ const explorationContext = `
235
+ PRIOR EXPLORATION (Layer 1 discovery):
236
+ - Key files: ${sharedDiscovery.relevant_files.slice(0,8).map(f => `${f.path} (${f.annotation})`).join(', ')}
237
+ - Patterns: ${sharedDiscovery.patterns.slice(0,5).join(', ')}
238
+ - Module map: ${JSON.stringify(sharedDiscovery.module_map || {})}`
239
+
240
+ Bash({
241
+ command: `ccw cli -p "
242
+ PURPOSE: Deep analysis of '${topic_or_question}' — build on prior file discovery
243
+ Success: Actionable insights with code evidence (anchors + call chains)
212
244
 
213
245
  ${explorationContext}
214
246
 
215
247
  TASK:
216
- - Build on exploration findings reference specific code anchors
217
- - Analyze common patterns and anti-patterns with code evidence
218
- - Highlight potential issues/opportunities with file:line references
248
+ - From discovered files, trace call chains 2-3 levels deep for top 3-5 key files
249
+ - Extract code snippets (20-50 lines) for each key finding with file:line
250
+ - Identify patterns, anti-patterns, and potential issues with evidence
219
251
  - Generate discussion points for user clarification
220
252
 
221
253
  MODE: analysis
222
254
  CONTEXT: @**/* | Topic: ${topic_or_question}
223
- EXPECTED: Structured analysis with sections, insights tied to evidence, questions, recommendations
224
- CONSTRAINTS: Focus on ${dimensions.join(', ')}
255
+ EXPECTED: Structured analysis with: key_findings[], code_anchors[{file,lines,snippet,significance}], call_chains[{entry,chain,files}], discussion_points[]
256
+ CONSTRAINTS: Focus on ${dimensions.join(', ')} | Do NOT re-discover files — use provided file list
225
257
  " --tool gemini --mode analysis`,
226
- run_in_background: true
227
- })
228
- // STOP: Wait for hook callback before continuing
229
- // Multi-perspective: Same pattern per perspective with perspective.purpose/tasks/constraints/tool
258
+ run_in_background: true
259
+ })
260
+ // STOP: Wait for hook callback before continuing
261
+ }
230
262
  ```
231
263
 
232
264
  **Step 3: Aggregate Findings**
@@ -243,7 +275,13 @@ CONSTRAINTS: Focus on ${dimensions.join(', ')}
243
275
  - Present to user at beginning of Phase 3: "初始探索完成后,以下意图的覆盖情况:[list]。接下来的讨论将重点关注未覆盖的部分。"
244
276
  - Purpose: Early course correction — catch drift before spending multiple interactive rounds
245
277
 
246
- **explorations.json Schema** (single):
278
+ **exploration-codebase.json Schema** (shared Layer 1):
279
+ - `session_id`, `timestamp`, `topic`, `dimensions[]`
280
+ - `relevant_files[]`: {path, annotation, dimensions[]}
281
+ - `patterns[]`, `module_map`: {}
282
+ - `questions_for_user[]`, `_metadata`
283
+
284
+ **explorations.json Schema** (single — Layer 1 + CLI analysis merged):
247
285
  - `session_id`, `timestamp`, `topic`, `dimensions[]`
248
286
  - `sources[]`: {type, file/summary}
249
287
  - `key_findings[]`, `code_anchors[]`: {file, lines, snippet, significance}
@@ -251,10 +289,10 @@ CONSTRAINTS: Focus on ${dimensions.join(', ')}
251
289
  - `discussion_points[]`, `open_questions[]`
252
290
  - `technical_solutions[]`: {round, solution, problem, rationale, alternatives, status: proposed|validated|rejected, evidence_refs[], next_action}
253
291
 
254
- **perspectives.json Schema** (multi — extends explorations.json):
255
- - `perspectives[]`: [{name, tool, findings, insights, questions}]
292
+ **perspectives.json Schema** (multi — Layer 1 shared + per-perspective Layer 2-3):
293
+ - `shared_discovery`: {relevant_files[], patterns[], module_map}
294
+ - `perspectives[]`: [{name, tool, findings, insights, questions, code_anchors[], call_chains[]}]
256
295
  - `synthesis`: {convergent_themes, conflicting_views, unique_contributions}
257
- - code_anchors/call_chains include `perspective` field
258
296
 
259
297
  | Condition | Action |
260
298
  |-----------|--------|
@@ -270,6 +308,22 @@ CONSTRAINTS: Focus on ${dimensions.join(', ')}
270
308
 
271
309
  **Guideline**: Delegate complex tasks to agents (cli-explore-agent) or CLI calls. Avoid direct analysis in main process.
272
310
 
311
+ **Cumulative Context Rule**: Every agent/CLI call in Phase 3 MUST include a summary of ALL prior exploration results to avoid re-discovering known information. Build `priorContext` before each call:
312
+ ```javascript
313
+ // Build cumulative context from all prior explorations (Phase 2 + previous rounds)
314
+ const allFindings = readJSON(`${sessionFolder}/explorations.json`) // or perspectives.json
315
+ const priorContext = `
316
+ ## KNOWN FINDINGS (DO NOT re-discover)
317
+ - Established files: ${allFindings.sources.map(s => s.file).join(', ')}
318
+ - Key findings: ${allFindings.key_findings.join('; ')}
319
+ - Code anchors: ${allFindings.code_anchors.slice(0,5).map(a => `${a.file}:${a.lines}`).join(', ')}
320
+ - Call chains: ${allFindings.call_chains.slice(0,3).map(c => c.entry).join(', ')}
321
+ - Open questions: ${allFindings.open_questions.join('; ')}
322
+
323
+ ## NEW TASK: Focus ONLY on unexplored areas below.
324
+ `
325
+ ```
326
+
273
327
  **Loop** (max 5 rounds):
274
328
 
275
329
  1. **Current Understanding Summary** (Round >= 2, BEFORE presenting new findings):