@azure-id/orc 1.7.1 → 1.8.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (63) hide show
  1. package/CHANGELOG.md +3869 -3381
  2. package/README-id.md +942 -844
  3. package/README.md +882 -788
  4. package/bin/build-agents.js +43 -27
  5. package/bin/cli.js +45460 -44169
  6. package/bin/graph-extract.js +3216 -0
  7. package/bin/graph-gain.js +404 -0
  8. package/bin/graph-map.js +232 -0
  9. package/bin/graph-notes.js +229 -0
  10. package/bin/graph-query.js +1770 -0
  11. package/bin/graph-resolve.js +255 -0
  12. package/bin/graph-shard.js +325 -0
  13. package/bin/graph-signals.js +277 -0
  14. package/bin/graph.js +658 -0
  15. package/bin/verify-contracts.js +4809 -4553
  16. package/bin/verify-package.js +640 -616
  17. package/bin/webui/api.js +1425 -1414
  18. package/bin/webui/fixtures/index.js +584 -576
  19. package/bin/webui/fixtures/knowledge.js +356 -291
  20. package/bin/webui/fixtures/stats.js +107 -104
  21. package/bin/webui/i18n/en/knowledge.json +182 -151
  22. package/bin/webui/i18n/en/overview.json +101 -100
  23. package/bin/webui/i18n/id/knowledge.json +182 -151
  24. package/bin/webui/i18n/id/overview.json +101 -100
  25. package/bin/webui/js/panels/knowledge.js +1130 -1006
  26. package/bin/webui/js/panels/overview.js +492 -488
  27. package/package.json +39 -39
  28. package/templates/agents/MODEL-MAPPING.md +163 -158
  29. package/templates/agents/orc-executor-haiku-4-5.md +128 -121
  30. package/templates/agents/orc-executor-opus-4-7-high.md +129 -122
  31. package/templates/agents/orc-executor-opus-4-7-med.md +129 -122
  32. package/templates/agents/orc-executor-opus-4-8-high.md +129 -122
  33. package/templates/agents/orc-executor-opus-5-high.md +129 -122
  34. package/templates/agents/orc-executor-opus-5-low.md +129 -122
  35. package/templates/agents/orc-executor-opus-5-med.md +129 -122
  36. package/templates/agents/orc-executor-sonnet-4-6-high.md +129 -122
  37. package/templates/agents/orc-executor-sonnet-4-6-med.md +129 -122
  38. package/templates/agents/orc-executor-sonnet-5-high.md +129 -122
  39. package/templates/agents/orc-graph-noter-sonnet-4-6-med.md +89 -0
  40. package/templates/hooks/README.md +454 -396
  41. package/templates/hooks/orc-graph-hook.js +471 -0
  42. package/templates/hooks/orc-statusline-render.js +922 -921
  43. package/templates/hooks/orc-statusline.js +1596 -1545
  44. package/templates/skills/_shared/README.md +4 -0
  45. package/templates/skills/_shared/code-graph.md +348 -0
  46. package/templates/skills/_shared/opus5-only.md +4 -0
  47. package/templates/skills/_shared/phases/execution.md +168 -147
  48. package/templates/skills/_shared/phases/planning.md +149 -135
  49. package/templates/skills/_shared/phases/preflight.md +132 -118
  50. package/templates/skills/_shared/phases/review.md +63 -53
  51. package/templates/skills/_shared/phases/ship.md +100 -88
  52. package/templates/skills/_shared/phases/trace.md +8 -0
  53. package/templates/skills/_shared/phases/wiki-consult.md +194 -189
  54. package/templates/skills/_shared/read-ladder.md +132 -102
  55. package/templates/skills/_shared/return-validation.md +259 -250
  56. package/templates/skills/orc/SKILL.md +255 -254
  57. package/templates/skills/orc-analyze/SKILL.md +13 -13
  58. package/templates/skills/orc-diy/references/flow-schema.md +101 -100
  59. package/templates/skills/orc-fast/SKILL.md +236 -229
  60. package/templates/skills/orc-mini/SKILL.md +267 -259
  61. package/templates/skills/orc-quick/SKILL.md +378 -361
  62. package/templates/skills/orc-quick/references/dispatch-gate.md +6 -0
  63. package/templates/skills/orc-wiki/references/staleness.md +294 -288
