@azure-id/orc 0.56.1 → 1.1.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 (162) hide show
  1. package/CHANGELOG.md +219 -0
  2. package/README-id.md +49 -107
  3. package/README.md +694 -719
  4. package/bin/build-agents.js +18 -11
  5. package/bin/cli.js +33699 -29855
  6. package/bin/onboarding-content.js +0 -3
  7. package/bin/test-run.js +491 -0
  8. package/bin/verify-contracts.js +4330 -3277
  9. package/bin/verify-package.js +76 -6
  10. package/bin/webui/api.js +1201 -1163
  11. package/bin/webui/app.html +210 -198
  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/css/panels/wait.css +123 -0
  17. package/bin/webui/fixtures/extra.js +2036 -1934
  18. package/bin/webui/fixtures/flow.js +2 -2
  19. package/bin/webui/fixtures/index.js +510 -486
  20. package/bin/webui/fixtures/lanes.js +218 -0
  21. package/bin/webui/fixtures/settings.js +261 -34
  22. package/bin/webui/fixtures/stats.js +3 -3
  23. package/bin/webui/fixtures/wait.js +97 -0
  24. package/bin/webui/i18n/TERMS.md +135 -134
  25. package/bin/webui/i18n/en/extra.json +345 -313
  26. package/bin/webui/i18n/en/lanes.json +29 -0
  27. package/bin/webui/i18n/en/nav.json +21 -19
  28. package/bin/webui/i18n/en/overview.json +2 -0
  29. package/bin/webui/i18n/en/settings.json +16 -5
  30. package/bin/webui/i18n/en/wait.json +41 -0
  31. package/bin/webui/i18n/id/extra.json +345 -313
  32. package/bin/webui/i18n/id/lanes.json +29 -0
  33. package/bin/webui/i18n/id/nav.json +21 -19
  34. package/bin/webui/i18n/id/overview.json +2 -0
  35. package/bin/webui/i18n/id/settings.json +15 -4
  36. package/bin/webui/i18n/id/wait.json +41 -0
  37. package/bin/webui/js/01-i18n.js +151 -149
  38. package/bin/webui/js/panels/extra.js +3199 -3011
  39. package/bin/webui/js/panels/lanes.js +259 -0
  40. package/bin/webui/js/panels/overview.js +10 -0
  41. package/bin/webui/js/panels/settings.js +149 -3
  42. package/bin/webui/js/panels/wait.js +253 -0
  43. package/package.json +39 -39
  44. package/templates/agents/MODEL-MAPPING.md +23 -35
  45. package/templates/agents/orc-executor-opus-4-7-high.md +1 -1
  46. package/templates/agents/orc-executor-opus-4-7-med.md +1 -1
  47. package/templates/agents/orc-executor-opus-4-8-high.md +1 -1
  48. package/templates/agents/orc-executor-opus-5-high.md +1 -1
  49. package/templates/agents/orc-executor-opus-5-low.md +1 -1
  50. package/templates/agents/orc-executor-opus-5-med.md +1 -1
  51. package/templates/agents/orc-retro-opus-5-med.md +73 -73
  52. package/templates/agents/orc-retro-sonnet-5-high.md +72 -72
  53. package/templates/agents/orc-trace-writer-haiku-4-5.md +107 -107
  54. package/templates/commands/orc-route.md +1 -1
  55. package/templates/commands/orc-wait.md +19 -0
  56. package/templates/commands/orc.md +1 -1
  57. package/templates/hooks/orc-statusline.js +39 -0
  58. package/templates/skills/_shared/README.md +7 -3
  59. package/templates/skills/_shared/config-precedence.md +198 -0
  60. package/templates/skills/_shared/drift-recovery.md +1 -1
  61. package/templates/skills/_shared/extra-dispatch.md +159 -7
  62. package/templates/skills/_shared/interview.md +1 -1
  63. package/templates/skills/_shared/opus5-only.md +9 -7
  64. package/templates/skills/_shared/phases/README.md +82 -0
  65. package/templates/skills/{orc/references → _shared/phases}/analyst-gates.md +15 -3
  66. package/templates/skills/_shared/phases/execution.md +143 -0
  67. package/templates/skills/{orc/references → _shared/phases}/house-rules.md +13 -1
  68. package/templates/skills/{orc/references → _shared/phases}/intake.md +15 -2
  69. package/templates/skills/_shared/phases/mock-example.md +56 -0
  70. package/templates/skills/{orc/references → _shared/phases}/plan-handoff.md +16 -3
  71. package/templates/skills/_shared/phases/planning.md +135 -0
  72. package/templates/skills/_shared/phases/preflight.md +98 -0
  73. package/templates/skills/_shared/phases/review.md +53 -0
  74. package/templates/skills/_shared/phases/scoring.md +65 -0
  75. package/templates/skills/{orc/references → _shared/phases}/security-checklist.md +12 -1
  76. package/templates/skills/_shared/phases/security.md +55 -0
  77. package/templates/skills/_shared/phases/ship.md +88 -0
  78. package/templates/skills/{orc/references/stop-and-resume.md → _shared/phases/stop-resume.md} +169 -160
  79. package/templates/skills/_shared/phases/summary.md +48 -0
  80. package/templates/skills/_shared/phases/testgen.md +51 -0
  81. package/templates/skills/{orc/references/trace-protocol.md → _shared/phases/trace.md} +49 -6
  82. package/templates/skills/_shared/phases/verify.md +70 -0
  83. package/templates/skills/{orc/references → _shared/phases}/wave-grouping.md +14 -2
  84. package/templates/skills/{orc/references → _shared/phases}/wiki-consult.md +13 -1
  85. package/templates/skills/_shared/read-ladder.md +48 -0
  86. package/templates/skills/_shared/wait.md +240 -0
  87. package/templates/skills/context-combiner/SKILL.md +214 -187
  88. package/templates/skills/orc/README.md +148 -150
  89. package/templates/skills/orc/SKILL.md +75 -358
  90. package/templates/skills/orc/config.md +137 -389
  91. package/templates/skills/orc/examples/full-run-mock.md +1 -1
  92. package/templates/skills/orc/references/effort-and-mode.md +16 -18
  93. package/templates/skills/orc/references/phases/intake.md +47 -0
  94. package/templates/skills/orc/references/phases/integration.md +19 -0
  95. package/templates/skills/orc/references/preflight-report.md +4 -4
  96. package/templates/skills/orc/references/ultra-mode.md +117 -123
  97. package/templates/skills/orc/schemas/planning-output.md +279 -279
  98. package/templates/skills/orc/subskills/orc-planner/SKILL.md +260 -264
  99. package/templates/skills/orc/subskills/orc-pr/stack-gate.md +4 -1
  100. package/templates/skills/orc-aftermath/SKILL.md +158 -136
  101. package/templates/skills/orc-analyze/SKILL.md +252 -220
  102. package/templates/skills/orc-analyze/references/branching.md +51 -51
  103. package/templates/skills/orc-analyze/references/thin-input.md +1 -1
  104. package/templates/skills/orc-analyze-mini/SKILL.md +128 -112
  105. package/templates/skills/orc-boundary/SKILL.md +249 -208
  106. package/templates/skills/orc-brainstorm/SKILL.md +377 -339
  107. package/templates/skills/orc-budget/SKILL.md +248 -225
  108. package/templates/skills/orc-challenge/README.md +1 -1
  109. package/templates/skills/orc-challenge/SKILL.md +298 -255
  110. package/templates/skills/orc-challenge/examples/council-full-roster.md +1 -1
  111. package/templates/skills/orc-claude/SKILL.md +221 -199
  112. package/templates/skills/orc-diy/README.md +2 -1
  113. package/templates/skills/orc-diy/SKILL.md +132 -68
  114. package/templates/skills/orc-diy/references/blocks/analyze.md +1 -1
  115. package/templates/skills/orc-diy/references/compile.md +21 -7
  116. package/templates/skills/orc-diy/references/flow-schema.md +2 -2
  117. package/templates/skills/orc-doc/SKILL.md +49 -7
  118. package/templates/skills/orc-explain/SKILL.md +24 -0
  119. package/templates/skills/orc-export/SKILL.md +31 -5
  120. package/templates/skills/orc-fast/SKILL.md +218 -185
  121. package/templates/skills/orc-grill/SKILL.md +238 -207
  122. package/templates/skills/orc-handoff/SKILL.md +223 -204
  123. package/templates/skills/orc-learn/SKILL.md +181 -156
  124. package/templates/skills/orc-mini/SKILL.md +47 -24
  125. package/templates/skills/orc-pact/SKILL.md +255 -218
  126. package/templates/skills/orc-pattern/SKILL.md +154 -124
  127. package/templates/skills/orc-poly/SKILL.md +242 -216
  128. package/templates/skills/orc-poly/references/gather.md +1 -1
  129. package/templates/skills/orc-pr-driver/SKILL.md +196 -167
  130. package/templates/skills/orc-pr-driver/references/orc-run-split.md +1 -1
  131. package/templates/skills/orc-pr-setup/SKILL.md +212 -184
  132. package/templates/skills/orc-quick/README.md +2 -2
  133. package/templates/skills/orc-quick/SKILL.md +51 -13
  134. package/templates/skills/orc-quick/references/dispatch-gate.md +2 -3
  135. package/templates/skills/orc-retro/SKILL.md +249 -222
  136. package/templates/skills/orc-retro/examples/retro-mock.md +171 -171
  137. package/templates/skills/orc-route/SKILL.md +188 -165
  138. package/templates/skills/orc-verify/SKILL.md +103 -84
  139. package/templates/skills/orc-wait/SKILL.md +163 -0
  140. package/templates/skills/orc-wiki/SKILL.md +60 -206
  141. package/templates/skills/orc-wiki/references/phases/phase-0.md +71 -0
  142. package/templates/skills/orc-wiki/references/phases/phase-1.md +35 -0
  143. package/templates/skills/orc-wiki/references/phases/phase-2.md +52 -0
  144. package/templates/skills/orc-wiki/references/phases/phase-3.md +57 -0
  145. package/templates/skills/orc-wiki/references/phases/phase-3c.md +36 -0
  146. package/templates/agents/orc-advisor-fable-5.md +0 -50
  147. package/templates/agents/orc-analyst-fable-5.md +0 -115
  148. package/templates/agents/orc-judge-fable-5.md +0 -79
  149. package/templates/agents/orc-planner-fable-5.md +0 -152
  150. package/templates/agents/orc-reviewer-fable-5.md +0 -57
  151. package/templates/skills/_shared/fable5-override.md +0 -56
  152. package/templates/skills/orc-diy/references/blocks/execution.md +0 -42
  153. package/templates/skills/orc-diy/references/blocks/mock-example.md +0 -22
  154. package/templates/skills/orc-diy/references/blocks/planning.md +0 -34
  155. package/templates/skills/orc-diy/references/blocks/review.md +0 -18
  156. package/templates/skills/orc-diy/references/blocks/scoring.md +0 -16
  157. package/templates/skills/orc-diy/references/blocks/security.md +0 -25
  158. package/templates/skills/orc-diy/references/blocks/ship.md +0 -25
  159. package/templates/skills/orc-diy/references/blocks/summary.md +0 -18
  160. package/templates/skills/orc-diy/references/blocks/testgen.md +0 -17
  161. package/templates/skills/orc-diy/references/blocks/trace.md +0 -28
  162. package/templates/skills/orc-diy/references/blocks/verify.md +0 -25
