owflow 0.2.0 → 0.4.2

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 (111) hide show
  1. package/README.md +83 -28
  2. package/dist/agents/code-reviewer.md +1 -1
  3. package/dist/agents/information-gatherer.md +691 -691
  4. package/dist/agents/production-readiness-checker.md +1 -1
  5. package/dist/agents/project-analyzer.md +0 -1
  6. package/dist/agents/research-planner.md +450 -447
  7. package/dist/agents/research-synthesizer.md +403 -401
  8. package/dist/agents/solution-brainstormer.md +257 -257
  9. package/dist/agents/solution-designer.md +372 -372
  10. package/dist/agents/task-classifier.md +3 -3
  11. package/dist/commands/agents-md-generator.md +36 -0
  12. package/dist/commands/dev-analyze.md +33 -0
  13. package/dist/commands/dev-bugfix.md +37 -0
  14. package/dist/commands/dev-finalize.md +33 -0
  15. package/dist/commands/dev-implement.md +34 -0
  16. package/dist/commands/dev-plan.md +37 -0
  17. package/dist/commands/dev-spec.md +37 -0
  18. package/dist/commands/dev-tdd-red.md +33 -0
  19. package/dist/commands/dev-verify.md +33 -0
  20. package/dist/commands/development.md +11 -12
  21. package/dist/commands/diagrams-mermaid.md +3 -4
  22. package/dist/commands/flow-init.md +3 -4
  23. package/dist/commands/goal-development.md +32 -0
  24. package/dist/commands/goal-research.md +33 -0
  25. package/dist/commands/html-renderer.md +3 -4
  26. package/dist/commands/migration.md +3 -4
  27. package/dist/commands/performance.md +3 -4
  28. package/dist/commands/research-brainstorm.md +33 -0
  29. package/dist/commands/research-converge.md +33 -0
  30. package/dist/commands/research-design.md +33 -0
  31. package/dist/commands/research-finalize.md +33 -0
  32. package/dist/commands/research-fork.md +40 -0
  33. package/dist/commands/research-gather.md +33 -0
  34. package/dist/commands/research-plan.md +37 -0
  35. package/dist/commands/research-quick.md +37 -0
  36. package/dist/commands/research-synthesize.md +33 -0
  37. package/dist/commands/research.md +55 -37
  38. package/dist/commands/reviews-code.md +4 -4
  39. package/dist/commands/reviews-pragmatic.md +4 -4
  40. package/dist/commands/reviews-production-readiness.md +4 -4
  41. package/dist/commands/reviews-reality-check.md +4 -4
  42. package/dist/commands/reviews-spec-audit.md +4 -4
  43. package/dist/commands/rule-reviewer.md +38 -0
  44. package/dist/commands/standards-discover.md +3 -4
  45. package/dist/commands/standards-update.md +3 -4
  46. package/dist/commands/work.md +21 -21
  47. package/dist/configuration/skills-config.js +1 -1
  48. package/dist/index.js +5 -2
  49. package/dist/skills/agents-md-generator/SKILL.md +223 -0
  50. package/dist/skills/codebase-analyzer/SKILL.md +1 -1
  51. package/dist/skills/dev-analyze/SKILL.md +115 -0
  52. package/dist/skills/dev-bugfix/SKILL.md +452 -0
  53. package/dist/skills/dev-finalize/SKILL.md +118 -0
  54. package/dist/skills/dev-implement/SKILL.md +167 -0
  55. package/dist/skills/dev-plan/SKILL.md +147 -0
  56. package/dist/skills/dev-spec/SKILL.md +182 -0
  57. package/dist/skills/dev-tdd-red/SKILL.md +94 -0
  58. package/dist/skills/dev-verify/SKILL.md +160 -0
  59. package/dist/skills/development/SKILL.md +130 -522
  60. package/dist/skills/diagrams-mermaid/SKILL.md +3 -1
  61. package/dist/skills/docs-manager/SKILL.md +4 -4
  62. package/dist/skills/docs-manager/references/agents-md-template.md +1 -1
  63. package/dist/skills/flow-init/SKILL.md +34 -13
  64. package/dist/skills/goal-development/SKILL.md +96 -0
  65. package/dist/skills/goal-research/SKILL.md +118 -0
  66. package/dist/skills/html-renderer/SKILL.md +14 -1
  67. package/dist/skills/implementation-plan-executor/SKILL.md +1 -1
  68. package/dist/skills/implementation-verifier/SKILL.md +1 -1
  69. package/dist/skills/migration/SKILL.md +63 -18
  70. package/dist/skills/orchestrator-framework/SKILL.md +1 -1
  71. package/dist/skills/orchestrator-framework/references/command-namespacing.md +7 -0
  72. package/dist/skills/orchestrator-framework/references/confirm-or-revise-exception.md +20 -0
  73. package/dist/skills/orchestrator-framework/references/delegation-rules.md +54 -0
  74. package/dist/skills/orchestrator-framework/references/dispatcher-handoff.md +27 -0
  75. package/dist/skills/orchestrator-framework/references/gate-contract.md +112 -0
  76. package/dist/skills/orchestrator-framework/references/orchestrator-creation-checklist.md +3 -0
  77. package/dist/skills/orchestrator-framework/references/orchestrator-patterns.md +8 -50
  78. package/dist/skills/performance/SKILL.md +52 -18
  79. package/dist/skills/research/SKILL.md +249 -462
  80. package/dist/skills/research-brainstorm/SKILL.md +120 -0
  81. package/dist/skills/{research → research-brainstorm}/references/brainstorming-techniques.md +1 -1
  82. package/dist/skills/research-converge/SKILL.md +130 -0
  83. package/dist/skills/research-design/SKILL.md +146 -0
  84. package/dist/skills/{research → research-design}/references/design-techniques.md +1 -1
  85. package/dist/skills/research-finalize/SKILL.md +125 -0
  86. package/dist/skills/research-fork/SKILL.md +190 -0
  87. package/dist/skills/research-gather/SKILL.md +133 -0
  88. package/dist/skills/research-plan/SKILL.md +141 -0
  89. package/dist/skills/research-quick/SKILL.md +139 -0
  90. package/dist/skills/research-synthesize/SKILL.md +127 -0
  91. package/dist/skills/rule-reviewer/SKILL.md +334 -0
  92. package/dist/skills/standards-discover/SKILL.md +37 -14
  93. package/dist/skills/standards-update/SKILL.md +58 -10
  94. package/dist/templates/orchestrator-state-development.yml +14 -13
  95. package/dist/templates/orchestrator-state-research.yml +19 -13
  96. package/dist/tools/fork_task.js +36 -0
  97. package/dist/tools/verify_template.js +10 -31
  98. package/dist/utils/file-util.js +14 -8
  99. package/dist/utils/fork-task.js +74 -0
  100. package/dist/utils/plugin-info.js +20 -0
  101. package/dist/utils/yaml-structure.js +32 -0
  102. package/package.json +1 -1
  103. package/dist/commands/quick-bugfix.md +0 -37
  104. package/dist/commands/quick-dev.md +0 -182
  105. package/dist/commands/quick-plan.md +0 -167
  106. package/dist/constants.js +0 -4
  107. package/dist/skills/quick-bugfix/SKILL.md +0 -311
  108. package/dist/templates/quick-bugfix-task.yml +0 -10
  109. package/dist/templates/quick-dev-task.yml +0 -10
  110. package/dist/templates/quick-plan-task.yml +0 -11
  111. /package/dist/skills/{research → research-plan}/references/research-methodologies.md +0 -0
