@azure-id/orc 1.9.2 → 2.0.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 (172) hide show
  1. package/CHANGELOG.md +321 -0
  2. package/README-id.md +21 -36
  3. package/README.md +25 -36
  4. package/bin/build-agents.js +117 -20
  5. package/bin/cli.js +725 -29
  6. package/bin/gotcha-import.js +1081 -0
  7. package/bin/gotcha.js +1286 -0
  8. package/bin/graph-query.js +1 -1
  9. package/bin/graph.js +717 -717
  10. package/bin/habit.js +1453 -0
  11. package/bin/mockrun-catalog.js +281 -276
  12. package/bin/run-undo.js +398 -0
  13. package/bin/trace-write.js +657 -0
  14. package/bin/verify-contracts.js +525 -79
  15. package/bin/verify-package.js +51 -4
  16. package/bin/webui/api.js +26 -0
  17. package/bin/webui/app.html +239 -232
  18. package/bin/webui/css/00-tokens.css +110 -92
  19. package/bin/webui/css/04-motion.css +87 -0
  20. package/bin/webui/css/06-responsive.css +203 -178
  21. package/bin/webui/css/panels/behaviour.css +205 -0
  22. package/bin/webui/fixtures/behaviour.js +532 -0
  23. package/bin/webui/fixtures/index.js +34 -0
  24. package/bin/webui/fixtures/knowledge.js +7 -1
  25. package/bin/webui/fixtures/stats.js +16 -0
  26. package/bin/webui/i18n/en/behaviour.json +143 -0
  27. package/bin/webui/i18n/en/nav.json +25 -24
  28. package/bin/webui/i18n/en/tour.json +37 -35
  29. package/bin/webui/i18n/id/behaviour.json +143 -0
  30. package/bin/webui/i18n/id/nav.json +25 -24
  31. package/bin/webui/i18n/id/tour.json +37 -35
  32. package/bin/webui/js/01-i18n.js +155 -154
  33. package/bin/webui/js/90-tour.js +498 -494
  34. package/bin/webui/js/91-shortcuts.js +126 -126
  35. package/bin/webui/js/99-boot.js +121 -118
  36. package/bin/webui/js/panels/behaviour.js +1022 -0
  37. package/mock-run/INDEX.md +109 -107
  38. package/mock-run/gotcha-import.md +118 -0
  39. package/mock-run/habits.md +129 -0
  40. package/mock-run/orc-quick.md +6 -1
  41. package/package.json +1 -1
  42. package/templates/agents/MODEL-MAPPING.md +7 -7
  43. package/templates/agents/orc-advisor-opus-5-xhigh.md +1 -7
  44. package/templates/agents/orc-analyze-mini-opus-5-med.md +1 -6
  45. package/templates/agents/orc-analyze-mini-sonnet-5-high.md +1 -4
  46. package/templates/agents/orc-claude-writer-opus-4-8-high.md +48 -53
  47. package/templates/agents/orc-claude-writer-opus-5-med.md +1 -8
  48. package/templates/agents/orc-context-combiner-opus-5-high.md +1 -11
  49. package/templates/agents/orc-executor-haiku-4-5.md +14 -6
  50. package/templates/agents/orc-executor-opus-4-7-high.md +14 -6
  51. package/templates/agents/orc-executor-opus-4-7-med.md +14 -6
  52. package/templates/agents/orc-executor-opus-4-8-high.md +14 -6
  53. package/templates/agents/orc-executor-opus-5-high.md +14 -6
  54. package/templates/agents/orc-executor-opus-5-low.md +14 -6
  55. package/templates/agents/orc-executor-opus-5-med.md +14 -6
  56. package/templates/agents/orc-executor-sonnet-4-6-high.md +14 -6
  57. package/templates/agents/orc-executor-sonnet-4-6-med.md +14 -6
  58. package/templates/agents/orc-executor-sonnet-5-high.md +14 -6
  59. package/templates/agents/orc-graph-noter-sonnet-4-6-med.md +1 -10
  60. package/templates/agents/orc-judge-opus-5-xhigh.md +5 -9
  61. package/templates/agents/orc-learn-writer-opus-5-low.md +1 -7
  62. package/templates/agents/orc-pattern-codifier-opus-5-med.md +1 -8
  63. package/templates/agents/orc-pattern-codifier-sonnet-5-high.md +58 -63
  64. package/templates/agents/orc-planner-mini-opus-5-med.md +1 -4
  65. package/templates/agents/orc-planner-mini-sonnet-5-high.md +1 -2
  66. package/templates/agents/orc-planner-opus-5-med.md +1 -4
  67. package/templates/agents/orc-recon-opus-5-low.md +1 -8
  68. package/templates/agents/orc-recon-sonnet-4-6-med.md +1 -8
  69. package/templates/agents/orc-retro-opus-5-med.md +6 -8
  70. package/templates/agents/orc-retro-sonnet-5-high.md +6 -7
  71. package/templates/agents/orc-reviewer-opus-5-med.md +52 -16
  72. package/templates/agents/orc-scout-opus-5-low.md +1 -6
  73. package/templates/agents/orc-scout-sonnet-4-6-high.md +35 -39
  74. package/templates/agents/orc-system-analyst-opus-5-high.md +1 -6
  75. package/templates/agents/orc-test-author-opus-5-med.md +4 -5
  76. package/templates/agents/orc-trace-writer-haiku-4-5.md +3 -7
  77. package/templates/agents/orc-verifier-opus-5-med.md +16 -8
  78. package/templates/agents/orc-wiki-scanner-opus-4-8-high.md +74 -79
  79. package/templates/agents/orc-wiki-scanner-opus-5-med.md +1 -8
  80. package/templates/agents/orc-wiki-scanner-sonnet-5-high.md +97 -106
  81. package/templates/commands/orc-analyze.md +13 -21
  82. package/templates/commands/orc-fast.md +10 -15
  83. package/templates/commands/orc-poly.md +12 -21
  84. package/templates/commands/orc-pr-driver.md +11 -30
  85. package/templates/commands/orc-pr-setup.md +10 -31
  86. package/templates/commands/orc-route.md +11 -41
  87. package/templates/commands/orc-test.md +5 -60
  88. package/templates/hooks/README.md +34 -0
  89. package/templates/hooks/orc-session-hook.js +264 -0
  90. package/templates/hooks/orc-statusline.js +3 -1
  91. package/templates/skills/_shared/README.md +9 -0
  92. package/templates/skills/_shared/code-graph.md +47 -55
  93. package/templates/skills/_shared/config-precedence.md +3 -1
  94. package/templates/skills/_shared/extra-dispatch.md +73 -88
  95. package/templates/skills/_shared/gotchas.md +228 -177
  96. package/templates/skills/_shared/habits.md +101 -0
  97. package/templates/skills/_shared/lane-contract.md +84 -0
  98. package/templates/skills/_shared/phases/README.md +142 -83
  99. package/templates/skills/_shared/phases/analyst-gates.md +10 -21
  100. package/templates/skills/_shared/phases/execution.md +8 -14
  101. package/templates/skills/_shared/phases/house-rules.md +27 -32
  102. package/templates/skills/_shared/phases/intake.md +127 -133
  103. package/templates/skills/_shared/phases/mock-example.md +46 -56
  104. package/templates/skills/_shared/phases/plan-handoff.md +91 -97
  105. package/templates/skills/_shared/phases/planning.md +7 -17
  106. package/templates/skills/_shared/phases/preflight.md +19 -42
  107. package/templates/skills/_shared/phases/review.md +23 -27
  108. package/templates/skills/_shared/phases/rules.md +18 -42
  109. package/templates/skills/_shared/phases/scoring.md +55 -65
  110. package/templates/skills/_shared/phases/security-checklist.md +46 -50
  111. package/templates/skills/_shared/phases/security.md +45 -55
  112. package/templates/skills/_shared/phases/ship.md +6 -15
  113. package/templates/skills/_shared/phases/stop-resume.md +2 -5
  114. package/templates/skills/_shared/phases/summary.md +73 -48
  115. package/templates/skills/_shared/phases/testgen.md +41 -51
  116. package/templates/skills/_shared/phases/trace-verbs.md +433 -0
  117. package/templates/skills/_shared/phases/trace.md +136 -367
  118. package/templates/skills/_shared/phases/verify.md +62 -70
  119. package/templates/skills/_shared/phases/wave-grouping.md +128 -133
  120. package/templates/skills/_shared/phases/wiki-consult.md +10 -6
  121. package/templates/skills/_shared/read-ladder.md +2 -55
  122. package/templates/skills/_shared/return-validation.md +17 -70
  123. package/templates/skills/_shared/review-slice.md +79 -0
  124. package/templates/skills/_shared/smoke-gate.md +46 -28
  125. package/templates/skills/context-combiner/SKILL.md +15 -44
  126. package/templates/skills/orc/SKILL.md +34 -62
  127. package/templates/skills/orc/references/pattern-gate.md +89 -89
  128. package/templates/skills/orc/references/phases/intake.md +41 -47
  129. package/templates/skills/orc/references/phases/integration.md +13 -19
  130. package/templates/skills/orc/references/preflight-report.md +8 -9
  131. package/templates/skills/orc/references/ultra-mode.md +8 -6
  132. package/templates/skills/orc/subskills/orc-execution/SKILL.md +27 -73
  133. package/templates/skills/orc/subskills/orc-execution/core.md +12 -99
  134. package/templates/skills/orc/subskills/orc-execution/subagent.md +14 -13
  135. package/templates/skills/orc/subskills/orc-review-verify/SKILL.md +11 -52
  136. package/templates/skills/orc/subskills/orc-review-verify/core.md +52 -135
  137. package/templates/skills/orc/subskills/orc-review-verify/subagent.md +7 -7
  138. package/templates/skills/orc/subskills/orc-testgen/SKILL.md +11 -22
  139. package/templates/skills/orc/subskills/orc-testgen/core.md +20 -59
  140. package/templates/skills/orc/subskills/orc-testgen/subagent.md +7 -7
  141. package/templates/skills/orc-advisor/SKILL.md +56 -60
  142. package/templates/skills/orc-analyze/SKILL.md +30 -66
  143. package/templates/skills/orc-analyze/schemas/report-audit.md +2 -1
  144. package/templates/skills/orc-analyze/schemas/report-prose.md +2 -1
  145. package/templates/skills/orc-analyze-mini/SKILL.md +35 -70
  146. package/templates/skills/orc-diy/README.md +31 -0
  147. package/templates/skills/orc-diy/SKILL.md +23 -74
  148. package/templates/skills/orc-diy/references/blocks/pattern.md +18 -18
  149. package/templates/skills/orc-fast/SKILL.md +44 -72
  150. package/templates/skills/orc-judge/SKILL.md +77 -82
  151. package/templates/skills/orc-mini/SKILL.md +61 -109
  152. package/templates/skills/orc-pattern/SKILL.md +27 -48
  153. package/templates/skills/orc-poly/SKILL.md +32 -61
  154. package/templates/skills/orc-pr-driver/SKILL.md +25 -51
  155. package/templates/skills/orc-pr-driver/references/green-gate.md +113 -105
  156. package/templates/skills/orc-pr-setup/SKILL.md +20 -45
  157. package/templates/skills/orc-quick/README.md +43 -2
  158. package/templates/skills/orc-quick/SKILL.md +76 -107
  159. package/templates/skills/orc-quick/references/dispatch-gate.md +16 -5
  160. package/templates/skills/orc-quick/references/gh-mode.md +48 -1
  161. package/templates/skills/orc-quick/references/look.md +3 -1
  162. package/templates/skills/orc-retro/SKILL.md +19 -18
  163. package/templates/skills/orc-retro/examples/retro-mock.md +1 -1
  164. package/templates/skills/orc-route/SKILL.md +25 -45
  165. package/templates/skills/orc-test/SKILL.md +16 -37
  166. package/templates/skills/orc-verify/SKILL.md +14 -32
  167. package/templates/skills/orc-wait/SKILL.md +156 -163
  168. package/templates/skills/orc-wiki/references/phases/phase-0.md +1 -6
  169. package/templates/skills/orc-wiki/references/phases/phase-1.md +1 -6
  170. package/templates/skills/orc-wiki/references/phases/phase-2.md +1 -6
  171. package/templates/skills/orc-wiki/references/phases/phase-3.md +1 -6
  172. package/templates/skills/orc-wiki/references/phases/phase-3c.md +1 -6
