claude-code-workflow 7.2.29 → 7.2.30

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 (124) hide show
  1. package/.ccw/workflows/cli-templates/schemas/plan-overview-base-schema.json +2 -2
  2. package/.ccw/workflows/cli-templates/schemas/task-schema.json +14 -7
  3. package/.claude/agents/action-planning-agent.md +7 -4
  4. package/.claude/agents/cli-explore-agent.md +77 -63
  5. package/.claude/agents/cli-lite-planning-agent.md +11 -10
  6. package/.claude/agents/issue-plan-agent.md +421 -426
  7. package/.claude/commands/workflow/spec/setup.md +1 -1
  8. package/.claude/skills/ccw-chain/SKILL.md +119 -0
  9. package/.claude/skills/ccw-chain/chains/ccw-cycle.json +21 -0
  10. package/.claude/skills/ccw-chain/chains/ccw-exploration.json +47 -0
  11. package/.claude/skills/ccw-chain/chains/ccw-issue.json +33 -0
  12. package/.claude/skills/ccw-chain/chains/ccw-lightweight.json +57 -0
  13. package/.claude/skills/ccw-chain/chains/ccw-main.json +52 -0
  14. package/.claude/skills/ccw-chain/chains/ccw-standard.json +39 -0
  15. package/.claude/skills/ccw-chain/chains/ccw-team.json +10 -0
  16. package/.claude/skills/ccw-chain/chains/ccw-with-file.json +31 -0
  17. package/.claude/skills/ccw-chain/phases/analyze-with-file.md +788 -0
  18. package/.claude/skills/ccw-chain/phases/brainstorm/SKILL.md +408 -0
  19. package/.claude/skills/ccw-chain/phases/brainstorm/phases/01-mode-routing.md +207 -0
  20. package/.claude/skills/ccw-chain/phases/brainstorm/phases/02-artifacts.md +567 -0
  21. package/.claude/skills/ccw-chain/phases/brainstorm/phases/03-role-analysis.md +748 -0
  22. package/.claude/skills/ccw-chain/phases/brainstorm/phases/04-synthesis.md +827 -0
  23. package/.claude/skills/ccw-chain/phases/brainstorm-with-file.md +482 -0
  24. package/.claude/skills/ccw-chain/phases/collaborative-plan-with-file.md +639 -0
  25. package/.claude/skills/ccw-chain/phases/debug-with-file.md +656 -0
  26. package/.claude/skills/ccw-chain/phases/integration-test-cycle.md +936 -0
  27. package/.claude/skills/ccw-chain/phases/issue-convert-to-plan.md +720 -0
  28. package/.claude/skills/ccw-chain/phases/issue-discover.md +483 -0
  29. package/.claude/skills/ccw-chain/phases/issue-execute.md +629 -0
  30. package/.claude/skills/ccw-chain/phases/issue-from-brainstorm.md +382 -0
  31. package/.claude/skills/ccw-chain/phases/issue-plan.md +343 -0
  32. package/.claude/skills/ccw-chain/phases/issue-queue.md +464 -0
  33. package/.claude/skills/ccw-chain/phases/refactor-cycle.md +852 -0
  34. package/.claude/skills/ccw-chain/phases/review-cycle/SKILL.md +132 -0
  35. package/.claude/skills/ccw-chain/phases/review-cycle/phases/review-fix.md +760 -0
  36. package/.claude/skills/ccw-chain/phases/review-cycle/phases/review-module.md +764 -0
  37. package/.claude/skills/ccw-chain/phases/review-cycle/phases/review-session.md +775 -0
  38. package/.claude/skills/ccw-chain/phases/roadmap-with-file.md +544 -0
  39. package/.claude/skills/ccw-chain/phases/spec-generator/SKILL.md +338 -0
  40. package/.claude/skills/ccw-chain/phases/spec-generator/phases/01-5-requirement-clarification.md +404 -0
  41. package/.claude/skills/ccw-chain/phases/spec-generator/phases/01-discovery.md +257 -0
  42. package/.claude/skills/ccw-chain/phases/spec-generator/phases/02-product-brief.md +274 -0
  43. package/.claude/skills/ccw-chain/phases/spec-generator/phases/03-requirements.md +184 -0
  44. package/.claude/skills/ccw-chain/phases/spec-generator/phases/04-architecture.md +248 -0
  45. package/.claude/skills/ccw-chain/phases/spec-generator/phases/05-epics-stories.md +178 -0
  46. package/.claude/skills/ccw-chain/phases/spec-generator/phases/06-5-auto-fix.md +144 -0
  47. package/.claude/skills/ccw-chain/phases/spec-generator/phases/06-readiness-check.md +480 -0
  48. package/.claude/skills/ccw-chain/phases/team-planex.md +123 -0
  49. package/.claude/skills/ccw-chain/phases/ui-design-explore-auto.md +678 -0
  50. package/.claude/skills/ccw-chain/phases/unified-execute-with-file.md +870 -0
  51. package/.claude/skills/ccw-chain/phases/workflow-execute/SKILL.md +625 -0
  52. package/.claude/skills/ccw-chain/phases/workflow-execute/phases/06-review.md +215 -0
  53. package/.claude/skills/ccw-chain/phases/workflow-lite-plan.md +616 -0
  54. package/.claude/skills/ccw-chain/phases/workflow-multi-cli-plan.md +424 -0
  55. package/.claude/skills/ccw-chain/phases/workflow-plan/SKILL.md +466 -0
  56. package/.claude/skills/ccw-chain/phases/workflow-plan/phases/01-session-discovery.md +99 -0
  57. package/.claude/skills/ccw-chain/phases/workflow-plan/phases/02-context-gathering.md +338 -0
  58. package/.claude/skills/ccw-chain/phases/workflow-plan/phases/03-conflict-resolution.md +422 -0
  59. package/.claude/skills/ccw-chain/phases/workflow-plan/phases/04-task-generation.md +440 -0
  60. package/.claude/skills/ccw-chain/phases/workflow-plan/phases/05-plan-verify.md +395 -0
  61. package/.claude/skills/ccw-chain/phases/workflow-plan/phases/06-replan.md +594 -0
  62. package/.claude/skills/ccw-chain/phases/workflow-tdd-plan/SKILL.md +527 -0
  63. package/.claude/skills/ccw-chain/phases/workflow-tdd-plan/phases/01-session-discovery.md +57 -0
  64. package/.claude/skills/ccw-chain/phases/workflow-tdd-plan/phases/02-context-gathering.md +407 -0
  65. package/.claude/skills/ccw-chain/phases/workflow-tdd-plan/phases/03-test-coverage-analysis.md +172 -0
  66. package/.claude/skills/ccw-chain/phases/workflow-tdd-plan/phases/04-conflict-resolution.md +426 -0
  67. package/.claude/skills/ccw-chain/phases/workflow-tdd-plan/phases/05-tdd-task-generation.md +473 -0
  68. package/.claude/skills/ccw-chain/phases/workflow-tdd-plan/phases/06-tdd-structure-validation.md +189 -0
  69. package/.claude/skills/ccw-chain/phases/workflow-tdd-plan/phases/07-tdd-verify.md +635 -0
  70. package/.claude/skills/ccw-chain/phases/workflow-test-fix/SKILL.md +482 -0
  71. package/.claude/skills/ccw-chain/phases/workflow-test-fix/phases/01-session-start.md +60 -0
  72. package/.claude/skills/ccw-chain/phases/workflow-test-fix/phases/02-test-context-gather.md +493 -0
  73. package/.claude/skills/ccw-chain/phases/workflow-test-fix/phases/03-test-concept-enhanced.md +150 -0
  74. package/.claude/skills/ccw-chain/phases/workflow-test-fix/phases/04-test-task-generate.md +346 -0
  75. package/.claude/skills/ccw-chain/phases/workflow-test-fix/phases/05-test-cycle-execute.md +538 -0
  76. package/.claude/skills/ccw-chain/specs/auto-mode.md +47 -0
  77. package/.claude/skills/ccw-chain/specs/intent-patterns.md +60 -0
  78. package/.claude/skills/chain-loader/SKILL.md +78 -0
  79. package/.claude/skills/chain-loader/phases/01-analyze-skill.md +53 -0
  80. package/.claude/skills/chain-loader/phases/02-design-graph.md +73 -0
  81. package/.claude/skills/chain-loader/phases/03-generate-validate.md +75 -0
  82. package/.claude/skills/chain-loader/specs/chain-schema.md +99 -0
  83. package/.claude/skills/chain-loader/specs/design-patterns.md +99 -0
  84. package/.claude/skills/chain-loader/templates/chain-json.md +63 -0
  85. package/.claude/skills/review-cycle/phases/review-module.md +764 -764
  86. package/.claude/skills/review-cycle/phases/review-session.md +775 -775
  87. package/.claude/skills/workflow-multi-cli-plan/SKILL.md +2 -2
  88. package/.claude/skills/workflow-plan/phases/03-conflict-resolution.md +422 -422
  89. package/.claude/skills/workflow-plan/phases/05-plan-verify.md +395 -395
  90. package/.claude/skills/workflow-tdd-plan/phases/02-context-gathering.md +407 -407
  91. package/.claude/skills/workflow-tdd-plan/phases/04-conflict-resolution.md +426 -426
  92. package/.claude/skills/workflow-test-fix/phases/02-test-context-gather.md +493 -493
  93. package/README.md +14 -0
  94. package/ccw/dist/core/routes/litellm-api-routes.d.ts.map +1 -1
  95. package/ccw/dist/core/routes/litellm-api-routes.js +0 -23
  96. package/ccw/dist/core/routes/litellm-api-routes.js.map +1 -1
  97. package/ccw/dist/tools/chain-loader.d.ts +10 -0
  98. package/ccw/dist/tools/chain-loader.d.ts.map +1 -0
  99. package/ccw/dist/tools/chain-loader.js +642 -0
  100. package/ccw/dist/tools/chain-loader.js.map +1 -0
  101. package/ccw/dist/tools/index.d.ts.map +1 -1
  102. package/ccw/dist/tools/index.js +2 -0
  103. package/ccw/dist/tools/index.js.map +1 -1
  104. package/ccw/dist/tools/json-builder.js +20 -0
  105. package/ccw/dist/tools/json-builder.js.map +1 -1
  106. package/ccw/dist/types/chain-types.d.ts +72 -0
  107. package/ccw/dist/types/chain-types.d.ts.map +1 -0
  108. package/ccw/dist/types/chain-types.js +5 -0
  109. package/ccw/dist/types/chain-types.js.map +1 -0
  110. package/ccw/scripts/prepublish-clean.mjs +0 -1
  111. package/package.json +1 -3
  112. package/ccw-litellm/README.md +0 -180
  113. package/ccw-litellm/pyproject.toml +0 -35
  114. package/ccw-litellm/src/ccw_litellm/__init__.py +0 -47
  115. package/ccw-litellm/src/ccw_litellm/cli.py +0 -108
  116. package/ccw-litellm/src/ccw_litellm/clients/__init__.py +0 -12
  117. package/ccw-litellm/src/ccw_litellm/clients/litellm_embedder.py +0 -270
  118. package/ccw-litellm/src/ccw_litellm/clients/litellm_llm.py +0 -198
  119. package/ccw-litellm/src/ccw_litellm/config/__init__.py +0 -22
  120. package/ccw-litellm/src/ccw_litellm/config/loader.py +0 -343
  121. package/ccw-litellm/src/ccw_litellm/config/models.py +0 -162
  122. package/ccw-litellm/src/ccw_litellm/interfaces/__init__.py +0 -14
  123. package/ccw-litellm/src/ccw_litellm/interfaces/embedder.py +0 -52
  124. package/ccw-litellm/src/ccw_litellm/interfaces/llm.py +0 -45