@@ -0,0 +1,27 @@
1
+ # Dispatcher & Handoff Pattern (Subskill Loop)
2
+
3
+ How orchestrators delegate phase bodies to user-invocable **subskills**. Extracted from `orchestrator-patterns.md` (Section 7) so skills can link to it directly.
4
+
5
+ Orchestrators MAY delegate phase bodies to user-invocable **subskills** instead of executing them inline. Two modes share one state file and one set of subskills:
6
+
7
+ | Mode | Entry point | Behavior |
8
+ | ----------------- | ------------------------ | ------------------------------------------------------------------------------------------------------- |
9
+ | Orchestrated mode | wrapper skill/command | Invokes subskills back-to-back via Skill tool in sequence; pauses at `question` gates between subskills |
10
+ | Assisted mode | dispatcher skill/command | Derives next phase from state, prints the suggested command, and **STOPS**; user invokes each subskill |
11
+
12
+ ## Rules
13
+
14
+ 1. **State file is canonical.** `orchestrator-state.yml` remains the single source of truth. Subskills read it on entry and write step results on exit. `completed_phases` values MUST stay stable so both modes intermix freely on the same task.
15
+ - **Value convention**: `completed_phases` / `failed_phases` / `auto_fix_attempts` keys are **descriptive step slugs**, not `phase-N` numbers. Canonical slugs per workflow:
16
+
17
+ | Workflow | Slugs | Routing table | Template |
18
+ | ------------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------- | ---------------------------------------------- |
19
+ | development | `codebase-analysed`, `gap-analysed`, `tdd-red-proven`, `spec-written`, `spec-audited`, `plan-created`, `implementation-done`, `tdd-green-proven`, `options-chosen`, `verification-done`, `e2e-run`, `docs-generated`, `task-completed` | `skills/development/SKILL.md` | `templates/orchestrator-state-development.yml` |
20
+ | research | `brief-written`, `plan-created`, `findings-gathered`, `synthesis-complete`, `alternatives-generated`, `approaches-chosen`, `design-generated`, `research-completed` | `skills/research/SKILL.md` | `templates/orchestrator-state-research.yml` |
21
+ | performance | `phase-N` (legacy holdout — kept internally consistent) | `skills/performance/SKILL.md` | `templates/orchestrator-state-performance.yml` |
22
+ | migration | `phase-N` (legacy holdout — kept internally consistent) | `skills/migration/SKILL.md` | `templates/orchestrator-state-migration.yml` |
23
+ 2. **Subskills are self-contained.** Each has: an entry check (validate state + prerequisite artifacts), an execute section (delegation via Skill/Task tools per the [Delegation Rules](delegation-rules.md)), and an exit (state update + closing ritual). **State updates are per-step**: a subskill writes `orchestrator-state.yml` immediately after each of its steps completes — appending only the step slug actually performed, bumping `orchestrator.updated`, recording failures in `failed_phases`/`auto_fix_attempts`, and validating with `verify_template` — never as a single end-of-skill write.
24
+ 3. **Closing ritual (handoff) → Exit Gate.** Every subskill ends with the **Exit Gate** contract, see [Gate Contract](gate-contract.md) (results box → results-acceptance question → next-step hint on accept → STOP).
25
+ 4. **Entry checks replace phase gates in assisted mode.** A subskill invoked directly must validate the same prerequisites a phase gate would (e.g., spec exists before audit) and route to the prerequisite's command if missing — via its **Entry Gate** ([Gate Contract](gate-contract.md)).
26
+ 5. **Never chain automatically.** The orchestrated wrapper invokes; subskills only SUGGEST the next command and stop. Auto-chaining from a subskill skips user review.
27
+ 6. **Assisted mode is the gate.** In assisted mode, the user explicitly invoking the next command IS the phase gate — no additional `question` confirmation before a subskill starts.
@@ -0,0 +1,112 @@
1
+ # Gate Contract — Entry Gate & Exit Gate (Skill Contract)
2
+
3
+ Shared contract for how every user-invocable skill opens and closes. Extracted from `orchestrator-patterns.md` (Section 9) so skills can link to it directly.
4
+
5
+ Every **user-invocable** skill (orchestrators, subskills, dispatchers, utility commands) opens with an **Entry Gate** and closes with an **Exit Gate**. Internal skills (subagent-invoked, `user-invocable: false`) use lightweight input/structured-output contracts instead and never call `question`.
6
+
7
+ ## Entry Gate
8
+
9
+ The Entry Gate runs BEFORE any phase work. It validates that this skill is allowed to run and routes to what is missing instead of guessing.
10
+
11
+ 1. **Argument resolution** — resolve the argument in priority order: full path → identifier (directory name under the workflow's task type) → fresh description. If missing, ambiguous, or unmatched:
12
+ - Print a structured ask: the exact inputs accepted, with format examples, then WAIT.
13
+ - NEVER guess, auto-pick a task, or proceed with a resolved-by-hope path.
14
+ 2. **Prerequisite check** — verify each required upstream artifact, expressed as a table the skill keeps at the top of its body:
15
+
16
+ | Required for this skill | Where verified | Produced by |
17
+ | ----------------------- | ------------------------------------------------------------------- | ---------------------------- |
18
+ | State file exists | `<task-path>/orchestrator-state.yml` | `/owflow:development <desc>` |
19
+ | Analysis done | `gap-analysed` in `completed_phases` + `analysis/gap-analysis.md` exists | `/owflow:dev-analyze` |
20
+ | Spec approved | `implementation/spec.md` exists | `/owflow:dev-spec` |
21
+
22
+ Verify **presence and, where cheap, content** (state field values like `has_reproducible_defect`, marker artifacts like `implementation/tdd-red-gate.md`), not just file existence.
23
+
24
+ 3. **Blocked output** — when a prerequisite is unmet, print the blocked block and STOP:
25
+ 1. Numbered "Steps that must be completed first (in order)", each with its exact prefixed command (`/owflow:dev-analyze <task-path>`).
26
+ 2. List of resumable task identifiers (directories under the workflow's task type), if any exist.
27
+ 3. Fresh-start hint: `Run /owflow:<entry-command> <description> to start a task from scratch.`
28
+ 4. **Skip/resume semantics** — when the skill's steps are already in `completed_phases` (validate artifacts before trusting state): report the existing results briefly and route to the Exit Gate instead of re-executing.
29
+ 5. **Conditional activation** — skills that only apply under a state condition (e.g., TDD red gate requires `has_reproducible_defect: true`) check it as part of the Entry Gate and route to the correct alternative command when inactive.
30
+
31
+ ### Missing-state bootstrap (mid-pipeline entry)
32
+
33
+ When a subskill is invoked with a task path/identifier whose `orchestrator-state.yml` exists nowhere (no task, no state file) and the ONLY unmet prerequisite is the state file itself, the skill does not blindly send the user back to the full pipeline — the user chose to enter mid-pipeline. Instead:
34
+
35
+ 1. **Ask** via `question`: "No task exists at this path. Create a fresh standard task and start at `<this skill's first step slug>`?"
36
+ 2. **On confirm (bootstrap)**:
37
+ - Create the task directory `.owflow/tasks/<workflow-type>/YYYY-MM-DD-task-name/` (name derived from the argument or the user's input) — mark `orchestrator.entry_point: "<skill> (mid-pipeline bootstrap)"` and `started_phase` with this skill's starting step slug.
38
+ - Create `orchestrator-state.yml` from the workflow's template, honoring any of the skill's command flags into their state fields; leave `completed_phases` empty (upstream steps stay unrecorded).
39
+ - Run `verify_template` against the workflow's template.
40
+ - Then continue into Execute. Because bootstrapping creates **state only — never upstream artifacts**, later artifact prerequisites (e.g., `implementation/spec.md` before planning) still block with the normal precondition loop, so an incorrectly early bootstrap cannot silently skip work.
41
+ 3. **On decline** — print the blocked block with the fresh-start hint and STOP.
42
+
43
+ #### dev-* bootstrap
44
+
45
+ - Task directory under `.owflow/tasks/development/`; template `orchestrator-state-development.yml`; fresh-start hint: `Run /owflow:development <description> to start a task from scratch.`
46
+ - Skill starting points (used for the bootstrap question and `started_phase`): dev-analyze → `codebase-analysed`; dev-tdd-red → `tdd-red-proven`; dev-spec → `spec-written`; dev-plan → `plan-created`; dev-implement → `implementation-done`; dev-verify → `options-chosen`; dev-finalize → `e2e-run`.
47
+
48
+ #### research-* bootstrap
49
+
50
+ - Task directory under `.owflow/tasks/research/`; template `orchestrator-state-research.yml`; fresh-start hint: `Run /owflow:research <question> to start a task from scratch.`
51
+ - Skill starting points (used for the bootstrap question and `started_phase`): research-plan → `brief-written`; research-gather → `findings-gathered`; research-synthesize → `synthesis-complete`; research-brainstorm → `alternatives-generated`; research-converge → `approaches-chosen`; research-design → `design-generated`; research-finalize → `research-completed`.
52
+
53
+ ### Deterministic entry checks (future)
54
+
55
+ Entry-gate checks above are currently executed by the agent reading state. For more deterministic routing, future work considers (a) a small script that checks whether `orchestrator-state.yml` exists, parses it, and answers slug/next-step queries, and (b) an OpenCode lifecycle hook that automates these entry-gate checks for dev-* skills before they run. Until then, follow the rules above exactly as written.
56
+
57
+ ## Exit Gate
58
+
59
+ The Exit Gate runs after all phase work and state updates are final. It presents results, asks the user to confirm them, and only then hands off.
60
+
61
+ 1. **Results box** — one-screen markdown summary (no ASCII borders, markdown headings/bold carry the emphasis):
62
+
63
+ ```markdown
64
+ ## ✅ <SKILL> COMPLETE — <task name>
65
+
66
+ **<Field 1>** — [key outcome]
67
+ **<Field 2>** — [key outcome]
68
+
69
+ **Artifacts**
70
+
71
+ - `relative/path/to/artifact.md`
72
+
73
+ **Next ▸** `/owflow:<next-skill> <task-path>`
74
+ ```
75
+
76
+ Conventions:
77
+ - Status glyphs follow the outcome: ✅ pass/success, ⚠ pass-with-concerns/partial, ❌ fail.
78
+ - Set the **Next ▸** line to the suggested next command for this skill; omit it when the next-step hint depends on the Accept response (the handoff block is printed after Accept anyway).
79
+
80
+ 2. **Results-acceptance question** (MANDATORY, fires before any handoff hint):
81
+
82
+ Use `question` — "Are these results correct?" with options:
83
+ - **Accept** — results are good; proceed to the next-step hint.
84
+ - **Adjust** — user specifies what to change; re-work ONLY the affected parts, update artifacts/state, then re-present the results box and re-ask.
85
+ - **Discuss** — walk through a specific result in more depth (evidence, reasoning, alternatives); after the discussion, re-ask.
86
+ - **Stop here** — artifacts persist; print the resume command (`/owflow:<this-skill> <task-path>` or the next phase command) and end.
87
+
88
+ 3. **Next-step hint** — only after Accept: print the suggested next command derived from state, plus an "Other options" block of alternative valid commands. Every suggested command is a **compact annotated entry**:
89
+ - **Purpose** — one line stating what the proposed skill does.
90
+ - **Requirement tag** — `required` (mandatory next phase) or `optional` (shortcut, standalone utility, or conditional step) with its activation condition, e.g. `optional — only when has_reproducible_defect: true`.
91
+ - **Remaining plan** (for optional/alternative paths) — one compact line listing the phases still ahead in execution order, marking which are optional.
92
+ - Standalone review/utility commands are annotated `optional — does not advance phases`.
93
+
94
+ Example shape (~5 lines):
95
+
96
+ ```
97
+ → /owflow:dev-verify <task-path>
98
+ What: runs the verification pipeline (completeness, code review, fixes) — required before commit. Remaining after: /owflow:dev-finalize (required).
99
+ Other options:
100
+ /owflow:reviews-code <task-path> — optional, does not advance phases (standalone re-run of code review)
101
+ /owflow:goal-development <task-path> — optional shortcut: runs all remaining phases in one loop (… → verify → finalize)
102
+ ```
103
+
104
+ Then STOP. Never auto-invoke the next skill.
105
+
106
+ 4. **Gate ordering** — per the Phase Gate Behavior state ordering rule in `orchestrator-patterns.md`: finish phase work → present results box → acceptance question → user responds → THEN the state is already consistent (per-step writes happened during Execute); the Exit Gate never mutates phase state on its own except recording the user's acceptance decision where the state schema has a field for it.
107
+
108
+ ## Exceptions
109
+
110
+ - **Dispatchers** (`development`, `research`): the Exit Gate's acceptance question is adapted — the results box is the handoff block, and the question asks how to proceed (hand off to the suggested subskill / switch to autonomous mode / adjust / stop).
111
+ - **Utility skills with explicit no-follow-up contracts** (`agents-md-generator`, `rule-reviewer`): the acceptance question is confirm-or-revise only; follow-up suggestions stay prohibited unless the user asks. See [confirm-or-revise exception](confirm-or-revise-exception.md).
112
+ - **Orchestrated mode** (`goal-development`, `goal-research`): the subskill's own Exit Gate acceptance question IS the loop gate — Accept means "continue to the next subskill". The wrapper MUST NOT add a second consecutive `question`.
@@ -9,6 +9,8 @@ Use when creating NEW orchestrators or auditing existing ones. Not loaded during
9
9
  Before considering an orchestrator complete, verify ALL items:
10
10
 
11
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))
12
14
  - [ ] **State file creation** — Explicit step to CREATE `orchestrator-state.yml`
13
15
  - [ ] **State verification** — Explicit step to use `verify_template` to check YAML validity after creation
14
16
  - [ ] **Phase structure** — Each phase has: Purpose, Execute, Output, State, Transition (`→ Pause` / `→ AUTO-CONTINUE` / `→ Conditional`)
@@ -39,6 +41,7 @@ Before considering an orchestrator complete, verify ALL items:
39
41
  | Stopping at AUTO-CONTINUE transitions | Brief summary is fine, but must proceed immediately |
40
42
  | Missing standards references | INDEX.md must be referenced in relevant phases |
41
43
  | Auto-accepting subagent decisions | User must consent via question |
44
+ | Ending without results-acceptance | Exit Gate question MUST fire before next-step hint |
42
45
 
43
46
  ---
44
47
 
@@ -2,58 +2,14 @@
2
2
 
3
3
  Shared execution rules, schemas, and patterns for all workflow orchestrators.
4
4
 
5
- ---
6
-
7
- ## 1. Delegation Rules
8
-
9
- **Always use Skill/Task tools to delegate. Never execute delegated work inline.**
10
-
11
- When a phase requires delegation:
12
-
13
- 1. Use the **Skill tool** for **skills** — loads SKILL.md instructions into the main agent's context; the main agent executes the skill's instructions and continues with the orchestrator workflow afterward
14
- 2. Use the **Task tool** for **subagents/agents** — spawns an isolated subprocess that returns results when complete
15
- 3. Wait for completion before continuing
16
-
17
- **Skills and agents are NOT interchangeable.** Skills always use Skill tool; agents always use Task tool. Never invoke a skill via Task tool (`subagent_type`) — it will fail with "Agent type not found."
18
-
19
- **Why skills MUST use Skill tool**: Skills like `codebase-analyzer`, `implementation-plan-executor`, and `implementation-verifier` spawn their own subagents (Explore agents, reporters, planners). Subagents cannot spawn other subagents — so these skills must run in the main agent context via Skill tool.
20
-
21
- **Companion agent pattern** (e.g., `docs-operator`): Only works for skills that do NOT spawn subagents (like `docs-manager` which only does file operations). A companion agent preloads the skill via the `skills` frontmatter field and is invoked via Task tool. This pattern fails for any skill that needs to spawn subagents.
22
-
23
- ### Anti-Patterns
24
-
25
- | Anti-Pattern | Why It's Wrong | Correct Approach |
26
- | --------------------------------------- | ------------------------------------------- | ----------------------------------------------------- |
27
- | "I'll analyze the codebase..." | Bypasses codebase-analyzer skill | Use `Skill` tool with `codebase-analyzer` |
28
- | "Let me create the specification..." | Bypasses specification-creator | Use `Task` tool with `specification-creator` subagent |
29
- | "Looking at the gaps between..." | Bypasses gap-analyzer subagent | Use `Task` tool with `gap-analyzer` |
30
- | "I'll implement this by..." | Bypasses implementation-plan-executor skill | Use `Skill` tool with `implementation-plan-executor` |
31
- | Reading a SKILL.md then doing the work | Skill files are instructions FOR skills | Use Skill tool to invoke |
32
- | Spawning Explore agents in orchestrator | Codebase-analyzer manages its own agents | Invoke skill, let IT spawn agents |
33
-
34
- ### When Inline Execution is Acceptable
35
-
36
- These do NOT require delegation:
37
-
38
- 1. **Clarifying questions phases** — question is direct
39
- 2. **State updates** — Reading/writing orchestrator-state.yml
40
- 3. **Phase announcements** — Outputting status messages
41
- 4. **Simple decisions** — Enabling/disabling optional phases
42
- 5. **Finalization** — Creating summary, updating metadata
5
+ Some heavily cross-referenced sections live in their own reference files:
43
6
 
44
- For all analysis, planning, implementation, and verification phases: **ALWAYS DELEGATE**.
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)
45
11
 
