@azure-id/orc 0.56.0 → 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (153) hide show
  1. package/CHANGELOG.md +228 -0
  2. package/README-id.md +143 -53
  3. package/README.md +124 -103
  4. package/bin/build-agents.js +18 -11
  5. package/bin/cli.js +4139 -315
  6. package/bin/onboarding-content.js +0 -3
  7. package/bin/test-run.js +491 -0
  8. package/bin/verify-contracts.js +4256 -3277
  9. package/bin/verify-package.js +563 -498
  10. package/bin/webui/api.js +1186 -1163
  11. package/bin/webui/app.html +9 -0
  12. package/bin/webui/css/06-responsive.css +120 -108
  13. package/bin/webui/css/panels/extra.css +29 -0
  14. package/bin/webui/css/panels/lanes.css +134 -0
  15. package/bin/webui/css/panels/settings.css +79 -3
  16. package/bin/webui/fixtures/extra.js +2036 -1934
  17. package/bin/webui/fixtures/flow.js +2 -2
  18. package/bin/webui/fixtures/index.js +503 -486
  19. package/bin/webui/fixtures/lanes.js +218 -0
  20. package/bin/webui/fixtures/settings.js +261 -34
  21. package/bin/webui/fixtures/stats.js +3 -3
  22. package/bin/webui/i18n/TERMS.md +135 -134
  23. package/bin/webui/i18n/en/extra.json +345 -313
  24. package/bin/webui/i18n/en/lanes.json +29 -0
  25. package/bin/webui/i18n/en/nav.json +1 -0
  26. package/bin/webui/i18n/en/overview.json +2 -0
  27. package/bin/webui/i18n/en/settings.json +16 -5
  28. package/bin/webui/i18n/id/extra.json +345 -313
  29. package/bin/webui/i18n/id/lanes.json +29 -0
  30. package/bin/webui/i18n/id/nav.json +1 -0
  31. package/bin/webui/i18n/id/overview.json +2 -0
  32. package/bin/webui/i18n/id/settings.json +15 -4
  33. package/bin/webui/js/01-i18n.js +1 -0
  34. package/bin/webui/js/panels/extra.js +3199 -3011
  35. package/bin/webui/js/panels/lanes.js +259 -0
  36. package/bin/webui/js/panels/overview.js +10 -0
  37. package/bin/webui/js/panels/settings.js +149 -3
  38. package/package.json +3 -3
  39. package/templates/agents/MODEL-MAPPING.md +23 -35
  40. package/templates/agents/orc-executor-opus-4-7-high.md +1 -1
  41. package/templates/agents/orc-executor-opus-4-7-med.md +1 -1
  42. package/templates/agents/orc-executor-opus-4-8-high.md +1 -1
  43. package/templates/agents/orc-executor-opus-5-high.md +1 -1
  44. package/templates/agents/orc-executor-opus-5-low.md +1 -1
  45. package/templates/agents/orc-executor-opus-5-med.md +1 -1
  46. package/templates/agents/orc-retro-opus-5-med.md +73 -73
  47. package/templates/agents/orc-retro-sonnet-5-high.md +72 -72
  48. package/templates/agents/orc-trace-writer-haiku-4-5.md +107 -107
  49. package/templates/commands/orc-route.md +1 -1
  50. package/templates/commands/orc.md +1 -1
  51. package/templates/skills/_shared/README.md +7 -3
  52. package/templates/skills/_shared/config-precedence.md +198 -0
  53. package/templates/skills/_shared/drift-recovery.md +1 -1
  54. package/templates/skills/_shared/extra-dispatch.md +292 -6
  55. package/templates/skills/_shared/interview.md +1 -1
  56. package/templates/skills/_shared/opus5-only.md +9 -7
  57. package/templates/skills/_shared/phases/README.md +82 -0
  58. package/templates/skills/{orc/references → _shared/phases}/analyst-gates.md +15 -3
  59. package/templates/skills/_shared/phases/execution.md +143 -0
  60. package/templates/skills/{orc/references → _shared/phases}/house-rules.md +13 -1
  61. package/templates/skills/{orc/references → _shared/phases}/intake.md +15 -2
  62. package/templates/skills/_shared/phases/mock-example.md +56 -0
  63. package/templates/skills/{orc/references → _shared/phases}/plan-handoff.md +16 -3
  64. package/templates/skills/_shared/phases/planning.md +135 -0
  65. package/templates/skills/_shared/phases/preflight.md +76 -0
  66. package/templates/skills/_shared/phases/review.md +53 -0
  67. package/templates/skills/_shared/phases/scoring.md +65 -0
  68. package/templates/skills/{orc/references → _shared/phases}/security-checklist.md +12 -1
  69. package/templates/skills/_shared/phases/security.md +55 -0
  70. package/templates/skills/_shared/phases/ship.md +88 -0
  71. package/templates/skills/{orc/references/stop-and-resume.md → _shared/phases/stop-resume.md} +169 -160
  72. package/templates/skills/_shared/phases/summary.md +48 -0
  73. package/templates/skills/_shared/phases/testgen.md +51 -0
  74. package/templates/skills/{orc/references/trace-protocol.md → _shared/phases/trace.md} +49 -6
  75. package/templates/skills/_shared/phases/verify.md +70 -0
  76. package/templates/skills/{orc/references → _shared/phases}/wave-grouping.md +14 -2
  77. package/templates/skills/{orc/references → _shared/phases}/wiki-consult.md +13 -1
  78. package/templates/skills/_shared/read-ladder.md +48 -0
  79. package/templates/skills/context-combiner/SKILL.md +214 -187
  80. package/templates/skills/orc/README.md +148 -150
  81. package/templates/skills/orc/SKILL.md +70 -358
  82. package/templates/skills/orc/config.md +137 -389
  83. package/templates/skills/orc/examples/full-run-mock.md +1 -1
  84. package/templates/skills/orc/references/effort-and-mode.md +16 -18
  85. package/templates/skills/orc/references/phases/intake.md +47 -0
  86. package/templates/skills/orc/references/phases/integration.md +19 -0
  87. package/templates/skills/orc/references/preflight-report.md +4 -4
  88. package/templates/skills/orc/references/ultra-mode.md +117 -123
  89. package/templates/skills/orc/schemas/planning-output.md +279 -279
  90. package/templates/skills/orc/subskills/orc-planner/SKILL.md +260 -264
  91. package/templates/skills/orc/subskills/orc-pr/stack-gate.md +4 -1
  92. package/templates/skills/orc-aftermath/SKILL.md +153 -136
  93. package/templates/skills/orc-analyze/SKILL.md +247 -220
  94. package/templates/skills/orc-analyze/references/branching.md +51 -51
  95. package/templates/skills/orc-analyze/references/thin-input.md +1 -1
  96. package/templates/skills/orc-analyze-mini/SKILL.md +128 -112
  97. package/templates/skills/orc-boundary/SKILL.md +244 -208
  98. package/templates/skills/orc-brainstorm/SKILL.md +372 -339
  99. package/templates/skills/orc-budget/SKILL.md +243 -225
  100. package/templates/skills/orc-challenge/README.md +1 -1
  101. package/templates/skills/orc-challenge/SKILL.md +293 -255
  102. package/templates/skills/orc-challenge/examples/council-full-roster.md +1 -1
  103. package/templates/skills/orc-claude/SKILL.md +216 -199
  104. package/templates/skills/orc-diy/README.md +2 -1
  105. package/templates/skills/orc-diy/SKILL.md +129 -70
  106. package/templates/skills/orc-diy/references/blocks/analyze.md +1 -1
  107. package/templates/skills/orc-diy/references/compile.md +21 -7
  108. package/templates/skills/orc-diy/references/flow-schema.md +2 -2
  109. package/templates/skills/orc-doc/SKILL.md +44 -7
  110. package/templates/skills/orc-explain/SKILL.md +19 -0
  111. package/templates/skills/orc-export/SKILL.md +26 -5
  112. package/templates/skills/orc-fast/SKILL.md +215 -187
  113. package/templates/skills/orc-grill/SKILL.md +233 -207
  114. package/templates/skills/orc-handoff/SKILL.md +223 -204
  115. package/templates/skills/orc-learn/SKILL.md +176 -156
  116. package/templates/skills/orc-mini/SKILL.md +41 -23
  117. package/templates/skills/orc-pact/SKILL.md +250 -218
  118. package/templates/skills/orc-pattern/SKILL.md +149 -124
  119. package/templates/skills/orc-poly/SKILL.md +237 -216
  120. package/templates/skills/orc-poly/references/gather.md +1 -1
  121. package/templates/skills/orc-pr-driver/SKILL.md +196 -167
  122. package/templates/skills/orc-pr-driver/references/orc-run-split.md +1 -1
  123. package/templates/skills/orc-pr-setup/SKILL.md +212 -184
  124. package/templates/skills/orc-quick/README.md +2 -2
  125. package/templates/skills/orc-quick/SKILL.md +346 -313
  126. package/templates/skills/orc-quick/references/dispatch-gate.md +12 -4
  127. package/templates/skills/orc-retro/SKILL.md +244 -222
  128. package/templates/skills/orc-retro/examples/retro-mock.md +171 -171
  129. package/templates/skills/orc-route/SKILL.md +183 -165
  130. package/templates/skills/orc-verify/SKILL.md +100 -86
  131. package/templates/skills/orc-wiki/SKILL.md +55 -206
  132. package/templates/skills/orc-wiki/references/phases/phase-0.md +71 -0
  133. package/templates/skills/orc-wiki/references/phases/phase-1.md +35 -0
  134. package/templates/skills/orc-wiki/references/phases/phase-2.md +52 -0
  135. package/templates/skills/orc-wiki/references/phases/phase-3.md +57 -0
  136. package/templates/skills/orc-wiki/references/phases/phase-3c.md +36 -0
  137. package/templates/agents/orc-advisor-fable-5.md +0 -50
  138. package/templates/agents/orc-analyst-fable-5.md +0 -115
  139. package/templates/agents/orc-judge-fable-5.md +0 -79
  140. package/templates/agents/orc-planner-fable-5.md +0 -152
  141. package/templates/agents/orc-reviewer-fable-5.md +0 -57
  142. package/templates/skills/_shared/fable5-override.md +0 -56
  143. package/templates/skills/orc-diy/references/blocks/execution.md +0 -42
  144. package/templates/skills/orc-diy/references/blocks/mock-example.md +0 -22
  145. package/templates/skills/orc-diy/references/blocks/planning.md +0 -34
  146. package/templates/skills/orc-diy/references/blocks/review.md +0 -18
  147. package/templates/skills/orc-diy/references/blocks/scoring.md +0 -16
  148. package/templates/skills/orc-diy/references/blocks/security.md +0 -25
  149. package/templates/skills/orc-diy/references/blocks/ship.md +0 -25
  150. package/templates/skills/orc-diy/references/blocks/summary.md +0 -18
  151. package/templates/skills/orc-diy/references/blocks/testgen.md +0 -17
  152. package/templates/skills/orc-diy/references/blocks/trace.md +0 -28
  153. package/templates/skills/orc-diy/references/blocks/verify.md +0 -25
