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
package/.claude/CLAUDE.md CHANGED
@@ -9,12 +9,7 @@
9
9
 
10
10
  **Strictly follow the cli-tools.json configuration**
11
11
 
12
- Available CLI endpoints are dynamically defined by the config file:
13
- - Built-in tools and their enable/disable status
14
- - Custom API endpoints registered via the Dashboard
15
- - Managed through the CCW Dashboard Status page
16
-
17
-
12
+ Available CLI endpoints are dynamically defined by the config file
18
13
  ## Tool Execution
19
14
 
20
15
  - **Context Requirements**: @~/.claude/workflows/context-tools.md
@@ -25,9 +20,12 @@ Available CLI endpoints are dynamically defined by the config file:
25
20
  - **TaskOutput usage**: Only use `TaskOutput({ task_id: "xxx", block: false })` + sleep loop to poll completion status. NEVER read intermediate output during agent/CLI execution - wait for final result only
26
21
 
27
22
  ### CLI Tool Calls (ccw cli)
28
- - **Default: `run_in_background: true`** - Unless otherwise specified, always use background execution for CLI calls:
23
+ - **Default: Use Bash `run_in_background: true`** - Unless otherwise specified, always execute CLI calls in background using Bash tool's background mode:
29
24
  ```
30
- Bash({ command: "ccw cli -p '...' --tool gemini", run_in_background: true })
25
+ Bash({
26
+ command: "ccw cli -p '...' --tool gemini",
27
+ run_in_background: true // Bash tool parameter, not ccw cli parameter
28
+ })
31
29
  ```
32
30
  - **After CLI call**: Stop output immediately - let CLI execute in background. **DO NOT use TaskOutput polling** - wait for hook callback to receive results
33
31
 
@@ -55,6 +55,17 @@ color: yellow
55
55
  **Step-by-step execution**:
56
56
 
57
57
  ```
58
+ 0. Load planning notes → Extract phase-level constraints (NEW)
59
+ Commands: Read('.workflow/active/{session-id}/planning-notes.md')
60
+ Output: Consolidated constraints from all workflow phases
61
+ Structure:
62
+ - User Intent: Original GOAL, KEY_CONSTRAINTS
63
+ - Context Findings: Critical files, architecture notes, constraints
64
+ - Conflict Decisions: Resolved conflicts, modified artifacts
65
+ - Consolidated Constraints: Numbered list of ALL constraints (Phase 1-3)
66
+
67
+ USAGE: This is the PRIMARY source of constraints. All task generation MUST respect these constraints.
68
+
58
69
  1. Load session metadata → Extract user input
59
70
  - User description: Original task/feature requirements
60
71
  - Project scope: User-specified boundaries and goals
@@ -299,25 +310,22 @@ function computeCliStrategy(task, allTasks) {
299
310
 
300
311
  **execution_config Alignment Rules** (MANDATORY):
301
312
  ```
302
- userConfig.executionMethod → meta.execution_config + implementation_approach
313
+ userConfig.executionMethod → meta.execution_config
303
314
 
304
315
  "agent" →
305
316
  meta.execution_config = { method: "agent", cli_tool: null, enable_resume: false }
306
- implementation_approach steps: NO command field (agent direct execution)
307
-
308
- "hybrid" →
309
- meta.execution_config = { method: "hybrid", cli_tool: userConfig.preferredCliTool }
310
- implementation_approach steps: command field ONLY on complex steps
317
+ Execution: Agent executes pre_analysis, then directly implements implementation_approach
311
318
 
312
319
  "cli" →
