claude-code-workflow 6.3.48 → 6.3.49

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (211) hide show
  1. package/.claude/CLAUDE.md +6 -8
  2. package/.claude/agents/action-planning-agent.md +28 -45
  3. package/.claude/agents/cli-lite-planning-agent.md +93 -1
  4. package/.claude/agents/code-developer.md +144 -27
  5. package/.claude/commands/ccw-coordinator.md +175 -21
  6. package/.claude/commands/ccw-debug.md +832 -0
  7. package/.claude/commands/ccw.md +90 -9
  8. package/.claude/commands/cli/cli-init.md +1 -0
  9. package/.claude/commands/issue/convert-to-plan.md +718 -0
  10. package/.claude/commands/issue/from-brainstorm.md +382 -0
  11. package/.claude/commands/memory/tips.md +332 -0
  12. package/.claude/commands/workflow/analyze-with-file.md +804 -0
  13. package/.claude/commands/workflow/brainstorm/auto-parallel.md +18 -43
  14. package/.claude/commands/workflow/brainstorm/role-analysis.md +705 -0
  15. package/.claude/commands/workflow/brainstorm-with-file.md +1153 -0
  16. package/.claude/commands/workflow/debug-with-file.md +7 -5
  17. package/.claude/commands/workflow/execute.md +6 -4
  18. package/.claude/commands/workflow/lite-plan.md +2 -2
  19. package/.claude/commands/workflow/plan-verify.md +162 -327
  20. package/.claude/commands/workflow/plan.md +162 -26
  21. package/.claude/commands/workflow/replan.md +78 -2
  22. package/.claude/commands/workflow/{review-fix.md → review-cycle-fix.md} +6 -6
  23. package/.claude/commands/workflow/review-module-cycle.md +2 -2
  24. package/.claude/commands/workflow/review-session-cycle.md +2 -2
  25. package/.claude/commands/workflow/tools/conflict-resolution.md +16 -26
  26. package/.claude/commands/workflow/tools/context-gather.md +81 -118
  27. package/.claude/commands/workflow/tools/task-generate-agent.md +94 -10
  28. package/.claude/skills/ccw-help/command.json +4 -4
  29. package/.claude/skills/lite-skill-generator/SKILL.md +650 -0
  30. package/.claude/skills/lite-skill-generator/templates/simple-skill.md +68 -0
  31. package/.claude/skills/lite-skill-generator/templates/style-guide.md +64 -0
  32. package/.claude/skills/skill-generator/SKILL.md +277 -85
  33. package/.claude/skills/skill-generator/phases/01-requirements-discovery.md +4 -15
  34. package/.claude/skills/skill-generator/phases/02-structure-generation.md +72 -17
  35. package/.claude/skills/skill-generator/phases/03-phase-generation.md +218 -51
  36. package/.claude/skills/skill-generator/phases/04-specs-templates.md +111 -41
  37. package/.claude/skills/skill-generator/phases/05-validation.md +139 -56
  38. package/.claude/skills/skill-generator/templates/autonomous-action.md +78 -268
  39. package/.claude/skills/skill-generator/templates/autonomous-orchestrator.md +14 -0
  40. package/.claude/skills/skill-generator/templates/code-analysis-action.md +12 -0
  41. package/.claude/skills/skill-generator/templates/llm-action.md +12 -0
  42. package/.claude/skills/skill-generator/templates/script-template.md +368 -0
  43. package/.claude/skills/skill-generator/templates/sequential-phase.md +14 -0
  44. package/.claude/skills/skill-generator/templates/skill-md.md +14 -0
  45. package/.claude/skills/skill-tuning/SKILL.md +130 -266
  46. package/.claude/skills/skill-tuning/phases/orchestrator.md +95 -283
  47. package/.claude/skills/skill-tuning/specs/problem-taxonomy.md +90 -198
  48. package/.claude/skills/skill-tuning/specs/tuning-strategies.md +193 -1345
  49. package/.claude/workflows/cli-templates/schemas/plan-verify-agent-schema.json +47 -0
  50. package/.claude/workflows/cli-templates/schemas/verify-json-schema.json +158 -0
  51. package/.claude/workflows/cli-tools-usage.md +1 -1
  52. package/.codex/AGENTS.md +1 -3
  53. package/.codex/prompts/analyze-with-file.md +607 -0
  54. package/.codex/prompts/brainstorm-to-cycle.md +455 -0
  55. package/.codex/prompts/brainstorm-with-file.md +933 -0
  56. package/.codex/prompts/debug-with-file.md +15 -20
  57. package/.codex/skills/ccw-cli-tools/SKILL.md +559 -0
  58. package/ccw/dist/commands/cli.d.ts.map +1 -1
  59. package/ccw/dist/commands/cli.js +29 -5
  60. package/ccw/dist/commands/cli.js.map +1 -1
  61. package/ccw/dist/commands/issue.d.ts +2 -0
  62. package/ccw/dist/commands/issue.d.ts.map +1 -1
  63. package/ccw/dist/commands/issue.js +62 -20
  64. package/ccw/dist/commands/issue.js.map +1 -1
  65. package/ccw/dist/config/litellm-api-config-manager.d.ts.map +1 -1
  66. package/ccw/dist/config/litellm-api-config-manager.js +5 -3
  67. package/ccw/dist/config/litellm-api-config-manager.js.map +1 -1
  68. package/ccw/dist/config/litellm-provider-models.d.ts +73 -0
  69. package/ccw/dist/config/litellm-provider-models.d.ts.map +1 -0
  70. package/ccw/dist/config/litellm-provider-models.js +172 -0
  71. package/ccw/dist/config/litellm-provider-models.js.map +1 -0
  72. package/ccw/dist/config/provider-models.d.ts +25 -51
  73. package/ccw/dist/config/provider-models.d.ts.map +1 -1
  74. package/ccw/dist/config/provider-models.js +84 -149
  75. package/ccw/dist/config/provider-models.js.map +1 -1
  76. package/ccw/dist/config/storage-paths.d.ts.map +1 -1
  77. package/ccw/dist/config/storage-paths.js +23 -5
  78. package/ccw/dist/config/storage-paths.js.map +1 -1
  79. package/ccw/dist/core/auth/csrf-middleware.js +3 -3
  80. package/ccw/dist/core/auth/csrf-middleware.js.map +1 -1
  81. package/ccw/dist/core/dashboard-generator.d.ts.map +1 -1
  82. package/ccw/dist/core/dashboard-generator.js +3 -1
  83. package/ccw/dist/core/dashboard-generator.js.map +1 -1
  84. package/ccw/dist/core/routes/claude-routes.d.ts.map +1 -1
  85. package/ccw/dist/core/routes/claude-routes.js +206 -14
  86. package/ccw/dist/core/routes/claude-routes.js.map +1 -1
  87. package/ccw/dist/core/routes/cli-routes.d.ts.map +1 -1
  88. package/ccw/dist/core/routes/cli-routes.js.map +1 -1
  89. package/ccw/dist/core/routes/commands-routes.d.ts +7 -0
  90. package/ccw/dist/core/routes/commands-routes.d.ts.map +1 -0
  91. package/ccw/dist/core/routes/commands-routes.js +480 -0
  92. package/ccw/dist/core/routes/commands-routes.js.map +1 -0
  93. package/ccw/dist/core/routes/model-routes.d.ts +11 -0
  94. package/ccw/dist/core/routes/model-routes.d.ts.map +1 -0
  95. package/ccw/dist/core/routes/model-routes.js +112 -0
  96. package/ccw/dist/core/routes/model-routes.js.map +1 -0
  97. package/ccw/dist/core/routes/nav-status-routes.d.ts.map +1 -1
  98. package/ccw/dist/core/routes/nav-status-routes.js +84 -1
  99. package/ccw/dist/core/routes/nav-status-routes.js.map +1 -1
  100. package/ccw/dist/core/routes/provider-routes.d.ts +11 -0
  101. package/ccw/dist/core/routes/provider-routes.d.ts.map +1 -0
  102. package/ccw/dist/core/routes/provider-routes.js +67 -0
  103. package/ccw/dist/core/routes/provider-routes.js.map +1 -0
  104. package/ccw/dist/core/routes/skills-routes.d.ts.map +1 -1
  105. package/ccw/dist/core/routes/skills-routes.js +219 -7
  106. package/ccw/dist/core/routes/skills-routes.js.map +1 -1
  107. package/ccw/dist/core/routes/system-routes.d.ts.map +1 -1
  108. package/ccw/dist/core/routes/system-routes.js +58 -6
  109. package/ccw/dist/core/routes/system-routes.js.map +1 -1
  110. package/ccw/dist/core/server.d.ts.map +1 -1
  111. package/ccw/dist/core/server.js +13 -0
  112. package/ccw/dist/core/server.js.map +1 -1
  113. package/ccw/dist/mcp-server/index.js +2 -2
  114. package/ccw/dist/mcp-server/index.js.map +1 -1
  115. package/ccw/dist/tools/claude-cli-tools.d.ts +48 -11
  116. package/ccw/dist/tools/claude-cli-tools.d.ts.map +1 -1
  117. package/ccw/dist/tools/claude-cli-tools.js +146 -50
  118. package/ccw/dist/tools/claude-cli-tools.js.map +1 -1
  119. package/ccw/dist/tools/cli-config-manager.d.ts +1 -13
  120. package/ccw/dist/tools/cli-config-manager.d.ts.map +1 -1
  121. package/ccw/dist/tools/cli-config-manager.js +3 -27
  122. package/ccw/dist/tools/cli-config-manager.js.map +1 -1
  123. package/ccw/dist/tools/cli-executor-core.d.ts.map +1 -1
  124. package/ccw/dist/tools/cli-executor-core.js +7 -2
  125. package/ccw/dist/tools/cli-executor-core.js.map +1 -1
  126. package/ccw/dist/tools/cli-executor-state.d.ts.map +1 -1
  127. package/ccw/dist/tools/cli-history-store.d.ts +11 -0
  128. package/ccw/dist/tools/cli-history-store.d.ts.map +1 -1
  129. package/ccw/dist/tools/cli-history-store.js +82 -2
  130. package/ccw/dist/tools/cli-history-store.js.map +1 -1
  131. package/ccw/dist/tools/command-registry.d.ts +7 -0
  132. package/ccw/dist/tools/command-registry.d.ts.map +1 -1
  133. package/ccw/dist/tools/command-registry.js +14 -1
  134. package/ccw/dist/tools/command-registry.js.map +1 -1
  135. package/ccw/dist/tools/generate-module-docs.d.ts.map +1 -1
  136. package/ccw/dist/tools/generate-module-docs.js +11 -7
  137. package/ccw/dist/tools/generate-module-docs.js.map +1 -1
  138. package/ccw/dist/tools/litellm-executor.d.ts +1 -0
  139. package/ccw/dist/tools/litellm-executor.d.ts.map +1 -1
  140. package/ccw/dist/tools/litellm-executor.js +11 -9
  141. package/ccw/dist/tools/litellm-executor.js.map +1 -1
  142. package/ccw/dist/types/skill-types.d.ts +97 -0
  143. package/ccw/dist/types/skill-types.d.ts.map +1 -0
  144. package/ccw/dist/types/skill-types.js +6 -0
  145. package/ccw/dist/types/skill-types.js.map +1 -0
  146. package/ccw/src/commands/cli.ts +36 -5
  147. package/ccw/src/commands/issue.ts +81 -26
  148. package/ccw/src/config/litellm-api-config-manager.ts +5 -3
  149. package/ccw/src/config/litellm-provider-models.ts +222 -0
  150. package/ccw/src/config/provider-models.ts +91 -190
  151. package/ccw/src/config/storage-paths.ts +20 -5
  152. package/ccw/src/core/auth/csrf-middleware.ts +3 -3
  153. package/ccw/src/core/dashboard-generator.ts +3 -1
  154. package/ccw/src/core/routes/claude-routes.ts +233 -15
  155. package/ccw/src/core/routes/cli-routes.ts +2 -3
  156. package/ccw/src/core/routes/commands-routes.ts +620 -0
  157. package/ccw/src/core/routes/nav-status-routes.ts +95 -1
  158. package/ccw/src/core/routes/provider-routes.ts +78 -0
  159. package/ccw/src/core/routes/skills-routes.ts +266 -45
  160. package/ccw/src/core/routes/system-routes.ts +102 -50
  161. package/ccw/src/core/server.ts +13 -0
  162. package/ccw/src/mcp-server/index.ts +2 -2
  163. package/ccw/src/templates/dashboard-css/18-cli-settings.css +35 -0
  164. package/ccw/src/templates/dashboard-css/37-commands.css +193 -0
  165. package/ccw/src/templates/dashboard-js/components/navigation.js +4 -0
  166. package/ccw/src/templates/dashboard-js/i18n.js +116 -0
  167. package/ccw/src/templates/dashboard-js/views/cli-manager.js +249 -4
  168. package/ccw/src/templates/dashboard-js/views/commands-manager.js +503 -0
  169. package/ccw/src/templates/dashboard-js/views/issue-manager.js +7 -7
  170. package/ccw/src/templates/dashboard-js/views/mcp-manager.js +2 -7
  171. package/ccw/src/templates/dashboard-js/views/skills-manager.js +164 -23
  172. package/ccw/src/templates/dashboard.html +7 -0
  173. package/ccw/src/tools/claude-cli-tools.ts +170 -56
  174. package/ccw/src/tools/cli-config-manager.ts +2 -33
  175. package/ccw/src/tools/cli-executor-core.ts +8 -2
  176. package/ccw/src/tools/cli-history-store.ts +92 -2
  177. package/ccw/src/tools/command-registry.ts +16 -1
  178. package/ccw/src/tools/generate-module-docs.ts +11 -7
  179. package/ccw/src/tools/litellm-executor.ts +13 -9
  180. package/ccw/src/types/skill-types.ts +99 -0
  181. package/package.json +1 -1
  182. package/.claude/commands/enhance-prompt.md +0 -93
  183. package/.claude/commands/memory/code-map-memory.md +0 -687
  184. package/.claude/commands/memory/docs.md +0 -615
  185. package/.claude/commands/memory/load-skill-memory.md +0 -182
  186. package/.claude/commands/memory/skill-memory.md +0 -525
  187. package/.claude/commands/memory/swagger-docs.md +0 -773
  188. package/.claude/commands/memory/tech-research-rules.md +0 -310
  189. package/.claude/commands/memory/workflow-skill-memory.md +0 -517
  190. package/.claude/commands/task/breakdown.md +0 -208
  191. package/.claude/commands/task/create.md +0 -152
  192. package/.claude/commands/task/execute.md +0 -270
  193. package/.claude/commands/task/replan.md +0 -441
  194. package/.claude/commands/version.md +0 -254
  195. package/.claude/commands/workflow/action-plan-verify.md +0 -485
  196. package/.claude/commands/workflow/brainstorm/api-designer.md +0 -587
  197. package/.claude/commands/workflow/brainstorm/data-architect.md +0 -220
  198. package/.claude/commands/workflow/brainstorm/product-manager.md +0 -200
  199. package/.claude/commands/workflow/brainstorm/product-owner.md +0 -200
  200. package/.claude/commands/workflow/brainstorm/scrum-master.md +0 -200
  201. package/.claude/commands/workflow/brainstorm/subject-matter-expert.md +0 -200
  202. package/.claude/commands/workflow/brainstorm/system-architect.md +0 -389
  203. package/.claude/commands/workflow/brainstorm/ui-designer.md +0 -221
  204. package/.claude/commands/workflow/brainstorm/ux-expert.md +0 -221
  205. package/.claude/commands/workflow/debug.md +0 -331
  206. package/.claude/commands/workflow/develop-with-file.md +0 -1044
  207. package/.claude/skills/ccw-loop/README.md +0 -303
  208. package/.claude/skills/skill-generator/templates/script-bash.md +0 -277
  209. package/.claude/skills/skill-generator/templates/script-python.md +0 -198
  210. package/.codex/prompts/debug.md +0 -318
  211. package/ccw/src/core/routes/mcp-routes.ts.backup +0 -549
