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.
- package/LICENSE +21 -21
- package/README.md +448 -261
- package/dist/agents/bottleneck-analyzer.md +332 -329
- package/dist/agents/code-quality-pragmatist.md +353 -354
- package/dist/agents/code-reviewer.md +238 -239
- package/dist/agents/codebase-analysis-reporter.md +245 -246
- package/dist/agents/docs-operator.md +22 -23
- package/dist/agents/e2e-test-verifier.md +447 -448
- package/dist/agents/gap-analyzer.md +501 -502
- package/dist/agents/implementation-completeness-checker.md +219 -220
- package/dist/agents/implementation-planner.md +308 -309
- package/dist/agents/information-gatherer.md +690 -691
- package/dist/agents/production-readiness-checker.md +278 -279
- package/dist/agents/project-analyzer.md +403 -403
- package/dist/agents/reality-assessor.md +365 -366
- package/dist/agents/research-planner.md +449 -450
- package/dist/agents/research-synthesizer.md +402 -403
- package/dist/agents/solution-brainstormer.md +256 -257
- package/dist/agents/solution-designer.md +371 -372
- package/dist/agents/spec-auditor.md +297 -298
- package/dist/agents/specification-creator.md +333 -334
- package/dist/agents/task-classifier.md +449 -450
- package/dist/agents/task-group-implementer.md +283 -284
- package/dist/agents/test-suite-runner.md +194 -195
- package/dist/agents/user-docs-generator.md +508 -509
- package/dist/commands/reviews-code.md +90 -90
- package/dist/commands/reviews-pragmatic.md +99 -99
- package/dist/commands/reviews-production-readiness.md +113 -113
- package/dist/commands/reviews-reality-check.md +110 -110
- package/dist/commands/reviews-spec-audit.md +114 -114
- package/dist/commands/work.md +280 -280
- package/dist/configuration/agents-config.d.ts +2 -0
- package/dist/configuration/agents-config.js +8 -44
- package/dist/configuration/commands-config.d.ts +23 -0
- package/dist/configuration/commands-config.js +17 -17
- package/dist/configuration/skills-config.d.ts +2 -0
- package/dist/configuration/skills-config.js +3 -3
- package/dist/hooks/hooks-diagnostics.d.ts +3 -0
- package/dist/hooks/hooks-diagnostics.js +21 -0
- package/dist/hooks/hooks-persistence.d.ts +17 -0
- package/dist/hooks/hooks-persistence.js +207 -0
- package/dist/hooks/hooks-registry.d.ts +6 -0
- package/dist/hooks/hooks-registry.js +104 -0
- package/dist/hooks/hooks-wrapper.d.ts +25 -0
- package/dist/hooks/hooks-wrapper.js +318 -0
- package/dist/hooks/internal/before-tool.d.ts +6 -0
- package/dist/hooks/internal/before-tool.js +13 -0
- package/dist/hooks/internal/session-compaction.d.ts +9 -0
- package/dist/hooks/{session-compaction.js → internal/session-compaction.js} +9 -7
- package/dist/hooks/runtime/circuit-breaker.d.ts +23 -0
- package/dist/hooks/runtime/circuit-breaker.js +39 -0
- package/dist/hooks/runtime/failure-policy.d.ts +15 -0
- package/dist/hooks/runtime/failure-policy.js +49 -0
- package/dist/hooks/runtime/process-executor.d.ts +33 -0
- package/dist/hooks/runtime/process-executor.js +147 -0
- package/dist/hooks/runtime/status-recorder.d.ts +27 -0
- package/dist/hooks/runtime/status-recorder.js +111 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.js +111 -40
- package/dist/skills/agents-md-generator/SKILL.md +223 -223
- package/dist/skills/codebase-analyzer/SKILL.md +162 -162
- package/dist/skills/codebase-analyzer/references/code-analysis.md +63 -63
- package/dist/skills/codebase-analyzer/references/combined.md +31 -31
- package/dist/skills/codebase-analyzer/references/context-discovery.md +63 -63
- package/dist/skills/codebase-analyzer/references/file-discovery.md +51 -51
- package/dist/skills/codebase-analyzer/references/migration-target.md +23 -23
- package/dist/skills/codebase-analyzer/references/pattern-mining.md +22 -22
- package/dist/skills/dev-analyze/SKILL.md +115 -115
- package/dist/skills/dev-bugfix/SKILL.md +452 -452
- package/dist/skills/dev-finalize/SKILL.md +118 -118
- package/dist/skills/dev-implement/SKILL.md +167 -167
- package/dist/skills/dev-plan/SKILL.md +147 -147
- package/dist/skills/dev-spec/SKILL.md +182 -182
- package/dist/skills/dev-tdd-red/SKILL.md +94 -94
- package/dist/skills/dev-verify/SKILL.md +153 -153
- package/dist/skills/development/SKILL.md +260 -260
- package/dist/skills/diagrams-mermaid/SKILL.md +183 -159
- package/dist/skills/diagrams-mermaid/references/reference.md +220 -148
- package/dist/skills/docs-manager/SKILL.md +379 -379
- package/dist/skills/docs-manager/docs/INDEX.md +199 -199
- package/dist/skills/docs-manager/docs/standards/backend/api.md +25 -25
- package/dist/skills/docs-manager/docs/standards/backend/migrations.md +22 -22
- package/dist/skills/docs-manager/docs/standards/backend/models.md +25 -25
- package/dist/skills/docs-manager/docs/standards/backend/queries.md +22 -22
- package/dist/skills/docs-manager/docs/standards/frontend/accessibility.md +25 -25
- package/dist/skills/docs-manager/docs/standards/frontend/components.md +28 -28
- package/dist/skills/docs-manager/docs/standards/frontend/css.md +16 -16
- package/dist/skills/docs-manager/docs/standards/frontend/responsive.md +28 -28
- package/dist/skills/docs-manager/docs/standards/global/coding-style.md +25 -25
- package/dist/skills/docs-manager/docs/standards/global/commenting.md +10 -10
- package/dist/skills/docs-manager/docs/standards/global/conventions.md +31 -31
- package/dist/skills/docs-manager/docs/standards/global/error-handling.md +22 -22
- package/dist/skills/docs-manager/docs/standards/global/minimal-implementation.md +22 -22
- package/dist/skills/docs-manager/docs/standards/global/validation.md +28 -28
- package/dist/skills/docs-manager/docs/standards/testing/test-writing.md +25 -25
- package/dist/skills/docs-manager/references/agents-md-template.md +29 -29
- package/dist/skills/docs-manager/references/index-md-template.md +73 -73
- package/dist/skills/flow-init/SKILL.md +234 -234
- package/dist/skills/flow-init/references/architecture-template.md +45 -45
- package/dist/skills/flow-init/references/roadmap-templates.md +93 -93
- package/dist/skills/flow-init/references/tech-stack-template.md +70 -70
- package/dist/skills/flow-init/references/vision-templates.md +75 -75
- package/dist/skills/goal-development/SKILL.md +96 -96
- package/dist/skills/goal-migration/SKILL.md +114 -114
- package/dist/skills/goal-performance/SKILL.md +126 -0
- package/dist/skills/goal-research/SKILL.md +118 -118
- package/dist/skills/html-renderer/SKILL.md +173 -173
- package/dist/skills/html-renderer/references/index.html +318 -318
- package/dist/skills/html-renderer/references/styles.css +388 -388
- package/dist/skills/html-renderer/references/tokens.json +104 -104
- package/dist/skills/implementation-plan-executor/SKILL.md +378 -378
- package/dist/skills/implementation-verifier/SKILL.md +307 -307
- package/dist/skills/migration/SKILL.md +268 -268
- package/dist/skills/migration-analyze/SKILL.md +126 -126
- package/dist/skills/migration-finalize/SKILL.md +161 -161
- package/dist/skills/migration-fix/SKILL.md +155 -155
- package/dist/skills/migration-implement/SKILL.md +131 -131
- package/dist/skills/migration-plan/SKILL.md +131 -131
- package/dist/skills/migration-spec/SKILL.md +135 -135
- package/dist/skills/migration-spec/references/migration-strategies.md +430 -430
- package/dist/skills/migration-target/SKILL.md +134 -134
- package/dist/skills/migration-target/references/migration-types.md +489 -489
- package/dist/skills/migration-verify/SKILL.md +184 -184
- package/dist/skills/orchestrator-framework/SKILL.md +65 -65
- package/dist/skills/orchestrator-framework/references/command-namespacing.md +7 -7
- package/dist/skills/orchestrator-framework/references/confirm-or-revise-exception.md +20 -20
- package/dist/skills/orchestrator-framework/references/delegation-rules.md +54 -54
- package/dist/skills/orchestrator-framework/references/dispatcher-handoff.md +27 -27
- package/dist/skills/orchestrator-framework/references/fix-loop-contract.md +65 -65
- package/dist/skills/orchestrator-framework/references/gate-contract.md +122 -117
- package/dist/skills/orchestrator-framework/references/orchestrator-creation-checklist.md +51 -51
- package/dist/skills/orchestrator-framework/references/orchestrator-patterns.md +235 -235
- package/dist/skills/performance/SKILL.md +267 -437
- package/dist/skills/performance-analyze/SKILL.md +129 -0
- package/dist/skills/{performance → performance-analyze}/references/performance-optimization-guide.md +271 -365
- package/dist/skills/performance-finalize/SKILL.md +117 -0
- package/dist/skills/performance-implement/SKILL.md +114 -0
- package/dist/skills/performance-plan/SKILL.md +112 -0
- package/dist/skills/performance-spec/SKILL.md +145 -0
- package/dist/skills/performance-verify/SKILL.md +164 -0
- package/dist/skills/research/SKILL.md +249 -249
- package/dist/skills/research-brainstorm/SKILL.md +120 -120
- package/dist/skills/research-brainstorm/references/brainstorming-techniques.md +84 -84
- package/dist/skills/research-converge/SKILL.md +130 -130
- package/dist/skills/research-design/SKILL.md +146 -146
- package/dist/skills/research-design/references/design-techniques.md +40 -40
- package/dist/skills/research-finalize/SKILL.md +125 -125
- package/dist/skills/research-fork/SKILL.md +190 -190
- package/dist/skills/research-gather/SKILL.md +133 -133
- package/dist/skills/research-plan/SKILL.md +141 -141
- package/dist/skills/research-plan/references/research-methodologies.md +710 -710
- package/dist/skills/research-quick/SKILL.md +139 -139
- package/dist/skills/research-synthesize/SKILL.md +127 -127
- package/dist/skills/rule-reviewer/SKILL.md +334 -334
- package/dist/skills/standards-discover/SKILL.md +260 -260
- package/dist/skills/standards-discover/references/aggregation-strategy.md +76 -76
- package/dist/skills/standards-discover/references/code-pattern-prompt.md +68 -68
- package/dist/skills/standards-discover/references/config-analyzer-prompt.md +67 -67
- package/dist/skills/standards-discover/references/docs-extractor-prompt.md +65 -65
- package/dist/skills/standards-discover/references/external-analyzer-prompt.md +75 -75
- package/dist/skills/standards-update/SKILL.md +207 -207
- package/dist/templates/orchestrator-state-base.yml +17 -17
- package/dist/templates/orchestrator-state-development.yml +95 -95
- package/dist/templates/orchestrator-state-migration.yml +95 -95
- package/dist/templates/orchestrator-state-performance.yml +64 -53
- package/dist/templates/orchestrator-state-research.yml +67 -67
- package/dist/tools/fork_task.d.ts +17 -0
- package/dist/tools/fork_task.js +21 -11
- package/dist/tools/verify_template.d.ts +11 -0
- package/dist/tools/verify_template.js +32 -17
- package/dist/tui/hooks-dialogs.d.ts +20 -0
- package/dist/tui/hooks-dialogs.js +181 -0
- package/dist/tui/hooks-presenter.d.ts +15 -0
- package/dist/tui/hooks-presenter.js +70 -0
- package/dist/tui/hooks-sidebar.d.ts +10 -0
- package/dist/tui/hooks-sidebar.js +104 -0
- package/dist/tui/primitives.d.ts +21 -0
- package/dist/tui/primitives.js +47 -0
- package/dist/tui.d.ts +12 -0
- package/dist/tui.js +129 -0
- package/dist/types/hook-types.d.ts +125 -0
- package/dist/types/hook-types.js +76 -0
- package/dist/types/opencode-types.d.ts +13 -0
- package/dist/utils/file-util.d.ts +2 -0
- package/dist/utils/file-util.js +6 -6
- package/dist/utils/fork-task.d.ts +27 -0
- package/dist/utils/fork-task.js +18 -23
- package/dist/utils/plugin-info.d.ts +3 -0
- package/dist/utils/plugin-info.js +8 -10
- package/dist/utils/workflow-paths.d.ts +17 -0
- package/dist/utils/workflow-paths.js +18 -0
- package/dist/utils/yaml-structure.d.ts +7 -0
- package/dist/utils/yaml-structure.js +7 -11
- package/package.json +68 -48
- package/dist/hooks/before-tool.js +0 -19
|
@@ -1,54 +1,54 @@
|
|
|
1
|
-
# Delegation Rules
|
|
2
|
-
|
|
3
|
-
Shared rules for how orchestrators and subskills delegate work. Extracted from `orchestrator-patterns.md` (Section 1) so skills can link to it directly.
|
|
4
|
-
|
|
5
|
-
---
|
|
6
|
-
|
|
7
|
-
**Always use Skill/Task tools to delegate. Never execute delegated work inline.**
|
|
8
|
-
|
|
9
|
-
When a phase requires delegation:
|
|
10
|
-
|
|
11
|
-
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
|
|
12
|
-
2. Use the **Task tool** for **subagents/agents** — spawns an isolated subprocess that returns results when complete
|
|
13
|
-
3. Wait for completion before continuing
|
|
14
|
-
|
|
15
|
-
**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."
|
|
16
|
-
|
|
17
|
-
**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.
|
|
18
|
-
|
|
19
|
-
**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.
|
|
20
|
-
|
|
21
|
-
## Anti-Patterns
|
|
22
|
-
|
|
23
|
-
| Anti-Pattern | Why It's Wrong | Correct Approach |
|
|
24
|
-
| --------------------------------------- | ------------------------------------------- | ----------------------------------------------------- |
|
|
25
|
-
| "I'll analyze the codebase..." | Bypasses codebase-analyzer skill | Use `Skill` tool with `codebase-analyzer` |
|
|
26
|
-
| "Let me create the specification..." | Bypasses specification-creator | Use `Task` tool with `specification-creator` subagent |
|
|
27
|
-
| "Looking at the gaps between..." | Bypasses gap-analyzer subagent | Use `Task` tool with `gap-analyzer` |
|
|
28
|
-
| "I'll implement this by..." | Bypasses implementation-plan-executor skill | Use `Skill` tool with `implementation-plan-executor` |
|
|
29
|
-
| Reading a SKILL.md then doing the work | Skill files are instructions FOR skills | Use Skill tool to invoke |
|
|
30
|
-
| Spawning Explore agents in orchestrator | Codebase-analyzer manages its own agents | Invoke skill, let IT spawn agents |
|
|
31
|
-
|
|
32
|
-
## When Inline Execution is Acceptable
|
|
33
|
-
|
|
34
|
-
These do NOT require delegation:
|
|
35
|
-
|
|
36
|
-
1. **Clarifying questions phases** — question is direct
|
|
37
|
-
2. **State updates** — Reading/writing orchestrator-state.yml
|
|
38
|
-
3. **Phase announcements** — Outputting status messages
|
|
39
|
-
4. **Simple decisions** — Enabling/disabling optional phases
|
|
40
|
-
5. **Finalization** — Creating summary, updating metadata
|
|
41
|
-
|
|
42
|
-
For all analysis, planning, implementation, and verification phases: **ALWAYS DELEGATE**.
|
|
43
|
-
|
|
44
|
-
**Never acceptable inline** (regardless of perceived task simplicity):
|
|
45
|
-
|
|
46
|
-
- Specification creation → always delegate to `specification-creator` subagent
|
|
47
|
-
- Implementation planning → always delegate to `implementation-planner` subagent
|
|
48
|
-
- Gap analysis → always delegate to `gap-analyzer` subagent
|
|
49
|
-
- Codebase analysis → always delegate to `codebase-analyzer` skill
|
|
50
|
-
- Code review → always delegate to `code-reviewer` subagent
|
|
51
|
-
- Test execution → always delegate to `test-suite-runner` subagent
|
|
52
|
-
- Implementation completeness → always delegate to `implementation-completeness-checker` subagent
|
|
53
|
-
|
|
54
|
-
"The task is simple" is NOT a valid reason to skip delegation.
|
|
1
|
+
# Delegation Rules
|
|
2
|
+
|
|
3
|
+
Shared rules for how orchestrators and subskills delegate work. Extracted from `orchestrator-patterns.md` (Section 1) so skills can link to it directly.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
**Always use Skill/Task tools to delegate. Never execute delegated work inline.**
|
|
8
|
+
|
|
9
|
+
When a phase requires delegation:
|
|
10
|
+
|
|
11
|
+
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
|
|
12
|
+
2. Use the **Task tool** for **subagents/agents** — spawns an isolated subprocess that returns results when complete
|
|
13
|
+
3. Wait for completion before continuing
|
|
14
|
+
|
|
15
|
+
**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."
|
|
16
|
+
|
|
17
|
+
**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.
|
|
18
|
+
|
|
19
|
+
**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.
|
|
20
|
+
|
|
21
|
+
## Anti-Patterns
|
|
22
|
+
|
|
23
|
+
| Anti-Pattern | Why It's Wrong | Correct Approach |
|
|
24
|
+
| --------------------------------------- | ------------------------------------------- | ----------------------------------------------------- |
|
|
25
|
+
| "I'll analyze the codebase..." | Bypasses codebase-analyzer skill | Use `Skill` tool with `codebase-analyzer` |
|
|
26
|
+
| "Let me create the specification..." | Bypasses specification-creator | Use `Task` tool with `specification-creator` subagent |
|
|
27
|
+
| "Looking at the gaps between..." | Bypasses gap-analyzer subagent | Use `Task` tool with `gap-analyzer` |
|
|
28
|
+
| "I'll implement this by..." | Bypasses implementation-plan-executor skill | Use `Skill` tool with `implementation-plan-executor` |
|
|
29
|
+
| Reading a SKILL.md then doing the work | Skill files are instructions FOR skills | Use Skill tool to invoke |
|
|
30
|
+
| Spawning Explore agents in orchestrator | Codebase-analyzer manages its own agents | Invoke skill, let IT spawn agents |
|
|
31
|
+
|
|
32
|
+
## When Inline Execution is Acceptable
|
|
33
|
+
|
|
34
|
+
These do NOT require delegation:
|
|
35
|
+
|
|
36
|
+
1. **Clarifying questions phases** — question is direct
|
|
37
|
+
2. **State updates** — Reading/writing orchestrator-state.yml
|
|
38
|
+
3. **Phase announcements** — Outputting status messages
|
|
39
|
+
4. **Simple decisions** — Enabling/disabling optional phases
|
|
40
|
+
5. **Finalization** — Creating summary, updating metadata
|
|
41
|
+
|
|
42
|
+
For all analysis, planning, implementation, and verification phases: **ALWAYS DELEGATE**.
|
|
43
|
+
|
|
44
|
+
**Never acceptable inline** (regardless of perceived task simplicity):
|
|
45
|
+
|
|
46
|
+
- Specification creation → always delegate to `specification-creator` subagent
|
|
47
|
+
- Implementation planning → always delegate to `implementation-planner` subagent
|
|
48
|
+
- Gap analysis → always delegate to `gap-analyzer` subagent
|
|
49
|
+
- Codebase analysis → always delegate to `codebase-analyzer` skill
|
|
50
|
+
- Code review → always delegate to `code-reviewer` subagent
|
|
51
|
+
- Test execution → always delegate to `test-suite-runner` subagent
|
|
52
|
+
- Implementation completeness → always delegate to `implementation-completeness-checker` subagent
|
|
53
|
+
|
|
54
|
+
"The task is simple" is NOT a valid reason to skip delegation.
|
|
@@ -1,27 +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 | `
|
|
22
|
-
| migration | `state-analysed`, `target-planned`, `strategy-specified`, `plan-created`, `migration-executed`, `options-chosen`, `verification-done`, `issues-resolved`, `docs-generated`, `task-completed` | `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.
|
|
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 | `codebase-analysed`, `bottlenecks-identified`, `spec-written`, `spec-audited`, `plan-created`, `implementation-done`, `options-chosen`, `verification-done`, `task-completed` | `skills/performance/SKILL.md` | `templates/orchestrator-state-performance.yml` |
|
|
22
|
+
| migration | `state-analysed`, `target-planned`, `strategy-specified`, `plan-created`, `migration-executed`, `options-chosen`, `verification-done`, `issues-resolved`, `docs-generated`, `task-completed` | `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.
|
|
@@ -1,65 +1,65 @@
|
|
|
1
|
-
# Fix Loop Contract — User-Driven Fix-Then-Reverify
|
|
2
|
-
|
|
3
|
-
Shared contract for skills that resolve verification issues together with the user. It pins the option wording, iteration budget, state-write cadence, and exit conditions so each applying skill describes only its workflow-specific deltas instead of restating the loop.
|
|
4
|
-
|
|
5
|
-
**Applies to**:
|
|
6
|
-
|
|
7
|
-
- `dev-verify` — the `verification-done` step after `implementation-verifier` returns `passed_with_issues` or `failed`
|
|
8
|
-
- `migration-fix` — when the verification state facts say fixable issues remain (`issues-resolved`)
|
|
9
|
-
|
|
10
|
-
Skills that use the loop MUST reference this file and document only their deltas in the "Workflow-Specific Deltas" section.
|
|
11
|
-
|
|
12
|
-
---
|
|
13
|
-
|
|
14
|
-
## Loop (max 3 iterations)
|
|
15
|
-
|
|
16
|
-
1. **Display the detailed issue breakdown** grouped by category and severity, with location, description, and fixability.
|
|
17
|
-
2. **Present critical + warning issues as a numbered list.** Info issues are listed for awareness, not actionable.
|
|
18
|
-
3. **Ask via `question`** — "Which issues should I fix?" with exactly three options:
|
|
19
|
-
- **"Fix all fixable issues"**
|
|
20
|
-
- **"Let me choose specific issues"**
|
|
21
|
-
- **"Skip fixes, proceed as-is"**
|
|
22
|
-
4. **Fix the selected issues directly.** Immediately after each fix, append it to `verification_context.fixes_applied` in state — never defer to the end of the loop. Bump `orchestrator.updated`; re-read the state file + run `verify_template`.
|
|
23
|
-
5. **After fixes, set `options.skip_test_suite: false`** (code changed — the suite must re-run on re-verification).
|
|
24
|
-
6. **Ask via `question`** — "Re-run verification to check fixes?" with options:
|
|
25
|
-
- **"Yes, re-run verification"** → re-invoke `implementation-verifier` (Skill tool), then **immediately** update `verification_context.reverify_count` and refresh `verification_context.last_status` + `issues_found` from the verifier's structured return; return to step 1.
|
|
26
|
-
- **"No, proceed to next phase"** → exit the loop to the Exit Gate.
|
|
27
|
-
7. **Record each user decision** (specific selection, proceed-with-warnings, deliberate skip) in `verification_context.decisions_made`.
|
|
28
|
-
|
|
29
|
-
The loop is capped at **3 iterations**; at the cap, the question in "Exit Conditions" decides the outcome.
|
|
30
|
-
|
|
31
|
-
---
|
|
32
|
-
|
|
33
|
-
## Exit Conditions
|
|
34
|
-
|
|
35
|
-
| Condition | Action |
|
|
36
|
-
| --------- | ------ |
|
|
37
|
-
| ✅ No critical issues remain | Append the skill's success slug and proceed. |
|
|
38
|
-
| ⚠ Max 3 iterations reached | `question` — "Proceed with known issues?" / stop-or-rollback option. Proceed ⇒ append the success slug with the approval recorded in `decisions_made`; stop/rollback ⇒ do NOT append, record the decision. |
|
|
39
|
-
| Deliberate skip ("Skip fixes, proceed as-is") | A user-chosen skip, not a failure: no success slug, no failure entry; record the reason in `phase_summaries.<fix>.summary` + `decisions_made`. |
|
|
40
|
-
| ❌ Critical issues remain unresolved | **MUST NOT proceed without explicit user approval.** |
|
|
41
|
-
| Verifier itself fails | Do NOT append the success slug; append it to `orchestrator.failed_phases` and increment `auto_fix_attempts["<slug>"]`. |
|
|
42
|
-
|
|
43
|
-
---
|
|
44
|
-
|
|
45
|
-
## State Writes (per iteration, never batched)
|
|
46
|
-
|
|
47
|
-
- `fixes_applied` — after every fix.
|
|
48
|
-
- `reverify_count` + refreshed `last_status` / `issues_found` — right after each verifier run.
|
|
49
|
-
- `decisions_made` — after each user decision.
|
|
50
|
-
- The success slug — only when the loop settles (✅, or an approved ⚠); never on a deliberate skip or a failure.
|
|
51
|
-
|
|
52
|
-
**Single-writer split**: the verification step owns the initial `last_status` / `issues_found`; the fix loop owns `fixes_applied`, `reverify_count`, `decisions_made`, plus the re-verify refresh of `last_status` / `issues_found`.
|
|
53
|
-
|
|
54
|
-
---
|
|
55
|
-
|
|
56
|
-
## Workflow-Specific Deltas
|
|
57
|
-
|
|
58
|
-
### Development (`dev-verify`)
|
|
59
|
-
|
|
60
|
-
None beyond this contract.
|
|
61
|
-
|
|
62
|
-
### Migration (`migration-fix`)
|
|
63
|
-
|
|
64
|
-
- **Compatibility verdict invalidation**: after fixes, set `verification_context.compatibility_status: null` (field-level fail-closed exception — the compatibility checks ran against pre-fix code). Only `migration-verify` may set a new verdict; when it is not `passed`, the required next step is `/owflow:migration-verify <task-path>`, never finalize.
|
|
65
|
-
- **Data-integrity HALT**: data-integrity issues are NEVER auto-fixed. HALT, present the rollback option with the issue, and append the failure entry; rollback happens only on explicit user confirmation — no automatic rollback or revert ever. A deliberate skip cannot waive a data-integrity failure or any non-passed compatibility check.
|
|
1
|
+
# Fix Loop Contract — User-Driven Fix-Then-Reverify
|
|
2
|
+
|
|
3
|
+
Shared contract for skills that resolve verification issues together with the user. It pins the option wording, iteration budget, state-write cadence, and exit conditions so each applying skill describes only its workflow-specific deltas instead of restating the loop.
|
|
4
|
+
|
|
5
|
+
**Applies to**:
|
|
6
|
+
|
|
7
|
+
- `dev-verify` — the `verification-done` step after `implementation-verifier` returns `passed_with_issues` or `failed`
|
|
8
|
+
- `migration-fix` — when the verification state facts say fixable issues remain (`issues-resolved`)
|
|
9
|
+
|
|
10
|
+
Skills that use the loop MUST reference this file and document only their deltas in the "Workflow-Specific Deltas" section.
|
|
11
|
+
|
|
12
|
+
---
|
|
13
|
+
|
|
14
|
+
## Loop (max 3 iterations)
|
|
15
|
+
|
|
16
|
+
1. **Display the detailed issue breakdown** grouped by category and severity, with location, description, and fixability.
|
|
17
|
+
2. **Present critical + warning issues as a numbered list.** Info issues are listed for awareness, not actionable.
|
|
18
|
+
3. **Ask via `question`** — "Which issues should I fix?" with exactly three options:
|
|
19
|
+
- **"Fix all fixable issues"**
|
|
20
|
+
- **"Let me choose specific issues"**
|
|
21
|
+
- **"Skip fixes, proceed as-is"**
|
|
22
|
+
4. **Fix the selected issues directly.** Immediately after each fix, append it to `verification_context.fixes_applied` in state — never defer to the end of the loop. Bump `orchestrator.updated`; re-read the state file + run `verify_template`.
|
|
23
|
+
5. **After fixes, set `options.skip_test_suite: false`** (code changed — the suite must re-run on re-verification).
|
|
24
|
+
6. **Ask via `question`** — "Re-run verification to check fixes?" with options:
|
|
25
|
+
- **"Yes, re-run verification"** → re-invoke `implementation-verifier` (Skill tool), then **immediately** update `verification_context.reverify_count` and refresh `verification_context.last_status` + `issues_found` from the verifier's structured return; return to step 1.
|
|
26
|
+
- **"No, proceed to next phase"** → exit the loop to the Exit Gate.
|
|
27
|
+
7. **Record each user decision** (specific selection, proceed-with-warnings, deliberate skip) in `verification_context.decisions_made`.
|
|
28
|
+
|
|
29
|
+
The loop is capped at **3 iterations**; at the cap, the question in "Exit Conditions" decides the outcome.
|
|
30
|
+
|
|
31
|
+
---
|
|
32
|
+
|
|
33
|
+
## Exit Conditions
|
|
34
|
+
|
|
35
|
+
| Condition | Action |
|
|
36
|
+
| --------- | ------ |
|
|
37
|
+
| ✅ No critical issues remain | Append the skill's success slug and proceed. |
|
|
38
|
+
| ⚠ Max 3 iterations reached | `question` — "Proceed with known issues?" / stop-or-rollback option. Proceed ⇒ append the success slug with the approval recorded in `decisions_made`; stop/rollback ⇒ do NOT append, record the decision. |
|
|
39
|
+
| Deliberate skip ("Skip fixes, proceed as-is") | A user-chosen skip, not a failure: no success slug, no failure entry; record the reason in `phase_summaries.<fix>.summary` + `decisions_made`. |
|
|
40
|
+
| ❌ Critical issues remain unresolved | **MUST NOT proceed without explicit user approval.** |
|
|
41
|
+
| Verifier itself fails | Do NOT append the success slug; append it to `orchestrator.failed_phases` and increment `auto_fix_attempts["<slug>"]`. |
|
|
42
|
+
|
|
43
|
+
---
|
|
44
|
+
|
|
45
|
+
## State Writes (per iteration, never batched)
|
|
46
|
+
|
|
47
|
+
- `fixes_applied` — after every fix.
|
|
48
|
+
- `reverify_count` + refreshed `last_status` / `issues_found` — right after each verifier run.
|
|
49
|
+
- `decisions_made` — after each user decision.
|
|
50
|
+
- The success slug — only when the loop settles (✅, or an approved ⚠); never on a deliberate skip or a failure.
|
|
51
|
+
|
|
52
|
+
**Single-writer split**: the verification step owns the initial `last_status` / `issues_found`; the fix loop owns `fixes_applied`, `reverify_count`, `decisions_made`, plus the re-verify refresh of `last_status` / `issues_found`.
|
|
53
|
+
|
|
54
|
+
---
|
|
55
|
+
|
|
56
|
+
## Workflow-Specific Deltas
|
|
57
|
+
|
|
58
|
+
### Development (`dev-verify`)
|
|
59
|
+
|
|
60
|
+
None beyond this contract.
|
|
61
|
+
|
|
62
|
+
### Migration (`migration-fix`)
|
|
63
|
+
|
|
64
|
+
- **Compatibility verdict invalidation**: after fixes, set `verification_context.compatibility_status: null` (field-level fail-closed exception — the compatibility checks ran against pre-fix code). Only `migration-verify` may set a new verdict; when it is not `passed`, the required next step is `/owflow:migration-verify <task-path>`, never finalize.
|
|
65
|
+
- **Data-integrity HALT**: data-integrity issues are NEVER auto-fixed. HALT, present the rollback option with the issue, and append the failure entry; rollback happens only on explicit user confirmation — no automatic rollback or revert ever. A deliberate skip cannot waive a data-integrity failure or any non-passed compatibility check.
|
|
@@ -1,117 +1,122 @@
|
|
|
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
|
-
#### migration-* bootstrap
|
|
54
|
-
|
|
55
|
-
- Task directory under `.owflow/tasks/migrations/`; template `orchestrator-state-migration.yml`; fresh-start hint: `Run /owflow:migration <description> to start a migration task from scratch.`
|
|
56
|
-
- Skill starting points (used for the bootstrap question and `started_phase`): migration-analyze → `state-analysed`; migration-target → `target-planned`; migration-spec → `strategy-specified`; migration-plan → `plan-created`; migration-implement → `migration-executed`; migration-verify → `options-chosen`; migration-fix → `issues-resolved`; migration-finalize → `task-completed`.
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
- **
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
- **
|
|
95
|
-
- **
|
|
96
|
-
- **
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
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
|
+
#### migration-* bootstrap
|
|
54
|
+
|
|
55
|
+
- Task directory under `.owflow/tasks/migrations/`; template `orchestrator-state-migration.yml`; fresh-start hint: `Run /owflow:migration <description> to start a migration task from scratch.`
|
|
56
|
+
- Skill starting points (used for the bootstrap question and `started_phase`): migration-analyze → `state-analysed`; migration-target → `target-planned`; migration-spec → `strategy-specified`; migration-plan → `plan-created`; migration-implement → `migration-executed`; migration-verify → `options-chosen`; migration-fix → `issues-resolved`; migration-finalize → `task-completed`.
|
|
57
|
+
|
|
58
|
+
#### performance-* bootstrap
|
|
59
|
+
|
|
60
|
+
- Task directory under `.owflow/tasks/performance/`; template `orchestrator-state-performance.yml`; fresh-start hint: `Run /owflow:performance <description> to start a task from scratch.`
|
|
61
|
+
- Skill starting points (used for the bootstrap question and `started_phase`): performance-analyze → `codebase-analysed`; performance-spec → `spec-written`; performance-plan → `plan-created`; performance-implement → `implementation-done`; performance-verify → `options-chosen`; performance-finalize → `task-completed`.
|
|
62
|
+
|
|
63
|
+
### Deterministic entry checks (future)
|
|
64
|
+
|
|
65
|
+
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.
|
|
66
|
+
|
|
67
|
+
## Exit Gate
|
|
68
|
+
|
|
69
|
+
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.
|
|
70
|
+
|
|
71
|
+
1. **Results box** — one-screen markdown summary (no ASCII borders, markdown headings/bold carry the emphasis):
|
|
72
|
+
|
|
73
|
+
```markdown
|
|
74
|
+
## ✅ <SKILL> COMPLETE — <task name>
|
|
75
|
+
|
|
76
|
+
**<Field 1>** — [key outcome]
|
|
77
|
+
**<Field 2>** — [key outcome]
|
|
78
|
+
|
|
79
|
+
**Artifacts**
|
|
80
|
+
|
|
81
|
+
- `relative/path/to/artifact.md`
|
|
82
|
+
|
|
83
|
+
**Next ▸** `/owflow:<next-skill> <task-path>`
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
Conventions:
|
|
87
|
+
- Status glyphs follow the outcome: ✅ pass/success, ⚠ pass-with-concerns/partial, ❌ fail.
|
|
88
|
+
- 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).
|
|
89
|
+
|
|
90
|
+
2. **Results-acceptance question** (MANDATORY, fires before any handoff hint):
|
|
91
|
+
|
|
92
|
+
Use `question` — "Are these results correct?" with options:
|
|
93
|
+
- **Accept** — results are good; proceed to the next-step hint.
|
|
94
|
+
- **Adjust** — user specifies what to change; re-work ONLY the affected parts, update artifacts/state, then re-present the results box and re-ask.
|
|
95
|
+
- **Discuss** — walk through a specific result in more depth (evidence, reasoning, alternatives); after the discussion, re-ask.
|
|
96
|
+
- **Stop here** — artifacts persist; print the resume command (`/owflow:<this-skill> <task-path>` or the next phase command) and end.
|
|
97
|
+
|
|
98
|
+
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**:
|
|
99
|
+
- **Purpose** — one line stating what the proposed skill does.
|
|
100
|
+
- **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`.
|
|
101
|
+
- **Remaining plan** (for optional/alternative paths) — one compact line listing the phases still ahead in execution order, marking which are optional.
|
|
102
|
+
- Standalone review/utility commands are annotated `optional — does not advance phases`.
|
|
103
|
+
|
|
104
|
+
Example shape (~5 lines):
|
|
105
|
+
|
|
106
|
+
```
|
|
107
|
+
→ /owflow:dev-verify <task-path>
|
|
108
|
+
What: runs the verification pipeline (completeness, code review, fixes) — required before commit. Remaining after: /owflow:dev-finalize (required).
|
|
109
|
+
Other options:
|
|
110
|
+
/owflow:reviews-code <task-path> — optional, does not advance phases (standalone re-run of code review)
|
|
111
|
+
/owflow:goal-development <task-path> — optional shortcut: runs all remaining phases in one loop (… → verify → finalize)
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
Then STOP. Never auto-invoke the next skill.
|
|
115
|
+
|
|
116
|
+
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.
|
|
117
|
+
|
|
118
|
+
## Exceptions
|
|
119
|
+
|
|
120
|
+
- **Dispatchers** (`development`, `research`, `performance`, `migration`): 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).
|
|
121
|
+
- **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).
|
|
122
|
+
- **Orchestrated mode** (`goal-development`, `goal-research`, `goal-performance`, `goal-migration`): 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`.
|