@@ -1,70 +1,62 @@
1
- # Phase — Verify — TDD gate + adversarial review (id: `verify`)
2
-
3
- > **Shared phase file.** Moved out of `orc/SKILL.md` at v1.0.0 W12, and into
4
- > this library at W13 when `orc-diy` became its second reader. A spine is loaded
5
- > IN FULL when its skill activates; this is loaded when the phase fires, and most
6
- > runs skip most phases.
7
- >
8
- > **Two layers, and a lane reads exactly one.** `full` is `/orc`'s procedure.
9
- > `composed` is what `orc diy compile` stitches — the same phase expressed as
10
- > `<!-- diy:when -->` variants over a composed flow, NOT a second copy of the
11
- > procedure. Reading the wrong one is the failure `README.md` names: a lane
12
- > doing a phase its product promise says it does differently.
13
- > `orc lane phases <lane> --json` names the layer for each lane.
14
-
15
- <!-- orc:layer full -->
16
-
17
- ## Verify: TDD gate + adversarial review (same subskill, phase=verify)
18
-
19
- Emit `PHASE verify start`. TWO halves in the SAME dispatched verifier slot
20
- (../../orc/subskills/orc-review-verify/ — Phase 5's reviewer stays separate):
21
- **1) TDD gate (deterministic):** run the plan's TDD suite — green IS the
22
- definition-of-done for non-exempt requirements; red → repair loop (implement→
23
- test→repair, cap `tdd_loop_max`; cap hit → STOP SEQUENCE + honest red report).
24
- **2) Adversarial review:** attack the green implementation — edge cases the
25
- spec missed, error paths, contract violations, race/ordering, workflow breaks
26
- (dead wiring, broken commands) — findings on the existing P0–P3 ladder. The
27
- verifier also checks the intent-spec's
28
- definition-of-done PLUS the pattern's `validation_gate[]` lines (each a
29
- criterion; unmet = P0). The return carries `criteria[]` {criterion, pass|fail,
30
- evidence} — every criterion needs evidence. Quote spot-check P0/P1 first, then:
31
- P0 → auto-fix once → re-verify once → second failure STOPS; P1 → ask before the
32
- one fix attempt, then re-verify (same single-retry cap).
33
- **Pact recheck (`pact_recheck_on_verify`, default true; emit `PACT recheck`):**
34
- after GREEN, run `orc pact check` scoped to the promises whose anchors intersect
35
- this run's CHANGED files. A promise that flips to BROKEN is a **P1 finding with its
36
- check output** — reported, never an automatic abort: the ledger may simply have
37
- outgrown the code, and that is the user's call. Emit
38
- `VERDICT pass|fail :: <detail>`, then `PHASE verify end`.
39
-
40
- <!-- /orc:layer -->
41
-
42
- <!-- orc:layer composed -->
43
-
44
- ## Phase: Verify
45
-
46
- <!-- diy:when verify=off -->
47
- Verification is DISABLED in this flow. The build+test evidence in each
48
- executor return is the only green signal; say "verify skipped by flow
49
- config" in the summary. Never claim criteria were verified.
50
- <!-- /diy:when -->
51
- <!-- diy:when verify=smoke -->
52
- Run a SMOKE verify only: dispatch the verifier
53
- (`orc-verifier-opus-5-med`) with an explicitly narrowed scope — build +
54
- full test suite, red/green verdict, NO per-criterion definition-of-done
55
- sweep. Red blocks ship exactly as a full verify would.
56
- <!-- /diy:when -->
57
- <!-- diy:when verify=full -->
58
- Dispatch verification exactly as the full lane does — follow the verify half
59
- of `.claude/skills/orc/subskills/orc-review-verify/SKILL.md` (build + tests +
60
- every acceptance criterion checked against the definition of done).
61
- <!-- /diy:when -->
62
- <!-- diy:when tdd=on -->
63
- TDD gate (rides the verify slot): the verifier slice carries the plan's
64
- `tdd_suite[]`; green is the definition-of-done for non-exempt requirements,
65
- red → the repair loop capped at `tdd_loop_max` (cap hit → STOP + honest red
66
- report). The adversarial half of the verify pass applies as the full lane
67
- defines it.
68
- <!-- /diy:when -->
69
-
70
- <!-- /orc:layer -->
1
+ # Phase — Verify — TDD gate + adversarial review (id: `verify`)
2
+
3
+ > **Shared phase file** — read when the phase fires. A lane reads ONE layer: `full` (`/orc`) or `composed` (the `<!-- diy:when -->` variants `orc diy compile` stitches). `orc lane phases <lane> --json` names it.
4
+
5
+ <!-- orc:layer full -->
6
+
7
+ ## Verify: TDD gate + adversarial review (same subskill, phase=verify)
8
+
9
+ Emit `PHASE verify start`. TWO halves in the SAME dispatched verifier slot
10
+ (../../orc/subskills/orc-review-verify/ — Phase 5's reviewer stays separate):
11
+ **1) TDD gate (deterministic):** run the plan's TDD suite — green IS the
12
+ definition-of-done for non-exempt requirements; red → the flaky check
13
+ (`../smoke-gate.md` §Flaky: exit 0 = not red, no round), then the repair loop (implement→
14
+ test→repair, cap `tdd_loop_max`; cap hit → STOP SEQUENCE + honest red report).
15
+ **2) Adversarial review:** attack the green implementation — edge cases the
16
+ spec missed, error paths, contract violations, race/ordering, workflow breaks
17
+ (dead wiring, broken commands) — findings on the existing P0–P3 ladder. The
18
+ verifier also checks the intent-spec's
19
+ definition-of-done PLUS the pattern's `validation_gate[]` lines (each a
20
+ criterion; unmet = P0). The return carries `criteria[]` {criterion, pass|fail,
21
+ evidence} — every criterion needs evidence. Quote spot-check P0/P1 first, then:
22
+ P0 → auto-fix once → re-verify once → second failure STOPS; P1 → ask before the
23
+ one fix attempt, then re-verify (same single-retry cap).
24
+ **Pact recheck (`pact_recheck_on_verify`, default true; emit `PACT recheck`):**
25
+ after GREEN, run `orc pact check` scoped to the promises whose anchors intersect
26
+ this run's CHANGED files. A promise that flips to BROKEN is a **P1 finding with its
27
+ check output** — reported, never an automatic abort: the ledger may simply have
28
+ outgrown the code, and that is the user's call. Emit
29
+ `VERDICT pass|fail :: <detail>`, then `PHASE verify end`.
30
+
31
+ <!-- /orc:layer -->
32
+
33
+ <!-- orc:layer composed -->
34
+
35
+ ## Phase: Verify
36
+
37
+ <!-- diy:when verify=off -->
38
+ Verification is DISABLED in this flow. The build+test evidence in each
39
+ executor return is the only green signal; say "verify skipped by flow
40
+ config" in the summary. Never claim criteria were verified.
41
+ <!-- /diy:when -->
42
+ <!-- diy:when verify=smoke -->
43
+ Run a SMOKE verify only: dispatch the verifier
44
+ (`orc-verifier-opus-5-med`) with an explicitly narrowed scope — build +
45
+ full test suite, red/green verdict, NO per-criterion definition-of-done
46
+ sweep. Red blocks ship exactly as a full verify would.
47
+ <!-- /diy:when -->
48
+ <!-- diy:when verify=full -->
49
+ Dispatch verification exactly as the full lane does — follow the verify half
50
+ of `.claude/skills/orc/subskills/orc-review-verify/SKILL.md` (build + tests +
51
+ every acceptance criterion checked against the definition of done).
52
+ <!-- /diy:when -->
53
+ <!-- diy:when tdd=on -->
54
+ TDD gate (rides the verify slot): the verifier slice carries the plan's
55
+ `tdd_suite[]`; green is the definition-of-done for non-exempt requirements,
56
+ red → the flaky check
57
+ (`.claude/skills/_shared/smoke-gate.md` §Flaky), then the repair loop capped at `tdd_loop_max` (cap hit → STOP + honest red
58
+ report). The adversarial half of the verify pass applies as the full lane
59
+ defines it.
60
+ <!-- /diy:when -->
61
+
62
+ <!-- /orc:layer -->
@@ -1,133 +1,128 @@
1
- # Phase — Wave grouping (id: `wave-grouping`)
2
-
3
- > **Library file.** Canonical since v1.0.0 W12; it was under the `orc` skill's
4
- > private `references/`, and another lane already reached across into it. Read
5
- > by `orc`, `orc-diy`. Layers declared: `core` only — single-layer because the
6
- > conflict graph is arithmetic, and a lane that groups waves at all groups
7
- > them this way. `orc lane phases <lane> --json` names the file and the layers
8
- > to read.
9
-
10
- <!-- orc:layer core -->
11
- ## Reference — Wave Grouping & Conflict Graph
12
-
13
- Turn the tagged task list into conflict-free waves. Load during Phase 3.
14
-
15
- ## Waves are computed for EVERY run — dispatch style is intra-wave only
16
-
17
- Wave computation is NOT a parallel-mode concern. It runs for **every run with ≥2
18
- tasks, sequential included** (dependency layers + conflict graph +
19
- `max_wave_tasks` cap). **Dispatch style controls only INTRA-WAVE concurrency:**
20
-
21
- - **parallel** → a wave's non-conflicting tasks dispatch at once (up to
22
- `max_wave_tasks`);
23
- - **sequential** → the SAME waves, but a wave's tasks dispatch one at a time, in
24
- order; the wave still closes only when all its tasks close.
25
-
26
- Either way the **wave-boundary gate fires identically** (the deterministic batch
27
- pause below binds to wave numbers, not to a dispatch style). A sequential run
28
- therefore never degenerates to "no waves / per-task pauses" — a 5-task plan
29
- becomes e.g. `[T1] [T2 T3 T4] [T5]`, not five ad-hoc stops. **Show the wave plan
30
- (wave → tasks → pause marks) to the user BEFORE wave 1 in BOTH styles.**
31
-
32
- ## The principle
33
-
34
- Two tasks may share a wave ONLY if their `declared_files` don't overlap AND
35
- neither depends on the other. Conflicts are designed out by scheduling — never
36
- negotiated at runtime.
37
-
38
- ## Algorithm
39
-
40
- 1. **Dependency edges:** a task's earliest wave = max(wave of its deps) + 1.
41
- 2. **Conflict edges:** for every pair, mark conflict if `declared_files` globs
42
- intersect (expand against the repo tree; unresolvable globs conflict on
43
- their literal prefix).
44
- 3. **Assign greedily in topological order:** place each task in the earliest
45
- wave where (a) all deps are earlier and (b) nothing in that wave conflicts.
46
- Otherwise open a new wave.
47
- 4. **Cap concurrency at `config.max_wave_tasks`** (default 3): a wave NEVER
48
- exceeds this many tasks, even if more are conflict-free. Overflow moves to the
49
- next wave. This is the efficiency cap — 3 parallel subagents by default.
50
- 5. **Mark batch pauses:** compute the pause schedule from the user's Phase 2
51
- answer — mark `is_batch_pause: true` on wave W when `W % N == 0` AND a later
52
- wave exists (`W < total_waves`); the last wave is NEVER a pause (nothing
53
- remains to gate). The resulting wave indices are the `pause_schedule` stored
54
- in the checkpoint. A pause so marked is a HARD gate (stop-resume.md), not
55
- an orchestrator judgment call.
56
-
57
- ## Same-feature collision
58
-
59
- If two tasks own the same feature/files with no dependency between them, the
60
- graph auto-serializes them — but that's a planning smell. Surface it: suggest
61
- merging them into one task rather than silently serializing duplicate work.
62
-
63
- ## TDD tasks are ORDINARY tasks (v0.41.0)
64
-
65
- TDD red proofs are **planner-emitted tasks**, not an orchestrator-synthesized
66
- Wave 0. Each one materializes the `tdd_spec` entries of the implementation task
67
- it guards, and that task lists it in `depends_on`. Nothing here special-cases
68
- them:
69
-
70
- - they enter the same conflict graph via their `declared_files` (their test
71
- files), so **independent TDD tasks share a wave and run in parallel** — the
72
- red proofs for two unrelated features are one wave, not two;
73
- - `depends_on` guarantees **a red proof is always in an earlier wave than the
74
- code it proves** — a proof can never land beside its implementation;
75
- - they are scored from **their own planner-emitted `facets`**, like any task, so
76
- no derived-vector rule is needed;
77
- - `max_wave_tasks`, `is_batch_pause` and `pause_schedule` bind to them unchanged.
78
-
79
- **A TDD task does NOT inherit the risk floor** of the task it guards: it
80
- transcribes planner-authored skeletons, writes no production code, and its output
81
- is asserted RED before anything is believed. The planner reflects that in the
82
- task's own facets (`novelty: mechanical`, `logic: none`, `risk: []`). Stated here
83
- so it is not re-litigated per run — the alternative is a Haiku-sized
84
- transcription job dispatched at floor 70 because the requirement it proves is
85
- auth-flavoured.
86
-
87
- **If no task carries `new-surface` or `behavior-change` entries, no TDD task
88
- exists and no extra wave is created.**
89
-
90
- ## Orchestrator-synthesized tasks (the mock example, any future one)
91
-
92
- Some dispatched tasks appear in no `tasks[]` because the ORCHESTRATOR synthesized
93
- them — the mock example (`_shared/drift-recovery.md`). They still obey hard rule
94
- 1: **dispatched like any other task, never done by you.** But they have no
95
- planner-emitted `facets`, and the orchestrator is by definition the party that
96
- did NOT read the code — inventing a vector for them is judgment wearing
97
- arithmetic's clothes, the exact thing the facet redesign removed.
98
-
99
- So their vector is **DERIVED, never judged**:
100
-
101
- | Facet | Value |
102
- |---|---|
103
- | `breadth` | `len(files the synthesized task will touch)` |
104
- | `novelty` | `mechanical` — it transcribes planner-authored material |
105
- | `logic` | `none` |
106
- | `test_surface` | per the task |
107
- | `risk` | `[]` — unless the synthesized task itself inherits a CITED risk |
108
-
109
- ## Post-wave worktree audit (a GATE, not a report)
110
-
111
- Declarations can be wrong, and a return can be honest and still miss what
112
- happened. Capture `git status --short` BEFORE the wave dispatches and again
113
- after every task returns, then diff the two:
114
- - **Any path whose state changed and is in NO task's `declared_files`** → name
115
- the path and the likely task, and get an explicit user decision BEFORE the
116
- wave closes. A wave never closes over an unexplained worktree delta.
117
- - **A file that became LESS modified is as much a violation as one that became
118
- more modified.** That is the revert signature — an executor made an
119
- unsatisfiable assertion true by `git checkout`-ing another task's completed
120
- work, returned a literally-true report, and left a CLEAN tree. Nothing that
121
- reads returns can see it.
122
- - **Stray files count** — a path that appears at the repo root (a stdout dump, a
123
- mangled-path artifact) is undeclared output, not noise to ignore.
124
- - Two agents in one wave touched the same undeclared file → record
125
- `failure_reason: "file-collision:<file> with <agent>"`, set the
126
- later-finishing task to `requeued`, re-dispatch in a later wave so it sees
127
- the other's committed changes.
128
- - Declarations are the plan, `actual_files` is the ATTESTATION, and
129
- `git status` is the AUDIT — same instruction → contract → attestation →
130
- spot-check pattern the plan applies to `grounding[]`.
131
- - Canonical cross-lane wording: `_shared/return-validation.md` §6.
132
-
133
- <!-- /orc:layer -->
1
+ # Phase — Wave grouping (id: `wave-grouping`)
2
+
3
+ > **Library file** (`orc`, `orc-diy`), `core` only: the conflict graph is arithmetic, and every lane that groups waves groups them this way.
4
+
5
+ <!-- orc:layer core -->
6
+ ## Reference — Wave Grouping & Conflict Graph
7
+
8
+ Turn the tagged task list into conflict-free waves. Load during Phase 3.
9
+
10
+ ## Waves are computed for EVERY run — dispatch style is intra-wave only
11
+
12
+ Wave computation is NOT a parallel-mode concern. It runs for **every run with ≥2
13
+ tasks, sequential included** (dependency layers + conflict graph +
14
+ `max_wave_tasks` cap). **Dispatch style controls only INTRA-WAVE concurrency:**
15
+
16
+ - **parallel** → a wave's non-conflicting tasks dispatch at once (up to
17
+ `max_wave_tasks`);
18
+ - **sequential** → the SAME waves, but a wave's tasks dispatch one at a time, in
19
+ order; the wave still closes only when all its tasks close.
20
+
21
+ Either way the **wave-boundary gate fires identically** (the deterministic batch
22
+ pause below binds to wave numbers, not to a dispatch style). A sequential run
23
+ therefore never degenerates to "no waves / per-task pauses" — a 5-task plan
24
+ becomes e.g. `[T1] [T2 T3 T4] [T5]`, not five ad-hoc stops. **Show the wave plan
25
+ (wave → tasks → pause marks) to the user BEFORE wave 1 in BOTH styles.**
26
+
27
+ ## The principle
28
+
29
+ Two tasks may share a wave ONLY if their `declared_files` don't overlap AND
30
+ neither depends on the other. Conflicts are designed out by scheduling — never
31
+ negotiated at runtime.
32
+
33
+ ## Algorithm
34
+
35
+ 1. **Dependency edges:** a task's earliest wave = max(wave of its deps) + 1.
36
+ 2. **Conflict edges:** for every pair, mark conflict if `declared_files` globs
37
+ intersect (expand against the repo tree; unresolvable globs conflict on
38
+ their literal prefix).
39
+ 3. **Assign greedily in topological order:** place each task in the earliest
40
+ wave where (a) all deps are earlier and (b) nothing in that wave conflicts.
41
+ Otherwise open a new wave.
42
+ 4. **Cap concurrency at `config.max_wave_tasks`** (default 3): a wave NEVER
43
+ exceeds this many tasks, even if more are conflict-free. Overflow moves to the
44
+ next wave. This is the efficiency cap — 3 parallel subagents by default.
45
+ 5. **Mark batch pauses:** compute the pause schedule from the user's Phase 2
46
+ answer — mark `is_batch_pause: true` on wave W when `W % N == 0` AND a later
47
+ wave exists (`W < total_waves`); the last wave is NEVER a pause (nothing
48
+ remains to gate). The resulting wave indices are the `pause_schedule` stored
49
+ in the checkpoint. A pause so marked is a HARD gate (stop-resume.md), not
50
+ an orchestrator judgment call.
51
+
52
+ ## Same-feature collision
53
+
54
+ If two tasks own the same feature/files with no dependency between them, the
55
+ graph auto-serializes them — but that's a planning smell. Surface it: suggest
56
+ merging them into one task rather than silently serializing duplicate work.
57
+
58
+ ## TDD tasks are ORDINARY tasks (v0.41.0)
59
+
60
+ TDD red proofs are **planner-emitted tasks**, not an orchestrator-synthesized
61
+ Wave 0. Each one materializes the `tdd_spec` entries of the implementation task
62
+ it guards, and that task lists it in `depends_on`. Nothing here special-cases
63
+ them:
64
+
65
+ - they enter the same conflict graph via their `declared_files` (their test
66
+ files), so **independent TDD tasks share a wave and run in parallel** — the
67
+ red proofs for two unrelated features are one wave, not two;
68
+ - `depends_on` guarantees **a red proof is always in an earlier wave than the
69
+ code it proves** — a proof can never land beside its implementation;
70
+ - they are scored from **their own planner-emitted `facets`**, like any task, so
71
+ no derived-vector rule is needed;
72
+ - `max_wave_tasks`, `is_batch_pause` and `pause_schedule` bind to them unchanged.
73
+
74
+ **A TDD task does NOT inherit the risk floor** of the task it guards: it
75
+ transcribes planner-authored skeletons, writes no production code, and its output
76
+ is asserted RED before anything is believed. The planner reflects that in the
77
+ task's own facets (`novelty: mechanical`, `logic: none`, `risk: []`). Stated here
78
+ so it is not re-litigated per run — the alternative is a Haiku-sized
79
+ transcription job dispatched at floor 70 because the requirement it proves is
80
+ auth-flavoured.
81
+
82
+ **If no task carries `new-surface` or `behavior-change` entries, no TDD task
83
+ exists and no extra wave is created.**
84
+
85
+ ## Orchestrator-synthesized tasks (the mock example, any future one)
86
+
87
+ Some dispatched tasks appear in no `tasks[]` because the ORCHESTRATOR synthesized
88
+ them — the mock example (`_shared/drift-recovery.md`). They still obey hard rule
89
+ 1: **dispatched like any other task, never done by you.** But they have no
90
+ planner-emitted `facets`, and the orchestrator is by definition the party that
91
+ did NOT read the code — inventing a vector for them is judgment wearing
92
+ arithmetic's clothes, the exact thing the facet redesign removed.
93
+
94
+ So their vector is **DERIVED, never judged**:
95
+
96
+ | Facet | Value |
97
+ |---|---|
98
+ | `breadth` | `len(files the synthesized task will touch)` |
99
+ | `novelty` | `mechanical` — it transcribes planner-authored material |
100
+ | `logic` | `none` |
101
+ | `test_surface` | per the task |
102
+ | `risk` | `[]` — unless the synthesized task itself inherits a CITED risk |
103
+
104
+ ## Post-wave worktree audit (a GATE, not a report)
105
+
106
+ Declarations can be wrong, and a return can be honest and still miss what
107
+ happened. Capture `git status --short` BEFORE the wave dispatches and again
108
+ after every task returns, then diff the two:
109
+ - **Any path whose state changed and is in NO task's `declared_files`** → name
110
+ the path and the likely task, and get an explicit user decision BEFORE the
111
+ wave closes. A wave never closes over an unexplained worktree delta.
112
+ - **A file that became LESS modified is as much a violation as one that became
113
+ more modified.** That is the revert signature — an executor made an
114
+ unsatisfiable assertion true by `git checkout`-ing another task's completed
115
+ work, returned a literally-true report, and left a CLEAN tree. Nothing that
116
+ reads returns can see it.
117
+ - **Stray files count** — a path that appears at the repo root (a stdout dump, a
118
+ mangled-path artifact) is undeclared output, not noise to ignore.
119
+ - Two agents in one wave touched the same undeclared file → record
120
+ `failure_reason: "file-collision:<file> with <agent>"`, set the
121
+ later-finishing task to `requeued`, re-dispatch in a later wave so it sees
122
+ the other's committed changes.
123
+ - Declarations are the plan, `actual_files` is the ATTESTATION, and
124
+ `git status` is the AUDIT — same instruction → contract → attestation →
125
+ spot-check pattern the plan applies to `grounding[]`.
126
+ - Canonical cross-lane wording: `_shared/return-validation.md` §6.
127
+
128
+ <!-- /orc:layer -->
@@ -1,11 +1,6 @@
1
1
  # Phase — Wiki consult (id: `wiki-consult`)
