@azure-id/orc 0.56.1 → 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (153) hide show
  1. package/CHANGELOG.md +2367 -2218
  2. package/README-id.md +49 -107
  3. package/README.md +45 -133
  4. package/bin/build-agents.js +18 -11
  5. package/bin/cli.js +33060 -29855
  6. package/bin/onboarding-content.js +0 -3
  7. package/bin/test-run.js +491 -0
  8. package/bin/verify-contracts.js +4256 -3277
  9. package/bin/verify-package.js +563 -498
  10. package/bin/webui/api.js +1186 -1163
  11. package/bin/webui/app.html +9 -0
  12. package/bin/webui/css/06-responsive.css +120 -108
  13. package/bin/webui/css/panels/extra.css +29 -0
  14. package/bin/webui/css/panels/lanes.css +134 -0
  15. package/bin/webui/css/panels/settings.css +79 -3
  16. package/bin/webui/fixtures/extra.js +2036 -1934
  17. package/bin/webui/fixtures/flow.js +2 -2
  18. package/bin/webui/fixtures/index.js +503 -486
  19. package/bin/webui/fixtures/lanes.js +218 -0
  20. package/bin/webui/fixtures/settings.js +261 -34
  21. package/bin/webui/fixtures/stats.js +3 -3
  22. package/bin/webui/i18n/TERMS.md +135 -134
  23. package/bin/webui/i18n/en/extra.json +345 -313
  24. package/bin/webui/i18n/en/lanes.json +29 -0
  25. package/bin/webui/i18n/en/nav.json +1 -0
  26. package/bin/webui/i18n/en/overview.json +2 -0
  27. package/bin/webui/i18n/en/settings.json +16 -5
  28. package/bin/webui/i18n/id/extra.json +345 -313
  29. package/bin/webui/i18n/id/lanes.json +29 -0
  30. package/bin/webui/i18n/id/nav.json +1 -0
  31. package/bin/webui/i18n/id/overview.json +2 -0
  32. package/bin/webui/i18n/id/settings.json +15 -4
  33. package/bin/webui/js/01-i18n.js +1 -0
  34. package/bin/webui/js/panels/extra.js +3199 -3011
  35. package/bin/webui/js/panels/lanes.js +259 -0
  36. package/bin/webui/js/panels/overview.js +10 -0
  37. package/bin/webui/js/panels/settings.js +149 -3
  38. package/package.json +39 -39
  39. package/templates/agents/MODEL-MAPPING.md +23 -35
  40. package/templates/agents/orc-executor-opus-4-7-high.md +1 -1
  41. package/templates/agents/orc-executor-opus-4-7-med.md +1 -1
  42. package/templates/agents/orc-executor-opus-4-8-high.md +1 -1
  43. package/templates/agents/orc-executor-opus-5-high.md +1 -1
  44. package/templates/agents/orc-executor-opus-5-low.md +1 -1
  45. package/templates/agents/orc-executor-opus-5-med.md +1 -1
  46. package/templates/agents/orc-retro-opus-5-med.md +73 -73
  47. package/templates/agents/orc-retro-sonnet-5-high.md +72 -72
  48. package/templates/agents/orc-trace-writer-haiku-4-5.md +107 -107
  49. package/templates/commands/orc-route.md +1 -1
  50. package/templates/commands/orc.md +1 -1
  51. package/templates/skills/_shared/README.md +7 -3
  52. package/templates/skills/_shared/config-precedence.md +198 -0
  53. package/templates/skills/_shared/drift-recovery.md +1 -1
  54. package/templates/skills/_shared/extra-dispatch.md +159 -7
  55. package/templates/skills/_shared/interview.md +1 -1
  56. package/templates/skills/_shared/opus5-only.md +9 -7
  57. package/templates/skills/_shared/phases/README.md +82 -0
  58. package/templates/skills/{orc/references → _shared/phases}/analyst-gates.md +15 -3
  59. package/templates/skills/_shared/phases/execution.md +143 -0
  60. package/templates/skills/{orc/references → _shared/phases}/house-rules.md +13 -1
  61. package/templates/skills/{orc/references → _shared/phases}/intake.md +15 -2
  62. package/templates/skills/_shared/phases/mock-example.md +56 -0
  63. package/templates/skills/{orc/references → _shared/phases}/plan-handoff.md +16 -3
  64. package/templates/skills/_shared/phases/planning.md +135 -0
  65. package/templates/skills/_shared/phases/preflight.md +76 -0
  66. package/templates/skills/_shared/phases/review.md +53 -0
  67. package/templates/skills/_shared/phases/scoring.md +65 -0
  68. package/templates/skills/{orc/references → _shared/phases}/security-checklist.md +12 -1
  69. package/templates/skills/_shared/phases/security.md +55 -0
  70. package/templates/skills/_shared/phases/ship.md +88 -0
  71. package/templates/skills/{orc/references/stop-and-resume.md → _shared/phases/stop-resume.md} +169 -160
  72. package/templates/skills/_shared/phases/summary.md +48 -0
  73. package/templates/skills/_shared/phases/testgen.md +51 -0
  74. package/templates/skills/{orc/references/trace-protocol.md → _shared/phases/trace.md} +49 -6
  75. package/templates/skills/_shared/phases/verify.md +70 -0
  76. package/templates/skills/{orc/references → _shared/phases}/wave-grouping.md +14 -2
  77. package/templates/skills/{orc/references → _shared/phases}/wiki-consult.md +13 -1
  78. package/templates/skills/_shared/read-ladder.md +48 -0
  79. package/templates/skills/context-combiner/SKILL.md +214 -187
  80. package/templates/skills/orc/README.md +148 -150
  81. package/templates/skills/orc/SKILL.md +70 -358
  82. package/templates/skills/orc/config.md +137 -389
  83. package/templates/skills/orc/examples/full-run-mock.md +1 -1
  84. package/templates/skills/orc/references/effort-and-mode.md +16 -18
  85. package/templates/skills/orc/references/phases/intake.md +47 -0
  86. package/templates/skills/orc/references/phases/integration.md +19 -0
  87. package/templates/skills/orc/references/preflight-report.md +4 -4
  88. package/templates/skills/orc/references/ultra-mode.md +117 -123
  89. package/templates/skills/orc/schemas/planning-output.md +279 -279
  90. package/templates/skills/orc/subskills/orc-planner/SKILL.md +260 -264
  91. package/templates/skills/orc/subskills/orc-pr/stack-gate.md +4 -1
  92. package/templates/skills/orc-aftermath/SKILL.md +153 -136
  93. package/templates/skills/orc-analyze/SKILL.md +247 -220
  94. package/templates/skills/orc-analyze/references/branching.md +51 -51
  95. package/templates/skills/orc-analyze/references/thin-input.md +1 -1
  96. package/templates/skills/orc-analyze-mini/SKILL.md +128 -112
  97. package/templates/skills/orc-boundary/SKILL.md +244 -208
  98. package/templates/skills/orc-brainstorm/SKILL.md +372 -339
  99. package/templates/skills/orc-budget/SKILL.md +243 -225
  100. package/templates/skills/orc-challenge/README.md +1 -1
  101. package/templates/skills/orc-challenge/SKILL.md +293 -255
  102. package/templates/skills/orc-challenge/examples/council-full-roster.md +1 -1
  103. package/templates/skills/orc-claude/SKILL.md +216 -199
  104. package/templates/skills/orc-diy/README.md +2 -1
  105. package/templates/skills/orc-diy/SKILL.md +129 -70
  106. package/templates/skills/orc-diy/references/blocks/analyze.md +1 -1
  107. package/templates/skills/orc-diy/references/compile.md +21 -7
  108. package/templates/skills/orc-diy/references/flow-schema.md +2 -2
  109. package/templates/skills/orc-doc/SKILL.md +44 -7
  110. package/templates/skills/orc-explain/SKILL.md +19 -0
  111. package/templates/skills/orc-export/SKILL.md +26 -5
  112. package/templates/skills/orc-fast/SKILL.md +215 -187
  113. package/templates/skills/orc-grill/SKILL.md +233 -207
  114. package/templates/skills/orc-handoff/SKILL.md +223 -204
  115. package/templates/skills/orc-learn/SKILL.md +176 -156
  116. package/templates/skills/orc-mini/SKILL.md +41 -23
  117. package/templates/skills/orc-pact/SKILL.md +250 -218
  118. package/templates/skills/orc-pattern/SKILL.md +149 -124
  119. package/templates/skills/orc-poly/SKILL.md +237 -216
  120. package/templates/skills/orc-poly/references/gather.md +1 -1
  121. package/templates/skills/orc-pr-driver/SKILL.md +196 -167
  122. package/templates/skills/orc-pr-driver/references/orc-run-split.md +1 -1
  123. package/templates/skills/orc-pr-setup/SKILL.md +212 -184
  124. package/templates/skills/orc-quick/README.md +2 -2
  125. package/templates/skills/orc-quick/SKILL.md +45 -12
  126. package/templates/skills/orc-quick/references/dispatch-gate.md +2 -3
  127. package/templates/skills/orc-retro/SKILL.md +244 -222
  128. package/templates/skills/orc-retro/examples/retro-mock.md +171 -171
  129. package/templates/skills/orc-route/SKILL.md +183 -165
  130. package/templates/skills/orc-verify/SKILL.md +100 -86
  131. package/templates/skills/orc-wiki/SKILL.md +55 -206
  132. package/templates/skills/orc-wiki/references/phases/phase-0.md +71 -0
  133. package/templates/skills/orc-wiki/references/phases/phase-1.md +35 -0
  134. package/templates/skills/orc-wiki/references/phases/phase-2.md +52 -0
  135. package/templates/skills/orc-wiki/references/phases/phase-3.md +57 -0
  136. package/templates/skills/orc-wiki/references/phases/phase-3c.md +36 -0
  137. package/templates/agents/orc-advisor-fable-5.md +0 -50
  138. package/templates/agents/orc-analyst-fable-5.md +0 -115
  139. package/templates/agents/orc-judge-fable-5.md +0 -79
  140. package/templates/agents/orc-planner-fable-5.md +0 -152
  141. package/templates/agents/orc-reviewer-fable-5.md +0 -57
  142. package/templates/skills/_shared/fable5-override.md +0 -56
  143. package/templates/skills/orc-diy/references/blocks/execution.md +0 -42
  144. package/templates/skills/orc-diy/references/blocks/mock-example.md +0 -22
  145. package/templates/skills/orc-diy/references/blocks/planning.md +0 -34
  146. package/templates/skills/orc-diy/references/blocks/review.md +0 -18
  147. package/templates/skills/orc-diy/references/blocks/scoring.md +0 -16
  148. package/templates/skills/orc-diy/references/blocks/security.md +0 -25
  149. package/templates/skills/orc-diy/references/blocks/ship.md +0 -25
  150. package/templates/skills/orc-diy/references/blocks/summary.md +0 -18
  151. package/templates/skills/orc-diy/references/blocks/testgen.md +0 -17
  152. package/templates/skills/orc-diy/references/blocks/trace.md +0 -28
  153. package/templates/skills/orc-diy/references/blocks/verify.md +0 -25
