@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,147 +1,168 @@
1
- # Phase — Execution (id: `execution`)
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
- ## Execution (load wave-grouping.md + log-protocol.md)
18
-
19
- Emit `PHASE execution start`. Build the conflict graph from `declared_files` →
20
- group waves (cap `max_wave_tasks`, mark `is_batch_pause` from `pause_schedule`;
21
- waves are computed for BOTH dispatch styles — sequential fires a wave's tasks
22
- one at a time, parallel fires them together) → SHOW the wave plan (wave → tasks →
23
- pause marks) to the user BEFORE wave 1 → write checkpoint + state-of-play BEFORE
24
- dispatching. **Boundary gate, per wave (`boundary_gate`; emit `BOUNDARY`):**
25
- `warn` prints each task's verdict; `block` additionally LIFTS a REFUSE task out of
26
- the wave — **the wave still runs the rest** — and hands it back with its checklist
27
- plus the "not blocked for you" line (it gates ORC's dispatch, never an explicit
28
- instruction). ESCALATE dispatches but gates ship on the named human, riding the
29
- EXISTING pause machinery. An uncarded area is `unknown`, never REFUSE. **Pattern-resolve gate
30
- (once, before the first wave):** resolve each tagged language per
31
- `../../orc/references/pattern-gate.md` and report ONE user line per language (cache hit →
32
- apply cached; miss → codify/agnostic per `pattern_findings`; learn → dispatch
33
- the codifier); hold resolved patterns in run state.
34
-
35
- **TDD red proof — PAIRED TASKS, not a Wave 0 (v0.41.0):** TDD tasks are ORDINARY planner-emitted tasks the impl task `depends_on`, so they wave and score like any other (mechanics in `wave-grouping.md`); no `new-surface`/`behavior-change` entries → no TDD task at all. Each materializes its skeletons into real FAILING tests and returns the red evidence; emit `TDD-RED task=<id> iter=0` per requirement.
36
- **Pre-implementation green is read per `disposition`:** a `new-surface` entry that PASSES is a spec bug → block that requirement's dispatch and surface it; a `behavior-change` regression-guard passing is EXPECTED and blocks nothing; anything else → adjudicate with the user, recorded in `decisions`. Then per implementation wave:
37
- 1. Dispatch EVERY task as a spawned subagent (emit `DISPATCH <agent> :: <task>
38
- expect=<model>/<effort>` BEFORE the Task call; subagent wrapper framing + the
39
- task's INPUT SLICE per orc-execution/core.md + its scored model). Every
40
- slice carries the task's `acceptance[]`, its `tdd_spec` tests (the executor
41
- implements to green: implement→test→repair, cap `tdd_loop_max`, emitting
42
- `TDD-RED`/`TDD-GREEN` per iteration; cap hit → STOP SEQUENCE + honest red
43
- report) and the `house_rules` card lines
44
- (`house-rules.md`, injected LITERALLY — read once per run, never
45
- a pointer) with the `rules_card` directly under it — the `text` of
46
- `orc rules slice --lane <lane> --json`, VERBATIM, `--pack ui` added for a
47
- front-end task (`rules.md`; the preflight `line` alone is NOT the card); FE/BE and `db:postgres` tasks get the resolved `pattern`
48
- injected literally (pattern-gate.md), and — with `gotchas: on` — the
49
- SCOPE-MATCHING gotchas beside it (glob vs this task's `declared_files`, cap 3,
50
- highest `hits` first; zero matches = NO block, never an empty one — NEVER
51
- inject unfiltered: `_shared/gotchas.md` §7).
52
- **A FOREIGN task uses Bash, not the Task tool:** write the IDENTICAL slice to a
53
- file and run `orc extra dispatch --task <file> --json` (exit codes + the
54
- fallback procedure: `../extra-dispatch.md`). Append `via=extra:<profile>`
55
- to the `DISPATCH` line and copy the return's `trace_line` + every
56
- `trace_extras[]` entry VERBATIM into the packet — the CLI composes them, and the
57
- hook emits NO `SPAWN`/`RETURN` for a foreign worker, so they are the whole record.
58
- 2. Record worker milestone pings (they bound what a mid-wave stop can save).
59
- 3. Collect returns; VALIDATE each (emit `VERIFY <task> actual=<model>/<effort>`
60
- ✅ MATCH / ⛔ DOWNGRADE per return — surface any downgrade to the user).
61
- **A FOREIGN return runs `_shared/return-validation.md` §2b INSTEAD of §2** — it
62
- has no injected model-id line, so it cannot carry `actual_model` and faking one
63
- claims evidence that does not exist; ⛔ SUBSTITUTION replaces the downgrade
64
- check. A failure runs the fallback procedure, which BEGINS with a free
65
- `orc extra reconcile <task>` — a worktree that moved is RESUMED, never re-done
66
- — then re-dispatches or STOPs, announced, with the `EXTRA fallback` line.
67
- `needs_context` → adjudicate → re-slice
68
- (cap 2 per task, then escalate). A `pattern` task must return
69
- `invariants_checked: true` + the matching `pattern_version`. **Evidence
70
- check:** `status=done` on a stack with a runnable build/test REQUIRES
71
- `evidence` {command, exit_code, tail} — a missing block or false
72
- `no_runner_detected` is malformed (requeue); `done` with non-empty
73
- `unmet[]` is `partial`.
74
- 4. **Post-wave worktree audit (GATE, `_shared/return-validation.md` §6):** diff `git status --short` before/after the wave — a changed path in NO task's `declared_files`, INCLUDING one that became less modified (the revert signature), blocks the close until named and decided.
75
- Overlap → `failure_reason: "file-collision:<file> with <agent>"`, requeue later wave.
76
- 5. Append worker `log_entries` to the decision log; regenerate the digest.
77
- **Gotcha capture (`gotchas: on`):** a return that CLOSED a repair loop carries
78
- `gotcha_recorded` (`_shared/return-validation.md` §7) — dedupe on
79
- `symptom`+`scope` (a match bumps `hits`/`last_seen` and appends nothing), else
80
- append the block to `.claude/orc/gotchas.md`. YOU write it, never a subagent;
81
- a capped-and-stopped loop records NOTHING.
82
- 6. Update checkpoint + state-of-play; emit `OUTCOME task=<id> score=<n>
83
- band=<range> model=<m> retries=<n> requeues=<n> needs_context=<n> unmet=<n>`
84
- as each task closes.
85
- 7. **Wave-boundary gate (deterministic — NOT judgment):** after wave W, if the
86
- wave's `is_batch_pause` is true (W in `pause_schedule`) AND a later wave
87
- remains, emit `GATE wave-boundary :: wave=W of K → STOP (batch_pause_every=N)`
88
- and run the MANDATORY STOP SEQUENCE — never dispatch wave W+1 past an
89
- unacknowledged boundary. Token pressure → same STOP SEQUENCE (judgment).
90
- Last wave closes → emit `PHASE execution end`. (stop-resume.md)
91
-
92
- **User escalations:** relay question → broadcast answer to log; an answer that
93
- invalidates a DONE task → re-run once, then set every reverse-`depends_on`
94
- consumer to `stale_review`. **Worker failure/garbage/timeout:** flag +
95
- continue the wave; audit and re-dispatch at the next batch checkpoint
96
-
97
- **Before any re-dispatch, run `orc run inflight`** (0 clear · 1 in-flight · 2 unknown). A Task error does not kill the agent behind it, and exit 2 REFUSES by default — `a lane that re-dispatches over a live attempt` has broken the contract. Canonical: `../return-validation.md`.
98
- (`requeued`, retry_count++). Hard retry cap 2 → STOP and surface.
99
-
100
- <!-- /orc:layer -->
101
-
102
- <!-- orc:layer composed -->
103
-
104
- ## Phase: Execution (waves)
105
-
106
- Run execution exactly as the full lane's execution subskill defines it —
107
- follow `.claude/skills/orc/subskills/orc-execution/SKILL.md` (slices
108
- constructed by you, standing rules injected, evidence-bearing returns
109
- validated against the contract) with these compiled overrides:
110
-
111
- - Max parallel tasks per wave: **{{max_wave_tasks}}** (hard cap; overflow →
112
- next wave; wave grouping per
113
- `.claude/skills/_shared/phases/wave-grouping.md`).
114
- - Stop-and-continue pause every **{{batch_pause_every}}** waves (checkpoint
115
- confirmed BEFORE announcing any stop; resume per
116
- `.claude/skills/_shared/phases/stop-resume.md`).
117
- - Executor selection comes from this flow's scoring section above — never
118
- from the shipped presets.
119
-
120
- <!-- diy:when tdd=on -->
121
- TDD execution: `tdd_spec` is SCOPED by each entry's `disposition` — only
122
- `new-surface` and `behavior-change` get tests; `covered-by-existing` (cited
123
- existing test) and `no-behavior` (constants, translation strings, docs, config)
124
- get none, and a task with cited `risk[]` is never scoped out. A PAIRED TDD task
125
- (never a Wave 0) materializes the remaining skeletons into real
126
- FAILING tests (red proven before implementation; a `new-surface` pre-implementation
127
- pass is a spec bug → block that requirement). Each implementation slice carries its
128
- `tdd_spec`; executors implement to green (implement→test→repair, cap
129
- `tdd_loop_max`; `TDD-RED`/`TDD-GREEN` per iteration) and return `tdd_state`
130
- per `.claude/skills/_shared/return-validation.md` — including §6's worktree
131
- delta: `git status --short` before/after each dispatch, any changed path
132
- outside `declared_files` (a revert included) gates the wave close.
133
- <!-- /diy:when -->
134
-
135
- <!-- diy:when gotchas=on -->
136
- Repair memory: probe `orc gotcha status` once at preflight (exit 0 = entries,
137
- 1 = none — never a `find`) and print one line either way. Inject the
138
- SCOPE-MATCHING entries into each slice beside `pattern` — glob vs that task's
139
- `declared_files`, cap 3, highest `hits` first; zero matches = NO block, never an
140
- empty one, and NEVER unfiltered. A return that CLOSED a repair loop carries
141
- `gotcha_recorded`; dedupe it on `symptom`+`scope` (a match bumps `hits` and
142
- `last_seen`) and append it to `.claude/orc/gotchas.md` YOURSELF — a subagent never
143
- writes that file, and a loop that hit its cap and stopped records nothing. Full
144
- contract: `.claude/skills/_shared/gotchas.md`.
145
- <!-- /diy:when -->
146
-
147
- <!-- /orc:layer -->
1
+ # Phase — Execution (id: `execution`)
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
+ ## Execution (load wave-grouping.md + log-protocol.md)
18
+
19
+ Emit `PHASE execution start`. Build the conflict graph from `declared_files` →
20
+ group waves (cap `max_wave_tasks`, mark `is_batch_pause` from `pause_schedule`;
21
+ waves are computed for BOTH dispatch styles — sequential fires a wave's tasks
22
+ one at a time, parallel fires them together) → SHOW the wave plan (wave → tasks →
23
+ pause marks) to the user BEFORE wave 1 → write checkpoint + state-of-play BEFORE
24
+ dispatching. **Boundary gate, per wave (`boundary_gate`; emit `BOUNDARY`):**
25
+ `warn` prints each task's verdict; `block` additionally LIFTS a REFUSE task out of
26
+ the wave — **the wave still runs the rest** — and hands it back with its checklist
27
+ plus the "not blocked for you" line (it gates ORC's dispatch, never an explicit
28
+ instruction). ESCALATE dispatches but gates ship on the named human, riding the
29
+ EXISTING pause machinery. An uncarded area is `unknown`, never REFUSE. **Pattern-resolve gate
30
+ (once, before the first wave):** resolve each tagged language per
31
+ `../../orc/references/pattern-gate.md` and report ONE user line per language (cache hit →
32
+ apply cached; miss → codify/agnostic per `pattern_findings`; learn → dispatch
33
+ the codifier); hold resolved patterns in run state.
34
+
35
+ **TDD red proof — PAIRED TASKS, not a Wave 0 (v0.41.0):** TDD tasks are ORDINARY planner-emitted tasks the impl task `depends_on`, so they wave and score like any other (mechanics in `wave-grouping.md`); no `new-surface`/`behavior-change` entries → no TDD task at all. Each materializes its skeletons into real FAILING tests and returns the red evidence; emit `TDD-RED task=<id> iter=0` per requirement.
36
+ **Pre-implementation green is read per `disposition`:** a `new-surface` entry that PASSES is a spec bug → block that requirement's dispatch and surface it; a `behavior-change` regression-guard passing is EXPECTED and blocks nothing; anything else → adjudicate with the user, recorded in `decisions`. Then per implementation wave:
37
+ 1. Dispatch EVERY task as a spawned subagent (emit `DISPATCH <agent> :: <task>
38
+ expect=<model>/<effort>` BEFORE the Task call; subagent wrapper framing + the
39
+ task's INPUT SLICE per orc-execution/core.md + its scored model). Every
40
+ slice carries ONE `orc graph ctx --for-slice <the task's declared_files> --if-enabled --json`
41
+ `card` as its `graph` block (`../code-graph.md` §7; exit 3 = off → no block) —
42
+ the OUTSIDE view only, because the executor reads each declared file in full
43
+ itself,
44
+ the task's `acceptance[]`, its `tdd_spec` tests (the executor
45
+ implements to green: implement→test→repair, cap `tdd_loop_max`, emitting
46
+ `TDD-RED`/`TDD-GREEN` per iteration; cap hit → STOP SEQUENCE + honest red
47
+ report) and the `house_rules` card lines
48
+ (`house-rules.md`, injected LITERALLY — read once per run, never
49
+ a pointer) with the `rules_card` directly under it — the `text` of
50
+ `orc rules slice --lane <lane> --json`, VERBATIM, `--pack ui` added for a
51
+ front-end task (`rules.md`; the preflight `line` alone is NOT the card); FE/BE and `db:postgres` tasks get the resolved `pattern`
52
+ injected literally (pattern-gate.md), and — with `gotchas: on` — the
53
+ SCOPE-MATCHING gotchas beside it (glob vs this task's `declared_files`, cap 3,
54
+ highest `hits` first; zero matches = NO block, never an empty one — NEVER
55
+ inject unfiltered: `_shared/gotchas.md` §7).
56
+ **A FOREIGN task uses Bash, not the Task tool:** write the IDENTICAL slice to a
57
+ file and run `orc extra dispatch --task <file> --json` (exit codes + the
58
+ fallback procedure: `../extra-dispatch.md`). Append `via=extra:<profile>`
59
+ to the `DISPATCH` line and copy the return's `trace_line` + every
60
+ `trace_extras[]` entry VERBATIM into the packet — the CLI composes them, and the
61
+ hook emits NO `SPAWN`/`RETURN` for a foreign worker, so they are the whole record.
62
+ 2. Record worker milestone pings (they bound what a mid-wave stop can save).
63
+ 3. Collect returns; VALIDATE each (emit `VERIFY <task> actual=<model>/<effort>`
64
+ ✅ MATCH / ⛔ DOWNGRADE per return — surface any downgrade to the user).
65
+ **A FOREIGN return runs `_shared/return-validation.md` §2b INSTEAD of §2** — it
66
+ has no injected model-id line, so it cannot carry `actual_model` and faking one
67
+ claims evidence that does not exist; ⛔ SUBSTITUTION replaces the downgrade
68
+ check. A failure runs the fallback procedure, which BEGINS with a free
69
+ `orc extra reconcile <task>` — a worktree that moved is RESUMED, never re-done
70
+ — then re-dispatches or STOPs, announced, with the `EXTRA fallback` line.
71
+ `needs_context` → adjudicate → re-slice
72
+ (cap 2 per task, then escalate). A `pattern` task must return
73
+ `invariants_checked: true` + the matching `pattern_version`. **Evidence
74
+ check:** `status=done` on a stack with a runnable build/test REQUIRES
75
+ `evidence` {command, exit_code, tail} — a missing block or false
76
+ `no_runner_detected` is malformed (requeue); `done` with non-empty
77
+ `unmet[]` is `partial`.
78
+ 4. **Post-wave worktree audit (GATE, `_shared/return-validation.md` §6):** diff `git status --short` before/after the wave — a changed path in NO task's `declared_files`, INCLUDING one that became less modified (the revert signature), blocks the close until named and decided.
79
+ Overlap → `failure_reason: "file-collision:<file> with <agent>"`, requeue later wave.
80
+ 4a. **Code graph (`../code-graph.md` §5–§6):** after the audit, ONE call —
81
+ `orc graph update --notes-pending --files <the wave's changed paths> --at wave --if-enabled --json`
82
+ (emit `GRAPH-UPDATE`; the answer's `notes_pending` is the notes half):
83
+ `notes_pending.exit` 0 → dispatch `orc-graph-noter-sonnet-4-6-med` (slice = paths only) in the
84
+ SAME tool block as the next wave's first dispatch; 3 or 5 → nothing, the
85
+ symbols wait for a later batch. The noter returns ONE line (emit `GRAPH-NOTES`) —
86
+ never pull its notes into this context. A slice that carried cards gets a
87
+ `graph:` continuation on its `DISPATCH` line and a `graph_used` return.
88
+ 5. Append worker `log_entries` to the decision log; regenerate the digest.
89
+ **Gotcha capture (`gotchas: on`):** a return that CLOSED a repair loop carries
90
+ `gotcha_recorded` (`_shared/return-validation.md` §7) — dedupe on
91
+ `symptom`+`scope` (a match bumps `hits`/`last_seen` and appends nothing), else
92
+ append the block to `.claude/orc/gotchas.md`. YOU write it, never a subagent;
93
+ a capped-and-stopped loop records NOTHING.
94
+ 6. Update checkpoint + state-of-play; emit `OUTCOME task=<id> score=<n>
95
+ band=<range> model=<m> retries=<n> requeues=<n> needs_context=<n> unmet=<n>`
96
+ as each task closes.
97
+ 7. **Wave-boundary gate (deterministic — NOT judgment):** after wave W, if the
98
+ wave's `is_batch_pause` is true (W in `pause_schedule`) AND a later wave
99
+ remains, emit `GATE wave-boundary :: wave=W of K → STOP (batch_pause_every=N)`
100
+ and run the MANDATORY STOP SEQUENCE — never dispatch wave W+1 past an
101
+ unacknowledged boundary. Token pressure → same STOP SEQUENCE (judgment).
102
+ Last wave closes → emit `PHASE execution end`. (stop-resume.md)
103
+
104
+ **User escalations:** relay question → broadcast answer to log; an answer that
105
+ invalidates a DONE task → re-run once, then set every reverse-`depends_on`
106
+ consumer to `stale_review`. **Worker failure/garbage/timeout:** flag +
107
+ continue the wave; audit and re-dispatch at the next batch checkpoint
108
+
109
+ **Before any re-dispatch, run `orc run inflight`** (0 clear · 1 in-flight · 2 unknown). A Task error does not kill the agent behind it, and exit 2 REFUSES by default — `a lane that re-dispatches over a live attempt` has broken the contract. Canonical: `../return-validation.md`.
110
+ (`requeued`, retry_count++). Hard retry cap 2 → STOP and surface.
111
+
112
+ <!-- /orc:layer -->
113
+
114
+ <!-- orc:layer composed -->
115
+
116
+ ## Phase: Execution (waves)
117
+
118
+ Run execution exactly as the full lane's execution subskill defines it —
119
+ follow `.claude/skills/orc/subskills/orc-execution/SKILL.md` (slices
120
+ constructed by you, standing rules injected, evidence-bearing returns
121
+ validated against the contract) with these compiled overrides:
122
+
123
+ - Max parallel tasks per wave: **{{max_wave_tasks}}** (hard cap; overflow →
124
+ next wave; wave grouping per
125
+ `.claude/skills/_shared/phases/wave-grouping.md`).
126
+ - Stop-and-continue pause every **{{batch_pause_every}}** waves (checkpoint
127
+ confirmed BEFORE announcing any stop; resume per
128
+ `.claude/skills/_shared/phases/stop-resume.md`).
129
+ - Executor selection comes from this flow's scoring section above — never
130
+ from the shipped presets.
131
+
132
+ <!-- diy:when tdd=on -->
133
+ TDD execution: `tdd_spec` is SCOPED by each entry's `disposition` — only
134
+ `new-surface` and `behavior-change` get tests; `covered-by-existing` (cited
135
+ existing test) and `no-behavior` (constants, translation strings, docs, config)
136
+ get none, and a task with cited `risk[]` is never scoped out. A PAIRED TDD task
137
+ (never a Wave 0) materializes the remaining skeletons into real
138
+ FAILING tests (red proven before implementation; a `new-surface` pre-implementation
139
+ pass is a spec bug → block that requirement). Each implementation slice carries its
140
+ `tdd_spec`; executors implement to green (implement→test→repair, cap
141
+ `tdd_loop_max`; `TDD-RED`/`TDD-GREEN` per iteration) and return `tdd_state`
142
+ per `.claude/skills/_shared/return-validation.md` — including §6's worktree
143
+ delta: `git status --short` before/after each dispatch, any changed path
144
+ outside `declared_files` (a revert included) gates the wave close.
145
+ <!-- /diy:when -->
146
+
147
+ <!-- diy:when code_graph=on -->
148
+ Code graph cache (never skipped): each slice gets ONE `orc graph ctx --for-slice <the task's
149
+ declared_files> --if-enabled --json` `card` as its `graph` block, and the return
150
+ carries `graph_used`. After each wave's worktree audit run ONE call —
151
+ `orc graph update --notes-pending --files <the wave's changed paths> --at wave --if-enabled --json`
152
+ (copy its `trace` verbatim); `notes_pending.exit` 0 → dispatch `orc-graph-noter-sonnet-4-6-med` paired
153
+ with the next wave's first dispatch, exit 3 or 5 → nothing. Canonical:
154
+ `.claude/skills/_shared/code-graph.md`.
155
+ <!-- /diy:when -->
156
+ <!-- diy:when gotchas=on -->
157
+ Repair memory: probe `orc gotcha status` once at preflight (exit 0 = entries,
158
+ 1 = none — never a `find`) and print one line either way. Inject the
159
+ SCOPE-MATCHING entries into each slice beside `pattern` — glob vs that task's
160
+ `declared_files`, cap 3, highest `hits` first; zero matches = NO block, never an
161
+ empty one, and NEVER unfiltered. A return that CLOSED a repair loop carries
162
+ `gotcha_recorded`; dedupe it on `symptom`+`scope` (a match bumps `hits` and
163
+ `last_seen`) and append it to `.claude/orc/gotchas.md` YOURSELF — a subagent never
164
+ writes that file, and a loop that hit its cap and stopped records nothing. Full
165
+ contract: `.claude/skills/_shared/gotchas.md`.
166
+ <!-- /diy:when -->
167
+
168
+ <!-- /orc:layer -->