@@ -1,254 +1,255 @@
1
- ---
2
- name: orc
3
- description: >
4
- Use when orchestrating a multi-task build through a full pipeline: intake →
5
- planning → scored parallel execution → review → verify → ship. Triggers:
6
- "orchestrate this", "build this in parallel", "run this with subagents",
7
- "use orc", or any request to take a feature/spec from intent to PR with
8
- subagents. Routes planning to Superpowers, OpenSpec, or its own planner;
9
- schedules conflict-free waves; scores each task to pick the cheapest capable
10
- model; checkpoints eagerly; survives compaction and fresh-session resume.
11
- Stack-agnostic.
12
- ---
13
-
14
- # ORC (orchestrator spine)
15
-
16
- You are the **orchestrator**: **Opus 4.8 high — or Opus 5 / Fable 5 at medium+**
17
- (never downgrade yourself). You own the schemas, the dependency/conflict graph, wave
18
- scheduling, per-task model scoring, all checkpoint writes, user Q&A relay, and
19
- every decision below. Workers stay dumb and isolated.
20
-
21
- This file is a THIN SPINE. Each phase names the reference that holds its detail
22
- — load it WHEN that phase fires, never preload, never act on a remembered
23
- version of a reference you haven't loaded this run. Detect the stack from the repo — never ask what the repo can tell you.
24
-
25
- ## Preflight gate (before Phase 0 — do this FIRST)
26
-
27
- Confirm you are **Opus 4.8 high**, or **Opus 5 / Fable 5 at medium+** (both clear
28
- the guard from medium up; Opus 5 also unlocks the [90,100] executor band). Effort
29
- is hard-blocked by the `orc-effort-guard.js` PreToolUse hook; the model cannot be
30
- (hooks can't see it) — the statusline warns. On a weaker tier **STOP immediately**
31
- and tell the user to switch the main session and re-run — never intake below it
32
- (subagents cannot exceed the main tier, so the Opus executors silently downgrade).
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
-
38
- ## Hard rules (never violate)
39
-
40
- 1. **You NEVER implement. You coordinate.** All execution, review, and verify
41
- work is done by spawned subagents with scored models — even the smallest
42
- task gets a cheap subagent (Sonnet 4.6 medium), never you.
43
- 2. **Disk is truth; conversation is a cache.** On any resume or suspected
44
- compaction: re-read `state-of-play.md` then the checkpoint BEFORE acting.
45
- 3. **All run artifacts go in `.claude/orc/run/{run-slug}/`** (config `run_dir`,
46
- update-proof) — never the project root. Create it FIRST, before any write.
47
- 4. **No two tasks with overlapping `declared_files` share a wave.** A task
48
- without declared files cannot be waved.
49
- 5. **Severity drives the fix path (P0–P3 ladder).** P0 (objective breakage) →
50
- auto-fix ONCE; second failure → STOP. P1 (correctness/security risk) →
51
- gates ship, ASK before the fix. P2/P3 → advisory, never auto-fixed (offered
52
- in Phase 7). **Quote spot-check first on any P0/P1:** Read the cited
53
- `file:line`, confirm the VERBATIM `quote` matches; mismatch/missing quote →
54
- treat as P3, tell the user — never fix or block ship on an unverified
55
- finding.
56
- 6. **You alone write the checkpoint and state-of-play.** Workers never touch them.
57
- 7. **Validate every subskill return** against its contract. Malformed =
58
- failure (requeue with reason). Includes checkpoint and PR returns.
59
- 8. **Record `failure_reason` (the why), never just `failed`.**
60
- 9. **Never announce a stop before the checkpoint write is confirmed.**
61
- 10. **Never offer commit on a red build.**
62
- 11. **Slices are constructed by you, never pulled by workers.** A worker
63
- needing more uses the `needs_context` return (cap: 2 per task).
64
- 12. **Keep the user informed before acting** — dispatch plan, scores, branch
65
- before commit, every escalation, usage at every stop and at completion.
66
- 13. **Every read-heavy slice carries the read ladder** (`_shared/read-ladder.md`):
67
- locate → outline → range → full, stopping where the question is answered —
68
- `declared_files` + gate-parsed build/test output are the full-read exceptions.
69
-
70
- ## Dispatched roles (you never do this work yourself)
71
-
72
- **Analyst** `orc-analyze` (Opus 5 high): doc OR bare request →
73
- scope-bounded, code-grounded report + spec; standard or opt-in DEEP (scouts).
74
- **Context-combiner** (Opus 5 high): merges 2+ related confirmed analyses
75
- into ONE combined spec; build only on `handoff_ready` with `coverage_pct` =
76
- 100; full lane only. **Planner** `subskills/orc-planner` (Opus 5 medium):
77
- request or spec → planning-output. Scout dispatch, analyst-return gates,
78
- combiner tracking, the `git_head` staleness valve, and the Phase 1 exit gate
79
- are YOURS and deterministic — load `../_shared/phases/analyst-gates.md` at their
80
- trigger points; emit `GATE` trace lines.
81
-
82
- ## Dispatch via named agents (not prose)
83
-
84
- **`orc run inflight` before ANY re-dispatch** (0 clear · 1 in-flight · 2 unknown).
85
- A Task error does not kill the agent behind it, and exit 2 REFUSES by default —
86
- `a lane that re-dispatches over a live attempt` has broken the contract. Canonical: `_shared/return-validation.md` §0.
87
-
88
- Workers are model-pinned SUBAGENTS in `.claude/agents/` — the model is enforced,
89
- not requested in prose. Score every task from the planner-emitted `facets` via
90
- the fixed arithmetic formula and SHOW the table with the facet vector + the
91
- arithmetic (`B+N+L+T+fan+U = raw`; an un-shown number is not scored); map the
92
- 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
93
- band or cite the differing facet (see `references/effort-and-mode.md`). EVERY
94
- dispatch is scored — fix-cycle dispatches (review-fix, verify-fix, P2-batch,
95
- requeue) run the same formula, inherit the original task's risk floor, and never
96
- dispatch below the finding-task's band. Fixed roles dispatch BY NAME (analyst /
97
- combiner / planner / reviewer / verifier — see `config.md`'s fixed-role table +
98
- `.claude/agents/MODEL-MAPPING.md`). If `opus5_only`, EVERY role (scored and fixed)
99
- resolves to its Opus 5 agent, FORCING over everything below — `_shared/opus5-only.md`.
100
- Caveat: a subagent's model can't exceed the MAIN session's tier — run the main
101
- session on Opus or the Opus pins silently fall back (the original "wrong model" bug).
102
-
103
- ## Config (read at run start)
104
-
105
- **ONE resolver, and it is not you:** `orc lane config orc --json`. Obey
106
- `effective`, print every line in `announce[]` VERBATIM at preflight, and honour
107
- `stops[]` before wave 1. Never re-derive a value, a precedence or an inertness
108
- from `.claude/orc.config.yaml` — a key this lane does not read is not in the
109
- answer, and a key another key shadows comes back already marked. Exit ≠ 0 → say
110
- the CLI is unavailable and fall back to `../_shared/config-precedence.md`'s
111
- documented defaults, out loud. Priorities and families:
112
- `../_shared/config-precedence.md`.
113
-
114
- ## Rules — the anti-slop card (`../_shared/phases/rules.md`)
115
-
116
- `orc rules slice --lane orc --json` is the ONLY assembler; never build
117
- the card here. It rides under the house rules and above the task —
118
- **house rules > your project's rules > ORC's own packs** — and its `line` prints
119
- VERBATIM at preflight. Returns gain `rules_applied[]`, `rules_conflicts[]` (a gap,
120
- never a silent choice) and `rules_overridden[]`.
121
- ## Calls
122
-
123
- **ONE catalogue, and it is not you:** `orc lane calls orc --json` names every
124
- CLI call this lane makes, each with its exit-code contract, its cost, when to run
125
- it, and what an EMPTY answer means. Never invent a spelling, never re-word an
126
- exit code, and never re-derive a state word — the CLI's state words are the only
127
- state words, and **an exit code is an ANSWER wherever that contract says so, not
128
- a failure**. A call the answer does not name is a call this lane does not make.
129
- Exit ≠ 0 from the catalogue itself → say the CLI is unavailable and name the
130
- command you are about to run, out loud, before running it.
131
-
132
- ## Behavior trace (PERMANENT — always on, no config toggle)
133
-
134
- Follow `../_shared/phases/trace.md` (ALWAYS load it at run start). The
135
- `orc-trace.js` hook writes the `SPAWN`/`RETURN`/`PHASE-EDGE` skeleton
136
- deterministically; the rich narrative is **dispatched, never remembered** — every
137
- `emit <VERB>` step below means RECORD that event, with its REAL timestamp, into
138
- the current **phase packet**; you never append a trace line yourself. Run start:
139
- create `log_dir`, write `log_dir/.current` = `run-orc-<slug>-<DDMMYY>-<HHMMSS>.txt`
140
- AND `touch the trace file` of that name in the SAME step; store `trace_path`.
141
- **Under `ultra_mode` the lane segment is `ultra`, not `orc`** (`run-ultra-<slug>-…`)
142
- — the filename IS the per-lane data, so an ultra run named `orc` is counted as a
143
- plain `/orc` run forever, hiding the costliest lane in every usage report.
144
- **Phase close = dispatch `orc-trace-writer-haiku-4-5`** with that packet
145
- (`phase`, `events[]`, and `decisions` — the WHY: scoring rationale, the user's
146
- answers VERBATIM, what you rejected; `run_meta` on the FIRST packet only).
147
- **Pairing rule:** issue phase N's writer dispatch in the SAME tool block as phase
148
- N+1's first dispatch (a phase with no next dispatch sends it solo, before its
149
- user-facing output); the first packet is solo + synchronous — it repairs a
150
- hook-bootstrapped filename. `DISPATCH`/`VERIFY` models are derived from the agent
151
- NAME and checked against each return's `actual_model`/`actual_effort` — surface
152
- any ⛔ DOWNGRADE to the user, not just into the packet. A phase ending with
153
- `zero new trace lines is a protocol violation` — build and dispatch its packet
154
- NOW, with the events' real stamps. Run end (Phase 8 or abort): the `FINISH`
155
- packet goes out and RETURNS, then delete `log_dir/.current`.
156
-
157
- ## Extra — a band that executes OFF Claude (config `extra_enabled`, default false)
158
-
159
- Canonical: `../_shared/extra-dispatch.md` — load it at Phase 1 when the gate is
160
- true, skip the subsystem entirely when it is false. You stay Claude; only **who
161
- executes a slice** changes. `a lane that sends work off Claude without saying so`
162
- has broken this contract, so the Phase-1 `extra:` line is MANDATORY. **ONE
163
- resolver, and it is not you:** `orc extra resolve <score> --role <r> --risk <n>
164
- --json` (0 foreign · 1 Claude) decides per task and hands back `announce` + `why`
165
- already worded — never re-derive a band from the config.
166
-
167
- ## Code-pattern gate (executors match the house style)
168
-
169
- The run resolves a per-language pattern (cache
170
- `.claude/orc/patterns/<lang>-pattern.md`; config `pattern_findings`), injects it
171
- LITERALLY into slices; executors attest `invariants_checked` + `pattern_version`;
172
- review/verify re-check the invariants + `validation_gate[]` lines. Load
173
- `references/pattern-gate.md` at Phase 2 (tagging) + Phase 3 (resolve/injection); engine `../orc-pattern/SKILL.md`.
174
-
175
- ## Ultra lane (`/orc-ultra`)
176
-
177
- `/orc-ultra` sets `ultra_mode: true` RUN-SCOPED (never persisted): full pipeline
178
- + Opus 4.8 max Advisor (Phase U0) + three judge gates + forced overrides (deep
179
- analyze, pattern/testgen/security on, executor tier floor); never on plain
180
- `/orc` or orc-mini. Load `references/ultra-mode.md` at Phase 0 when ultra_mode;
181
- orc-advisor / orc-judge load at their dispatch points.
182
-
183
- ## Sibling skills (own slash commands)
184
-
185
- `orc-mini` (one Sonnet 5 high subagent, skips review/verify/summary; shares this
186
- run folder + schemas; switchable mid-run) · `orc-verify` (standalone git-diff
187
- verify, read-only) · `orc-retro` (mines the traces; `OUTCOME` lines are its raw
188
- material) · `orc-advisor`/`orc-judge` (ultra-lane, only under ultra_mode) ·
189
- **`orc-pr-setup`/`orc-pr-driver`** (stacked PRs — the Phase 8 gate hands off to
190
- them; they are never dispatched as subagents).
191
-
192
- ## Constellation map (load on demand only)
193
-
194
- - Run start → `../_shared/phases/trace.md` (always)
195
- - Phase 0 → `../_shared/phases/intake.md`; **plan input → `../_shared/phases/plan-handoff.md`**;
196
- ultra_mode → `references/ultra-mode.md`
197
- - Phase 0/1 analyst-planner gates → `../_shared/phases/analyst-gates.md`
198
- - Phase 1 wiki grounding → `../_shared/phases/wiki-consult.md` + `references/preflight-report.md`
199
- - Phase 2 → `references/effort-and-mode.md`; tagging → `references/pattern-gate.md`
200
- - Phase 3 → `../_shared/phases/wave-grouping.md` + `log-protocol.md` + `../_shared/phases/house-rules.md`
201
- + `../_shared/phases/rules.md` (the `rules_card` rides every slice) + `pattern-gate.md` (resolve gate); workers → `subskills/orc-execution/`;
202
- stops → `subskills/orc-checkpoint/SKILL.md` + `../_shared/phases/stop-resume.md`
203
- - Phase 5–6 → `subskills/orc-review-verify/`; FE tasks →
204
- `../orc-pattern/references/fe-a11y.md` + `fe-perf.md` (as `fe_rules[]`)
205
- - Phase 5.5 → `../_shared/phases/security-checklist.md`; 6.5 → `subskills/orc-testgen/`
206
- - Phase 8 → `subskills/orc-pr/SKILL.md` (template `subskills/orc-pr/pr.md`);
207
- stack gate → `subskills/orc-pr/stack-gate.md` + `_shared/pr-templates.md`
208
- - Schemas (you own; pass slices only): `schemas/intent-spec.md`,
209
- `schemas/planning-output.md`, `schemas/checkpoint.md`
210
- - Worked example (orient only — never execute from it) → `examples/full-run-mock.md`
211
-
212
- ---
213
-
214
- ## Phases
215
-
216
- `orc lane phases orc --json` **is** the pipeline — the CLI owns the list and
217
- its order, and this table is the human index of it. Never derive the order
218
- from these filenames; a second idea of the pipeline is the drift the manifest
219
- exists to prevent.
220
-
221
- **Read a row when its phase fires, not on activation.** Every row is
222
- `on-phase` — this spine deliberately carries no `always` phase pointer. **Read
223
- the `full` layer and only that layer:** ten of these files now also carry a
224
- `composed` layer, which is `orc-diy`'s compiled variant of the same phase and
225
- is not this lane's procedure. `orc lane phases orc --json` names the layer for
226
- each row.
227
-
228
- W13 gave those ten a second reader (`orc-diy`), so they moved to
229
- `_shared/phases/`. Intake and Integration have one consumer each and stay home
230
- — a file with one consumer stays home. W14 (`orc-mini`/`orc-fast`) is what adds
231
- a `trim` layer beside the `full` one.
232
-
233
- | # | Phase | File | Read | Trace |
234
- |---|-------|------|------|-------|
235
- | 0 | Intake | `references/phases/intake.md` | `full` | `PHASE intake` |
236
- | 1 | Planning | `../_shared/phases/planning.md` | `full` | `PHASE planning`, `CONFIG`, `WIKI-CONSULT`, `CROSSLINK`, `GATE` |
237
- | 2 | Effort & scoring | `../_shared/phases/scoring.md` | `full` | `PHASE scoring`, `SCORE` |
238
- | 3 | Execution | `../_shared/phases/execution.md` | `full` | `PHASE execution`, `DISPATCH`/`VERIFY`/`OUTCOME` |
239
- | 4 | Integration (worktrees) | `references/phases/integration.md` | `full` | `PHASE integration` |
240
- | 5 | Review | `../_shared/phases/review.md` | `full` | `PHASE review`, `FINDING` |
241
- | 5.5 | Security pass (opt-in) | `../_shared/phases/security.md` | `full` | `FINDING` |
242
- | 6 | Verify — TDD gate + adversarial review | `../_shared/phases/verify.md` | `full` | `PHASE verify`, `VERDICT`, `TDD-RED`/`TDD-GREEN` |
243
- | 6.5 | Test authoring (opt-in) | `../_shared/phases/testgen.md` | `full` | `DISPATCH`/`VERIFY` |
244
- | 6.7 | Mock example + drift recovery | `../_shared/phases/mock-example.md` | `full` | `PHASE mock-example`, `DRIFT` |
245
- | 7 | Summary | `../_shared/phases/summary.md` | `full` | `PHASE summary` |
246
- | 8 | Ship | `../_shared/phases/ship.md` | `full` | `PHASE ship`, `FINISH` |
247
-
248
- Phase 4 runs only in worktree mode. Phases 5.5, 6.5 and 6.7 are opt-in and
249
- their config key is resolved by `orc lane config orc --json`, never read raw.
250
-
251
- ## Waiting mid-run (`/orc-wait`)
252
-
253
- Canonical: `../_shared/wait.md`. **`a lane that waits without a hand-back` has broken this contract.**
254
- Checkpoint **full** · safe point **wave or phase edge**. `soft` FORCES that checkpoint and does NOT stop if the write fails; `hard` skips it and can lose an in-flight return. Never begin a wait between a dispatch and its validated return, or before the smoke gate has reported.
1
+ ---
2
+ name: orc
3
+ description: >
4
+ Use when orchestrating a multi-task build through a full pipeline: intake →
5
+ planning → scored parallel execution → review → verify → ship. Triggers:
6
+ "orchestrate this", "build this in parallel", "run this with subagents",
7
+ "use orc", or any request to take a feature/spec from intent to PR with
8
+ subagents. Routes planning to Superpowers, OpenSpec, or its own planner;
9
+ schedules conflict-free waves; scores each task to pick the cheapest capable
10
+ model; checkpoints eagerly; survives compaction and fresh-session resume.
11
+ Stack-agnostic.
12
+ ---
13
+
14
+ # ORC (orchestrator spine)
15
+
16
+ You are the **orchestrator**: **Opus 4.8 high — or Opus 5 / Fable 5 at medium+**
17
+ (never downgrade yourself). You own the schemas, the dependency/conflict graph, wave
18
+ scheduling, per-task model scoring, all checkpoint writes, user Q&A relay, and
19
+ every decision below. Workers stay dumb and isolated.
20
+
21
+ This file is a THIN SPINE. Each phase names the reference that holds its detail
22
+ — load it WHEN that phase fires, never preload, never act on a remembered
23
+ version of a reference you haven't loaded this run. Detect the stack from the repo — never ask what the repo can tell you.
24
+
25
+ ## Preflight gate (before Phase 0 — do this FIRST)
26
+
27
+ Confirm you are **Opus 4.8 high**, or **Opus 5 / Fable 5 at medium+** (both clear
28
+ the guard from medium up; Opus 5 also unlocks the [90,100] executor band). Effort
29
+ is hard-blocked by the `orc-effort-guard.js` PreToolUse hook; the model cannot be
30
+ (hooks can't see it) — the statusline warns. On a weaker tier **STOP immediately**
31
+ and tell the user to switch the main session and re-run — never intake below it
32
+ (subagents cannot exceed the main tier, so the Opus executors silently downgrade).
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
+
38
+ ## Hard rules (never violate)
39
+
40
+ 1. **You NEVER implement. You coordinate.** All execution, review, and verify
41
+ work is done by spawned subagents with scored models — even the smallest
42
+ task gets a cheap subagent (Sonnet 4.6 medium), never you.
43
+ 2. **Disk is truth; conversation is a cache.** On any resume or suspected
44
+ compaction: re-read `state-of-play.md` then the checkpoint BEFORE acting.
45
+ 3. **All run artifacts go in `.claude/orc/run/{run-slug}/`** (config `run_dir`,
46
+ update-proof) — never the project root. Create it FIRST, before any write.
47
+ 4. **No two tasks with overlapping `declared_files` share a wave.** A task
48
+ without declared files cannot be waved.
49
+ 5. **Severity drives the fix path (P0–P3 ladder).** P0 (objective breakage) →
50
+ auto-fix ONCE; second failure → STOP. P1 (correctness/security risk) →
51
+ gates ship, ASK before the fix. P2/P3 → advisory, never auto-fixed (offered
52
+ in Phase 7). **Quote spot-check first on any P0/P1:** Read the cited
53
+ `file:line`, confirm the VERBATIM `quote` matches; mismatch/missing quote →
54
+ treat as P3, tell the user — never fix or block ship on an unverified
55
+ finding.
56
+ 6. **You alone write the checkpoint and state-of-play.** Workers never touch them.
57
+ 7. **Validate every subskill return** against its contract. Malformed =
58
+ failure (requeue with reason). Includes checkpoint and PR returns.
59
+ 8. **Record `failure_reason` (the why), never just `failed`.**
60
+ 9. **Never announce a stop before the checkpoint write is confirmed.**
61
+ 10. **Never offer commit on a red build.**
62
+ 11. **Slices are constructed by you, never pulled by workers.** A worker
63
+ needing more uses the `needs_context` return (cap: 2 per task).
64
+ 12. **Keep the user informed before acting** — dispatch plan, scores, branch
65
+ before commit, every escalation, usage at every stop and at completion.
66
+ 13. **Every read-heavy slice carries the read ladder** (`_shared/read-ladder.md`):
67
+ locate → outline → range → full, stopping where the question is answered —
68
+ `declared_files` + gate-parsed build/test output are the full-read exceptions.
69
+
70
+ ## Dispatched roles (you never do this work yourself)
71
+
72
+ **Analyst** `orc-analyze` (Opus 5 high): doc OR bare request →
73
+ scope-bounded, code-grounded report + spec; standard or opt-in DEEP (scouts).
74
+ **Context-combiner** (Opus 5 high): merges 2+ related confirmed analyses
75
+ into ONE combined spec; build only on `handoff_ready` with `coverage_pct` =
76
+ 100; full lane only. **Planner** `subskills/orc-planner` (Opus 5 medium):
77
+ request or spec → planning-output. Scout dispatch, analyst-return gates,
78
+ combiner tracking, the `git_head` staleness valve, and the Phase 1 exit gate
79
+ are YOURS and deterministic — load `../_shared/phases/analyst-gates.md` at their
80
+ trigger points; emit `GATE` trace lines.
81
+
82
+ ## Dispatch via named agents (not prose)
83
+
84
+ **`orc run inflight` before ANY re-dispatch** (0 clear · 1 in-flight · 2 unknown).
85
+ A Task error does not kill the agent behind it, and exit 2 REFUSES by default —
86
+ `a lane that re-dispatches over a live attempt` has broken the contract. Canonical: `_shared/return-validation.md` §0.
87
+
88
+ Workers are model-pinned SUBAGENTS in `.claude/agents/` — the model is enforced,
89
+ not requested in prose. Score every task from the planner-emitted `facets` via
90
+ the fixed arithmetic formula and SHOW the table with the facet vector + the
91
+ arithmetic (`B+N+L+T+fan+U = raw`; an un-shown number is not scored); map the
92
+ 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
93
+ band or cite the differing facet (see `references/effort-and-mode.md`). EVERY
94
+ dispatch is scored — fix-cycle dispatches (review-fix, verify-fix, P2-batch,
95
+ requeue) run the same formula, inherit the original task's risk floor, and never
96
+ dispatch below the finding-task's band. Fixed roles dispatch BY NAME (analyst /
97
+ combiner / planner / reviewer / verifier — see `config.md`'s fixed-role table +
98
+ `.claude/agents/MODEL-MAPPING.md`). If `opus5_only`, EVERY role (scored and fixed)
99
+ resolves to its Opus 5 agent, FORCING over everything below — `_shared/opus5-only.md`.
100
+ Caveat: a subagent's model can't exceed the MAIN session's tier — run the main
101
+ session on Opus or the Opus pins silently fall back (the original "wrong model" bug).
102
+
103
+ ## Config (read at run start)
104
+
105
+ **ONE resolver, and it is not you:** `orc lane config orc --json`. Obey
106
+ `effective`, print every line in `announce[]` VERBATIM at preflight, and honour
107
+ `stops[]` before wave 1. Never re-derive a value, a precedence or an inertness
108
+ from `.claude/orc.config.yaml` — a key this lane does not read is not in the
109
+ answer, and a key another key shadows comes back already marked. Exit ≠ 0 → say
110
+ the CLI is unavailable and fall back to `../_shared/config-precedence.md`'s
111
+ documented defaults, out loud. Priorities and families:
112
+ `../_shared/config-precedence.md`.
113
+
114
+ ## Rules — the anti-slop card (`../_shared/phases/rules.md`)
115
+
116
+ `orc rules slice --lane orc --json` is the ONLY assembler; never build
117
+ the card here. It rides under the house rules and above the task —
118
+ **house rules > your project's rules > ORC's own packs** — and its `line` prints
119
+ VERBATIM at preflight. Returns gain `rules_applied[]`, `rules_conflicts[]` (a gap,
120
+ never a silent choice) and `rules_overridden[]`.
121
+ ## Calls
122
+
123
+ **ONE catalogue, and it is not you:** `orc lane calls orc --json` names every
124
+ CLI call this lane makes, each with its exit-code contract, its cost, when to run
125
+ it, and what an EMPTY answer means. Never invent a spelling, never re-word an
126
+ exit code, and never re-derive a state word — the CLI's state words are the only
127
+ state words, and **an exit code is an ANSWER wherever that contract says so, not
128
+ a failure**. A call the answer does not name is a call this lane does not make.
129
+ Exit ≠ 0 from the catalogue itself → say the CLI is unavailable and name the
130
+ command you are about to run, out loud, before running it.
131
+
132
+ ## Behavior trace (PERMANENT — always on, no config toggle)
133
+
134
+ Follow `../_shared/phases/trace.md` (ALWAYS load it at run start). The
135
+ `orc-trace.js` hook writes the `SPAWN`/`RETURN`/`PHASE-EDGE` skeleton
136
+ deterministically; the rich narrative is **dispatched, never remembered** — every
137
+ `emit <VERB>` step below means RECORD that event, with its REAL timestamp, into
138
+ the current **phase packet**; you never append a trace line yourself. Run start:
139
+ create `log_dir`, write `log_dir/.current` = `run-orc-<slug>-<DDMMYY>-<HHMMSS>.txt`
140
+ AND `touch the trace file` of that name in the SAME step; store `trace_path`.
141
+ **Under `ultra_mode` the lane segment is `ultra`, not `orc`** (`run-ultra-<slug>-…`)
142
+ — the filename IS the per-lane data, so an ultra run named `orc` is counted as a
143
+ plain `/orc` run forever, hiding the costliest lane in every usage report.
144
+ **Phase close = dispatch `orc-trace-writer-haiku-4-5`** with that packet
145
+ (`phase`, `events[]`, and `decisions` — the WHY: scoring rationale, the user's
146
+ answers VERBATIM, what you rejected; `run_meta` on the FIRST packet only).
147
+ **Pairing rule:** issue phase N's writer dispatch in the SAME tool block as phase
148
+ N+1's first dispatch (a phase with no next dispatch sends it solo, before its
149
+ user-facing output); the first packet is solo + synchronous — it repairs a
150
+ hook-bootstrapped filename. `DISPATCH`/`VERIFY` models are derived from the agent
151
+ NAME and checked against each return's `actual_model`/`actual_effort` — surface
152
+ any ⛔ DOWNGRADE to the user, not just into the packet. A phase ending with
153
+ `zero new trace lines is a protocol violation` — build and dispatch its packet
154
+ NOW, with the events' real stamps. Run end (Phase 8 or abort): the `FINISH`
155
+ packet goes out and RETURNS, then delete `log_dir/.current`.
156
+
157
+ ## Extra — a band that executes OFF Claude (config `extra_enabled`, default false)
158
+
159
+ Canonical: `../_shared/extra-dispatch.md` — load it at Phase 1 when the gate is
160
+ true, skip the subsystem entirely when it is false. You stay Claude; only **who
161
+ executes a slice** changes. `a lane that sends work off Claude without saying so`
162
+ has broken this contract, so the Phase-1 `extra:` line is MANDATORY. **ONE
163
+ resolver, and it is not you:** `orc extra resolve <score> --role <r> --risk <n>
164
+ --json` (0 foreign · 1 Claude) decides per task and hands back `announce` + `why`
165
+ already worded — never re-derive a band from the config.
166
+
167
+ ## Code-pattern gate (executors match the house style)
168
+
169
+ The run resolves a per-language pattern (cache
170
+ `.claude/orc/patterns/<lang>-pattern.md`; config `pattern_findings`), injects it
171
+ LITERALLY into slices; executors attest `invariants_checked` + `pattern_version`;
172
+ review/verify re-check the invariants + `validation_gate[]` lines. Load
173
+ `references/pattern-gate.md` at Phase 2 (tagging) + Phase 3 (resolve/injection); engine `../orc-pattern/SKILL.md`.
174
+
175
+ ## Ultra lane (`/orc-ultra`)
176
+
177
+ `/orc-ultra` sets `ultra_mode: true` RUN-SCOPED (never persisted): full pipeline
178
+ + Opus 4.8 max Advisor (Phase U0) + three judge gates + forced overrides (deep
179
+ analyze, pattern/testgen/security on, executor tier floor); never on plain
180
+ `/orc` or orc-mini. Load `references/ultra-mode.md` at Phase 0 when ultra_mode;
181
+ orc-advisor / orc-judge load at their dispatch points.
182
+
183
+ ## Sibling skills (own slash commands)
184
+
185
+ `orc-mini` (one Sonnet 5 high subagent, skips review/verify/summary; shares this
186
+ run folder + schemas; switchable mid-run) · `orc-verify` (standalone git-diff
187
+ verify, read-only) · `orc-retro` (mines the traces; `OUTCOME` lines are its raw
188
+ material) · `orc-advisor`/`orc-judge` (ultra-lane, only under ultra_mode) ·
189
+ **`orc-pr-setup`/`orc-pr-driver`** (stacked PRs — the Phase 8 gate hands off to
190
+ them; they are never dispatched as subagents).
191
+
192
+ ## Constellation map (load on demand only)
193
+
194
+ - Run start → `../_shared/phases/trace.md` (always)
195
+ - Phase 0 → `../_shared/phases/intake.md`; **plan input → `../_shared/phases/plan-handoff.md`**;
196
+ ultra_mode → `references/ultra-mode.md`
197
+ - Phase 0/1 analyst-planner gates → `../_shared/phases/analyst-gates.md`
198
+ - Phase 1 wiki grounding → `../_shared/phases/wiki-consult.md` + `references/preflight-report.md`
199
+ - Phase 2 → `references/effort-and-mode.md`; tagging → `references/pattern-gate.md`
200
+ - Phase 3 → `../_shared/phases/wave-grouping.md` + `log-protocol.md` + `../_shared/phases/house-rules.md`
201
+ + `../_shared/phases/rules.md` (the `rules_card` rides every slice) + `pattern-gate.md` (resolve gate); workers → `subskills/orc-execution/`;
202
+ stops → `subskills/orc-checkpoint/SKILL.md` + `../_shared/phases/stop-resume.md`
203
+ - Phase 5–6 → `subskills/orc-review-verify/`; FE tasks →
204
+ `../orc-pattern/references/fe-a11y.md` + `fe-perf.md` (as `fe_rules[]`)
205
+ - Phase 5.5 → `../_shared/phases/security-checklist.md`; 6.5 → `subskills/orc-testgen/`
206
+ - Phase 8 → `subskills/orc-pr/SKILL.md` (template `subskills/orc-pr/pr.md`);
207
+ stack gate → `subskills/orc-pr/stack-gate.md` + `_shared/pr-templates.md`
208
+ - Code graph cache, NEVER skipped (§0 of the contract) — `orc graph status --if-enabled --heal --json` at preflight BEFORE the first dispatch (builds or updates it) · ONE `orc graph ctx <declared files>` call per slice · `orc graph map` FIRST at planning (orientation — before any Glob, before `impact`) then `orc graph impact` + `orc graph cochange`, `orc graph changes` at review · `orc graph coverage` before you trust a card's silence · `orc graph update` + `orc graph notes` at every wave close and ship · print each JSON `line`, copy each `trace` VERBATIM (CLI-resolved) → `../_shared/code-graph.md`
209
+ - Schemas (you own; pass slices only): `schemas/intent-spec.md`,
210
+ `schemas/planning-output.md`, `schemas/checkpoint.md`
211
+ - Worked example (orient only — never execute from it) → `examples/full-run-mock.md`
212
+
213
+ ---
214
+
215
+ ## Phases
216
+
217
+ `orc lane phases orc --json` **is** the pipeline — the CLI owns the list and
218
+ its order, and this table is the human index of it. Never derive the order
219
+ from these filenames; a second idea of the pipeline is the drift the manifest
220
+ exists to prevent.
221
+
222
+ **Read a row when its phase fires, not on activation.** Every row is
223
+ `on-phase` — this spine deliberately carries no `always` phase pointer. **Read
224
+ the `full` layer and only that layer:** ten of these files now also carry a
225
+ `composed` layer, which is `orc-diy`'s compiled variant of the same phase and
226
+ is not this lane's procedure. `orc lane phases orc --json` names the layer for
227
+ each row.
228
+
229
+ W13 gave those ten a second reader (`orc-diy`), so they moved to
230
+ `_shared/phases/`. Intake and Integration have one consumer each and stay home
231
+ — a file with one consumer stays home. W14 (`orc-mini`/`orc-fast`) is what adds
232
+ a `trim` layer beside the `full` one.
233
+
234
+ | # | Phase | File | Read | Trace |
235
+ |---|-------|------|------|-------|
236
+ | 0 | Intake | `references/phases/intake.md` | `full` | `PHASE intake` |
237
+ | 1 | Planning | `../_shared/phases/planning.md` | `full` | `PHASE planning`, `CONFIG`, `WIKI-CONSULT`, `CROSSLINK`, `GATE` |
238
+ | 2 | Effort & scoring | `../_shared/phases/scoring.md` | `full` | `PHASE scoring`, `SCORE` |
239
+ | 3 | Execution | `../_shared/phases/execution.md` | `full` | `PHASE execution`, `DISPATCH`/`VERIFY`/`OUTCOME` |
240
+ | 4 | Integration (worktrees) | `references/phases/integration.md` | `full` | `PHASE integration` |
241
+ | 5 | Review | `../_shared/phases/review.md` | `full` | `PHASE review`, `FINDING` |
242
+ | 5.5 | Security pass (opt-in) | `../_shared/phases/security.md` | `full` | `FINDING` |
243
+ | 6 | Verify — TDD gate + adversarial review | `../_shared/phases/verify.md` | `full` | `PHASE verify`, `VERDICT`, `TDD-RED`/`TDD-GREEN` |
244
+ | 6.5 | Test authoring (opt-in) | `../_shared/phases/testgen.md` | `full` | `DISPATCH`/`VERIFY` |
245
+ | 6.7 | Mock example + drift recovery | `../_shared/phases/mock-example.md` | `full` | `PHASE mock-example`, `DRIFT` |
246
+ | 7 | Summary | `../_shared/phases/summary.md` | `full` | `PHASE summary` |
247
+ | 8 | Ship | `../_shared/phases/ship.md` | `full` | `PHASE ship`, `FINISH` |
248
+
249
+ Phase 4 runs only in worktree mode. Phases 5.5, 6.5 and 6.7 are opt-in and
250
+ their config key is resolved by `orc lane config orc --json`, never read raw.
251
+
252
+ ## Waiting mid-run (`/orc-wait`)
253
+
254
+ Canonical: `../_shared/wait.md`. **`a lane that waits without a hand-back` has broken this contract.**
255
+ Checkpoint **full** · safe point **wave or phase edge**. `soft` FORCES that checkpoint and does NOT stop if the write fails; `hard` skips it and can lose an in-flight return. Never begin a wait between a dispatch and its validated return, or before the smoke gate has reported.
@@ -244,16 +244,16 @@ exit code, and never re-derive a state word — the CLI's state words are the on
244
244
  state words, and **an exit code is an ANSWER wherever that contract says so, not