313
- meta.execution_config = { method: "cli", cli_tool: userConfig.preferredCliTool }
314
- implementation_approach steps: command field on ALL steps
320
+ meta.execution_config = { method: "cli", cli_tool: userConfig.preferredCliTool, enable_resume: true }
321
+ Execution: Agent executes pre_analysis, then hands off context + implementation_approach to CLI
322
+
323
+ "hybrid" →
324
+ meta.execution_config = { method: "hybrid", cli_tool: userConfig.preferredCliTool, enable_resume: true }
325
+ Execution: Agent decides which tasks to handoff to CLI based on complexity
315
326
  ```
316
327
 
317
- **Consistency Check**: `meta.execution_config.method` MUST match presence of `command` fields:
318
- - `method: "agent"` → 0 steps have command field
319
- - `method: "hybrid"` → some steps have command field
320
- - `method: "cli"` → all steps have command field
328
+ **Note**: implementation_approach steps NO LONGER contain `command` fields. CLI execution is controlled by task-level `meta.execution_config` only.
321
329
 
322
330
  **Test Task Extensions** (for type="test-gen" or type="test-fix"):
323
331
 
@@ -638,32 +646,6 @@ Agent determines CLI tool usage per-step based on user semantics and task nature
638
646
  "output": "implementation"
639
647
  },
640
648
 
641
- // === CLI MODE: Command Execution (optional command field) ===
642
- {
643
- "step": 3,
644
- "title": "Execute implementation using CLI tool",
645
- "description": "Use Codex/Gemini for complex autonomous execution",
646
- "command": "ccw cli -p '[prompt]' --tool codex --mode write --cd [path]",
647
- "modification_points": ["[Same as default mode]"],
648
- "logic_flow": ["[Same as default mode]"],
649
- "depends_on": [1, 2],
650
- "output": "cli_implementation",
651
- "cli_output_id": "step3_cli_id" // Store execution ID for resume
652
- },
653
-
654
- // === CLI MODE with Resume: Continue from previous CLI execution ===
655
- {
656
- "step": 4,
657
- "title": "Continue implementation with context",
658
- "description": "Resume from previous step with accumulated context",
659
- "command": "ccw cli -p '[continuation prompt]' --resume ${step3_cli_id} --tool codex --mode write",
660
- "resume_from": "step3_cli_id", // Reference previous step's CLI ID
661
- "modification_points": ["[Continue from step 3]"],
662
- "logic_flow": ["[Build on previous output]"],
663
- "depends_on": [3],
664
- "output": "continued_implementation",
665
- "cli_output_id": "step4_cli_id"
666
- }
667
649
  ]
668
650
  ```
669
651
 
@@ -785,13 +767,13 @@ Generate at `.workflow/active/{session_id}/TODO_LIST.md`:
785
767
  Use `analysis_results.complexity` or task count to determine structure:
786
768
 
787
769
  **Single Module Mode**:
788
- - **Simple Tasks** (≤5 tasks): Flat structure
789
- - **Medium Tasks** (6-12 tasks): Flat structure
790
- - **Complex Tasks** (>12 tasks): Re-scope required (maximum 12 tasks hard limit)
770
+ - **Simple Tasks** (≤4 tasks): Flat structure
771
+ - **Medium Tasks** (5-8 tasks): Flat structure
772
+ - **Complex Tasks** (>8 tasks): Re-scope required (maximum 8 tasks hard limit)
791
773
 
792
774
  **Multi-Module Mode** (N+1 parallel planning):
793
- - **Per-module limit**: ≤9 tasks per module
794
- - **Total limit**: Sum of all module tasks ≤27 (3 modules × 9 tasks)
775
+ - **Per-module limit**: ≤6 tasks per module
776
+ - **Total limit**: No total limit (each module independently capped at 6 tasks)
795
777
  - **Task ID format**: `IMPL-{prefix}{seq}` (e.g., IMPL-A1, IMPL-B1)
796
778
  - **Structure**: Hierarchical by module in IMPL_PLAN.md and TODO_LIST.md
797
779
 
@@ -855,6 +837,7 @@ Use `analysis_results.complexity` or task count to determine structure:
855
837
  ### 3.3 Guidelines Checklist
856
838
 
857
839
  **ALWAYS:**
840
+ - **Load planning-notes.md FIRST**: Read planning-notes.md before context-package.json. Use its Consolidated Constraints as primary constraint source for all task generation
858
841
  - **Search Tool Priority**: ACE (`mcp__ace-tool__search_context`) → CCW (`mcp__ccw-tools__smart_search`) / Built-in (`Grep`, `Glob`, `Read`)
859
842
  - Apply Quantification Requirements to all requirements, acceptance criteria, and modification points
860
843
  - Load IMPL_PLAN template: `Read(~/.claude/workflows/cli-templates/prompts/workflow/impl-plan-template.txt)` before generating IMPL_PLAN.md
@@ -865,7 +848,7 @@ Use `analysis_results.complexity` or task count to determine structure:
865
848
  - **Compute CLI execution strategy**: Based on `depends_on`, set `cli_execution.strategy` (new/resume/fork/merge_fork)
