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,437 +1,267 @@
1
- ---
2
- name: owflow:performance
3
- description: Orchestrates performance optimization workflows using static code analysis to identify bottlenecks (N+1 queries, missing indexes, O(n^2) algorithms, blocking I/O, memory leaks). Accepts optional user-provided profiling data. Reuses standard specification, planning, implementation, and verification phases.
4
- argument-hint: "[task description]"
5
- user-invocable: true
6
- ---
7
-
8
- # Performance Orchestrator
9
-
10
- Static-analysis-first performance optimization workflow. Identifies bottlenecks by reading code, then uses the standard specification/planning/implementation/verification pipeline to fix them.
11
-
12
- Gates follow the shared contract in [Gate Contract](../orchestrator-framework/references/gate-contract.md).
13
-
14
- ## Entry Gate
15
-
16
- **BEFORE executing any phase, you MUST complete these steps:**
17
-
18
- ### Argument resolution
19
-
20
- - **Performance issue description provided** → use it as the task description.
21
- - **Task path / identifier** (directory under `.owflow/tasks/performance/`) → resume mode: read `orchestrator-state.yml`, find the first incomplete phase (`--from=PHASE` overrides), validate existing artifacts, then continue from there.
22
- - **Nothing provided** → ask via `question`: "What is slow or performance-constrained? Describe the symptom (endpoint, page, job), expected vs actual behavior, and any profiling data you have." — collect the description, plus optional profiling data paths, before proceeding.
23
-
24
- ### Prerequisites
25
-
26
- | Required for this skill | Where verified | Produced by |
27
- | ----------------------- | ----------------------------------------------------- | ---------------------------- |
28
- | State file exists | `<task-path>/orchestrator-state.yml` (resume mode) | prior `/owflow:performance` run |
29
-
30
- On resume, if the state file is missing → print: `No performance task found at <path>. Run /owflow:performance <description> to start from scratch.` and STOP. Validate expected artifacts for completed phases (remove entries with missing artifacts).
31
-
32
- ### Execution steps
33
-
34
- 1. **Load framework patterns** — Read `../orchestrator-framework/references/orchestrator-patterns.md` NOW: delegation rules, interactive mode, state schema, initialization, context passing, issue resolution.
35
- 2. **Initialize workflow:**
36
- 1. **Create Task Items**: Use `TaskCreate` for all phases (see Phase Configuration), then set dependencies with `TaskUpdate addBlockedBy`
37
- 2. **Create Task Directory**: `.owflow/tasks/performance/YYYY-MM-DD-task-name/`
38
- 3. **Create Subdirectories**: `analysis/`, `analysis/user-profiling-data/`, `implementation/`, `verification/`
39
- 4. **Initialize State**: Create `orchestrator-state.yml` with performance context
40
- - **CRITICAL**: Use the `verify_template` tool immediately after creation to check YAML validity against `orchestrator-state-performance.yml`.
41
- 5. **Discover project documentation**: Read `.owflow/docs/INDEX.md` (if exists), extract ALL file paths from the "Project Documentation" section — includes predefined docs AND any user-added project docs. Store as `project_context.project_doc_paths` in state.
42
-
43
- **Output**:
44
-
45
- ```
46
- Performance Orchestrator Started
47
-
48
- Task: [performance issue description]
49
- Directory: [task-path]
50
-
51
- Starting Phase 1: Codebase Analysis...
52
- ```
53
-
54
- ---
55
-
56
- ## When to Use
57
-
58
- Use for:
59
-
60
- - Application slow (response time issues, high latency)
61
- - Need systematic bottleneck identification and resolution
62
- - Want static code analysis for performance anti-patterns
63
- - Have user-provided profiling data to act on
64
- - Database query optimization needed
65
- - Algorithm or I/O inefficiencies suspected
66
-
67
- **DO NOT use for**: New features, bug fixes, refactoring without performance goals.
68
-
69
- ---
70
-
71
- ## Core Principles
72
-
73
- 1. **Static Analysis First**: Read code to detect patterns. Don't try to run profiling tools.
74
- 2. **User Data Welcome**: Incorporate user-provided profiling data when available
75
- 3. **Reuse Standard Phases**: Use proven specification/planning/implementation/verification pipeline
76
- 4. **Conservative Estimates**: Provide improvement ranges, not false precision
77
- 5. **Practical Optimizations**: Focus on patterns the agent CAN detect and fix
78
-
79
- ---
80
-
81
- ## Phase Configuration
82
-
83
- | Phase | content | activeForm | Agent/Skill |
84
- | ----- | -------------------------------------------- | ------------------------------------------------- | ---------------------------- |
85
- | 1 | "Analyze codebase" | "Analyzing codebase" | codebase-analyzer |
86
- | 2 | "Analyze performance bottlenecks" | "Analyzing performance bottlenecks" | bottleneck-analyzer |
87
- | 3 | "Gather requirements & create specification" | "Gathering requirements & creating specification" | specification-creator |
88
- | 4 | "Audit specification" | "Auditing specification" | spec-auditor (conditional) |
89
- | 5 | "Plan implementation" | "Planning implementation" | implementation-planner |
90
- | 6 | "Execute implementation" | "Executing implementation" | implementation-plan-executor |
91
- | 7 | "Prompt verification options" | "Prompting verification options" | Direct |
92
- | 8 | "Verify implementation & resolve issues" | "Verifying implementation" | implementation-verifier |
93
- | 9 | "Finalize workflow" | "Finalizing workflow" | Direct |
94
-
95
- ---
96
-
97
- ## Workflow Phases
98
-
99
- ### Phase 1: Codebase Analysis & Clarifications
100
-
101
- **Purpose**: Comprehensive codebase exploration for performance context, followed by scope/requirements clarification
102
- **Execute**:
103
-
104
- 1. Skill tool - `codebase-analyzer`
105
- 2. Update state with analysis results
106
- 3. Direct - use question for max 5 critical clarifying questions about performance concerns, hotspots, and optimization goals
107
- 4. Save clarifications to `analysis/clarifications.md`
108
- **Output**: `analysis/codebase-analysis.md`, `analysis/clarifications.md`
109
- **State**: Update `performance_context.phase_summaries.codebase_analysis`, `task_context.clarifications_resolved`
110
-
111
- Pass `task_type="enhancement"` and the performance-focused description. The codebase-analyzer adaptively selects parallel Explore agents based on task complexity. For performance tasks, the description should guide agents toward: database query patterns, hot code paths, I/O operations, caching layers, connection management, schema/migration files.
112
-
113
- → **AUTO-CONTINUE** — Do NOT end turn, do NOT prompt user. Proceed immediately to Phase 2.
114
-
115
- ---
116
-
117
- ### Phase 2: Static Performance Analysis
118
-
119
- **Purpose**: Identify bottlenecks through static code analysis + optional user profiling data
120
- **Execute**: Task tool - `bottleneck-analyzer` subagent
121
- **Output**: `analysis/performance-analysis.md`
122
- **State**: Update `performance_context.bottlenecks_identified`, `performance_context.user_data_available`, `performance_context.bottleneck_priorities`
123
-
124
- **Process**:
125
-
126
- 1. Check if `analysis/user-profiling-data/` contains any files
127
- 2. If empty, use question:
128
- - Question: "Do you have profiling data to provide (flame graphs, APM screenshots, slow query logs)?"
129
- - Options: "Yes, let me add files to analysis/user-profiling-data/" | "No, proceed with static analysis only"
130
- 3. If user chooses to add files, wait for them, then proceed
131
-
132
- **ANTI-PATTERN — DO NOT DO THIS:**
133
-
134
- - ❌ "Let me analyze the bottlenecks myself..." — STOP. Delegate to bottleneck-analyzer.
135
- - ❌ "I'll grep for N+1 patterns..." — STOP. Delegate to bottleneck-analyzer.
136
-
137
- **INVOKE NOW** — Task tool call:
138
-
139
- 4. Task tool - `bottleneck-analyzer` subagent
140
-
141
- **Context to pass**: task_path, description, codebase analysis summary from Phase 1, user data paths (if any)
142
-
143
- **SELF-CHECK**: Did you just invoke the Task tool with `bottleneck-analyzer`? Or did you start analyzing code yourself? If the latter, STOP and invoke the Task tool.
144
-
145
- → Pause
146
-
147
- question - "Performance analysis complete. [N] bottlenecks identified ([P0 count] P0, [P1 count] P1). Continue to specification?"
148
-
149
- ---
150
-
151
- ### Phase 3: Requirements & Specification
152
-
153
- > **Phase gate**: Requires `question` confirmation from Phase 2 before executing.
154
-
155
- **Purpose**: Gather optimization requirements and create specification
156
- **Output**: `analysis/requirements.md`, `implementation/spec.md`
157
- **State**: Update `performance_context.phase_summaries.specification`
158
-
159
- **Part A — Requirements Gathering (inline)**:
160
-
161
- 1. Present bottleneck summary from Phase 2 to user
162
- 2. Use question for optimization priorities:
163
- - Which bottleneck priorities to address? (All P0+P1, P0 only, specific ones)
164
- - Any constraints? (backward compatibility, memory limits, no new dependencies)
165
- - Performance targets? (specific response time goals, if known)
166
- 3. Save gathered requirements to `analysis/requirements.md` with: performance issue description, bottleneck analysis summary, optimization priorities, constraints, targets
167
-
168
- **Part B — Specification Creation (subagent)**:
169
-
170
- 📋 **Standards Discovery**: Read `.owflow/docs/INDEX.md` before creating spec.
171
-
172
- **ANTI-PATTERN — DO NOT DO THIS:**
173
-
174
- - ❌ "Let me create the specification..." — STOP. Delegate to specification-creator.
175
- - ❌ "I'll write the spec based on the analysis..." — STOP. Delegate to specification-creator.
176
-
177
- **INVOKE NOW** — Task tool call:
178
-
179
- 4. Task tool - `specification-creator` subagent
180
-
181
- **Context to pass**: task_path, task_type="performance", task_description, requirements_path (analysis/requirements.md), project_context_paths (INDEX.md + project_doc_paths from state — all discovered project docs), phase_summaries (codebase_analysis, bottleneck_analysis)
182
-
183
- **SELF-CHECK**: Did you just invoke the Task tool with `specification-creator`? Or did you start writing spec.md yourself? If the latter, STOP and invoke the Task tool.
184
-
185
- **Part C — Diagram Refinement (Skill, content-preserving)**:
186
-
187
- 5. Invoke Skill tool: `diagrams-mermaid` to refine `implementation/spec.md`
188
- 6. Add diagrams that clarify bottleneck flows and optimization boundaries without replacing specification text.
189
- 7. If context for a diagram is missing, document gaps and avoid speculative dependencies.
190
-
191
- → Pause
192
-
193
- question - Display executive summary before asking. Read `implementation/spec.md` and extract: optimization targets, approach chosen, number of changes planned, expected impact. Format as brief overview then "Continue to specification audit?"
194
-
195
- ---
196
-
197
- ### Phase 4: Specification Audit (Conditional)
198
-
199
- > **Phase gate**: Requires `question` confirmation from Phase 3 before executing.
200
-
201
- **Purpose**: Independent review of optimization specification
202
- **Execute**: Task tool - `spec-auditor` subagent
203
- **Output**: `verification/spec-audit.md`
204
- **State**: Update `options.spec_audit_enabled`
205
-
206
- **Run if**: >5 optimizations planned, spec >50 lines, or user requests
207
- **Skip if**: Simple optimization (1-3 changes)
208
-
209
- question to decide - "Run specification audit?"
210
-
211
- → Pause
212
-
213
- question - Display executive summary before asking. Read `verification/spec-audit.md` and extract: overall verdict, issue counts by severity, top findings. Format as brief overview then "Continue to implementation planning?"
214
-
215
- ---
216
-
217
- ### Phase 5: Implementation Planning
218
-
219
- > **Phase gate**: Requires `question` confirmation from Phase 4 before executing.
220
-
221
- **Purpose**: Break optimization specification into implementation steps
222
-
223
- 📋 **Standards Discovery**: Read `.owflow/docs/INDEX.md` before planning.
224
-
225
- **ANTI-PATTERN — DO NOT DO THIS:**
226
-
227
- - ❌ "Let me create the implementation plan..." — STOP. Delegate to implementation-planner.
228
- - ❌ "I'll break this into optimization steps..." — STOP. Delegate to implementation-planner.
229
-
230
- **INVOKE NOW** — Task tool call:
231
-
232
- **Execute**: Task tool - `implementation-planner` subagent
233
- **Output**: `implementation/implementation-plan.md`
234
- **State**: Update task groups and dependencies
235
-
236
- **Context to pass**: task_path, task_type="performance", task_description, phase_summaries (specification, bottleneck_analysis, codebase_analysis)
237
-
238
- **SELF-CHECK**: Did you just invoke the Task tool with `implementation-planner`? Or did you start writing the plan yourself? If the latter, STOP and invoke the Task tool.
239
-
240
- **Post-plan diagram refinement (Skill, content-preserving)**:
241
-
242
- - Invoke Skill tool: `diagrams-mermaid` for `implementation/implementation-plan.md`
243
- - Add one compact optimization execution flow (task-group dependency or state flow).
244
- - Keep plan steps authoritative; diagrams are explanatory additions only.
245
-
246
- → Pause
247
-
248
- question - Display executive summary before asking. Read `implementation/implementation-plan.md` and extract: number of task groups, total steps, key dependencies, optimization sequence. Format as brief overview then "Continue to implementation?"
249
-
250
- ---
251
-
252
- ### Phase 6: Implementation
253
-
254
- > **Phase gate**: Requires `question` confirmation from Phase 5 before executing.
255
-
256
- **Purpose**: Execute the optimization plan
257
-
258
- 📋 **Standards Discovery**: Implementation reads `.owflow/docs/INDEX.md` continuously.
259
-
260
- **ANTI-PATTERN — DO NOT DO THIS:**
261
-
262
- - ❌ "Let me implement this directly..." — STOP. Delegate to implementation-plan-executor.
263
- - ❌ "This is simple enough to code inline..." — STOP. Simplicity is NOT a reason to skip delegation.
264
-
265
- **INVOKE NOW** — Skill tool call:
266
-
267
- **Execute**: Skill tool - `implementation-plan-executor`
268
- **Output**: Implemented optimizations, `implementation/work-log.md`
269
- **State**: Update implementation progress, extract phase_summaries.implementation
270
-
271
- **SELF-CHECK**: Did you just invoke the Skill tool with `implementation-plan-executor`? Or did you start writing code yourself? If the latter, STOP immediately and invoke the Skill tool instead.
272
-
273
- **⚠️ POST-IMPLEMENTATION CONTINUATION** — After the skill completes and returns control:
274
-
275
- 1. Read `orchestrator-state.yml` to confirm you are the orchestrator
276
- 2. Update state: add Phase 6 to `completed_phases`
277
- 3. Proceed to Phase 7
278
-
279
- → Pause
280
-
281
- question - Display executive summary before asking. Extract from `phase_summaries.implementation` and `implementation/work-log.md`: optimizations applied, files changed, test results, any known issues. Format as brief overview then "Continue to verification?"
282
-
283
- ---
284
-
285
- ### Phase 7: Verification Options
286
-
287
- > **Phase gate**: Requires `question` confirmation from Phase 6 before executing.
288
-
289
- **Purpose**: Determine which verification checks to run
290
- **Execute**: Direct - use question for options
291
- **Output**: Updated state with verification options
292
- **State**: Set `options.code_review_enabled`, `options.pragmatic_review_enabled`, `options.production_check_enabled`, `options.reality_check_enabled`
293
-
294
- **Always enabled**: Reality check, pragmatic review
295
- **Auto-set**: `skip_test_suite: true` (full test suite already passed during implementation phase; cleared before re-verification if fixes are applied)
296
-
297
- question with multiselect - "Which additional verification checks?"
298
-
299
- - "Code review" (recommended)
300
- - "Production readiness check"
301
-
302
- → Pause
303
-
304
- question - "Options selected. Continue to Phase 8?"
305
-
306
- ---
307
-
308
- ### Phase 8: Verification & Issue Resolution
309
-
310
- > **Phase gate**: Requires `question` confirmation from Phase 7 before executing.
311
-
312
- **Purpose**: Comprehensive implementation verification with user-driven fix cycles
313
- **Output**: `verification/implementation-verification.md`, optional review reports
314
- **State**: Update `verification_context`
315
-
316
- **Execute**:
317
-
318
- **Step 1**: Invoke Skill tool - `implementation-verifier`
319
-
320
- **Step 2**: Display detailed issue breakdown grouped by category and severity (critical/warning/info), listing location, description, and fixability for each.
321
-
322
- **Step 3**: Gate on verification status:
323
-
324
- - `status: passed` → skip to Pause
325
- - `status: passed_with_issues` or `failed` → enter user-driven fix loop (Step 4)
326
-
327
- **Step 4**: User-driven fix loop (max 3 iterations):
328
-
329
- 1. Present all critical + warning issues as a numbered list
330
- 2. question — "Which issues should I fix?" with options: "Fix all fixable issues" / "Let me choose specific issues" / "Skip fixes, proceed as-is"
331
- 3. Fix selected issues
332
- 4. After fixes: set `skip_test_suite: false` (code changed, tests must re-run)
333
- 5. question — "Re-run verification to check fixes?" with options: "Yes, re-run verification" / "No, proceed to next phase"
334
- 6. If re-run → re-invoke `implementation-verifier` → return to Step 2
335
-
336
- → Pause
337
-
338
- question - Display executive summary: total issues found, issues fixed, issues remaining by severity. Then "Continue to finalization?"
339
-
340
- ---
341
-
342
- ### Phase 9: Finalization → Exit Gate
343
-
344
- > **Phase gate**: Requires `question` confirmation from Phase 8 before executing.
345
-
346
- **Purpose**: Present optimization results, confirm correctness with the user, and close the workflow (Exit Gate contract, [Gate Contract](../orchestrator-framework/references/gate-contract.md))
347
- **Execute**: Direct - create summary, update state, guide commit
348
- **Output**: Workflow summary
349
- **State**: Set `task.status: completed`
350
-
351
- **Process**:
352
-
353
- 1. Create workflow summary (bottlenecks found, optimizations implemented, verification result)
354
- 2. Update task status to "completed"
355
- 3. **Results box**:
356
-
357
- ```markdown
358
- ## ✅ PERFORMANCE WORKFLOW COMPLETE — <task name>
359
-
360
- **Bottlenecks found** — [count by severity]
361
- **Optimizations applied** — [count + key ones]
362
- **Verification** — [final verdict]
363
- **Estimated improvement** — [range from analysis]
364
-
365
- **Artifacts**
366
- - `analysis/performance-analysis.md`
367
- - `implementation/work-log.md`
368
- - `verification/implementation-verification.md`
369
- ```
370
-
371
- 4. **Results-acceptance question** — use `question` — "Are these results correct?" with options:
372
- - **Accept** — workflow is complete; print next steps below.
373
- - **Adjust** — re-run the affected phase (additional optimizations, re-verification) with the user's corrections, then re-present the results box.
374
- - **Discuss** — walk through bottleneck findings, optimization rationale, and measurement caveats in more depth; then re-ask.
375
- - **Stop here** — print the resume command (`/owflow:performance <task-path>`) and end.
376
-
377
- 5. **Next steps (after Accept)** — performance-specific guidance:
378
- - Run the application and verify improvements manually
379
- - Consider profiling with runtime tools to measure actual impact
380
- - Monitor production metrics after deployment
381
- - Address remaining P2/P3 bottlenecks if needed
382
- - `/owflow:standards-update "<lesson learned>"` — capture optimization patterns as standards
383
-
384
- → End of workflow
385
-
386
- ---
387
-
388
- ## Domain Context (State Extensions)
389
-
390
- Performance-specific fields in `orchestrator-state.yml`:
391
-
392
- Refer to the template [src/templates/orchestrator-state-performance.yml](../../templates/orchestrator-state-performance.yml).
393
-
394
- ---
395
-
396
- ## Task Structure
397
-
398
- ```
399
- .owflow/tasks/performance/YYYY-MM-DD-task-name/
400
- ├── orchestrator-state.yml
401
- ├── analysis/
402
- │ ├── codebase-analysis.md # Phase 1
403
- │ ├── performance-analysis.md # Phase 2
404
- │ ├── user-profiling-data/ # Optional user-provided data
405
- │ └── requirements.md # Phase 3
406
- ├── implementation/
407
- │ ├── spec.md # Phase 3
408
- │ ├── implementation-plan.md # Phase 5
409
- │ └── work-log.md # Phase 6
410
- └── verification/
411
- ├── spec-audit.md # Phase 4 (conditional)
412
- └── implementation-verification.md # Phase 8
413
- ```
414
-
415
- ---
416
-
417
- ## Auto-Recovery
418
-
419
- | Phase | Max Attempts | Strategy |
420
- | ----- | ------------ | ------------------------------------------ |
421
- | 1 | 2 | Expand search scope, prompt user for hints |
422
- | 2 | 2 | Re-analyze with broader patterns, ask user |
423
- | 3 | 2 | Regenerate spec with adjusted requirements |
424
- | 5 | 2 | Regenerate plan |
425
- | 6 | 5 | Fix syntax, imports, tests |
426
- | 8 | 3 | Fix-then-reverify cycles |
427
-
428
- ---
429
-
430
- ## Command Integration
431
-
432
- Invoked via:
433
-
434
- - `/owflow:performance [description]` (new)
435
- - `/owflow:performance [task-path] [--from=PHASE]` (resume)
436
-
437
- Task directory: `.owflow/tasks/performance/YYYY-MM-DD-task-name/`
1
+ ---
2
+ name: owflow:performance
3
+ description: Performance workflow dispatcher. Initializes/resumes performance tasks, derives the next step from state, and hands off to the matching /owflow:performance-* subskill. Static-analysis-first bottleneck identification (N+1 queries, missing indexes, O(n^2) algorithms, blocking I/O, memory leaks) with optional user-provided profiling data.
4
+ argument-hint: "[task description | task-path] [--from=<step-slug>]"
5
+ user-invocable: true
6
+ ---
7
+
8
+ # Performance Dispatcher
9
+
10
+ Entry point for performance tasks in **assisted mode**: initialize (or resume) the task, derive the next pending step from `orchestrator-state.yml`, print the matching subskill command, and STOP. Each `/owflow:performance-*` subskill runs its steps with fresh context — the explicit invocation IS the step gate. The dispatcher owns only initialization (task directory, state, six task items) and the drop-only resume trim; every task artifact is produced by the subskills (see [Task Structure](#task-structure)).
11
+
12
+ Performance state uses descriptive step slugs in `completed_phases` / `failed_phases` / `auto_fix_attempts`: `codebase-analysed`, `bottlenecks-identified`, `spec-written`, `spec-audited` (conditional), `plan-created`, `implementation-done`, `options-chosen`, `verification-done`, `task-completed`. The routing table below maps slugs to subskills.
13
+
14
+ For the all-in-one loop with in-session `question` gates, use `/owflow:goal-performance`.
15
+
16
+ Gates follow the shared contract in the [Gate Contract](../orchestrator-framework/references/gate-contract.md), with the [dispatcher exception](../orchestrator-framework/references/gate-contract.md#exceptions).
17
+
18
+ ## Entry Gate
19
+
20
+ **BEFORE deriving the handoff, complete these steps:**
21
+
22
+ ### Step 1: Load Framework Patterns
23
+
24
+ **Read the framework reference files NOW using the Read tool:**
25
+
26
+ 1. The [Dispatcher & Handoff Pattern](../orchestrator-framework/references/dispatcher-handoff.md) governs this skill.
27
+ 2. The [Delegation Rules](../orchestrator-framework/references/delegation-rules.md) bound what subskills delegate.
28
+ 3. The [Orchestrator Patterns](../orchestrator-framework/references/orchestrator-patterns.md) define state schema, initialization, and context passing.
29
+
30
+ ### Step 2: Resolve the Argument
31
+
32
+ **If the argument is a task path or identifier** (a directory, or a directory name under `.owflow/tasks/performance/`) → **resume mode**:
33
+
34
+ 1. Read `orchestrator-state.yml`.
35
+ 2. **Resume validation (drop-only)** — before `completed_phases` is trusted, validate every entry against the two-kind resume table below; an entry whose marker is missing is DROPPED. The path never repairs or re-keys state.
36
+ 3. Derive the next handoff with the Routing Table below.
37
+ 4. `--from=<step-slug>` overrides the derived step — validate the target's upstream conditions exist (per the routing table and the target subskill's Entry Gate), else use `question` to confirm or cancel. An unknown slug → print the 9 accepted slugs and STOP.
38
+ 5. Missing state file → print: `No performance task found at <path>. Run /owflow:performance <description> to start a task from scratch.` and STOP.
39
+
40
+ **If the argument is a performance issue description** (any other free text) → new task.
41
+
42
+ **If nothing is provided** → ask via `question`: "What is slow or performance-constrained? Describe the symptom (endpoint, page, job), expected vs actual behavior, and any profiling data you have." — collect the description, plus optional profiling data paths, then WAIT. Never guess or auto-pick a task.
43
+
44
+ ### Step 3: Initialize (new task)
45
+
46
+ 1. **Create Task Directory**: `.owflow/tasks/performance/YYYY-MM-DD-task-name/` (3-5 kebab-case words from the description)
47
+ 2. **Create Subdirectories**: `analysis/`, `analysis/user-profiling-data/`, `implementation/`, `verification/`
48
+ 3. **Initialize State**: create `orchestrator-state.yml` from the performance template — `task.title` / `task.description` from the description, `task.status: in_progress`, `orchestrator.task_path`, `orchestrator.entry_point: "performance"` (template/bootstrap mechanic). Discover project documentation: read `.owflow/docs/INDEX.md` (if exists), extract ALL file paths from the "Project Documentation" section, and store them as `performance_context.project_doc_paths` in state.
49
+ - **CRITICAL**: use the `verify_template` tool immediately after creation to check YAML validity against `orchestrator-state-performance.yml`.
50
+ 4. **Create Task Items**: use `TaskCreate` for the six subskill handoffs (one item each, per the Task Configuration table), then set the execution order with `TaskUpdate addBlockedBy` (analyze → spec → plan → implement → verify → finalize). Record every created item's id in `orchestrator.task_ids` — the `goal-performance` wrapper updates these same ids at each hop instead of creating its own. On resume, refresh the already-evidenced items instead of re-creating them.
51
+
52
+ **Output**:
53
+
54
+ ```
55
+ 🚀 Performance Dispatcher
56
+
57
+ Task: [performance issue description]
58
+ Directory: [task-path]
59
+ Next step: [step name]
60
+ ```
61
+
62
+ ---
63
+
64
+ ## When to Use
65
+
66
+ Use for:
67
+
68
+ - Application slow (response time issues, high latency)
69
+ - Need systematic bottleneck identification and resolution
70
+ - Want static code analysis for performance anti-patterns
71
+ - Have user-provided profiling data to act on
72
+ - Database query optimization needed
73
+ - Algorithm or I/O inefficiencies suspected
74
+
75
+ **DO NOT use for**: New features, bug fixes, refactoring without performance goals.
76
+
77
+ ---
78
+
79
+ ## Core Principles
80
+
81
+ 1. **Static Analysis First**: Read code to detect patterns. Don't try to run profiling tools.
82
+ 2. **User Data Welcome**: Incorporate user-provided profiling data when available
83
+ 3. **Subskill Pipeline**: The optimization pipeline is the six `/owflow:performance-*` subskills — analyze → spec → plan → implement → verify → finalize — not inline phases; this dispatcher only routes.
84
+ 4. **Conservative Estimates**: Provide improvement ranges, not false precision
85
+ 5. **Practical Optimizations**: Focus on patterns the agent CAN detect and fix
86
+
87
+ ---
88
+
89
+ ## Task Configuration
90
+
91
+ One task item per subskill handoff (`TaskCreate` at init; ordered with `addBlockedBy`):
92
+
93
+ | Subskill | Slugs owned (frozen) | Task item content | Engine(s) |
94
+ | --- | --- | --- | --- |
95
+ | `performance-analyze` | `codebase-analysed`, `bottlenecks-identified` | "Analyze codebase & bottlenecks" | Skill `codebase-analyzer`; Task `bottleneck-analyzer` |
96
+ | `performance-spec` | `spec-written`, `spec-audited` (conditional) | "Gather requirements & create specification" | Task `specification-creator`; Task `spec-auditor`; Skill `diagrams-mermaid` |
97
+ | `performance-plan` | `plan-created` | "Plan implementation" | Task `implementation-planner`; Skill `diagrams-mermaid` |
98
+ | `performance-implement` | `implementation-done` | "Execute implementation" | Skill `implementation-plan-executor` |
99
+ | `performance-verify` | `options-chosen`, `verification-done` | "Verify implementation & resolve issues" | Skill `implementation-verifier` |
100
+ | `performance-finalize` | `task-completed` | "Finalize workflow" | Direct (inline-legal) |
101
+
102
+ ---
103
+
104
+ ## Routing Table (completed_phases → next subskill)
105
+
106
+ Every row is evaluated in order; the first matching row wins. **Every condition includes the absence of its own slug(s)** (the absence clause), the evaluation order is **total** (a fallback row closes it), and **the first-missing-slug heuristic is retired** for this table — see the routing rules below.
107
+
108
+ | # | Subskill (slugs owned) | Routes here when | Handoff command |
109
+ | --- | --- | --- | --- |
110
+ | 1 | `performance-analyze` (`codebase-analysed`, `bottlenecks-identified`) | new task, OR `codebase-analysed` absent, OR (`codebase-analysed` present AND `bottlenecks-identified` absent) | `/owflow:performance-analyze <task-path>` |
111
+ | 2 | `performance-spec` (`spec-written`, `spec-audited`) | `bottlenecks-identified` complete AND [ (`spec-written` absent) OR (`spec-audited` absent AND (`options.spec_audit_enabled` is **null OR `true`**)) ] | `/owflow:performance-spec <task-path>` |
112
+ | 3 | **`performance-plan`** (`plan-created`) | **`spec-written` complete AND `options.spec_audit_enabled` is non-null — the audit decision is settled — AND `plan-created` absent.** Never `spec-audited`. | `/owflow:performance-plan <task-path>` |
113
+ | 4 | `performance-implement` (`implementation-done`) | `plan-created` complete AND `implementation-done` absent | `/owflow:performance-implement <task-path>` |
114
+ | 5 | `performance-verify` (`options-chosen`, `verification-done`) | `implementation-done` complete AND [ `options-chosen` absent OR `verification-done` absent ] | `/owflow:performance-verify <task-path>` |
115
+ | 6 | `performance-finalize` (`task-completed`) | `verification-done` complete AND `task-completed` absent | `/owflow:performance-finalize <task-path>` |
116
+ | T | terminal | `task-completed` complete (validated by `task.status: completed`) → **no handoff**; report the task as done | — |
117
+ | F | **fallback** | **no row above matched** (anomalous state — e.g. `SW ∧ SA ∧ spec_audit_enabled: null`, or slugs present out of order after a hand-edited state). Report the state that failed to route, then route to `/owflow:performance-analyze <task-path>` | `/owflow:performance-analyze <task-path>` |
118
+
119
+ **Routing rules, normative.** These four sentences ship verbatim in the dispatcher; they are the guard's defense against its own simplification:
120
+
121
+ 1. **Absence clause** — each row that *advances* the pipeline requires its own slugs to be absent from `completed_phases` (rows 1, 2, 3, 4, 6; row 5 is a re-entry row and requires only the sub-step it owns to be outstanding). No row ever fires on the strength of its own slug already being present.
122
+ 2. **Row 2 re-enters `performance-spec` while the audit decision is undecided** (`spec_audit_enabled` null) *and* when it is decided-yes with no `spec-audited` slug; `performance-spec`'s own skip/resume rule settles it — re-ask only while the decision is `null`, never once it is non-null.
123
+ 3. **Row 3 requires a settled decision** (`spec_audit_enabled` non-null), never the `spec-audited` slug. Audit-skipped therefore falls through to row 3 instead of looping.
124
+ 4. **The first-missing-slug heuristic used by both shipped dispatchers is retired for this table** (`development/SKILL.md:87`, `research/SKILL.md:100`) and must not be reintroduced — the conditional audit makes row 2 a three-way disjunction. Any edit that collapses rows 2–3 back to a single "first missing slug" rule reintroduces the audit-skip resume loop.
125
+
126
+ **Why the fallback exists, stated honestly.** Its purpose is **totality**: a total routing function never leaves the user without a command. Its destination is row 1's destination, and that destination is **not** guaranteed to block — row 1 can only fail when `codebase-analysed` ∧ `bottlenecks-identified` are both recorded, which means both analyze marker artifacts exist, so `performance-analyze`'s Entry Gate would *pass*. F therefore guarantees a defined, reported destination; it does not itself guarantee that a prerequisite check will stop the flow. The states F actually catches are the unreachable-by-design ones (`spec-written` ∧ `spec-audited` with the decision `null`) and hand-edited states — in both cases re-running analyze is the safe, reversible move.
127
+
128
+ Every reachable state routes to exactly one handoff:
129
+
130
+ | Reachable state | Matching row | Handoff |
131
+ | --- | --- | --- |
132
+ | new task, or analyze step 1 done (`codebase-analysed` absent) | 1 | `performance-analyze` |
133
+ | analyze done, `bottlenecks-identified` absent | 1 | `performance-analyze` |
134
+ | **spec step 1 done, audit decision still `null`** | **2** | **`performance-spec` (asks the audit decision)** |
135
+ | audit decided `true`, `spec-audited` absent | 2 | `performance-spec` (audit sub-step) |
136
+ | audit ran (`spec-audited` present, decision `true`) | 3 | `performance-plan` |
137
+ | audit skipped (decision `false`, no `spec-audited`) | 3 | `performance-plan` |
138
+ | `plan-created` present, `implementation-done` absent | 4 | `performance-implement` |
139
+ | `implementation-done` present, `options-chosen` absent | 5 | `performance-verify` (asks options) |
140
+ | `options-chosen` present, `verification-done` absent | 5 | `performance-verify` (idempotence rule) |
141
+ | `verification-done` present, `task-completed` absent | 6 | `performance-finalize` |
142
+ | all 9 slugs, `task.status: completed` | T | none — done |
143
+ | anomalous (unreachable-by-design, e.g. `SW ∧ SA` with decision `null`; or slugs out of order) | F | `performance-analyze`, with the failing state reported |
144
+
145
+ Row 2's two-part condition is what makes the audit a first-class routable outcome in **all three** directions: `null` → stays in `performance-spec` to settle the decision; `true` + `spec-audited` missing → routes into the audit sub-step; `false`, or `true` + `spec-audited` present → falls through to row 3.
146
+
147
+ ### Resume Validation — the two-kind table
148
+
149
+ Applied on every resume, before `completed_phases` is trusted (`gate-contract.md:28`). An entry whose marker is missing is dropped; artifacts beat state.
150
+
151
+ | Slug | Validated against | Kind |
152
+ | --- | --- | --- |
153
+ | `codebase-analysed` | `analysis/codebase-analysis.md` | file |
154
+ | `bottlenecks-identified` | `analysis/performance-analysis.md` | file |
155
+ | `spec-written` | `implementation/spec.md` | file |
156
+ | `spec-audited` | `verification/spec-audit.md` | file (conditional) |
157
+ | `plan-created` | `implementation/implementation-plan.md` | file |
158
+ | `implementation-done` | `implementation/work-log.md` | file |
159
+ | `options-chosen` | at least one non-null `orchestrator.options.*` review flag | **state predicate — vacuous, see note** |
160
+ | `verification-done` | `verification/implementation-verification.md` | file |
161
+ | `task-completed` | `task.status: completed` | **state predicate** |
162
+
163
+ **The `options-chosen` predicate is vacuous against this template — recorded, not fixed (Known Limitation #11).** The template ships `code_review_enabled: true`, `pragmatic_review_enabled: true` and `reality_check_enabled: true`, so "at least one non-null `options.*` review flag" is true on a **brand-new** state, before the user has chosen anything. The predicate therefore never drops a stale `options-chosen` entry, and the safeguard is delivered by other means: `performance-verify` owns the slug, its Entry Gate routes on the slug itself, and its idempotence rule governs the re-entry. Narrowing the predicate to a value the template cannot pre-satisfy would require a dedicated marker artifact — new scope, and D1 is settled, so it is **recorded as Known Limitation #11** instead. `task-completed`'s predicate (`task.status: completed` against a `pending` default) *does* discriminate and is sound.
164
+
165
+ ---
166
+
167
+ ## Checklist Waivers (routing-only dispatcher)
168
+
169
+ This dispatcher records explicit, named waivers against [Orchestrator Creation Checklist](../orchestrator-framework/references/orchestrator-creation-checklist.md) items written for a monolith-shaped orchestrator with inline phases; a routing-only dispatcher cannot satisfy them because it executes no phase bodies and delegates nothing:
170
+
171
+ | Checklist item | Disposition | Why |
172
+ | --- | --- | --- |
173
+ | `:16` Phase structure (Purpose / Execute / Output / State / Transition per phase) | Waived | No phase bodies here — the 6 subskills own Execute/Output/State, and Entry/Exit Gates own transitions. |
174
+ | `:17` Delegation enforcement (ANTI-PATTERN / INVOKE NOW / SELF-CHECK per delegated phase) | Waived | The dispatcher spawns no subagents; delegation blocks live in the subskills that delegate. |
175
+ | `:18` POST-CONTINUATION blocks | Waived | No Skill-tool phase runs here; each subskill appends its own slugs. |
176
+ | `:19` Context passing (accumulated context in subagent prompts) | Waived by the same clause as `:17` | Unsatisfiable for the same reason: no subagents are spawned here. |
177
+ | `:20` Context extraction (per-phase `phase_summaries`) | Waived | Extraction happens per step inside the subskills. |
178
+ | `:21` Decision gates (`decisions_needed` presented via `question`) | Waived | The dispatcher receives none; the subskills own their decision questions. |
179
+ | `:22` `question` at every `→ Pause` | Waived | No `→ Pause` transitions exist — routing prints one command and STOPS; the explicit invocation is the gate. |
180
+ | `:25` Auto-recovery table | Waived | Retries are owned per subskill (each `performance-*` SKILL.md carries its own `## Recovery` table). |
181
+ | `:24` TaskCreate initialization | **Satisfied, not waived** | The dispatcher creates the six task items with `addBlockedBy` at init and records their ids in `orchestrator.task_ids`; the wrapper only updates those ids. |
182
+
183
+ ---
184
+
185
+ ## Exit Gate (adapted for dispatch mode)
186
+
187
+ After deriving the handoff, present the results box, ask how to proceed, then hand off accordingly (see the [dispatcher exception](../orchestrator-framework/references/gate-contract.md)). The results box IS the handoff block. Never auto-invoke the subskill.
188
+
189
+ ### Results box
190
+
191
+ ```markdown
192
+ ## ✅ PERFORMANCE TASK READY — <task name>
193
+
194
+ **Task** — [performance issue description]
195
+ **Directory** — `<task-path>`
196
+ **Next step** — [subskill + slug(s)]
197
+ [Resume note: completed steps / fresh task]
198
+
199
+ **Next ▸** `/owflow:performance-<subskill> <task-path>`
200
+ ```
201
+
202
+ ### Acceptance question
203
+
204
+ Use `question` — "Task ready. How would you like to proceed?" with options:
205
+
206
+ - **Hand off to /owflow:performance-<subskill>** — the user invokes the suggested command (the dispatcher copies it to chat for convenience). Execution starts in a fresh context.
207
+ - **Switch to autonomous mode** — run the remaining steps in one session: `/owflow:goal-performance <task-path>`.
208
+ - **Adjust** — task set-up or derivation is wrong (wrong description, wrong task, wrong `--from`); re-run the affected step, re-present the results box.
209
+ - **Stop here** — print the resume command (`/owflow:performance <task-path>`) and end.
210
+
211
+ ### Handoff message
212
+
213
+ On Accept (hand off choice), print, then STOP:
214
+
215
+ ```
216
+ ✓ Performance task ready at <task-path>
217
+
218
+ Next step:
219
+ → /owflow:performance-<subskill> <task-path>
220
+
221
+ Other options:
222
+ /owflow:goal-performance <task-path> — run remaining steps in one loop
223
+ /owflow:performance --from=<step-slug> <task-path> — jump to a specific step
224
+ ```
225
+
226
+ ---
227
+
228
+ ## Task Structure
229
+
230
+ The dispatcher creates the directory skeleton at init; every artifact below is produced by the subskill named in the comments:
231
+
232
+ ```
233
+ .owflow/tasks/performance/YYYY-MM-DD-task-name/
234
+ ├── orchestrator-state.yml # dispatcher (init) + every subskill (per-step writes)
235
+ ├── analysis/
236
+ │ ├── codebase-analysis.md # performance-analyze (codebase-analysed)
237
+ │ ├── clarifications.md # performance-analyze
238
+ │ ├── performance-analysis.md # performance-analyze (bottlenecks-identified)
239
+ │ ├── requirements.md # performance-spec
240
+ │ └── user-profiling-data/ # optional user-provided data
241
+ ├── implementation/
242
+ │ ├── spec.md # performance-spec (spec-written)
243
+ │ ├── implementation-plan.md # performance-plan (plan-created)
244
+ │ └── work-log.md # performance-implement (implementation-done)
245
+ └── verification/
246
+ ├── spec-audit.md # performance-spec (spec-audited, conditional)
247
+ └── implementation-verification.md # performance-verify (verification-done)
248
+ ```
249
+
250
+ ---
251
+
252
+ ## Auto-Recovery
253
+
254
+ Retries are owned by each subskill (each `/owflow:performance-*` SKILL.md carries its own `## Recovery` table).
255
+
256
+ ---
257
+
258
+ ## Command Integration
259
+
260
+ Invoked via:
261
+
262
+ - `/owflow:performance [description]` (new)
263
+ - `/owflow:performance [task-path] [--from=<step-slug>]` (resume)
264
+
265
+ Alternative: `/owflow:goal-performance <task-path>` — same task lifecycle, all subskills invoked in one session with `question` gates.
266
+
267
+ Task directory: `.owflow/tasks/performance/YYYY-MM-DD-task-name/`