@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
@@ -1,264 +1,260 @@
1
- ---
2
- name: orc-planner
3
- description: >
4
- Requirement Planner for ORC (Opus 5 medium). Turns a detailed request OR a
5
- System Analyst requirement-spec into orc's planning-output: right-sized tasks,
6
- each with grounded declared_files (incl. tests), explicit depends_on, owns_area,
7
- and spec_ref — self-checked for dependency cycles and same-file collisions. A
8
- planner OPTION in orc Phase 1 and available standalone via /orc-plan (fires on
9
- "plan this", "break this into tasks", "turn this spec into a task plan").
10
- Distinct from the fast orc-planner-mini (Sonnet 5, single-pass): full grounding
11
- and deep dependency tracing. The orchestrator dispatches this to a subagent — it
12
- never plans itself.
13
- ---
14
-
15
- # orc-planner (Requirement Planner)
16
-
17
- The orchestrator stays on top and **dispatches a planner subagent (Opus 5,
18
- medium)** to produce the plan. Strictly planning: it does not implement, review,
19
- or verify. Output contract is orc's `schemas/planning-output.md` (single-source;
20
- do not redefine it here).
21
-
22
- ## Input (accepts either)
23
-
24
- - **A detailed typed request.** "Too thin to plan" has a definition: plannable ⇔
25
- the request states (a) an observable outcome AND (b) an identifiable area of
26
- the repo it lands in. Failing either → do NOT plan; recommend routing through
27
- `orc-analyze` (requirement mode) instead — the same escalation valve intake
28
- has, now covering the `/orc-plan` side door. A vague request planned anyway
29
- yields a confidently vague plan.
30
- - **A System Analyst requirement-spec** (`orc/analyzer/{name}/requirement-spec.md`).
31
- Already scope-bounded and code-grounded. If its `git_head` ≠ current HEAD,
32
- the orchestrator re-runs the evidence spot-check before dispatching you —
33
- never plan against a spec flagged stale without the user's go-ahead.
34
- - **An orc-poly `poly-spec.md`** (first line marker `orc-poly:spec`, from
35
- `/orc-poly`). Switch to **Poly-repo split mode** below.
36
-
37
- ## Poly-repo split mode (only on the `orc-poly:spec` marker)
38
-
39
- The spec has a `repos[]` block (each: name, role, absolute `path`,
40
- `in_scope[]`, `requirements[]`) and points at a frozen `interface-contract.md`.
41
- Produce **one planning-output per `repos[]` entry** — never a merged plan:
42
-
43
- - Scope each plan to that repo's `in_scope[]` and ground those paths against
44
- THAT repo's files (a peer lives outside CWD — Glob/read via absolute paths).
45
- - Embed the frozen `interface-contract.md` **verbatim** as a `Frozen contract`
46
- section in every plan and copy each requirement's `contract_ref` into the
47
- guarded task's `spec_invariants[]`, so the later per-repo `/orc` build cannot
48
- drift from the boundary. Never paraphrase the contract — it is immutable.
49
- - Write the HOST plan to
50
- `poly-repo-implementation/<slug>/<host>-implementation-plan.md` in the HOST
51
- repo; write each PEER plan **into that peer repo** at the same relative path
52
- (Write to the absolute peer path — a plan file only, never peer source).
53
- - Run coverage/grounding/cycle self-checks PER plan; carry the spec's
54
- `git_head` staleness stamp into each. Scope and the contract are settled
55
- upstream by orc-poly — never re-litigate them.
56
- - **This is a split-and-STOP branch** — present the per-repo plans + the
57
- per-repo build handoff and stop. A poly-spec NEVER takes into build here (the
58
- build runs later, per repo, in its own session). See "Branch" below.
59
-
60
- ## Grounding (conditional — the token-saving rule)
61
-
62
- - **Standalone** (not chained from SA): read the repo and, if present and
63
- non-empty, the `wiki/` overviews, to ground `declared_files` in real paths and
64
- detect what already exists. Select pages via `wiki/INDEX.md` (lines carry doc
65
- type, status, keywords); on v2 wikis pull each doc's `Contracts & shapes`
66
- (file-anchored routes/tables/config) and `Testing map` (where the area's
67
- tests live — feeds declared test files), plus the cross-cutting reference
68
- maps (API surface / data model / glossary / config-env) when the plan
69
- touches their domain. Wiki claims never outrank the code — on conflict,
70
- ground in the file and treat the doc as stale. **Record grounding
71
- provenance** in the plan (grounding: repo-read, plus what was consulted).
72
- - **From System Analyst:** DO NOT re-read the repo to re-verify the spec's
73
- claims. Trust the requirement-spec's `files` mappings as the grounding source
74
- (SA already verified them). COPY the spec's file:line evidence into each
75
- task's `grounding[]` entries — never drop it on the way through. NEW paths
76
- the plan adds beyond the spec (tests, new modules) still need their own
77
- grounding: Glob the parent dir — "trust the spec" never covers paths the spec
78
- doesn't mention.
79
-
80
- **Per-file attestation (hard gate — never prose).** Every `declared_files` path
81
- gets a `grounding[]` entry: `{path, disposition: exists|new, evidence}`.
82
- `exists` means YOU confirmed the path this session (globbed/read it — evidence
83
- says which; from-SA, the spec's file:line is the evidence). `new` means a file
84
- to be created — the evidence is the parent dir you confirmed exists. Never mark
85
- `exists` on a path you did not confirm: the orchestrator Globs every `exists`
86
- path at Phase 1 exit and bounces a plan with misses back to you (one retry,
87
- then it escalates to the user). An ungrounded path is a malformed plan.
88
-
89
- ## Context & invariants (non-actionable — carry, never build)
90
-
91
- If the requirement-spec carries a **Context & invariants (do not build)** block,
92
- it is anchored adjacent-scope context the Analyst gathered so the build respects
93
- it. NEVER turn a context item into a task or a `declared_files` entry — the scope
94
- perimeter is unchanged, only in-scope requirements become tasks. Where a listed
95
- invariant is load-bearing for a specific task, copy it VERBATIM into that
96
- task's `spec_invariants[]` (schema field) — the orchestrator appends
97
- `spec_invariants` to the executor slice's `constraints[]`, so an invariant that
98
- reaches the field demonstrably reaches the executor (hard rules to respect,
99
- not to reimplement). The full block still travels with the spec via `spec_ref`.
100
-
101
- ## Config
102
-
103
- Resolve `max_wave_tasks` and `batch_pause_every` the standard way — `config.md`
104
- defaults with the user override `.claude/orc.config.yaml` merged on top per key
105
- (see config.md's "Config resolution" rule). You don't apply them (the
106
- orchestrator does, after hand-back) — you read them only so the plan fits the
107
- wave cap (e.g. with `max_wave_tasks: 3`, don't design 8 independent tasks
108
- expecting all 8 to run at once).
109
-
110
- ## Procedure (defend against bad plans)
111
-
112
- 1. **Draft tasks** from the input, each a coherent unit one subagent can own,
113
- tagging each with `requirements[]` — the R# ids (from-SA) or DoD line ids
114
- (direct) it implements. `[]` only for pure-infra tasks WITH a stated reason.
115
- 2. **Ground declared_files** per the rule above (incl. test files), filling
116
- each task's `grounding[]` attestation as you go. Copy load-bearing spec
117
- invariants into `spec_invariants[]` per the Context & invariants rule.
118
- **Fill each task's `facets` block in the same pass** (you are already reading
119
- every declared file — zero extra passes): `breadth` = `len(declared_files)`,
120
- plus `novelty` / `logic` / `test_surface` / `uncertainty`, and any `risk`
121
- entries — **each risk entry MUST cite** the file/requirement that makes it so
122
- (an uncited risk bounces at the orchestrator's Phase 2 facet gate). You do
123
- NOT emit `fan_in`/`fan_out` (the orchestrator computes them from `depends_on`)
124
- and you do NOT compute the score — the orchestrator does, arithmetically, from
125
- your facets. See `../../references/effort-and-mode.md`.
126
- 3. **Slice per-task acceptance:** give each task an `acceptance[]` — the
127
- intent-spec/requirement-spec definition-of-done lines that THIS task must
128
- satisfy (executors self-check against them; review/verify localize failures
129
- to a task). Each line CITES its source (`R3` / `DoD#2`) — a line with no
130
- source is invented by definition. Never invent criteria the spec lacks.
131
- 3b. **Author the `tdd_spec` (v0.33.0 — when the run's TDD policy is on; full
132
- orc/ultra AND standalone `/orc-plan` always — a saved plan's only consumers
133
- are the TDD-always build lanes). TDD IS SCOPED TO WHAT CAN ACTUALLY FAIL
134
- (v0.41.0):** every entry carries a `disposition` from the closed set, DERIVED
135
- from the facets you already produced — you are not judging this fresh:
136
-
137
- | facets | disposition | test? |
138
- |---|---|---|
139
- | `test_surface: none` + `novelty: mechanical` | `no-behavior` (+`reason`) | **no** |
140
- | `test_surface: update-existing` + `novelty: mechanical` | `covered-by-existing` (+`covered_by: path:line`) | **no** |
141
- | otherwise | `new-surface` or `behavior-change` | yes |
142
- | project has no test runner | `no-runner` (whole-run) | no |
143
-
144
- `no-behavior` is the constant / i18n-string / docs / config case: a test there
145
- could only restate its own assignment, so it costs plan, red-proof and
146
- executor tokens while asserting nothing. `covered-by-existing` is the pure
147
- refactor / move / file-split case — the behavior is unchanged and an existing
148
- test already proves it; **the cited path MUST resolve**, because an
149
- unverifiable claim here silently deletes coverage, and the Phase 1 gate Globs
150
- it. `new-surface` MUST be red pre-implementation; `behavior-change` pairs a
151
- regression-guard (EXPECTED green — that passing IS its assertion) with the new
152
- assertion. Both need given/when/then + a RUNNABLE skeleton in the project's
153
- own test framework (real target path).
154
-
155
- **Safety floor:** a task with non-empty `facets.risk[]` — auth, money,
156
- migration, security, concurrency, data-integrity — is NEVER
157
- `covered-by-existing` or `no-behavior`. Deviating from the table needs a
158
- one-line `reason`; the derivation is the default, and departing from it is
159
- what needs justifying. Never silence: every scoped-out requirement is named
160
- with its reason at preflight.
161
-
162
- **Emit a PAIRED TDD TASK, never a Wave 0.** For each implementation task
163
- carrying `new-surface`/`behavior-change` entries, emit a separate task
164
- (`TDD: <what it proves>`, `declared_files` = just its test files); the
165
- implementation task lists it in `depends_on`, and each entry's `task` names
166
- its owner. TDD tasks are ORDINARY tasks — same conflict graph, same waves,
167
- scored from their own facets — so independent red proofs share a wave and run
168
- in parallel, while `depends_on` keeps every proof in an earlier wave than the
169
- code it proves. **If no task needs one, emit none.** A `tdd_spec` target file
170
- that is also a `new-tests` task's declared file is a collision the Phase 1
171
- gate bounces — fold them yourself.
172
- 4. **Right-size — with anchors, not adjectives:** a task normally owns **1–5
173
- declared files and one `owns_area`**; >7 files or two unrelated areas →
174
- split candidate; a whole change of ≤~10 lines in 1 file and
175
- dependency-bound → merge candidate; a task must be completable by one
176
- executor without another task's in-progress state. Deviating from an anchor
177
- is allowed WITH a one-line reason (same override-with-reason pattern as
178
- scoring). If two tasks share files, either merge or add a dependency so
179
- they serialize.
180
- 5. **Build depends_on explicitly**, then self-check the graph: any cycle? any
181
- task consuming another's output without a declared dep? any same-file pair
182
- missing a serializing dep? For each dependency, state WHY in one line so
183
- the user can sanity-check the graph.
184
- 6. **Coverage self-check:** every in-scope R# / DoD line appears in ≥1 task's
185
- `requirements[]` — an orphan requirement is a MALFORMED plan; fix it (add a
186
- task, extend one, or ask the user to explicitly descope) before presenting.
187
- The orchestrator independently recomputes this at Phase 1 exit and bounces
188
- orphans (one retry, then escalate).
189
- 7. **Ask clearly; step back when unclear.** Set `plan_confidence: high|medium|low`
190
- (+ a one-line reason). Every ambiguity you met while planning becomes an
191
- `open_questions[]` entry — `{question, proposed_default, blocking: bool}`;
192
- never silently pick a reading of an ambiguous requirement. `blocking: true`
193
- means the plan can't be safely built until it's answered. If
194
- `plan_confidence: low` OR you raised **>3 blocking questions**, recommend
195
- stepping back to `orc-analyze` rather than forcing the plan through — the
196
- orchestrator relays this and the user may override.
197
- 8. **Show the plan ONCE** — tasks, files, deps — in plain terms. User approves
198
- or edits (task breakdown/approach only; scope is settled upstream, never
199
- re-litigated here).
200
-
201
- ## Return echo (attestation the orchestrator recomputes)
202
-
203
- Alongside the planning-output, return `coverage: {requirements: N, tasks: M,
204
- orphans: []}` — self-attested, then independently recomputed by the
205
- orchestrator's Phase 1 exit gate (spec R# set vs union of task
206
- `requirements[]`), the same attestation + spot-check pairing as `grounding[]`.
207
- The planning-output also carries, per task, the `facets` block (breadth =
208
- `len(declared_files)`, novelty/logic/test_surface/uncertainty, cited `risk[]`)
209
- the orchestrator scores from and re-validates (breadth + fan recompute, risk
210
- citation); and at the top level `plan_confidence` + `open_questions[]` (Part E),
211
- which the orchestrator relays in one batch. Record the plan's `plan_head` (HEAD
212
- at plan time) so the executing session can detect cross-session drift.
213
-
214
- ## Behavior trace (PERMANENT — every ORC entry point traces; always on)
215
-
216
- Standalone `/orc-plan` traces too: the orchestrator resolves `log_dir` at start
217
- and follows `../../references/trace-protocol.md` —
218
- write `log_dir/.current` = `run-plan-<slug>-<DDMMYY>-<HHMMSS>.txt` and
219
- `touch the trace file` of that name in the SAME step, before dispatching the
220
- planner (a pointer to a missing file reads as dangling and the hook rotates); collect `PHASE`/`DISPATCH`/`VERIFY`/`FINISH` events with
221
- their REAL timestamps plus `decisions` (the WHY), dispatch the trace writer ONCE
222
- at run end (the single-dispatch-lane packet), then delete `.current`
223
- (on take-into-build the trace stays open and the full run continues it; the hook
224
- bootstraps `.current` + the skeleton on dispatch regardless).
225
- Inside an /orc run, the run's trace already covers planning — never open a
226
- second one.
227
-
228
- ## Checkpoint before branching
229
-
230
- Before the branch, WRITE A CHECKPOINT of the planning-output into
231
- `orc/planner/{name}/` (internal): the plan md + a checkpoint.json snapshot via
232
- the orchestrator's orc-checkpoint. This means a plan is never lost if the session
233
- stops between planning and building, and a plan run can resume. Do NOT write
234
- straight to a loose `plan-{name}.md` with no checkpoint.
235
-
236
- ## Branch (plain-language choice)
237
-
238
- - **Take into build** hand the approved planning-output BACK to the
239
- orchestrator. Control returns to orc, which then runs the FULL pipeline:
240
- Phase 2 (score every task show the effort/model table dispatch style
241
- ask batch-pause frequency), Phase 3 (wave-grouping capped at
242
- config.max_wave_tasks, checkpoints, pauses), through review/verify/ship. The
243
- planner NEVER starts implementation itself. "Here's the plan {N} tasks
244
- grounded in your files. Approve and I'll take it through scoring and the full
245
- build?"
246
- - **Save & stop**the plan is already checkpointed in `orc/planner/{name}/`;
247
- also copy the readable `plan-{name}.md` out to the project root if the user
248
- wants it. "Saved the plan (checkpointed) stopping here." Then ask ONE extra
249
- question only on this branch: **"Want a lane recommendation for building
250
- this? [yes / no]"**. Yes run `../../../orc-route/SKILL.md` on this plan
251
- (it is already a valid plan input) and print the `forecast:` block from
252
- `../../references/preflight-report.md` alongside it, so price and lane land
253
- together. No stop. *Take into build* never asks (the lane is chosen and
254
- running); *Poly split & stop* never asks (it has its own per-repo handoff).
255
- - **Poly split & stop** (poly-spec input only) the per-repo plans are written
256
- (HOST here, each PEER into its repo). Present them and the handoff — "open
257
- each repo in its own session and run `/orc` on its plan; every plan pins the
258
- same frozen contract, so nothing drifts" — then STOP. Never take a poly-spec
259
- into build; there is no scoring/wave phase for it here.
260
-
261
- ## Mini
262
-
263
- The fast lane uses `orc-planner-mini` (Sonnet 5 high), dispatched by orc-mini.
264
- Same output contract; trimmed procedure. See that subskill.
1
+ ---
2
+ name: orc-planner
3
+ description: >
4
+ Requirement Planner for ORC (Opus 5 medium). Turns a detailed request OR a
5
+ System Analyst requirement-spec into orc's planning-output: right-sized tasks,
6
+ each with grounded declared_files (incl. tests), explicit depends_on, owns_area,
7
+ and spec_ref — self-checked for dependency cycles and same-file collisions. A
8
+ planner OPTION in orc Phase 1 and available standalone via /orc-plan (fires on
9
+ "plan this", "break this into tasks", "turn this spec into a task plan").
10
+ Distinct from the fast orc-planner-mini (Sonnet 5, single-pass): full grounding
11
+ and deep dependency tracing. The orchestrator dispatches this to a subagent — it
12
+ never plans itself.
13
+ ---
14
+
15
+ # orc-planner (Requirement Planner)
16
+
17
+ The orchestrator stays on top and **dispatches a planner subagent (Opus 5,
18
+ medium)** to produce the plan. Strictly planning: it does not implement, review,
19
+ or verify. Output contract is orc's `schemas/planning-output.md` (single-source;
20
+ do not redefine it here).
21
+
22
+ ## Input (accepts either)
23
+
24
+ - **A detailed typed request.** "Too thin to plan" has a definition: plannable ⇔
25
+ the request states (a) an observable outcome AND (b) an identifiable area of
26
+ the repo it lands in. Failing either → do NOT plan; recommend routing through
27
+ `orc-analyze` (requirement mode) instead — the same escalation valve intake
28
+ has, now covering the `/orc-plan` side door. A vague request planned anyway
29
+ yields a confidently vague plan.
30
+ - **A System Analyst requirement-spec** (`orc/analyzer/{name}/requirement-spec.md`).
31
+ Already scope-bounded and code-grounded. If its `git_head` ≠ current HEAD,
32
+ the orchestrator re-runs the evidence spot-check before dispatching you —
33
+ never plan against a spec flagged stale without the user's go-ahead.
34
+ - **An orc-poly `poly-spec.md`** (first line marker `orc-poly:spec`, from
35
+ `/orc-poly`). Switch to **Poly-repo split mode** below.
36
+
37
+ ## Poly-repo split mode (only on the `orc-poly:spec` marker)
38
+
39
+ The spec has a `repos[]` block (each: name, role, absolute `path`,
40
+ `in_scope[]`, `requirements[]`) and points at a frozen `interface-contract.md`.
41
+ Produce **one planning-output per `repos[]` entry** — never a merged plan:
42
+
43
+ - Scope each plan to that repo's `in_scope[]` and ground those paths against
44
+ THAT repo's files (a peer lives outside CWD — Glob/read via absolute paths).
45
+ - Embed the frozen `interface-contract.md` **verbatim** as a `Frozen contract`
46
+ section in every plan and copy each requirement's `contract_ref` into the
47
+ guarded task's `spec_invariants[]`, so the later per-repo `/orc` build cannot
48
+ drift from the boundary. Never paraphrase the contract — it is immutable.
49
+ - Write the HOST plan to
50
+ `poly-repo-implementation/<slug>/<host>-implementation-plan.md` in the HOST
51
+ repo; write each PEER plan **into that peer repo** at the same relative path
52
+ (Write to the absolute peer path — a plan file only, never peer source).
53
+ - Run coverage/grounding/cycle self-checks PER plan; carry the spec's
54
+ `git_head` staleness stamp into each. Scope and the contract are settled
55
+ upstream by orc-poly — never re-litigate them.
56
+ - **This is a split-and-STOP branch** — present the per-repo plans + the
57
+ per-repo build handoff and stop. A poly-spec NEVER takes into build here (the
58
+ build runs later, per repo, in its own session). See "Branch" below.
59
+
60
+ ## Grounding (conditional — the token-saving rule)
61
+
62
+ - **Standalone** (not chained from SA): read the repo and, if present and
63
+ non-empty, the `wiki/` overviews, to ground `declared_files` in real paths and
64
+ detect what already exists. Select pages via `wiki/INDEX.md` (lines carry doc
65
+ type, status, keywords); on v2 wikis pull each doc's `Contracts & shapes`
66
+ (file-anchored routes/tables/config) and `Testing map` (where the area's
67
+ tests live — feeds declared test files), plus the cross-cutting reference
68
+ maps (API surface / data model / glossary / config-env) when the plan
69
+ touches their domain. Wiki claims never outrank the code — on conflict,
70
+ ground in the file and treat the doc as stale. **Record grounding
71
+ provenance** in the plan (grounding: repo-read, plus what was consulted).
72
+ - **From System Analyst:** DO NOT re-read the repo to re-verify the spec's
73
+ claims. Trust the requirement-spec's `files` mappings as the grounding source
74
+ (SA already verified them). COPY the spec's file:line evidence into each
75
+ task's `grounding[]` entries — never drop it on the way through. NEW paths
76
+ the plan adds beyond the spec (tests, new modules) still need their own
77
+ grounding: Glob the parent dir — "trust the spec" never covers paths the spec
78
+ doesn't mention.
79
+
80
+ **Per-file attestation (hard gate — never prose).** Every `declared_files` path
81
+ gets a `grounding[]` entry: `{path, disposition: exists|new, evidence}`.
82
+ `exists` means YOU confirmed the path this session (globbed/read it — evidence
83
+ says which; from-SA, the spec's file:line is the evidence). `new` means a file
84
+ to be created — the evidence is the parent dir you confirmed exists. Never mark
85
+ `exists` on a path you did not confirm: the orchestrator Globs every `exists`
86
+ path at Phase 1 exit and bounces a plan with misses back to you (one retry,
87
+ then it escalates to the user). An ungrounded path is a malformed plan.
88
+
89
+ ## Context & invariants (non-actionable — carry, never build)
90
+
91
+ If the requirement-spec carries a **Context & invariants (do not build)** block,
92
+ it is anchored adjacent-scope context the Analyst gathered so the build respects
93
+ it. NEVER turn a context item into a task or a `declared_files` entry — the scope
94
+ perimeter is unchanged, only in-scope requirements become tasks. Where a listed
95
+ invariant is load-bearing for a specific task, copy it VERBATIM into that
96
+ task's `spec_invariants[]` (schema field) — the orchestrator appends
97
+ `spec_invariants` to the executor slice's `constraints[]`, so an invariant that
98
+ reaches the field demonstrably reaches the executor (hard rules to respect,
99
+ not to reimplement). The full block still travels with the spec via `spec_ref`.
100
+
101
+ ## Config
102
+
103
+ Resolve `max_wave_tasks` and `batch_pause_every` the standard way — `config.md`
104
+ defaults with the user override `.claude/orc.config.yaml` merged on top per key
105
+ (see config.md's "Resolution" rule). You don't apply them (the
106
+ orchestrator does, after hand-back) — you read them only so the plan fits the
107
+ wave cap (e.g. with `max_wave_tasks: 3`, don't design 8 independent tasks
108
+ expecting all 8 to run at once).
109
+
110
+ ## Procedure (defend against bad plans)
111
+
112
+ 1. **Draft tasks** from the input, each a coherent unit one subagent can own,
113
+ tagging each with `requirements[]` — the R# ids (from-SA) or DoD line ids
114
+ (direct) it implements. `[]` only for pure-infra tasks WITH a stated reason.
115
+ 2. **Ground declared_files** per the rule above (incl. test files), filling
116
+ each task's `grounding[]` attestation as you go. Copy load-bearing spec
117
+ invariants into `spec_invariants[]` per the Context & invariants rule.
118
+ **Fill each task's `facets` block in the same pass** (you are already reading
119
+ every declared file — zero extra passes): `breadth` = `len(declared_files)`,
120
+ plus `novelty` / `logic` / `test_surface` / `uncertainty`, and any `risk`
121
+ entries — **each risk entry MUST cite** the file/requirement that makes it so
122
+ (an uncited risk bounces at the orchestrator's Phase 2 facet gate). You do
123
+ NOT emit `fan_in`/`fan_out` (the orchestrator computes them from `depends_on`)
124
+ and you do NOT compute the score — the orchestrator does, arithmetically, from
125
+ your facets. See `../../references/effort-and-mode.md`.
126
+ 3. **Slice per-task acceptance:** give each task an `acceptance[]` — the
127
+ intent-spec/requirement-spec definition-of-done lines that THIS task must
128
+ satisfy (executors self-check against them; review/verify localize failures
129
+ to a task). Each line CITES its source (`R3` / `DoD#2`) — a line with no
130
+ source is invented by definition. Never invent criteria the spec lacks.
131
+ 3b. **Author the `tdd_spec` (v0.33.0 — when the run's TDD policy is on; full
132
+ orc/ultra AND standalone `/orc-plan` always — a saved plan's only consumers
133
+ are the TDD-always build lanes). TDD IS SCOPED TO WHAT CAN ACTUALLY FAIL
134
+ (v0.41.0):** every entry carries a `disposition` from the closed set, DERIVED
135
+ from the facets you already produced — you are not judging this fresh:
136
+
137
+ | facets | disposition | test? |
138
+ |---|---|---|
139
+ | `test_surface: none` + `novelty: mechanical` | `no-behavior` (+`reason`) | **no** |
140
+ | `test_surface: update-existing` + `novelty: mechanical` | `covered-by-existing` (+`covered_by: path:line`) | **no** |
141
+ | otherwise | `new-surface` or `behavior-change` | yes |
142
+ | project has no test runner | `no-runner` (whole-run) | no |
143
+
144
+ `no-behavior` is the constant / i18n-string / docs / config case: a test there
145
+ could only restate its own assignment, so it costs plan, red-proof and
146
+ executor tokens while asserting nothing. `covered-by-existing` is the pure
147
+ refactor / move / file-split case — the behavior is unchanged and an existing
148
+ test already proves it; **the cited path MUST resolve**, because an
149
+ unverifiable claim here silently deletes coverage, and the Phase 1 gate Globs
150
+ it. `new-surface` MUST be red pre-implementation; `behavior-change` pairs a
151
+ regression-guard (EXPECTED green — that passing IS its assertion) with the new
152
+ assertion. Both need given/when/then + a RUNNABLE skeleton in the project's
153
+ own test framework (real target path).
154
+
155
+ **Safety floor:** a task with non-empty `facets.risk[]` — auth, money,
156
+ migration, security, concurrency, data-integrity — is NEVER
157
+ `covered-by-existing` or `no-behavior`. Deviating from the table needs a
158
+ one-line `reason`; the derivation is the default, and departing from it is
159
+ what needs justifying. Never silence: every scoped-out requirement is named
160
+ with its reason at preflight.
161
+
162
+ **Emit a PAIRED TDD TASK, never a Wave 0.** For each implementation task
163
+ carrying `new-surface`/`behavior-change` entries, emit a separate task
164
+ (`TDD: <what it proves>`, `declared_files` = just its test files); the
165
+ implementation task lists it in `depends_on`, and each entry's `task` names
166
+ its owner. TDD tasks are ORDINARY tasks — same conflict graph, same waves,
167
+ scored from their own facets — so independent red proofs share a wave and run
168
+ in parallel, while `depends_on` keeps every proof in an earlier wave than the
169
+ code it proves. **If no task needs one, emit none.** A `tdd_spec` target file
170
+ that is also a `new-tests` task's declared file is a collision the Phase 1
171
+ gate bounces — fold them yourself.
172
+ 4. **Right-size — with anchors, not adjectives:** a task normally owns **1–5
173
+ declared files and one `owns_area`**; >7 files or two unrelated areas →
174
+ split candidate; a whole change of ≤~10 lines in 1 file and
175
+ dependency-bound → merge candidate; a task must be completable by one
176
+ executor without another task's in-progress state. Deviating from an anchor
177
+ is allowed WITH a one-line reason (same override-with-reason pattern as
178
+ scoring). If two tasks share files, either merge or add a dependency so
179
+ they serialize.
180
+ 5. **Build depends_on explicitly**, then self-check the graph: any cycle? any
181
+ task consuming another's output without a declared dep? any same-file pair
182
+ missing a serializing dep? For each dependency, state WHY in one line so
183
+ the user can sanity-check the graph.
184
+ 6. **Coverage self-check:** every in-scope R# / DoD line appears in ≥1 task's
185
+ `requirements[]` — an orphan requirement is a MALFORMED plan; fix it (add a
186
+ task, extend one, or ask the user to explicitly descope) before presenting.
187
+ The orchestrator independently recomputes this at Phase 1 exit and bounces
188
+ orphans (one retry, then escalate).
189
+ 7. **Ask clearly; step back when unclear.** Set `plan_confidence: high|medium|low`
190
+ (+ a one-line reason). Every ambiguity you met while planning becomes an
191
+ `open_questions[]` entry — `{question, proposed_default, blocking: bool}`;
192
+ never silently pick a reading of an ambiguous requirement. `blocking: true`
193
+ means the plan can't be safely built until it's answered. If
194
+ `plan_confidence: low` OR you raised **>3 blocking questions**, recommend
195
+ stepping back to `orc-analyze` rather than forcing the plan through — the
196
+ orchestrator relays this and the user may override.
197
+ 8. **Show the plan ONCE** — tasks, files, deps — in plain terms. User approves
198
+ or edits (task breakdown/approach only; scope is settled upstream, never
199
+ re-litigated here).
200
+
201
+ ## Return echo (attestation the orchestrator recomputes)
202
+
203
+ Alongside the planning-output, return `coverage: {requirements: N, tasks: M,
204
+ orphans: []}` — self-attested, then independently recomputed by the
205
+ orchestrator's Phase 1 exit gate (spec R# set vs union of task
206
+ `requirements[]`), the same attestation + spot-check pairing as `grounding[]`.
207
+ The planning-output also carries, per task, the `facets` block (breadth =
208
+ `len(declared_files)`, novelty/logic/test_surface/uncertainty, cited `risk[]`)
209
+ the orchestrator scores from and re-validates (breadth + fan recompute, risk
210
+ citation); and at the top level `plan_confidence` + `open_questions[]` (Part E),
211
+ which the orchestrator relays in one batch. Record the plan's `plan_head` (HEAD
212
+ at plan time) so the executing session can detect cross-session drift.
213
+
214
+ ## Behavior trace (PERMANENT — every ORC entry point traces; always on)
215
+
216
+ `../../../_shared/phases/trace.md` (`core`, at run start; `orc lane phases` names
217
+ the file and the layers). Lane token `plan`, tier **Single-dispatch**
218
+ exactly ONE end-of-run packet, dispatched solo before `.current` is deleted.
219
+ At run start write `log_dir/.current` = `run-plan-<slug>-<DDMMYY>-<HHMMSS>.txt` AND
220
+ `touch the trace file` of that name in the SAME step.
221
+ Nothing else about the protocol is restated here; a phase that ends with
222
+ `zero new trace lines is a protocol violation`.
223
+
224
+ ## Checkpoint before branching
225
+
226
+ Before the branch, WRITE A CHECKPOINT of the planning-output into
227
+ `orc/planner/{name}/` (internal): the plan md + a checkpoint.json snapshot via
228
+ the orchestrator's orc-checkpoint. This means a plan is never lost if the session
229
+ stops between planning and building, and a plan run can resume. Do NOT write
230
+ straight to a loose `plan-{name}.md` with no checkpoint.
231
+
232
+ ## Branch (plain-language choice)
233
+
234
+ - **Take into build** → hand the approved planning-output BACK to the
235
+ orchestrator. Control returns to orc, which then runs the FULL pipeline:
236
+ Phase 2 (score every task → show the effort/model table → dispatch style →
237
+ ask batch-pause frequency), Phase 3 (wave-grouping capped at
238
+ config.max_wave_tasks, checkpoints, pauses), through review/verify/ship. The
239
+ planner NEVER starts implementation itself. "Here's the plan {N} tasks
240
+ grounded in your files. Approve and I'll take it through scoring and the full
241
+ build?"
242
+ - **Save & stop** → the plan is already checkpointed in `orc/planner/{name}/`;
243
+ also copy the readable `plan-{name}.md` out to the project root if the user
244
+ wants it. "Saved the plan (checkpointed) stopping here." Then ask ONE extra
245
+ question — only on this branch: **"Want a lane recommendation for building
246
+ this? [yes / no]"**. Yes run `../../../orc-route/SKILL.md` on this plan
247
+ (it is already a valid plan input) and print the `forecast:` block from
248
+ `../../references/preflight-report.md` alongside it, so price and lane land
249
+ together. No stop. *Take into build* never asks (the lane is chosen and
250
+ running); *Poly split & stop* never asks (it has its own per-repo handoff).
251
+ - **Poly split & stop** (poly-spec input only) the per-repo plans are written
252
+ (HOST here, each PEER into its repo). Present them and the handoff — "open
253
+ each repo in its own session and run `/orc` on its plan; every plan pins the
254
+ same frozen contract, so nothing drifts" then STOP. Never take a poly-spec
255
+ into build; there is no scoring/wave phase for it here.
256
+
257
+ ## Mini
258
+
259
+ The fast lane uses `orc-planner-mini` (Sonnet 5 high), dispatched by orc-mini.
260
+ Same output contract; trimmed procedure. See that subskill.
@@ -23,7 +23,10 @@ a LISTED bucket, never silently dropped. `test-generator/` deliverables count;
23
23
 
24
24
  ## Step 2 — the threshold (config, not vibes)
25
25
 
26
- Read from `../../config.md` (← `.claude/orc.config.yaml`):
26
+ Resolve with `orc lane config orc --json` and read `effective` (v1.0.0 W7 —
27
+ the defaults live in the CLI registry, never in a second table here). The
28
+ Default column below is what the registry ships today, for orientation only:
29
+ a disagreement means the registry is right.
27
30
 
28
31
  | Key | Default | Meaning here |
29
32
  |---|---|---|