@@ -0,0 +1,53 @@
1
+ # Phase — Review (id: `review`)
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
+ ## Review (load ../../orc/subskills/orc-review-verify/, spawned)
18
+
19
+ Emit `PHASE review start`. Superpowers path: its review skill incl. tests
20
+ (Sonnet 4.6 medium). OpenSpec/self path: review worker (Opus 5 medium). Pass the resolved
21
+ `code_pattern` + its invariants + gate lines for the re-check
22
+ (pattern-gate.md); no resolved pattern → FIRST ask for one (paste/md/none).
23
+ FE tasks in run → pass `fe_rules[]` from `../../orc-pattern/references/` fe-a11y
24
+ + fe-perf. Findings arrive on the **P0–P3 ladder** (invariant violation or
25
+ unmet gate line = P0; every P0–P2 carries `file:line` + VERBATIM `quote`;
26
+ unanchored → P3). Apply hard rule 5 INCLUDING the quote spot-check: P0 →
27
+ auto-fix once · P1 → ask, then fix once · P2/P3 → record for Phase 7. Emit
28
+ `FINDING p0=<n> p1=<n> p2=<n> p3=<n>` on the return, then `PHASE review end`.
29
+
30
+ <!-- /orc:layer -->
31
+
32
+ <!-- orc:layer composed -->
33
+
34
+ ## Phase: Review
35
+
36
+ <!-- diy:when review=off -->
37
+ Code review is DISABLED in this flow. Say so in the run summary line ("review
38
+ skipped by flow config") — never imply the work was reviewed.
39
+ <!-- /diy:when -->
40
+ <!-- diy:when review=on -->
41
+ Dispatch the reviewer exactly as the full lane does — follow the review half
42
+ of `.claude/skills/orc/subskills/orc-review-verify/SKILL.md` (reviewer agent
43
+ `orc-reviewer-opus-5-med`; findings ride the severity ladder from the
44
+ locked rules, blocking and advisory findings both surfaced).
45
+ <!-- /diy:when -->
46
+ <!-- diy:when review=blocking-only -->
47
+ Dispatch the reviewer exactly as the full lane does — follow the review half
48
+ of `.claude/skills/orc/subskills/orc-review-verify/SKILL.md` — but only
49
+ P0/P1 findings gate anything; P2/P3 findings are listed once in the summary
50
+ and never re-offered as fix-up tasks.
51
+ <!-- /diy:when -->
52
+
53
+ <!-- /orc:layer -->
@@ -0,0 +1,65 @@
1
+ # Phase — Effort & scoring (id: `scoring`)
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
+ ## Effort, dispatch style, scoring (load ../../orc/references/effort-and-mode.md)
18
+
19
+ Emit `PHASE scoring start`. Refine effort; recommend **sequential** vs
20
+ **parallel** dispatch (worktrees for high-effort independent features) — user
21
+ confirms. Dispatch style is **intra-wave concurrency only**: waves are computed
22
+ regardless of style (sequential runs have waves too, see wave-grouping.md), so
23
+ the batch pause always binds to wave numbers. **Batch-pause schedule (deterministic, not a cadence hint):** the plan
24
+ has K waves — ask "pause after every wave / every 2nd / run straight through?"
25
+ and SHOW the resulting stop list ("will pause after waves [list]"); a 2-wave
26
+ plan plainly offers "pause after wave 1". Store it as `pause_schedule`, recompute
27
+ each wave's `is_batch_pause` (last wave never pauses). **Facet-validation gate
28
+ (deterministic):** recompute `breadth` + `fan_in`/`fan_out` from the plan; a
29
+ mismatch or an uncited `risk` entry bounces the plan (grounding mechanics).
30
+ **Score every task** from its `facets` via the fixed formula, map to the model
31
+ ladder, show the facet vector + arithmetic table, and emit `SCORE task=<id>
32
+ score=<n> band=<band> model=<m> facets=<vector> :: <reason>` per task; a score
33
+ override needs a written reason (logged). **With `extra_enabled`** the table gains
34
+ a `via` column and its head can name TWO tables (effort-and-mode.md); a foreign
35
+ task's `SCORE` appends `via=extra:<profile>` and `model=` is the FOREIGN model id.
36
+ **Cited-risk hold-back (deterministic, beside the facet gate):** a foreign-routed
37
+ task with a non-empty `risk[]` is HELD BACK to its Claude band (`extra_risk_tasks`
38
+ defaults to `off`) and every one is LISTED with its cited risk — a silently
39
+ held-back task is indistinguishable from a forgotten one. Use the wiki's "Notes for planning" to sharpen
40
+ core/isolated + risk factors. **Tag each task's pattern domain+language**
41
+ (+ secondary `db: postgres`) per `../../orc/references/pattern-gate.md`. Ask: "Any
42
+ anticipated escalations, or run straight through?" Emit `PHASE scoring end`.
43
+
44
+ <!-- /orc:layer -->
45
+
46
+ <!-- orc:layer composed -->
47
+
48
+ ## Phase: Task scoring → executor selection
49
+
50
+ <!-- diy:when scoring=on -->
51
+ Score each task 0–100 with the full lane's rubric (see the scoring section of
52
+ `.claude/skills/orc/SKILL.md`), then dispatch the executor agent from THIS
53
+ compiled table — it is already clipped to this flow's session tier; never
54
+ substitute a preset from `config.md`:
55
+
56
+ {{score_table}}
57
+ <!-- /diy:when -->
58
+ <!-- diy:when scoring=off -->
59
+ Scoring is DISABLED in this flow. Skip the rubric entirely: EVERY execution
60
+ task dispatches to **{{fixed_executor}}**. Wave grouping, declared-files
61
+ conflict rules, and slice construction are unchanged — scoring off changes
62
+ model selection only, never scheduling.
63
+ <!-- /diy:when -->
64
+
65
+ <!-- /orc:layer -->
@@ -1,4 +1,13 @@
1
- # Reference — Security-Pass Checklist (Phase 5.5, opt-in)
1
+ # Phase — Security pass (id: `security-checklist`)
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 an
6
+ > opt-in pass either runs its checklist or does not run. `orc lane phases
7
+ > <lane> --json` names the file and the layers to read.
8
+
9
+ <!-- orc:layer core -->
10
+ ## Reference — Security-Pass Checklist (Phase 5.5, opt-in)
2
11
 