@@ -35,7 +35,7 @@ Step 1: Context-Package Detection
35
35
  ├─ Valid package exists → Return existing (skip execution)
36
36
  └─ No valid package → Continue to Step 2
37
37
 
38
- Step 2: Complexity Assessment & Parallel Explore (NEW)
38
+ Step 2: Complexity Assessment & Parallel Explore
39
39
  ├─ Analyze task_description → classify Low/Medium/High
40
40
  ├─ Select exploration angles (1-4 based on complexity)
41
41
  ├─ Launch N cli-explore-agents in parallel
@@ -213,19 +213,37 @@ Write(`${sessionFolder}/explorations-manifest.json`, JSON.stringify(explorationM
213
213
  **Only execute after Step 2 completes**
214
214
 
215
215
  ```javascript
216
+ // Load user intent from planning-notes.md (from Phase 1)
217
+ const planningNotesPath = `.workflow/active/${session_id}/planning-notes.md`;
218
+ let userIntent = { goal: task_description, key_constraints: "None specified" };
219
+
220
+ if (file_exists(planningNotesPath)) {
221
+ const notesContent = Read(planningNotesPath);
222
+ const goalMatch = notesContent.match(/\*\*GOAL\*\*:\s*(.+)/);
223
+ const constraintsMatch = notesContent.match(/\*\*KEY_CONSTRAINTS\*\*:\s*(.+)/);
224
+ if (goalMatch) userIntent.goal = goalMatch[1].trim();
225
+ if (constraintsMatch) userIntent.key_constraints = constraintsMatch[1].trim();
226
+ }
227
+
216
228
  Task(
217
229
  subagent_type="context-search-agent",
218
230
  run_in_background=false,
219
231
  description="Gather comprehensive context for plan",
220
232
  prompt=`
221
233
  ## Execution Mode
222
- **PLAN MODE** (Comprehensive) - Full Phase 1-3 execution
234
+ **PLAN MODE** (Comprehensive) - Full Phase 1-3 execution with priority sorting
223
235
 
224
236
  ## Session Information
225
237
  - **Session ID**: ${session_id}
226
238
  - **Task Description**: ${task_description}
227
239
  - **Output Path**: .workflow/${session_id}/.process/context-package.json
228
240
 
241
+ ## User Intent (from Phase 1 - Planning Notes)
242
+ **GOAL**: ${userIntent.goal}
243
+ **KEY_CONSTRAINTS**: ${userIntent.key_constraints}
244
+
245
+ This is the PRIMARY context source - all subsequent analysis must align with user intent.
246
+
229
247
  ## Exploration Input (from Step 2)
230
248
  - **Manifest**: ${sessionFolder}/explorations-manifest.json
231
249
  - **Exploration Count**: ${explorationManifest.exploration_count}
@@ -245,7 +263,13 @@ Execute complete context-search-agent workflow for implementation planning:
245
263
  4. **Analysis**: Extract keywords, determine scope, classify complexity based on task description and project state
246
264
 
247
265
  ### Phase 2: Multi-Source Context Discovery
248
- Execute all discovery tracks:
266
+ Execute all discovery tracks (WITH USER INTENT INTEGRATION):
267
+ - **Track -1**: User Intent & Priority Foundation (EXECUTE FIRST)
268
+ - Load user intent (GOAL, KEY_CONSTRAINTS) from session input
269
+ - Map user requirements to codebase entities (files, modules, patterns)
270
+ - Establish baseline priority scores based on user goal alignment
271
+ - Output: user_intent_mapping.json with preliminary priority scores
272
+
249
273
  - **Track 0**: Exploration Synthesis (load ${sessionFolder}/explorations-manifest.json, prioritize critical_files, deduplicate patterns/integration_points)
250
274
  - **Track 1**: Historical archive analysis (query manifest.json for lessons learned)
251
275
  - **Track 2**: Reference documentation (CLAUDE.md, architecture docs)
@@ -254,13 +278,45 @@ Execute all discovery tracks:
254
278
 
255
279
  ### Phase 3: Synthesis, Assessment & Packaging
256
280
  1. Apply relevance scoring and build dependency graph
257
- 2. **Synthesize 4-source data**: Merge findings from all sources (archive > docs > code > web). **Prioritize the context from `project-tech.json`** for architecture and tech stack unless code analysis reveals it's outdated.
258
- 3. **Populate `project_context`**: Directly use the `overview` from `project-tech.json` to fill the `project_context` section. Include description, technology_stack, architecture, and key_components.
259
- 4. **Populate `project_guidelines`**: Load conventions, constraints, and learnings from `project-guidelines.json` into a dedicated section.
260
- 5. Integrate brainstorm artifacts (if .brainstorming/ exists, read content)
261
- 6. Perform conflict detection with risk assessment
262
- 7. **Inject historical conflicts** from archive analysis into conflict_detection
263
- 8. Generate and validate context-package.json
281
+ 2. **Synthesize 5-source data** (including Track -1): Merge findings from all sources
282
+ - Priority order: User Intent > Archive > Docs > Exploration > Code > Web
283
+ - **Prioritize the context from `project-tech.json`** for architecture and tech stack unless code analysis reveals it's outdated
284
+ 3. **Context Priority Sorting**:
285
+ a. Combine scores from Track -1 (user intent alignment) + relevance scores + exploration critical_files
286
+ b. Classify files into priority tiers:
287
+ - **Critical** (score ≥ 0.85): Directly mentioned in user goal OR exploration critical_files
288
+ - **High** (0.70-0.84): Key dependencies, patterns required for goal
289
+ - **Medium** (0.50-0.69): Supporting files, indirect dependencies
290
+ - **Low** (< 0.50): Contextual awareness only
291
+ c. Generate dependency_order: Based on dependency graph + user goal sequence
292
+ d. Document sorting_rationale: Explain prioritization logic
293
+
294
+ 4. **Populate `project_context`**: Directly use the `overview` from `project-tech.json` to fill the `project_context` section. Include description, technology_stack, architecture, and key_components.
295
+ 5. **Populate `project_guidelines`**: Load conventions, constraints, and learnings from `project-guidelines.json` into a dedicated section.
296
+ 6. Integrate brainstorm artifacts (if .brainstorming/ exists, read content)
297
+ 7. Perform conflict detection with risk assessment
298
+ 8. **Inject historical conflicts** from archive analysis into conflict_detection
299
+ 9. **Generate prioritized_context section**:
300
+ ```json
301
+ {
302
+ "prioritized_context": {
303
+ "user_intent": {
304
+ "goal": "...",
305
+ "scope": "...",
306
+ "key_constraints": ["..."]
307
+ },
308
+ "priority_tiers": {
309
+ "critical": [{ "path": "...", "relevance": 0.95, "rationale": "..." }],
310
+ "high": [...],
311
+ "medium": [...],
312
+ "low": [...]
313
+ },
314
+ "dependency_order": ["module1", "module2", "module3"],
315
+ "sorting_rationale": "Based on user goal alignment (Track -1), exploration critical files, and dependency graph analysis"
316
+ }
317
+ }
318
+ ```
319
+ 10. Generate and validate context-package.json with prioritized_context field
264
320
 
265
321
  ## Output Requirements
266
322
  Complete context-package.json with:
@@ -272,6 +328,7 @@ Complete context-package.json with:
272
328
  - **brainstorm_artifacts**: {guidance_specification, role_analyses[], synthesis_output} with content
273
329
  - **conflict_detection**: {risk_level, risk_factors, affected_modules[], mitigation_strategy, historical_conflicts[]}
274
330
  - **exploration_results**: {manifest_path, exploration_count, angles, explorations[], aggregated_insights} (from Track 0)
331
+ - **prioritized_context**: {user_intent, priority_tiers{critical, high, medium, low}, dependency_order[], sorting_rationale}
275
332
 
276
333
  ## Quality Validation
277
334
  Before completion verify:
@@ -282,6 +339,17 @@ Before completion verify:
282
339
  - [ ] No sensitive data exposed
283
340
  - [ ] Total files ≤50 (prioritize high-relevance)
284
341
 
342
+ ## Planning Notes Record (REQUIRED)
343
+ After completing context-package.json, append a brief execution record to planning-notes.md:
344
+
345
+ **File**: .workflow/active/${session_id}/planning-notes.md
346
+ **Location**: Under "## Context Findings (Phase 2)" section
347
+ **Format**:
348
+ \`\`\`
349
+ ### [Context-Search Agent] YYYY-MM-DD
350
+ - **Note**: [智能补充:简短总结关键发现,如探索角度、关键文件、冲突风险等]
351
+ \`\`\`
352
+
285
353
  Execute autonomously following agent documentation.
286
354
  Report completion with statistics.
287
355
  `
@@ -326,116 +394,11 @@ Refer to `context-search-agent.md` Phase 3.7 for complete `context-package.json`
326
394
  - **brainstorm_artifacts**: Brainstorm documents with full content (if exists)
327
395
  - **conflict_detection**: Risk assessment with mitigation strategies and historical conflicts
328
396
  - **exploration_results**: Aggregated exploration insights (from parallel explore phase)
329
-
330
- ## Historical Archive Analysis
331
-
332
- ### Track 1: Query Archive Manifest
333
-
334
- The context-search-agent MUST perform historical archive analysis as Track 1 in Phase 2:
335
-
336
- **Step 1: Check for Archive Manifest**
337
- ```bash
338
- # Check if archive manifest exists
339
- if [[ -f .workflow/archives/manifest.json ]]; then
340
- # Manifest available for querying
341
- fi
342
- ```
343
-
344
- **Step 2: Extract Task Keywords**
345
- ```javascript
346
- // From current task description, extract key entities and operations
347
- const keywords = extractKeywords(task_description);
348
- // Examples: ["User", "model", "authentication", "JWT", "reporting"]
349
- ```
350
-
351
- **Step 3: Search Archive for Relevant Sessions**
352
- ```javascript
353
- // Query manifest for sessions with matching tags or descriptions
354
- const relevantArchives = archives.filter(archive => {
355
- return archive.tags.some(tag => keywords.includes(tag)) ||
356
- keywords.some(kw => archive.description.toLowerCase().includes(kw.toLowerCase()));
357
- });
358
- ```
359
-
360
- **Step 4: Extract Watch Patterns**
361
- ```javascript
362
- // For each relevant archive, check watch_patterns for applicability
363
- const historicalConflicts = [];
364
-
365
- relevantArchives.forEach(archive => {
366
- archive.lessons.watch_patterns?.forEach(pattern => {
367
- // Check if pattern trigger matches current task
368
- if (isPatternRelevant(pattern.pattern, task_description)) {
369
- historicalConflicts.push({
370
- source_session: archive.session_id,
371
- pattern: pattern.pattern,
372
- action: pattern.action,
373
- files_to_check: pattern.related_files,
374
- archived_at: archive.archived_at
375
- });
376
- }
377
- });
378
- });
379
- ```
380
-
381
- **Step 5: Inject into Context Package**
382
- ```json
383
- {
384
- "conflict_detection": {
385
- "risk_level": "medium",
386
- "risk_factors": ["..."],
387
- "affected_modules": ["..."],
388
- "mitigation_strategy": "...",
389
- "historical_conflicts": [
390
- {
391
- "source_session": "WFS-auth-feature",
392
- "pattern": "When modifying User model",
393
- "action": "Check reporting-service and auditing-service dependencies",
394
- "files_to_check": ["src/models/User.ts", "src/services/reporting.ts"],
395
- "archived_at": "2025-09-16T09:00:00Z"
396
- }
397
- ]
398
- }
399
- }
400
- ```
401
-
402
- ### Risk Level Escalation
403
-
404
- If `historical_conflicts` array is not empty, minimum risk level should be "medium":
405
-
406
- ```javascript
407
- if (historicalConflicts.length > 0 && currentRisk === "low") {
408
- conflict_detection.risk_level = "medium";
409
- conflict_detection.risk_factors.push(
410
- `${historicalConflicts.length} historical conflict pattern(s) detected from past sessions`
411
- );
412
- }
413
- ```
414
-
415
- ### Archive Query Algorithm
416
-
417
- ```markdown
418
- 1. IF .workflow/archives/manifest.json does NOT exist → Skip Track 1, continue to Track 2
419
- 2. IF manifest exists:
420
- a. Load manifest.json
421
- b. Extract keywords from task_description (nouns, verbs, technical terms)
422
- c. Filter archives where:
423
- - ANY tag matches keywords (case-insensitive) OR
424
- - description contains keywords (case-insensitive substring match)
425
- d. For each relevant archive:
426
- - Read lessons.watch_patterns array
427
- - Check if pattern.pattern keywords overlap with task_description
428
- - If relevant: Add to historical_conflicts array
429
- e. IF historical_conflicts.length > 0:
430
- - Set risk_level = max(current_risk, "medium")
431
- - Add to risk_factors
432
- 3. Continue to Track 2 (reference documentation)
433
- ```
397
+ - **prioritized_context**: Pre-sorted context with user intent and priority tiers (critical/high/medium/low)
434
398
 
435
399
  ## Notes
436
400
 
437
401
  - **Detection-first**: Always check for existing package before invoking agent
438
- - **Dual project file integration**: Agent reads both `.workflow/project-tech.json` (tech analysis) and `.workflow/project-guidelines.json` (user constraints) as primary sources
439
- - **Guidelines injection**: Project guidelines are included in context-package to ensure task generation respects user-defined constraints
440
- - **No redundancy**: This command is a thin orchestrator, all logic in agent
402
+ - **User intent integration**: Load user intent from planning-notes.md (Phase 1 output)
403
+ - **Output**: Generates `context-package.json` with `prioritized_context` field
441
404
  - **Plan-specific**: Use this for implementation planning; brainstorm mode uses direct agent call
@@ -19,6 +19,10 @@ Generate implementation planning documents (IMPL_PLAN.md, task JSONs, TODO_LIST.
19
19
  ## Core Philosophy
20
20
  - **Planning Only**: Generate planning documents (IMPL_PLAN.md, task JSONs, TODO_LIST.md) - does NOT implement code
21
21
  - **Agent-Driven Document Generation**: Delegate plan generation to action-planning-agent
22
+ - **NO Redundant Context Sorting**: Context priority sorting is ALREADY completed in context-gather Phase 2/3
23
+ - Use `context-package.json.prioritized_context` directly
24
+ - DO NOT re-sort files or re-compute priorities
25
+ - `priority_tiers` and `dependency_order` are pre-computed and ready-to-use
22
26
  - **N+1 Parallel Planning**: Auto-detect multi-module projects, enable parallel planning (2+1 or 3+1 mode)
23
27
  - **Progressive Loading**: Load context incrementally (Core → Selective → On-Demand) due to analysis.md file size
24
28
  - **Memory-First**: Reuse loaded documents from conversation memory
@@ -161,12 +165,13 @@ const userConfig = {
161
165
 
162
166
  ### Phase 1: Context Preparation & Module Detection (Command Responsibility)
163
167
 
164
- **Command prepares session paths, metadata, and detects module structure.**
168
+ **Command prepares session paths, metadata, detects module structure. Context priority sorting is NOT performed here - it's already completed in context-gather Phase 2/3.**
165
169
 
166
170
  **Session Path Structure**:
167
171
  ```
168
172
  .workflow/active/WFS-{session-id}/
169
173
  ├── workflow-session.json # Session metadata
174
+ ├── planning-notes.md # Consolidated planning notes
170
175
  ├── .process/
171
176
  │ └── context-package.json # Context package with artifact catalog
172
177
  ├── .task/ # Output: Task JSON files
@@ -248,9 +253,21 @@ IMPORTANT: This is PLANNING ONLY - you are generating planning documents, NOT im
248
253
 
249
254
  CRITICAL: Follow the progressive loading strategy defined in agent specification (load analysis.md files incrementally due to file size)
250
255
 
256
+ ## PLANNING NOTES (PHASE 1-3 CONTEXT)
257
+ Load: .workflow/active/{session-id}/planning-notes.md
258
+
259
+ This document contains:
260
+ - User Intent: Original GOAL and KEY_CONSTRAINTS from Phase 1
261
+ - Context Findings: Critical files, architecture, and constraints from Phase 2
262
+ - Conflict Decisions: Resolved conflicts and planning constraints from Phase 3
263
+ - Consolidated Constraints: All constraints from all phases
264
+
265
+ **USAGE**: Read planning-notes.md FIRST. Use Consolidated Constraints list to guide task sequencing and dependencies.
266
+
251
267
  ## SESSION PATHS
252
268
  Input:
253
269
  - Session Metadata: .workflow/active/{session-id}/workflow-session.json
270
+ - Planning Notes: .workflow/active/{session-id}/planning-notes.md
254
271
  - Context Package: .workflow/active/{session-id}/.process/context-package.json
255
272
 
256
273
  Output:
@@ -278,7 +295,17 @@ CLI Resume Support (MANDATORY for all CLI commands):
278
295
  - Read previous task's cliExecutionId from session state
279
296
  - Format: ccw cli -p "[prompt]" --resume ${previousCliId} --tool ${tool} --mode write
280
297
 
281
- ## EXPLORATION CONTEXT (from context-package.exploration_results)
298
+ ## PRIORITIZED CONTEXT (from context-package.prioritized_context) - ALREADY SORTED
299
+ Context sorting is ALREADY COMPLETED in context-gather Phase 2/3. DO NOT re-sort.
300
+ Direct usage:
301
+ - **user_intent**: Use goal/scope/key_constraints for task alignment
302
+ - **priority_tiers.critical**: These files are PRIMARY focus for task generation
303
+ - **priority_tiers.high**: These files are SECONDARY focus
304
+ - **dependency_order**: Use this for task sequencing - already computed
305
+ - **sorting_rationale**: Reference for understanding priority decisions
306
+
307
+ ## EXPLORATION CONTEXT (from context-package.exploration_results) - SUPPLEMENT ONLY
308
+ If prioritized_context is incomplete, fall back to exploration_results:
282
309
  - Load exploration_results from context-package.json
283
310
  - Use aggregated_insights.critical_files for focus_paths generation
284
311
  - Apply aggregated_insights.constraints to acceptance criteria
@@ -298,8 +325,10 @@ CLI Resume Support (MANDATORY for all CLI commands):
298
325
  - 6-field schema (id, title, status, context_package_path, meta, context, flow_control)
299
326
  - Quantified requirements with explicit counts
300
327
  - Artifacts integration from context package
301
- - **focus_paths enhanced with exploration critical_files**
302
- - Flow control with pre_analysis steps (include exploration integration_points analysis)
328
+ - **focus_paths generated directly from prioritized_context.priority_tiers (critical + high)**
329
+ - NO re-sorting or re-prioritization - use pre-computed tiers as-is
330
+ - Critical files are PRIMARY focus, High files are SECONDARY
331
+ - Flow control with pre_analysis steps (use prioritized_context.dependency_order for task sequencing)
303
332
  - **CLI Execution IDs and strategies (MANDATORY)**
304
333
 
305
334
  2. Implementation Plan (IMPL_PLAN.md)
@@ -347,6 +376,19 @@ Hard Constraints:
347
376
  - IMPL_PLAN.md created with complete structure
348
377
  - TODO_LIST.md generated matching task JSONs
349
378
  - Return completion status with document count and task breakdown summary
379
+
380
+ ## PLANNING NOTES RECORD (REQUIRED)
381
+ After completing all documents, append a brief execution record to planning-notes.md:
382
+
383
+ **File**: .workflow/active/{session_id}/planning-notes.md
384
+ **Location**: Create new section after "## Consolidated Constraints"
385
+ **Format**:
386
+ \`\`\`
387
+ ## Task Generation (Phase 4)
388
+
389
+ ### [Action-Planning Agent] YYYY-MM-DD
390
+ - **Note**: [智能补充:简短总结任务数量、关键任务、依赖关系等]
391
+ \`\`\`
350
392
  `
351
393
  )
352
394
  ```
@@ -376,16 +418,22 @@ IMPORTANT: Generate Task JSONs ONLY. IMPL_PLAN.md and TODO_LIST.md by Phase 3 Co
376
418
 
377
419
  CRITICAL: Follow the progressive loading strategy defined in agent specification (load analysis.md files incrementally due to file size)
378
420
 
421
+ ## PLANNING NOTES (PHASE 1-3 CONTEXT)
422
+ Load: .workflow/active/{session-id}/planning-notes.md
423
+
424
+ This document contains consolidated constraints and user intent to guide module-scoped task generation.
425
+
379
426
  ## MODULE SCOPE
380
427
  - Module: ${module.name} (${module.type})
381
428
  - Focus Paths: ${module.paths.join(', ')}
382
429
  - Task ID Prefix: IMPL-${module.prefix}
383
- - Task Limit: ≤9 tasks (hard limit for this module)
430
+ - Task Limit: ≤6 tasks (hard limit for this module)
384
431
  - Other Modules: ${otherModules.join(', ')} (reference only, do NOT generate tasks for them)
385
432
 
386
433
  ## SESSION PATHS
387
434
  Input:
388
435
  - Session Metadata: .workflow/active/{session-id}/workflow-session.json
436
+ - Planning Notes: .workflow/active/{session-id}/planning-notes.md
389
437
  - Context Package: .workflow/active/{session-id}/.process/context-package.json
390
438
 
391
439
  Output:
@@ -411,7 +459,16 @@ CLI Resume Support (MANDATORY for all CLI commands):
411
459
  - Read previous task's cliExecutionId from session state
412
460
  - Format: ccw cli -p "[prompt]" --resume ${previousCliId} --tool ${tool} --mode write
413
461
 
414
- ## EXPLORATION CONTEXT (from context-package.exploration_results)
462
+ ## PRIORITIZED CONTEXT (from context-package.prioritized_context) - ALREADY SORTED
463
+ Context sorting is ALREADY COMPLETED in context-gather Phase 2/3. DO NOT re-sort.
464
+ Filter by module scope (${module.paths.join(', ')}):
465
+ - **user_intent**: Use for task alignment within module
466
+ - **priority_tiers.critical**: Filter for files in ${module.paths.join(', ')} → PRIMARY focus
467
+ - **priority_tiers.high**: Filter for files in ${module.paths.join(', ')} → SECONDARY focus
468
+ - **dependency_order**: Use module-relevant entries for task sequencing
469
+
470
+ ## EXPLORATION CONTEXT (from context-package.exploration_results) - SUPPLEMENT ONLY
471
+ If prioritized_context is incomplete for this module, fall back to exploration_results:
415
472
  - Load exploration_results from context-package.json
416
473
  - Filter for ${module.name} module: Use aggregated_insights.critical_files matching ${module.paths.join(', ')}
417
474
  - Apply module-relevant constraints from aggregated_insights.constraints
@@ -438,8 +495,10 @@ Task JSON Files (.task/IMPL-${module.prefix}*.json):
438
495
  - Task ID format: IMPL-${module.prefix}1, IMPL-${module.prefix}2, ...
439
496
  - Quantified requirements with explicit counts
440
497
  - Artifacts integration from context package (filtered for ${module.name})
441
- - **focus_paths enhanced with exploration critical_files (module-scoped)**
442
- - Flow control with pre_analysis steps (include exploration integration_points analysis)
498
+ - **focus_paths generated directly from prioritized_context.priority_tiers filtered by ${module.paths.join(', ')}**
499
+ - NO re-sorting - use pre-computed tiers filtered for this module
500
+ - Critical files are PRIMARY focus, High files are SECONDARY
501
+ - Flow control with pre_analysis steps (use prioritized_context.dependency_order for module task sequencing)
443
502
  - **CLI Execution IDs and strategies (MANDATORY)**
444
503
  - Focus ONLY on ${module.name} module scope
445
504
 
@@ -482,6 +541,21 @@ Hard Constraints:
482
541
  - Cross-module dependencies use CROSS:: placeholder format consistently
483
542
  - Focus paths scoped to ${module.paths.join(', ')} only
484
543
  - Return: task count, task IDs, dependency summary (internal + cross-module)
544
+
545
+ ## PLANNING NOTES RECORD (REQUIRED)
546
+ After completing module task JSONs, append a brief execution record to planning-notes.md:
547
+
548
+ **File**: .workflow/active/{session_id}/planning-notes.md
549
+ **Location**: Create new section after "## Consolidated Constraints" (if not exists)
550
+ **Format**:
551
+ \`\`\`
552
+ ## Task Generation (Phase 4)
553
+
554
+ ### [Action-Planning Agent - ${module.name}] YYYY-MM-DD
555
+ - **Note**: [智能补充:简短总结本模块任务数量、关键任务等]
556
+ \`\`\`
557
+
558
+ **Note**: Multiple module agents will append their records. Phase 3 Integration Coordinator will add final summary.
485
559
  `
486
560
  )
487
561
  );
@@ -562,6 +636,17 @@ Module Count: ${modules.length}
562
636
  - No CROSS:: placeholders remaining in task JSONs
563
637
  - IMPL_PLAN.md and TODO_LIST.md generated with multi-module structure
564
638
  - Return: task count, per-module breakdown, resolved dependency count
639
+
640
+ ## PLANNING NOTES RECORD (REQUIRED)
641
+ After completing integration, append final summary to planning-notes.md:
642
+
643
+ **File**: .workflow/active/{session_id}/planning-notes.md
644
+ **Location**: Under "## Task Generation (Phase 4)" section (after module agent records)
645
+ **Format**:
646
+ \`\`\`
647
+ ### [Integration Coordinator] YYYY-MM-DD
648
+ - **Note**: [智能补充:简短总结总任务数、跨模块依赖解决情况等]
649
+ \`\`\`
565
650
  `
566
651
  )
