claude-code-workflow 7.2.30 → 7.3.0

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 (183) hide show
  1. package/.claude/commands/workflow-skill.md +130 -0
  2. package/.claude/skills/ccw-chain/SKILL.md +44 -71
  3. package/.claude/skills/ccw-chain/chains/ccw-cycle.json +13 -3
  4. package/.claude/skills/ccw-chain/chains/ccw-exploration.json +33 -22
  5. package/.claude/skills/ccw-chain/chains/ccw-issue.json +23 -12
  6. package/.claude/skills/ccw-chain/chains/ccw-lightweight.json +23 -9
  7. package/.claude/skills/ccw-chain/chains/ccw-main.json +15 -2
  8. package/.claude/skills/ccw-chain/chains/ccw-standard.json +28 -16
  9. package/.claude/skills/ccw-chain/chains/ccw-team.json +7 -2
  10. package/.claude/skills/ccw-chain/chains/ccw-with-file.json +25 -9
  11. package/.claude/skills/chain-loader/phases/01-analyze-skill.md +53 -53
  12. package/.claude/skills/chain-loader/specs/chain-schema.md +30 -3
  13. package/.claude/skills/chain-loader/templates/chain-json.md +63 -63
  14. package/.claude/skills/workflow-plan/SKILL.md +1 -0
  15. package/.claude/skills/workflow-plan/phases/01-session-discovery.md +19 -2
  16. package/.claude/skills/workflow-plan/phases/02-context-gathering.md +2 -2
  17. package/.claude/skills/workflow-plan/phases/04-task-generation.md +9 -1
  18. package/.codex/skills/analyze-with-file/SKILL.md +383 -134
  19. package/.codex/skills/brainstorm/SKILL.md +3 -3
  20. package/.codex/skills/brainstorm-with-file/SKILL.md +208 -88
  21. package/.codex/skills/clean/SKILL.md +1 -1
  22. package/.codex/skills/csv-wave-pipeline/SKILL.md +2 -2
  23. package/.codex/skills/investigate/orchestrator.md +24 -0
  24. package/.codex/skills/issue-discover/SKILL.md +374 -361
  25. package/.codex/skills/issue-discover/phases/01-issue-new.md +1 -1
  26. package/.codex/skills/issue-discover/phases/02-discover.md +2 -2
  27. package/.codex/skills/issue-discover/phases/03-discover-by-prompt.md +1 -1
  28. package/.codex/skills/issue-discover/phases/04-quick-execute.md +2 -2
  29. package/.codex/skills/parallel-dev-cycle/SKILL.md +44 -37
  30. package/.codex/skills/project-documentation-workflow/SKILL.md +1 -1
  31. package/.codex/skills/review-cycle/SKILL.md +31 -12
  32. package/.codex/skills/roadmap-with-file/SKILL.md +141 -133
  33. package/.codex/skills/security-audit/orchestrator.md +29 -0
  34. package/.codex/skills/session-sync/SKILL.md +1 -1
  35. package/.codex/skills/ship/orchestrator.md +24 -0
  36. package/.codex/skills/spec-add/SKILL.md +5 -5
  37. package/.codex/skills/spec-generator/SKILL.md +33 -2
  38. package/.codex/skills/spec-generator/phases/01-5-requirement-clarification.md +3 -3
  39. package/.codex/skills/spec-generator/phases/01-discovery.md +1 -1
  40. package/.codex/skills/spec-generator/phases/02-product-brief.md +1 -1
  41. package/.codex/skills/spec-generator/phases/03-requirements.md +1 -1
  42. package/.codex/skills/spec-generator/phases/04-architecture.md +1 -1
  43. package/.codex/skills/spec-generator/phases/05-epics-stories.md +1 -1
  44. package/.codex/skills/spec-generator/phases/06-readiness-check.md +1 -1
  45. package/.codex/skills/spec-generator/phases/07-issue-export.md +1 -1
  46. package/.codex/skills/spec-setup/SKILL.md +669 -669
  47. package/.codex/skills/team-arch-opt/specs/team-config.json +1 -1
  48. package/.codex/skills/team-brainstorm/SKILL.md +259 -259
  49. package/.codex/skills/team-coordinate/SKILL.md +359 -359
  50. package/.codex/skills/team-coordinate/roles/coordinator/commands/monitor.md +1 -1
  51. package/.codex/skills/team-designer/SKILL.md +27 -1
  52. package/.codex/skills/team-designer/phases/01-requirements-analysis.md +2 -2
  53. package/.codex/skills/team-designer/phases/02-scaffold-generation.md +1 -1
  54. package/.codex/skills/team-designer/phases/04-validation.md +1 -1
  55. package/.codex/skills/team-executor/SKILL.md +218 -218
  56. package/.codex/skills/team-frontend/SKILL.md +227 -227
  57. package/.codex/skills/team-frontend-debug/SKILL.md +278 -278
  58. package/.codex/skills/team-frontend-debug/roles/coordinator/commands/analyze.md +2 -2
  59. package/.codex/skills/team-interactive-craft/SKILL.md +220 -220
  60. package/.codex/skills/team-interactive-craft/roles/coordinator/role.md +209 -209
  61. package/.codex/skills/team-issue/SKILL.md +269 -269
  62. package/.codex/skills/team-issue/roles/coordinator/role.md +1 -1
  63. package/.codex/skills/team-lifecycle-v4/SKILL.md +305 -305
  64. package/.codex/skills/team-motion-design/SKILL.md +222 -222
  65. package/.codex/skills/team-motion-design/roles/coordinator/role.md +210 -210
  66. package/.codex/skills/team-perf-opt/SKILL.md +258 -258
  67. package/.codex/skills/team-perf-opt/specs/team-config.json +1 -1
  68. package/.codex/skills/team-planex/SKILL.md +216 -216
  69. package/.codex/skills/team-quality-assurance/SKILL.md +229 -229
  70. package/.codex/skills/team-review/SKILL.md +227 -227
  71. package/.codex/skills/team-roadmap-dev/SKILL.md +238 -238
  72. package/.codex/skills/team-roadmap-dev/roles/coordinator/commands/roadmap-discuss.md +5 -5
  73. package/.codex/skills/team-tech-debt/SKILL.md +206 -206
  74. package/.codex/skills/team-tech-debt/roles/coordinator/commands/monitor.md +1 -1
  75. package/.codex/skills/team-testing/SKILL.md +237 -237
  76. package/.codex/skills/team-ui-polish/SKILL.md +218 -218
  77. package/.codex/skills/team-ui-polish/roles/coordinator/role.md +213 -213
  78. package/.codex/skills/team-uidesign/SKILL.md +219 -219
  79. package/.codex/skills/team-uidesign/roles/coordinator/role.md +2 -2
  80. package/.codex/skills/team-ultra-analyze/SKILL.md +260 -260
  81. package/.codex/skills/team-ultra-analyze/roles/coordinator/commands/monitor.md +1 -1
  82. package/.codex/skills/team-ultra-analyze/roles/coordinator/role.md +1 -1
  83. package/.codex/skills/team-ux-improve/SKILL.md +227 -227
  84. package/.codex/skills/team-ux-improve/roles/coordinator/role.md +1 -1
  85. package/.codex/skills/team-ux-improve/specs/team-config.json +1 -1
  86. package/.codex/skills/team-visual-a11y/SKILL.md +319 -319
  87. package/.codex/skills/team-visual-a11y/roles/coordinator/role.md +213 -213
  88. package/.codex/skills/workflow-execute/SKILL.md +5 -5
  89. package/.codex/skills/workflow-lite-planex/SKILL.md +3 -3
  90. package/.codex/skills/workflow-plan/SKILL.md +3 -3
  91. package/.codex/skills/workflow-tdd-plan/SKILL.md +4 -4
  92. package/.codex/skills/workflow-test-fix-cycle/SKILL.md +403 -402
  93. package/ccw/dist/cli.d.ts.map +1 -1
  94. package/ccw/dist/cli.js +16 -0
  95. package/ccw/dist/cli.js.map +1 -1
  96. package/ccw/dist/commands/chain-loader.d.ts +2 -0
  97. package/ccw/dist/commands/chain-loader.d.ts.map +1 -0
  98. package/ccw/dist/commands/chain-loader.js +11 -0
  99. package/ccw/dist/commands/chain-loader.js.map +1 -0
  100. package/ccw/dist/commands/install.d.ts.map +1 -1
  101. package/ccw/dist/commands/install.js +52 -1
  102. package/ccw/dist/commands/install.js.map +1 -1
  103. package/ccw/dist/commands/launcher.d.ts +2 -0
  104. package/ccw/dist/commands/launcher.d.ts.map +1 -0
  105. package/ccw/dist/commands/launcher.js +434 -0
  106. package/ccw/dist/commands/launcher.js.map +1 -0
  107. package/ccw/dist/tools/chain-loader.d.ts.map +1 -1
  108. package/ccw/dist/tools/chain-loader.js +457 -45
  109. package/ccw/dist/tools/chain-loader.js.map +1 -1
  110. package/ccw/dist/tools/skill-context-loader.d.ts.map +1 -1
  111. package/ccw/dist/tools/skill-context-loader.js +12 -26
  112. package/ccw/dist/tools/skill-context-loader.js.map +1 -1
  113. package/ccw/dist/types/chain-types.d.ts +41 -1
  114. package/ccw/dist/types/chain-types.d.ts.map +1 -1
  115. package/ccw/dist/utils/chain-visualizer.d.ts +13 -0
  116. package/ccw/dist/utils/chain-visualizer.d.ts.map +1 -0
  117. package/ccw/dist/utils/chain-visualizer.js +164 -0
  118. package/ccw/dist/utils/chain-visualizer.js.map +1 -0
  119. package/package.json +1 -1
  120. package/.claude/commands/cli/cli-init.md +0 -441
  121. package/.claude/commands/cli/codex-review.md +0 -361
  122. package/.claude/commands/flow-create.md +0 -663
  123. package/.claude/skills/ccw-chain/phases/analyze-with-file.md +0 -788
  124. package/.claude/skills/ccw-chain/phases/brainstorm/SKILL.md +0 -408
  125. package/.claude/skills/ccw-chain/phases/brainstorm/phases/01-mode-routing.md +0 -207
  126. package/.claude/skills/ccw-chain/phases/brainstorm/phases/02-artifacts.md +0 -567
  127. package/.claude/skills/ccw-chain/phases/brainstorm/phases/03-role-analysis.md +0 -748
  128. package/.claude/skills/ccw-chain/phases/brainstorm/phases/04-synthesis.md +0 -827
  129. package/.claude/skills/ccw-chain/phases/brainstorm-with-file.md +0 -482
  130. package/.claude/skills/ccw-chain/phases/collaborative-plan-with-file.md +0 -639
  131. package/.claude/skills/ccw-chain/phases/debug-with-file.md +0 -656
  132. package/.claude/skills/ccw-chain/phases/integration-test-cycle.md +0 -936
  133. package/.claude/skills/ccw-chain/phases/issue-convert-to-plan.md +0 -720
  134. package/.claude/skills/ccw-chain/phases/issue-discover.md +0 -483
  135. package/.claude/skills/ccw-chain/phases/issue-execute.md +0 -629
  136. package/.claude/skills/ccw-chain/phases/issue-from-brainstorm.md +0 -382
  137. package/.claude/skills/ccw-chain/phases/issue-plan.md +0 -343
  138. package/.claude/skills/ccw-chain/phases/issue-queue.md +0 -464
  139. package/.claude/skills/ccw-chain/phases/refactor-cycle.md +0 -852
  140. package/.claude/skills/ccw-chain/phases/review-cycle/SKILL.md +0 -132
  141. package/.claude/skills/ccw-chain/phases/review-cycle/phases/review-fix.md +0 -760
  142. package/.claude/skills/ccw-chain/phases/review-cycle/phases/review-module.md +0 -764
  143. package/.claude/skills/ccw-chain/phases/review-cycle/phases/review-session.md +0 -775
  144. package/.claude/skills/ccw-chain/phases/roadmap-with-file.md +0 -544
  145. package/.claude/skills/ccw-chain/phases/spec-generator/SKILL.md +0 -338
  146. package/.claude/skills/ccw-chain/phases/spec-generator/phases/01-5-requirement-clarification.md +0 -404
  147. package/.claude/skills/ccw-chain/phases/spec-generator/phases/01-discovery.md +0 -257
  148. package/.claude/skills/ccw-chain/phases/spec-generator/phases/02-product-brief.md +0 -274
  149. package/.claude/skills/ccw-chain/phases/spec-generator/phases/03-requirements.md +0 -184
  150. package/.claude/skills/ccw-chain/phases/spec-generator/phases/04-architecture.md +0 -248
  151. package/.claude/skills/ccw-chain/phases/spec-generator/phases/05-epics-stories.md +0 -178
  152. package/.claude/skills/ccw-chain/phases/spec-generator/phases/06-5-auto-fix.md +0 -144
  153. package/.claude/skills/ccw-chain/phases/spec-generator/phases/06-readiness-check.md +0 -480
  154. package/.claude/skills/ccw-chain/phases/team-planex.md +0 -123
  155. package/.claude/skills/ccw-chain/phases/ui-design-explore-auto.md +0 -678
  156. package/.claude/skills/ccw-chain/phases/unified-execute-with-file.md +0 -870
  157. package/.claude/skills/ccw-chain/phases/workflow-execute/SKILL.md +0 -625
  158. package/.claude/skills/ccw-chain/phases/workflow-execute/phases/06-review.md +0 -215
  159. package/.claude/skills/ccw-chain/phases/workflow-lite-plan.md +0 -616
  160. package/.claude/skills/ccw-chain/phases/workflow-multi-cli-plan.md +0 -424
  161. package/.claude/skills/ccw-chain/phases/workflow-plan/SKILL.md +0 -466
  162. package/.claude/skills/ccw-chain/phases/workflow-plan/phases/01-session-discovery.md +0 -99
  163. package/.claude/skills/ccw-chain/phases/workflow-plan/phases/02-context-gathering.md +0 -338
  164. package/.claude/skills/ccw-chain/phases/workflow-plan/phases/03-conflict-resolution.md +0 -422
  165. package/.claude/skills/ccw-chain/phases/workflow-plan/phases/04-task-generation.md +0 -440
  166. package/.claude/skills/ccw-chain/phases/workflow-plan/phases/05-plan-verify.md +0 -395
  167. package/.claude/skills/ccw-chain/phases/workflow-plan/phases/06-replan.md +0 -594
  168. package/.claude/skills/ccw-chain/phases/workflow-tdd-plan/SKILL.md +0 -527
  169. package/.claude/skills/ccw-chain/phases/workflow-tdd-plan/phases/01-session-discovery.md +0 -57
  170. package/.claude/skills/ccw-chain/phases/workflow-tdd-plan/phases/02-context-gathering.md +0 -407
  171. package/.claude/skills/ccw-chain/phases/workflow-tdd-plan/phases/03-test-coverage-analysis.md +0 -172
  172. package/.claude/skills/ccw-chain/phases/workflow-tdd-plan/phases/04-conflict-resolution.md +0 -426
  173. package/.claude/skills/ccw-chain/phases/workflow-tdd-plan/phases/05-tdd-task-generation.md +0 -473
  174. package/.claude/skills/ccw-chain/phases/workflow-tdd-plan/phases/06-tdd-structure-validation.md +0 -189
  175. package/.claude/skills/ccw-chain/phases/workflow-tdd-plan/phases/07-tdd-verify.md +0 -635
  176. package/.claude/skills/ccw-chain/phases/workflow-test-fix/SKILL.md +0 -482
  177. package/.claude/skills/ccw-chain/phases/workflow-test-fix/phases/01-session-start.md +0 -60
  178. package/.claude/skills/ccw-chain/phases/workflow-test-fix/phases/02-test-context-gather.md +0 -493
  179. package/.claude/skills/ccw-chain/phases/workflow-test-fix/phases/03-test-concept-enhanced.md +0 -150
  180. package/.claude/skills/ccw-chain/phases/workflow-test-fix/phases/04-test-task-generate.md +0 -346
  181. package/.claude/skills/ccw-chain/phases/workflow-test-fix/phases/05-test-cycle-execute.md +0 -538
  182. package/.claude/skills/ccw-chain/specs/intent-patterns.md +0 -60
  183. package/.claude/skills/team-edict.zip +0 -0
