owflow 0.5.0 → 0.7.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 (195) hide show
  1. package/LICENSE +21 -21
  2. package/README.md +448 -261
  3. package/dist/agents/bottleneck-analyzer.md +332 -329
  4. package/dist/agents/code-quality-pragmatist.md +353 -354
  5. package/dist/agents/code-reviewer.md +238 -239
  6. package/dist/agents/codebase-analysis-reporter.md +245 -246
  7. package/dist/agents/docs-operator.md +22 -23
  8. package/dist/agents/e2e-test-verifier.md +447 -448
  9. package/dist/agents/gap-analyzer.md +501 -502
  10. package/dist/agents/implementation-completeness-checker.md +219 -220
  11. package/dist/agents/implementation-planner.md +308 -309
  12. package/dist/agents/information-gatherer.md +690 -691
  13. package/dist/agents/production-readiness-checker.md +278 -279
  14. package/dist/agents/project-analyzer.md +403 -403
  15. package/dist/agents/reality-assessor.md +365 -366
  16. package/dist/agents/research-planner.md +449 -450
  17. package/dist/agents/research-synthesizer.md +402 -403
  18. package/dist/agents/solution-brainstormer.md +256 -257
  19. package/dist/agents/solution-designer.md +371 -372
  20. package/dist/agents/spec-auditor.md +297 -298
  21. package/dist/agents/specification-creator.md +333 -334
  22. package/dist/agents/task-classifier.md +449 -450
  23. package/dist/agents/task-group-implementer.md +283 -284
  24. package/dist/agents/test-suite-runner.md +194 -195
  25. package/dist/agents/user-docs-generator.md +508 -509
  26. package/dist/commands/reviews-code.md +90 -90
  27. package/dist/commands/reviews-pragmatic.md +99 -99
  28. package/dist/commands/reviews-production-readiness.md +113 -113
  29. package/dist/commands/reviews-reality-check.md +110 -110
  30. package/dist/commands/reviews-spec-audit.md +114 -114
  31. package/dist/commands/work.md +280 -280
  32. package/dist/configuration/agents-config.d.ts +2 -0
  33. package/dist/configuration/agents-config.js +8 -44
  34. package/dist/configuration/commands-config.d.ts +23 -0
  35. package/dist/configuration/commands-config.js +17 -17
  36. package/dist/configuration/skills-config.d.ts +2 -0
  37. package/dist/configuration/skills-config.js +3 -3
  38. package/dist/hooks/hooks-diagnostics.d.ts +3 -0
  39. package/dist/hooks/hooks-diagnostics.js +21 -0
  40. package/dist/hooks/hooks-persistence.d.ts +17 -0
  41. package/dist/hooks/hooks-persistence.js +207 -0
  42. package/dist/hooks/hooks-registry.d.ts +6 -0
  43. package/dist/hooks/hooks-registry.js +104 -0
  44. package/dist/hooks/hooks-wrapper.d.ts +25 -0
  45. package/dist/hooks/hooks-wrapper.js +318 -0
  46. package/dist/hooks/internal/before-tool.d.ts +6 -0
  47. package/dist/hooks/internal/before-tool.js +13 -0
  48. package/dist/hooks/internal/session-compaction.d.ts +9 -0
  49. package/dist/hooks/{session-compaction.js → internal/session-compaction.js} +9 -7
  50. package/dist/hooks/runtime/circuit-breaker.d.ts +23 -0
  51. package/dist/hooks/runtime/circuit-breaker.js +39 -0
  52. package/dist/hooks/runtime/failure-policy.d.ts +15 -0
  53. package/dist/hooks/runtime/failure-policy.js +49 -0
  54. package/dist/hooks/runtime/process-executor.d.ts +33 -0
  55. package/dist/hooks/runtime/process-executor.js +147 -0
  56. package/dist/hooks/runtime/status-recorder.d.ts +27 -0
  57. package/dist/hooks/runtime/status-recorder.js +111 -0
  58. package/dist/index.d.ts +7 -0
  59. package/dist/index.js +111 -40
  60. package/dist/skills/agents-md-generator/SKILL.md +223 -223
  61. package/dist/skills/codebase-analyzer/SKILL.md +162 -162
  62. package/dist/skills/codebase-analyzer/references/code-analysis.md +63 -63
  63. package/dist/skills/codebase-analyzer/references/combined.md +31 -31
  64. package/dist/skills/codebase-analyzer/references/context-discovery.md +63 -63
  65. package/dist/skills/codebase-analyzer/references/file-discovery.md +51 -51
  66. package/dist/skills/codebase-analyzer/references/migration-target.md +23 -23
  67. package/dist/skills/codebase-analyzer/references/pattern-mining.md +22 -22
  68. package/dist/skills/dev-analyze/SKILL.md +115 -115
  69. package/dist/skills/dev-bugfix/SKILL.md +452 -452
  70. package/dist/skills/dev-finalize/SKILL.md +118 -118
  71. package/dist/skills/dev-implement/SKILL.md +167 -167
  72. package/dist/skills/dev-plan/SKILL.md +147 -147
  73. package/dist/skills/dev-spec/SKILL.md +182 -182
  74. package/dist/skills/dev-tdd-red/SKILL.md +94 -94
  75. package/dist/skills/dev-verify/SKILL.md +153 -153
  76. package/dist/skills/development/SKILL.md +260 -260
  77. package/dist/skills/diagrams-mermaid/SKILL.md +183 -159
  78. package/dist/skills/diagrams-mermaid/references/reference.md +220 -148
  79. package/dist/skills/docs-manager/SKILL.md +379 -379
  80. package/dist/skills/docs-manager/docs/INDEX.md +199 -199
  81. package/dist/skills/docs-manager/docs/standards/backend/api.md +25 -25
  82. package/dist/skills/docs-manager/docs/standards/backend/migrations.md +22 -22
  83. package/dist/skills/docs-manager/docs/standards/backend/models.md +25 -25
  84. package/dist/skills/docs-manager/docs/standards/backend/queries.md +22 -22
  85. package/dist/skills/docs-manager/docs/standards/frontend/accessibility.md +25 -25
  86. package/dist/skills/docs-manager/docs/standards/frontend/components.md +28 -28
  87. package/dist/skills/docs-manager/docs/standards/frontend/css.md +16 -16
  88. package/dist/skills/docs-manager/docs/standards/frontend/responsive.md +28 -28
  89. package/dist/skills/docs-manager/docs/standards/global/coding-style.md +25 -25
  90. package/dist/skills/docs-manager/docs/standards/global/commenting.md +10 -10
  91. package/dist/skills/docs-manager/docs/standards/global/conventions.md +31 -31
  92. package/dist/skills/docs-manager/docs/standards/global/error-handling.md +22 -22
  93. package/dist/skills/docs-manager/docs/standards/global/minimal-implementation.md +22 -22
  94. package/dist/skills/docs-manager/docs/standards/global/validation.md +28 -28
  95. package/dist/skills/docs-manager/docs/standards/testing/test-writing.md +25 -25
  96. package/dist/skills/docs-manager/references/agents-md-template.md +29 -29
  97. package/dist/skills/docs-manager/references/index-md-template.md +73 -73
  98. package/dist/skills/flow-init/SKILL.md +234 -234
  99. package/dist/skills/flow-init/references/architecture-template.md +45 -45
  100. package/dist/skills/flow-init/references/roadmap-templates.md +93 -93
  101. package/dist/skills/flow-init/references/tech-stack-template.md +70 -70
  102. package/dist/skills/flow-init/references/vision-templates.md +75 -75
  103. package/dist/skills/goal-development/SKILL.md +96 -96
  104. package/dist/skills/goal-migration/SKILL.md +114 -114
  105. package/dist/skills/goal-performance/SKILL.md +126 -0
  106. package/dist/skills/goal-research/SKILL.md +118 -118
  107. package/dist/skills/html-renderer/SKILL.md +173 -173
  108. package/dist/skills/html-renderer/references/index.html +318 -318
  109. package/dist/skills/html-renderer/references/styles.css +388 -388
  110. package/dist/skills/html-renderer/references/tokens.json +104 -104
  111. package/dist/skills/implementation-plan-executor/SKILL.md +378 -378
  112. package/dist/skills/implementation-verifier/SKILL.md +307 -307
  113. package/dist/skills/migration/SKILL.md +268 -268
  114. package/dist/skills/migration-analyze/SKILL.md +126 -126
  115. package/dist/skills/migration-finalize/SKILL.md +161 -161
  116. package/dist/skills/migration-fix/SKILL.md +155 -155
  117. package/dist/skills/migration-implement/SKILL.md +131 -131
  118. package/dist/skills/migration-plan/SKILL.md +131 -131
  119. package/dist/skills/migration-spec/SKILL.md +135 -135
  120. package/dist/skills/migration-spec/references/migration-strategies.md +430 -430
  121. package/dist/skills/migration-target/SKILL.md +134 -134
  122. package/dist/skills/migration-target/references/migration-types.md +489 -489
  123. package/dist/skills/migration-verify/SKILL.md +184 -184
  124. package/dist/skills/orchestrator-framework/SKILL.md +65 -65
  125. package/dist/skills/orchestrator-framework/references/command-namespacing.md +7 -7
  126. package/dist/skills/orchestrator-framework/references/confirm-or-revise-exception.md +20 -20
  127. package/dist/skills/orchestrator-framework/references/delegation-rules.md +54 -54
  128. package/dist/skills/orchestrator-framework/references/dispatcher-handoff.md +27 -27
  129. package/dist/skills/orchestrator-framework/references/fix-loop-contract.md +65 -65
  130. package/dist/skills/orchestrator-framework/references/gate-contract.md +122 -117
  131. package/dist/skills/orchestrator-framework/references/orchestrator-creation-checklist.md +51 -51
  132. package/dist/skills/orchestrator-framework/references/orchestrator-patterns.md +235 -235
  133. package/dist/skills/performance/SKILL.md +267 -437
  134. package/dist/skills/performance-analyze/SKILL.md +129 -0
  135. package/dist/skills/{performance → performance-analyze}/references/performance-optimization-guide.md +271 -365
  136. package/dist/skills/performance-finalize/SKILL.md +117 -0
  137. package/dist/skills/performance-implement/SKILL.md +114 -0
  138. package/dist/skills/performance-plan/SKILL.md +112 -0
  139. package/dist/skills/performance-spec/SKILL.md +145 -0
  140. package/dist/skills/performance-verify/SKILL.md +164 -0
  141. package/dist/skills/research/SKILL.md +249 -249
  142. package/dist/skills/research-brainstorm/SKILL.md +120 -120
  143. package/dist/skills/research-brainstorm/references/brainstorming-techniques.md +84 -84
  144. package/dist/skills/research-converge/SKILL.md +130 -130
  145. package/dist/skills/research-design/SKILL.md +146 -146
  146. package/dist/skills/research-design/references/design-techniques.md +40 -40
  147. package/dist/skills/research-finalize/SKILL.md +125 -125
  148. package/dist/skills/research-fork/SKILL.md +190 -190
  149. package/dist/skills/research-gather/SKILL.md +133 -133
  150. package/dist/skills/research-plan/SKILL.md +141 -141
  151. package/dist/skills/research-plan/references/research-methodologies.md +710 -710
  152. package/dist/skills/research-quick/SKILL.md +139 -139
  153. package/dist/skills/research-synthesize/SKILL.md +127 -127
  154. package/dist/skills/rule-reviewer/SKILL.md +334 -334
  155. package/dist/skills/standards-discover/SKILL.md +260 -260
  156. package/dist/skills/standards-discover/references/aggregation-strategy.md +76 -76
  157. package/dist/skills/standards-discover/references/code-pattern-prompt.md +68 -68
  158. package/dist/skills/standards-discover/references/config-analyzer-prompt.md +67 -67
  159. package/dist/skills/standards-discover/references/docs-extractor-prompt.md +65 -65
  160. package/dist/skills/standards-discover/references/external-analyzer-prompt.md +75 -75
  161. package/dist/skills/standards-update/SKILL.md +207 -207
  162. package/dist/templates/orchestrator-state-base.yml +17 -17
  163. package/dist/templates/orchestrator-state-development.yml +95 -95
  164. package/dist/templates/orchestrator-state-migration.yml +95 -95
  165. package/dist/templates/orchestrator-state-performance.yml +64 -53
  166. package/dist/templates/orchestrator-state-research.yml +67 -67
  167. package/dist/tools/fork_task.d.ts +17 -0
  168. package/dist/tools/fork_task.js +21 -11
  169. package/dist/tools/verify_template.d.ts +11 -0
  170. package/dist/tools/verify_template.js +32 -17
  171. package/dist/tui/hooks-dialogs.d.ts +20 -0
  172. package/dist/tui/hooks-dialogs.js +181 -0
  173. package/dist/tui/hooks-presenter.d.ts +15 -0
  174. package/dist/tui/hooks-presenter.js +70 -0
  175. package/dist/tui/hooks-sidebar.d.ts +10 -0
  176. package/dist/tui/hooks-sidebar.js +104 -0
  177. package/dist/tui/primitives.d.ts +21 -0
  178. package/dist/tui/primitives.js +47 -0
  179. package/dist/tui.d.ts +12 -0
  180. package/dist/tui.js +129 -0
  181. package/dist/types/hook-types.d.ts +125 -0
  182. package/dist/types/hook-types.js +76 -0
  183. package/dist/types/opencode-types.d.ts +13 -0
  184. package/dist/utils/file-util.d.ts +2 -0
  185. package/dist/utils/file-util.js +6 -6
  186. package/dist/utils/fork-task.d.ts +27 -0
  187. package/dist/utils/fork-task.js +18 -23
  188. package/dist/utils/plugin-info.d.ts +3 -0
  189. package/dist/utils/plugin-info.js +8 -10
  190. package/dist/utils/workflow-paths.d.ts +17 -0
  191. package/dist/utils/workflow-paths.js +18 -0
  192. package/dist/utils/yaml-structure.d.ts +7 -0
  193. package/dist/utils/yaml-structure.js +7 -11
  194. package/package.json +68 -48
  195. package/dist/hooks/before-tool.js +0 -19
