@azure-id/orc 1.7.0 → 1.8.1

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 +3649 -3339
  2. package/README-id.md +923 -844
  3. package/README.md +836 -860
  4. package/bin/build-agents.js +43 -27
  5. package/bin/cli.js +701 -3
  6. package/bin/graph-extract.js +927 -0
  7. package/bin/graph-notes.js +188 -0
  8. package/bin/graph-query.js +808 -0
  9. package/bin/graph-resolve.js +178 -0
  10. package/bin/graph-signals.js +277 -0
  11. package/bin/graph.js +605 -0
  12. package/bin/verify-contracts.js +4669 -4527
  13. package/bin/verify-package.js +626 -616
  14. package/bin/webui/api.js +1419 -1414
  15. package/bin/webui/fixtures/index.js +579 -576
  16. package/bin/webui/fixtures/knowledge.js +316 -291
  17. package/bin/webui/i18n/en/knowledge.json +167 -151
  18. package/bin/webui/i18n/en/overview.json +101 -100
  19. package/bin/webui/i18n/id/knowledge.json +167 -151
  20. package/bin/webui/i18n/id/overview.json +101 -100
  21. package/bin/webui/js/panels/knowledge.js +1065 -1006
  22. package/bin/webui/js/panels/overview.js +492 -488
  23. package/package.json +39 -39
  24. package/templates/agents/MODEL-MAPPING.md +163 -158
  25. package/templates/agents/orc-executor-haiku-4-5.md +133 -113
  26. package/templates/agents/orc-executor-opus-4-7-high.md +134 -114
  27. package/templates/agents/orc-executor-opus-4-7-med.md +134 -114
  28. package/templates/agents/orc-executor-opus-4-8-high.md +134 -114
  29. package/templates/agents/orc-executor-opus-5-high.md +134 -114
  30. package/templates/agents/orc-executor-opus-5-low.md +134 -114
  31. package/templates/agents/orc-executor-opus-5-med.md +134 -114
  32. package/templates/agents/orc-executor-sonnet-4-6-high.md +134 -114
  33. package/templates/agents/orc-executor-sonnet-4-6-med.md +134 -114
  34. package/templates/agents/orc-executor-sonnet-5-high.md +134 -114
  35. package/templates/agents/orc-graph-noter-sonnet-4-6-med.md +86 -0
  36. package/templates/hooks/README.md +444 -396
  37. package/templates/hooks/orc-graph-hook.js +336 -0
  38. package/templates/hooks/orc-statusline-render.js +922 -921
  39. package/templates/hooks/orc-statusline.js +1596 -1545
  40. package/templates/skills/_shared/README.md +4 -0
  41. package/templates/skills/_shared/code-graph.md +220 -0
  42. package/templates/skills/_shared/extra-dispatch.md +1 -1
  43. package/templates/skills/_shared/opus5-only.md +4 -0
  44. package/templates/skills/_shared/phases/execution.md +166 -145
  45. package/templates/skills/_shared/phases/planning.md +142 -135
  46. package/templates/skills/_shared/phases/preflight.md +132 -118
  47. package/templates/skills/_shared/phases/review.md +63 -53
  48. package/templates/skills/_shared/phases/rules.md +5 -0
  49. package/templates/skills/_shared/phases/ship.md +96 -88
  50. package/templates/skills/_shared/phases/trace.md +6 -0
  51. package/templates/skills/_shared/phases/wiki-consult.md +194 -189
  52. package/templates/skills/_shared/read-ladder.md +124 -102
  53. package/templates/skills/_shared/return-validation.md +259 -250
  54. package/templates/skills/orc/SKILL.md +255 -254
  55. package/templates/skills/orc/references/preflight-report.md +6 -0
  56. package/templates/skills/orc/subskills/orc-execution/SKILL.md +2 -1
  57. package/templates/skills/orc/subskills/orc-execution/core.md +9 -1
  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 -360
  62. package/templates/skills/orc-quick/references/dispatch-gate.md +6 -0
  63. package/templates/skills/orc-wiki/references/staleness.md +294 -288