@@ -1,402 +1,403 @@
1
- ---
2
- name: workflow-test-fix-cycle
3
- description: "End-to-end test-fix workflow generate test sessions with progressive layers (L0-L3), then execute iterative fix cycles until pass rate >= 95%. Combines test-fix-gen and test-cycle-execute into a unified pipeline. Triggers on \"workflow:test-fix-cycle\"."
4
- allowed-tools: spawn_agent, wait_agent, send_message, assign_task, close_agent, request_user_input, Read, Write, Edit, Bash, Glob, Grep
5
- ---
6
-
7
- # Workflow Test-Fix Cycle
8
-
9
- End-to-end test-fix workflow pipeline: generate test sessions with progressive layers (L0-L3), AI code validation, and task generation (Phase 1), then execute iterative fix cycles with adaptive strategy engine until pass rate >= 95% (Phase 2).
10
-
11
- ## Architecture Overview
12
-
13
- ```
14
- ┌────────────────────────────────────────────────────────────────────────────┐
15
- │ Workflow Test-Fix Cycle Orchestrator (SKILL.md) │
16
- │ → Full pipeline: Test generation + Iterative execution │
17
- │ → Phase dispatch: Read phase docs, execute, pass context │
18
- └───────────────┬────────────────────────────────────────────────────────────┘
19
-
20
- ┌────────────┴────────────────────────┐
21
- ↓ ↓
22
- ┌─────────────────────────┐ ┌─────────────────────────────┐
23
- │ Phase 1: Test-Fix Gen │ │ Phase 2: Test-Cycle Execute │
24
- │ phases/01-test-fix-gen │ │ phases/02-test-cycle-execute │
25
- │ 5 sub-phases: │ │ 3 stages: │
26
- │ ① Create Session │ │ ① Discovery │
27
- │ ② Gather Context │ │ ② Main Loop (iterate) │
28
- │ ③ Test Analysis (Gemini)│ │ ③ Completion │
29
- │ ④ Generate Tasks │ │ │
30
- │ ⑤ Summary │ │ Agents (via spawn_agent): │
31
- │ │ │ @cli-planning-agent │
32
- │ Agents (via spawn_agent)│ │ @test-fix-agent │
33
- │ @test-context-search │ │ │
34
- │ @context-search │ │ Strategy: conservative → │
35
- │ @cli-execution │ │ aggressive → surgical │
36
- │ @action-planning │ │ │
37
- └────────┬────────────────┘ └────────────┬──────────────────┘
38
- ↓ ↓
39
- IMPL-001..002.json Pass Rate >= 95%
40
- TEST_ANALYSIS_RESULTS.md Auto-complete session
41
-
42
- Task Pipeline:
43
- ┌──────────────┐ ┌─────────────────┐ ┌─────────────────┐ ┌──────────────┐
44
- │ IMPL-001 │───→│ IMPL-001.3 │───→│ IMPL-001.5 │───→│ IMPL-002 │
45
- │ Test Gen │ │ Code Validate │ │ Quality Gate │ │ Test & Fix │
46
- │ L1-L3 │ │ L0 + AI Issues │ │ Coverage 80%+ │ │ Max 10 iter │
47
- │@code-developer│ │ @test-fix-agent │ │ @test-fix-agent │ │@test-fix-agent│
48
- └──────────────┘ └─────────────────┘ └─────────────────┘ └──────────────┘
49
-
50
- Fix Loop: │
51
- ┌──────────────────┘
52
-
53
- ┌──────────┐
54
- │ @cli-plan│───→ IMPL-fix-N.json
55
- │ agent │
56
- ├──────────┤
57
- │@test-fix │───→ Apply & re-test
58
- │ agent │
59
- └──────────┘
60
- ```
61
-
62
- ## Key Design Principles
63
-
64
- 1. **Two-Phase Pipeline**: Generation (Phase 1) creates session + tasks, Execution (Phase 2) runs iterative fix cycles
65
- 2. **Pure Orchestrator**: Dispatch to phase docs, parse outputs, pass context between phases
66
- 3. **Phase 1 Auto-Continue**: Sub-phases within Phase 1 run autonomously
67
- 4. **Subagent Lifecycle**: Explicit lifecycle management with spawn_agent → wait_agent → close_agent
68
- 5. **Progressive Test Layers**: L0 (Static) → L1 (Unit) → L2 (Integration) → L3 (E2E)
69
- 6. **AI Code Issue Detection**: Validates against common AI-generated code problems
70
- 7. **Intelligent Strategy Engine**: conservative → aggressive → surgical based on iteration context
71
- 8. **CLI Fallback Chain**: Gemini → Qwen → Codex for analysis resilience
72
- 9. **Progressive Testing**: Affected tests during iterations, full suite for final validation
73
- 10. **Role Path Loading**: Subagent roles loaded via path reference in MANDATORY FIRST STEPS
74
-
75
- ## Auto Mode
76
-
77
- Phase 1 generates test session and tasks. Phase 2 executes iterative fix cycles until pass rate >= 95% or max iterations reached. **Between Phase 1 and Phase 2, you MUST stop and wait for user confirmation before proceeding to execution.** Phase 2 runs autonomously once approved.
78
-
79
- ## Subagent API Reference
80
-
81
- ### spawn_agent
82
- Create a new subagent with task assignment.
83
-
84
- ```javascript
85
- const agentId = spawn_agent({
86
- agent_type: "{agent_type}",
87
- message: `
88
- ## TASK ASSIGNMENT
89
-
90
- ### MANDATORY FIRST STEPS (Agent Execute)
91
- 1. Run: `ccw spec load --category "planning execution"`
92
-
93
- ## TASK CONTEXT
94
- ${taskContext}
95
-
96
- ## DELIVERABLES
97
- ${deliverables}
98
- `
99
- })
100
- ```
101
-
102
- ### wait_agent
103
- Get results from subagent (only way to retrieve results).
104
-
105
- ```javascript
106
- const result = wait_agent({
107
- targets: [agentId],
108
- timeout_ms: 600000 // 10 minutes
109
- })
110
-
111
- if (result.timed_out) {
112
- // Handle timeout - can use assign_task to prompt completion
113
- }
114
- ```
115
-
116
- ### assign_task
117
- Assign new work to active subagent (for clarification or follow-up).
118
-
119
- ```javascript
120
- assign_task({
121
- target: agentId,
122
- items: [{ type: "text", text: `
123
- ## CLARIFICATION ANSWERS
124
- ${answers}
125
-
126
- ## NEXT STEP
127
- Continue with plan generation.
128
- ` }]
129
- })
130
- ```
131
-
132
- ### close_agent
133
- Clean up subagent resources (irreversible).
134
-
135
- ```javascript
136
- close_agent({ id: agentId })
137
- ```
138
-
139
- ## Usage
140
-
141
- ```
142
- workflow-test-fix-cycle <input> [options]
143
-
144
- # Input (Phase 1 - Test Generation)
145
- source-session-id WFS-* session ID (Session Mode - test validation for completed implementation)
146
- feature description Text description of what to test (Prompt Mode)
147
- /path/to/file.md Path to requirements file (Prompt Mode)
148
-
149
- # Options (Phase 2 - Cycle Execution)
150
- --max-iterations=N Custom iteration limit (default: 10)
151
-
152
- # Examples
153
- workflow-test-fix-cycle WFS-user-auth-v2 # Session Mode
154
- workflow-test-fix-cycle "Test the user authentication API endpoints in src/auth/api.ts" # Prompt Mode - text
155
- workflow-test-fix-cycle ./docs/api-requirements.md # Prompt Mode - file
156
- workflow-test-fix-cycle "Test user registration" --max-iterations=15 # With custom iterations
157
-
158
- # Resume (Phase 2 only - session already created)
159
- workflow-test-fix-cycle --resume-session="WFS-test-user-auth" # Resume interrupted session
160
- ```
161
-
162
- **Quality Gate**: Test pass rate >= 95% (criticality-aware) or 100%
163
- **Max Iterations**: 10 (default, adjustable)
164
- **CLI Tools**: Gemini → Qwen → Codex (fallback chain)
165
-
166
- ## Test Strategy Overview
167
-
168
- Progressive Test Layers (L0-L3):
169
-
170
- | Layer | Name | Focus |
171
- |-------|------|-------|
172
- | **L0** | Static Analysis | Compilation, imports, types, AI code issues |
173
- | **L1** | Unit Tests | Function/class behavior (happy/negative/edge cases) |
174
- | **L2** | Integration Tests | Component interactions, API contracts, failure modes |
175
- | **L3** | E2E Tests | User journeys, critical paths (optional) |
176
-
177
- **Key Features**:
178
- - **AI Code Issue Detection** - Validates against common AI-generated code problems (hallucinated imports, placeholder code, mock leakage, etc.)
179
- - **Project Type Detection** - Applies appropriate test templates (React, Node API, CLI, Library, etc.)
180
- - **Quality Gates** - IMPL-001.3 (code validation) and IMPL-001.5 (test quality) ensure high standards
181
-
182
- **Detailed specifications**: See the test-task-generate workflow tool for complete L0-L3 requirements and quality thresholds.
183
-
184
- ## Execution Flow
185
-
186
- ```
187
- Input → Detect Mode (session | prompt | resume)
188
-
189
- ├─ resume mode → Skip to Phase 2
190
-
191
- └─ session/prompt mode → Phase 1
192
-
193
- Phase 1: Test-Fix Generation (phases/01-test-fix-gen.md)
194
- ├─ Sub-phase 1.1: Create Test Session → testSessionId
195
- ├─ Sub-phase 1.2: Gather Test Context (spawn_agent) → contextPath
196
- ├─ Sub-phase 1.3: Test Generation Analysis (spawn_agent → Gemini) → TEST_ANALYSIS_RESULTS.md
197
- ├─ Sub-phase 1.4: Generate Test Tasks (spawn_agent) → IMPL-*.json, IMPL_PLAN.md, TODO_LIST.md
198
- └─ Sub-phase 1.5: Phase 1 Summary
199
-
200
- ⛔ MANDATORY CONFIRMATION GATE
201
- │ Present plan summary → request_user_input → User approves/cancels
202
- │ NEVER auto-proceed to Phase 2
203
-
204
- Phase 2: Test-Cycle Execution (phases/02-test-cycle-execute.md)
205
- ├─ Discovery: Load session, tasks, iteration state
206
- ├─ Main Loop (for each task):
207
- │ ├─ Execute → Test → Calculate pass_rate
208
- │ ├─ 100% → SUCCESS: Next task
209
- │ ├─ 95-99% + low criticality → PARTIAL SUCCESS: Approve
210
- │ └─ <95% → Fix Loop:
211
- │ ├─ Select strategy: conservative/aggressive/surgical
212
- │ ├─ spawn_agent(@cli-planning-agent) → IMPL-fix-N.json
213
- │ ├─ spawn_agent(@test-fix-agent) → Apply fix & re-test
214
- │ └─ Re-test → Back to decision
215
- └─ Completion: Final validation → Summary → Sync session state → Auto-complete session
216
- ```
217
-
218
- ## Core Rules
219
-
220
- 1. **Start Immediately**: First action is progress tracking initialization
221
- 2. **No Preliminary Analysis**: Do not read files before Phase 1
222
- 3. **Parse Every Output**: Extract data from each phase/sub-phase for the next
223
- 4. **Within-Phase Auto-Continue**: Sub-phases within a phase run automatically; Phase 2 iterations run automatically once started
224
- 5. **Phase Loading**: Read phase doc on-demand (`phases/01-*.md`, `phases/02-*.md`)
225
- 6. **Task Attachment Model**: Sub-tasks ATTACH → execute → COLLAPSE
226
- 7. **MANDATORY CONFIRMATION GATE**: After Phase 1 completes, you MUST stop and present the generated plan to the user. Wait for explicit user approval via request_user_input before starting Phase 2. NEVER auto-proceed from Phase 1 to Phase 2
227
- 8. **Phase 2 Continuous**: Once user approves, Phase 2 runs continuously until pass rate >= 95% or max iterations reached
228
- 9. **Explicit Lifecycle**: Always close_agent after wait_agent completes to free resources
229
-
230
- ## Phase Execution
231
-
232
- ### Phase 1: Test-Fix Generation
233
-
234
- **Read**: `phases/01-test-fix-gen.md`
235
-
236
- 5 sub-phases that create a test session and generate task JSONs:
237
- 1. Create Test Session → `testSessionId`
238
- 2. Gather Test Context (spawn_agent → wait_agent → close_agent) → `contextPath`
239
- 3. Test Generation Analysis (spawn_agent → wait_agent → close_agent) → `TEST_ANALYSIS_RESULTS.md`
240
- 4. Generate Test Tasks (spawn_agent → wait_agent → close_agent) → `IMPL-001.json`, `IMPL-001.3.json`, `IMPL-001.5.json`, `IMPL-002.json`, `IMPL_PLAN.md`, `TODO_LIST.md`
241
- 5. Phase 1 Summary → **⛔ MANDATORY: Present plan and wait for user confirmation before Phase 2**
242
-
243
- **Agents Used** (via spawn_agent):
244
- - `test_context_search_agent` (agent_type: test_context_search_agent) - Context gathering (Session Mode)
245
- - `context_search_agent` (agent_type: context_search_agent) - Context gathering (Prompt Mode)
246
- - `cli_execution_agent` (agent_type: cli_execution_agent) - Test analysis with Gemini
247
- - `action_planning_agent` (agent_type: action_planning_agent) - Task JSON generation
248
-
249
- ### Phase 2: Test-Cycle Execution
250
-
251
- **Read**: `phases/02-test-cycle-execute.md`
252
-
253
- 3-stage iterative execution with adaptive strategy:
254
- 1. Discovery - Load session, tasks, iteration state
255
- 2. Main Loop - Execute tasks → Test → Analyze failures → Fix → Re-test
256
- 3. Completion - Final validation → Summary → Auto-complete session
257
-
258
- **Agents Used** (via spawn_agent):
259
- - `cli_planning_agent` (agent_type: cli_planning_agent) - Failure analysis, root cause extraction, fix task generation
260
- - `test_fix_agent` (agent_type: test_fix_agent) - Test execution, code fixes, criticality assignment
261
-
262
- **Strategy Engine**: conservative (iteration 1-2) → aggressive (pass >80%) → surgical (regression)
263
-
264
- ## Output Artifacts
265
-
266
- ### Directory Structure
267
-
268
- ```
269
- {projectRoot}/.workflow/active/WFS-test-[session]/
270
- ├── workflow-session.json # Session metadata
271
- ├── IMPL_PLAN.md # Test generation and execution strategy
272
- ├── TODO_LIST.md # Task checklist
273
- ├── .task/
274
- │ ├── IMPL-001.json # Test understanding & generation
275
- │ ├── IMPL-001.3-validation.json # Code validation gate
276
- │ ├── IMPL-001.5-review.json # Test quality gate
277
- │ ├── IMPL-002.json # Test execution & fix cycle
278
- │ └── IMPL-fix-{N}.json # Generated fix tasks (Phase 2)
279
- ├── .process/
280
- │ ├── [test-]context-package.json # Context and coverage analysis
281
- │ ├── TEST_ANALYSIS_RESULTS.md # Test requirements and strategy (L0-L3)
282
- │ ├── iteration-state.json # Current iteration + strategy + stuck tests
283
- │ ├── test-results.json # Latest results (pass_rate, criticality)
284
- │ ├── test-output.log # Full test output
285
- │ ├── fix-history.json # All fix attempts
286
- │ ├── iteration-{N}-analysis.md # CLI analysis report
287
- │ └── iteration-{N}-cli-output.txt
288
- └── .summaries/iteration-summaries/
289
- ```
290
-
291
- ## Progress Tracking Pattern
292
-
293
- **Phase 1** (Generation):
294
- ```javascript
295
- [
296
- { content: "Phase 1: Test-Fix Generation", status: "in_progress" },
297
- { content: " 1.1 Create Test Session", status: "completed" },
298
- { content: " 1.2 Gather Test Context", status: "in_progress" },
299
- { content: " 1.3 Test Generation Analysis", status: "pending" },
300
- { content: " 1.4 Generate Test Tasks", status: "pending" },
301
- { content: " 1.5 Phase Summary", status: "pending" },
302
- { content: "Phase 2: Test-Cycle Execution", status: "pending" }
303
- ]
304
- ```
305
-
306
- **Phase 2** (Execution):
307
- ```javascript
308
- [
309
- { content: "Phase 1: Test-Fix Generation", status: "completed" },
310
- { content: "Phase 2: Test-Cycle Execution", status: "in_progress" },
311
- { content: " Execute IMPL-001: Generate tests [code-developer]", status: "completed" },
312
- { content: " Execute IMPL-002: Test & Fix Cycle [ITERATION]", status: "in_progress" },
313
- { content: " → Iteration 1: Initial test (pass: 70%, conservative)", status: "completed" },
314
- { content: " → Iteration 2: Fix validation (pass: 82%, conservative)", status: "completed" },
315
- { content: " → Iteration 3: Batch fix auth (pass: 89%, aggressive)", status: "in_progress" }
316
- ]
317
- ```
318
-
319
- **Update Rules**:
320
- - Phase 1: Attach/collapse sub-phase tasks within Phase 1
321
- - Phase 2: Add iteration items with strategy and pass rate
322
- - Mark completed after each phase/iteration
323
- - Update parent task when all complete
324
-
325
- ## Error Handling
326
-
327
- | Phase | Scenario | Action |
328
- |-------|----------|--------|
329
- | 1.1 | Source session not found (session mode) | Return error with session ID |
330
- | 1.1 | No completed IMPL tasks (session mode) | Return error, source incomplete |
331
- | 1.2 | Context gathering failed | Return error, check source artifacts |
332
- | 1.2 | Agent timeout | Retry with extended timeout, close_agent, then return error |
333
- | 1.3 | Gemini analysis failed | Return error, check context package |
334
- | 1.4 | Task generation failed | Retry once, then return error |
335
- | 2 | Test execution error | Log, retry with error context |
336
- | 2 | CLI analysis failure | Fallback: Gemini Qwen Codex → manual |
337
- | 2 | Agent execution error | Save state, close_agent, retry with simplified context |
338
- | 2 | Max iterations reached | Generate failure report, mark blocked |
339
- | 2 | Regression detected | Rollback last fix, switch to surgical strategy |
340
- | 2 | Stuck tests detected | Continue with alternative strategy, document in failure report |
341
-
342
- **Lifecycle Error Handling**:
343
- ```javascript
344
- try {
345
- const agentId = spawn_agent({ message: "..." });
346
- const result = wait_agent({ targets: [agentId], timeout_ms: 600000 });
347
- // ... process result ...
348
- close_agent({ id: agentId });
349
- } catch (error) {
350
- if (agentId) close_agent({ id: agentId });
351
- throw error;
352
- }
353
- ```
354
-
355
- ## Coordinator Checklist
356
-
357
- **Phase 1 (Generation)**:
358
- - Detect input type (session ID / description / file path / resume)
359
- - Initialize progress tracking with 2 top-level phases
360
- - Read `phases/01-test-fix-gen.md` for detailed sub-phase execution
361
- - Execute 5 sub-phases with spawn_agent wait_agent → close_agent lifecycle
362
- - Verify all Phase 1 outputs (4+ task JSONs, IMPL_PLAN.md, TODO_LIST.md)
363
- - **Ensure all agents are closed** after each sub-phase completes
364
- - **⛔ MANDATORY: Present plan summary and request_user_input for confirmation**
365
- - Show: session ID, task count, test layers, quality gates
366
- - Options: "Proceed to Execution" / "Review Plan" / "Cancel"
367
- - If "Cancel" return, do NOT start Phase 2
368
- - If "Review Plan" → display IMPL_PLAN.md, then return
369
- - Only proceed to Phase 2 if user selects "Proceed to Execution"
370
-
371
- **Phase 2 (Execution)**:
372
- - Read `phases/02-test-cycle-execute.md` for detailed execution logic
373
- - Load session state and task queue
374
- - Execute iterative test-fix cycles with spawn_agent → wait_agent → close_agent
375
- - Track iterations in progress tracking
376
- - Auto-complete session on success (pass rate >= 95%)
377
- - **Ensure all agents are closed** after each iteration
378
-
379
- **Resume Mode**:
380
- - If `--resume-session` provided, skip Phase 1
381
- - Load existing session directly into Phase 2
382
-
383
- ## Related Skills
384
-
385
- **Prerequisite Skills**:
386
- - `workflow-plan` or `workflow-execute` - Complete implementation (Session Mode)
387
- - None for Prompt Mode
388
-
389
- **Phase 1 Agents** (used by phases/01-test-fix-gen.md via spawn_agent):
390
- - `test_context_search_agent` (agent_type: test_context_search_agent) - Test coverage analysis (Session Mode)
391
- - `context_search_agent` (agent_type: context_search_agent) - Codebase analysis (Prompt Mode)
392
- - `cli_execution_agent` (agent_type: cli_execution_agent) - Test requirements with Gemini
393
- - `action_planning_agent` (agent_type: action_planning_agent) - Task JSON generation
394
-
395
- **Phase 2 Agents** (used by phases/02-test-cycle-execute.md via spawn_agent):
396
- - `cli_planning_agent` (agent_type: cli_planning_agent) - CLI analysis, root cause extraction, task generation
397
- - `test_fix_agent` (agent_type: test_fix_agent) - Test execution, code fixes, criticality assignment
398
-
399
- **Follow-up**:
400
- - Session sync: `$session-sync -y "Test-fix cycle complete: {pass_rate}% pass rate"`
401
- - Session auto-complete on success
402
- - Issue creation for follow-up work (post-completion expansion)
1
+ ---
2
+ name: workflow-test-fix-cycle
3
+ description: "End-to-end test-fix workflow generate test sessions with progressive layers (L0-L3), then execute iterative fix cycles until pass rate >= 95%. Combines test-fix-gen and test-cycle-execute into a unified pipeline. Triggers on \"workflow:test-fix-cycle\"."
4
+ allowed-tools: spawn_agent, wait_agent, send_message, assign_task, close_agent, request_user_input, Read, Write, Edit, Bash, Glob, Grep
5
+ ---
6
+
7
+ # Workflow Test-Fix Cycle
8
+
9
+ End-to-end test-fix workflow pipeline: generate test sessions with progressive layers (L0-L3), AI code validation, and task generation (Phase 1), then execute iterative fix cycles with adaptive strategy engine until pass rate >= 95% (Phase 2).
10
+
11
+ ## Architecture Overview
12
+
13
+ ```
14
+ ┌────────────────────────────────────────────────────────────────────────────┐
15
+ │ Workflow Test-Fix Cycle Orchestrator (SKILL.md) │
16
+ │ → Full pipeline: Test generation + Iterative execution │
17
+ │ → Phase dispatch: Read phase docs, execute, pass context │
18
+ └───────────────┬────────────────────────────────────────────────────────────┘
19
+
20
+ ┌────────────┴────────────────────────┐
21
+ ↓ ↓
22
+ ┌─────────────────────────┐ ┌─────────────────────────────┐
23
+ │ Phase 1: Test-Fix Gen │ │ Phase 2: Test-Cycle Execute │
24
+ │ phases/01-test-fix-gen │ │ phases/02-test-cycle-execute │
25
+ │ 5 sub-phases: │ │ 3 stages: │
26
+ │ ① Create Session │ │ ① Discovery │
27
+ │ ② Gather Context │ │ ② Main Loop (iterate) │
28
+ │ ③ Test Analysis (Gemini)│ │ ③ Completion │
29
+ │ ④ Generate Tasks │ │ │
30
+ │ ⑤ Summary │ │ Agents (via spawn_agent): │
31
+ │ │ │ @cli-planning-agent │
32
+ │ Agents (via spawn_agent)│ │ @test-fix-agent │
33
+ │ @test-context-search │ │ │
34
+ │ @context-search │ │ Strategy: conservative → │
35
+ │ @cli-execution │ │ aggressive → surgical │
36
+ │ @action-planning │ │ │
37
+ └────────┬────────────────┘ └────────────┬──────────────────┘
38
+ ↓ ↓
39
+ IMPL-001..002.json Pass Rate >= 95%
40
+ TEST_ANALYSIS_RESULTS.md Auto-complete session
41
+
42
+ Task Pipeline:
43
+ ┌──────────────┐ ┌─────────────────┐ ┌─────────────────┐ ┌──────────────┐
44
+ │ IMPL-001 │───→│ IMPL-001.3 │───→│ IMPL-001.5 │───→│ IMPL-002 │
45
+ │ Test Gen │ │ Code Validate │ │ Quality Gate │ │ Test & Fix │
46
+ │ L1-L3 │ │ L0 + AI Issues │ │ Coverage 80%+ │ │ Max 10 iter │
47
+ │@code-developer│ │ @test-fix-agent │ │ @test-fix-agent │ │@test-fix-agent│
48
+ └──────────────┘ └─────────────────┘ └─────────────────┘ └──────────────┘
49
+
50
+ Fix Loop: │
51
+ ┌──────────────────┘
52
+
53
+ ┌──────────┐
54
+ │ @cli-plan│───→ IMPL-fix-N.json
55
+ │ agent │
56
+ ├──────────┤
57
+ │@test-fix │───→ Apply & re-test
58
+ │ agent │
59
+ └──────────┘
60
+ ```
61
+
62
+ ## Key Design Principles
63
+
64
+ 1. **Two-Phase Pipeline**: Generation (Phase 1) creates session + tasks, Execution (Phase 2) runs iterative fix cycles
65
+ 2. **Pure Orchestrator**: Dispatch to phase docs, parse outputs, pass context between phases
66
+ 3. **Phase 1 Auto-Continue**: Sub-phases within Phase 1 run autonomously
67
+ 4. **Subagent Lifecycle**: Explicit lifecycle management with spawn_agent → wait_agent → close_agent
68
+ 5. **Progressive Test Layers**: L0 (Static) → L1 (Unit) → L2 (Integration) → L3 (E2E)
69
+ 6. **AI Code Issue Detection**: Validates against common AI-generated code problems
70
+ 7. **Intelligent Strategy Engine**: conservative → aggressive → surgical based on iteration context
71
+ 8. **CLI Fallback Chain**: Gemini → Qwen → Codex for analysis resilience
72
+ 9. **Progressive Testing**: Affected tests during iterations, full suite for final validation
73
+ 10. **Role Path Loading**: Subagent roles loaded via path reference in MANDATORY FIRST STEPS
74
+
75
+ ## Auto Mode
76
+
77
+ Phase 1 generates test session and tasks. Phase 2 executes iterative fix cycles until pass rate >= 95% or max iterations reached. **Between Phase 1 and Phase 2, you MUST stop and wait for user confirmation before proceeding to execution.** Phase 2 runs autonomously once approved.
78
+
79
+ ## Subagent API Reference
80
+
81
+ ### spawn_agent
82
+ Create a new subagent with task assignment.
83
+
84
+ ```javascript
85
+ const agentId = spawn_agent({
86
+ agent_type: "{agent_type}",
87
+ message: `
88
+ ## TASK ASSIGNMENT
89
+
90
+ ### MANDATORY FIRST STEPS (Agent Execute)
91
+ 1. Run: `ccw spec load --category "planning execution"`
92
+
93
+ ## TASK CONTEXT
94
+ ${taskContext}
95
+
96
+ ## DELIVERABLES
97
+ ${deliverables}
98
+ `
99
+ })
100
+ ```
101
+
102
+ ### wait_agent
103
+ Get results from subagent (only way to retrieve results).
104
+
105
+ ```javascript
106
+ const result = wait_agent({
107
+ targets: [agentId],
108
+ timeout_ms: 600000 // 10 minutes
109
+ })
110
+
111
+ if (result.timed_out) {
112
+ // Handle timeout - can use assign_task to prompt completion
113
+ }
114
+ ```
115
+
116
+ ### assign_task
117
+ Assign new work to active subagent (for clarification or follow-up).
118
+
119
+ ```javascript
120
+ assign_task({
121
+ target: agentId,
122
+ items: [{ type: "text", text: `
123
+ ## CLARIFICATION ANSWERS
124
+ ${answers}
125
+
126
+ ## NEXT STEP
127
+ Continue with plan generation.
128
+ ` }]
129
+ })
130
+ ```
131
+
132
+ ### close_agent
133
+ Clean up subagent resources (irreversible).
134
+
135
+ ```javascript
136
+ close_agent({ id: agentId })
137
+ ```
138
+
139
+ ## Usage
140
+
141
+ ```
142
+ workflow-test-fix-cycle <input> [options]
143
+
144
+ # Input (Phase 1 - Test Generation)
145
+ source-session-id WFS-* session ID (Session Mode - test validation for completed implementation)
146
+ feature description Text description of what to test (Prompt Mode)
147
+ /path/to/file.md Path to requirements file (Prompt Mode)
148
+
149
+ # Options (Phase 2 - Cycle Execution)
150
+ --max-iterations=N Custom iteration limit (default: 10)
151
+
152
+ # Examples
153
+ workflow-test-fix-cycle WFS-user-auth-v2 # Session Mode
154
+ workflow-test-fix-cycle "Test the user authentication API endpoints in src/auth/api.ts" # Prompt Mode - text
155
+ workflow-test-fix-cycle ./docs/api-requirements.md # Prompt Mode - file
156
+ workflow-test-fix-cycle "Test user registration" --max-iterations=15 # With custom iterations
157
+
158
+ # Resume (Phase 2 only - session already created)
159
+ workflow-test-fix-cycle --resume-session="WFS-test-user-auth" # Resume interrupted session
160
+ ```
161
+
162
+ **Quality Gate**: Test pass rate >= 95% (criticality-aware) or 100%
163
+ **Max Iterations**: 10 (default, adjustable)
164
+ **CLI Tools**: Gemini → Qwen → Codex (fallback chain)
165
+
166
+ ## Test Strategy Overview
167
+
168
+ Progressive Test Layers (L0-L3):
169
+
170
+ | Layer | Name | Focus |
171
+ |-------|------|-------|
172
+ | **L0** | Static Analysis | Compilation, imports, types, AI code issues |
173
+ | **L1** | Unit Tests | Function/class behavior (happy/negative/edge cases) |
174
+ | **L2** | Integration Tests | Component interactions, API contracts, failure modes |
175
+ | **L3** | E2E Tests | User journeys, critical paths (optional) |
176
+
177
+ **Key Features**:
178
+ - **AI Code Issue Detection** - Validates against common AI-generated code problems (hallucinated imports, placeholder code, mock leakage, etc.)
179
+ - **Project Type Detection** - Applies appropriate test templates (React, Node API, CLI, Library, etc.)
180
+ - **Quality Gates** - IMPL-001.3 (code validation) and IMPL-001.5 (test quality) ensure high standards
181
+
182
+ **Detailed specifications**: See the test-task-generate workflow tool for complete L0-L3 requirements and quality thresholds.
183
+
184
+ ## Execution Flow
185
+
186
+ ```
187
+ Input → Detect Mode (session | prompt | resume)
188
+
189
+ ├─ resume mode → Skip to Phase 2
190
+
191
+ └─ session/prompt mode → Phase 1
192
+
193
+ Phase 1: Test-Fix Generation (phases/01-test-fix-gen.md)
194
+ ├─ Sub-phase 1.1: Create Test Session → testSessionId
195
+ ├─ Sub-phase 1.2: Gather Test Context (spawn_agent) → contextPath
196
+ ├─ Sub-phase 1.3: Test Generation Analysis (spawn_agent → Gemini) → TEST_ANALYSIS_RESULTS.md
197
+ ├─ Sub-phase 1.4: Generate Test Tasks (spawn_agent) → IMPL-*.json, IMPL_PLAN.md, TODO_LIST.md
198
+ └─ Sub-phase 1.5: Phase 1 Summary
199
+
200
+ ⛔ MANDATORY CONFIRMATION GATE
201
+ │ Present plan summary → request_user_input → User approves/cancels
202
+ │ NEVER auto-proceed to Phase 2
203
+
204
+ Phase 2: Test-Cycle Execution (phases/02-test-cycle-execute.md)
205
+ ├─ Discovery: Load session, tasks, iteration state
206
+ ├─ Main Loop (for each task):
207
+ │ ├─ Execute → Test → Calculate pass_rate
208
+ │ ├─ 100% → SUCCESS: Next task
209
+ │ ├─ 95-99% + low criticality → PARTIAL SUCCESS: Approve
210
+ │ └─ <95% → Fix Loop:
211
+ │ ├─ Select strategy: conservative/aggressive/surgical
212
+ │ ├─ spawn_agent(@cli-planning-agent) → IMPL-fix-N.json
213
+ │ ├─ spawn_agent(@test-fix-agent) → Apply fix & re-test
214
+ │ └─ Re-test → Back to decision
215
+ └─ Completion: Final validation → Summary → Sync session state → Auto-complete session
216
+ ```
217
+
218
+ ## Core Rules
219
+
220
+ 1. **Start Immediately**: First action is `functions.update_plan` initialization
221
+ 2. **No Preliminary Analysis**: Do not read files before Phase 1
222
+ 3. **Parse Every Output**: Extract data from each phase/sub-phase for the next
223
+ 4. **Within-Phase Auto-Continue**: Sub-phases within a phase run automatically; Phase 2 iterations run automatically once started
224
+ 5. **Phase Loading**: Read phase doc on-demand (`phases/01-*.md`, `phases/02-*.md`)
225
+ 6. **Task Attachment Model**: Sub-tasks ATTACH → execute → COLLAPSE
226
+ 7. **MANDATORY CONFIRMATION GATE**: After Phase 1 completes, you MUST stop and present the generated plan to the user. Wait for explicit user approval via request_user_input before starting Phase 2. NEVER auto-proceed from Phase 1 to Phase 2
227
+ 8. **Phase 2 Continuous**: Once user approves, Phase 2 runs continuously until pass rate >= 95% or max iterations reached
228
+ 9. **Explicit Lifecycle**: Always close_agent after wait_agent completes to free resources
229
+
230
+ ## Phase Execution
231
+
232
+ ### Phase 1: Test-Fix Generation
233
+
234
+ **Read**: `phases/01-test-fix-gen.md`
235
+
236
+ 5 sub-phases that create a test session and generate task JSONs:
237
+ 1. Create Test Session → `testSessionId`
238
+ 2. Gather Test Context (spawn_agent → wait_agent → close_agent) → `contextPath`
239
+ 3. Test Generation Analysis (spawn_agent → wait_agent → close_agent) → `TEST_ANALYSIS_RESULTS.md`
240
+ 4. Generate Test Tasks (spawn_agent → wait_agent → close_agent) → `IMPL-001.json`, `IMPL-001.3.json`, `IMPL-001.5.json`, `IMPL-002.json`, `IMPL_PLAN.md`, `TODO_LIST.md`
241
+ 5. Phase 1 Summary → **⛔ MANDATORY: Present plan and wait for user confirmation before Phase 2**
242
+
243
+ **Agents Used** (via spawn_agent):
244
+ - `test_context_search_agent` (agent_type: test_context_search_agent) - Context gathering (Session Mode)
245
+ - `context_search_agent` (agent_type: context_search_agent) - Context gathering (Prompt Mode)
246
+ - `cli_execution_agent` (agent_type: cli_execution_agent) - Test analysis with Gemini
247
+ - `action_planning_agent` (agent_type: action_planning_agent) - Task JSON generation
248
+
249
+ ### Phase 2: Test-Cycle Execution
250
+
251
+ **Read**: `phases/02-test-cycle-execute.md`
252
+
253
+ 3-stage iterative execution with adaptive strategy:
254
+ 1. Discovery - Load session, tasks, iteration state
255
+ 2. Main Loop - Execute tasks → Test → Analyze failures → Fix → Re-test
256
+ 3. Completion - Final validation → Summary → Auto-complete session
257
+
258
+ **Agents Used** (via spawn_agent):
259
+ - `cli_planning_agent` (agent_type: cli_planning_agent) - Failure analysis, root cause extraction, fix task generation
260
+ - `test_fix_agent` (agent_type: test_fix_agent) - Test execution, code fixes, criticality assignment
261
+
262
+ **Strategy Engine**: conservative (iteration 1-2) → aggressive (pass >80%) → surgical (regression)
263
+
264
+ ## Output Artifacts
265
+
266
+ ### Directory Structure
267
+
268
+ ```
269
+ {projectRoot}/.workflow/active/WFS-test-[session]/
270
+ ├── workflow-session.json # Session metadata
271
+ ├── IMPL_PLAN.md # Test generation and execution strategy
272
+ ├── TODO_LIST.md # Task checklist
273
+ ├── .task/
274
+ │ ├── IMPL-001.json # Test understanding & generation
275
+ │ ├── IMPL-001.3-validation.json # Code validation gate
276
+ │ ├── IMPL-001.5-review.json # Test quality gate
277
+ │ ├── IMPL-002.json # Test execution & fix cycle
278
+ │ └── IMPL-fix-{N}.json # Generated fix tasks (Phase 2)
279
+ ├── .process/
280
+ │ ├── [test-]context-package.json # Context and coverage analysis
281
+ │ ├── TEST_ANALYSIS_RESULTS.md # Test requirements and strategy (L0-L3)
282
+ │ ├── iteration-state.json # Current iteration + strategy + stuck tests
283
+ │ ├── test-results.json # Latest results (pass_rate, criticality)
284
+ │ ├── test-output.log # Full test output
285
+ │ ├── fix-history.json # All fix attempts
286
+ │ ├── iteration-{N}-analysis.md # CLI analysis report
287
+ │ └── iteration-{N}-cli-output.txt
288
+ └── .summaries/iteration-summaries/
289
+ ```
290
+
291
+ ## Progress Tracking
292
+
293
+ ### Initialization (MANDATORY)
294
+
295
+ ```javascript
296
+ // Initialize progress tracking after input parsing
297
+ functions.update_plan([
298
+ { id: "phase-1", title: "Phase 1: Test-Fix Generation", status: "in_progress" },
299
+ { id: "phase-2", title: "Phase 2: Test-Cycle Execution", status: "pending" }
300
+ ])
301
+ ```
302
+
303
+ ### Phase Transitions
304
+
305
+ ```javascript
306
+ // After Phase 1 completes (before mandatory confirmation gate)
307
+ functions.update_plan([
308
+ { id: "phase-1", status: "completed" },
309
+ { id: "phase-2", status: "in_progress" }
310
+ ])
311
+
312
+ // After Phase 2 completes (pass rate >= 95% or max iterations)
313
+ functions.update_plan([{ id: "phase-2", status: "completed" }])
314
+ ```
315
+
316
+ ### Resume Mode
317
+
318
+ ```javascript
319
+ // When --resume-session skips Phase 1
320
+ functions.update_plan([
321
+ { id: "phase-1", title: "Phase 1: Test-Fix Generation", status: "completed" },
322
+ { id: "phase-2", title: "Phase 2: Test-Cycle Execution", status: "in_progress" }
323
+ ])
324
+ ```
325
+
326
+ ## Error Handling
327
+
328
+ | Phase | Scenario | Action |
329
+ |-------|----------|--------|
330
+ | 1.1 | Source session not found (session mode) | Return error with session ID |
331
+ | 1.1 | No completed IMPL tasks (session mode) | Return error, source incomplete |
332
+ | 1.2 | Context gathering failed | Return error, check source artifacts |
333
+ | 1.2 | Agent timeout | Retry with extended timeout, close_agent, then return error |
334
+ | 1.3 | Gemini analysis failed | Return error, check context package |
335
+ | 1.4 | Task generation failed | Retry once, then return error |
336
+ | 2 | Test execution error | Log, retry with error context |
337
+ | 2 | CLI analysis failure | Fallback: Gemini Qwen Codex manual |
338
+ | 2 | Agent execution error | Save state, close_agent, retry with simplified context |
339
+ | 2 | Max iterations reached | Generate failure report, mark blocked |
340
+ | 2 | Regression detected | Rollback last fix, switch to surgical strategy |
341
+ | 2 | Stuck tests detected | Continue with alternative strategy, document in failure report |
342
+
343
+ **Lifecycle Error Handling**:
344
+ ```javascript
345
+ try {
346
+ const agentId = spawn_agent({ message: "..." });
347
+ const result = wait_agent({ targets: [agentId], timeout_ms: 600000 });
348
+ // ... process result ...
349
+ close_agent({ id: agentId });
350
+ } catch (error) {
351
+ if (agentId) close_agent({ id: agentId });
352
+ throw error;
353
+ }
354
+ ```
355
+
356
+ ## Coordinator Checklist
357
+
358
+ **Phase 1 (Generation)**:
359
+ - Detect input type (session ID / description / file path / resume)
360
+ - Initialize `functions.update_plan` with 2 top-level phases
361
+ - Read `phases/01-test-fix-gen.md` for detailed sub-phase execution
362
+ - Execute 5 sub-phases with spawn_agent wait_agent close_agent lifecycle
363
+ - Verify all Phase 1 outputs (4+ task JSONs, IMPL_PLAN.md, TODO_LIST.md)
364
+ - **Ensure all agents are closed** after each sub-phase completes
365
+ - **⛔ MANDATORY: Present plan summary and request_user_input for confirmation**
366
+ - Show: session ID, task count, test layers, quality gates
367
+ - Options: "Proceed to Execution" / "Review Plan" / "Cancel"
368
+ - If "Cancel" → return, do NOT start Phase 2
369
+ - If "Review Plan" display IMPL_PLAN.md, then return
370
+ - Only proceed to Phase 2 if user selects "Proceed to Execution"
371
+
372
+ **Phase 2 (Execution)**:
373
+ - Read `phases/02-test-cycle-execute.md` for detailed execution logic
374
+ - Load session state and task queue
375
+ - Execute iterative test-fix cycles with spawn_agent → wait_agent → close_agent
376
+ - Track iterations via `functions.update_plan`
377
+ - Auto-complete session on success (pass rate >= 95%)
378
+ - **Ensure all agents are closed** after each iteration
379
+
380
+ **Resume Mode**:
381
+ - If `--resume-session` provided, skip Phase 1
382
+ - Load existing session directly into Phase 2
383
+
384
+ ## Related Skills
385
+
386
+ **Prerequisite Skills**:
387
+ - `workflow-plan` or `workflow-execute` - Complete implementation (Session Mode)
388
+ - None for Prompt Mode
389
+
390
+ **Phase 1 Agents** (used by phases/01-test-fix-gen.md via spawn_agent):
391
+ - `test_context_search_agent` (agent_type: test_context_search_agent) - Test coverage analysis (Session Mode)
392
+ - `context_search_agent` (agent_type: context_search_agent) - Codebase analysis (Prompt Mode)
393
+ - `cli_execution_agent` (agent_type: cli_execution_agent) - Test requirements with Gemini
394
+ - `action_planning_agent` (agent_type: action_planning_agent) - Task JSON generation
395
+
396
+ **Phase 2 Agents** (used by phases/02-test-cycle-execute.md via spawn_agent):
397
+ - `cli_planning_agent` (agent_type: cli_planning_agent) - CLI analysis, root cause extraction, task generation
398
+ - `test_fix_agent` (agent_type: test_fix_agent) - Test execution, code fixes, criticality assignment
399
+
400
+ **Follow-up**:
401
+ - Session sync: `$session-sync -y "Test-fix cycle complete: {pass_rate}% pass rate"`
402
+ - Session auto-complete on success
403
+ - Issue creation for follow-up work (post-completion expansion)