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,51 +1,51 @@
1
- # Orchestrator Creation Checklist
2
-
3
- Use when creating NEW orchestrators or auditing existing ones. Not loaded during normal orchestrator execution.
4
-
5
- ---
6
-
7
- ## Required Elements
8
-
9
- Before considering an orchestrator complete, verify ALL items:
10
-
11
- - [ ] **Step 0: Load Framework** — Initialization reads `orchestrator-patterns.md`
12
- - [ ] **Entry Gate** — Skill body opens with the Entry Gate contract (argument resolution, prerequisite table, blocked output, skip/resume semantics — see [Gate Contract](gate-contract.md))
13
- - [ ] **Exit Gate** — Skill body closes with the Exit Gate contract (results box, results-acceptance question, next-step hint on Accept, STOP — see [Gate Contract](gate-contract.md))
14
- - [ ] **State file creation** — Explicit step to CREATE `orchestrator-state.yml`
15
- - [ ] **State verification** — Explicit step to use `verify_template` to check YAML validity after creation
16
- - [ ] **Phase structure** — Each phase has: Purpose, Execute, Output, State, Transition (`→ Pause` / `→ AUTO-CONTINUE` / `→ Conditional`)
17
- - [ ] **Delegation enforcement** — Each delegated phase has: ANTI-PATTERN block, INVOKE NOW block, SELF-CHECK
18
- - [ ] **POST-CONTINUATION blocks** — After Skill tool phases, explicit instructions to read state, update completed_phases, and continue
19
- - [ ] **Context passing** — All subagent prompts include ACCUMULATED CONTEXT section with state summaries and prior phase summaries
20
- - [ ] **Context extraction** — Each phase's State Update extracts findings to `phase_summaries`
21
- - [ ] **Decision gates** — Phases receiving `decisions_needed` present to user via question
22
- - [ ] **Interactive mode** — `question` at every `→ Pause` transition
23
- - [ ] **Standards discovery** — `.owflow/docs/INDEX.md` referenced in spec, plan, implement, verify phases
24
- - [ ] **TaskCreate initialization** — Tasks created for all phases at workflow start with `addBlockedBy` dependencies
25
- - [ ] **Auto-recovery table** — Max attempts per phase with recovery strategies
26
- - [ ] **Domain context schema** — Includes `phase_summaries` structure
27
-
28
- ---
29
-
30
- ## Anti-Patterns
31
-
32
- | Anti-Pattern | Why It's Wrong |
33
- | --------------------------------------- | --------------------------------------------------- |
34
- | Skipping Step 0 (not loading framework) | Causes AUTO-CONTINUE failures and delegation errors |
35
- | Defining phases without transitions | Ambiguous when to pause vs continue |
36
- | Implicit user prompts without question | User loses control |
37
- | Inline STOP reminders at END of phases | Easily missed; use `→ Pause` transitions instead |
38
- | Vague subagent calls ("invoke X") | Must show explicit Skill/Task tool parameters |
39
- | Inline execution to "save time" | Must delegate regardless of perceived simplicity |
40
- | File paths only in subagent prompts | Include state summaries and prior phase summaries |
41
- | Stopping at AUTO-CONTINUE transitions | Brief summary is fine, but must proceed immediately |
42
- | Missing standards references | INDEX.md must be referenced in relevant phases |
43
- | Auto-accepting subagent decisions | User must consent via question |
44
- | Ending without results-acceptance | Exit Gate question MUST fire before next-step hint |
45
-
46
- ---
47
-
48
- ## Reference
49
-
50
- - **`orchestrator-patterns.md`** — Execution rules, schemas, and patterns
51
- - **Existing orchestrators** — Use as implementation examples (development, performance, migration, research)
1
+ # Orchestrator Creation Checklist
2
+
3
+ Use when creating NEW orchestrators or auditing existing ones. Not loaded during normal orchestrator execution.
4
+
5
+ ---
6
+
7
+ ## Required Elements
8
+
9
+ Before considering an orchestrator complete, verify ALL items:
10
+
11
+ - [ ] **Step 0: Load Framework** — Initialization reads `orchestrator-patterns.md`
12
+ - [ ] **Entry Gate** — Skill body opens with the Entry Gate contract (argument resolution, prerequisite table, blocked output, skip/resume semantics — see [Gate Contract](gate-contract.md))
13
+ - [ ] **Exit Gate** — Skill body closes with the Exit Gate contract (results box, results-acceptance question, next-step hint on Accept, STOP — see [Gate Contract](gate-contract.md))
14
+ - [ ] **State file creation** — Explicit step to CREATE `orchestrator-state.yml`
15
+ - [ ] **State verification** — Explicit step to use `verify_template` to check YAML validity after creation
16
+ - [ ] **Phase structure** — Each phase has: Purpose, Execute, Output, State, Transition (`→ Pause` / `→ AUTO-CONTINUE` / `→ Conditional`)
17
+ - [ ] **Delegation enforcement** — Each delegated phase has: ANTI-PATTERN block, INVOKE NOW block, SELF-CHECK
18
+ - [ ] **POST-CONTINUATION blocks** — After Skill tool phases, explicit instructions to read state, update completed_phases, and continue
19
+ - [ ] **Context passing** — All subagent prompts include ACCUMULATED CONTEXT section with state summaries and prior phase summaries
20
+ - [ ] **Context extraction** — Each phase's State Update extracts findings to `phase_summaries`
21
+ - [ ] **Decision gates** — Phases receiving `decisions_needed` present to user via question
22
+ - [ ] **Interactive mode** — `question` at every `→ Pause` transition
23
+ - [ ] **Standards discovery** — `.owflow/docs/INDEX.md` referenced in spec, plan, implement, verify phases
24
+ - [ ] **TaskCreate initialization** — Tasks created for all phases at workflow start with `addBlockedBy` dependencies
25
+ - [ ] **Auto-recovery table** — Max attempts per phase with recovery strategies
26
+ - [ ] **Domain context schema** — Includes `phase_summaries` structure
27
+
28
+ ---
29
+
30
+ ## Anti-Patterns
31
+
32
+ | Anti-Pattern | Why It's Wrong |
33
+ | --------------------------------------- | --------------------------------------------------- |
34
+ | Skipping Step 0 (not loading framework) | Causes AUTO-CONTINUE failures and delegation errors |
35
+ | Defining phases without transitions | Ambiguous when to pause vs continue |
36
+ | Implicit user prompts without question | User loses control |
37
+ | Inline STOP reminders at END of phases | Easily missed; use `→ Pause` transitions instead |
38
+ | Vague subagent calls ("invoke X") | Must show explicit Skill/Task tool parameters |
39
+ | Inline execution to "save time" | Must delegate regardless of perceived simplicity |
40
+ | File paths only in subagent prompts | Include state summaries and prior phase summaries |
41
+ | Stopping at AUTO-CONTINUE transitions | Brief summary is fine, but must proceed immediately |
42
+ | Missing standards references | INDEX.md must be referenced in relevant phases |
43
+ | Auto-accepting subagent decisions | User must consent via question |
44
+ | Ending without results-acceptance | Exit Gate question MUST fire before next-step hint |
45
+
46
+ ---
47
+
48
+ ## Reference
49
+
50
+ - **`orchestrator-patterns.md`** — Execution rules, schemas, and patterns
51
+ - **Existing orchestrators** — Use as implementation examples (development, performance, migration, research)
@@ -1,235 +1,235 @@
1
- # Orchestrator Patterns
2
-
3
- Shared execution rules, schemas, and patterns for all workflow orchestrators.
4
-
5
- Some heavily cross-referenced sections live in their own reference files:
6
-
7
- - [Delegation Rules](delegation-rules.md) — Skill/Task tool delegation contract (was Section 1)
8
- - [Dispatcher & Handoff Pattern](dispatcher-handoff.md) — subskill loop, mode table, per-step state writes (was Section 7)
9
- - [Command Namespacing](command-namespacing.md) — `owflow:` prefix rules (was Section 8)
10
- - [Gate Contract](gate-contract.md) — Entry Gate & Exit Gate skill contract, incl. exceptions (was Section 9)
11
- - [Fix Loop Contract](fix-loop-contract.md) — user-driven fix-then-reverify contract: option wording, iteration budget, exit conditions, per-iteration state writes
12
-
13
- Section numbering below is kept as-is so existing cross-references stay valid.
14
-
15
- ---
16
-
17
- ## 2. Phase Gate Behavior
18
-
19
- **`→ Pause` means STOP and USE question.** This is NOT optional. You MUST invoke the `question` tool and WAIT for user response. Proceeding without it is a protocol violation.
20
-
21
- All orchestrators pause at `→ Pause` transitions for user review and prompt for optional phases.
22
-
23
- **State ordering rule**: Phase state MUST NOT be updated to 'completed' (via orchestrator-state.yml or TaskUpdate) until AFTER the user responds to the exit gate. Correct sequence: finish phase work → call question → receive user response → update state to completed.
24
-
25
- ### Phase Entry Checks
26
-
27
- Every phase that follows a `→ Pause` gate includes an entry check at its TOP:
28
-
29
- ```
30
- > **Phase gate**: Confirm Phase N completion before executing.
31
- ```
32
-
33
- This catches missed gates: if the previous phase's `→ Pause` was skipped (e.g., the model output a summary and moved on), the entry check forces the gate to fire before the next phase executes. If the gate already fired, continue normally.
34
-
35
- ### AUTO-CONTINUE Rules
36
-
37
- When a phase ends with `→ **AUTO-CONTINUE**`:
38
-
39
- - You MAY output a brief phase summary (1-2 lines)
40
- - Do NOT end your turn
41
- - Do NOT use question
42
- - Do NOT wait for user input
43
- - After any summary, proceed immediately to the next phase
44
-
45
- **Common mistake**: Outputting a summary and then stopping/ending the turn. The summary is fine — stopping is not.
46
-
47
- ### Anti-Patterns
48
-
49
- | Anti-Pattern | Why It's Wrong |
50
- | --------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
51
- | Proceeding without question at phase gates | User loses control, can't review or stop |
52
- | Saying "I'll pause here" without tool call | Words are not pauses. Tool invocation required. |
53
- | Auto-accepting subagent decisions without asking | User must consent to scope/approach decisions |
54
- | Outputting a summary after phase work, then ending turn before reaching `→ Pause` | Gate is skipped; user loses control at the most critical review point. The gate must be the FIRST action after phase work completes — no summaries, no output before it. |
55
- | Marking phase as completed (state/TaskUpdate) before the exit gate executes | State corruption — downstream phases see false "completed" status. Gate → user response → state update. Never reverse this order. |
56
-
57
- ---
58
-
59
- ## 3. Context Passing & Decisions
60
-
61
- ### Context Passing
62
-
63
- All subagent prompts must include context from prior phases:
64
-
65
- ```
66
- prompt: |
67
- [Task instructions]
68
- Task path: [path]
69
-
70
- ## CONTEXT FROM PRIOR PHASES
71
- [Key state fields from orchestrator-state.yml]
72
- [Summaries of completed phases from phase_summaries]
73
-
74
- ## RESEARCH CONTEXT (if research_reference exists)
75
- Research question: [research_reference.research_question]
76
- Summary: [phase_summaries.research.summary]
77
-
78
- ## ARTIFACTS TO READ
79
- [List relevant files for full details]
80
- ```
81
-
82
- **Why**: Subagents run in isolated context. Without summaries, they must re-parse entire files and miss prior decisions.
83
-
84
- ### Context Extraction
85
-
86
- After each phase, extract key findings into `[domain]_context.phase_summaries`:
87
-
88
- 1. Parse subagent output for key fields
89
- 2. Create 1-2 sentence summary
90
- 3. Update state: `[domain]_context.phase_summaries.[phase_name]`
91
-
92
- This enables context passing to downstream phases and supports resume.
93
-
94
- **Critical**: Some subagent outputs contain structured fields that control downstream phase logic (e.g., `task_characteristics` from gap-analyzer gates Phase 4 and Phase 10 defaults). These MUST be extracted and written to state immediately — not just summarized. Re-read state after writing to verify the values were stored correctly.
95
-
96
- ### Decision Enforcement
97
-
98
- When a subagent returns `decisions_needed` items, the orchestrator MUST present them to the user via question. Decisions are never silently skipped.
99
-
100
- **Anti-Patterns** (NEVER do this):
101
-
102
- | Anti-Pattern | Why It's Wrong |
103
- | ----------------------------------------------- | ---------------------------------------------------- |
104
- | "I'll accept the recommended defaults" | User loses control over critical scope decisions |
105
- | Logging decisions without asking | Documentation is not consent |
106
- | "The recommendations are clear, no need to ask" | Clarity is not consent. User may disagree. |
107
- | Skipping decisions because task seems simple | Simple tasks can have non-obvious scope implications |
108
-
109
- **Decision Gate Pattern**:
110
-
111
- 1. **Parse**: Extract all critical and important decisions from subagent output
112
- 2. **Present**: Use `question` for each critical decision; batch important decisions into multi-select
113
- 3. **SELF-CHECK**: "Did I present ALL decisions from `decisions_needed`? If not, STOP."
114
-
115
- ---
116
-
117
- ## 4. State Schema
118
-
119
- All orchestrators use `orchestrator-state.yml` at `.owflow/tasks/[type]/YYYY-MM-DD-task-name/orchestrator-state.yml`.
120
-
121
- ### Common Fields
122
-
123
- Refer to the template [src/templates/orchestrator-state-base.yml](../../../templates/orchestrator-state-base.yml).
124
-
125
- ### Extension Pattern
126
-
127
- Orchestrators add domain-specific fields using `[domain]_context`:
128
-
129
- | Domain | Context Field | Example Fields |
130
- | ----------- | --------------------- | -------------------------------------------------- |
131
- | Development | `task_context` | risk_level, ui_heavy, architecture_decision |
132
- | Performance | `performance_context` | baseline_p95, target_p95, optimizations_completed |
133
- | Migration | `migration_context` | migration_type, target_system, risk_level |
134
- | Research | `research_context` | research_type, research_question, confidence_level |
135
-
136
- See each orchestrator's SKILL.md "Domain Context" section for full schema.
137
-
138
- ### Shared: research_reference
139
-
140
- When development starts from completed research (`--research` flag):
141
-
142
- Refer to `research_reference` in the template [src/templates/orchestrator-state-development.yml](../../../templates/orchestrator-state-development.yml).
143
-
144
- Research context flows to ALL phases via context passing. Artifacts are also copied to `analysis/research-context/`.
145
-
146
- ### Shared: verification_context
147
-
148
- All orchestrators with verification phases use:
149
-
150
- Refer to `verification_context` in the template [src/templates/orchestrator-state-base.yml](../../../templates/orchestrator-state-base.yml) or domain templates.
151
-
152
- ---
153
-
154
- ## 5. Initialization & Resume
155
-
156
- ### Initialization Steps
157
-
158
- 1. **Parse arguments**: Extract description, type, entry point (`--from`), optional flags
159
- 2. **Determine starting phase**: New task starts Phase 1; resume reads state for first incomplete phase
160
- 3. **Create task directory**: Standard structure with analysis/, implementation/, verification/, documentation/ _(skip on resume)_
161
- 4. **Create state file**: `orchestrator-state.yml` _(skip on resume)_
162
- - **CRITICAL**: Use the `verify_template` tool immediately after creation to check YAML validity against the corresponding template.
163
- 5. **Create task items**: `TaskCreate` for all phases, then `TaskUpdate addBlockedBy` for dependencies. On resume, also restore completed phase statuses.
164
- 6. **Output summary**: Show task info, phases, starting message
165
-
166
- ### Task Name Generation
167
-
168
- 1. Extract 3-5 key words from description
169
- 2. Convert to lowercase kebab-case
170
- 3. Prepend current date: `YYYY-MM-DD`
171
-
172
- Examples: "Fix login timeout bug" → `2025-12-17-fix-login-timeout`
173
-
174
- ### Task Restoration on Resume
175
-
176
- Task system IDs are ephemeral to a session. On resume:
177
-
178
- 1. Create all phase tasks (same `TaskCreate` loop, all start pending)
179
- 2. Set dependencies (same `TaskUpdate addBlockedBy`)
180
- 3. Mark completed phases (`TaskUpdate` to `completed` with `metadata: {restored: true}`)
181
- 4. Update state with new task IDs
182
-
183
- ### Resume Logic
184
-
185
- 1. **Read state file** — Load `orchestrator-state.yml`
186
- 2. **Validate artifacts** — Check expected files for `completed_phases`. If missing, remove from list.
187
- 3. **Find resume point** — First phase not in `completed_phases`
188
- 4. **Check prerequisites** — Verify required artifacts exist
189
- 5. **Restore task items** — Re-create phase tasks and mark completed ones
190
-
191
- | Starting From | Required Prerequisites |
192
- | -------------- | -------------------------------- |
193
- | Gap Analysis | `analysis/codebase-analysis.md` |
194
- | Specification | `analysis/gap-analysis.md` |
195
- | Planning | `implementation/spec.md` |
196
- | Implementation | spec.md + implementation-plan.md |
197
- | Verification | Implementation complete |
198
-
199
- If prerequisites missing, use question: "Start from Phase 1", "Specify different phase", or "Exit".
200
-
201
- ---
202
-
203
- ## 6. Issue Resolution
204
-
205
- **Don't just report issues — resolve them.** Use after verification phases that return structured issues.
206
-
207
- ### Fix-Then-Reverify Loop
208
-
209
- The canonical user-driven contract — option wording, iteration budget, exit conditions, and per-iteration state writes — lives in [Fix Loop Contract](fix-loop-contract.md); skills with a fix phase reference it and document only their deltas. The generic shape:
210
-
211
- 1. Read verification results (structured issues)
212
- 2. For each issue: trivial/auto-fixable → fix silently, log action; non-trivial → question
213
- 3. If fixes applied → set `skip_test_suite: false` (code changed) → re-run verification
214
- 4. Loop until: passes OR user proceeds with known issues OR max iterations (3)
215
-
216
- ### Fixability Assessment
217
-
218
- | Likely Fixable | Likely Not Fixable |
219
- | ------------------- | -------------------------- |
220
- | Lint errors | Architecture decisions |
221
- | Formatting issues | Design trade-offs |
222
- | Missing imports | Test logic errors |
223
- | Obvious typos | Unclear requirements |
224
- | Simple config fixes | Performance tuning choices |
225
-
226
- ### Exit Conditions
227
-
228
- | Condition | Action |
229
- | ---------------------------------------- | -------------------------------------------------- |
230
- | Verification passes | Proceed to next phase |
231
- | User chooses "Proceed with known issues" | Proceed with warning logged |
232
- | Max iterations (3) reached | Ask user how to proceed |
233
- | Critical issues remain unresolved | **MUST NOT proceed** — require user approval first |
234
-
235
- ---
1
+ # Orchestrator Patterns
2
+
3
+ Shared execution rules, schemas, and patterns for all workflow orchestrators.
4
+
5
+ Some heavily cross-referenced sections live in their own reference files:
6
+
7
+ - [Delegation Rules](delegation-rules.md) — Skill/Task tool delegation contract (was Section 1)
8
+ - [Dispatcher & Handoff Pattern](dispatcher-handoff.md) — subskill loop, mode table, per-step state writes (was Section 7)
9
+ - [Command Namespacing](command-namespacing.md) — `owflow:` prefix rules (was Section 8)
10
+ - [Gate Contract](gate-contract.md) — Entry Gate & Exit Gate skill contract, incl. exceptions (was Section 9)
11
+ - [Fix Loop Contract](fix-loop-contract.md) — user-driven fix-then-reverify contract: option wording, iteration budget, exit conditions, per-iteration state writes
12
+
13
+ Section numbering below is kept as-is so existing cross-references stay valid.
14
+
15
+ ---
16
+
17
+ ## 2. Phase Gate Behavior
18
+
19
+ **`→ Pause` means STOP and USE question.** This is NOT optional. You MUST invoke the `question` tool and WAIT for user response. Proceeding without it is a protocol violation.
20
+
21
+ All orchestrators pause at `→ Pause` transitions for user review and prompt for optional phases.
22
+
23
+ **State ordering rule**: Phase state MUST NOT be updated to 'completed' (via orchestrator-state.yml or TaskUpdate) until AFTER the user responds to the exit gate. Correct sequence: finish phase work → call question → receive user response → update state to completed.
24
+
25
+ ### Phase Entry Checks
26
+
27
+ Every phase that follows a `→ Pause` gate includes an entry check at its TOP:
28
+
29
+ ```
30
+ > **Phase gate**: Confirm Phase N completion before executing.
31
+ ```
32
+
33
+ This catches missed gates: if the previous phase's `→ Pause` was skipped (e.g., the model output a summary and moved on), the entry check forces the gate to fire before the next phase executes. If the gate already fired, continue normally.
34
+
35
+ ### AUTO-CONTINUE Rules
36
+
37
+ When a phase ends with `→ **AUTO-CONTINUE**`:
38
+
39
+ - You MAY output a brief phase summary (1-2 lines)
40
+ - Do NOT end your turn
41
+ - Do NOT use question
42
+ - Do NOT wait for user input
43
+ - After any summary, proceed immediately to the next phase
44
+
45
+ **Common mistake**: Outputting a summary and then stopping/ending the turn. The summary is fine — stopping is not.
46
+
47
+ ### Anti-Patterns
48
+
49
+ | Anti-Pattern | Why It's Wrong |
50
+ | --------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
51
+ | Proceeding without question at phase gates | User loses control, can't review or stop |
52
+ | Saying "I'll pause here" without tool call | Words are not pauses. Tool invocation required. |
53
+ | Auto-accepting subagent decisions without asking | User must consent to scope/approach decisions |
54
+ | Outputting a summary after phase work, then ending turn before reaching `→ Pause` | Gate is skipped; user loses control at the most critical review point. The gate must be the FIRST action after phase work completes — no summaries, no output before it. |
55
+ | Marking phase as completed (state/TaskUpdate) before the exit gate executes | State corruption — downstream phases see false "completed" status. Gate → user response → state update. Never reverse this order. |
56
+
57
+ ---
58
+
59
+ ## 3. Context Passing & Decisions
60
+
61
+ ### Context Passing
62
+
63
+ All subagent prompts must include context from prior phases:
64
+
65
+ ```
66
+ prompt: |
67
+ [Task instructions]
68
+ Task path: [path]
69
+
70
+ ## CONTEXT FROM PRIOR PHASES
71
+ [Key state fields from orchestrator-state.yml]
72
+ [Summaries of completed phases from phase_summaries]
73
+
74
+ ## RESEARCH CONTEXT (if research_reference exists)
75
+ Research question: [research_reference.research_question]
76
+ Summary: [phase_summaries.research.summary]
77
+
78
+ ## ARTIFACTS TO READ
79
+ [List relevant files for full details]
80
+ ```
81
+
82
+ **Why**: Subagents run in isolated context. Without summaries, they must re-parse entire files and miss prior decisions.
83
+
84
+ ### Context Extraction
85
+
86
+ After each phase, extract key findings into `[domain]_context.phase_summaries`:
87
+
88
+ 1. Parse subagent output for key fields
89
+ 2. Create 1-2 sentence summary
90
+ 3. Update state: `[domain]_context.phase_summaries.[phase_name]`
91
+
92
+ This enables context passing to downstream phases and supports resume.
93
+
94
+ **Critical**: Some subagent outputs contain structured fields that control downstream phase logic (e.g., `task_characteristics` from gap-analyzer gates Phase 4 and Phase 10 defaults). These MUST be extracted and written to state immediately — not just summarized. Re-read state after writing to verify the values were stored correctly.
95
+
96
+ ### Decision Enforcement
97
+
98
+ When a subagent returns `decisions_needed` items, the orchestrator MUST present them to the user via question. Decisions are never silently skipped.
99
+
100
+ **Anti-Patterns** (NEVER do this):
101
+
102
+ | Anti-Pattern | Why It's Wrong |
103
+ | ----------------------------------------------- | ---------------------------------------------------- |
104
+ | "I'll accept the recommended defaults" | User loses control over critical scope decisions |
105
+ | Logging decisions without asking | Documentation is not consent |
106
+ | "The recommendations are clear, no need to ask" | Clarity is not consent. User may disagree. |
107
+ | Skipping decisions because task seems simple | Simple tasks can have non-obvious scope implications |
108
+
109
+ **Decision Gate Pattern**:
110
+
111
+ 1. **Parse**: Extract all critical and important decisions from subagent output
112
+ 2. **Present**: Use `question` for each critical decision; batch important decisions into multi-select
113
+ 3. **SELF-CHECK**: "Did I present ALL decisions from `decisions_needed`? If not, STOP."
114
+
115
+ ---
116
+
117
+ ## 4. State Schema
118
+
119
+ All orchestrators use `orchestrator-state.yml` at `.owflow/tasks/[type]/YYYY-MM-DD-task-name/orchestrator-state.yml`.
120
+
121
+ ### Common Fields
122
+
123
+ Refer to the template [src/templates/orchestrator-state-base.yml](../../../templates/orchestrator-state-base.yml).
124
+
125
+ ### Extension Pattern
126
+
127
+ Orchestrators add domain-specific fields using `[domain]_context`:
128
+
129
+ | Domain | Context Field | Example Fields |
130
+ | ----------- | --------------------- | -------------------------------------------------- |
131
+ | Development | `task_context` | risk_level, ui_heavy, architecture_decision |
132
+ | Performance | `performance_context` | bottlenecks_identified, user_data_available, bottleneck_priorities, task_characteristics, phase_summaries |
133
+ | Migration | `migration_context` | migration_type, target_system, risk_level |
134
+ | Research | `research_context` | research_type, research_question, confidence_level |
135
+
136
+ See each workflow's state template under `src/templates/` for the full extension schema.
137
+
138
+ ### Shared: research_reference
139
+
140
+ When development starts from completed research (`--research` flag):
141
+
142
+ Refer to `research_reference` in the template [src/templates/orchestrator-state-development.yml](../../../templates/orchestrator-state-development.yml).
143
+
144
+ Research context flows to ALL phases via context passing. Artifacts are also copied to `analysis/research-context/`.
145
+
146
+ ### Shared: verification_context
147
+
148
+ All orchestrators with verification phases use:
149
+
150
+ Refer to `verification_context` in the template [src/templates/orchestrator-state-base.yml](../../../templates/orchestrator-state-base.yml) or domain templates.
151
+
152
+ ---
153
+
154
+ ## 5. Initialization & Resume
155
+
156
+ ### Initialization Steps
157
+
158
+ 1. **Parse arguments**: Extract description, type, entry point (`--from`), optional flags
159
+ 2. **Determine starting phase**: New task starts Phase 1; resume reads state for first incomplete phase
160
+ 3. **Create task directory**: Standard structure with analysis/, implementation/, verification/, documentation/ _(skip on resume)_
161
+ 4. **Create state file**: `orchestrator-state.yml` _(skip on resume)_
162
+ - **CRITICAL**: Use the `verify_template` tool immediately after creation to check YAML validity against the corresponding template.
163
+ 5. **Create task items**: `TaskCreate` for all phases, then `TaskUpdate addBlockedBy` for dependencies. On resume, also restore completed phase statuses.
164
+ 6. **Output summary**: Show task info, phases, starting message
165
+
166
+ ### Task Name Generation
167
+
168
+ 1. Extract 3-5 key words from description
169
+ 2. Convert to lowercase kebab-case
170
+ 3. Prepend current date: `YYYY-MM-DD`
171
+
172
+ Examples: "Fix login timeout bug" → `2025-12-17-fix-login-timeout`
173
+
174
+ ### Task Restoration on Resume
175
+
176
+ Task system IDs are ephemeral to a session. On resume:
177
+
178
+ 1. Create all phase tasks (same `TaskCreate` loop, all start pending)
179
+ 2. Set dependencies (same `TaskUpdate addBlockedBy`)
180
+ 3. Mark completed phases (`TaskUpdate` to `completed` with `metadata: {restored: true}`)
181
+ 4. Update state with new task IDs
182
+
183
+ ### Resume Logic
184
+
185
+ 1. **Read state file** — Load `orchestrator-state.yml`
186
+ 2. **Validate artifacts** — Check expected files for `completed_phases`. If missing, remove from list.
187
+ 3. **Find resume point** — First phase not in `completed_phases`
188
+ 4. **Check prerequisites** — Verify required artifacts exist
189
+ 5. **Restore task items** — Re-create phase tasks and mark completed ones
190
+
191
+ | Starting From | Required Prerequisites |
192
+ | -------------- | -------------------------------- |
193
+ | Gap Analysis | `analysis/codebase-analysis.md` |
194
+ | Specification | `analysis/gap-analysis.md` |
195
+ | Planning | `implementation/spec.md` |
196
+ | Implementation | spec.md + implementation-plan.md |
197
+ | Verification | Implementation complete |
198
+
199
+ If prerequisites missing, use question: "Start from Phase 1", "Specify different phase", or "Exit".
200
+
201
+ ---
202
+
203
+ ## 6. Issue Resolution
204
+
205
+ **Don't just report issues — resolve them.** Use after verification phases that return structured issues.
206
+
207
+ ### Fix-Then-Reverify Loop
208
+
209
+ The canonical user-driven contract — option wording, iteration budget, exit conditions, and per-iteration state writes — lives in [Fix Loop Contract](fix-loop-contract.md); skills with a fix phase reference it and document only their deltas. The generic shape:
210
+
211
+ 1. Read verification results (structured issues)
212
+ 2. For each issue: trivial/auto-fixable → fix silently, log action; non-trivial → question
213
+ 3. If fixes applied → set `skip_test_suite: false` (code changed) → re-run verification
214
+ 4. Loop until: passes OR user proceeds with known issues OR max iterations (3)
215
+
216
+ ### Fixability Assessment
217
+
218
+ | Likely Fixable | Likely Not Fixable |
219
+ | ------------------- | -------------------------- |
220
+ | Lint errors | Architecture decisions |
221
+ | Formatting issues | Design trade-offs |
222
+ | Missing imports | Test logic errors |
223
+ | Obvious typos | Unclear requirements |
224
+ | Simple config fixes | Performance tuning choices |
225
+
226
+ ### Exit Conditions
227
+
228
+ | Condition | Action |
229
+ | ---------------------------------------- | -------------------------------------------------- |
230
+ | Verification passes | Proceed to next phase |
231
+ | User chooses "Proceed with known issues" | Proceed with warning logged |
232
+ | Max iterations (3) reached | Ask user how to proceed |
233
+ | Critical issues remain unresolved | **MUST NOT proceed** — require user approval first |
234
+
235
+ ---