3
12
  Loaded ONLY when the Phase 5.5 security pass fires (config `security_review`
4
13
  `on`/`ask` + a task scored ≥ 70 in the run). Passed to the reviewer as
@@ -37,3 +46,5 @@ a hardening gap on a touched path = P1 · defense-in-depth suggestions = P2/P3.
37
46
  surfaced to callers by the new error handling.
38
47
  12. **Crypto misuse** — home-rolled hashing/encryption, weak algorithms (MD5,
39
48
  SHA1 for passwords), missing salts, static IVs in the diff.
49
+
50
+ <!-- /orc:layer -->
@@ -0,0 +1,55 @@
1
+ # Phase — Security pass (opt-in) (id: `security`)
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
+ ## Security pass (opt-in)
18
+
19
+ Only when config `security_review` is `on`/`ask` (default `off`) AND a task
20
+ scored **≥ 70** (reuses the risk floor). `ask` → one P0 prompt; `on` →
21
+ silent. Dispatch the reviewer with `phase=security` + changed files +
22
+ `security-checklist.md` (load only now). Same ladder, same
23
+ hard-rule-5 handling; report-only.
24
+
25
+ <!-- /orc:layer -->
26
+
27
+ <!-- orc:layer composed -->
28
+
29
+ ## Phase: Security pass
30
+
31
+ <!-- diy:when security=off -->
32
+ The security pass is OFF in this flow — skip silently.
33
+ <!-- /diy:when -->
34
+ <!-- diy:when security=ask -->
35
+ When at least one task scored at or above the risk floor (70), ask the user
36
+ once after review whether to run the security pass; on yes, run it exactly as
37
+ the full lane's Phase 5.5 (reviewer re-dispatched with the checklist from
38
+ `.claude/skills/_shared/phases/security-checklist.md`, sweeping only the
39
+ run's changed files).
40
+ <!-- /diy:when -->
41
+ <!-- diy:when security=on -->
42
+ When at least one task scored at or above the risk floor (70), dispatch the
43
+ security pass without asking — the full lane's Phase 5.5 with the checklist
44
+ from `.claude/skills/_shared/phases/security-checklist.md`, sweeping only the
45
+ run's changed files.
46
+ <!-- /diy:when -->
47
+ <!-- diy:when security=always -->
48
+ Dispatch the security pass on EVERY run of this flow, regardless of task
49
+ scores — the full lane's Phase 5.5 with the checklist from
50
+ `.claude/skills/_shared/phases/security-checklist.md`, sweeping only the
51
+ run's changed files. (This flow removes the risk-floor trigger, not the
52
+ pass's mechanics.)
53
+ <!-- /diy:when -->
54
+
55
+ <!-- /orc:layer -->
@@ -0,0 +1,88 @@
1
+ # Phase — Ship (id: `ship`)
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
+ ## Ship (load ../../orc/subskills/orc-pr/SKILL.md)
18
+
19
+ Emit `PHASE ship start`. Show current branch.
20
+
21
+ **Stacked-PR gate FIRST (deterministic; full `/orc` + `/orc-ultra` only — load
22
+ `../../orc/subskills/orc-pr/stack-gate.md`; never mini/fast/diy).** Measure the change
23
+ (`git diff --numstat`, exclusions applied) vs config `stacked_pr_loc`/
24
+ `stacked_pr_files`. Under threshold or `stacked_pr: off` → silent, ship normally
25
+ (`GATE stack-gate pass :: under-threshold`). Tripped → surface report + ONE P0
26
+ question (stack into layers? or one regular PR?) in the SAME round as its two
27
+ prerequisites — **a ticket** and a resolved PR template
28
+ (`_shared/pr-templates.md`; none found → recommend three options). No ticket, no
29
+ template, or "no" → **one regular PR, never re-asked**. "Yes" → commit on the
30
+ current branch (the driver's snapshot), write `stacked-pr/<slug>/STACK-FROM.md`
31
+ (`_shared/stack-plan.md`, `ENTRY-MODE: orc-run`, this run's `RUN-DIR`), then hand
32
+ off **`/orc-pr-setup`** → **`/orc-pr-driver`**. ORC never cuts layers itself.
33
+
34
+ **Handoff seam (one sentence, only when it applies):** if any changed file is a
35
+ GREEN surface in `orc handoff surfaces --json`, say so —
36
+ *"2 of these were changes a PM could have made alone — `/orc-handoff` next time."*
37
+ That sentence is how anyone finds out that lane exists.
38
+
39
+ Then ask together: **commit? push? create PR?** (PR: ticket +
40
+ title + target branch; generate from `../../orc/subskills/orc-pr/pr.md`). If Phase 6.5 ran,
41
+ commit `test-generator/<change-slug>/` too (a user deliverable, never gitignored).
42
+ **`mock-examples/` is NEVER staged** (drift-recovery.md; no `.gitignore` edit —
43
+ just never `git add` it).
44
+ On success: delete the ephemeral decision log; KEEP checkpoint + dispatch log.
45
+ **Wiki stale-flag:** flag (never re-scan) wiki docs whose covered files this
46
+ run changed; point at `/orc-wiki`. **Post-ship refresh ask** (BIG runs, /orc +
47
+ /orc-ultra — the `wiki_refresh_ask_tasks`/`_files` triggers and full rules in
48
+ `../../orc-wiki/references/staleness.md`): upgrade the passive note to **"Refresh
49
+ wiki now?"**; on "later" print the prominent stale warning and stamp
50
+ `wiki_refresh_declined` in the checkpoint. Then ALWAYS show the completion
51
+ usage report — /usage limits + the full dispatch log (model/effort/score per
52
+ subagent). The user must always know what the run cost. Finally emit
53
+ `PHASE ship end`, then the one-line `STATS lane=… dispatches=… downgrades=…`
54
+ summary (trace.md — what `orc stats` reads), then `FINISH :: <detail>`,
55
+ and in ONE step delete BOTH `log_dir/.current` and the run's `RESUME.md` (that
56
+ file existing is what marks a run unfinished — stop-resume.md).
57
+
58
+ <!-- /orc:layer -->
59
+
60
+ <!-- orc:layer composed -->
61
+
62
+ ## Phase: Ship
63
+
64
+ State the current branch and the change summary BEFORE any git action, and
65
+ never ship on a red build (locked rule).
66
+
67
+ <!-- diy:when ship_mode=ask -->
68
+ Ask the user how to ship: commit, PR (via
69
+ `.claude/skills/orc/subskills/orc-pr/SKILL.md`), or leave the working tree
70
+ as-is. Default when auto-accepted by autonomy: leave as-is and report.
71
+ <!-- /diy:when -->
72
+ <!-- diy:when ship_mode=commit -->
73
+ Commit the run's changes on a green gate without asking (branch first if on
74
+ the default branch; conventional message from the intent). PRs only if the
75
+ user asks afterwards.
76
+ <!-- /diy:when -->
77
+ <!-- diy:when ship_mode=pr -->
78
+ On a green gate, create the PR without asking via
79
+ `.claude/skills/orc/subskills/orc-pr/SKILL.md` (branch + commit + push + PR
80
+ body from the run artifacts).
81
+ <!-- /diy:when -->
82
+ <!-- diy:when ship_mode=report-only -->
83
+ NEVER commit or push in this flow. Leave the working tree modified, and end
84
+ with the change report + suggested commit message the user can apply
85
+ themselves.
86
+ <!-- /diy:when -->
87
+
88
+ <!-- /orc:layer -->
@@ -1,160 +1,169 @@
1
- # Reference — Stop Sequence, Usage Report, and Fresh-Session Resume
2
-
3
- The token-saving heart of ORC. Load whenever a stop fires (batch
4
- boundary, token pressure, phase transition worth guarding, or user request).
5
-
6
- ## When a stop is MANDATORY vs a judgment call
7
-
8
- Most stops are yours to judge (token pressure, a phase worth guarding, a user
9
- request). **The batch boundary is NOT a judgment call — it is a hard gate.**
10
- Waves are computed for every run regardless of dispatch style (sequential runs
11
- have waves too — see `wave-grouping.md`), so the boundary binds to wave numbers
12
- in both styles. After completing wave W, if `W % batch_pause_every == 0` **and at
13
- least one wave remains** (`W < total_waves`), the stop sequence below is MANDATORY
14
- and deterministic: **never dispatch wave W+1 past an unacknowledged boundary.** The
15
- boundary is computed from the answered pause schedule at intake (Phase 2) and
16
- stored as `pause_schedule` in the checkpoint, so a resumed session enforces the
17
- same boundaries. Emit `GATE wave-boundary :: wave=W of K STOP (batch_pause_every=N)`
18
- before the stop. Token pressure and user request remain judgment; the batch
19
- boundary is not.
20
-
21
- ## The stop sequence (order is mandatory)
22
-
23
- 1. **Decide** to stop (your judgment for token/phase/user stops; the batch
24
- boundary above is not a decision but a hard gate). The checkpoint skill
25
- never decides.
26
- 2. **Write the checkpoint** into the run subfolder via
27
- `subskills/orc-checkpoint/SKILL.md`. VALIDATE the
28
- return. If the write fails DO NOT STOP; surface the write failure instead.
29
- Stopping without a good checkpoint is the one thing that loses work.
30
- 3. **Update `run/{run-slug}/state-of-play.md`** the 10-line human-readable re-anchor:
31
- current phase, wave, done/pending tasks, last decision, next action.
32
- 3b. **Write `{run_dir}/{run-slug}/RESUME.md`** — the same breath as steps 2–3,
33
- by YOU, never a dispatched agent. Overwrite; never append. Shape below.
34
- 4. **Usage report** (see below).
35
- 5. **Generate the resume block** (see below) regenerate FRESH at every stop,
36
- never reuse an old one. It is printed inline AND is the body of `RESUME.md`.
37
- 6. Tell the user: what's done / remaining, then BOTH continue paths:
38
- "Reply **continue** here, or paste the block below in a **fresh session**
39
- (recommended if this conversation is long cheaper and cleaner than
40
- dragging this context forward)."
41
- 7. End the turn.
42
-
43
- ## Usage report (at EVERY stop and ALSO at run completion)
44
-
45
- Do NOT attempt to invoke `/usage` it cannot be called programmatically.
46
- Instead, at every stop and at run completion:
47
- 1. Report the **dispatch log** you fully control: every subagent's model,
48
- effort, and score. At completion, show the full per-task table (task, score
49
- + override reason, model, effort) so the user sees where tokens went.
50
- 2. **Remind the user to run `/usage` themselves** for their 5-hour and weekly
51
- limit numbers: "Run `/usage` to see your remaining limits."
52
-
53
- Never skip either part.
54
-
55
- ## The resume block printed inline AND written to `RESUME.md`
56
-
57
- A fresh session + disk state is cheaper AND higher-fidelity than a long compacted
58
- session: near-empty context, perfect state. Offer it proactively at every pause
59
- once the run is more than ~2 waves old or usage is heavy — do not wait to be
60
- forced.
61
-
62
- **The problem this file fixes.** ORC used to print the block and nothing else. If
63
- the user closed the window, got distracted, or came back three days later, the
64
- work was safe (the checkpoint is on disk) but the *way back in* was gone.
65
-
66
- ### Where it goes, and why there
67
-
68
- ```
69
- {run_dir}/{run-slug}/RESUME.md
70
- ```
71
-
72
- Inside the run folder — with `checkpoint.json` and `state-of-play.md`, where run
73
- state has lived safely since v0.34.1 — **never at the project root**.
74
- `/orc-quick` and `/orc-grill` put their docs at the root because those are
75
- deliverables a human reads later. A resume prompt is *transient run state*: dead
76
- the moment the run finishes, and it must never be at risk of being committed.
77
- Discovery is `orc resume`'s job, not the filesystem's.
78
-
79
- ### Lifecyclethe file existing IS the "unfinished" flag
80
-
81
- - **Written at EVERY stop**, as the third write in the same breath as
82
- `checkpoint.json` and `state-of-play.md`. ORC writes it itself no dispatch.
83
- A dispatch inside the stop sequence would mean a stop can fail because a
84
- subagent did, at the one step whose entire job is not losing work.
85
- - **ONE per run slug, always overwritten, never appended.** This is already the
86
- protocol's rule above ("regenerated FRESH at every stop, never reuse an old
87
- one"), because a stale resume block points at a wave that is already done. This
88
- gives that rule a place on disk.
89
- - **Deleted at `FINISH`** in the same Phase 8 step that deletes
90
- `log_dir/.current`. So a `RESUME.md` existing means **this run is still waiting
91
- for you**, with no stale entries and no separate "is this consumed?"
92
- bookkeeping.
93
- - **NOT deleted when a resume merely starts.** If that session then dies, the
94
- pointer must still be there.
95
-
96
- ### Contents (deterministicthis shape, not an improvisation)
97
-
98
- ```
99
- Continue ORC run `merchant-notifications`.
100
-
101
- Read .claude/orc/run/merchant-notifications/state-of-play.md,
102
- then .claude/orc/run/merchant-notifications/checkpoint.json.
103
- Resume from the checkpoint's phase and wave.
104
- The intent-spec is approved — do not re-plan. Do not redo tasks marked done.
105
-
106
- Where it stands: /orc · phase execution · wave 2 of 4 done
107
- Done: T1, T2, T3, T5
108
- Left: T4 (requeued — see failure_reason), T6, T7
109
- Watch out for: T4 failed once on a missing migration; the gotcha is recorded
110
- Next action: dispatch wave 3 (T6, T7)
111
- ```
112
-
113
- Every blank is a value you hold at that instant (phase, wave, task states,
114
- failure reasons) which is exactly why no model is needed to fill them in.
115
-
116
- **Keep the `Where it stands:` line in exactly that shape** lane, then phase,
117
- then `wave K of N`, separated by ` · `. It is the ONE line `orc resume` and
118
- `orc run list` parse, which is how they can list every waiting run without ever
119
- opening a `checkpoint.json`. Prose elsewhere in the file is free-form.
120
-
121
- ### Always tell the user both paths
122
-
123
- ```
124
- Paused after wave 2 of 4.
125
-
126
- To continue in a NEW session (cheaper and cleaner than this long one):
127
- open a fresh session and paste the contents of
128
-
129
- .claude/orc/run/merchant-notifications/RESUME.md
130
- (or just run `orc resume` and pick it from the list)
131
-
132
- Or reply `continue` here.
133
- ```
134
-
135
- Name the path AND the command. A user who lost the chat has neither the block nor
136
- the slug in front of them.
137
-
138
- ## Compaction-proofing (always on, not just at stops)
139
-
140
- - **Disk is truth.** Everything needed to continue lives in `run/` files you
141
- created: intent-spec, checkpoint, state-of-play, decision log. Conversation
142
- is a disposable cache.
143
- - Write the checkpoint EAGERLY: after every wave, every escalation answer,
144
- every phase transition — so a surprise compaction never catches state that
145
- exists only in conversation.
146
- - On ANY suspicion of compaction (context feels summarized, details missing):
147
- re-read state-of-play checkpoint re-anchor BEFORE acting.
148
-
149
- ## Resume procedure (both paths: "continue" here, or fresh session)
150
-
151
- 1. Read `run/{run-slug}/state-of-play.md` (one-glance orientation).
152
- 2. Read the newest valid checkpoint (`updated_at` wins).
153
- 3. One-line intent reconfirm (fresh session only): "Resuming: <scope>. Still
154
- correct?"
155
- 4. From task_state: done stays done; partial resumes from
156
- `progress.files_written` (last milestone); pending awaits its wave;
157
- requeued/failed re-dispatch reading `failure_reason`; stale_review gets a
158
- review pass.
159
- 5. Re-attach the decision log, regenerate the digest, continue from the
160
- checkpoint's phase.
1
+ # Phase — Stop, usage report, resume (id: `stop-resume`)
2
+
3
+ > **Library file.** Canonical since v1.0.0 W11; it was
4
+ > the `orc` skill's own `stop-and-resume` reference. Layers declared: `core` only — the stop
5
+ > sequence is identical in every lane that stops, and the lane-specific half
6
+ > (which moments are MANDATORY stops) is already a per-lane rule in the spine.
7
+
8
+ <!-- orc:layer core -->
9
+
10
+ The token-saving heart of ORC. Load whenever a stop fires (batch
11
+ boundary, token pressure, phase transition worth guarding, or user request).
12
+
13
+ ## When a stop is MANDATORY vs a judgment call
14
+
15
+ Most stops are yours to judge (token pressure, a phase worth guarding, a user
16
+ request). **The batch boundary is NOT a judgment call it is a hard gate.**
17
+ Waves are computed for every run regardless of dispatch style (sequential runs
18
+ have waves too see `wave-grouping.md`), so the boundary binds to wave numbers
19
+ in both styles. After completing wave W, if `W % batch_pause_every == 0` **and at
20
+ least one wave remains** (`W < total_waves`), the stop sequence below is MANDATORY
21
+ and deterministic: **never dispatch wave W+1 past an unacknowledged boundary.** The
22
+ boundary is computed from the answered pause schedule at intake (Phase 2) and
23
+ stored as `pause_schedule` in the checkpoint, so a resumed session enforces the
24
+ same boundaries. Emit `GATE wave-boundary :: wave=W of K STOP (batch_pause_every=N)`
25
+ before the stop. Token pressure and user request remain judgment; the batch
26
+ boundary is not.
27
+
28
+ ## The stop sequence (order is mandatory)
29
+
30
+ 1. **Decide** to stop (your judgment for token/phase/user stops; the batch
31
+ boundary above is not a decision but a hard gate). The checkpoint skill
32
+ never decides.
33
+ 2. **Write the checkpoint** into the run subfolder via
34
+ `subskills/orc-checkpoint/SKILL.md`. VALIDATE the
35
+ return. If the write fails DO NOT STOP; surface the write failure instead.
36
+ Stopping without a good checkpoint is the one thing that loses work.
37
+ 3. **Update `run/{run-slug}/state-of-play.md`** the 10-line human-readable re-anchor:
38
+ current phase, wave, done/pending tasks, last decision, next action.
39
+ 3b. **Write `{run_dir}/{run-slug}/RESUME.md`** the same breath as steps 2–3,
40
+ by YOU, never a dispatched agent. Overwrite; never append. Shape below.
41
+ 4. **Usage report** (see below).
42
+ 5. **Generate the resume block** (see below) — regenerate FRESH at every stop,
43
+ never reuse an old one. It is printed inline AND is the body of `RESUME.md`.
44
+ 6. Tell the user: what's done / remaining, then BOTH continue paths:
45
+ "Reply **continue** here, or paste the block below in a **fresh session**
46
+ (recommended if this conversation is long — cheaper and cleaner than
47
+ dragging this context forward)."
48
+ 7. End the turn.
49
+
50
+ ## Usage report (at EVERY stop and ALSO at run completion)
51
+
52
+ Do NOT attempt to invoke `/usage` — it cannot be called programmatically.
53
+ Instead, at every stop and at run completion:
54
+ 1. Report the **dispatch log** you fully control: every subagent's model,
55
+ effort, and score. At completion, show the full per-task table (task, score
56
+ + override reason, model, effort) so the user sees where tokens went.
57
+ 2. **Remind the user to run `/usage` themselves** for their 5-hour and weekly
58
+ limit numbers: "Run `/usage` to see your remaining limits."
59
+
60
+ Never skip either part.
61
+
62
+ ## The resume block printed inline AND written to `RESUME.md`
63
+
64
+ A fresh session + disk state is cheaper AND higher-fidelity than a long compacted
65
+ session: near-empty context, perfect state. Offer it proactively at every pause
66
+ once the run is more than ~2 waves old or usage is heavy — do not wait to be
67
+ forced.
68
+
69
+ **The problem this file fixes.** ORC used to print the block and nothing else. If
70
+ the user closed the window, got distracted, or came back three days later, the
71
+ work was safe (the checkpoint is on disk) but the *way back in* was gone.
72
+
73
+ ### Where it goes, and why there
74
+
75
+ ```
76
+ {run_dir}/{run-slug}/RESUME.md
77
+ ```
78
+
79
+ Inside the run folder with `checkpoint.json` and `state-of-play.md`, where run
80
+ state has lived safely since v0.34.1 — **never at the project root**.
81
+ `/orc-quick` and `/orc-grill` put their docs at the root because those are
82
+ deliverables a human reads later. A resume prompt is *transient run state*: dead
83
+ the moment the run finishes, and it must never be at risk of being committed.
84
+ Discovery is `orc resume`'s job, not the filesystem's.
85
+
86
+ ### Lifecycle the file existing IS the "unfinished" flag
87
+
88
+ - **Written at EVERY stop**, as the third write in the same breath as
89
+ `checkpoint.json` and `state-of-play.md`. ORC writes it itself no dispatch.
90
+ A dispatch inside the stop sequence would mean a stop can fail because a
91
+ subagent did, at the one step whose entire job is not losing work.
92
+ - **ONE per run slug, always overwritten, never appended.** This is already the
93
+ protocol's rule above ("regenerated FRESH at every stop, never reuse an old
94
+ one"), because a stale resume block points at a wave that is already done. This
95
+ gives that rule a place on disk.
96
+ - **Deleted at `FINISH`** in the same Phase 8 step that deletes
97
+ `log_dir/.current`. So a `RESUME.md` existing means **this run is still waiting
98
+ for you**, with no stale entries and no separate "is this consumed?"
99
+ bookkeeping.
100
+ - **NOT deleted when a resume merely starts.** If that session then dies, the
101
+ pointer must still be there.
102
+
103
+ ### Contents (deterministic this shape, not an improvisation)
104
+
105
+ ```
106
+ Continue ORC run `merchant-notifications`.
107
+
108
+ Read .claude/orc/run/merchant-notifications/state-of-play.md,
109
+ then .claude/orc/run/merchant-notifications/checkpoint.json.
110
+ Resume from the checkpoint's phase and wave.
111
+ The intent-spec is approved — do not re-plan. Do not redo tasks marked done.
112
+
113
+ Where it stands: /orc · phase execution · wave 2 of 4 done
114
+ Done: T1, T2, T3, T5
115
+ Left: T4 (requeued — see failure_reason), T6, T7
116
+ Watch out for: T4 failed once on a missing migration; the gotcha is recorded
117
+ Next action: dispatch wave 3 (T6, T7)
118
+ ```
119
+
120
+ Every blank is a value you hold at that instant (phase, wave, task states,
121
+ failure reasons) which is exactly why no model is needed to fill them in.
122
+
123
+ **Keep the `Where it stands:` line in exactly that shape** — lane, then phase,
124
+ then `wave K of N`, separated by ` · `. It is the ONE line `orc resume` and
125
+ `orc run list` parse, which is how they can list every waiting run without ever
126
+ opening a `checkpoint.json`. Prose elsewhere in the file is free-form.
127
+
128
+ ### Always tell the user both paths
129
+
130
+ ```
131
+ Paused after wave 2 of 4.
132
+
133
+ To continue in a NEW session (cheaper and cleaner than this long one):
134
+ open a fresh session and paste the contents of
135
+
136
+ .claude/orc/run/merchant-notifications/RESUME.md
137
+ (or just run `orc resume` and pick it from the list)
138
+
139
+ Or reply `continue` here.
140
+ ```
141
+
142
+ Name the path AND the command. A user who lost the chat has neither the block nor
143
+ the slug in front of them.
144
+
145
+ ## Compaction-proofing (always on, not just at stops)
146
+
147
+ - **Disk is truth.** Everything needed to continue lives in `run/` files you
148
+ created: intent-spec, checkpoint, state-of-play, decision log. Conversation
149
+ is a disposable cache.
150
+ - Write the checkpoint EAGERLY: after every wave, every escalation answer,
151
+ every phase transition — so a surprise compaction never catches state that
152
+ exists only in conversation.
153
+ - On ANY suspicion of compaction (context feels summarized, details missing):
154
+ re-read state-of-play → checkpoint → re-anchor BEFORE acting.
155
+
156
+ ## Resume procedure (both paths: "continue" here, or fresh session)
157
+
158
+ 1. Read `run/{run-slug}/state-of-play.md` (one-glance orientation).
159
+ 2. Read the newest valid checkpoint (`updated_at` wins).
160
+ 3. One-line intent reconfirm (fresh session only): "Resuming: <scope>. Still
161
+ correct?"
162
+ 4. From task_state: done stays done; partial resumes from
163
+ `progress.files_written` (last milestone); pending awaits its wave;
164
+ requeued/failed re-dispatch reading `failure_reason`; stale_review gets a
165
+ review pass.
166
+ 5. Re-attach the decision log, regenerate the digest, continue from the
167
+ checkpoint's phase.
168
+
169
+ <!-- /orc:layer -->