866
849
  - Map artifacts: Use artifacts_inventory to populate task.context.artifacts array
867
850
  - Add MCP integration: Include MCP tool steps in flow_control.pre_analysis when capabilities available
868
- - Validate task count: Maximum 12 tasks hard limit, request re-scope if exceeded
851
+ - Validate task count: Maximum 8 tasks (single module) or 6 tasks per module (multi-module), request re-scope if exceeded
869
852
  - Use session paths: Construct all paths using provided session_id
870
853
  - Link documents properly: Use correct linking format (📋 for JSON, ✅ for summaries)
871
854
  - Run validation checklist: Verify all quantification requirements before finalizing task JSONs
@@ -879,7 +862,7 @@ Use `analysis_results.complexity` or task count to determine structure:
879
862
  - Load files directly (use provided context package instead)
880
863
  - Assume default locations (always use session_id in paths)
881
864
  - Create circular dependencies in task.depends_on
882
- - Exceed 12 tasks without re-scoping
865
+ - Exceed 8 tasks (single module) or 6 tasks per module (multi-module) without re-scoping
883
866
  - Skip artifact integration when artifacts_inventory is provided
884
867
  - Ignore MCP capabilities when available
885
868
  - Use fixed pre-analysis steps without task-specific adaptation
@@ -13,6 +13,8 @@ color: cyan
13
13
 
14
14
  You are a generic planning agent that generates structured plan JSON for lite workflows. Output format is determined by the schema reference provided in the prompt. You execute CLI planning tools (Gemini/Qwen), parse results, and generate planObject conforming to the specified schema.
15
15
 
16
+ **CRITICAL**: After generating plan.json, you MUST execute internal **Plan Quality Check** (Phase 5) using CLI analysis to validate and auto-fix plan quality before returning to orchestrator. Quality dimensions: completeness, granularity, dependencies, acceptance criteria, implementation steps, constraint compliance.
17
+
16
18
 
17
19
  ## Input Context
18
20
 
@@ -72,7 +74,22 @@ Phase 4: planObject Generation
72
74
  ├─ Build planObject conforming to schema
73
75
  ├─ Assign CLI execution IDs and strategies
74
76
  ├─ Generate flow_control from depends_on