@@ -31,6 +31,10 @@ is hard-blocked by the `orc-effort-guard.js` PreToolUse hook; the model cannot b
31
31
  and tell the user to switch the main session and re-run — never intake below it
32
32
  (subagents cannot exceed the main tier, so the Opus executors silently downgrade).
33
33
 
34
+ The SHAPE of these steps — the order, and the four rules that make it worth
35
+ having — is `../_shared/phases/preflight.md` (`core` + `full`). The probes
36
+ themselves are this lane's own and stay here.
37
+
34
38
  ## Hard rules (never violate)
35
39
 
36
40
  1. **You NEVER implement. You coordinate.** All execution, review, and verify
@@ -72,7 +76,7 @@ into ONE combined spec; build only on `handoff_ready` with `coverage_pct` =
72
76
  100; full lane only. **Planner** `subskills/orc-planner` (Opus 5 medium):
73
77
  request or spec → planning-output. Scout dispatch, analyst-return gates,
74
78
  combiner tracking, the `git_head` staleness valve, and the Phase 1 exit gate
75
- are YOURS and deterministic — load `references/analyst-gates.md` at their
79
+ are YOURS and deterministic — load `../_shared/phases/analyst-gates.md` at their
76
80
  trigger points; emit `GATE` trace lines.
77
81
 
78
82
  ## Dispatch via named agents (not prose)