@@ -1,452 +1,452 @@
1
- ---
2
- name: owflow:dev-bugfix
3
- description: Quick bug fix with TDD red/green gates and complexity escalation. Alternative entry point into the dev-* workflow — creates/resumes a standard development task.
4
- argument-hint: "[bug description | task-path-or-identifier]"
5
- user-invocable: true
6
- ---
7
-
8
- # Dev Bug Fix
9
-
10
- Lightweight TDD-driven bug fix workflow with planning mode. Analyze the bug, present a fix plan for approval, then reproduce with a failing test, fix, and verify. Direct execution — no subagents — but with a **standard** development state file, so the task is a first-class development task: continuable by any dev-* subskill (`/owflow:dev-verify`, `/owflow:development <task-path>`, …) after the fix.
11
-
12
- Dev-bugfix is an **alternative entry point** into the development workflow, parallel to `/owflow:dev-implement --quick`: it runs an accelerated, bug-shaped slice of the pipeline (condensed analysis + plan → TDD red → fix → TDD green) and records the same state slugs so downstream skills can pick the task up. It does NOT introduce a second state format.
13
-
14
- For complex bugs that grow beyond a quick fix, suggests escalating to the full development workflow (`/owflow:development`).
15
-
16
- Gates follow the shared contract in [Gate Contract](../orchestrator-framework/references/gate-contract.md).
17
-
18
- ## Usage
19
-
20
- ```bash
21
- /owflow:dev-bugfix "Login form submits twice on slow connections"
22
- /owflow:dev-bugfix "API returns 500 when email contains special characters"
23
- /owflow:dev-bugfix .owflow/tasks/development/2026-05-28-login-double-submit
24
- ```
25
-
26
- Two invocation modes:
27
-
28
- | Mode | Argument | Result |
29
- | ------------------------------- | ------------------------------------------ | ---------------------------------------------------------------------------------------------------------- |
30
- | **Standalone** (new task) | Bug description (or nothing — prompt) | Bootstrap a NEW standard development task, run the quick fix slice, task remains continuable by any dev-* |
31
- | **Consecutive run** (existing) | Task path / identifier under `.owflow/tasks/development/` | Fix a newly emerging problem on an existing development task; reuse the task dir and state |
32
-
33
- ## Entry Gate
34
-
35
- Resolve the argument BEFORE anything else (see [Gate Contract](../orchestrator-framework/references/gate-contract.md)):
36
-
37
- - **Path / identifier** of an existing task directory under `.owflow/tasks/development/` → **Consecutive-run mode** below. Never guess or auto-pick a task.
38
- - **Description** (quoted free text) → **Standalone mode** below.
39
- - **Missing argument** → scan the recent conversation for bug context (error messages, reproduction steps, discussed symptoms); if found, use that as the bug description. Only if no argument AND no bug context in session, use `question`:
40
-
41
- ```
42
- "Describe the bug — what's the expected behavior vs actual behavior?"
43
- (or type a task path to fix a bug on an existing development task)
44
- ```
45
-
46
- Then re-route by the answer's kind. Stop only when no bug context or task reference can be obtained after asking.
47
-
48
- ### Standalone mode (new task from scratch)
49
-
50
- 1. **Create Task Directory**: `.owflow/tasks/development/YYYY-MM-DD-task-name/` — 3–5 key words from the bug description, lowercase kebab-case, today's date prefix (e.g. "Login form submits twice" → `2026-05-28-login-double-submit`). Create `analysis/` and `implementation/` subdirectories.
51
- 2. **Initialize State**: create `orchestrator-state.yml` from the development template with:
52
- - `task.title` / `task.description` from the bug description, `task.status: in_progress`
53
- - `orchestrator.entry_point: "dev-bugfix"`
54
- - `task_context.task_characteristics.has_reproducible_defect: true`
55
- - **CRITICAL**: use the `verify_template` tool immediately after creation to check YAML validity against `orchestrator-state-development.yml`.
56
- 3. **Discover project documentation**: read `.owflow/docs/INDEX.md` (if exists) and extract the Project Documentation file paths into `project_context.project_doc_paths` (matching the development dispatcher's initialization). If `.owflow/docs/` does not exist, proceed without standards and note the graceful-fallback hint (bottom of this file) in the completion message.
57
-
58
- ### Consecutive-run mode (existing development task)
59
-
60
- Used when a bug emerges on a task that already progressed in the dev pipeline (after implementation, verification, or finalization).
61
-
62
- 1. **Read `orchestrator-state.yml`** from the task path. If missing or the path matches no identifier → ask via `question` to bootstrap a fresh standard bugfix task ([Missing-state Bootstrap](../orchestrator-framework/references/gate-contract.md), starting slug `codebase-analysed`), or decline → print `No development task found at <path>. Run /owflow:dev-bugfix "<description>" to fix a bug on a fresh task.` and STOP.
63
- 2. **Read the existing state**: `completed_phases`, `phase_summaries`, affected files from prior phases. The bug fix is APPENDED to the task — existing artifacts (analysis, spec, plan, work-log) stay intact.
64
- 3. Continue with the normal workflow below. On success, the fix slugs re-map the task back toward verification (see Downstream Reset in the State Update Convention).
65
-
66
- ---
67
-
68
- ## When to Use
69
-
70
- **Use `/owflow:dev-bugfix` when:**
71
-
72
- - Bug is reasonably scoped and reproducible
73
- - You have a clear description of expected vs actual behavior
74
- - Fix likely touches a small number of files
75
-
76
- **Use `/owflow:development` instead when:**
77
-
78
- - Bug requires architectural changes
79
- - Multiple subsystems are involved
80
- - You need formal specification and planning
81
-
82
- ---
83
-
84
- ## Workflow
85
-
86
- ### Step 1: Parse Input
87
-
88
- Handled by the Entry Gate above — description → standalone bootstrap, task path/identifier → consecutive-run mode.
89
-
90
- ### Step 2: Standards Discovery
91
-
92
- **CRITICAL: This step MUST complete before entering plan mode.**
93
-
94
- **Check if `.owflow/docs/INDEX.md` exists:**
95
-
96
- **If exists:**
97
-
98
- 1. Read INDEX.md to discover available documentation and standards
99
- 2. Identify which standards are relevant based on:
100
- - The categories and files listed in INDEX.md
101
- - The area of the bug (e.g., API, frontend, database)
102
- - Keywords in the bug description
103
- 3. **READ the applicable standard files** (see Standards Reading Enforcement below)
104
- 4. **Update `orchestrator-state.yml`**: add the paths of standards read to `project_context.standards_applied` (extra state field keyed into `project_context`; create it if absent)
105
-
106
- **If not exists:**
107
-
108
- - Note that no standards are available
109
- - Suggest running `/owflow:flow-init` in the completion message
110
-
111
- ### Standards Reading Enforcement (MANDATORY)
112
-
113
- **BLOCKING**: Reading INDEX.md alone is NOT sufficient. You MUST read actual standard files.
114
-
115
- **Enforcement Process**:
116
-
117
- 1. Read INDEX.md to discover available standards
118
- 2. Identify which standards apply based on the bug area
119
- 3. **READ each applicable standard file** using the Read tool (not just note it exists)
120
- 4. Apply standards during fix implementation
121
- 5. List applied standards in the completion summary
122
-
123
- **Examples of standard discovery**:
124
-
125
- - Bug in API handler → Read API and error-handling standards
126
- - Bug in form validation → Read validation and frontend standards
127
- - Bug in database query → Read database and backend standards
128
-
129
- ### Step 3: Analyze & Assess Complexity
130
-
131
- **Explore the codebase to understand the bug:**
132
-
133
- 1. Search for relevant files (Glob, Grep, Read)
134
- 2. Trace the code path where the bug occurs
135
- 3. Identify: likely root cause, affected files, existing tests
136
- 4. Form a root cause hypothesis
137
-
138
- In **consecutive-run mode**, also read the existing phase summaries and affected files from `orchestrator-state.yml` — the newly emerging bug may interact with prior changes.
139
-
140
- **Complexity Escalation Check:**
141
-
142
- Assess whether this bug exceeds quick-fix scope. If **2 or more** of these signals are detected, suggest escalation:
143
-
144
- | Signal | Example |
145
- | ----------------------------------------------------------- | ---------------------------------------------------------------- |
146
- | Changes span 5+ files across multiple modules | Bug in shared utility affects API, frontend, and background jobs |
147
- | Requires database schema or data model changes | Missing column, wrong relationship, migration needed |
148
- | Multiple valid fix approaches with architectural trade-offs | Could fix at API layer, middleware layer, or client layer |
149
- | Security-sensitive code | Auth, crypto, permissions, input sanitization |
150
- | Root cause unclear after initial analysis | Symptoms don't point to a single location |
151
-
152
- **If escalation triggered:**
153
-
154
- **Write `analysis/findings.md`** in the task directory with the analysis captured so far:
155
-
156
- ```markdown
157
- # Bug Analysis
158
-
159
- ## Root Cause
160
-
161
- [Root cause hypothesis with evidence — file paths, code references]
162
-
163
- ## Affected Files
164
-
165
- - `path/to/file` — reason
166
-
167
- ## Complexity Assessment
168
-
169
- - [ ] Changes span 5+ files across multiple modules
170
- - [ ] Requires database schema changes
171
- - [ ] Multiple valid fix approaches with architectural trade-offs
172
- - [ ] Security-sensitive code
173
- - [ ] Root cause unclear after initial analysis
174
-
175
- Signals detected: X of 5
176
-
177
- ## Test Strategy
178
-
179
- [How the bug will be reproduced with a failing test]
180
-
181
- ## Standards Referenced
182
-
183
- - [standard file]: [key guideline applied]
184
- ```
185
-
186
- Use question:
187
-
188
- - Question: "This bug appears more complex than a quick fix — [describe why]. How would you like to proceed?"
189
- - Options:
190
- 1. "Continue with quick fix" — proceed, accepting the complexity
191
- 2. "Switch to full development workflow" — escalate (see below)
192
-
193
- **If user chooses to escalate:**
194
-
195
- 1. Ensure `analysis/findings.md` is written (above)
196
- 2. Update `orchestrator-state.yml`: set `task.status: escalated`, append `escalation_reason` to `task_context.gaps` as `"[signals detected]"`, bump `orchestrator.updated`
197
- 3. Tell the user: "Run `/owflow:development .owflow/tasks/development/YYYY-MM-DD-task-name` to continue with the full workflow." The dispatcher resumes the slugs that exist and routes to the first missing one (analysis specification / planning — whatever the quick slice condensed).
198
- 4. Do NOT set `escalated_to` — the development orchestrator will set it
199
- 5. `summary.md` is NOT written on escalation
200
- 6. Then STOP
201
-
202
- **If no escalation needed or user chooses to continue:**
203
-
204
- Write `analysis/findings.md` (same template above — captures analysis for auditability), extract a 1–2 sentence root-cause summary into `phase_summaries.quick_analysis` (`summary`, `affected_files`, `root_cause`), then proceed to Step 4.
205
-
206
- ### Step 4: Enter Planning Mode
207
-
208
- **Present the fix plan for user approval.**
209
-
210
- Standards context from Step 2 and analysis from Step 3 MUST inform the plan.
211
-
212
- **Plan file** — write `implementation/fix-plan.md`:
213
-
214
- ```markdown
215
- ## Bug Analysis
216
-
217
- **Root Cause**: [hypothesis with evidence — file paths, code references]
218
- **Affected Files**: [list of files that need changes]
219
-
220
- ## Proposed Fix
221
-
222
- [Description of the fix approach — what changes, why this approach]
223
-
224
- ## Test Strategy
225
-
226
- [What the failing test will assert — setup conditions, expected behavior]
227
-
228
- ## Applicable Standards
229
-
230
- [List each standard file read, with key guidelines extracted from each.
231
- If no standards exist: "No AI SDLC standards found. Consider running `/owflow:flow-init`."]
232
-
233
- ## Standards Compliance Checklist
234
-
235
- - [ ] [Guideline from standard file] (from `standards/[path]`)
236
- - [ ] [Guideline from standard file] (from `standards/[path]`)
237
- ```
238
-
239
- ### User approval gate: Mandatory Sections
240
-
241
- **BLOCKING: Do NOT ask for user approval until the plan file contains:**
242
-
243
- 1. **"## Bug Analysis"** — root cause hypothesis with evidence
244
- 2. **"## Proposed Fix"** — what changes and why
245
- 3. **"## Test Strategy"** — what the TDD red test will assert
246
- 4. **"## Applicable Standards"** — standards read and key guidelines
247
- 5. **"## Standards Compliance Checklist"** — checkboxes for applicable guidelines
248
-
249
- If any section is missing, add it before asking for user approval.
250
-
251
- ### Approval question
252
-
253
- Use `question` — present the mini plan (root cause, approach, affected files, test strategy) and ask "Proceed with the fix?" Options:
254
-
255
- - **Approve and implement** — continue with the TDD red gate
256
- - **Adjust** — rework the plan (different approach, different files), re-ask
257
- - **Run full pipeline instead** — escalate per the escalation procedure in Step 3 (escalation handling), then STOP
258
- - **Cancel** — end; state and artifacts persist
259
-
260
- On approval: append the condensed-phase slugs `codebase-analysed` and `gap-analysed` to `completed_phases` (the condensed analysis in Steps 2–3 covers both; note the condensation in `phase_summaries.codebase_analysis` / `phase_summaries.gap_analysis`), bump `orchestrator.updated`, and re-run `verify_template` on the state file. In **consecutive-run mode** these slugs already exist — do not append duplicates; instead note the re-fix in the existing analysis artifacts.
261
-
262
- ### Step 5: TDD Red Gate (`tdd-red-proven`)
263
-
264
- **Write a failing test that reproduces the bug.**
265
-
266
- Direct execution (targeted, single-test task — no delegation).
267
-
268
- 1. Identify the appropriate test file (existing test suite or create new test file following project conventions)
269
- 2. Write a test that:
270
- - Sets up the conditions that trigger the bug
271
- - Asserts the **correct** (expected) behavior
272
- - Should FAIL with current code (proving the bug exists)
273
- 3. Run the test
274
-
275
- **The test MUST fail.** This proves the bug is real and reproducible.
276
-
277
- **If the test passes:**
278
-
279
- - The bug may not be what we think, or it's already fixed
280
- - Investigate further — re-read the bug description, check if conditions are correct
281
- - Use question: "The reproduction test passes — the expected behavior already works under these conditions. Is the bug description accurate, or are there additional conditions?"
282
-
283
- **On success**: record the test path and key failure output in `implementation/tdd-red-gate.md` (mimicking the dev-tdd-red artifact), append `tdd-red-proven` to `completed_phases`, set `task_context.tdd_red_passed: true` (create `task_context` fields if absent), bump `orchestrator.updated`, re-run `verify_template`.
284
-
285
- **On failure to reproduce** (test framework issues, 2 rewrite attempts exhausted): do NOT append `tdd-red-proven`; document the blocker in `task_context.gaps` and use `question`: "The bug could not be reproduced with a failing test. Continue without a red gate (documented skip), or stop?" A user-chosen skip is recorded in `task_context.gaps` with `task_context.tdd_red_passed: false` — no slugs appended. If the user chooses stop → STOP (state persists; resumable via `/owflow:dev-bugfix <task-path>`).
286
-
287
- ### Step 6: Fix & Verify — TDD Green Gate (`implementation-done`, `tdd-green-proven`)
288
-
289
- **Implement the fix:**
290
-
291
- 1. Apply the fix based on the approved plan from Step 4
292
- 2. **Apply discovered standards** from Step 2
293
- 3. Run the failing test — it MUST now pass
294
- 4. Run the full test file and related test files to check for regressions
295
- 5. Append progress to `implementation/work-log.md` (what was fixed, files touched, test results — creating the file if absent); in **consecutive-run mode** append to the existing work-log rather than overwriting.
296
-
297
- **If tests fail after fix:**
298
-
299
- - Analyze the failure
300
- - Adjust the fix
301
- - Re-run tests
302
- - Maximum 3 fix-and-verify iterations
303
-
304
- **If still failing after 3 attempts:**
305
-
306
- - Stop and present findings to the user
307
- - Suggest escalating to `/owflow:development <task-path>` for a more thorough approach (the task is a standard dev task — the dispatcher continues it)
308
-
309
- **On success**: append `implementation-done` and `tdd-green-proven` to `completed_phases`, set `task_context.tdd_green_passed: true`, record test results in `implementation/tdd-green-gate.md`, extract 1–2 sentences into `phase_summaries.implementation` (root cause in 1 line, fix, files changed, test results), bump `orchestrator.updated`, re-run `verify_template`.
310
-
311
- ### Downstream reset (consecutive-run mode only)
312
-
313
- If `completed_phases` contained any of `options-chosen`, `verification-done`, `e2e-run`, `docs-generated`, `task-completed` **before** this run, REMOVE those downstream slugs now — new code invalidates prior verification, so the pipeline must route back to `/owflow:dev-verify`. Also set `verification_context.last_status: null` (re-verification required). Do NOT remove the fix slugs appended this run.
314
-
315
- ### Step 7: Summary
316
-
317
- **Write `summary.md`** in the task directory (in consecutive-run mode, write `summary.md` describing THIS fix run; earlier runs' summaries are reflected in the work-log):
318
-
319
- ```markdown
320
- # Task Summary
321
-
322
- **Command**: dev-bugfix
323
- **Date**: YYYY-MM-DD
324
- **Status**: completed
325
-
326
- ## What Was Done
327
-
328
- [Root cause and fix description]
329
-
330
- ## Files Modified
331
-
332
- - `path/to/file`
333
-
334
- ## Standards Applied
335
-
336
- - [standard]: [guideline]
337
-
338
- ## Tests
339
-
340
- - [test file] — [result]
341
-
342
- ## Commit Suggestion
343
-
344
- [conventional commit message]
345
- ```
346
-
347
- **Update `orchestrator-state.yml`**: set `task.status: completed` (both modes — in consecutive-run mode, the task stays open for verification, so use `task.status: in_progress` instead when the downstream reset applied), `updated: [now]`, plus final state update convention below.
348
-
349
- **Post-implementation: verify standards compliance using the checklist from the plan file.**
350
-
351
- ### State Update Convention (per step)
352
-
353
- 1. **Write immediately** — update `orchestrator-state.yml` as soon as the step completes, appending ONLY the slugs actually performed plus that step's fields. Never batch multiple steps into one end-of-skill write. (Slugs are appended at the step boundaries flagged above: approval → analysis slugs, Step 5 → `tdd-red-proven`, Step 6 → `implementation-done` + `tdd-green-proven`.)
354
- 2. **Timestamp** — set `orchestrator.updated` to the current UTC timestamp on every write.
355
- 3. **Failures** — if a step ultimately fails (retries exhausted, user stops): do NOT append its slugs; document the blocker in `task_context.gaps`; in consecutive-run mode the task's existing slugs are untouched.
356
- 4. **Validate** — after every write, re-read the file to confirm values, then run the `verify_template` tool with `filePath: <task-path>/orchestrator-state.yml`, `templateName: orchestrator-state-development.yml`. Fix any reported issue immediately before proceeding.
357
- 5. **Final check** — before the Exit Gate, one consolidated re-read + `verify_template` run to confirm the full state matches everything performed in this session.
358
-
359
- ### Step 8: Exit Gate
360
-
361
- Present results, get user confirmation, then close (Exit Gate contract, [Gate Contract](../orchestrator-framework/references/gate-contract.md)). Never auto-invoke the next skill.
362
-
363
- **Results box**:
364
-
365
- ```markdown
366
- ## ✅ QUICK BUGFIX COMPLETE — <task name>
367
-
368
- **Root cause** — [1-line root cause]
369
- **Fix** — [1-line fix description]
370
- **Files** — [count + key files]
371
- **Tests** — [red gate failed → green gate passed]
372
- **Standards** — [applied standards count]
373
- **Entry point** — [standalone bootstrap / consecutive fix on existing task]
374
- **Task state** — [slugs appended this run / pipeline position]
375
-
376
- **Artifacts**
377
- - implemented code
378
- - `summary.md`
379
- - `analysis/findings.md`
380
- - `implementation/fix-plan.md`
381
- - `implementation/tdd-red-gate.md` + `implementation/tdd-green-gate.md`
382
- - `implementation/work-log.md`
383
- - `orchestrator-state.yml` (status: <completed | in_progress>)
384
- ```
385
-
386
- **Results-acceptance question** — use `question` — "Is the bug fixed correctly?" with options:
387
-
388
- - **Accept** — fix verified; print next steps below.
389
- - **Adjust** — re-work the fix (different approach, additional files), re-run the TDD loop, then re-present the results box.
390
- - **Discuss** — walk through root cause analysis and fix reasoning in more depth; then re-ask.
391
- - **Stop here** — end; `summary.md` and the task directory persist. Resume or escalate later via the hints below.
392
-
393
- **Next steps (after Accept)**:
394
-
395
- Standalone (fresh task):
396
-
397
- ```
398
- ✓ Bug fixed — <task-path>
399
-
400
- Next steps:
401
- → /owflow:dev-verify <task-path> — recommended: run the verification pipeline
402
- (completeness, code review) before commit
403
-
404
- Other options:
405
- → Commit using the suggested message from summary.md
406
- /owflow:goal-development <task-path> — run verify → finalize in one loop
407
- /owflow:dev-spec <task-path> — write a formal specification later if needed
408
- ```
409
-
410
- Consecutive run (existing task, downstream slugs were reset):
411
-
412
- ```
413
- ✓ Bug fixed on <task-path>
414
-
415
- Next steps:
416
- → /owflow:dev-verify <task-path> — required: re-verification after new code
417
- ```
418
-
419
- Other options:
420
-
421
- ```
422
- /owflow:development <task-path> — full workflow view of the task
423
- /owflow:dev-bugfix <task-path> — fix another emerging problem on this task
424
- /owflow:reviews-code <task-path> — deeper review of the fix
425
- ```
426
-
427
- Then STOP.
428
-
429
- ---
430
-
431
- ## What This Does
432
-
433
- 1. **Resolves** the argument: bug description → fresh task bootstrap; task path/identifier → consecutive fix on an existing development task
434
- 2. **Creates/bootstraps** a standard development task directory with `orchestrator-state.yml` (dev template, `entry_point: dev-bugfix`)
435
- 3. **Discovers** applicable standards from `.owflow/docs/INDEX.md` and records them in state
436
- 4. **Analyzes** codebase to find root cause, writes `analysis/findings.md`, and assesses complexity
437
- 5. **Escalates** to the full development workflow if the bug is too complex (sets `task.status: escalated`)
438
- 6. **Plans** the fix (`implementation/fix-plan.md`) and presents it for user approval
439
- 7. **Reproduces** the bug with a failing test (TDD red, `tdd-red-proven`)
440
- 8. **Fixes** the bug and verifies the test passes (TDD green, `implementation-done` + `tdd-green-proven`); on consecutive runs, resets downstream verification slugs
441
- 9. **Summarizes** in `summary.md` and keeps the task continuable by any dev-* subskill
442
-
443
- ## Graceful Fallback
444
-
445
- **If `.owflow/docs/` does not exist:**
446
-
447
- Proceed with the bug fix normally, then note:
448
-
449
- ```
450
- "No AI SDLC standards found. Consider running `/owflow:flow-init` to initialize
451
- project documentation and coding standards for better consistency."
452
- ```
1
+ ---
2
+ name: owflow:dev-bugfix
3
+ description: Quick bug fix with TDD red/green gates and complexity escalation. Alternative entry point into the dev-* workflow — creates/resumes a standard development task.
4
+ argument-hint: "[bug description | task-path-or-identifier]"
5
+ user-invocable: true
6
+ ---
7
+
8
+ # Dev Bug Fix
9
+
10
+ Lightweight TDD-driven bug fix workflow with planning mode. Analyze the bug, present a fix plan for approval, then reproduce with a failing test, fix, and verify. Direct execution — no subagents — but with a **standard** development state file, so the task is a first-class development task: continuable by any dev-* subskill (`/owflow:dev-verify`, `/owflow:development <task-path>`, …) after the fix.
11
+
12
+ Dev-bugfix is an **alternative entry point** into the development workflow, parallel to `/owflow:dev-implement --quick`: it runs an accelerated, bug-shaped slice of the pipeline (condensed analysis + plan → TDD red → fix → TDD green) and records the same state slugs so downstream skills can pick the task up. It does NOT introduce a second state format.
13
+
14
+ For complex bugs that grow beyond a quick fix, suggests escalating to the full development workflow (`/owflow:development`).
15
+
16
+ Gates follow the shared contract in [Gate Contract](../orchestrator-framework/references/gate-contract.md).
17
+
18
+ ## Usage
19
+
20
+ ```bash
21
+ /owflow:dev-bugfix "Login form submits twice on slow connections"
22
+ /owflow:dev-bugfix "API returns 500 when email contains special characters"
23
+ /owflow:dev-bugfix .owflow/tasks/development/2026-05-28-login-double-submit
24
+ ```
25
+
26
+ Two invocation modes:
27
+
28
+ | Mode | Argument | Result |
29
+ | ------------------------------- | ------------------------------------------ | ---------------------------------------------------------------------------------------------------------- |
30
+ | **Standalone** (new task) | Bug description (or nothing — prompt) | Bootstrap a NEW standard development task, run the quick fix slice, task remains continuable by any dev-* |
31
+ | **Consecutive run** (existing) | Task path / identifier under `.owflow/tasks/development/` | Fix a newly emerging problem on an existing development task; reuse the task dir and state |
32
+
33
+ ## Entry Gate
34
+
35
+ Resolve the argument BEFORE anything else (see [Gate Contract](../orchestrator-framework/references/gate-contract.md)):
36
+
37
+ - **Path / identifier** of an existing task directory under `.owflow/tasks/development/` → **Consecutive-run mode** below. Never guess or auto-pick a task.
38
+ - **Description** (quoted free text) → **Standalone mode** below.
39
+ - **Missing argument** → scan the recent conversation for bug context (error messages, reproduction steps, discussed symptoms); if found, use that as the bug description. Only if no argument AND no bug context in session, use `question`:
40
+
41
+ ```
42
+ "Describe the bug — what's the expected behavior vs actual behavior?"
43
+ (or type a task path to fix a bug on an existing development task)
44
+ ```
45
+
46
+ Then re-route by the answer's kind. Stop only when no bug context or task reference can be obtained after asking.
47
+
48
+ ### Standalone mode (new task from scratch)
49
+
50
+ 1. **Create Task Directory**: `.owflow/tasks/development/YYYY-MM-DD-task-name/` — 3–5 key words from the bug description, lowercase kebab-case, today's date prefix (e.g. "Login form submits twice" → `2026-05-28-login-double-submit`). Create `analysis/` and `implementation/` subdirectories.
51
+ 2. **Initialize State**: create `orchestrator-state.yml` from the development template with:
52
+ - `task.title` / `task.description` from the bug description, `task.status: in_progress`
53
+ - `orchestrator.entry_point: "dev-bugfix"`
54
+ - `task_context.task_characteristics.has_reproducible_defect: true`
55
+ - **CRITICAL**: use the `verify_template` tool immediately after creation to check YAML validity against `orchestrator-state-development.yml`.
56
+ 3. **Discover project documentation**: read `.owflow/docs/INDEX.md` (if exists) and extract the Project Documentation file paths into `project_context.project_doc_paths` (matching the development dispatcher's initialization). If `.owflow/docs/` does not exist, proceed without standards and note the graceful-fallback hint (bottom of this file) in the completion message.
57
+
58
+ ### Consecutive-run mode (existing development task)
59
+
60
+ Used when a bug emerges on a task that already progressed in the dev pipeline (after implementation, verification, or finalization).
61
+
62
+ 1. **Read `orchestrator-state.yml`** from the task path. If missing or the path matches no identifier → ask via `question` to bootstrap a fresh standard bugfix task ([Missing-state Bootstrap](../orchestrator-framework/references/gate-contract.md), starting slug `codebase-analysed`), or decline → print `No development task found at <path>. Run /owflow:dev-bugfix "<description>" to fix a bug on a fresh task.` and STOP.
63
+ 2. **Read the existing state**: `completed_phases`, `phase_summaries`, affected files from prior phases. The bug fix is APPENDED to the task — existing artifacts (analysis, spec, plan, work-log) stay intact.
64
+ 3. Continue with the normal workflow below. On success, the fix slugs re-map the task back toward verification (see Downstream Reset in the State Update Convention).
65
+
66
+ ---
67
+
68
+ ## When to Use
69
+
70
+ **Use `/owflow:dev-bugfix` when:**
71
+
72
+ - Bug is reasonably scoped and reproducible
73
+ - You have a clear description of expected vs actual behavior
74
+ - Fix likely touches a small number of files
75
+
76
+ **Use `/owflow:development` instead when:**
77
+
78
+ - Bug requires architectural changes
79
+ - Multiple subsystems are involved
80
+ - You need formal specification and planning
81
+
82
+ ---
83
+
84
+ ## Workflow
85
+
86
+ ### Step 1: Parse Input
87
+
88
+ Handled by the Entry Gate above — description → standalone bootstrap, task path/identifier → consecutive-run mode.
89
+
90
+ ### Step 2: Standards Discovery
91
+
92
+ **CRITICAL: This step MUST complete before entering plan mode.**
93
+
94
+ **Check if `.owflow/docs/INDEX.md` exists:**
95
+
96
+ **If exists:**
97
+
98
+ 1. Read INDEX.md to discover available documentation and standards
99
+ 2. Identify which standards are relevant based on:
100
+ - The categories and files listed in INDEX.md
101
+ - The area of the bug (e.g., API, frontend, database)
102
+ - Keywords in the bug description
103
+ 3. **READ the applicable standard files** (see Standards Reading Enforcement below)
104
+ 4. **Update `orchestrator-state.yml`**: add the paths of standards read to `project_context.standards_applied` (extra state field keyed into `project_context`; create it if absent)
105
+
106
+ **If not exists:**
107
+
108
+ - Note that no standards are available
109
+ - Suggest running `/owflow:flow-init` in the completion message
110
+
111
+ ### Standards Reading Enforcement (MANDATORY)
112
+
113
+ **BLOCKING**: Reading INDEX.md alone is NOT sufficient. You MUST read actual standard files.
114
+
115
+ **Enforcement Process**:
116
+
117
+ 1. Read INDEX.md to discover available standards
118
+ 2. Identify which standards apply based on the bug area
119
+ 3. **READ each applicable standard file** using the Read tool (not just note it exists)
120
+ 4. Apply standards during fix implementation
121
+ 5. List applied standards in the completion summary
122
+
123
+ **Examples of standard discovery**:
124
+
125
+ - Bug in API handler → Read API and error-handling standards
126
+ - Bug in form validation → Read validation and frontend standards
127
+ - Bug in database query → Read database and backend standards
128
+
129
+ ### Step 3: Analyze & Assess Complexity
130
+
131
+ **Explore the codebase to understand the bug:**
132
+
133
+ 1. Search for relevant files (Glob, Grep, Read)
134
+ 2. Trace the code path where the bug occurs
135
+ 3. Identify: likely root cause, affected files, existing tests
136
+ 4. Form a root cause hypothesis
137
+
138
+ In **consecutive-run mode**, also read the existing phase summaries and affected files from `orchestrator-state.yml` — the newly emerging bug may interact with prior changes.
139
+
140
+ **Complexity Escalation Check:**
141
+
142
+ Assess whether this bug exceeds quick-fix scope. If **2 or more** of these signals are detected, suggest escalation:
143
+
144
+ | Signal | Example |
145
+ | ----------------------------------------------------------- | ---------------------------------------------------------------- |
146
+ | Changes span 5+ files across multiple modules | Bug in shared utility affects API, frontend, and background jobs |
147
+ | Requires database schema or data model changes | Missing column, wrong relationship, migration needed |
148
+ | Multiple valid fix approaches with architectural trade-offs | Could fix at API layer, middleware layer, or client layer |
149
+ | Security-sensitive code | Auth, crypto, permissions, input sanitization |
150
+ | Root cause unclear after initial analysis | Symptoms don't point to a single location |
151
+
152
+ **If escalation triggered:**
153
+
154
+ **Write `analysis/findings.md`** in the task directory with the analysis captured so far:
155
+
156
+ ```markdown
157
+ # Bug Analysis
158
+
159
+ ## Root Cause
160
+
161
+ [Root cause hypothesis with evidence — file paths, code references]
162
+
163
+ ## Affected Files
164
+
165
+ - `path/to/file` — reason
166
+
167
+ ## Complexity Assessment
168
+
169
+ - [ ] Changes span 5+ files across multiple modules
170
+ - [ ] Requires database schema changes
171
+ - [ ] Multiple valid fix approaches with architectural trade-offs
172
+ - [ ] Security-sensitive code
173
+ - [ ] Root cause unclear after initial analysis
174
+
175
+ Signals detected: X of 5
176
+
177
+ ## Test Strategy
178
+
179
+ [How the bug will be reproduced with a failing test]
180
+
181
+ ## Standards Referenced
182
+
183
+ - [standard file]: [key guideline applied]
184
+ ```
185
+
186
+ Use question:
187
+
188
+ - Question: "This bug appears more complex than a quick fix — [describe why]. How would you like to proceed?"
189
+ - Options:
190
+ 1. "Continue with quick fix" — proceed, accepting the complexity
191
+ 2. "Switch to full development workflow" — escalate (see below)
192
+
193
+ **If user chooses to escalate:**
194
+
195
+ 1. Ensure `analysis/findings.md` is written (above)
196
+ 2. Update `orchestrator-state.yml`: set `task.status: escalated`, append `escalation_reason` to `task_context.gaps` as `"[signals detected]"`, bump `orchestrator.updated`
197
+ 3. Tell the user: "Run `/owflow:development .owflow/tasks/development/YYYY-MM-DD-task-name` to continue with the full workflow." The dispatcher resumes the slugs that exist and routes to the first missing one (analysis specification / planning — whatever the quick slice condensed).
198
+ 4. Do NOT set `escalated_to` — the development orchestrator will set it
199
+ 5. `summary.md` is NOT written on escalation
200
+ 6. Then STOP
201
+
202
+ **If no escalation needed or user chooses to continue:**
203
+
204
+ Write `analysis/findings.md` (same template above — captures analysis for auditability), extract a 1–2 sentence root-cause summary into `phase_summaries.quick_analysis` (`summary`, `affected_files`, `root_cause`), then proceed to Step 4.
205
+
206
+ ### Step 4: Enter Planning Mode
207
+
208
+ **Present the fix plan for user approval.**
209
+
210
+ Standards context from Step 2 and analysis from Step 3 MUST inform the plan.
211
+
212
+ **Plan file** — write `implementation/fix-plan.md`:
213
+
214
+ ```markdown
215
+ ## Bug Analysis
216
+
217
+ **Root Cause**: [hypothesis with evidence — file paths, code references]
218
+ **Affected Files**: [list of files that need changes]
219
+
220
+ ## Proposed Fix
221
+
222
+ [Description of the fix approach — what changes, why this approach]
223
+
224
+ ## Test Strategy
225
+
226
+ [What the failing test will assert — setup conditions, expected behavior]
227
+
228
+ ## Applicable Standards
229
+
230
+ [List each standard file read, with key guidelines extracted from each.
231
+ If no standards exist: "No AI SDLC standards found. Consider running `/owflow:flow-init`."]
232
+
233
+ ## Standards Compliance Checklist
234
+
235
+ - [ ] [Guideline from standard file] (from `standards/[path]`)
236
+ - [ ] [Guideline from standard file] (from `standards/[path]`)
237
+ ```
238
+
239
+ ### User approval gate: Mandatory Sections
240
+
241
+ **BLOCKING: Do NOT ask for user approval until the plan file contains:**
242
+
243
+ 1. **"## Bug Analysis"** — root cause hypothesis with evidence
244
+ 2. **"## Proposed Fix"** — what changes and why
245
+ 3. **"## Test Strategy"** — what the TDD red test will assert
246
+ 4. **"## Applicable Standards"** — standards read and key guidelines
247
+ 5. **"## Standards Compliance Checklist"** — checkboxes for applicable guidelines
248
+
249
+ If any section is missing, add it before asking for user approval.
250
+
251
+ ### Approval question
252
+
253
+ Use `question` — present the mini plan (root cause, approach, affected files, test strategy) and ask "Proceed with the fix?" Options:
254
+
255
+ - **Approve and implement** — continue with the TDD red gate
256
+ - **Adjust** — rework the plan (different approach, different files), re-ask
257
+ - **Run full pipeline instead** — escalate per the escalation procedure in Step 3 (escalation handling), then STOP
258
+ - **Cancel** — end; state and artifacts persist
259
+
260
+ On approval: append the condensed-phase slugs `codebase-analysed` and `gap-analysed` to `completed_phases` (the condensed analysis in Steps 2–3 covers both; note the condensation in `phase_summaries.codebase_analysis` / `phase_summaries.gap_analysis`), bump `orchestrator.updated`, and re-run `verify_template` on the state file. In **consecutive-run mode** these slugs already exist — do not append duplicates; instead note the re-fix in the existing analysis artifacts.
261
+
262
+ ### Step 5: TDD Red Gate (`tdd-red-proven`)
263
+
264
+ **Write a failing test that reproduces the bug.**
265
+
266
+ Direct execution (targeted, single-test task — no delegation).
267
+
268
+ 1. Identify the appropriate test file (existing test suite or create new test file following project conventions)
269
+ 2. Write a test that:
270
+ - Sets up the conditions that trigger the bug
271
+ - Asserts the **correct** (expected) behavior
272
+ - Should FAIL with current code (proving the bug exists)
273
+ 3. Run the test
274
+
275
+ **The test MUST fail.** This proves the bug is real and reproducible.
276
+
277
+ **If the test passes:**
278
+
279
+ - The bug may not be what we think, or it's already fixed
280
+ - Investigate further — re-read the bug description, check if conditions are correct
281
+ - Use question: "The reproduction test passes — the expected behavior already works under these conditions. Is the bug description accurate, or are there additional conditions?"
282
+
283
+ **On success**: record the test path and key failure output in `implementation/tdd-red-gate.md` (mimicking the dev-tdd-red artifact), append `tdd-red-proven` to `completed_phases`, set `task_context.tdd_red_passed: true` (create `task_context` fields if absent), bump `orchestrator.updated`, re-run `verify_template`.
284
+
285
+ **On failure to reproduce** (test framework issues, 2 rewrite attempts exhausted): do NOT append `tdd-red-proven`; document the blocker in `task_context.gaps` and use `question`: "The bug could not be reproduced with a failing test. Continue without a red gate (documented skip), or stop?" A user-chosen skip is recorded in `task_context.gaps` with `task_context.tdd_red_passed: false` — no slugs appended. If the user chooses stop → STOP (state persists; resumable via `/owflow:dev-bugfix <task-path>`).
286
+
287
+ ### Step 6: Fix & Verify — TDD Green Gate (`implementation-done`, `tdd-green-proven`)
288
+
289
+ **Implement the fix:**
290
+
291
+ 1. Apply the fix based on the approved plan from Step 4
292
+ 2. **Apply discovered standards** from Step 2
293
+ 3. Run the failing test — it MUST now pass
294
+ 4. Run the full test file and related test files to check for regressions
295
+ 5. Append progress to `implementation/work-log.md` (what was fixed, files touched, test results — creating the file if absent); in **consecutive-run mode** append to the existing work-log rather than overwriting.
296
+
297
+ **If tests fail after fix:**
298
+
299
+ - Analyze the failure
300
+ - Adjust the fix
301
+ - Re-run tests
302
+ - Maximum 3 fix-and-verify iterations
303
+
304
+ **If still failing after 3 attempts:**
305
+
306
+ - Stop and present findings to the user
307
+ - Suggest escalating to `/owflow:development <task-path>` for a more thorough approach (the task is a standard dev task — the dispatcher continues it)
308
+
309
+ **On success**: append `implementation-done` and `tdd-green-proven` to `completed_phases`, set `task_context.tdd_green_passed: true`, record test results in `implementation/tdd-green-gate.md`, extract 1–2 sentences into `phase_summaries.implementation` (root cause in 1 line, fix, files changed, test results), bump `orchestrator.updated`, re-run `verify_template`.
310
+
311
+ ### Downstream reset (consecutive-run mode only)
312
+
313
+ If `completed_phases` contained any of `options-chosen`, `verification-done`, `e2e-run`, `docs-generated`, `task-completed` **before** this run, REMOVE those downstream slugs now — new code invalidates prior verification, so the pipeline must route back to `/owflow:dev-verify`. Also set `verification_context.last_status: null` (re-verification required). Do NOT remove the fix slugs appended this run.
314
+
315
+ ### Step 7: Summary
316
+
317
+ **Write `summary.md`** in the task directory (in consecutive-run mode, write `summary.md` describing THIS fix run; earlier runs' summaries are reflected in the work-log):
318
+
319
+ ```markdown
320
+ # Task Summary
321
+
322
+ **Command**: dev-bugfix
323
+ **Date**: YYYY-MM-DD
324
+ **Status**: completed
325
+
326
+ ## What Was Done
327
+
328
+ [Root cause and fix description]
329
+
330
+ ## Files Modified
331
+
332
+ - `path/to/file`
333
+
334
+ ## Standards Applied
335
+
336
+ - [standard]: [guideline]
337
+
338
+ ## Tests
339
+
340
+ - [test file] — [result]
341
+
342
+ ## Commit Suggestion
343
+
344
+ [conventional commit message]
345
+ ```
346
+
347
+ **Update `orchestrator-state.yml`**: set `task.status: completed` (both modes — in consecutive-run mode, the task stays open for verification, so use `task.status: in_progress` instead when the downstream reset applied), `updated: [now]`, plus final state update convention below.
348
+
349
+ **Post-implementation: verify standards compliance using the checklist from the plan file.**
350
+
351
+ ### State Update Convention (per step)
352
+
353
+ 1. **Write immediately** — update `orchestrator-state.yml` as soon as the step completes, appending ONLY the slugs actually performed plus that step's fields. Never batch multiple steps into one end-of-skill write. (Slugs are appended at the step boundaries flagged above: approval → analysis slugs, Step 5 → `tdd-red-proven`, Step 6 → `implementation-done` + `tdd-green-proven`.)
354
+ 2. **Timestamp** — set `orchestrator.updated` to the current UTC timestamp on every write.
355
+ 3. **Failures** — if a step ultimately fails (retries exhausted, user stops): do NOT append its slugs; document the blocker in `task_context.gaps`; in consecutive-run mode the task's existing slugs are untouched.
356
+ 4. **Validate** — after every write, re-read the file to confirm values, then run the `verify_template` tool with `filePath: <task-path>/orchestrator-state.yml`, `templateName: orchestrator-state-development.yml`. Fix any reported issue immediately before proceeding.
357
+ 5. **Final check** — before the Exit Gate, one consolidated re-read + `verify_template` run to confirm the full state matches everything performed in this session.
358
+
359
+ ### Step 8: Exit Gate
360
+
361
+ Present results, get user confirmation, then close (Exit Gate contract, [Gate Contract](../orchestrator-framework/references/gate-contract.md)). Never auto-invoke the next skill.
362
+
363
+ **Results box**:
364
+
365
+ ```markdown
366
+ ## ✅ QUICK BUGFIX COMPLETE — <task name>
367
+
368
+ **Root cause** — [1-line root cause]
369
+ **Fix** — [1-line fix description]
370
+ **Files** — [count + key files]
371
+ **Tests** — [red gate failed → green gate passed]
372
+ **Standards** — [applied standards count]
373
+ **Entry point** — [standalone bootstrap / consecutive fix on existing task]
374
+ **Task state** — [slugs appended this run / pipeline position]
375
+
376
+ **Artifacts**
377
+ - implemented code
378
+ - `summary.md`
379
+ - `analysis/findings.md`
380
+ - `implementation/fix-plan.md`
381
+ - `implementation/tdd-red-gate.md` + `implementation/tdd-green-gate.md`
382
+ - `implementation/work-log.md`
383
+ - `orchestrator-state.yml` (status: <completed | in_progress>)
384
+ ```
385
+
386
+ **Results-acceptance question** — use `question` — "Is the bug fixed correctly?" with options:
387
+
388
+ - **Accept** — fix verified; print next steps below.
389
+ - **Adjust** — re-work the fix (different approach, additional files), re-run the TDD loop, then re-present the results box.
390
+ - **Discuss** — walk through root cause analysis and fix reasoning in more depth; then re-ask.
391
+ - **Stop here** — end; `summary.md` and the task directory persist. Resume or escalate later via the hints below.
392
+
393
+ **Next steps (after Accept)**:
394
+
395
+ Standalone (fresh task):
396
+
397
+ ```
398
+ ✓ Bug fixed — <task-path>
399
+
400
+ Next steps:
401
+ → /owflow:dev-verify <task-path> — recommended: run the verification pipeline
402
+ (completeness, code review) before commit
403
+
404
+ Other options:
405
+ → Commit using the suggested message from summary.md
406
+ /owflow:goal-development <task-path> — run verify → finalize in one loop
407
+ /owflow:dev-spec <task-path> — write a formal specification later if needed
408
+ ```
409
+
410
+ Consecutive run (existing task, downstream slugs were reset):
411
+
412
+ ```
413
+ ✓ Bug fixed on <task-path>
414
+
415
+ Next steps:
416
+ → /owflow:dev-verify <task-path> — required: re-verification after new code
417
+ ```
418
+
419
+ Other options:
420
+
421
+ ```
422
+ /owflow:development <task-path> — full workflow view of the task
423
+ /owflow:dev-bugfix <task-path> — fix another emerging problem on this task
424
+ /owflow:reviews-code <task-path> — deeper review of the fix
425
+ ```
426
+
427
+ Then STOP.
428
+
429
+ ---
430
+
431
+ ## What This Does
432
+
433
+ 1. **Resolves** the argument: bug description → fresh task bootstrap; task path/identifier → consecutive fix on an existing development task
434
+ 2. **Creates/bootstraps** a standard development task directory with `orchestrator-state.yml` (dev template, `entry_point: dev-bugfix`)
435
+ 3. **Discovers** applicable standards from `.owflow/docs/INDEX.md` and records them in state
436
+ 4. **Analyzes** codebase to find root cause, writes `analysis/findings.md`, and assesses complexity
437
+ 5. **Escalates** to the full development workflow if the bug is too complex (sets `task.status: escalated`)
438
+ 6. **Plans** the fix (`implementation/fix-plan.md`) and presents it for user approval
439
+ 7. **Reproduces** the bug with a failing test (TDD red, `tdd-red-proven`)
440
+ 8. **Fixes** the bug and verifies the test passes (TDD green, `implementation-done` + `tdd-green-proven`); on consecutive runs, resets downstream verification slugs
441
+ 9. **Summarizes** in `summary.md` and keeps the task continuable by any dev-* subskill
442
+
443
+ ## Graceful Fallback
444
+
445
+ **If `.owflow/docs/` does not exist:**
446
+
447
+ Proceed with the bug fix normally, then note:
448
+
449
+ ```
450
+ "No AI SDLC standards found. Consider running `/owflow:flow-init` to initialize
451
+ project documentation and coding standards for better consistency."
452
+ ```