@@ -0,0 +1,625 @@
1
+ ---
2
+ name: workflow-execute
3
+ description: Coordinate agent execution for workflow tasks with automatic session discovery, parallel task processing, and status tracking. Triggers on "workflow-execute".
4
+ allowed-tools: Skill, Agent, AskUserQuestion, TaskCreate, TaskUpdate, TaskList, Read, Write, Edit, Bash, Glob, Grep
5
+ ---
6
+
7
+ # Workflow Execute
8
+
9
+ Orchestrates autonomous workflow execution through systematic task discovery, agent coordination, and progress tracking. **Executes entire workflow without user interruption** (except initial session selection if multiple active sessions exist), providing complete context to agents and ensuring proper flow control execution with comprehensive TodoWrite tracking.
10
+
11
+ **Resume Mode**: When called with `--resume-session` flag, skips discovery phase and directly enters TodoWrite generation and agent execution for the specified session.
12
+
13
+ ## Usage
14
+
15
+ ```bash
16
+ # Interactive mode (with confirmations)
17
+ /workflow-execute
18
+ /workflow-execute --resume-session="WFS-auth"
19
+
20
+ # Auto mode (skip confirmations, use defaults)
21
+ /workflow-execute --yes
22
+ /workflow-execute -y
23
+ /workflow-execute -y --resume-session="WFS-auth"
24
+
25
+ # With auto-commit (commit after each task completion)
26
+ /workflow-execute --with-commit
27
+ /workflow-execute -y --with-commit
28
+ /workflow-execute -y --with-commit --resume-session="WFS-auth"
29
+ ```
30
+
31
+ ## Auto Mode Defaults
32
+
33
+ When `--yes` or `-y` flag is used:
34
+ - **Session Selection**: Automatically selects the first (most recent) active session
35
+ - **Completion Choice**: Automatically completes session (runs `/workflow:session:complete --yes`)
36
+
37
+ When `--with-commit` flag is used:
38
+ - **Auto-Commit**: After each agent task completes, commit changes based on summary document
39
+ - **Commit Principle**: Minimal commits - only commit files modified by the completed task
40
+ - **Commit Message**: Generated from task summary with format: "feat/fix/refactor: {task-title} - {summary}"
41
+
42
+ **Flag Parsing**:
43
+ ```javascript
44
+ // ★ 统一 auto mode 检测:-y/--yes 从 $ARGUMENTS 或 ccw 传播
45
+ const autoYes = /\b(-y|--yes)\b/.test($ARGUMENTS)
46
+ const withCommit = $ARGUMENTS.includes('--with-commit')
47
+ ```
48
+
49
+ ## Performance Optimization Strategy
50
+
51
+ **Lazy Loading**: Task JSONs read **on-demand** during execution, not upfront. TODO_LIST.md + IMPL_PLAN.md provide metadata for planning.
52
+
53
+ **Loading Strategy**:
54
+ - **TODO_LIST.md**: Read in Phase 3 (task metadata, status, dependencies for TodoWrite generation)
55
+ - **IMPL_PLAN.md**: Check existence in Phase 2 (normal mode), parse execution strategy in Phase 4A
56
+ - **Task JSONs**: Lazy loading - read only when task is about to execute (Phase 4B)
57
+
58
+ ## Core Rules
59
+ **Complete entire workflow autonomously without user interruption, using TodoWrite for comprehensive progress tracking.**
60
+ **Execute all discovered pending tasks until workflow completion or blocking dependency.**
61
+ **User-choice completion: When all tasks finished, ask user to choose review or complete.**
62
+ **ONE AGENT = ONE TASK JSON: Each agent instance executes exactly one task JSON file - never batch multiple tasks into single agent execution.**
63
+
64
+ ## Core Responsibilities
65
+ - **Session Discovery**: Identify and select active workflow sessions
66
+ - **Execution Strategy Parsing**: Extract execution model from IMPL_PLAN.md
67
+ - **TodoWrite Progress Tracking**: Maintain real-time execution status throughout entire workflow
68
+ - **Agent Orchestration**: Coordinate specialized agents with complete context
69
+ - **Status Synchronization**: Update task JSON files and workflow state
70
+ - **Autonomous Completion**: Continue execution until all tasks complete or reach blocking state
71
+ - **Session User-Choice Completion**: Ask user to choose review or complete when all tasks finished
72
+
73
+ ## Execution Philosophy
74
+ - **Progress tracking**: Continuous TodoWrite updates throughout entire workflow execution
75
+ - **Autonomous completion**: Execute all tasks without user interruption until workflow complete
76
+
77
+ ## Execution Process
78
+
79
+ ```
80
+ Normal Mode:
81
+ Phase 1: Discovery
82
+ ├─ Count active sessions
83
+ └─ Decision:
84
+ ├─ count=0 → ERROR: No active sessions
85
+ ├─ count=1 → Auto-select session → Phase 2
86
+ └─ count>1 → AskUserQuestion (max 4 options) → Phase 2
87
+
88
+ Phase 2: Planning Document Validation
89
+ ├─ Check IMPL_PLAN.md exists
90
+ ├─ Check TODO_LIST.md exists
91
+ └─ Validate .task/ contains IMPL-*.json files
92
+
93
+ Phase 3: TodoWrite Generation
94
+ ├─ Update session status to "active" (Step 0)
95
+ ├─ Parse TODO_LIST.md for task statuses
96
+ ├─ Generate TodoWrite for entire workflow
97
+ └─ Prepare session context paths
98
+
99
+ Phase 4: Execution Strategy & Task Execution
100
+ ├─ Step 4A: Parse execution strategy from IMPL_PLAN.md
101
+ └─ Step 4B: Execute tasks with lazy loading
102
+ └─ Loop:
103
+ ├─ Get next in_progress task from TodoWrite
104
+ ├─ Lazy load task JSON
105
+ ├─ Launch agent with task context
106
+ ├─ Mark task completed (update IMPL-*.json status)
107
+ │ # Quick fix: Update task status for ccw dashboard
108
+ │ # TS=$(date -Iseconds) && jq --arg ts "$TS" '.status="completed" | .status_history=(.status_history // [])+[{"from":"in_progress","to":"completed","changed_at":$ts}]' IMPL-X.json > tmp.json && mv tmp.json IMPL-X.json
109
+ ├─ [with-commit] Commit changes based on summary (minimal principle)
110
+ │ # Read summary from .summaries/IMPL-X-summary.md
111
+ │ # Extract changed files from summary's "Files Modified" section
112
+ │ # Generate commit message: "feat/fix/refactor: {task-title} - {summary}"
113
+ │ # git add <changed-files> && git commit -m "<commit-message>"
114
+ └─ Advance to next task
115
+
116
+ Phase 5: Completion
117
+ ├─ Update task statuses in JSON files
118
+ ├─ Generate summaries
119
+ └─ AskUserQuestion: Choose next step
120
+ ├─ "Enter Review" → Phase 6
121
+ └─ "Complete Session" → /workflow:session:complete
122
+
123
+ Phase 6: Post-Implementation Review (Optional)
124
+ └─ Ref: phases/06-review.md
125
+ ├─ Select review type (quality/security/architecture/action-items)
126
+ ├─ CLI-assisted analysis (Gemini/Qwen)
127
+ ├─ Generate REVIEW-{type}.md report
128
+ └─ Post-review: another review or complete session
129
+
130
+ Resume Mode (--resume-session):
131
+ ├─ Skip Phase 1 & Phase 2
132
+ └─ Entry Point: Phase 3 (TodoWrite Generation)
133
+ ├─ Update session status to "active" (if not already)
134
+ └─ Continue: Phase 4 → Phase 5 → [Phase 6]
135
+ ```
136
+
137
+ ## Execution Lifecycle
138
+
139
+ ### Phase 1: Discovery
140
+ **Applies to**: Normal mode only (skipped in resume mode)
141
+
142
+ **Purpose**: Find and select active workflow session with user confirmation when multiple sessions exist
143
+
144
+ **Process**:
145
+
146
+ #### Step 1.1: Count Active Sessions
147
+ ```bash
148
+ bash(find .workflow/active/ -name "WFS-*" -type d 2>/dev/null | wc -l)
149
+ ```
150
+
151
+ #### Step 1.2: Handle Session Selection
152
+
153
+ **Case A: No Sessions** (count = 0)
154
+ ```
155
+ ERROR: No active workflow sessions found
156
+ Run /workflow-plan "task description" to create a session
157
+ ```
158
+
159
+ **Case B: Single Session** (count = 1)
160
+ ```bash
161
+ bash(find .workflow/active/ -name "WFS-*" -type d 2>/dev/null | head -1 | xargs basename)
162
+ ```
163
+ Auto-select and continue to Phase 2.
164
+
165
+ **Case C: Multiple Sessions** (count > 1)
166
+
167
+ List sessions with metadata and prompt user selection:
168
+ ```bash
169
+ bash(for dir in .workflow/active/WFS-*/; do [ -d "$dir" ] || continue; session=$(basename "$dir"); project=$(jq -r '.project // "Unknown"' "${dir}workflow-session.json" 2>/dev/null || echo "Unknown"); total=$(grep -c '^\- \[' "${dir}TODO_LIST.md" 2>/dev/null || echo 0); completed=$(grep -c '^\- \[x\]' "${dir}TODO_LIST.md" 2>/dev/null || echo 0); if [ "$total" -gt 0 ]; then progress=$((completed * 100 / total)); else progress=0; fi; echo "$session | $project | $completed/$total tasks ($progress%)"; done)
170
+ ```
171
+
172
+ **Parse --yes flag**:
173
+ ```javascript
174
+ // ★ 统一 auto mode 检测:-y/--yes 从 $ARGUMENTS 或 ccw 传播
175
+ const autoYes = /\b(-y|--yes)\b/.test($ARGUMENTS)
176
+ ```
177
+
178
+ **Conditional Selection**:
179
+ ```javascript
180
+ if (autoYes) {
181
+ // Auto mode: Select first session (most recent)
182
+ const firstSession = sessions[0]
183
+ console.log(`[--yes] Auto-selecting session: ${firstSession.id}`)
184
+ selectedSessionId = firstSession.id
185
+ // Continue to Phase 2
186
+ } else {
187
+ // Interactive mode: Use AskUserQuestion to present formatted options (max 4 options shown)
188
+ // If more than 4 sessions, show most recent 4 with "Other" option for manual input
189
+ const sessions = getActiveSessions() // sorted by last modified
190
+ const displaySessions = sessions.slice(0, 4)
191
+
192
+ AskUserQuestion({
193
+ questions: [{
194
+ question: "Multiple active sessions detected. Select one:",
195
+ header: "Session",
196
+ multiSelect: false,
197
+ options: displaySessions.map(s => ({
198
+ label: s.id,
199
+ description: `${s.project} | ${s.progress}`
200
+ }))
201
+ // Note: User can select "Other" to manually enter session ID
202
+ }]
203
+ })
204
+ }
205
+ ```
206
+
207
+ **Input Validation**:
208
+ - If user selects from options: Use selected session ID
209
+ - If user selects "Other" and provides input: Validate session exists
210
+ - If validation fails: Show error and re-prompt or suggest available sessions
211
+
212
+ Parse user input (supports: number "1", full ID "WFS-auth-system", or partial "auth"), validate selection, and continue to Phase 2.
213
+
214
+ #### Step 1.3: Load Session Metadata
215
+ ```bash
216
+ bash(cat .workflow/active/${sessionId}/workflow-session.json)
217
+ ```
218
+
219
+ **Output**: Store session metadata in memory
220
+ **DO NOT read task JSONs yet** - defer until execution phase (lazy loading)
221
+
222
+ **Resume Mode**: This entire phase is skipped when `--resume-session="session-id"` flag is provided.
223
+
224
+ ### Phase 2: Planning Document Validation
225
+ **Applies to**: Normal mode only (skipped in resume mode)
226
+
227
+ **Purpose**: Validate planning artifacts exist before execution
228
+
229
+ **Process**:
230
+ 1. **Check IMPL_PLAN.md**: Verify file exists (defer detailed parsing to Phase 4A)
231
+ 2. **Check plan.json**: Verify file exists (structured plan overview, used in Phase 4A)
232
+ 3. **Check TODO_LIST.md**: Verify file exists (defer reading to Phase 3)
233
+ 4. **Validate Task Directory**: Ensure `.task/` contains at least one IMPL-*.json file
234
+
235
+ **Key Optimization**: Only existence checks here. Actual file reading happens in later phases.
236
+
237
+ **Resume Mode**: This phase is skipped when `--resume-session` flag is provided. Resume mode entry point is Phase 3.
238
+
239
+ ### Phase 3: TodoWrite Generation
240
+ **Applies to**: Both normal and resume modes (resume mode entry point)
241
+
242
+ **Step 0: Update Session Status to Active**
243
+ Before generating TodoWrite, update session status from "planning" to "active":
244
+ ```bash
245
+ # Update session status (idempotent - safe to run if already active)
246
+ jq '.status = "active" | .execution_started_at = (.execution_started_at // now | todate)' \
247
+ .workflow/active/${sessionId}/workflow-session.json > tmp.json && \
248
+ mv tmp.json .workflow/active/${sessionId}/workflow-session.json
249
+ ```
250
+ This ensures the dashboard shows the session as "ACTIVE" during execution.
251
+
252
+ **Process**:
253
+ 1. **Create TodoWrite List**: Generate task list from TODO_LIST.md (not from task JSONs)
254
+ - Parse TODO_LIST.md to extract all tasks with current statuses
255
+ - Identify first pending task with met dependencies
256
+ - Generate comprehensive TodoWrite covering entire workflow
257
+ 2. **Prepare Session Context**: Inject workflow paths for agent use (using provided session-id)
258
+ 3. **Validate Prerequisites**: Ensure IMPL_PLAN.md and TODO_LIST.md exist and are valid
259
+
260
+ **Resume Mode Behavior**:
261
+ - Load existing TODO_LIST.md directly from `.workflow/active/{session-id}/`
262
+ - Extract current progress from TODO_LIST.md
263
+ - Generate TodoWrite from TODO_LIST.md state
264
+ - Proceed immediately to agent execution (Phase 4)
265
+
266
+ ### Phase 4: Execution Strategy Selection & Task Execution
267
+ **Applies to**: Both normal and resume modes
268
+
269
+ **Step 4A: Parse Execution Strategy (plan.json preferred, IMPL_PLAN.md fallback)**
270
+
271
+ Prefer `plan.json` (structured) over `IMPL_PLAN.md` (human-readable) for execution strategy:
272
+ 1. **If plan.json exists**: Read `recommended_execution`, `complexity`, `task_ids[]`, `shared_context`
273
+ 2. **Fallback to IMPL_PLAN.md**: Read Section 4 to extract execution model
274
+
275
+ Extract:
276
+ - **Execution Model**: Sequential | Parallel | Phased | TDD Cycles
277
+ - **Parallelization Opportunities**: Which tasks can run in parallel
278
+ - **Serialization Requirements**: Which tasks must run sequentially
279
+ - **Critical Path**: Priority execution order
280
+
281
+ If neither has execution strategy, use intelligent fallback (analyze task structure).
282
+
283
+ **Step 4B: Execute Tasks with Lazy Loading**
284
+
285
+ **Key Optimization**: Read task JSON **only when needed** for execution
286
+
287
+ **Execution Loop Pattern**:
288
+ ```
289
+ while (TODO_LIST.md has pending tasks) {
290
+ next_task_id = getTodoWriteInProgressTask()
291
+ task_json = Read(.workflow/active/{session}/.task/{next_task_id}.json) // Lazy load
292
+ executeTaskWithAgent(task_json)
293
+ updateTodoListMarkCompleted(next_task_id)
294
+ advanceTodoWriteToNextTask()
295
+ }
296
+ ```
297
+
298
+ **Execution Process per Task**:
299
+ 1. **Identify Next Task**: From TodoWrite, get the next `in_progress` task ID
300
+ 2. **Load Task JSON on Demand**: Read `.task/{task-id}.json` for current task ONLY
301
+ 3. **Validate Task Structure**: Ensure required fields exist (id, title, description, depends_on, convergence)
302
+ 4. **Launch Agent**: Invoke specialized agent with complete context including flow control steps
303
+ 5. **Monitor Progress**: Track agent execution and handle errors without user interruption
304
+ 6. **Collect Results**: Gather implementation results and outputs
305
+ 7. **[with-commit] Auto-Commit**: If `--with-commit` flag enabled, commit changes based on summary
306
+ - Read summary from `.summaries/{task-id}-summary.md`
307
+ - Extract changed files from summary's "Files Modified" section
308
+ - Determine commit type from `meta.type` (feature→feat, bugfix→fix, refactor→refactor)
309
+ - Generate commit message: "{type}: {task-title} - {summary-first-line}"
310
+ - Commit only modified files (minimal principle): `git add <files> && git commit -m "<message>"`
311
+ 8. **Continue Workflow**: Identify next pending task from TODO_LIST.md and repeat
312
+
313
+ **Note**: TODO_LIST.md updates are handled by agents (e.g., code-developer.md), not by the orchestrator.
314
+
315
+
316
+ ### Phase 5: Completion
317
+ **Applies to**: Both normal and resume modes
318
+
319
+ **Process**:
320
+ 1. **Update Task Status**: Mark completed tasks in JSON files
321
+ 2. **Generate Summary**: Create task summary in `.summaries/`
322
+ 3. **Update TodoWrite**: Mark current task complete, advance to next
323
+ 4. **Synchronize State**: Update session state and workflow status
324
+ 5. **Check Workflow Complete**: Verify all tasks are completed
325
+ 6. **User Choice**: When all tasks finished, ask user to choose next step:
326
+
327
+ ```javascript
328
+ // Parse --yes flag
329
+ // ★ 统一 auto mode 检测:-y/--yes 从 $ARGUMENTS 或 ccw 传播
330
+ const autoYes = /\b(-y|--yes)\b/.test($ARGUMENTS)
331
+
332
+ if (autoYes) {
333
+ // Auto mode: Complete session automatically
334
+ console.log(`[--yes] Auto-selecting: Complete Session`)
335
+ Skill(skill="workflow:session:complete", args="--yes")
336
+ } else {
337
+ // Interactive mode: Ask user
338
+ AskUserQuestion({
339
+ questions: [{
340
+ question: "All tasks completed. What would you like to do next?",
341
+ header: "Next Step",
342
+ multiSelect: false,
343
+ options: [
344
+ {
345
+ label: "Enter Review",
346
+ description: "Run specialized review (security/architecture/quality/action-items)"
347
+ },
348
+ {
349
+ label: "Complete Session",
350
+ description: "Archive session and update manifest"
351
+ }
352
+ ]
353
+ }]
354
+ })
355
+ }
356
+ ```
357
+
358
+ **Based on user selection**:
359
+ - **"Enter Review"**: Execute Phase 6 → `Ref: phases/06-review.md`
360
+ - **"Complete Session"**: Execute `/workflow:session:complete`
361
+
362
+ ### Post-Completion Expansion
363
+
364
+ **Auto-sync**: 执行 `/workflow:session:sync -y "{summary}"` 更新 specs/*.md + project-tech。
365
+
366
+ 完成后询问用户是否扩展为issue(test/enhance/refactor/doc),选中项调用 `/issue:new "{summary} - {dimension}"`
367
+
368
+ ## Execution Strategy (IMPL_PLAN-Driven)
369
+
370
+ ### Strategy Priority
371
+
372
+ **IMPL_PLAN-Driven Execution (Recommended)**:
373
+ 1. **Read IMPL_PLAN.md execution strategy** (Section 4: Implementation Strategy)
374
+ 2. **Follow explicit guidance**:
375
+ - Execution Model (Sequential/Parallel/Phased/TDD)
376
+ - Parallelization Opportunities (which tasks can run in parallel)
377
+ - Serialization Requirements (which tasks must run sequentially)
378
+ - Critical Path (priority execution order)
379
+ 3. **Use TODO_LIST.md for status tracking** only
380
+ 4. **IMPL_PLAN decides "HOW"**, workflow-execute implements it
381
+
382
+ **Intelligent Fallback (When IMPL_PLAN lacks execution details)**:
383
+ 1. **Analyze task structure**:
384
+ - Check `meta.execution_group` in task JSONs
385
+ - Analyze `depends_on` relationships
386
+ - Understand task complexity and risk
387
+ 2. **Apply smart defaults**:
388
+ - No dependencies + same execution_group → Parallel
389
+ - Has dependencies → Sequential (wait for deps)
390
+ - Critical/high-risk tasks → Sequential
391
+ 3. **Conservative approach**: When uncertain, prefer sequential execution
392
+
393
+ ### Execution Models
394
+
395
+ #### 1. Sequential Execution
396
+ **When**: IMPL_PLAN specifies "Sequential" OR no clear parallelization guidance
397
+ **Pattern**: Execute tasks one by one in TODO_LIST order
398
+ **TodoWrite**: ONE task marked as `in_progress` at a time
399
+
400
+ #### 2. Parallel Execution
401
+ **When**: IMPL_PLAN specifies "Parallel" with clear parallelization opportunities
402
+ **Pattern**: Execute independent task groups concurrently by launching multiple agent instances
403
+ **TodoWrite**: MULTIPLE tasks (in same batch) marked as `in_progress` simultaneously
404
+ **Agent Instantiation**: Launch one agent instance per task (respects ONE AGENT = ONE TASK JSON rule)
405
+
406
+ #### 3. Phased Execution
407
+ **When**: IMPL_PLAN specifies "Phased" with phase breakdown
408
+ **Pattern**: Execute tasks in phases, respect phase boundaries
409
+ **TodoWrite**: Within each phase, follow Sequential or Parallel rules
410
+
411
+ #### 4. Intelligent Fallback
412
+ **When**: IMPL_PLAN lacks execution strategy details
413
+ **Pattern**: Analyze task structure and apply smart defaults
414
+ **TodoWrite**: Follow Sequential or Parallel rules based on analysis
415
+
416
+ ### Task Status Logic
417
+ ```
418
+ pending + dependencies_met → executable
419
+ completed → skip
420
+ blocked → skip until dependencies clear
421
+ ```
422
+
423
+ ## TodoWrite Coordination
424
+
425
+ ### TodoWrite Rules (Unified)
426
+
427
+ **Rule 1: Initial Creation**
428
+ - **Normal Mode**: Generate TodoWrite from discovered pending tasks for entire workflow
429
+ - **Resume Mode**: Generate from existing session state and current progress
430
+
431
+ **Rule 2: In-Progress Task Count (Execution-Model-Dependent)**
432
+ - **Sequential execution**: Mark ONLY ONE task as `in_progress` at a time
433
+ - **Parallel batch execution**: Mark ALL tasks in current batch as `in_progress` simultaneously
434
+ - **Execution group indicator**: Show `[execution_group: group-id]` for parallel tasks
435
+
436
+ **Rule 3: Status Updates**
437
+ - **Immediate Updates**: Update status after each task/batch completion without user interruption
438
+ - **Status Synchronization**: Sync with JSON task files after updates
439
+ - **Continuous Tracking**: Maintain TodoWrite throughout entire workflow execution until completion
440
+
441
+ **Rule 4: Workflow Completion Check**
442
+ - When all tasks marked `completed`, prompt user to choose review or complete session
443
+
444
+ ### TodoWrite Tool Usage
445
+
446
+ **Example 1: Sequential Execution**
447
+ ```javascript
448
+ TodoWrite({
449
+ todos: [
450
+ {
451
+ content: "Execute IMPL-1.1: Design auth schema [code-developer] [FLOW_CONTROL]",
452
+ status: "in_progress", // ONE task in progress
453
+ activeForm: "Executing IMPL-1.1: Design auth schema"
454
+ },
455
+ {
456
+ content: "Execute IMPL-1.2: Implement auth logic [code-developer] [FLOW_CONTROL]",
457
+ status: "pending",
458
+ activeForm: "Executing IMPL-1.2: Implement auth logic"
459
+ }
460
+ ]
461
+ });
462
+ ```
463
+
464
+ **Example 2: Parallel Batch Execution**
465
+ ```javascript
466
+ TodoWrite({
467
+ todos: [
468
+ {
469
+ content: "Execute IMPL-1.1: Build Auth API [code-developer] [execution_group: parallel-auth-api]",
470
+ status: "in_progress", // Batch task 1
471
+ activeForm: "Executing IMPL-1.1: Build Auth API"
472
+ },
473
+ {
474
+ content: "Execute IMPL-1.2: Build User UI [code-developer] [execution_group: parallel-ui-comp]",
475
+ status: "in_progress", // Batch task 2 (running concurrently)
476
+ activeForm: "Executing IMPL-1.2: Build User UI"
477
+ },
478
+ {
479
+ content: "Execute IMPL-1.3: Setup Database [code-developer] [execution_group: parallel-db-schema]",
480
+ status: "in_progress", // Batch task 3 (running concurrently)
481
+ activeForm: "Executing IMPL-1.3: Setup Database"
482
+ },
483
+ {
484
+ content: "Execute IMPL-2.1: Integration Tests [test-fix-agent] [depends_on: IMPL-1.1, IMPL-1.2, IMPL-1.3]",
485
+ status: "pending", // Next batch (waits for current batch completion)
486
+ activeForm: "Executing IMPL-2.1: Integration Tests"
487
+ }
488
+ ]
489
+ });
490
+ ```
491
+
492
+ ## Agent Execution Pattern
493
+
494
+ ### Flow Control Execution
495
+ **[FLOW_CONTROL]** marker indicates task JSON contains `pre_analysis` steps for context preparation.
496
+
497
+ **Note**: Orchestrator does NOT execute flow control steps - Agent interprets and executes them autonomously.
498
+
499
+ ### Agent Prompt Template
500
+ **Path-Based Invocation**: Pass paths and trigger markers, let agent parse task JSON autonomously.
501
+
502
+ ```bash
503
+ Agent(subagent_type="{meta.agent}",
504
+ run_in_background=false,
505
+ prompt="Implement task {task.id}: {task.title}
506
+
507
+ [FLOW_CONTROL]
508
+
509
+ **Input**:
510
+ - Task JSON: {session.task_json_path}
511
+ - Context Package: {session.context_package_path}
512
+
513
+ **Output Location**:
514
+ - Workflow: {session.workflow_dir}
515
+ - TODO List: {session.todo_list_path}
516
+ - Summaries: {session.summaries_dir}
517
+
518
+ **Execution**: Read task JSON → Execute pre_analysis → Check execution_config.method → (CLI: handoff to CLI tool | Agent: direct implementation) → Update TODO_LIST.md → Generate summary",
519
+ description="Implement: {task.id}")
520
+ ```
521
+
522
+ **Key Markers**:
523
+ - `Implement` keyword: Triggers tech stack detection and guidelines loading
524
+ - `[FLOW_CONTROL]`: Triggers pre_analysis execution
525
+
526
+ **Why Path-Based**: Agent (code-developer.md) autonomously:
527
+ - Reads and parses task JSON (description, convergence, implementation, execution_config)
528
+ - Executes pre_analysis steps (Phase 1: context gathering)
529
+ - Checks execution_config.method (Phase 2: determine mode)
530
+ - CLI mode: Builds handoff prompt and executes via ccw cli with resume strategy
531
+ - Agent mode: Directly implements using modification_points and logic_flow
532
+ - Generates structured summary with integration points
533
+
534
+ Embedding task content in prompt creates duplication and conflicts with agent's parsing logic.
535
+
536
+ ### Agent Assignment Rules
537
+ ```
538
+ meta.agent specified → Use specified agent
539
+ meta.agent missing → Infer from meta.type:
540
+ - "feature" → @code-developer
541
+ - "test-gen" → @code-developer
542
+ - "test-fix" → @test-fix-agent
543
+ - "review" → @universal-executor
544
+ - "docs" → @doc-generator
545
+ ```
546
+
547
+ ## Phase Reference Documents
548
+
549
+ | Phase | Document | Purpose |
550
+ |-------|----------|---------|
551
+ | 6 | [phases/06-review.md](phases/06-review.md) | Post-implementation specialized review (security/architecture/quality/action-items) |
552
+
553
+ ## Workflow File Structure Reference
554
+ ```
555
+ .workflow/active/WFS-[topic-slug]/
556
+ ├── workflow-session.json # Session state and metadata
557
+ ├── plan.json # Structured plan overview (machine-readable)
558
+ ├── IMPL_PLAN.md # Planning document and requirements (human-readable)
559
+ ├── TODO_LIST.md # Progress tracking (updated by agents)
560
+ ├── .task/ # Task definitions (JSON only)
561
+ │ ├── IMPL-1.json # Main task definitions
562
+ │ └── IMPL-1.1.json # Subtask definitions
563
+ ├── .summaries/ # Task completion summaries
564
+ │ ├── IMPL-1-summary.md # Task completion details
565
+ │ └── IMPL-1.1-summary.md # Subtask completion details
566
+ └── .process/ # Planning artifacts
567
+ ├── context-package.json # Smart context package
568
+ └── ANALYSIS_RESULTS.md # Planning analysis results
569
+ ```
570
+
571
+ ## Error Handling & Recovery
572
+
573
+ ### Common Errors & Recovery
574
+
575
+ | Error Type | Cause | Recovery Strategy | Max Attempts |
576
+ |-----------|-------|------------------|--------------|
577
+ | **Discovery Errors** |
578
+ | No active session | No sessions in `.workflow/active/` | Create or resume session: `/workflow-plan "project"` | N/A |
579
+ | Multiple sessions | Multiple sessions in `.workflow/active/` | Prompt user selection | N/A |
580
+ | Corrupted session | Invalid JSON files | Recreate session structure or validate files | N/A |
581
+ | **Execution Errors** |
582
+ | Agent failure | Agent crash/timeout | Retry with simplified context | 2 |
583
+ | Flow control error | Command failure | Skip optional, fail critical | 1 per step |
584
+ | Context loading error | Missing dependencies | Reload from JSON, use defaults | 3 |
585
+ | JSON file corruption | File system issues | Restore from backup/recreate | 1 |
586
+
587
+ ### Error Prevention
588
+ - **Pre-flight Checks**: Validate session integrity before execution
589
+ - **Backup Strategy**: Create task snapshots before major operations
590
+ - **Atomic Updates**: Update JSON files atomically to prevent corruption
591
+ - **Dependency Validation**: Check all depends_on references exist
592
+ - **Context Verification**: Ensure all required context is available
593
+
594
+ ## Auto-Commit Mode (--with-commit)
595
+
596
+ **Behavior**: After each agent task completes, automatically commit changes based on summary document.
597
+
598
+ **Minimal Principle**: Only commit files modified by the completed task.
599
+
600
+ **Commit Message Format**: `{type}: {task-title} - {summary}`
601
+
602
+ **Type Mapping** (from `meta.type`):
603
+ - `feature` → `feat` | `bugfix` → `fix` | `refactor` → `refactor`
604
+ - `test-gen` → `test` | `docs` → `docs` | `review` → `chore`
605
+
606
+ **Implementation**:
607
+ ```bash
608
+ # 1. Read summary from .summaries/{task-id}-summary.md
609
+ # 2. Extract files from "Files Modified" section
610
+ # 3. Commit: git add <files> && git commit -m "{type}: {title} - {summary}"
611
+ ```
612
+
613
+ **Error Handling**: Skip commit on no changes/missing summary, log errors, continue workflow.
614
+
615
+ ## Related Skills
616
+
617
+ **Prerequisite Skills**:
618
+ - `workflow-plan` skill - Generate implementation plan and task JSONs
619
+
620
+ **Called During Execution**:
621
+ - `/workflow:session:complete` - Archive session after all tasks complete
622
+ - `review-cycle` skill - Post-implementation review
623
+
624
+ **Follow-up Skills**:
625
+ - `/issue:new` - Create follow-up issues (test/enhance/refactor/doc)