2
2
 
3
- > **Library file.** Canonical since v1.0.0 W12; it was under the `orc` skill's
4
- > private `references/`, and other lanes already reached across into it. Read
5
- > by `orc`, `orc-mini`, `orc-fast`, `orc-wiki`. Layers declared: `core` only —
6
- > single-layer because the precedence ladder (`code > fresh wiki > stale wiki
7
- > > model priors`) does not bend for a faster lane. `orc lane phases <lane>
8
- > --json` names the file and the layers to read.
3
+ > **Library file** (`orc`, `orc-mini`, `orc-fast`, `orc-wiki`), `core` only: the ladder `code > fresh wiki > stale wiki > model priors` does not bend for a faster lane.
9
4
 
10
5
  <!-- orc:layer core -->
11
6
  ## Reference — Wiki Consult (shared by orc / orc-mini / orc-fast)
@@ -148,6 +143,15 @@ actually read, or `none`. `none` on a slice that carried docs is a REAL signal
148
143
  It is the only thing that distinguishes a wiki that is working from one that is
149
144
  merely being shipped.
150
145
 
146
+ **orc-mini only** (moved here from its spine at v2.0.0):
147
+
148
+ **`none` is an answer — record it, never drop it.** `wiki_used: none` and
149
+ `graph_used: none` from ANY return go into the checkpoint and the ship line
150
+ (`knowledge: wiki 2 pages offered · used none · graph card 2 targets · used
151
+ none`). Two runs in a row with `wiki_used: none` on FRESH pages → one line:
152
+ `wiki: the selected pages were not used in 2 runs — check their TL;DRs
153
+ (/orc-wiki)`. A signal, never a gate, never dropped for looking null.
154
+
151
155
  ## Scoring bonus (full lane, Phase 2)