46
- **Never acceptable inline** (regardless of perceived task simplicity):
47
-
48
- - Specification creation → always delegate to `specification-creator` subagent
49
- - Implementation planning → always delegate to `implementation-planner` subagent
50
- - Gap analysis → always delegate to `gap-analyzer` subagent
51
- - Codebase analysis → always delegate to `codebase-analyzer` skill
52
- - Code review → always delegate to `code-reviewer` subagent
53
- - Test execution → always delegate to `test-suite-runner` subagent
54
- - Implementation completeness → always delegate to `implementation-completeness-checker` subagent
55
-
56
- "The task is simple" is NOT a valid reason to skip delegation.
12
+ Section numbering below is kept as-is so existing cross-references stay valid.
57
13
 
58
14
  ---
59
15
 
@@ -272,3 +228,5 @@ If prerequisites missing, use question: "Start from Phase 1", "Specify different
272
228
  | User chooses "Proceed with known issues" | Proceed with warning logged |
273
229
  | Max iterations (3) reached | Ask user how to proceed |
274
230
  | Critical issues remain unresolved | **MUST NOT proceed** — require user approval first |
231
+
232
+ ---
@@ -1,5 +1,5 @@
1
1
  ---
2
- name: performance
2
+ name: owflow:performance
3
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
4
  user-invocable: true
