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,594 @@
1
+ # Phase 6: Interactive Replan
2
+
3
+ Interactive workflow replanning with session-level artifact updates and boundary clarification through guided questioning.
4
+
5
+ ## Objective
6
+
7
+ - Intelligently replan workflow sessions or individual tasks
8
+ - Interactive clarification to define modification boundaries
9
+ - Impact analysis with automatic detection of affected files and dependencies
10
+ - Backup management with restore capability
11
+ - Comprehensive artifact updates (IMPL_PLAN.md, TODO_LIST.md, task JSONs)
12
+
13
+ ## Entry Point
14
+
15
+ Triggered via Replan Mode routing in SKILL.md.
16
+
17
+ ## Input
18
+
19
+ Replan accepts requirements text as arguments. Session and mode preferences are provided via `workflowPreferences` context variables (set by SKILL.md via AskUserQuestion).
20
+
21
+ ```
22
+ Input: requirements text (positional argument)
23
+ Context: workflowPreferences.autoYes, workflowPreferences.interactive
24
+ Session: auto-detected from .workflow/active/ or specified via workflowPreferences.sessionId
25
+ ```
26
+
27
+ ### Task Replan Mode
28
+
29
+ ```text
30
+ # Direct task update
31
+ Replan input: IMPL-1 "requirements text"
32
+
33
+ # Interactive mode (workflowPreferences.interactive = true)
34
+ Replan input: IMPL-1 "requirements text"
35
+ ```
36
+
37
+ ## Language Convention
38
+
39
+ Interactive question options use Chinese (user-facing UI text) with English identifiers in parentheses. Structural content uses English. This is intentional for Chinese-language workflows.
40
+
41
+ ## Execution
42
+
43
+ ### Input Parsing
44
+
45
+ **Parse input**:
46
+ ```javascript
47
+ // Reference workflowPreferences (set by SKILL.md via AskUserQuestion)
48
+ const sessionFlag = workflowPreferences.sessionId
49
+ const interactive = workflowPreferences.interactive
50
+ const taskIdMatch = $ARGUMENTS.match(/\b(IMPL-\d+(?:\.\d+)?)\b/)
51
+ const taskId = taskIdMatch?.[1]
52
+ ```
53
+
54
+ ### Step 6.1: Mode Detection & Session Discovery
55
+
56
+ **Process**:
57
+ 1. **Detect Operation Mode**:
58
+ - Check if task ID provided (IMPL-N or IMPL-N.M format) → Task mode
59
+ - Otherwise → Session mode
60
+
61
+ 2. **Discover/Validate Session**:
62
+ - Use `--session` flag if provided
63
+ - Otherwise auto-detect from `.workflow/active/`
64
+ - Validate session exists
65
+
66
+ 3. **Load Session Context**:
67
+ - Read `workflow-session.json`
68
+ - List existing tasks
69
+ - Read `IMPL_PLAN.md` and `TODO_LIST.md`
70
+
71
+ 4. **Parse Execution Intent** (from requirements text):
72
+ ```javascript
73
+ // Dynamic tool detection from cli-tools.json
74
+ // Read enabled tools: ["gemini", "qwen", "codex", ...]
75
+ const enabledTools = loadEnabledToolsFromConfig(); // See ~/.claude/cli-tools.json
76
+
77
+ // Build dynamic patterns from enabled tools
78
+ function buildExecPatterns(tools) {
79
+ const patterns = {
80
+ agent: /改为\s*Agent\s*执行|使用\s*Agent\s*执行/i
81
+ };
82
+ tools.forEach(tool => {
83
+ // Pattern: "使用 {tool} 执行" or "改用 {tool}"
84
+ patterns[`cli_${tool}`] = new RegExp(
85
+ `使用\\s*(${tool})\\s*执行|改用\\s*(${tool})`, 'i'
86
+ );
87
+ });
88
+ return patterns;
89
+ }
90
+
91
+ const execPatterns = buildExecPatterns(enabledTools);
92
+
93
+ let executionIntent = null
94
+ for (const [key, pattern] of Object.entries(execPatterns)) {
95
+ if (pattern.test(requirements)) {
96
+ executionIntent = key.startsWith('cli_')
97
+ ? { method: 'cli', cli_tool: key.replace('cli_', '') }
98
+ : { method: 'agent', cli_tool: null }
99
+ break
100
+ }
101
+ }
102
+ ```
103
+
104
+ **Output**: Session validated, context loaded, mode determined, **executionIntent parsed**
105
+
106
+ ---
107
+
108
+ ### Auto Mode Support
109
+
110
+ When `workflowPreferences.autoYes === true`, the phase skips interactive clarification and uses safe defaults:
111
+
112
+ ```javascript
113
+ // Reference workflowPreferences (set by SKILL.md via AskUserQuestion)
114
+ const autoYes = workflowPreferences.autoYes
115
+ ```
116
+
117
+ **Auto Mode Defaults**:
118
+ - **Modification Scope**: `tasks_only` (safest - only update task details)
119
+ - **Affected Modules**: All modules related to the task
120
+ - **Task Changes**: `update_only` (no structural changes)
121
+ - **Dependency Changes**: `no` (preserve existing dependencies)
122
+ - **User Confirmation**: Auto-confirm execution
123
+
124
+ **Note**: `workflowPreferences.interactive` overrides `workflowPreferences.autoYes` (forces interactive mode).
125
+
126
+ ---
127
+
128
+ ### Step 6.2: Interactive Requirement Clarification
129
+
130
+ **Purpose**: Define modification scope through guided questioning
131
+
132
+ **Auto Mode Check**:
133
+ ```javascript
134
+ if (autoYes && !interactive) {
135
+ // Use defaults and skip to Step 6.3
136
+ console.log(`[Auto] Using safe defaults for replan:`)
137
+ console.log(` - Scope: tasks_only`)
138
+ console.log(` - Changes: update_only`)
139
+ console.log(` - Dependencies: preserve existing`)
140
+
141
+ userSelections = {
142
+ scope: 'tasks_only',
143
+ modules: 'all_affected',
144
+ task_changes: 'update_only',
145
+ dependency_changes: false
146
+ }
147
+ // Proceed to Step 6.3
148
+ }
149
+ ```
150
+
151
+ #### Session Mode Questions
152
+
153
+ **Q1: Modification Scope**
154
+ ```javascript
155
+ Options:
156
+ - 仅更新任务细节 (tasks_only)
157
+ - 修改规划方案 (plan_update)
158
+ - 重构任务结构 (task_restructure)
159
+ - 全面重规划 (comprehensive)
160
+ ```
161
+
162
+ **Q2: Affected Modules** (if scope >= plan_update)
163
+ ```javascript
164
+ Options: Dynamically generated from existing tasks' focus_paths
165
+ - 认证模块 (src/auth)
166
+ - 用户管理 (src/user)
167
+ - 全部模块
168
+ ```
169
+
170
+ **Q3: Task Changes** (if scope >= task_restructure)
171
+ ```javascript
172
+ Options:
173
+ - 添加/删除任务 (add_remove)
174
+ - 合并/拆分任务 (merge_split)
175
+ - 仅更新内容 (update_only)
176
+ // Note: Max 4 options for AskUserQuestion
177
+ ```
178
+
179
+ **Q4: Dependency Changes**
180
+ ```javascript
181
+ Options:
182
+ - 是,需要重新梳理依赖
183
+ - 否,保持现有依赖
184
+ ```
185
+
186
+ #### Task Mode Questions
187
+
188
+ **Q1: Update Type**
189
+ ```javascript
190
+ Options:
191
+ - 需求和验收标准 (requirements & acceptance)
192
+ - 实现方案 (implementation_approach)
193
+ - 文件范围 (focus_paths)
194
+ - 依赖关系 (depends_on)
195
+ - 全部更新
196
+ ```
197
+
198
+ **Q2: Ripple Effect**
199
+ ```javascript
200
+ Options:
201
+ - 是,需要同步更新依赖任务
202
+ - 否,仅影响当前任务
203
+ - 不确定,请帮我分析
204
+ ```
205
+
206
+ **Output**: User selections stored, modification boundaries defined
207
+
208
+ ---
209
+
210
+ ### Step 6.3: Impact Analysis & Planning
211
+
212
+ **Step 6.3.1: Analyze Required Changes**
213
+
214
+ Determine affected files based on clarification:
215
+
216
+ ```typescript
217
+ interface ImpactAnalysis {
218
+ affected_files: {
219
+ impl_plan: boolean;
220
+ todo_list: boolean;
221
+ session_meta: boolean;
222
+ tasks: string[];
223
+ };
224
+
225
+ operations: {
226
+ type: 'create' | 'update' | 'delete' | 'merge' | 'split';
227
+ target: string;
228
+ reason: string;
229
+ }[];
230
+
231
+ backup_strategy: {
232
+ timestamp: string;
233
+ files: string[];
234
+ };
235
+ }
236
+ ```
237
+
238
+ **Step 6.3.2: Generate Modification Plan**
239
+
240
+ ```markdown
241
+ ## Modification Plan
242
+
243
+ ### Impact Scope
244
+ - [ ] IMPL_PLAN.md: Update technical section 3
245
+ - [ ] TODO_LIST.md: Add 2 new tasks, delete 1 obsolete task
246
+ - [ ] IMPL-001.json: Update implementation approach
247
+ - [ ] workflow-session.json: Update task count
248
+
249
+ ### Change Operations
250
+ 1. **Create**: IMPL-004.json (2FA implementation)
251
+ 2. **Update**: IMPL-001.json (add 2FA preparation)
252
+ 3. **Delete**: IMPL-003.json (replaced by new approach)
253
+ ```
254
+
255
+ **Step 6.3.3: User Confirmation**
256
+
257
+ ```javascript
258
+ // Reference workflowPreferences (set by SKILL.md via AskUserQuestion)
259
+ const autoYes = workflowPreferences.autoYes
260
+
261
+ if (autoYes) {
262
+ // Auto mode: Auto-confirm execution
263
+ console.log(`[Auto] Auto-confirming replan execution`)
264
+ userConfirmation = 'confirm'
265
+ // Proceed to Step 6.4
266
+ } else {
267
+ // Interactive mode: Ask user
268
+ AskUserQuestion({
269
+ questions: [{
270
+ question: "Modification plan generated. Confirm action:",
271
+ header: "Confirm",
272
+ options: [
273
+ { label: "Confirm Execute", description: "Apply all modifications" },
274
+ { label: "Adjust Plan", description: "Re-answer questions to adjust scope" },
275
+ { label: "Cancel", description: "Abort this replan" }
276
+ ],
277
+ multiSelect: false
278
+ }]
279
+ })
280
+ }
281
+ ```
282
+
283
+ **Output**: Modification plan confirmed or adjusted
284
+
285
+ ---
286
+
287
+ ### Step 6.4: Backup Creation
288
+
289
+ **Process**:
290
+
291
+ 1. **Create Backup Directory**:
292
+ ```bash
293
+ timestamp=$(date -u +"%Y-%m-%dT%H-%M-%S")
294
+ backup_dir=".workflow/active/$SESSION_ID/.process/backup/replan-$timestamp"
295
+ mkdir -p "$backup_dir"
296
+ ```
297
+
298
+ 2. **Backup All Affected Files**:
299
+ - IMPL_PLAN.md
300
+ - TODO_LIST.md
301
+ - workflow-session.json
302
+ - Affected task JSONs
303
+
304
+ 3. **Create Backup Manifest**:
305
+ ```markdown
306
+ # Replan Backup Manifest
307
+
308
+ **Timestamp**: {timestamp}
309
+ **Reason**: {replan_reason}
310
+ **Scope**: {modification_scope}
311
+
312
+ ## Restoration Command
313
+ cp {backup_dir}/* .workflow/active/{session}/
314
+ ```
315
+
316
+ **Output**: All files safely backed up with manifest
317
+
318
+ ---
319
+
320
+ ### Step 6.5: Apply Modifications
321
+
322
+ **Step 6.5.1: Update IMPL_PLAN.md** (if needed)
323
+
324
+ Use Edit tool to modify specific sections:
325
+ - Update affected technical sections
326
+ - Update modification date
327
+
328
+ **Step 6.5.2: Update TODO_LIST.md** (if needed)
329
+
330
+ - Add new tasks with `[ ]` checkbox
331
+ - Mark deleted tasks as `[x] ~~task~~ (obsolete)`
332
+ - Update modified task descriptions
333
+
334
+ **Step 6.5.3: Update Task JSONs**
335
+
336
+ For each affected task:
337
+ ```typescript
338
+ const updated_task = {
339
+ ...task,
340
+ context: {
341
+ ...task.context,
342
+ requirements: [...updated_requirements],
343
+ acceptance: [...updated_acceptance]
344
+ },
345
+ flow_control: {
346
+ ...task.flow_control,
347
+ implementation_approach: [...updated_steps]
348
+ },
349
+ // Update execution config if intent detected
350
+ ...(executionIntent && {
351
+ meta: {
352
+ ...task.meta,
353
+ execution_config: {
354
+ method: executionIntent.method,
355
+ cli_tool: executionIntent.cli_tool,
356
+ enable_resume: executionIntent.method !== 'agent'
357
+ }
358
+ }
359
+ })
360
+ };
361
+
362
+ Write({
363
+ file_path: `.workflow/active/${SESSION_ID}/.task/${task_id}.json`,
364
+ content: JSON.stringify(updated_task, null, 2)
365
+ });
366
+ ```
367
+
368
+ **Note**: Implementation approach steps are NO LONGER modified. CLI execution is controlled by task-level `meta.execution_config` only.
369
+
370
+ **Step 6.5.4: Create New Tasks** (if needed)
371
+
372
+ Generate complete task JSON with all required fields:
373
+ - id, title, status
374
+ - meta (type, agent)
375
+ - context (requirements, focus_paths, acceptance)
376
+ - flow_control (pre_analysis, implementation_approach, target_files)
377
+
378
+ **Step 6.5.5: Delete Obsolete Tasks** (if needed)
379
+
380
+ Move to backup instead of hard delete:
381
+ ```bash
382
+ mv ".workflow/active/$SESSION_ID/.task/{task-id}.json" "$backup_dir/"
383
+ ```
384
+
385
+ **Step 6.5.6: Update Session Metadata**
386
+
387
+ Update workflow-session.json:
388
+ - progress.current_tasks
389
+ - progress.last_replan
390
+ - replan_history array
391
+
392
+ **Output**: All modifications applied, artifacts updated
393
+
394
+ ---
395
+
396
+ ### Step 6.6: Verification & Summary
397
+
398
+ **Step 6.6.1: Verify Consistency**
399
+
400
+ 1. Validate all task JSONs are valid JSON
401
+ 2. Check task count within limits (max 10)
402
+ 3. Verify dependency graph is acyclic
403
+
404
+ **Step 6.6.2: Generate Change Summary**
405
+
406
+ ```markdown
407
+ ## Replan Complete
408
+
409
+ ### Session Info
410
+ - **Session**: {session-id}
411
+ - **Timestamp**: {timestamp}
412
+ - **Backup**: {backup-path}
413
+
414
+ ### Change Summary
415
+ **Scope**: {scope}
416
+ **Reason**: {reason}
417
+
418
+ ### Modified Files
419
+ - IMPL_PLAN.md: {changes}
420
+ - TODO_LIST.md: {changes}
421
+ - Task JSONs: {count} files updated
422
+
423
+ ### Task Changes
424
+ - **Added**: {task-ids}
425
+ - **Deleted**: {task-ids}
426
+ - **Updated**: {task-ids}
427
+
428
+ ### Rollback
429
+ cp {backup-path}/* .workflow/active/{session}/
430
+ ```
431
+
432
+ **Output**: Summary displayed, replan complete
433
+
434
+ ## TodoWrite Progress Tracking
435
+
436
+ ### Session Mode Progress
437
+
438
+ ```json
439
+ [
440
+ {"content": "Mode detection and session discovery", "status": "completed", "activeForm": "Detecting mode and discovering session"},
441
+ {"content": "Interactive requirement clarification", "status": "completed", "activeForm": "Clarifying requirements interactively"},
442
+ {"content": "Impact analysis and plan generation", "status": "completed", "activeForm": "Analyzing impact and generating plan"},
443
+ {"content": "Backup creation", "status": "completed", "activeForm": "Creating backup"},
444
+ {"content": "Apply modifications to artifacts", "status": "completed", "activeForm": "Applying modifications"},
445
+ {"content": "Verify consistency", "status": "completed", "activeForm": "Verifying consistency"}
446
+ ]
447
+ ```
448
+
449
+ ### Task Mode Progress
450
+
451
+ ```json
452
+ [
453
+ {"content": "Detect session and load task", "status": "completed", "activeForm": "Detecting session and loading task"},
454
+ {"content": "Interactive update confirmation", "status": "completed", "activeForm": "Confirming update interactively"},
455
+ {"content": "Apply task modifications", "status": "completed", "activeForm": "Applying task modifications"}
456
+ ]
457
+ ```
458
+
459
+ ## Error Handling
460
+
461
+ ### Session Errors
462
+
463
+ ```bash
464
+ # No active session found
465
+ ERROR: No active session found
466
+ Run /workflow:session:start to create a session
467
+
468
+ # Session not found
469
+ ERROR: Session WFS-invalid not found
470
+ Available sessions: [list]
471
+
472
+ # No changes specified
473
+ WARNING: No modifications specified
474
+ Provide requirements text or use interactive mode
475
+ ```
476
+
477
+ ### Task Errors
478
+
479
+ ```bash
480
+ # Task not found
481
+ ERROR: Task IMPL-999 not found in session
482
+ Available tasks: [list]
483
+
484
+ # Task completed
485
+ WARNING: Task IMPL-001 is completed
486
+ Consider creating new task for additional work
487
+
488
+ # Circular dependency
489
+ ERROR: Circular dependency detected
490
+ Resolve dependency conflicts before proceeding
491
+ ```
492
+
493
+ ### Validation Errors
494
+
495
+ ```bash
496
+ # Task limit exceeded
497
+ ERROR: Replan would create 12 tasks (limit: 10)
498
+ Consider: combining tasks, splitting sessions, or removing tasks
499
+
500
+ # Invalid JSON
501
+ ERROR: Generated invalid JSON
502
+ Backup preserved, rolling back changes
503
+ ```
504
+
505
+ ## File Structure
506
+
507
+ ```
508
+ .workflow/active/WFS-session-name/
509
+ ├── workflow-session.json
510
+ ├── IMPL_PLAN.md
511
+ ├── TODO_LIST.md
512
+ ├── .task/
513
+ │ ├── IMPL-001.json
514
+ │ ├── IMPL-002.json
515
+ │ └── IMPL-003.json
516
+ └── .process/
517
+ ├── context-package.json
518
+ └── backup/
519
+ └── replan-{timestamp}/
520
+ ├── MANIFEST.md
521
+ ├── IMPL_PLAN.md
522
+ ├── TODO_LIST.md
523
+ ├── workflow-session.json
524
+ └── IMPL-*.json
525
+ ```
526
+
527
+ ## Examples
528
+
529
+ ### Session Replan - Add Feature
530
+
531
+ ```
532
+ Replan input: "Add 2FA support"
533
+
534
+ # Interactive clarification
535
+ Q: Modification scope?
536
+ A: Comprehensive replan
537
+
538
+ Q: Affected modules?
539
+ A: Auth module, API endpoints
540
+
541
+ Q: Task changes?
542
+ A: Add new tasks, update content
543
+
544
+ # Execution
545
+ Backup created
546
+ IMPL_PLAN.md updated
547
+ TODO_LIST.md updated
548
+ IMPL-004.json created
549
+ IMPL-001.json, IMPL-002.json updated
550
+
551
+ Replan complete! Added 1 task, updated 2 tasks
552
+ ```
553
+
554
+ ### Task Replan - Update Requirements
555
+
556
+ ```bash
557
+ /workflow:replan IMPL-002 "Update acceptance criteria to include rate limiting"
558
+
559
+ # Interactive clarification
560
+ Q: Update type?
561
+ A: Requirements and acceptance criteria
562
+
563
+ Q: Ripple effect?
564
+ A: Yes, sync dependent tasks
565
+
566
+ # Execution
567
+ Backup created
568
+ IMPL-002.json updated
569
+ - context.requirements updated
570
+ - context.acceptance updated
571
+ IMPL-003.json updated (dependent task synced)
572
+
573
+ Task requirements updated with ripple effect applied
574
+ ```
575
+
576
+ ### Task Replan - Change Execution Method
577
+
578
+ ```bash
579
+ /workflow:replan IMPL-001 "Use Codex for execution"
580
+
581
+ # Semantic parsing detects executionIntent:
582
+ # { method: 'cli', cli_tool: 'codex' }
583
+
584
+ # Execution (no interactive questions needed)
585
+ Backup created
586
+ IMPL-001.json updated
587
+ - meta.execution_config = { method: 'cli', cli_tool: 'codex', enable_resume: true }
588
+
589
+ Task execution method updated: Agent → CLI (codex)
590
+ ```
591
+
592
+ ## Completion
593
+
594
+ Phase 6 is a terminal phase. Replan complete with backup and summary.