75
- └─ Return to orchestrator
77
+ └─ Write initial plan.json
78
+
79
+ Phase 5: Plan Quality Check (MANDATORY)
80
+ ├─ Execute CLI quality check using Gemini (Qwen fallback)
81
+ ├─ Analyze plan quality dimensions:
82
+ │ ├─ Task completeness (all requirements covered)
83
+ │ ├─ Task granularity (not too large/small)
84
+ │ ├─ Dependency correctness (no circular deps, proper ordering)
85
+ │ ├─ Acceptance criteria quality (quantified, testable)
86
+ │ ├─ Implementation steps sufficiency (2+ steps per task)
87
+ │ └─ Constraint compliance (follows project-guidelines.json)
88
+ ├─ Parse check results and categorize issues
89
+ └─ Decision:
90
+ ├─ No issues → Return plan to orchestrator
91
+ ├─ Minor issues → Auto-fix → Update plan.json → Return
92
+ └─ Critical issues → Report → Suggest regeneration
76
93
  ```
77
94
 
78
95
  ## CLI Command Template
@@ -734,3 +751,78 @@ function validateTask(task) {
734
751
  - Skip task validation
735
752
  - **Skip CLI execution ID assignment**
736
753
  - **Ignore schema structure**
754
+ - **Skip Phase 5 Plan Quality Check**
755
+
756
+ ---
757
+
758
+ ## Phase 5: Plan Quality Check (MANDATORY)
759
+
760
+ ### Overview
761
+
762
+ After generating plan.json, **MUST** execute CLI quality check before returning to orchestrator. This is a mandatory step for ALL plans regardless of complexity.
763
+
764
+ ### Quality Dimensions
765
+
766
+ | Dimension | Check Criteria | Critical? |
767
+ |-----------|---------------|-----------|
768
+ | **Completeness** | All user requirements reflected in tasks | Yes |
769
+ | **Task Granularity** | Each task 15-60 min scope | No |
770
+ | **Dependencies** | No circular deps, correct ordering | Yes |
771
+ | **Acceptance Criteria** | Quantified and testable (not vague) | No |
772
+ | **Implementation Steps** | 2+ actionable steps per task | No |
773
+ | **Constraint Compliance** | Follows project-guidelines.json | Yes |
774
+
775
+ ### CLI Command Format
776
+
777
+ Use `ccw cli` with analysis mode to validate plan against quality dimensions:
778
+
779
+ ```bash
780
+ ccw cli -p "Validate plan quality: completeness, granularity, dependencies, acceptance criteria, implementation steps, constraint compliance" \
781
+ --tool gemini --mode analysis \
782
+ --context "@{plan_json_path} @.workflow/project-guidelines.json"
783
+ ```
784
+
785
+ **Expected Output Structure**:
786
+ - Quality Check Report (6 dimensions with pass/fail status)
787
+ - Summary (critical/minor issue counts)
788
+ - Recommendation: `PASS` | `AUTO_FIX` | `REGENERATE`
789
+ - Fixes (JSON patches if AUTO_FIX)
790
+
791
+ ### Result Parsing
792
+
793
+ Parse CLI output sections using regex to extract:
794
+ - **6 Dimension Results**: Each with `passed` boolean and issue lists (missing requirements, oversized/undersized tasks, vague criteria, etc.)
795
+ - **Summary Counts**: Critical issues, minor issues
796
+ - **Recommendation**: `PASS` | `AUTO_FIX` | `REGENERATE`
797
+ - **Fixes**: Optional JSON patches for auto-fixable issues
798
+
799
+ ### Auto-Fix Strategy
800
+
801
+ Apply automatic fixes for minor issues:
802
+
803
+ | Issue Type | Auto-Fix Action | Example |
804
+ |-----------|----------------|---------|
805
+ | **Vague Acceptance** | Replace with quantified criteria | "works correctly" → "All unit tests pass with 100% success rate" |
806
+ | **Insufficient Steps** | Expand to 4-step template | Add: Analyze → Implement → Error handling → Verify |
807
+ | **CLI-Provided Patches** | Apply JSON patches from CLI output | Update task fields per patch specification |
808
+
809
+ After fixes, update `_metadata.quality_check` with fix log.
810
+
811
+ ### Execution Flow
812
+
813
+ After Phase 4 planObject generation:
814
+
815
+ 1. **Write Initial Plan** → `${sessionFolder}/plan.json`
816
+ 2. **Execute CLI Check** → Gemini (Qwen fallback)
817
+ 3. **Parse Results** → Extract recommendation and issues
818
+ 4. **Handle Recommendation**:
819
+
820
+ | Recommendation | Action | Return Status |
821
+ |---------------|--------|---------------|
822
+ | `PASS` | Log success, add metadata | `success` |
823
+ | `AUTO_FIX` | Apply fixes, update plan.json, log fixes | `success` |
824
+ | `REGENERATE` | Log critical issues, add issues to metadata | `needs_review` |
825
+
826
+ 5. **Return** → Plan with `_metadata.quality_check` containing execution result
827
+
828
+ **CLI Fallback**: Gemini → Qwen → Skip with warning (if both fail)
@@ -186,34 +186,150 @@ output → Variable name to store this step's result
186
186
 
187
187
  **Execution Flow**:
188
188
  ```