5
5
  ---
@@ -8,24 +8,36 @@ user-invocable: true
8
8
 
9
9
  Static-analysis-first performance optimization workflow. Identifies bottlenecks by reading code, then uses the standard specification/planning/implementation/verification pipeline to fix them.
10
10
 
11
- ## Initialization
11
+ Gates follow the shared contract in [Gate Contract](../orchestrator-framework/references/gate-contract.md).
12
+
13
+ ## Entry Gate
12
14
 
13
15
  **BEFORE executing any phase, you MUST complete these steps:**
14
16
 
15
- ### Step 1: Load Framework Patterns
17
+ ### Argument resolution
18
+
19
+ - **Performance issue description provided** → use it as the task description.
20
+ - **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.
21
+ - **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.
22
+
23
+ ### Prerequisites
16
24
 
17
- **Read the framework reference file NOW using the Read tool:**
25
+ | Required for this skill | Where verified | Produced by |
26
+ | ----------------------- | ----------------------------------------------------- | ---------------------------- |
27
+ | State file exists | `<task-path>/orchestrator-state.yml` (resume mode) | prior `/owflow:performance` run |
18
28
 
19
- 1. `../orchestrator-framework/references/orchestrator-patterns.md` - Delegation rules, interactive mode, state schema, initialization, context passing, issue resolution
29
+ 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).
20
30
 