@@ -81,29 +85,42 @@ Workers are model-pinned SUBAGENTS in `.claude/agents/` — the model is enforce
81
85
  not requested in prose. Score every task from the planner-emitted `facets` via
82
86
  the fixed arithmetic formula and SHOW the table with the facet vector + the
83
87
  arithmetic (`B+N+L+T+fan+U = raw`; an un-shown number is not scored); map the
84
- final score via the RESOLVED table in `config.md` — `opus5_only` (3-band Opus-5-only, FORCING) > `rubric_bands_override` > the default 8-band (`rubric_bands` = granularity only, never a preset); NAME it when you show scores; sibling tasks differing in ≤1 facet share a
88
+ final score via the RESOLVED table in `config.md` — `opus5_only` (2-band Opus-5-only, FORCING) > `rubric_bands_override` > the default 6-band (`rubric_bands` = granularity only, never a preset); NAME it when you show scores; sibling tasks differing in ≤1 facet share a
85
89
  band or cite the differing facet (see `references/effort-and-mode.md`). EVERY
86
90
  dispatch is scored — fix-cycle dispatches (review-fix, verify-fix, P2-batch,
87
91
  requeue) run the same formula, inherit the original task's risk floor, and never
88
92
  dispatch below the finding-task's band. Fixed roles dispatch BY NAME (analyst /
89
93
  combiner / planner / reviewer / verifier — see `config.md`'s fixed-role table +
90
94
  `.claude/agents/MODEL-MAPPING.md`). If `opus5_only`, EVERY role (scored and fixed)
91
- resolves to its Opus 5 agent, FORCING over everything below — `_shared/opus5-only.md`;
92
- else if `fable5_enabled`, roles in `fable5_roles` dispatch their
93
- `orc-<role>-fable-5` variant — `_shared/fable5-override.md`.
95
+ resolves to its Opus 5 agent, FORCING over everything below — `_shared/opus5-only.md`.
94
96
  Caveat: a subagent's model can't exceed the MAIN session's tier — run the main
95
97
  session on Opus or the Opus pins silently fall back (the original "wrong model" bug).
96
98
 
97
99
  ## Config (read at run start)
98
100
 
99
- Read `config.md` defaults, merge the user override `.claude/orc.config.yaml` on
100
- top (written by the `orc config` CLI; survives `orc update`; per-run overrides
101
- allowed). Keys: `max_wave_tasks`, `batch_pause_every`, `max_scouts`,
102
- `default_analysis_depth`, `generate_tests`, `pattern_findings`, `security_review`, `log_dir`.
101
+ **ONE resolver, and it is not you:** `orc lane config orc --json`. Obey
102
+ `effective`, print every line in `announce[]` VERBATIM at preflight, and honour
103
+ `stops[]` before wave 1. Never re-derive a value, a precedence or an inertness
104
+ from `.claude/orc.config.yaml` a key this lane does not read is not in the
105
+ answer, and a key another key shadows comes back already marked. Exit ≠ 0 → say
106
+ the CLI is unavailable and fall back to `../_shared/config-precedence.md`'s
107
+ documented defaults, out loud. Priorities and families:
108
+ `../_shared/config-precedence.md`.
109
+
110
+ ## Calls
111
+
112
+ **ONE catalogue, and it is not you:** `orc lane calls orc --json` names every
113
+ CLI call this lane makes, each with its exit-code contract, its cost, when to run
114
+ it, and what an EMPTY answer means. Never invent a spelling, never re-word an
115
+ exit code, and never re-derive a state word — the CLI's state words are the only
116
+ state words, and **an exit code is an ANSWER wherever that contract says so, not
117
+ a failure**. A call the answer does not name is a call this lane does not make.
118
+ Exit ≠ 0 from the catalogue itself → say the CLI is unavailable and name the
119
+ command you are about to run, out loud, before running it.
103
120
 
104
121
  ## Behavior trace (PERMANENT — always on, no config toggle)
105
122
 
106
- Follow `references/trace-protocol.md` (ALWAYS load it at run start). The
123
+ Follow `../_shared/phases/trace.md` (ALWAYS load it at run start). The
107
124
  `orc-trace.js` hook writes the `SPAWN`/`RETURN`/`PHASE-EDGE` skeleton
108
125
  deterministically; the rich narrative is **dispatched, never remembered** — every
109
126
  `emit <VERB>` step below means RECORD that event, with its REAL timestamp, into
@@ -163,18 +180,18 @@ them; they are never dispatched as subagents).
163
180
 
164
181
  ## Constellation map (load on demand only)
165
182
 
166
- - Run start → `references/trace-protocol.md` (always)
167
- - Phase 0 → `references/intake.md`; **plan input → `references/plan-handoff.md`**;
183
+ - Run start → `../_shared/phases/trace.md` (always)
184
+ - Phase 0 → `../_shared/phases/intake.md`; **plan input → `../_shared/phases/plan-handoff.md`**;
168
185
  ultra_mode → `references/ultra-mode.md`
169
- - Phase 0/1 analyst-planner gates → `references/analyst-gates.md`
170
- - Phase 1 wiki grounding → `references/wiki-consult.md` + `references/preflight-report.md`
186
+ - Phase 0/1 analyst-planner gates → `../_shared/phases/analyst-gates.md`
187
+ - Phase 1 wiki grounding → `../_shared/phases/wiki-consult.md` + `references/preflight-report.md`
171
188
  - Phase 2 → `references/effort-and-mode.md`; tagging → `references/pattern-gate.md`
172
- - Phase 3 → `references/wave-grouping.md` + `log-protocol.md` + `house-rules.md`
189
+ - Phase 3 → `../_shared/phases/wave-grouping.md` + `log-protocol.md` + `../_shared/phases/house-rules.md`
173
190
  + `pattern-gate.md` (resolve gate); workers → `subskills/orc-execution/`;
174
- stops → `subskills/orc-checkpoint/SKILL.md` + `references/stop-and-resume.md`
191
+ stops → `subskills/orc-checkpoint/SKILL.md` + `../_shared/phases/stop-resume.md`
175
192
  - Phase 5–6 → `subskills/orc-review-verify/`; FE tasks →
176
193
  `../orc-pattern/references/fe-a11y.md` + `fe-perf.md` (as `fe_rules[]`)