567
652
  ```
@@ -579,5 +664,4 @@ function resolveCrossModuleDependency(placeholder, allTasks) {
579
664
  ? candidates.sort((a, b) => a.id.localeCompare(b.id))[0].id
580
665
  : placeholder; // Keep for manual resolution
581
666
  }
582
- ```
583
-
667
+ ```
@@ -257,7 +257,7 @@
257
257
  "essential": true,
258
258
  "flow": {
259
259
  "prerequisites": ["/workflow:execute"],
260
- "next_steps": ["/workflow:review-fix"]
260
+ "next_steps": ["/workflow:review-cycle-fix"]
261
261
  },
262
262
  "source": "../../../commands/workflow/review-session-cycle.md"
263
263
  },
@@ -271,8 +271,8 @@
271
271
  "source": "../../../commands/workflow/review-module-cycle.md"
272
272
  },
273
273
  {
274
- "name": "review-fix",
275
- "command": "/workflow:review-fix",
274
+ "name": "review-cycle-fix",
275
+ "command": "/workflow:review-cycle-fix",
276
276
  "description": "Automated fixing of review findings",
277
277
  "arguments": "<export-file|review-dir>",
278
278
  "category": "workflow",
@@ -280,7 +280,7 @@
280
280
  "flow": {
281
281
  "prerequisites": ["/workflow:review-session-cycle", "/workflow:review-module-cycle"]
282
282
  },
283
- "source": "../../../commands/workflow/review-fix.md"
283
+ "source": "../../../commands/workflow/review-cycle-fix.md"
284
284
  },
285
285
  {
286
286
  "name": "test-gen",