21
- ### Step 2: Initialize Workflow
31
+ ### Execution steps
22
32
 
23
- 1. **Create Task Items**: Use `TaskCreate` for all phases (see Phase Configuration), then set dependencies with `TaskUpdate addBlockedBy`
24
- 2. **Create Task Directory**: `.owflow/tasks/performance/YYYY-MM-DD-task-name/`
25
- 3. **Create Subdirectories**: `analysis/`, `analysis/user-profiling-data/`, `implementation/`, `verification/`
26
- 4. **Initialize State**: Create `orchestrator-state.yml` with performance context
27
- - **CRITICAL**: Use the `verify_template` tool immediately after creation to check YAML validity against `orchestrator-state-performance.yml`.
28
- 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.
33
+ 1. **Load framework patterns** — Read `../orchestrator-framework/references/orchestrator-patterns.md` NOW: delegation rules, interactive mode, state schema, initialization, context passing, issue resolution.
34
+ 2. **Initialize workflow:**
35
+ 1. **Create Task Items**: Use `TaskCreate` for all phases (see Phase Configuration), then set dependencies with `TaskUpdate addBlockedBy`
36
+ 2. **Create Task Directory**: `.owflow/tasks/performance/YYYY-MM-DD-task-name/`
37
+ 3. **Create Subdirectories**: `analysis/`, `analysis/user-profiling-data/`, `implementation/`, `verification/`
38
+ 4. **Initialize State**: Create `orchestrator-state.yml` with performance context
39
+ - **CRITICAL**: Use the `verify_template` tool immediately after creation to check YAML validity against `orchestrator-state-performance.yml`.
40
+ 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.
29
41
 