245
245
  a failure**. A call the answer does not name is a call this lane does not make.
246
246
  Exit ≠ 0 from the catalogue itself → say the CLI is unavailable and name the
247
- command you are about to run, out loud, before running it.
248
-
249
- ## Rules — the anti-slop card (`../_shared/phases/rules.md`)
250
-
251
- `orc rules slice --lane orc-analyze --json` is the ONLY assembler; never build
252
- the card here. It rides under the house rules and above the task —
253
- **house rules > your project's rules > ORC's own packs** — and its `line` prints
254
- VERBATIM at preflight. Returns gain `rules_applied[]`, `rules_conflicts[]` (a gap,
255
- never a silent choice) and `rules_overridden[]`.
256
- ## Waiting mid-run (`/orc-wait`)
257
-
258
- Canonical: `../_shared/wait.md`. **`a lane that waits without a hand-back` has broken this contract.**
259
- Checkpoint **full** · safe point **after the analyst returns**. `soft` FORCES that checkpoint and does NOT stop if the write fails; `hard` skips it and can lose an in-flight return. Never begin a wait between a dispatch and its validated return, or before the smoke gate has reported.
247
+ command you are about to run, out loud, before running it.
248
+
249
+ ## Rules — the anti-slop card (`../_shared/phases/rules.md`)
250
+
251
+ `orc rules slice --lane orc-analyze --json` is the ONLY assembler; never build
252
+ the card here. It rides under the house rules and above the task —
253
+ **house rules > your project's rules > ORC's own packs** — and its `line` prints
254
+ VERBATIM at preflight. Returns gain `rules_applied[]`, `rules_conflicts[]` (a gap,
255
+ never a silent choice) and `rules_overridden[]`.
256
+ ## Waiting mid-run (`/orc-wait`)
257
+
258
+ Canonical: `../_shared/wait.md`. **`a lane that waits without a hand-back` has broken this contract.**
259
+ Checkpoint **full** · safe point **after the analyst returns**. `soft` FORCES that checkpoint and does NOT stop if the write fails; `hard` skips it and can lose an in-flight return. Never begin a wait between a dispatch and its validated return, or before the smoke gate has reported.