@@ -1,259 +1,267 @@
1
- ---
2
- name: orc-mini
3
- description: >
4
- Lightweight ORC for fast implementation. Use for
5
- "use orc-mini to implement X" or "/orc-mini". Same
6
- intake → intent-spec → planning → dispatch → smoke-gate → ship spine as the full
7
- orchestrator, but SKIPS full code review, verification, and the summary phase.
8
- Dispatches ONE Sonnet 5 high-effort subagent for implementation, then runs a
9
- build+test smoke gate (blocks ship on red) and offers opt-in test authoring.
10
- Switchable to full flow mid-run. The orchestrator never implements — it spawns.
11
- ---
12
-
13
- # ORC-MINI
14
-
15
- A trimmed orchestrator for when you want speed over the full quality pipeline.
16
- Everything in the main spine (`../orc/SKILL.md`) applies EXCEPT the
17
- differences below. Load the main skill's references and schemas by path — the
18
- HOT-PATH essentials (dispatch names, return-contract fields, artifact path)
19
- are inlined here so nothing is reconstructed from "full minus deltas."
20
-
21
- Run as **Opus 4.8 high**, or Opus 5 / Fable 5 at medium+ (as full; never downgrade).
22
- **You never implement — you spawn.** The one exception is the **smoke gate**:
23
- a read-only build+test run, not implementation — you still never write code.
24
-
25
- **Worked example** (orient only — never execute from it): `examples/mini-run-mock.md`.
26
-
27
- ## Differences from the full orchestrator
28
-
29
- 1. **Skip full Phase 5 (Review), Phase 6 (Verify), and Phase 7 (Summary).**
30
- Instead: the **smoke gate** after execution, then the opt-in
31
- **test-authoring ask**, then ship.
32
- 2. **Implementation is ONE subagent, Sonnet 5, high effort.** No waves. **No
33
- scoring table** — replace it with a **one-line complexity read** (mini-ok?
34
- or recommend switching to full); log that line, never render the matrix.
35
- 3. **No dispatch-style and no batch-pause questions** — a single subagent
36
- makes both meaningless; never ask them.
37
- 4. **Lighter intake.** Ask only the **Always + medium tier** (Q1–Q4 in
38
- `../_shared/phases/intake.md`); skip the high tier (Q5/Q6). Run the Step
39
- 3.5 repo cross-check at NAMES-ONLY depth (Glob/Grep-confirm what the draft
40
- names, tag the rest `UNVERIFIED`, resolve tags in the sign-off line; >3
41
- tags → recommend the full flow or `orc-analyze`). Sign-off **defaults to
42
- SOFT**, not GATE.
43
- 5. **Still write tests** if the project has a test setup (the executor
44
- creates/updates them in its task).
45
- 6. **Everything else is identical:** run folder + intent-spec, planning,
46
- checkpoint/state-of-play, stop sequence, usage reminder, ship flow.
47
-
48
- ## Mini flow (the phase set)
49
-
50
- ```
51
- Phase 0 intake (Q1–Q4, soft sign-off) + run folder + intent-spec
52
- Phase 1 planning (dispatch orc-planner-mini; analyst first only on real docs)
53
- → one-line complexity read (mini-ok? or recommend switch-to-full)
54
- Phase 3 dispatch ONE executor (orc-executor-sonnet-5-high) — slice carries
55
- the standing `house_rules` card (../_shared/phases/house-rules.md,
56
- injected literally) + the cached `postgres` pattern on a data-access
57
- task (cache HIT only) — collect + validate return
58
- Phase M SMOKE GATE — run build+test → GREEN proceed · RED block ship + surface
59
- Phase X MOCK EXAMPLE (config mock_example) — offer/build after a GREEN gate
60
- Phase T TEST-AUTHORING ASK (opt-in) — offer to write test cases (never run them)
61
- Phase 8 ship (commit / push / PR — never stages mock-examples/)
62
- ```
63
- (No Phase 2 scoring table, no dispatch-style/batch-pause asks, no full
64
- review/verify/summary.)
65
-
66
- **Postgres query grounding.** On a Postgres project, if the task touches the
67
- data-access layer AND `orc pattern status postgres` reports cached (the
68
- deterministic probe in `../_shared/detecting-artifacts.md`, never an ad-hoc
69
- `find` for `.claude/orc/patterns/postgres-pattern.md`), inject it LITERALLY into
70
- the slice (conventions + blocking query invariants).
71
- Cache MISS → skip — mini never codifies (that's the full lane /
72
- `/orc-pattern`); universal invariants + neighbor imitation still cover it.
73
-
74
- **Gotchas (repair memory; config `gotchas`) — mini READS and WRITES.** Probe at
75
- Phase 1 (`orc gotcha status`, one row, never silent), inject the SCOPE-MATCHING
76
- entries into the Phase 3 slice (cap 3; zero matches = no block, never
77
- unfiltered), and append a returned `gotcha_recorded` YOURSELF after the return.
78
- Trimmed mechanics + `.claude/orc/gotchas.md`: `../_shared/gotchas.md` §10.
79
-
80
- ## Phase M — Smoke gate (build + test; blocks ship on red)
81
-
82
- After the executor return validates (`../_shared/return-validation.md` —
83
- including `done` with non-empty `unmet[]` = partial, and §6's worktree delta: a path changed outside `declared_files` is a violation whatever the return said), YOU run the smoke gate
84
- per `../_shared/smoke-gate.md`: read-only build+test. **GREEN** →
85
- test-authoring ask, then ship. **RED** → never offer commit/ship; one repair
86
- re-dispatch, second red → STOP and surface. Docs-only → gate N/A, say so.
87
- `orc run inflight` FIRST — exit 2 REFUSES, because
88
- `a lane that re-dispatches over a live attempt` has broken the contract
89
- (`../_shared/return-validation.md` §0).
90
-
91
- ## Phase X — Mock example + drift recovery (config `mock_example`, default ask)
92
-
93
- Canonical: `../_shared/drift-recovery.md` — load it when the phase fires. After
94
- a GREEN Phase M, before ship: `ask` → MANDATORY offer (never silently
95
- skipped/run) · `on` → build · `off` → skip. Deliverable
96
- `mock-examples/<change-slug>/` at project root (EXAMPLE.md + one runnable
97
- mocked artifact) — **never committed, never staged** (no `.gitignore` edit).
98
- One question after the user runs it: matches expectation? [yes / drift:
99
- <describe>]. Drift → `DRIFT-FROM` handoff (gap analysis → patch plan → dispatch
100
- → re-gate → re-offer), hard cap 2 loops, then an honest unresolved report.
101
- Trace: `PHASE mock-example`, `DRIFT loop=<n>`.
102
-
103
- ## Phase T — Test-authoring ask (opt-in; writes tests, never runs them)
104
-
105
- Same opt-in as full Phase 6.5 — mini **only asks** (never gates the ship).
106
- Default from `config.generate_tests`; at the end of a GREEN run ask: *"Write
107
- test cases for these changes? (I'll author them — automated files +
108
- TEST-PLAN.md + a curl bundle for HTTP APIs — but never run them; you test
109
- manually.)"* Yes → dispatch `orc-test-author-opus-5-med` (subskill
110
- `../orc/subskills/orc-testgen/`) with the run's `actual_files`,
111
- definition-of-done, touched flows, constraints, stack; the two manual
112
- deliverables land in **`test-generator/<change-slug>/` at the project root**.
113
- Validate the returned `test_plan_path`/`curl_bundle_path` are under that folder
114
- (else malformed → re-dispatch); relay + state the exact path (committed on ship,
115
- not gitignored). No → ship. Either way this NEVER runs tests.
116
-
117
- ## Behavior trace (always on)
118
-
119
- `../_shared/phases/trace.md` (`core`, at run start; `orc lane phases` names
120
- the file and the layers). Lane token `mini`, tier **Build lanes** —
121
- per phase, batched to **3 packets** (intake+plan · execution · ship), each
122
- paired with the next phase's first dispatch.
123
- At run start write `log_dir/.current` = `run-mini-<slug>-<DDMMYY>-<HHMMSS>.txt` AND
124
- `touch the trace file` of that name in the SAME step.
125
- Nothing else about the protocol is restated here; a phase that ends with
126
- `zero new trace lines is a protocol violation`.
127
-
128
- Mini does NOT drop the trace. `OUTCOME … band=mini` per task.
129
-
130
- ## Complexity read (replaces the scoring table)
131
-
132
- ONE judgment before dispatch: is this genuinely mini-sized (single coherent
133
- area, low interdependency, low blast radius)? State it in one line and log it.
134
- Complex/high-risk (many interdependencies, core/shared surface,
135
- security-sensitive) → **recommend switching to full** — let the user choose.
136
-
137
- ## Fallback intake (arriving from orc-fast)
138
-
139
- orc-fast falls back HERE whenever its prerequisites fail — never by stopping
140
- the chat. Follow the reader side of `../_shared/fallback-handoff.md`: the
141
- `FALLBACK-FROM` block in the shared run folder names the reason; acknowledge
142
- it in one line, skip re-deriving whatever is carried, reuse the run folder.
143
-
144
- ## Switching to full flow mid-run
145
-
146
- On "switch to full" (or when the complexity read / a mid-run surprise clearly
147
- needs review/verify): the run folder, checkpoint, and intent-spec already live
148
- in the shared `.claude/orc/run/{run-slug}/` format, so the full flow resumes from
149
- the current checkpoint and adds the phases mini skipped. Record the switch in
150
- the decision log.
151
-
152
- ## Dispatch via named agents (canonical name-map — dispatch BY these names)
153
-
154
- Models pinned in `.claude/agents/`; look up here, never reconstruct a name (agent = skill-name + model-effort suffix). See `.claude/agents/MODEL-MAPPING.md`. `opus5_only: true` FORCES the right column and needs an Opus 5 main session — mini's cheap-lane premise is off while it is on (`../_shared/opus5-only.md`).
155
-
156
- **Extra (`extra_enabled`, `../_shared/extra-dispatch.md`):** mini's ONE executor may run off Claude. It has no score, so resolve the pinned executor's **BAND, both edges, and require them to agree** — a partially covering row keeps the run on Claude and the preflight says so. Print the `extra:` line at intake whenever the gate is on (P0: `a lane that sends work off Claude without saying so`); dispatch via `orc extra dispatch --task <file> --json` with the IDENTICAL slice; validate with `return-validation.md` **§2b, not §2** (⛔ SUBSTITUTION replaces the downgrade check); a failure runs `orc extra reconcile <task_id>` FIRST — a worktree that moved is RESUMED, never re-done — then falls back to the pinned Claude agent, announced. A cited-risk change never leaves Claude (`extra_risk_tasks`, default `off`) — and mini's complexity read is not a substitute for that gate.
157
-
158
- | Role | Agent (dispatch this) | Model / effort | When `opus5_only` |
159
- |------|-----------------------|----------------|-------------------|
160
- | mini analysis (docs only) | `orc-analyze-mini-sonnet-5-high` | claude-sonnet-5 / high | `orc-analyze-mini-opus-5-med` |
161
- | mini planning | `orc-planner-mini-sonnet-5-high` | claude-sonnet-5 / high | `orc-planner-mini-opus-5-med` |
162
- | mini execution | `orc-executor-sonnet-5-high` | claude-sonnet-5 / high | `orc-executor-opus-5-low` |
163
- | test authoring (opt-in) | `orc-test-author-opus-5-med` | claude-opus-5 / medium | unchanged |
164
-
165
- ## Config
166
-
167
- **ONE resolver, and it is not you:** `orc lane config orc-mini --json`. Obey
168
- `effective`, print every line in `announce[]` VERBATIM at preflight, and honour
169
- `stops[]` before wave 1. Never re-derive a value, a precedence or an inertness
170
- from `.claude/orc.config.yaml` — a key this lane does not read is not in the
171
- answer, and a key another key shadows comes back already marked. Exit ≠ 0 → say
172
- the CLI is unavailable and fall back to `../_shared/config-precedence.md`'s
173
- documented defaults, out loud. Priorities and families:
174
- `../_shared/config-precedence.md`.
175
-
176
- Wave/scoring/scout keys never apply to mini — and they are not in the answer,
177
- so there is nothing to render or ask.
178
-
179
- ## Rules — the anti-slop card (`../_shared/phases/rules.md`)
180
-
181
- `orc rules slice --lane orc-mini --json` is the ONLY assembler; never build
182
- the card here. It rides under the house rules and above the task —
183
- **house rules > your project's rules > ORC's own packs** — and its `line` prints
184
- VERBATIM at preflight. Returns gain `rules_applied[]`, `rules_conflicts[]` (a gap,
185
- never a silent choice) and `rules_overridden[]`.
186
- ## Calls
187
-
188
- **ONE catalogue, and it is not you:** `orc lane calls orc-mini --json` names every
189
- CLI call this lane makes, each with its exit-code contract, its cost, when to run
190
- it, and what an EMPTY answer means. Never invent a spelling, never re-word an
191
- exit code, and never re-derive a state word — the CLI's state words are the only
192
- state words, and **an exit code is an ANSWER wherever that contract says so, not
193
- a failure**. A call the answer does not name is a call this lane does not make.
194
- Exit ≠ 0 from the catalogue itself → say the CLI is unavailable and name the
195
- command you are about to run, out loud, before running it.
196
-
197
- ## TDD (ONE intake question — mini's whole TDD policy)
198
-
199
- At intake ask once:
200
- *"Anchor this in plan-time acceptance tests (TDD — red tests first, implement
201
- to green)? [yes/no]"*. Yes → the planner slice carries `tdd: on` (the mini
202
- planner authors `tdd_spec` per requirement, **scoped by the same `disposition` set the full lane uses** — `new-surface | behavior-change | covered-by-existing | no-behavior | no-runner`, derived from the `facets`, same safety floor: a cited `risk[]` is never scoped out, so a constant or a translation string gets no test but an auth change always does). Mini keeps its SINGLE executor — no paired TDD task; that executor materializes the failing tests FIRST, then implements to green
203
- (implement→test→repair, cap `tdd_loop_max`; emit `TDD-RED`/`TDD-GREEN` per
204
- iteration; cap hit → STOP + honest red report), and Phase M's smoke gate runs
205
- the TDD suite as part of build+test. Scoped-out requirements are named with their
206
- reason at preflight — never silent. No → skip entirely; never re-ask.
207
-
208
- ## Analyst & planner (mini lane)
209
-
210
- orc-mini dispatches the FAST variants (Sonnet 5 high): `orc-analyze-mini` and
211
- `orc-planner-mini` — same artifacts and output contracts as full, trimmed
212
- depth. The mini analyst is **doc-optional**: on real doc input it runs first,
213
- then the mini planner; on a merely ambiguous request, prefer one inline
214
- clarifying question over a cold analyst spawn. Always single-pass — **no deep
215
- mode, no scouts**; it escalates to `/orc-analyze` deep on its concrete
216
- thresholds and the user chooses. You never analyze or plan yourself.
217
-
218
- **Mini-lane gates (yours, deterministic — same as full; full detail in
219
- `../_shared/phases/analyst-gates.md`; emit `GATE` trace lines).** On
220
- mini-analyst return: evidence spot-check + derivation lint; refuse
221
- take-into-build on open `UNVERIFIED`/missing `scope_closed`; `git_head` ≠
222
- HEAD at plan time → re-run the spot-check first. On mini-planner return: Glob
223
- every `disposition: exists` path, recompute coverage (no orphan
224
- requirements), cycle + collision checks. Any miss → bounce (one retry, then
225
- escalate). At dispatch, append the task's `spec_invariants` to the slice's
226
- `constraints[]` verbatim.
227
-
228
- ## Wiki consult (if present)
229
-
230
- Same rule as the full skill — load `../_shared/phases/wiki-consult.md` at the
231
- planning/complexity-read step: compute the FRESH / AGING / STALE tier from
232
- `.claude/orc/wiki-meta.json`, pull the relevant pages (incl. cross-cutting
233
- maps like `orc-reference-api-surface` when their domain applies), apply
234
- `code > fresh wiki > stale wiki (hints) > model priors`, and **emit
235
- `WIKI-CONSULT <tier> :: docs=<pages pulled>`**. Crosslink: a task touching a
236
- boundary in `.claude/orc/crosslink/needs.json` gets the cached contract
237
- injected per that reference — advisory, never blocking. Mini never generates
238
- the wiki; after a code-changing run apply the passive stale-flag note only
239
- (the post-ship refresh ASK is full-lane/ultra behavior).
240
-
241
- ## Shared artifacts
242
-
243
- Writes to the SAME location as the full skill
244
- (`.claude/orc/run/{run-slug}/`) — a switch needs no migration.
245
-
246
- ## What mini still enforces (from the main hard rules)
247
-
248
- Never implement yourself (the smoke gate is read-only, not implementation) ·
249
- all RUN-STATE artifacts in the run subfolder, never project root (the one
250
- exception is the opt-in `test-generator/<change-slug>/` self-QA deliverable,
251
- which lands at the project root by design) · validate every
252
- subagent return (malformed = failure) · report the dispatch log + remind the
253
- user to run `/usage` (never invoke it programmatically) · **never offer commit
254
- on a red build** (enforced by Phase M).
255
-
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 executor 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.
1
+ ---
2
+ name: orc-mini
3
+ description: >
4
+ Lightweight ORC for fast implementation. Use for
5
+ "use orc-mini to implement X" or "/orc-mini". Same
6
+ intake → intent-spec → planning → dispatch → smoke-gate → ship spine as the full
7
+ orchestrator, but SKIPS full code review, verification, and the summary phase.
8
+ Dispatches ONE Sonnet 5 high-effort subagent for implementation, then runs a
9
+ build+test smoke gate (blocks ship on red) and offers opt-in test authoring.
10
+ Switchable to full flow mid-run. The orchestrator never implements — it spawns.
11
+ ---
12
+
13
+ # ORC-MINI
14
+
15
+ A trimmed orchestrator for when you want speed over the full quality pipeline.
16
+ Everything in the main spine (`../orc/SKILL.md`) applies EXCEPT the
17
+ differences below. Load the main skill's references and schemas by path — the
18
+ HOT-PATH essentials (dispatch names, return-contract fields, artifact path)
19
+ are inlined here so nothing is reconstructed from "full minus deltas."
20
+
21
+ Run as **Opus 4.8 high**, or Opus 5 / Fable 5 at medium+ (as full; never downgrade).
22
+ **You never implement — you spawn.** The one exception is the **smoke gate**:
23
+ a read-only build+test run, not implementation — you still never write code.
24
+
25
+ **Worked example** (orient only — never execute from it): `examples/mini-run-mock.md`.
26
+
27
+ ## Differences from the full orchestrator
28
+
29
+ 1. **Skip full Phase 5 (Review), Phase 6 (Verify), and Phase 7 (Summary).**
30
+ Instead: the **smoke gate** after execution, then the opt-in
31
+ **test-authoring ask**, then ship.
32
+ 2. **Implementation is ONE subagent, Sonnet 5, high effort.** No waves. **No
33
+ scoring table** — replace it with a **one-line complexity read** (mini-ok?
34
+ or recommend switching to full); log that line, never render the matrix.
35
+ 3. **No dispatch-style and no batch-pause questions** — a single subagent
36
+ makes both meaningless; never ask them.
37
+ 4. **Lighter intake.** Ask only the **Always + medium tier** (Q1–Q4 in
38
+ `../_shared/phases/intake.md`); skip the high tier (Q5/Q6). Run the Step
39
+ 3.5 repo cross-check at NAMES-ONLY depth (Glob/Grep-confirm what the draft
40
+ names, tag the rest `UNVERIFIED`, resolve tags in the sign-off line; >3
41
+ tags → recommend the full flow or `orc-analyze`). Sign-off **defaults to
42
+ SOFT**, not GATE.
43
+ 5. **Still write tests** if the project has a test setup (the executor
44
+ creates/updates them in its task).
45
+ 6. **Everything else is identical:** run folder + intent-spec, planning,
46
+ checkpoint/state-of-play, stop sequence, usage reminder, ship flow.
47
+
48
+ ## Mini flow (the phase set)
49
+
50
+ ```
51
+ Phase 0 intake (Q1–Q4, soft sign-off) + run folder + intent-spec
52
+ Phase 1 planning (dispatch orc-planner-mini; analyst first only on real docs)
53
+ → one-line complexity read (mini-ok? or recommend switch-to-full)
54
+ Phase 3 dispatch ONE executor (orc-executor-sonnet-5-high) — slice carries
55
+ the standing `house_rules` card (../_shared/phases/house-rules.md, literal)
56
+ + the `rules_card` under it (`orc rules slice` → `text`, verbatim) + the
57
+ cached `postgres` pattern on a data-access task (cache HIT only) + `orc graph ctx` cards when the graph is on — collect + validate return
58
+ Phase M SMOKE GATE — run build+test → GREEN proceed · RED block ship + surface
59
+ Phase X MOCK EXAMPLE (config mock_example) — offer/build after a GREEN gate
60
+ Phase T TEST-AUTHORING ASK (opt-in) — offer to write test cases (never run them)
61
+ Phase 8 ship (commit / push / PR — never stages mock-examples/)
62
+ ```
63
+ (No Phase 2 scoring table, no dispatch-style/batch-pause asks, no full
64
+ review/verify/summary.)
65
+
66
+ **Postgres query grounding.** On a Postgres project, if the task touches the
67
+ data-access layer AND `orc pattern status postgres` reports cached (the
68
+ deterministic probe in `../_shared/detecting-artifacts.md`, never an ad-hoc
69
+ `find` for `.claude/orc/patterns/postgres-pattern.md`), inject it LITERALLY into
70
+ the slice (conventions + blocking query invariants).
71
+ Cache MISS → skip — mini never codifies (that's the full lane /
72
+ `/orc-pattern`); universal invariants + neighbor imitation still cover it.
73
+
74
+ **Gotchas (repair memory; config `gotchas`) — mini READS and WRITES.** Probe at
75
+ Phase 1 (`orc gotcha status`, one row, never silent), inject the SCOPE-MATCHING
76
+ entries into the Phase 3 slice (cap 3; zero matches = no block, never
77
+ unfiltered), and append a returned `gotcha_recorded` YOURSELF after the return.
78
+ Trimmed mechanics + `.claude/orc/gotchas.md`: `../_shared/gotchas.md` §10.
79
+
80
+ ## Code graph cache — consult, build, use, update (`../_shared/code-graph.md` §0)
81
+
82
+ Never skipped. Every call carries `--if-enabled`: exit 3 = off → print `graph: off` once, make no other graph call.
83
+ Print each JSON `line` in chat; put each `trace` in the next packet VERBATIM.
84
+ 1. **Preflight, with the probes, before the planner:** `orc graph status --if-enabled --heal --json` — it builds or updates the cache itself.
85
+ 2. **Phase 3 slice:** ONE `orc graph ctx <declared_files> --if-enabled --json` → its `card` is the `graph` block; the return carries `graph_used`.
86
+ 3. **Phase M GREEN:** `orc graph update --if-enabled --json`, then one `orc graph notes pending` batch (§6) — the next run starts from this cache.
87
+
88
+ ## Phase M — Smoke gate (build + test; blocks ship on red)
89
+
90
+ After the executor return validates (`../_shared/return-validation.md` —
91
+ including `done` with non-empty `unmet[]` = partial, and §6's worktree delta: a path changed outside `declared_files` is a violation whatever the return said), YOU run the smoke gate
92
+ per `../_shared/smoke-gate.md`: read-only build+test. **GREEN** → code-graph step 3 (above) →
93
+ test-authoring ask, then ship. **RED** → never offer commit/ship; one repair
94
+ re-dispatch, second red → STOP and surface. Docs-only → gate N/A, say so.
95
+ `orc run inflight` FIRST — exit 2 REFUSES, because
96
+ `a lane that re-dispatches over a live attempt` has broken the contract
97
+ (`../_shared/return-validation.md` §0).
98
+
99
+ ## Phase X — Mock example + drift recovery (config `mock_example`, default ask)
100
+
101
+ Canonical: `../_shared/drift-recovery.md` — load it when the phase fires. After
102
+ a GREEN Phase M, before ship: `ask` → MANDATORY offer (never silently
103
+ skipped/run) · `on` → build · `off` → skip. Deliverable
104
+ `mock-examples/<change-slug>/` at project root (EXAMPLE.md + one runnable
105
+ mocked artifact) — **never committed, never staged** (no `.gitignore` edit).
106
+ One question after the user runs it: matches expectation? [yes / drift:
107
+ <describe>]. Drift → `DRIFT-FROM` handoff (gap analysis → patch plan → dispatch
108
+ → re-gate → re-offer), hard cap 2 loops, then an honest unresolved report.
109
+ Trace: `PHASE mock-example`, `DRIFT loop=<n>`.
110
+
111
+ ## Phase T — Test-authoring ask (opt-in; writes tests, never runs them)
112
+
113
+ Same opt-in as full Phase 6.5 — mini **only asks** (never gates the ship).
114
+ Default from `config.generate_tests`; at the end of a GREEN run ask: *"Write
115
+ test cases for these changes? (I'll author them — automated files +
116
+ TEST-PLAN.md + a curl bundle for HTTP APIs — but never run them; you test
117
+ manually.)"* Yes → dispatch `orc-test-author-opus-5-med` (subskill
118
+ `../orc/subskills/orc-testgen/`) with the run's `actual_files`,
119
+ definition-of-done, touched flows, constraints, stack; the two manual
120
+ deliverables land in **`test-generator/<change-slug>/` at the project root**.
121
+ Validate the returned `test_plan_path`/`curl_bundle_path` are under that folder
122
+ (else malformed → re-dispatch); relay + state the exact path (committed on ship,
123
+ not gitignored). No → ship. Either way this NEVER runs tests.
124
+
125
+ ## Behavior trace (always on)
126
+
127
+ `../_shared/phases/trace.md` (`core`, at run start; `orc lane phases` names
128
+ the file and the layers). Lane token `mini`, tier **Build lanes** —
129
+ per phase, batched to **3 packets** (intake+plan · execution · ship), each
130
+ paired with the next phase's first dispatch.
131
+ At run start write `log_dir/.current` = `run-mini-<slug>-<DDMMYY>-<HHMMSS>.txt` AND
132
+ `touch the trace file` of that name in the SAME step.
133
+ Nothing else about the protocol is restated here; a phase that ends with
134
+ `zero new trace lines is a protocol violation`.
135
+
136
+ Mini does NOT drop the trace. `OUTCOME … band=mini` per task.
137
+
138
+ ## Complexity read (replaces the scoring table)
139
+
140
+ ONE judgment before dispatch: is this genuinely mini-sized (single coherent
141
+ area, low interdependency, low blast radius)? State it in one line and log it.
142
+ Complex/high-risk (many interdependencies, core/shared surface,
143
+ security-sensitive) → **recommend switching to full** — let the user choose.
144
+
145
+ ## Fallback intake (arriving from orc-fast)
146
+
147
+ orc-fast falls back HERE whenever its prerequisites fail — never by stopping
148
+ the chat. Follow the reader side of `../_shared/fallback-handoff.md`: the
149
+ `FALLBACK-FROM` block in the shared run folder names the reason; acknowledge
150
+ it in one line, skip re-deriving whatever is carried, reuse the run folder.
151
+
152
+ ## Switching to full flow mid-run
153
+
154
+ On "switch to full" (or when the complexity read / a mid-run surprise clearly
155
+ needs review/verify): the run folder, checkpoint, and intent-spec already live
156
+ in the shared `.claude/orc/run/{run-slug}/` format, so the full flow resumes from
157
+ the current checkpoint and adds the phases mini skipped. Record the switch in
158
+ the decision log.
159
+
160
+ ## Dispatch via named agents (canonical name-map — dispatch BY these names)
161
+
162
+ Models pinned in `.claude/agents/`; look up here, never reconstruct a name (agent = skill-name + model-effort suffix). See `.claude/agents/MODEL-MAPPING.md`. `opus5_only: true` FORCES the right column and needs an Opus 5 main session — mini's cheap-lane premise is off while it is on (`../_shared/opus5-only.md`).
163
+
164
+ **Extra (`extra_enabled`, `../_shared/extra-dispatch.md`):** mini's ONE executor may run off Claude. It has no score, so resolve the pinned executor's **BAND, both edges, and require them to agree** — a partially covering row keeps the run on Claude and the preflight says so. Print the `extra:` line at intake whenever the gate is on (P0: `a lane that sends work off Claude without saying so`); dispatch via `orc extra dispatch --task <file> --json` with the IDENTICAL slice; validate with `return-validation.md` **§2b, not §2** (⛔ SUBSTITUTION replaces the downgrade check); a failure runs `orc extra reconcile <task_id>` FIRST — a worktree that moved is RESUMED, never re-done — then falls back to the pinned Claude agent, announced. A cited-risk change never leaves Claude (`extra_risk_tasks`, default `off`) — and mini's complexity read is not a substitute for that gate.
165
+
166
+ | Role | Agent (dispatch this) | Model / effort | When `opus5_only` |
167
+ |------|-----------------------|----------------|-------------------|
168
+ | mini analysis (docs only) | `orc-analyze-mini-sonnet-5-high` | claude-sonnet-5 / high | `orc-analyze-mini-opus-5-med` |
169
+ | mini planning | `orc-planner-mini-sonnet-5-high` | claude-sonnet-5 / high | `orc-planner-mini-opus-5-med` |
170
+ | mini execution | `orc-executor-sonnet-5-high` | claude-sonnet-5 / high | `orc-executor-opus-5-low` |
171
+ | test authoring (opt-in) | `orc-test-author-opus-5-med` | claude-opus-5 / medium | unchanged |
172
+
173
+ ## Config
174
+
175
+ **ONE resolver, and it is not you:** `orc lane config orc-mini --json`. Obey
176
+ `effective`, print every line in `announce[]` VERBATIM at preflight, and honour
177
+ `stops[]` before wave 1. Never re-derive a value, a precedence or an inertness
178
+ from `.claude/orc.config.yaml` — a key this lane does not read is not in the
179
+ answer, and a key another key shadows comes back already marked. Exit ≠ 0 → say
180
+ the CLI is unavailable and fall back to `../_shared/config-precedence.md`'s
181
+ documented defaults, out loud. Priorities and families:
182
+ `../_shared/config-precedence.md`.
183
+
184
+ Wave/scoring/scout keys never apply to mini — and they are not in the answer,
185
+ so there is nothing to render or ask.
186
+
187
+ ## Rules — the anti-slop card (`../_shared/phases/rules.md`)
188
+
189
+ `orc rules slice --lane orc-mini --json` is the ONLY assembler; never build
190
+ the card here. It rides under the house rules and above the task —
191
+ **house rules > your project's rules > ORC's own packs** — and its `line` prints
192
+ VERBATIM at preflight. Returns gain `rules_applied[]`, `rules_conflicts[]` (a gap,
193
+ never a silent choice) and `rules_overridden[]`.
194
+ ## Calls
195
+
196
+ **ONE catalogue, and it is not you:** `orc lane calls orc-mini --json` names every
197
+ CLI call this lane makes, each with its exit-code contract, its cost, when to run
198
+ it, and what an EMPTY answer means. Never invent a spelling, never re-word an
199
+ exit code, and never re-derive a state word — the CLI's state words are the only
200
+ state words, and **an exit code is an ANSWER wherever that contract says so, not
201
+ a failure**. A call the answer does not name is a call this lane does not make.
202
+ Exit ≠ 0 from the catalogue itself → say the CLI is unavailable and name the
203
+ command you are about to run, out loud, before running it.
204
+
205
+ ## TDD (ONE intake question — mini's whole TDD policy)
206
+
207
+ At intake ask once:
208
+ *"Anchor this in plan-time acceptance tests (TDD — red tests first, implement
209
+ to green)? [yes/no]"*. Yes → the planner slice carries `tdd: on` (the mini
210
+ planner authors `tdd_spec` per requirement, **scoped by the same `disposition` set the full lane uses** — `new-surface | behavior-change | covered-by-existing | no-behavior | no-runner`, derived from the `facets`, same safety floor: a cited `risk[]` is never scoped out, so a constant or a translation string gets no test but an auth change always does). Mini keeps its SINGLE executor — no paired TDD task; that executor materializes the failing tests FIRST, then implements to green
211
+ (implement→test→repair, cap `tdd_loop_max`; emit `TDD-RED`/`TDD-GREEN` per
212
+ iteration; cap hit → STOP + honest red report), and Phase M's smoke gate runs
213
+ the TDD suite as part of build+test. Scoped-out requirements are named with their
214
+ reason at preflight — never silent. No → skip entirely; never re-ask.
215
+
216
+ ## Analyst & planner (mini lane)
217
+
218
+ orc-mini dispatches the FAST variants (Sonnet 5 high): `orc-analyze-mini` and
219
+ `orc-planner-mini` — same artifacts and output contracts as full, trimmed
220
+ depth. The mini analyst is **doc-optional**: on real doc input it runs first,
221
+ then the mini planner; on a merely ambiguous request, prefer one inline
222
+ clarifying question over a cold analyst spawn. Always single-pass — **no deep
223
+ mode, no scouts**; it escalates to `/orc-analyze` deep on its concrete
224
+ thresholds and the user chooses. You never analyze or plan yourself.
225
+
226
+ **Mini-lane gates (yours, deterministic — same as full; full detail in
227
+ `../_shared/phases/analyst-gates.md`; emit `GATE` trace lines).** On
228
+ mini-analyst return: evidence spot-check + derivation lint; refuse
229
+ take-into-build on open `UNVERIFIED`/missing `scope_closed`; `git_head` ≠
230
+ HEAD at plan time → re-run the spot-check first. On mini-planner return: Glob
231
+ every `disposition: exists` path, recompute coverage (no orphan
232
+ requirements), cycle + collision checks. Any miss → bounce (one retry, then
233
+ escalate). At dispatch, append the task's `spec_invariants` to the slice's
234
+ `constraints[]` verbatim.
235
+
236
+ ## Wiki consult (if present)
237
+
238
+ Same rule as the full skill — load `../_shared/phases/wiki-consult.md` at the
239
+ planning/complexity-read step: compute the FRESH / AGING / STALE tier from
240
+ `.claude/orc/wiki-meta.json`, pull the relevant pages (incl. cross-cutting
241
+ maps like `orc-reference-api-surface` when their domain applies), apply
242
+ `code > fresh wiki > stale wiki (hints) > model priors`, and **emit
243
+ `WIKI-CONSULT <tier> :: docs=<pages pulled>`**. Crosslink: a task touching a
244
+ boundary in `.claude/orc/crosslink/needs.json` gets the cached contract
245
+ injected per that reference — advisory, never blocking. Mini never generates
246
+ the wiki; after a code-changing run apply the passive stale-flag note only
247
+ (the post-ship refresh ASK is full-lane/ultra behavior).
248
+
249
+ ## Shared artifacts
250
+
251
+ Writes to the SAME location as the full skill
252
+ (`.claude/orc/run/{run-slug}/`) — a switch needs no migration.
253
+
254
+ ## What mini still enforces (from the main hard rules)
255
+
256
+ Never implement yourself (the smoke gate is read-only, not implementation) ·
257
+ all RUN-STATE artifacts in the run subfolder, never project root (the one
258
+ exception is the opt-in `test-generator/<change-slug>/` self-QA deliverable,
259
+ which lands at the project root by design) · validate every
260
+ subagent return (malformed = failure) · report the dispatch log + remind the
261
+ user to run `/usage` (never invoke it programmatically) · **never offer commit
262
+ on a red build** (enforced by Phase M).
263
+
264
+ ## Waiting mid-run (`/orc-wait`)
265
+
266
+ Canonical: `../_shared/wait.md`. **`a lane that waits without a hand-back` has broken this contract.**
267
+ Checkpoint **full** · safe point **after the executor 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.