30
42
  **Output**:
31
43
 
@@ -326,11 +338,11 @@ question - Display executive summary: total issues found, issues fixed, issues r
326
338
 
327
339
  ---
328
340
 
329
- ### Phase 9: Finalization
341
+ ### Phase 9: Finalization → Exit Gate
330
342
 
331
343
  > **Phase gate**: Requires `question` confirmation from Phase 8 before executing.
332
344
 
333
- **Purpose**: Complete workflow and provide next steps
345
+ **Purpose**: Present optimization results, confirm correctness with the user, and close the workflow (Exit Gate contract, [Gate Contract](../orchestrator-framework/references/gate-contract.md))
334
346
  **Execute**: Direct - create summary, update state, guide commit
335
347
  **Output**: Workflow summary
336
348
  **State**: Set `task.status: completed`
@@ -339,12 +351,34 @@ question - Display executive summary: total issues found, issues fixed, issues r
339
351
 
340
352
  1. Create workflow summary (bottlenecks found, optimizations implemented, verification result)
341
353
  2. Update task status to "completed"
342
- 3. Provide commit message template
343
- 4. Guide performance-specific next steps:
354
+ 3. **Results box**:
355
+
356
+ ```markdown
357
+ ## ✅ PERFORMANCE WORKFLOW COMPLETE — <task name>
358
+
359
+ **Bottlenecks found** — [count by severity]
360
+ **Optimizations applied** — [count + key ones]
361
+ **Verification** — [final verdict]
362
+ **Estimated improvement** — [range from analysis]
363
+
364
+ **Artifacts**
365
+ - `analysis/performance-analysis.md`
366
+ - `implementation/work-log.md`
367
+ - `verification/implementation-verification.md`
368
+ ```
369
+
370
+ 4. **Results-acceptance question** — use `question` — "Are these results correct?" with options:
371
+ - **Accept** — workflow is complete; print next steps below.
372
+ - **Adjust** — re-run the affected phase (additional optimizations, re-verification) with the user's corrections, then re-present the results box.
373
+ - **Discuss** — walk through bottleneck findings, optimization rationale, and measurement caveats in more depth; then re-ask.
374
+ - **Stop here** — print the resume command (`/owflow:performance <task-path>`) and end.
375
+
376
+ 5. **Next steps (after Accept)** — performance-specific guidance:
344
377
  - Run the application and verify improvements manually
345
378
  - Consider profiling with runtime tools to measure actual impact
346
379
  - Monitor production metrics after deployment
347
380
  - Address remaining P2/P3 bottlenecks if needed
381
+ - `/owflow:standards-update "<lesson learned>"` — capture optimization patterns as standards
348
382
 
349
383
  → End of workflow
350
384
 
@@ -396,7 +430,7 @@ Refer to the template [src/templates/orchestrator-state-performance.yml](../../t
396
430
 
397
431
  Invoked via:
398
432
 
399
- - `/performance [description]` (new)
400
- - `/performance [task-path] [--from=PHASE]` (resume)
433
+ - `/owflow:performance [description]` (new)
434
+ - `/owflow:performance [task-path] [--from=PHASE]` (resume)
401
435
 
402
436
  Task directory: `.owflow/tasks/performance/YYYY-MM-DD-task-name/`