152
156
 
153
157
  If a non-empty `wiki/` is present, use its overviews' "Notes for planning" to
@@ -5,14 +5,6 @@ about to edit: scouts, wiki scan-tasks, the analyst, the reviewer, and every
5
5
  executor reading a file for context rather than for change. Load this wherever
6
6
  a slice tells an agent to go read something.
7
7
 
8
- ## Why this exists
9
-
10
- ORC's cost is dominated by parallel reading, not by thinking: up to `max_scouts`
11
- scouts at once, a wiki scan that is expensive by design, and every executor in a
12
- wave opening its declared files. A role that opens a 900-line file to learn one
13
- function's shape has spent the run's budget on bytes nobody needed. Reading more
14
- is not understanding more.
15
-
16
8
  ## The ladder
17
9
 
18
10
  Escalate one step at a time. Stop at the step that answers the question.
@@ -88,50 +80,6 @@ is a `needs_context` return, not permission to keep going.
88
80
  lint results — the smoke gate, the TDD gate, the verifier and orc-quick's
89
81
  build loop decide red vs green from those exact bytes. Read them whole.
90
82
 
91
- ## Reading ORC's own payload — the partial-read discipline (v1.0.0 W10)
92
-
93
- Everything above is about reading the PROJECT. It applies unchanged to reading
94
- ORC's own files, and it has to: a lane manifest of pointers that every lane
95
- dutifully reads whole is MORE round-trips than the prose it replaced, for the
96
- same bytes. Centralizing prose and then reading all of it is a slower payload,
97
- not a smaller one.
98
-
99
- So every pointer a lane carries declares three things.
100
-
101
- | Declaration | Values | Means |
102
- |---|---|---|
103
- | `when` | `always` · `on-phase` · `on-state` · `on-demand` · `compile-time` | WHETHER to open it at all |
104
- | `read` | `layer` · `section` · `whole` | HOW MUCH to open |
105
- | `layers` | `core` · `full` · `trim` · `composed` | WHICH part, when `read: layer` |
106
-
107
- ### The four rules that make it honest
108
-
109
- 1. **`on-phase` is the default, and `always` must be justified.** A file every
110
- lane always loads has saved nothing by moving. Each `always` pointer is
111
- named in the wave that adds it.
112
- 2. **`read: section` names a HEADING, never a line number.** A stored line
113
- number is a wrong line number one edit later; a heading anchor survives an
114
- edit above it. This is why a shared file's headings are part of its
115
- contract — renaming one breaks every pointer into it.
116
- 3. **A trimmed lane reads `core` plus its OWN layer, and never the `full`
117
- layer.** Reading a neighbouring layer "for context" is the bleed this rule
118
- exists to stop: the layer boundary is the product promise, not a suggestion.
119
- 4. **The two exceptions above carry over unchanged.** A file you will EDIT is
120
- read in full, first, always; and output a gate parses is read whole.
121
- 5. **`compile-time` is not a run-time read at all.** `orc-diy` is a declared
122
- reader of ten shared phases and opens none of them during a run: the `orc
123
- diy compile` CLI reads their `composed` layer once and stitches it into
124
- `FLOW-COMPILED.md`, which is the only spine that run then follows. Saying
125
- `on-phase` there would describe a read that never happens, and a manifest
126
- that describes a run nobody performs is the drift it exists to prevent
127
- (v1.0.0 W13).
128
-
129
- ### The honest limit
130
-
131
- A partial read saves round-trips and bytes for the lanes that SKIP a phase. It
132
- does **not** make a phase cheaper for the lane that runs it — that lane reads
133
- its layers whole. Any claim otherwise has to show the measurement.
134
-
135
83
  ## Handoff
136
84
 
137
85
  The ladder governs HOW MUCH to read. It never decides WHETHER knowledge exists —
@@ -140,6 +88,5 @@ that is `detecting-artifacts.md` — and it never overrides precedence:
140
88
  the same order gains two rungs and loses none:
141
89
  `code > graph structure (current blob) > fresh wiki > stale wiki (hints) > graph notes and doc notes > model priors`.
142
90
 
143
- What a lane INVOKES, and what each exit code means, is not here either: that is
144
- `orc lane calls <lane> --json`, whose catalogue is the one copy of every call
145
- two or more lanes share.
91
+ An orchestrator reading ORC's OWN payload follows the partial-read rules in
92
+ `phases/README.md` (§Pointer discipline).