177
- - Phase 5.5 → `references/security-checklist.md`; 6.5 → `subskills/orc-testgen/`
194
+ - Phase 5.5 → `../_shared/phases/security-checklist.md`; 6.5 → `subskills/orc-testgen/`
178
195
  - Phase 8 → `subskills/orc-pr/SKILL.md` (template `subskills/orc-pr/pr.md`);
179
196
  stack gate → `subskills/orc-pr/stack-gate.md` + `_shared/pr-templates.md`
180
197
  - Schemas (you own; pass slices only): `schemas/intent-spec.md`,
@@ -183,344 +200,39 @@ them; they are never dispatched as subagents).
183
200
 
184
201
  ---
185
202
 
186
- ## Phase 0 — Intake (load references/intake.md) · Trace: `PHASE intake`
187
-
188
- **Plan-input trigger (check FIRST load `references/plan-handoff.md`):** if the
189
- run input IS a plan (pasted planning-output, a `plan-{name}.md` path, or an
190
- `orc/planner/{name}/` checkpoint), follow that reference: bootstrap the trace,
191
- schema-validate, apply the `plan_head` staleness valve, RE-RUN the full Phase 1
192
- exit gate here (the deterministic catch for phantom-file drift), relay
193
- `open_questions[]`, then continue at Phase 2. A plan input never skips Phase 2/3
194
- nor executes task-by-task ad hoc.
195
-
196
- **Analyst auto-trigger:** on a document (PDF path, pasted doc, audit sheet)
197
- OR an ambiguous/underspecified requirement, FIRST dispatch the System Analyst
198
- (doc-optional — with no doc the request itself is the source). Offer
199
- standard/deep (`config.default_analysis_depth` presets it; mention `orc
200
- config set default_analysis_depth deep`); deep you dispatch the scouts. On
201
- return run the analyst-return gates (analyst-gates.md); on build, continue at
202
- Phase 1 with the Requirement Planner.
203
-
204
- Emit `PHASE intake start` FIRST, then create `run/{run-slug}/` (slug from the
205
- intent). Then: rough-size
206
- question tier (2/4/6) → ONE batched question round → draft the intent-spec
207
- (`schemas/intent-spec.md`) **repo cross-check** (intake Step 3.5:
208
- Glob/Grep-confirm everything the spec names, or tag `UNVERIFIED`; tags become
209
- ONE batched sign-off question; >3 tags recommend `orc-analyze`) sign-off
210
- preference (gate/soft; DEFAULT GATE) show spec approval or edits. **No
211
- planning until approved (gate mode) and no unresolved `UNVERIFIED` tags
212
- either way.** On approval, emit `PHASE intake end`.
213
-
214
- The intent-spec's definition-of-done becomes Phase 6's acceptance criteria;
215
- its constraints become hard rules in every slice at slice-assembly each
216
- task's `spec_invariants[]` is appended VERBATIM to that slice's
217
- `constraints[]`. Offer the opt-in **Test Authoring** (Phase 6.5; default
218
- `config.generate_tests`) in the sign-off round.
219
-
220
- ## Phase 1 Planning · Trace: `PHASE planning`, `CONFIG`, `WIKI-CONSULT`, `CROSSLINK`, `GATE`
221
-
222
- Emit `PHASE planning start`, then emit ONE `CONFIG <key=value …>` line with the
223
- resolved values of every config key this run will consume (incl. `fable5_*` when enabled, and ALWAYS `opus5_only` — it selects the executor table AND every fixed role, so retro can segment per-band outcomes BY dispatch mode) — the runtime
224
- proof `/orc-retro` audits that the run honored the config.
225
- **Wiki consult (load `references/wiki-consult.md`;
226
- always report — no tier is silent):** read the FRESH/AGING/STALE tier from
227
- **`orc wiki status`** (v0.41.0 — deterministic; never hand-compute it from `wiki-meta.json`), pull the relevant pages (incl. cross-cutting maps like `orc-reference-api-surface`), apply
228
- `code > fresh wiki > stale wiki (hints) > model priors`, emit
229
- `WIKI-CONSULT <tier> :: docs=<pages>`, print the one-line tier report (every tier, `absent` included), and attribute per-dispatch too — `wiki:` on the `DISPATCH` line + a `wiki_used` return (wiki-consult.md Step 5). **Crosslink:** per wiki-consult.md, inject
230
- the cached `.claude/orc/crosslink/needs.json` contract into any boundary-touching
231
- task (advisory) and print + emit `CROSSLINK <state> :: boundaries=<n> peers=<names>`
232
- — `configured-no-cache` prints the "cache not built" warning (full orc reads
233
- only pre-built needs/cache, never peer source live). **Gotchas (repair memory,
234
- config `gotchas`):** probe ONCE with `orc gotcha status` (exit 0 = entries exist,
235
- 1 = none — never a `find`); canonical `_shared/gotchas.md`.
236
- **Pact / boundary / aftermath / wiki debt (v0.46.0 — all CONSUMED here, never
237
- written here):** probe `orc pact status --json` (`pact_gate`, default `warn`),
238
- `orc boundary status --json` (`boundary_gate`, default `warn`), `orc wiki debt
239
- --json`, and — only to decide whether the preflight's `after:` line fires at all —
240
- `orc aftermath status --json`. Print each probe's own `line` VERBATIM; never
241
- recount or re-word one. Gates: `../orc-pact/references/gate.md` +
242
- `../orc-boundary/references/gate.md`. **Challenge (v0.47.0, `challenge_gate`,
243
- default `warn`):** when the run's INPUT DOCUMENT has a cycle, print
244
- `orc challenge status <slug> --json`'s `preflight_line` verbatim — building from
245
- a document that has not passed its own review is worth one line. There is no
246
- `block` mode (the `/orc-pact` precedent). **Extra (v0.50.0, `extra_enabled`) —
247
- resolved HERE, announced HERE, never silent:** load `../_shared/extra-dispatch.md`;
248
- per task run `orc extra resolve <score> --role executor --risk <n> --json`, and
249
- before wave 1 settle its two pre-dispatch states, both PRINTED — a `needs_reping`
250
- profile (re-ping; a STALE profile still routes) and a vaulted credential, which is
251
- **LOCKED AT DISPATCH TIME whatever `credential.present` says** and falls back to
252
- Claude rather than stopping the run. **Preflight:** print the compact block per
253
- `references/preflight-report.md` once wiki + crosslink (+ pattern/waves) resolve.
254
-
255
- Ask which planner: **Superpowers / OpenSpec / Requirement Planner / ORC
256
- (self)**. With an analyst requirement-spec present, the Requirement Planner
257
- is the natural choice (consumes the spec; does NOT re-question scope); apply
258
- the `git_head` staleness valve first (analyst-gates.md). Dispatch the planner
259
- as a subagent — never plan yourself.
260
-
261
- **CRITICAL — planning always hands back here.** However a plan was produced,
262
- control returns to THIS orchestrator, which runs Phase 2 → 3 → … → 8 — never
263
- jump from a plan straight to implementation. **ONE exception — a poly-spec
264
- (`orc-poly:spec`, from `/orc-poly`):** the planner runs poly-split mode (one
265
- plan per repo, each pinned to the frozen contract, each written into its own
266
- repo); present the per-repo plans + build handoff and STOP — a poly-spec is the
267
- only input that does NOT proceed to Phase 2 (each repo builds later, in its own
268
- `/orc` session). The plan must satisfy
269
- `schemas/planning-output.md` (per-task `declared_files` incl. tests,
270
- `grounding[]`, `acceptance[]`, `requirements[]`, `spec_invariants[]`,
271
- `depends_on`, `owns_area`, `spec_ref`, + a `coverage` echo, + `tdd_spec` —
272
- TDD is ALWAYS ON in full orc/ultra but **SCOPED to what can actually fail (v0.41.0)**: a `disposition` per entry (`new-surface | behavior-change | covered-by-existing | no-behavior | no-runner`) DERIVED from the planner's facets — constants/translations/file-splits get NO test, a cited `risk[]` is never scoped out, and a PAIRED task materializes it, never a Wave 0 (schema notes 7-8; gate check 5);
273
- missing declared files → extract and confirm before leaving this phase.
274
-
275
- **Phase 1 exit gate** (deterministic — full checks in analyst-gates.md; emit
276
- `GATE` lines): Glob every `disposition: exists` path, recompute coverage (no
277
- `orphan` requirements), cycle + same-file collision checks. Any miss →
278
- bounce to the planner (one retry), then escalate. **After the gate passes,
279
- relay the plan's `open_questions[]` in ONE batch:** blocking questions must be
280
- answered before Phase 2; non-blocking show their `proposed_default` for tacit
281
- approval. **Step-back valve:** `plan_confidence: low` OR >3 blocking questions →
282
- recommend stepping back to `orc-analyze` (user may override and proceed).
283
- **Pact injection (`pact_gate: warn`) — the payoff, and it happens HERE:** a
284
- DRIFTED or BROKEN promise whose `anchors` intersect a task's `declared_files` is
285
- appended VERBATIM to that task's `constraints[]` (the `spec_invariants[]`
286
- channel — no new plumbing) and PRINTED per task. HOLDING entries are never
287
- injected. Last month's decision constrains this month's plan, automatically. On
288
- pass, emit `PHASE planning end`.
289
-
290
- **Then print the `forecast:` block, BEFORE the Phase-2 pause question**
291
- (`references/preflight-report.md`) — tasks · waves · estimated subagents · model
292
- mix · a measured time RANGE · one cheaper lane and what it costs. This is the
293
- earliest instant every number is real and the last cheap moment to walk away.
294
- Presentation only, no new probes. When `config.run_budget_dispatches` > 0 and the
295
- forecast exceeds it, this is a **hard stop** with the batch pause's discipline
296
- (`GATE budget stop`) offering proceed · cheaper lane · re-plan smaller — never
297
- dispatch wave 1 past it.
298
-
299
- ## Phase 2 — Effort, dispatch style, scoring (load references/effort-and-mode.md) · Trace: `PHASE scoring`, `SCORE`
300
-
301
- Emit `PHASE scoring start`. Refine effort; recommend **sequential** vs
302
- **parallel** dispatch (worktrees for high-effort independent features) — user
303
- confirms. Dispatch style is **intra-wave concurrency only**: waves are computed
304
- regardless of style (sequential runs have waves too, see wave-grouping.md), so
305
- the batch pause always binds to wave numbers. **Batch-pause schedule (deterministic, not a cadence hint):** the plan
306
- has K waves — ask "pause after every wave / every 2nd / run straight through?"
307
- and SHOW the resulting stop list ("will pause after waves [list]"); a 2-wave
308
- plan plainly offers "pause after wave 1". Store it as `pause_schedule`, recompute
309
- each wave's `is_batch_pause` (last wave never pauses). **Facet-validation gate
310
- (deterministic):** recompute `breadth` + `fan_in`/`fan_out` from the plan; a
311
- mismatch or an uncited `risk` entry bounces the plan (grounding mechanics).
312
- **Score every task** from its `facets` via the fixed formula, map to the model
313
- ladder, show the facet vector + arithmetic table, and emit `SCORE task=<id>
314
- score=<n> band=<band> model=<m> facets=<vector> :: <reason>` per task; a score
315
- override needs a written reason (logged). **With `extra_enabled`** the table gains
316
- a `via` column and its head can name TWO tables (effort-and-mode.md); a foreign
317
- task's `SCORE` appends `via=extra:<profile>` and `model=` is the FOREIGN model id.
318
- **Cited-risk hold-back (deterministic, beside the facet gate):** a foreign-routed
319
- task with a non-empty `risk[]` is HELD BACK to its Claude band (`extra_risk_tasks`
320
- defaults to `off`) and every one is LISTED with its cited risk — a silently
321
- held-back task is indistinguishable from a forgotten one. Use the wiki's "Notes for planning" to sharpen
322
- core/isolated + risk factors. **Tag each task's pattern domain+language**
323
- (+ secondary `db: postgres`) per `references/pattern-gate.md`. Ask: "Any
324
- anticipated escalations, or run straight through?" Emit `PHASE scoring end`.
325
-
326
- ## Phase 3 — Execution (load wave-grouping.md + log-protocol.md) · Trace: `PHASE execution`, `DISPATCH`/`VERIFY`/`OUTCOME` per task
327
-
328
- Emit `PHASE execution start`. Build the conflict graph from `declared_files` →
329
- group waves (cap `max_wave_tasks`, mark `is_batch_pause` from `pause_schedule`;
330
- waves are computed for BOTH dispatch styles — sequential fires a wave's tasks
331
- one at a time, parallel fires them together) → SHOW the wave plan (wave → tasks →
332
- pause marks) to the user BEFORE wave 1 → write checkpoint + state-of-play BEFORE
333
- dispatching. **Boundary gate, per wave (`boundary_gate`; emit `BOUNDARY`):**
334
- `warn` prints each task's verdict; `block` additionally LIFTS a REFUSE task out of
335
- the wave — **the wave still runs the rest** — and hands it back with its checklist
336
- plus the "not blocked for you" line (it gates ORC's dispatch, never an explicit
337
- instruction). ESCALATE dispatches but gates ship on the named human, riding the
338
- EXISTING pause machinery. An uncarded area is `unknown`, never REFUSE. **Pattern-resolve gate
339
- (once, before the first wave):** resolve each tagged language per
340
- `references/pattern-gate.md` and report ONE user line per language (cache hit →
341
- apply cached; miss → codify/agnostic per `pattern_findings`; learn → dispatch
342
- the codifier); hold resolved patterns in run state.
343
-
344
- **TDD red proof — PAIRED TASKS, not a Wave 0 (v0.41.0):** TDD tasks are ORDINARY planner-emitted tasks the impl task `depends_on`, so they wave and score like any other (mechanics in `wave-grouping.md`); no `new-surface`/`behavior-change` entries → no TDD task at all. Each materializes its skeletons into real FAILING tests and returns the red evidence; emit `TDD-RED task=<id> iter=0` per requirement.
345
- **Pre-implementation green is read per `disposition`:** a `new-surface` entry that PASSES is a spec bug → block that requirement's dispatch and surface it; a `behavior-change` regression-guard passing is EXPECTED and blocks nothing; anything else → adjudicate with the user, recorded in `decisions`. Then per implementation wave:
346
- 1. Dispatch EVERY task as a spawned subagent (emit `DISPATCH <agent> :: <task>
347
- expect=<model>/<effort>` BEFORE the Task call; subagent wrapper framing + the
348
- task's INPUT SLICE per orc-execution/core.md + its scored model). Every
349
- slice carries the task's `acceptance[]`, its `tdd_spec` tests (the executor
350
- implements to green: implement→test→repair, cap `tdd_loop_max`, emitting
351
- `TDD-RED`/`TDD-GREEN` per iteration; cap hit → STOP SEQUENCE + honest red
352
- report) and the `house_rules` card lines
353
- (`references/house-rules.md`, injected LITERALLY — read once per run, never
354
- a pointer); FE/BE and `db:postgres` tasks get the resolved `pattern`
355
- injected literally (pattern-gate.md), and — with `gotchas: on` — the
356
- SCOPE-MATCHING gotchas beside it (glob vs this task's `declared_files`, cap 3,
357
- highest `hits` first; zero matches = NO block, never an empty one — NEVER
358
- inject unfiltered: `_shared/gotchas.md` §7).
359
- **A FOREIGN task uses Bash, not the Task tool:** write the IDENTICAL slice to a
360
- file and run `orc extra dispatch --task <file> --json` (exit codes + the
361
- fallback procedure: `../_shared/extra-dispatch.md`). Append `via=extra:<profile>`
362
- to the `DISPATCH` line and copy the return's `trace_line` + every
363
- `trace_extras[]` entry VERBATIM into the packet — the CLI composes them, and the
364
- hook emits NO `SPAWN`/`RETURN` for a foreign worker, so they are the whole record.
365
- 2. Record worker milestone pings (they bound what a mid-wave stop can save).
366
- 3. Collect returns; VALIDATE each (emit `VERIFY <task> actual=<model>/<effort>`
367
- ✅ MATCH / ⛔ DOWNGRADE per return — surface any downgrade to the user).
368
- **A FOREIGN return runs `_shared/return-validation.md` §2b INSTEAD of §2** — it
369
- has no injected model-id line, so it cannot carry `actual_model` and faking one
370
- claims evidence that does not exist; ⛔ SUBSTITUTION replaces the downgrade
371
- check. A failure runs the fallback procedure, which BEGINS with a free
372
- `orc extra reconcile <task>` — a worktree that moved is RESUMED, never re-done
373
- — then re-dispatches or STOPs, announced, with the `EXTRA fallback` line.
374
- `needs_context` → adjudicate → re-slice
375
- (cap 2 per task, then escalate). A `pattern` task must return
376
- `invariants_checked: true` + the matching `pattern_version`. **Evidence
377
- check:** `status=done` on a stack with a runnable build/test REQUIRES
378
- `evidence` {command, exit_code, tail} — a missing block or false
379
- `no_runner_detected` is malformed (requeue); `done` with non-empty
380
- `unmet[]` is `partial`.
381
- 4. **Post-wave worktree audit (GATE, `_shared/return-validation.md` §6):** diff `git status --short` before/after the wave — a changed path in NO task's `declared_files`, INCLUDING one that became less modified (the revert signature), blocks the close until named and decided.
382
- Overlap → `failure_reason: "file-collision:<file> with <agent>"`, requeue later wave.
383
- 5. Append worker `log_entries` to the decision log; regenerate the digest.
384
- **Gotcha capture (`gotchas: on`):** a return that CLOSED a repair loop carries
385
- `gotcha_recorded` (`_shared/return-validation.md` §7) — dedupe on
386
- `symptom`+`scope` (a match bumps `hits`/`last_seen` and appends nothing), else
387
- append the block to `.claude/orc/gotchas.md`. YOU write it, never a subagent;
388
- a capped-and-stopped loop records NOTHING.
389
- 6. Update checkpoint + state-of-play; emit `OUTCOME task=<id> score=<n>
390
- band=<range> model=<m> retries=<n> requeues=<n> needs_context=<n> unmet=<n>`
391
- as each task closes.
392
- 7. **Wave-boundary gate (deterministic — NOT judgment):** after wave W, if the
393
- wave's `is_batch_pause` is true (W in `pause_schedule`) AND a later wave
394
- remains, emit `GATE wave-boundary :: wave=W of K → STOP (batch_pause_every=N)`
395
- and run the MANDATORY STOP SEQUENCE — never dispatch wave W+1 past an
396
- unacknowledged boundary. Token pressure → same STOP SEQUENCE (judgment).
397
- Last wave closes → emit `PHASE execution end`. (references/stop-and-resume.md)
398
-
399
- **User escalations:** relay question → broadcast answer to log; an answer that
400
- invalidates a DONE task → re-run once, then set every reverse-`depends_on`
401
- consumer to `stale_review`. **Worker failure/garbage/timeout:** flag +
402
- continue the wave; audit and re-dispatch at the next batch checkpoint
403
- (`requeued`, retry_count++). Hard retry cap 2 → STOP and surface.
404
-
405
- ## Phase 4 — Integration (worktrees only) · Trace: `PHASE integration`
406
-
407
- Emit `PHASE integration start`. Merge worker branches; conflicts → resolver
408
- subagent (Opus 4.8 medium) given BOTH tasks' specs/intents, not just the diff.
409
- Record merge state in checkpoint; emit `PHASE integration end`.
410
-
411
- ## Phase 5 — Review (load subskills/orc-review-verify/, spawned) · Trace: `PHASE review`, `FINDING`
412
-
413
- Emit `PHASE review start`. Superpowers path: its review skill incl. tests
414
- (Sonnet 4.6 medium). OpenSpec/self path: review worker (Opus 5 medium). Pass the resolved
415
- `code_pattern` + its invariants + gate lines for the re-check
416
- (pattern-gate.md); no resolved pattern → FIRST ask for one (paste/md/none).
417
- FE tasks in run → pass `fe_rules[]` from `../orc-pattern/references/` fe-a11y
418
- + fe-perf. Findings arrive on the **P0–P3 ladder** (invariant violation or
419
- unmet gate line = P0; every P0–P2 carries `file:line` + VERBATIM `quote`;
420
- unanchored → P3). Apply hard rule 5 INCLUDING the quote spot-check: P0 →
421
- auto-fix once · P1 → ask, then fix once · P2/P3 → record for Phase 7. Emit
422
- `FINDING p0=<n> p1=<n> p2=<n> p3=<n>` on the return, then `PHASE review end`.
423
-
424
- ## Phase 5.5 — Security pass (opt-in) · Trace: `FINDING`
425
-
426
- Only when config `security_review` is `on`/`ask` (default `off`) AND a task
427
- scored **≥ 70** (reuses the risk floor). `ask` → one P0 prompt; `on` →
428
- silent. Dispatch the reviewer with `phase=security` + changed files +
429
- `references/security-checklist.md` (load only now). Same ladder, same
430
- hard-rule-5 handling; report-only.
431
-
432
- ## Phase 6 — Verify: TDD gate + adversarial review (same subskill, phase=verify) · Trace: `PHASE verify`, `VERDICT`, `TDD-RED`/`TDD-GREEN`
433
-
434
- Emit `PHASE verify start`. TWO halves in the SAME dispatched verifier slot
435
- (subskills/orc-review-verify/ — Phase 5's reviewer stays separate):
436
- **1) TDD gate (deterministic):** run the plan's TDD suite — green IS the
437
- definition-of-done for non-exempt requirements; red → repair loop (implement→
438
- test→repair, cap `tdd_loop_max`; cap hit → STOP SEQUENCE + honest red report).
439
- **2) Adversarial review:** attack the green implementation — edge cases the
440
- spec missed, error paths, contract violations, race/ordering, workflow breaks
441
- (dead wiring, broken commands) — findings on the existing P0–P3 ladder. The
442
- verifier also checks the intent-spec's
443
- definition-of-done PLUS the pattern's `validation_gate[]` lines (each a
444
- criterion; unmet = P0). The return carries `criteria[]` {criterion, pass|fail,
445
- evidence} — every criterion needs evidence. Quote spot-check P0/P1 first, then:
446
- P0 → auto-fix once → re-verify once → second failure STOPS; P1 → ask before the
447
- one fix attempt, then re-verify (same single-retry cap).
448
- **Pact recheck (`pact_recheck_on_verify`, default true; emit `PACT recheck`):**
449
- after GREEN, run `orc pact check` scoped to the promises whose anchors intersect
450
- this run's CHANGED files. A promise that flips to BROKEN is a **P1 finding with its
451
- check output** — reported, never an automatic abort: the ledger may simply have
452
- outgrown the code, and that is the user's call. Emit
453
- `VERDICT pass|fail :: <detail>`, then `PHASE verify end`.
454
-
455
- ## Phase 6.5 — Test Authoring (opt-in; load subskills/orc-testgen/) · Trace: `DISPATCH`/`VERIFY`
456
-
457
- Only when `config.generate_tests` is on (confirmed at intake). ORC **writes**
458
- test cases and **runs nothing** — never gates the ship. Dispatch
459
- `orc-test-author-opus-5-med` (run's `actual_files`, definition-of-done,
460
- touched flows, constraints, stack); it returns test files + a `TEST-PLAN.md` + a
461
- Postman-importable `test-cases.http` (HTTP APIs), the two manual deliverables
462
- written to **`test-generator/<change-slug>/` at the project root**. Validate the
463
- returned `test_plan_path`/`curl_bundle_path` are under that folder (else
464
- malformed → re-dispatch); state the exact path in the summary — discoverability
465
- is the point.
466
-
467
- ## Phase 6.7 — Mock example + drift recovery (config `mock_example`) · Trace: `PHASE mock-example`, `DRIFT`
468
-
469
- Load `../_shared/drift-recovery.md` (canonical). Only after a GREEN Phase 6,
470
- before ship: `ask` (default) → the offer is MANDATORY (never silently skipped,
471
- never silently run); `on` → build; `off` → skip. Deliverable:
472
- `mock-examples/<change-slug>/` at the project root (`EXAMPLE.md` + one minimal
473
- runnable artifact; mocked inputs only) — **NEVER committed**. After the user
474
- runs it, ONE question: matches expectation? [yes / drift: <describe>]. On
475
- drift → `DRIFT-FROM` handoff → analyze-mini gap analysis → mini planner patch
476
- plan → scored dispatch → re-verify → re-offer; **hard cap 2 loops**, then an
477
- honest unresolved report. Emit `DRIFT loop=<n>` per loop; end-of-phase packet.
478
-
479
- ## Phase 7 — Summary · Trace: `PHASE summary`
480
-
481
- Emit `PHASE summary start`. Report: tasks/waves/dispatches (scores + overrides), escalations,
482
- needs_context events, findings by severity (P0/P1 resolved; P2 itemized; P3
483
- counted), verify result, authored tests when 6.5 ran, repo state + branch,
484
- stale_review flags. Then ONE question: **"Apply the P2 fix-batch? The P3
485
- cosmetics too?"** — never fix unasked. Emit `PHASE summary end`.
486
-
487
- ## Phase 8 — Ship (load subskills/orc-pr/SKILL.md) · Trace: `PHASE ship`, `FINISH`
488
-
489
- Emit `PHASE ship start`. Show current branch.
490
-
491
- **Stacked-PR gate FIRST (deterministic; full `/orc` + `/orc-ultra` only — load
492
- `subskills/orc-pr/stack-gate.md`; never mini/fast/diy).** Measure the change
493
- (`git diff --numstat`, exclusions applied) vs config `stacked_pr_loc`/
494
- `stacked_pr_files`. Under threshold or `stacked_pr: off` → silent, ship normally
495
- (`GATE stack-gate pass :: under-threshold`). Tripped → surface report + ONE P0
496
- question (stack into layers? or one regular PR?) in the SAME round as its two
497
- prerequisites — **a ticket** and a resolved PR template
498
- (`_shared/pr-templates.md`; none found → recommend three options). No ticket, no
499
- template, or "no" → **one regular PR, never re-asked**. "Yes" → commit on the
500
- current branch (the driver's snapshot), write `stacked-pr/<slug>/STACK-FROM.md`
501
- (`_shared/stack-plan.md`, `ENTRY-MODE: orc-run`, this run's `RUN-DIR`), then hand
502
- off **`/orc-pr-setup`** → **`/orc-pr-driver`**. ORC never cuts layers itself.
503
-
504
- **Handoff seam (one sentence, only when it applies):** if any changed file is a
505
- GREEN surface in `orc handoff surfaces --json`, say so —
506
- *"2 of these were changes a PM could have made alone — `/orc-handoff` next time."*
507
- That sentence is how anyone finds out that lane exists.
508
-
509
- Then ask together: **commit? push? create PR?** (PR: ticket +
510
- title + target branch; generate from `subskills/orc-pr/pr.md`). If Phase 6.5 ran,
511
- commit `test-generator/<change-slug>/` too (a user deliverable, never gitignored).
512
- **`mock-examples/` is NEVER staged** (drift-recovery.md; no `.gitignore` edit —
513
- just never `git add` it).
514
- On success: delete the ephemeral decision log; KEEP checkpoint + dispatch log.
515
- **Wiki stale-flag:** flag (never re-scan) wiki docs whose covered files this
516
- run changed; point at `/orc-wiki`. **Post-ship refresh ask** (BIG runs, /orc +
517
- /orc-ultra — the `wiki_refresh_ask_tasks`/`_files` triggers and full rules in
518
- `../orc-wiki/references/staleness.md`): upgrade the passive note to **"Refresh
519
- wiki now?"**; on "later" print the prominent stale warning and stamp
520
- `wiki_refresh_declined` in the checkpoint. Then ALWAYS show the completion
521
- usage report — /usage limits + the full dispatch log (model/effort/score per
522
- subagent). The user must always know what the run cost. Finally emit
523
- `PHASE ship end`, then the one-line `STATS lane=… dispatches=… downgrades=…`
524
- summary (trace-protocol.md — what `orc stats` reads), then `FINISH :: <detail>`,
525
- and in ONE step delete BOTH `log_dir/.current` and the run's `RESUME.md` (that
526
- file existing is what marks a run unfinished — stop-and-resume.md).
203
+ ## Phases
204
+
205
+ `orc lane phases orc --json` **is** the pipelinethe CLI owns the list and
206
+ its order, and this table is the human index of it. Never derive the order
207
+ from these filenames; a second idea of the pipeline is the drift the manifest
208
+ exists to prevent.
209
+
210
+ **Read a row when its phase fires, not on activation.** Every row is
211
+ `on-phase` this spine deliberately carries no `always` phase pointer. **Read
212
+ the `full` layer and only that layer:** ten of these files now also carry a
213
+ `composed` layer, which is `orc-diy`'s compiled variant of the same phase and
214
+ is not this lane's procedure. `orc lane phases orc --json` names the layer for
215
+ each row.
216
+
217
+ W13 gave those ten a second reader (`orc-diy`), so they moved to
218
+ `_shared/phases/`. Intake and Integration have one consumer each and stay home
219
+ a file with one consumer stays home. W14 (`orc-mini`/`orc-fast`) is what adds
220
+ a `trim` layer beside the `full` one.
221
+
222
+ | # | Phase | File | Read | Trace |
223
+ |---|-------|------|------|-------|
224
+ | 0 | Intake | `references/phases/intake.md` | `full` | `PHASE intake` |
225
+ | 1 | Planning | `../_shared/phases/planning.md` | `full` | `PHASE planning`, `CONFIG`, `WIKI-CONSULT`, `CROSSLINK`, `GATE` |
226
+ | 2 | Effort & scoring | `../_shared/phases/scoring.md` | `full` | `PHASE scoring`, `SCORE` |
227
+ | 3 | Execution | `../_shared/phases/execution.md` | `full` | `PHASE execution`, `DISPATCH`/`VERIFY`/`OUTCOME` |
228
+ | 4 | Integration (worktrees) | `references/phases/integration.md` | `full` | `PHASE integration` |
229
+ | 5 | Review | `../_shared/phases/review.md` | `full` | `PHASE review`, `FINDING` |
230
+ | 5.5 | Security pass (opt-in) | `../_shared/phases/security.md` | `full` | `FINDING` |
231
+ | 6 | Verify TDD gate + adversarial review | `../_shared/phases/verify.md` | `full` | `PHASE verify`, `VERDICT`, `TDD-RED`/`TDD-GREEN` |
232
+ | 6.5 | Test authoring (opt-in) | `../_shared/phases/testgen.md` | `full` | `DISPATCH`/`VERIFY` |
233
+ | 6.7 | Mock example + drift recovery | `../_shared/phases/mock-example.md` | `full` | `PHASE mock-example`, `DRIFT` |
234
+ | 7 | Summary | `../_shared/phases/summary.md` | `full` | `PHASE summary` |
235
+ | 8 | Ship | `../_shared/phases/ship.md` | `full` | `PHASE ship`, `FINISH` |
236
+
237
+ Phase 4 runs only in worktree mode. Phases 5.5, 6.5 and 6.7 are opt-in and
238
+ their config key is resolved by `orc lane config orc --json`, never read raw.