189
- FOR each step in implementation_approach[] (ordered by step number):
190
- 1. Check depends_on: Wait for all listed step numbers to complete
191
- 2. Variable Substitution: Replace [variable_name] in description/modification_points
192
- with values stored from previous steps' output
193
- 3. Execute step (choose one):
194
-
195
- IF step.command exists:
196
- Execute the CLI command via Bash tool
197
- Capture output
198
-
199
- ELSE (no command - Agent direct implementation):
200
- Read modification_points[] as list of files to create/modify
201
- Read logic_flow[] as implementation sequence
202
- For each file in modification_points:
203
- • If "Create new file: path" → Use Write tool to create
204
- If "Modify file: path" → Use Edit tool to modify
205
- If "Add to file: path" Use Edit tool to append
206
- Follow logic_flow sequence for implementation logic
207
- Use [focus_paths] from context as working directory scope
208
-
209
- 4. Store result in [step.output] variable for later steps
210
- 5. Mark step complete, proceed to next
189
+ // Read task-level execution config (Single Source of Truth)
190
+ const executionMethod = task.meta?.execution_config?.method || 'agent';
191
+ const cliTool = task.meta?.execution_config?.cli_tool || getDefaultCliTool(); // See ~/.claude/cli-tools.json
192
+
193
+ // Phase 1: Execute pre_analysis (always by Agent)
194
+ const preAnalysisResults = {};
195
+ for (const step of task.flow_control.pre_analysis || []) {
196
+ const result = executePreAnalysisStep(step);
197
+ preAnalysisResults[step.output_to] = result;
198
+ }
199
+
200
+ // Phase 2: Determine execution mode
201
+ const hasLegacyCommands = task.flow_control.implementation_approach
202
+ .some(step => step.command);
203
+
204
+ IF hasLegacyCommands:
205
+ // Backward compatibility: Old mode with step.command fields
206
+ FOR each step in implementation_approach[]:
207
+ IF step.command exists:
208
+ → Execute via Bash: Bash({ command: step.command, timeout: 3600000 })
209
+ ELSE:
210
+ Agent direct implementation
211
+
212
+ ELSE IF executionMethod === 'cli':
213
+ // New mode: CLI Handoff
214
+ → const cliPrompt = buildCliHandoffPrompt(preAnalysisResults, task)
215
+ → const cliCommand = buildCliCommand(task, cliTool, cliPrompt)
216
+ → Bash({ command: cliCommand, run_in_background: false, timeout: 3600000 })
217
+
218
+ ELSE IF executionMethod === 'hybrid':
219
+ // Hybrid mode: Agent decides based on task complexity
220
+ → IF task is complex (multiple files, complex logic):
221
+ Use CLI Handoff (same as cli mode)
222
+ ELSE:
223
+ Use Agent direct implementation
224
+
225
+ ELSE (executionMethod === 'agent'):
226
+ // Default: Agent direct implementation
227
+ FOR each step in implementation_approach[]:
228
+ 1. Variable Substitution: Replace [variable_name] with preAnalysisResults
229
+ 2. Read modification_points[] as files to create/modify
230
+ 3. Read logic_flow[] as implementation sequence
231
+ 4. For each file in modification_points:
232
+ • If "Create new file: path" → Use Write tool
233
+ • If "Modify file: path" → Use Edit tool
234
+ • If "Add to file: path" → Use Edit tool (append)
235
+ 5. Follow logic_flow sequence
236
+ 6. Use [focus_paths] from context as working directory scope
237
+ 7. Store result in [step.output] variable
238
+ ```
239
+
240
+ **CLI Handoff Functions**:
241
+
242
+ ```javascript
243
+ // Get default CLI tool from cli-tools.json
244
+ function getDefaultCliTool() {
245
+ // Read ~/.claude/cli-tools.json and return first enabled tool
246
+ // Fallback order: gemini → qwen → codex (first enabled in config)
247
+ return firstEnabledTool || 'gemini'; // System default fallback
248
+ }
249
+
250
+ // Build CLI prompt from pre-analysis results and task
251
+ function buildCliHandoffPrompt(preAnalysisResults, task) {
252
+ const contextSection = Object.entries(preAnalysisResults)
253
+ .map(([key, value]) => `### ${key}\n${value}`)
254
+ .join('\n\n');
255
+
256
+ const approachSection = task.flow_control.implementation_approach
257
+ .map((step, i) => `
258
+ ### Step ${step.step}: ${step.title}
259
+ ${step.description}
260
+
261
+ **Modification Points**:
262
+ ${step.modification_points?.map(m => `- ${m}`).join('\n') || 'N/A'}
263
+
264
+ **Logic Flow**:
265
+ ${step.logic_flow?.map((l, j) => `${j + 1}. ${l}`).join('\n') || 'Follow modification points'}
266
+ `).join('\n');
267
+
268
+ return `
269
+ PURPOSE: ${task.title}
270
+ Complete implementation based on pre-analyzed context.
271
+
272
+ ## PRE-ANALYSIS CONTEXT
273
+ ${contextSection}
274
+
275
+ ## REQUIREMENTS
276
+ ${task.context.requirements?.map(r => `- ${r}`).join('\n') || task.context.requirements}
277
+
278
+ ## IMPLEMENTATION APPROACH
279
+ ${approachSection}
280
+
281
+ ## ACCEPTANCE CRITERIA
282
+ ${task.context.acceptance?.map(a => `- ${a}`).join('\n') || task.context.acceptance}
283
+
284
+ ## TARGET FILES
285
+ ${task.flow_control.target_files?.map(f => `- ${f}`).join('\n') || 'See modification points above'}
286
+
287
+ MODE: write
288
+ CONSTRAINTS: Follow existing patterns | No breaking changes
289
+ `.trim();
290
+ }
291
+
292
+ // Build CLI command with resume strategy
293
+ function buildCliCommand(task, cliTool, cliPrompt) {
294
+ const cli = task.cli_execution || {};
295
+ const escapedPrompt = cliPrompt.replace(/"/g, '\\"');
296
+ const baseCmd = `ccw cli -p "${escapedPrompt}"`;
297
+
298
+ switch (cli.strategy) {
299
+ case 'new':
300
+ return `${baseCmd} --tool ${cliTool} --mode write --id ${task.cli_execution_id}`;
301
+ case 'resume':
302
+ return `${baseCmd} --resume ${cli.resume_from} --tool ${cliTool} --mode write`;
303
+ case 'fork':
304
+ return `${baseCmd} --resume ${cli.resume_from} --id ${task.cli_execution_id} --tool ${cliTool} --mode write`;
305
+ case 'merge_fork':
306
+ return `${baseCmd} --resume ${cli.merge_from.join(',')} --id ${task.cli_execution_id} --tool ${cliTool} --mode write`;
307
+ default:
308
+ // Fallback: no resume, no id
309
+ return `${baseCmd} --tool ${cliTool} --mode write`;
310
+ }
311
+ }
211
312
  ```
212
313
 
213
- **CLI Command Execution (CLI Execute Mode)**:
214
- When step contains `command` field with Codex CLI, execute via CCW CLI. For Codex resume:
215
- - First task (`depends_on: []`): `ccw cli -p "..." --tool codex --mode write --cd [path]`
216
- - Subsequent tasks (has `depends_on`): Use CCW CLI with resume context to maintain session
314
+ **Execution Config Reference** (from task.meta.execution_config):
315
+ | Field | Values | Description |
316
+ |-------|--------|-------------|
317
+ | `method` | `agent` / `cli` / `hybrid` | Execution mode (default: agent) |
318
+ | `cli_tool` | See `~/.claude/cli-tools.json` | CLI tool preference (first enabled tool as default) |
319
+ | `enable_resume` | `true` / `false` | Enable CLI session resume |
320
+
321
+ **CLI Execution Reference** (from task.cli_execution):
322
+ | Field | Values | Description |
323
+ |-------|--------|-------------|
324
+ | `strategy` | `new` / `resume` / `fork` / `merge_fork` | Resume strategy |
325
+ | `resume_from` | `{session}-{task_id}` | Parent task CLI ID (resume/fork) |
326
+ | `merge_from` | `[{id1}, {id2}]` | Parent task CLI IDs (merge_fork) |
327
+
328
+ **Resume Strategy Examples**:
329
+ - **New task** (no dependencies): `--id WFS-001-IMPL-001`
330
+ - **Resume** (single dependency, single child): `--resume WFS-001-IMPL-001`
331
+ - **Fork** (single dependency, multiple children): `--resume WFS-001-IMPL-001 --id WFS-001-IMPL-002`
332
+ - **Merge** (multiple dependencies): `--resume WFS-001-IMPL-001,WFS-001-IMPL-002 --id WFS-001-IMPL-003`
217
333
 
218
334
  **Test-Driven Development**:
219
335
  - Write tests first (red → green → refactor)
@@ -389,7 +505,8 @@ Before completing any task, verify:
389
505
  - Use `run_in_background=false` for all Bash/CLI calls - agent cannot receive task hook callbacks
390
506
  - Set timeout ≥60 minutes for CLI commands (hooks don't propagate to subagents):
391
507
  ```javascript
392
- Bash(command="ccw cli -p '...' --tool codex --mode write", timeout=3600000) // 60 min
508
+ Bash(command="ccw cli -p '...' --tool <cli-tool> --mode write", timeout=3600000) // 60 min
509
+ // <cli-tool>: First enabled tool from ~/.claude/cli-tools.json (e.g., gemini, qwen, codex)
393
510
  ```
394
511
 
395
512
  **ALWAYS:**