@@ -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 -->
@@ -0,0 +1,48 @@
1
+ # Phase — Summary (id: `summary`)
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
+ ## Summary
18
+
19
+ Emit `PHASE summary start`. Report: tasks/waves/dispatches (scores + overrides), escalations,
20
+ needs_context events, findings by severity (P0/P1 resolved; P2 itemized; P3
21
+ counted), verify result, authored tests when 6.5 ran, repo state + branch,
22
+ stale_review flags. Then ONE question: **"Apply the P2 fix-batch? The P3
23
+ cosmetics too?"** — never fix unasked. Emit `PHASE summary end`.
24
+
25
+ <!-- /orc:layer -->
26
+
27
+ <!-- orc:layer composed -->
28
+
29
+ ## Phase: Summary
30
+
31
+ <!-- diy:when summary=off -->
32
+ No summary phase: end after ship with a single line (tasks done / gate color
33
+ / ship action taken) plus usage, and note which phases this flow skipped.
34
+ <!-- /diy:when -->
35
+ <!-- diy:when summary=short -->
36
+ Short summary: one paragraph — what was built, gate results, ship action,
37
+ skipped phases, and usage. No per-task breakdown.
38
+ <!-- /diy:when -->
39
+ <!-- diy:when summary=full -->
40
+ Full summary exactly as the full lane's final phase: per-task outcomes with
41
+ models used, findings outcomes, verify results, ship action, skipped
42
+ phases, and usage.
43
+ <!-- /diy:when -->
44
+
45
+ Always name the phases this flow skipped by config — the user must never
46
+ mistake a DIY run for a full-lane run.
47
+
48
+ <!-- /orc:layer -->
@@ -0,0 +1,51 @@
1
+ # Phase — Test authoring (opt-in) (id: `testgen`)
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
+ ## Test Authoring (opt-in; load ../../orc/subskills/orc-testgen/)
18
+
19
+ Only when `config.generate_tests` is on (confirmed at intake). ORC **writes**
20
+ test cases and **runs nothing** — never gates the ship. Dispatch
21
+ `orc-test-author-opus-5-med` (run's `actual_files`, definition-of-done,
22
+ touched flows, constraints, stack); it returns test files + a `TEST-PLAN.md` + a
23
+ Postman-importable `test-cases.http` (HTTP APIs), the two manual deliverables
24
+ written to **`test-generator/<change-slug>/` at the project root**. Validate the
25
+ returned `test_plan_path`/`curl_bundle_path` are under that folder (else
26
+ malformed → re-dispatch); state the exact path in the summary — discoverability
27
+ is the point.
28
+
29
+ <!-- /orc:layer -->
30
+
31
+ <!-- orc:layer composed -->
32
+
33
+ ## Phase: Test authoring
34
+
35
+ <!-- diy:when testgen=off -->
36
+ Test authoring is OFF in this flow — skip silently.
37
+ <!-- /diy:when -->
38
+ <!-- diy:when testgen=ask -->
39
+ After verify (or after execution when verify is off), offer test authoring
40
+ once; on yes, run the full lane's Phase 6.5 via
41
+ `.claude/skills/orc/subskills/orc-testgen/SKILL.md` — it WRITES test cases
42
+ and a test plan, never runs them, and never gates the ship.
43
+ <!-- /diy:when -->
44
+ <!-- diy:when testgen=on -->
45
+ After verify (or after execution when verify is off), run the full lane's
46
+ Phase 6.5 without asking via
47
+ `.claude/skills/orc/subskills/orc-testgen/SKILL.md` — it WRITES test cases
48
+ and a test plan, never runs them, and never gates the ship.
49
+ <!-- /diy:when -->
50
+
51
+ <!-- /orc:layer -->