@azure-id/orc 1.9.2 → 2.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 (228) hide show
  1. package/CHANGELOG.md +722 -0
  2. package/README-id.md +56 -42
  3. package/README.md +58 -41
  4. package/bin/build-agents.js +125 -29
  5. package/bin/clear-logs.js +620 -0
  6. package/bin/cli.js +1873 -180
  7. package/bin/fix.js +459 -0
  8. package/bin/gotcha-import.js +1081 -0
  9. package/bin/gotcha.js +1566 -0
  10. package/bin/graph-query.js +1 -1
  11. package/bin/graph.js +717 -717
  12. package/bin/habit.js +1538 -0
  13. package/bin/mockrun-catalog.js +284 -276
  14. package/bin/onboarding-content.js +2 -1
  15. package/bin/pricing.json +28 -21
  16. package/bin/run-undo.js +398 -0
  17. package/bin/trace-write.js +869 -0
  18. package/bin/verify-contracts.js +627 -100
  19. package/bin/verify-package.js +68 -10
  20. package/bin/webui/api.js +151 -6
  21. package/bin/webui/app.html +239 -232
  22. package/bin/webui/css/00-tokens.css +110 -92
  23. package/bin/webui/css/04-motion.css +87 -0
  24. package/bin/webui/css/06-responsive.css +203 -178
  25. package/bin/webui/css/panels/behaviour.css +205 -0
  26. package/bin/webui/css/panels/hookui.css +79 -0
  27. package/bin/webui/fixtures/behaviour.js +562 -0
  28. package/bin/webui/fixtures/extra.js +9 -9
  29. package/bin/webui/fixtures/flow.js +81 -81
  30. package/bin/webui/fixtures/hookui.js +506 -431
  31. package/bin/webui/fixtures/index.js +66 -3
  32. package/bin/webui/fixtures/knowledge.js +9 -3
  33. package/bin/webui/fixtures/maintenance.js +123 -42
  34. package/bin/webui/fixtures/rules.js +1007 -1002
  35. package/bin/webui/fixtures/settings.js +6 -7
  36. package/bin/webui/fixtures/stats.js +25 -6
  37. package/bin/webui/fixtures/wait.js +98 -97
  38. package/bin/webui/i18n/en/behaviour.json +156 -0
  39. package/bin/webui/i18n/en/hookui.json +290 -194
  40. package/bin/webui/i18n/en/maintenance.json +71 -52
  41. package/bin/webui/i18n/en/nav.json +25 -24
  42. package/bin/webui/i18n/en/settings.json +60 -60
  43. package/bin/webui/i18n/en/tour.json +37 -35
  44. package/bin/webui/i18n/id/behaviour.json +156 -0
  45. package/bin/webui/i18n/id/hookui.json +290 -194
  46. package/bin/webui/i18n/id/maintenance.json +71 -52
  47. package/bin/webui/i18n/id/nav.json +25 -24
  48. package/bin/webui/i18n/id/settings.json +60 -60
  49. package/bin/webui/i18n/id/tour.json +37 -35
  50. package/bin/webui/js/01-i18n.js +155 -154
  51. package/bin/webui/js/05-banners.js +181 -172
  52. package/bin/webui/js/06-edit.js +193 -183
  53. package/bin/webui/js/90-tour.js +498 -494
  54. package/bin/webui/js/91-shortcuts.js +126 -126
  55. package/bin/webui/js/99-boot.js +121 -118
  56. package/bin/webui/js/panels/behaviour.js +1087 -0
  57. package/bin/webui/js/panels/hookui.js +2196 -1691
  58. package/bin/webui/js/panels/maintenance.js +336 -235
  59. package/bin/webui/js/panels/settings.js +726 -719
  60. package/mock-run/INDEX.md +110 -107
  61. package/mock-run/extra-slots.md +1 -1
  62. package/mock-run/gotcha-import.md +118 -0
  63. package/mock-run/habits.md +129 -0
  64. package/mock-run/orc-aftermath.md +392 -392
  65. package/mock-run/orc-budget.md +29 -33
  66. package/mock-run/orc-cli.md +200 -200
  67. package/mock-run/orc-explain.md +86 -86
  68. package/mock-run/orc-extra.md +389 -392
  69. package/mock-run/orc-fix.md +87 -0
  70. package/mock-run/orc-pattern.md +112 -112
  71. package/mock-run/orc-quick.md +6 -1
  72. package/mock-run/orc.md +157 -157
  73. package/package.json +1 -1
  74. package/templates/agents/MODEL-MAPPING.md +37 -34
  75. package/templates/agents/orc-advisor-opus-5-xhigh.md +1 -7
  76. package/templates/agents/orc-analyze-mini-opus-5-med.md +1 -6
  77. package/templates/agents/orc-analyze-mini-sonnet-5-high.md +2 -5
  78. package/templates/agents/{orc-claude-writer-opus-4-8-high.md → orc-claude-writer-opus-5-low.md} +48 -53
  79. package/templates/agents/orc-context-combiner-opus-5-high.md +1 -11
  80. package/templates/agents/orc-executor-haiku-4-5.md +14 -6
  81. package/templates/agents/orc-executor-opus-4-7-high.md +14 -6
  82. package/templates/agents/orc-executor-opus-4-7-med.md +14 -6
  83. package/templates/agents/orc-executor-opus-4-8-high.md +14 -6
  84. package/templates/agents/orc-executor-opus-5-high.md +14 -6
  85. package/templates/agents/orc-executor-opus-5-low.md +14 -6
  86. package/templates/agents/orc-executor-opus-5-med.md +14 -6
  87. package/templates/agents/orc-executor-sonnet-4-6-high.md +14 -6
  88. package/templates/agents/orc-executor-sonnet-4-6-med.md +14 -6
  89. package/templates/agents/orc-executor-sonnet-5-high.md +15 -7
  90. package/templates/agents/orc-executor-sonnet-5-low.md +155 -0
  91. package/templates/agents/orc-executor-sonnet-5-med.md +155 -0
  92. package/templates/agents/orc-graph-noter-sonnet-4-6-med.md +1 -10
  93. package/templates/agents/orc-judge-opus-5-xhigh.md +5 -9
  94. package/templates/agents/orc-learn-writer-opus-5-low.md +1 -7
  95. package/templates/agents/orc-pattern-codifier-opus-5-med.md +1 -8
  96. package/templates/agents/orc-pattern-codifier-sonnet-5-high.md +58 -63
  97. package/templates/agents/orc-planner-mini-opus-5-med.md +1 -4
  98. package/templates/agents/orc-planner-mini-sonnet-5-high.md +2 -3
  99. package/templates/agents/orc-planner-opus-5-med.md +1 -4
  100. package/templates/agents/orc-recon-opus-5-low.md +1 -8
  101. package/templates/agents/orc-recon-sonnet-4-6-med.md +1 -8
  102. package/templates/agents/orc-retro-opus-5-med.md +6 -8
  103. package/templates/agents/orc-retro-sonnet-5-high.md +7 -8
  104. package/templates/agents/orc-reviewer-opus-5-low.md +96 -0
  105. package/templates/agents/orc-scout-opus-5-low.md +1 -6
  106. package/templates/agents/orc-scout-sonnet-4-6-high.md +35 -39
  107. package/templates/agents/orc-system-analyst-opus-5-high.md +1 -6
  108. package/templates/agents/orc-test-author-opus-5-med.md +4 -5
  109. package/templates/agents/orc-trace-writer-haiku-4-5.md +3 -7
  110. package/templates/agents/orc-verifier-opus-5-med.md +16 -8
  111. package/templates/agents/{orc-wiki-scanner-opus-4-8-high.md → orc-wiki-scanner-opus-5-low.md} +74 -79
  112. package/templates/agents/orc-wiki-scanner-sonnet-5-high.md +97 -106
  113. package/templates/commands/orc-analyze.md +13 -21
  114. package/templates/commands/orc-fast.md +10 -15
  115. package/templates/commands/orc-fix.md +18 -0
  116. package/templates/commands/orc-poly.md +12 -21
  117. package/templates/commands/orc-pr-driver.md +11 -30
  118. package/templates/commands/orc-pr-setup.md +10 -31
  119. package/templates/commands/orc-route.md +11 -41
  120. package/templates/commands/orc-test.md +5 -60
  121. package/templates/commands/orc-wiki.md +64 -64
  122. package/templates/hooks/README.md +109 -7
  123. package/templates/hooks/orc-session-hook.js +339 -0
  124. package/templates/hooks/orc-statusline-render.js +317 -23
  125. package/templates/hooks/orc-statusline.js +165 -50
  126. package/templates/hooks/orc-subagent-line.js +23 -5
  127. package/templates/hooks/orc-weather-fetch.js +123 -0
  128. package/templates/skills/_shared/README.md +9 -0
  129. package/templates/skills/_shared/code-graph.md +47 -55
  130. package/templates/skills/_shared/config-precedence.md +3 -1
  131. package/templates/skills/_shared/extra-dispatch.md +78 -93
  132. package/templates/skills/_shared/gotchas.md +248 -177
  133. package/templates/skills/_shared/habits.md +101 -0
  134. package/templates/skills/_shared/lane-contract.md +84 -0
  135. package/templates/skills/_shared/opus5-only.md +14 -14
  136. package/templates/skills/_shared/phases/README.md +142 -83
  137. package/templates/skills/_shared/phases/analyst-gates.md +10 -21
  138. package/templates/skills/_shared/phases/execution.md +8 -14
  139. package/templates/skills/_shared/phases/house-rules.md +27 -32
  140. package/templates/skills/_shared/phases/intake.md +127 -133
  141. package/templates/skills/_shared/phases/mock-example.md +46 -56
  142. package/templates/skills/_shared/phases/plan-handoff.md +91 -97
  143. package/templates/skills/_shared/phases/planning.md +7 -17
  144. package/templates/skills/_shared/phases/preflight.md +19 -42
  145. package/templates/skills/_shared/phases/review.md +24 -28
  146. package/templates/skills/_shared/phases/rules.md +18 -42
  147. package/templates/skills/_shared/phases/scoring.md +55 -65
  148. package/templates/skills/_shared/phases/security-checklist.md +46 -50
  149. package/templates/skills/_shared/phases/security.md +45 -55
  150. package/templates/skills/_shared/phases/ship.md +6 -15
  151. package/templates/skills/_shared/phases/stop-resume.md +2 -5
  152. package/templates/skills/_shared/phases/summary.md +73 -48
  153. package/templates/skills/_shared/phases/testgen.md +41 -51
  154. package/templates/skills/_shared/phases/trace-verbs.md +447 -0
  155. package/templates/skills/_shared/phases/trace.md +66 -297
  156. package/templates/skills/_shared/phases/verify.md +62 -70
  157. package/templates/skills/_shared/phases/wave-grouping.md +128 -133
  158. package/templates/skills/_shared/phases/wiki-consult.md +10 -6
  159. package/templates/skills/_shared/read-ladder.md +2 -55
  160. package/templates/skills/_shared/return-validation.md +17 -70
  161. package/templates/skills/_shared/review-slice.md +106 -0
  162. package/templates/skills/_shared/smoke-gate.md +46 -28
  163. package/templates/skills/_shared/wait.md +1 -0
  164. package/templates/skills/context-combiner/SKILL.md +15 -44
  165. package/templates/skills/orc/README.md +2 -2
  166. package/templates/skills/orc/SKILL.md +35 -63
  167. package/templates/skills/orc/config.md +25 -27
  168. package/templates/skills/orc/examples/full-run-mock.md +2 -1
  169. package/templates/skills/orc/references/effort-and-mode.md +17 -17
  170. package/templates/skills/orc/references/pattern-gate.md +89 -89
  171. package/templates/skills/orc/references/phases/intake.md +41 -47
  172. package/templates/skills/orc/references/phases/integration.md +13 -19
  173. package/templates/skills/orc/references/preflight-report.md +11 -12
  174. package/templates/skills/orc/references/ultra-mode.md +9 -7
  175. package/templates/skills/orc/schemas/checkpoint.md +122 -122
  176. package/templates/skills/orc/subskills/orc-execution/SKILL.md +27 -73
  177. package/templates/skills/orc/subskills/orc-execution/core.md +12 -99
  178. package/templates/skills/orc/subskills/orc-execution/subagent.md +14 -13
  179. package/templates/skills/orc/subskills/orc-review-verify/SKILL.md +12 -53
  180. package/templates/skills/orc/subskills/orc-review-verify/core.md +52 -135
  181. package/templates/skills/orc/subskills/orc-review-verify/subagent.md +7 -7
  182. package/templates/skills/orc/subskills/orc-testgen/SKILL.md +11 -22
  183. package/templates/skills/orc/subskills/orc-testgen/core.md +20 -59
  184. package/templates/skills/orc/subskills/orc-testgen/subagent.md +7 -7
  185. package/templates/skills/orc-advisor/SKILL.md +56 -60
  186. package/templates/skills/orc-analyze/SKILL.md +33 -67
  187. package/templates/skills/orc-analyze/schemas/report-audit.md +2 -1
  188. package/templates/skills/orc-analyze/schemas/report-prose.md +2 -1
  189. package/templates/skills/orc-analyze-mini/SKILL.md +35 -70
  190. package/templates/skills/orc-claude/SKILL.md +14 -14
  191. package/templates/skills/orc-claude/examples/claude-run-mock.md +65 -65
  192. package/templates/skills/orc-diy/README.md +31 -0
  193. package/templates/skills/orc-diy/SKILL.md +27 -78
  194. package/templates/skills/orc-diy/references/blocks/pattern.md +18 -18
  195. package/templates/skills/orc-fast/SKILL.md +49 -75
  196. package/templates/skills/orc-fix/SKILL.md +110 -0
  197. package/templates/skills/orc-judge/SKILL.md +77 -82
  198. package/templates/skills/orc-mini/SKILL.md +64 -112
  199. package/templates/skills/orc-mini/examples/mini-run-mock.md +4 -2
  200. package/templates/skills/orc-pattern/SKILL.md +27 -48
  201. package/templates/skills/orc-poly/SKILL.md +32 -61
  202. package/templates/skills/orc-pr-driver/SKILL.md +25 -51
  203. package/templates/skills/orc-pr-driver/references/green-gate.md +113 -105
  204. package/templates/skills/orc-pr-setup/SKILL.md +20 -45
  205. package/templates/skills/orc-quick/README.md +44 -3
  206. package/templates/skills/orc-quick/SKILL.md +77 -108
  207. package/templates/skills/orc-quick/references/dispatch-gate.md +18 -6
  208. package/templates/skills/orc-quick/references/gh-mode.md +50 -1
  209. package/templates/skills/orc-quick/references/look.md +3 -1
  210. package/templates/skills/orc-retro/SKILL.md +20 -19
  211. package/templates/skills/orc-retro/examples/retro-mock.md +17 -17
  212. package/templates/skills/orc-route/SKILL.md +25 -45
  213. package/templates/skills/orc-test/SKILL.md +16 -37
  214. package/templates/skills/orc-verify/SKILL.md +14 -32
  215. package/templates/skills/orc-wait/SKILL.md +156 -163
  216. package/templates/skills/orc-wiki/README.md +325 -325
  217. package/templates/skills/orc-wiki/SKILL.md +195 -195
  218. package/templates/skills/orc-wiki/examples/wiki-run-mock.md +37 -37
  219. package/templates/skills/orc-wiki/references/extra.md +2 -2
  220. package/templates/skills/orc-wiki/references/partial-refresh.md +276 -271
  221. package/templates/skills/orc-wiki/references/phases/phase-0.md +2 -7
  222. package/templates/skills/orc-wiki/references/phases/phase-1.md +1 -6
  223. package/templates/skills/orc-wiki/references/phases/phase-2.md +4 -9
  224. package/templates/skills/orc-wiki/references/phases/phase-3.md +1 -6
  225. package/templates/skills/orc-wiki/references/phases/phase-3c.md +4 -8
  226. package/templates/agents/orc-claude-writer-opus-5-med.md +0 -55
  227. package/templates/agents/orc-reviewer-opus-5-med.md +0 -60
  228. package/templates/agents/orc-wiki-scanner-opus-5-med.md +0 -81
@@ -1,60 +1,31 @@
1
1
  # Phase — Behavior trace (id: `trace`)
2
2
 
3
- > **Library file.** Canonical since v1.0.0 W11; it was
4
- > the `orc` skill's own `trace-protocol` reference, and 26 lanes reached
5
- > across into one lane's private folder to read it. Layers declared: `core` only — the protocol
6
- > is identical in every lane that traces, and this phase's per-lane variation is
7
- > the TIER TABLE below, which is DATA, not a layer. `orc lane phases <lane>
8
- > --json` names the file and the layers to read; `README.md` in this folder
9
- > holds the closed layer set.
3
+ > **Library file.** `orc lane phases <lane> --json` → `trace_grammar` gives this lane's verbs. **A verb not in `trace_grammar` → read `trace-verbs.md`** (the CLOSED set, on demand). Never invent a verb.
10
4
 
11
5
  <!-- orc:layer core -->
12
6
 
13
- How ORC records its own behavior for later review. **Behavior-trace logging is
14
- PERMANENT (always on) — there is no config toggle.** Every ORC run traces.
15
-
16
- Purpose: capture the flow of a run — phases, spawns, the model that actually
17
- answered, scoring decisions, user questions, review/verify outcomes — so the
18
- skills can be improved from real traces. This is NOT the decision log
19
- (`run/…md`, agent knowledge, deleted on success). The trace is a separate,
20
- **persistent** artifact and the two never mix.
21
-
22
- ## Always on
23
-
24
- There is no gate. Behavior-trace logging is PERMANENT — every run traces. The
25
- `orc-trace.js` hook is the deterministic guarantee: on the first ORC-agent
26
- dispatch it bootstraps `log_dir` + the run pointer itself, so a `.txt` is created
27
- for every run even if the orchestrator never writes a rich marker. Only
7
+ **Behavior-trace logging is PERMANENT (always on) — there is no config toggle.**
8
+ Every ORC run traces, to a **persistent** file that is NOT the decision log. The
9
+ `orc-trace.js` hook bootstraps `log_dir` + the run pointer on the first ORC-agent
10
+ dispatch and writes the `SPAWN`/`RETURN`/`PHASE-EDGE` skeleton itself. Only
28
11
  `log_dir` (default `.claude/orc/logs`) is configurable.
29
12
 
30
- ## Narration is DISPATCHED, not remembered (v0.32.0 — the core rule)
31
-
32
- Two earlier fixes bet on the orchestrator remembering to append rich lines; both
33
- failed under real load (long runs, compaction, parallel waves), leaving traces
34
- with nothing but the hook's `SPAWN`/`RETURN` skeleton. The one behavior a run
35
- performs reliably is **dispatching agents**. So narration moved onto it:
36
-
37
- > **Phase close = build the phase packet + dispatch `orc-trace-writer-haiku-4-5`.**
13
+ ## Narration is WRITTEN BY THE CLI, not remembered (v2.0.0 — the core rule)
38
14
 
39
- The orchestrator supplies the facts; the pinned Haiku writer holds the pen and
40
- appends the block. Three properties make this hold:
15
+ > **Phase close = pipe the phase packet to `orc trace write --packet -`.**
16
+ > Exit ≠ 0 → dispatch `orc-trace-writer-haiku-4-5` with the SAME packet.
41
17
 
42
- - **Pairing rule (the anti-forget mechanism).** The writer dispatch for phase N
43
- is issued **in the same tool block as phase N+1's first dispatch** — logging
44
- piggybacks on the very action the model reliably performs. A phase with no next
45
- dispatch (FINISH, an abort, a pure-question phase) dispatches the writer SOLO,
46
- before printing that phase's user-facing output.
47
- - **First dispatch is solo and synchronous** — before the planner/analyst goes
48
- out. It carries `run_meta` and performs the rename repair (below) while nothing
49
- else is in flight.
50
- - **Last dispatch (run end).** The FINISH packet (final report summary, ship
51
- state, verdict totals) goes out and RETURNS before you delete `.current`.
18
+ You supply the facts; the CLI holds the pen. You never append lines by hand.
52
19
 
53
- The writer's own `SPAWN`/`RETURN` are logged like any `orc*` agent — deliberately:
54
- **a writer SPAWN per phase is the deterministic proof that narration happened**,
55
- and that is exactly what `/orc-retro` audits (narration coverage).
20
+ - **Pairing rule.** The write for phase N goes **in the same tool block as
21
+ phase N+1's first dispatch**. A phase with no next dispatch (FINISH, an
22
+ abort, a pure-question phase) writes SOLO, before its user-facing output.
23
+ - **First write is solo** — before the planner/analyst goes out. It carries
24
+ `run_meta`.
25
+ - **Last write (run end).** The FINISH packet is written BEFORE you delete
26
+ `.current`. It carries ONE `STATS` line immediately BEFORE `FINISH`.
56
27
 
57
- ### Phase packet (passed inline in the dispatch prompt — small, plain YAML)
28
+ ### Phase packet (the command's stdin — small, plain YAML or JSON)
58
29
 
59
30
  ```yaml
60
31
  phase: execution wave 2
@@ -64,274 +35,72 @@ run_meta: # FIRST packet of the run ONLY; omit thereafter
64
35
  # prsetup | prdriver | quick | grill | route |
65
36
  # brainstorm | pact | boundary | handoff | budget |
66
37
  # aftermath | export | challenge | doc | test
67
- # (`ultra` = an /orc-ultra run; the ONLY lane the orc
68
- # spine can emit besides `orc`. No other value here
69
- # is legal — a lane no entry point opens is a lane
70
- # every counting tool reports as permanently zero.)
71
38
  slug: cas-multi-exchange-withdrawal
72
39
  trace_path: .claude/orc/logs/run-orc-cas-multi-exchange-withdrawal-240726-002352.txt
73
- events: # each {ts, verb, tail}; verb from the CLOSED set below
74
- - {ts: "240726 00:28:16.220", verb: "DISPATCH orc-executor-sonnet-4-6-high",
75
- tail: "T2 pairs expect=claude-sonnet-4-6/high"}
40
+ events: # each {ts, verb, tail}; verb = the WHOLE head (`GATE grounding pass`), tail = detail only
76
41
  - {ts: "240726 00:30:39.881", verb: "VERIFY T2", tail: "actual=claude-sonnet-4-6/high ✅ MATCH"}
77
42
  decisions: > # free text — the WHY layer
78
- T2 kept at band [40,55) despite fan_out=3: the three consumers are
79
- generated. User answered "no new deps" verbatim; rejected the adapter split.
43
+ User answered "no new deps" verbatim; rejected the adapter split.
80
44
  ```
81
45
 
82
- - The packet is built from the phase's **actual working state as the phase
83
- closes** — never reconstructed later from memory.
84
- - `ts` is each event's REAL time. The writer stamps nothing itself: the block is
85
- a faithful late append of events that happened seconds ago, not an end-of-run
86
- summary. Retro sorts by stamp, not by file order.
46
+ - Build it from the phase's **actual working state as the phase closes**, never
47
+ from memory later. `ts` is each event's REAL time. An absent field is omitted.
87
48
  - Subagent-returned markers (`QUESTION`, `FINDING`, `VERDICT`, a return's
88
49
  `actual_model`) are folded into the NEXT packet, never written directly.
89
- - `VERIFY` stays an orchestrator OBLIGATION — you compare claimed vs actual and
90
- surface any ⛔ DOWNGRADE to the user in chat; only the LINE travels by packet.
91
- - The writer NEVER invents: an absent field is omitted, never guessed.
92
50
 
93
51
  ### How many packets per lane (three tiers — EVERY trace-owning lane narrates)
94
52
 
95
53
  | Tier | Lanes | Packets |
96
54
  |------|-------|---------|
97
- | Build lanes | `orc` (incl. ultra), `orc-mini`, `orc-fast` | per phase — full orc ≈ 7–9 (ultra adds U0 + judge packets); orc-mini batches to 3 (intake+plan, execution, ship); orc-fast to 2 (preflight+dispatch, gate+ship) |
98
- | Multi-dispatch | `orc-wiki`, `orc-pr-driver` (lane `prdriver`) | orc-wiki: one per scan-batch boundary (the points that already run the registration sync / offer the pause) + the end-of-run packet. orc-pr-driver: one per LAYER boundary (each layer's green gate closes) + the end-of-run packet |
99
- | Composed | `orc-diy` | one packet per ENABLED phase group, **minimum 2** — the flow shape is user-composed, so the count is too (the compiled flow carries this block automatically) |
100
- | Iterative | `orc-quick`, `orc-challenge` (lane `challenge`), `orc-doc` (lane `doc`), `orc-test` (lane `test`) | **one packet per completed numbered entry** + the end-of-run `FINISH` packet — the lane loops on user requests, so the count follows entries, not phases. For `orc-challenge` the unit is one completed ITERATION (C2→C8), and the packet goes out at the stop; on a PASS it is the `FINISH` packet. **Several trace files for one cycle is CORRECT** — several sessions ran, and `orc stats` counts several. For `orc-doc` the unit is one completed WAVE, and the packet is the LAST step of the stop sequence. For `orc-test` the unit is one completed CYCLE (T2→T9), and the packet goes out at the stop |
101
- | Single-dispatch | `orc-claude`, `orc-plan`, `orc-analyze` + `orc-analyze-mini` (both lane token `analyze`), `orc-pattern`, `orc-verify`, `orc-learn`, `orc-poly`, `orc-pr-setup` (lane `prsetup`), `orc-grill`, `orc-route`, `orc-brainstorm` (lane `brainstorm`), `orc-pact` (lane `pact`), `orc-boundary` (lane `boundary`), `orc-handoff` (lane `handoff`), `orc-budget` (lane `budget`), `orc-aftermath` (lane `aftermath`), `orc-export` (lane `export`) | **exactly ONE mandatory end-of-run packet** |
102
-
103
- **`context-combiner` is NOT a lane — it is a PHASE inside the analyze run.** It
104
- has no slash command and no entry point of its own: `orc-analyze` Phase F
105
- dispatches it while `.current` still points at that run's `run-analyze-…` file.
106
- So it never writes a pointer, never touches a trace file, and never emits its own
107
- `FINISH`; its `DISPATCH`/`RETURN`, its Phase D challenge verdicts and its
108
- conservation-gate result all fold into **orc-analyze's** end-of-run packet. The
109
- hook agrees — `context-combiner` maps to its own `PHASE-EDGE` role family
110
- (`combine`), which segments the phase *within* that trace. Listing it as a lane
111
- (as this table did before v0.42.0) declared a run nothing could ever open.
112
-
113
- **The single-packet obligation is defined HERE, once** (every trace-owning lane
114
- already loads this reference) — micro-lane spines keep only their existing trace
115
- pointer. That packet is dispatched SOLO after the lane's main return validates
116
- and BEFORE `.current` is deleted; it carries `run_meta` (so the rename repair
117
- works there too) plus the lane's whole event list: intake decisions, the user's
118
- answers, `DISPATCH`/`VERIFY`, gate/verdict lines, `FINISH`. One Haiku call per
119
- run buys the WHY layer for every lane. Haiku cost is noise against any run's
120
- executor spend.
121
-
122
- `/orc-retro` is the ONE exception: it mines traces and writes none (its hard
123
- rule 4). The hook enforces this — `orc-retro-*` dispatches never bootstrap a
124
- trace and never emit `SPAWN`/`RETURN`.
55
+ | Build lanes | `orc` (incl. ultra), `orc-mini`, `orc-fast` | per phase — full orc ≈ 7–9 (ultra adds U0 + judge packets); orc-mini batches to 3, orc-fast to 2 |
56
+ | Multi-dispatch | `orc-wiki`, `orc-pr-driver` | one per scan-batch (wiki) or LAYER (pr-driver) boundary + the end-of-run packet |
57
+ | Composed | `orc-diy` | one per ENABLED phase group, **minimum 2** |
58
+ | Iterative | `orc-quick`, `orc-challenge`, `orc-doc`, `orc-test` | **one per completed unit** (entry · iteration · wave · cycle — each spine names its unit) + the end-of-run `FINISH` packet. Several trace files for one cycle is CORRECT |
59
+ | Single-dispatch | `orc-claude`, `orc-plan`, `orc-analyze`, `orc-analyze-mini`, `orc-pattern`, `orc-verify`, `orc-learn`, `orc-poly`, `orc-pr-setup`, `orc-grill`, `orc-route`, `orc-brainstorm`, `orc-pact`, `orc-boundary`, `orc-handoff`, `orc-budget`, `orc-aftermath`, `orc-export` | **exactly ONE mandatory end-of-run packet** |
60
+
61
+ **The single-packet obligation is defined HERE, once.** That packet goes out
62
+ SOLO after the main return validates and BEFORE `.current` is deleted, with
63
+ `run_meta` plus the whole event list (intake decisions, the user's answers,
64
+ `DISPATCH`/`VERIFY`, gate/verdict lines, `FINISH`). `context-combiner` is a
65
+ PHASE of the analyze run, not a lane. `/orc-retro` writes no trace.
125
66
 
126
67
  ## Files & lifecycle
127
68
 
128
- - Folder: `log_dir` (default `.claude/orc/logs/`). Persistent — **never deleted**
129
- (deliberate opposite of the decision log). Top level holds the run `.txt` plus
130
- its sidecars (`.pending.json`, `.jsonl`); generated reports live in
131
- subfolders (`retro/`).
132
- - One file per run: **`run-<lane>-<slug>-<DDMMYY>-<HHMMSS>.txt`**, append-only.
133
- - `lane` — the trace-owning skill's short name (`orc`, `ultra`, `mini`, `fast`,
134
- `diy`, `wiki`, `analyze`, `plan`, `claude`, `poly`, `learn`, `verify`,
135
- `pattern`, `prsetup`, `prdriver`, `quick`, `grill`, `route`,
136
- `brainstorm`, `challenge`). Every value
137
- here is a lane some entry point actually opens — keep it that way: this
138
- list IS the lane vocabulary `orc stats` and `/orc-retro` count against.
139
- - `slug` — kebab-cased short user context from the intent (`[a-z0-9-]`, ≤32
140
- chars, filesystem-safe, no trailing hyphen) — same derivation as the
141
- run-folder slug.
142
- - `HHMMSS` — so two same-day runs never collide.
143
- - e.g. `run-orc-cas-multi-exchange-withdrawal-240726-002352.txt`.
144
- - The name is DATA: `/orc-retro` aggregates per lane straight from it, without
145
- parsing content.
69
+ - `log_dir` stays until `orc clear logs --apply` or the `log_retention_auto`
70
+ sweep. One append-only file per run:
71
+ **`run-<lane>-<slug>-<DDMMYY>-<HHMMSS>.txt`** — `lane` from the enum above,
72
+ `slug` `[a-z0-9-]`, ≤32 chars, no trailing hyphen.
146
73
  - Run pointer: at run start, write `log_dir/.current` containing just the trace
147
74
  filename **and `touch the trace file` of that name in the SAME step**. Both, or
148
- neither — a pointer naming a file that does not exist yet is indistinguishable
149
- from a dangling one by content alone, and that is what used to split a run
150
- across two files (a generic bootstrap holding the hook skeleton + a rich file
151
- holding every narrated line, each looking correct alone). Delete the pointer at
152
- run end (success or abort). The `orc-trace.js` hook reads it to know which file
153
- to append to, and since v0.34.2 it also honors a POINTER whose mtime is fresh
154
- even when the file is not there yet — the two fixes are independent on purpose.
155
- - **A SUSPENDED lane re-writes its pointer on RESUME.** When a lane hands control
156
- to another lane and expects it back (`_shared/lane-suspend.md`, `RETURN-TO`),
157
- the receiving lane DELETES `.current` at its own `FINISH`. So on return the
158
- suspending lane re-writes `.current` and must `touch the trace file` it names,
159
- in the SAME step — both, or neither. Otherwise every line it writes after the
160
- return goes nowhere: the v0.34.2 split-run signature, reached by a different
161
- road. Two traces for a suspend is CORRECT — two lanes ran, and `orc stats`
162
- counts two.
163
- - **Rename repair (deterministic-with-repair, not memory-only).** When no usable
164
- pointer exists as the first ORC-agent dispatch fires, the hook creates the
165
- folder + a generic `run-<DDMMYY>-<HHMMSS>.txt` and points at it. The FIRST
166
- writer dispatch repairs that. **The trigger is a DISK COMPARISON, not a
167
- remembered state:** repair when `.current` on disk DISAGREES with the packet's
168
- `run_meta.trace_path` — a rich packet name beside a generic pointer IS the
169
- clobber signature, every time — regardless of whether the pointer was ever
170
- missing. (Stated the old way — "if the pointer is missing" — writers correctly
171
- declined to repair, because that is not the state the hook actually leaves.)
172
- The repair is a **MOVE** of the `.txt` plus its `.pending.json` / `.jsonl`
173
- siblings, then a rewrite of `.current` — never a fresh create beside the
174
- bootstrap file, which splits the run's evidence in two. Non-ORC Tasks never
175
- trace — the hook only bootstraps for agent names starting with `orc`.
176
-
177
- ## Structured companion (`<trace>.jsonl`)
178
-
179
- The `.txt` stays the canonical, human-skimmable trace. The writer ALSO appends
180
- each packet event as one JSON line to `<trace>.jsonl`:
181
- `{ts, actor, phase, verb, tail, …verb-specific fields}`. `/orc-retro` mines the
182
- `.jsonl` when present — `SCORE`/`OUTCOME`/`VERIFY` aggregation becomes robust
183
- without regex over free tail text — and falls back to `.txt` parsing for older
184
- traces. Hook lines stay `.txt`-only; the two are read together.
75
+ neither — a pointer to a missing file reads as dangling and splits the run.
76
+ A lane that writes code also runs `orc run snapshot --run <run-slug>` in that
77
+ step (what `orc undo` goes back to). Delete the pointer at run end (success or abort).
78
+ - **A SUSPENDED lane re-writes its pointer on RESUME** (`_shared/lane-suspend.md`,
79
+ `RETURN-TO`): the receiving lane deleted `.current`, so re-write it and
80
+ `touch the trace file` it names, in the SAME step.
185
81
 
186
82
  ## Write cadence — append AS THE RUN GOES, never in one batch at the end
187
83
 
188
- The trace is a **running record**, not an end-of-run report. Each phase's packet
189
- goes out AT that phase's close — coupled to the next phase's first dispatch:
190
-
191
- | Moment | Packet carries |
192
- |--------|----------------|
193
- | a phase closes | that phase's events + the decisions behind them |
194
- | dispatching an agent | the `DISPATCH` line (folded into the closing phase's packet) |
195
- | a return validates | its `VERIFY` + any subagent-returned marker |
196
- | a task closes | its `OUTCOME` |
197
- | review/verify verdict | `FINDING` / `VERDICT` |
198
- | run end | `FINISH` — dispatched SOLO and returned before `.current` is deleted |
84
+ Each phase's packet goes out AT that phase's close, with that phase's events
85
+ and the decisions behind them.
199
86
 
200
87
  **Self-check:** a phase that ends with
201
88
  `zero new trace lines is a protocol violation`.
202
- The failure this prevents is a fully-executed run behind a one-line trace. If a
203
- phase went by without its packet, dispatch the writer NOW with the events' real
204
- timestamps rather than skipping them — a late block with true stamps is a late
205
- record; a block stamped "now" is a FALSE one. Batching everything at `FINISH` is
206
- the classic failure: by then the run's context is compacted and the detail is gone.
207
-
208
- ## Line format
209
-
210
- `[DDMMYY HH:MM:SS.mmm] <actor> <VERB> :: <free tail>`
211
-
212
- Fixed columns → human-skimmable now, column-parseable by a future mining tool.
213
- Actors: `hook`, `orc` (the default for a packet event with no actor), a role/agent
214
- short name (`analyst`, `planner`, `reviewer`, `verifier`, `T<n>` for an executor
215
- task), or `writer` — which means the narration agent speaking for ITSELF (its
216
- `NOTE` line), never a blanket stamp on events it was handed. **The actor is
217
- per-EVENT.** The writer copies `events[].actor` into both the `.txt` column and
218
- the `.jsonl` `actor` field, so the pair can never disagree about the same event
219
- (they did, and retro reads the `.jsonl` first).
220
-
221
- ## Verb set (CLOSED — never invent new verbs)
222
-
223
- "Emitted by" now reads **orc → writer** for the narrated verbs: the orchestrator
224
- supplies the fact in a packet, the writer writes the line. `SPAWN`, `RETURN` and
225
- `PHASE-EDGE` stay hook-owned and need no cooperation at all.
226
-
227
- | Verb | Emitted by | Meaning |
228
- |------|-----------|---------|
229
- | `PHASE <name> start\|end` | orc → writer | phase transition |
230
- | `PHASE-EDGE <role-family> :: first=<agent>` | hook | **deterministic phase inference.** ORC agent names encode their role, so when a SPAWN's role family differs from the previous SPAWN's, the hook segments the run itself — families: `recon → recon` (v1.9.0 — /orc-quick's read-only half; a question answered for a person is not an analysis), `analyst\|scout → analysis`, `planner → planning`, `executor → execution`, `reviewer → review`, `verifier → verify`, `test-author → testgen`, `advisor\|judge → ultra-gate` (the trace writer never opens an edge). Zero model dependence: even a run where every writer dispatch was forgotten still reads planning → execution → review → verify, and `/orc-retro` computes NARRATION COVERAGE from edges with vs without a writer `SPAWN` between them |
231
- | `CONFIG <key=value …>` | orc → writer | Phase 1 — the resolved config values this run will consume (ALWAYS `opus5_only` — it selects the executor table AND every fixed role, so retro can segment outcomes by dispatch mode). Runtime proof that the run honored the config; `/orc-retro` audits it against behavior |
232
- | `WIKI-CONSULT <tier> :: docs=<list>` | orc → writer | project wiki consulted for grounding (full/mini at planning; fast at slice-build) — tier ∈ `fresh` \| `aging` \| `stale` \| `absent` \| `empty`; `docs=` the pages pulled/handed to the executor (comma list) or `none`. Records whether the run grounded in the wiki and whether it was stale (surfaces grounding + staleness for later audit) |
233
- | `CROSSLINK <state> :: boundaries=<n> peers=<names>` | orc → writer | cross-repo peer-knowledge state at the consult point — state ∈ `cached` (peer cache present) \| `configured-no-cache` (crosslink configured but the cache is not built) \| `none`. Per-task `CROSSLINK inject task=<id> :: <boundary>` when a slice receives a linked contract. Records whether peer contracts were injected this run (full orc consumes only the pre-built crosslink cache — it never reads peer source live; mechanism in `wiki-consult.md`) |
234
- | `GRAPH-CONSULT <state> :: files=<n> symbols=<n>[ density=<n>[ thin=1]]` | orc → writer | the code graph's preflight state (`code-graph.md` §4) — state ∈ `fresh` \| `updated` \| `built` \| `drifted` \| `none` \| `off`. Copied VERBATIM from the `trace` field of `orc graph status --heal --json --brief`; `density=` is the named symbols per file and `thin=1` means most files hold none, so most questions asked of the graph will not find one (v1.9.1); a `GATE` line that describes the graph in other words does not replace it. Plus `GRAPH-CONSULT card task=<id> :: targets=<…>` (the `trace` of `orc graph ctx --json`, with `task=` added) when a slice receives cards |
235
- | `GRAPH-UPDATE <state> :: parsed=<n> reused=<n> deleted=<n> gen=<n> route=<n> ms=<n>` | orc → writer | one graph update at a wave close, a green smoke gate, a code-writing `/orc-quick` request, or ship — the `trace` field of `orc graph update --json`, verbatim. The graph HOOK writes its own `GRAPH-UPDATE … :: by=hook …` lines directly; never copy one of those, it is already in the file |
236
- | `GRAPH-MAP <repo|focused> :: files=<shown>/<total> [focus=<a,b>] gen=<n>` | orc → writer | ONE line at the START of planning (and at a `/orc-quick` Q1 look that had no file to name) — the `trace` field of `orc graph map --json`, verbatim. `files=` is how many the budget SHOWED over how many the repository has, so a short map can be told from a small repository. `focused` means `--focus` re-ranked the repository around what the request named. RANK is a hint about where to look first and the trace never says more than that |
237
- | `GRAPH-CHANGES <found\|none> :: symbols=<n> high=<n> medium=<n> low=<n> gen=<n>` | orc → writer | one line at review — the `trace` field of `orc graph changes --json`, verbatim. `high` counts symbols that are exported, have three or more callers and NO test reaching them |
238
- | `GRAPH-COMPLEXITY <mini-ok\|recommend-orc> :: files=<n> callers=<n> caller_files=<n> maybe=<n> tests=<n> risk=<n> cochange=<n> gen=<n>` | orc → writer | one line per `/orc-mini` run — the `trace` field of `orc graph impact … --complexity --json`, verbatim. The CLI computes the verdict from the four thresholds in `bin/graph-signals.js`; `maybe` is reported and never trips one. Mini's own `GATE complexity :: <the line>` is separate: it records what the USER chose after the offer |
239
- | `GRAPH-COCHANGE <found\|none> :: rows=<n> commits=<n>` | orc → writer | one line per planning batch, not per file — the `trace` field of `orc graph cochange --json` for the file that produced the widest answer |
240
- | `GRAPH-HINT injected=<n> subagent_start=<n> read_notes=<n> updates=<n>` | orc → writer | ONE line per phase close, not one per hint — the counters `orc-graph-hook.js` keeps in `<log_dir>/<run>.graph-hook.json`. Omitted when the file does not exist (the hook is off, or it never had anything to say) |
241
- | `GRAPH-GAIN paid=<n> low=<n> high=<n> calls=<n>` | orc → writer | ONE line per run, at ship — the `trace` field of `orc graph gain --run <trace name> --json`, verbatim. `paid` is exact (the tokens the graph put in); `low`/`high` are an ESTIMATE of the retrieval it kept out, and they are never collapsed into one number. Omitted when the ledger is empty or the graph is off |
242
- | `GRAPH-NOTES <applied\|below-min\|none\|deferred\|off\|skipped> :: <detail>` | orc → writer | one notes batch: the noter's ONE-line return copied verbatim (`applied`), the `trace` field of `orc graph notes pending --json` when it exited 3 or 5, `skipped` under the Opus-5-only mode |
243
- | `SPAWN <agent>` | hook | an agent dispatch was observed (skeleton) |
244
- | `RETURN <agent> :: <desc> dur=<m>m<s>s [model=<id>]` | hook | a subagent finished (skeleton). The hook attributes the RETURN to the finishing agent from the SubagentStop payload (`~<agent>` = approximate FIFO match on older Claude Code that omits `agent_type`; `~agent :: unattributed` = ≥2 agents in flight, so it deliberately claimed NO pending record rather than starve the right one), echoes the SPAWN's desc + wall-clock duration, and appends `model=<id>` when the return's `actual_model` is visible in the last message. A duplicate stop for an agent whose record was already consumed is DROPPED, never written as a desc-less RETURN. Still hook-written skeleton — NOT an orchestrator obligation; the authoritative model check is the `VERIFY` line |
245
- | `DISPATCH <agent> :: <task> expect=<model>/<effort>` | orc → writer | orchestrator dispatched a named agent (the claim). **A FOREIGN dispatch appends `via=extra:<profile>`** and its `expect=` names the profile's model rather than a Claude tier — additive, the way `/orc-doc`'s `sections=` was. A foreign worker is not a Claude subagent, so the hook emits NO `SPAWN` and NO `RETURN` for it (P7, the `/orc-quick` ad-hoc-recon precedent): this line and `EXTRA` are the whole record, which is why neither is optional. **The `/orc-doc` lane's tail NAMES ITS SECTIONS** (v0.49.2) — `doc write sections=03-scope,04-risks part=sections/03-scope.md`, `doc check sections=03-goals`, `doc digest source=<path>` — which is the only thing that makes `orc doc cost`'s per-section attribution honest rather than a guess. It is additive: the tail was already captured whole |
246
- | `SCORE task=<id> score=<n> band=<range> model=<m> facets=<compact-vector> :: <reason>` | orc → writer | scoring decision (tunes the rubric). **A task the resolver sent foreign appends `via=extra:<profile>`**, and `model=` is the foreign model id — so `/orc-retro` can segment a band's outcomes by WHO ran it. `facets=` is the planner-emitted vector (breadth·novelty·logic·test·fan·unc·risk) the score was computed from — `/orc-retro` reads it to recalibrate the formula. Fix-cycle dispatches emit `SCORE task=fix-<n> …` the same way |
247
- | `VERIFY <task> actual=<model>/<effort> ✅ MATCH` / `⛔ DOWNGRADE expected=<m>/<e>` | orc → writer | claimed-vs-actual model check (the COMPARISON stays the orchestrator's obligation — surface a downgrade to the user, not just the trace) |
248
- | `QUESTION count=<n> :: <topic>` | subagent→orc → writer | stopped to ask the user |
249
- | `CONTEXT-GAP :: <what was already known>` | subagent→orc → writer | asked/re-derived something already in context |
250
- | `REPLAN wave=<n> :: <reason>` | orc → writer | re-planned after a conflict/failure |
251
- | `GATE <name> pass\|bounce\|escalate :: <detail>` | orc → writer | exit-gate result — name ∈ grounding \| coverage \| graph \| evidence \| derivation \| facet (the plan's facet-vocabulary check, `effort-and-mode.md`) \| schema (the plan-handoff schema check) \| judgment (ultra; `escalate` is judgment-only) \| wave-boundary \| budget (the Phase-1 `run_budget_dispatches` forecast gate — `pass` or the `stop` that blocks wave 1; emitted only when the key is > 0) \| stack-gate (Phase 8 stacked-PR threshold + handoff) \| stack-certainty (a stacked-PR seam decision) \| layer-green (one layer's green-gate ladder). The shared-band SIBLING-CONSISTENCY determination is NOT a gate name — carry it in the packet's `decisions`, never as an invented verb. Bounce detail lists the misses (feeds `/orc-retro` gate-bounce rates) |
252
- | `ADVISE :: brief=<path> questions=<n>` | orc → writer | ultra Phase U0 — advisor brief received, clarification round relayed |
253
- | `JUDGE <gate> <verdict> round=<n> blocking=<n> advisory=<n> downgraded=<n>` | orc → writer | ultra judgment verdict (gate ∈ analysis \| plan \| implementation) |
254
- | `OUTCOME task=<id> score=<n> band=<range> model=<m> retries=<n> requeues=<n> needs_context=<n> unmet=<n>` | orc → writer | task closed — links the scoring band to what it actually took (feeds `/orc-retro` calibration) |
255
- | `FINDING p0=<n> p1=<n> p2=<n> p3=<n>` | reviewer→orc → writer | review outcome (P0–P3 severity ladder) |
256
- | `VERDICT pass\|fail :: <detail>` | verifier→orc → writer | verification outcome |
257
- | `DRIFT loop=<n> :: <user description, compressed>` | orc → writer | mock-example drift-recovery loop opened (`PHASE mock-example`; canonical `_shared/drift-recovery.md`; hard cap 2 loops) |
258
- | `TDD-RED task=<id> iter=<n> :: <failing tests>` | executor→orc → writer | TDD repair-loop iteration — the plan's acceptance tests still red (cap `tdd_loop_max`; a paired TDD task's red proof also emits iter=0) |
259
- | `TDD-GREEN task=<id> iter=<n>` | executor→orc → writer | the task's TDD acceptance tests pass (the non-exempt definition-of-done) |
260
- | `REPRO red\|green :: <cmd> exit=<n>` | executor→orc → writer | a DEFECT task's reproduction, before and after the fix (`_shared/return-validation.md` §5d). TWO lines per reproduced defect, in this order: the `before` run must be RED and the `after` run GREEN, or the return was malformed. `REPRO none :: <reason>` when no reproduction could be written — an honest answer, never a missing line. A reproduction is NOT a plan-time acceptance test, so it never reuses `TDD-RED`/`TDD-GREEN`: `/orc-retro` counts "we proved the bug first" apart from "we drove the plan's acceptance tests" |
261
- | `NOTE :: <decisions>` | writer | the packet's `decisions` field — the WHY layer (scoring rationale, user answers verbatim, what was rejected). One line per packet, only when `decisions` is non-empty |
262
- | `STATS lane=<l> slug=<s> dispatches=<n> waves=<n> tasks=<n> bands=<h:n,m:n,l:n> downgrades=<n> duration_ms=<n>` | orc → writer | ONE deterministic summary line per run, in the `FINISH` packet, immediately BEFORE the `FINISH` line. This is what `orc stats` reads — one line per file, never a parse of the whole trace. Omit a field you genuinely do not have (a lane with no waves omits `waves=`); never guess one. Every trace-owning lane emits it, not just `orc` |
263
- | `PACT <state> :: <ids>` | orc → writer | invariant-ledger state at the Phase-1 probe (`pact_gate`), and `PACT inject task=<id> :: <PACT-id>` when a DRIFTED/BROKEN promise is appended to a task's `constraints[]`. `PACT recheck pass\|fail :: <ids>` at Phase 6. Records whether last month's decisions constrained this month's plan |
264
- | `BOUNDARY <verdict> task=<id> :: <area>` | orc → writer | per-task boundary verdict (verdict ∈ `EXECUTE` \| `ESCALATE` \| `REFUSE` \| `unknown` — an uncarded area is UNKNOWN, never REFUSE), plus `BOUNDARY lift task=<id> :: <area>` when `boundary_gate: block` removes ONE task from a wave (the wave still runs). `/orc-retro` reads these to answer the question the lane exists for: how much work did we stop attempting, and was that right |
265
- | `CHALLENGE iter=<n> findings=P0:<n>/P1:<n>/P2:<n> coverage=<n>% verdict=PASS\|FAIL` | orc → writer | one line per completed `/orc-challenge` iteration boundary. **Copy `orc challenge record`'s `trace_line` verbatim** — the CLI assembles it so the lane never composes a second wording for the same number. Plus `CHALLENGE accept :: <id>` and `CHALLENGE rebut :: <id>` when an escape valve is used, and `CHALLENGE regoal\|retemplate :: v<n>` on a re-freeze. `/orc-retro` reads the sequence to answer whether a cycle converged or stalled |
266
- | `EXTRA <profile>/<model> engine=<api\|claude-shim\|cli> task=<id> band=[lo,hi) tok=in/cw/cr/out outcome=<done\|partial\|failed\|fallback> dur=<m>m<s>s` | orc → writer | one line per FOREIGN dispatch — a slice that executed on a non-Claude worker (`_shared/extra-dispatch.md`). **Copy `orc extra dispatch`'s `trace_line` verbatim** — the CLI assembles it, exactly as `orc challenge record` does, so the lane never composes a second wording for the same numbers. Plus `EXTRA fallback task=<id> :: <reason> → <agent>` when a failed foreign dispatch re-dispatches to Claude (P6), `EXTRA substitution task=<id> :: requested=<m> reported=<m>` / `EXTRA reroute task=<id> :: <providers>` when the endpoint answered with a different model, or the same model served by a different company, and — v0.54.0 — `EXTRA resume task=<id> attempt=<n> :: from=<reason> attribution=<verdict> target=<extra:profile\|agent> files_preexisting=<n>` when a dispatch CONTINUES a position an earlier attempt left on disk, plus `EXTRA orphan task=<id> :: attempt=<n> lease-expired files_changed=<n> state=<state>` when preflight reports a dispatch that never reported back, and — v1.0.0 — `EXTRA demote run=<slug> :: profile=<p> reason=<consecutive-stall\|stale-live-attempt\|manual> n=<k> → <ladder>` when this run DROPS a foreign profile to the bottom of the ladder after two consecutive stalls, a stale live attempt, or `orc extra demote`. **A demotion that leaves no line cannot be counted** either — copy `orc extra demotion`’s `trace_line` VERBATIM and emit it before the next dispatch, beside the mandatory announce line. A demotion is RUN state: it never writes the config and it is never promoted back on its own. **A resume that leaves no line cannot be counted** — neither `orc extra stats` nor `/orc-retro` can then learn whether resuming works, or which providers ignore the resume preamble. `EXTRA resume` rides in the resumed dispatch's own `trace_extras[]`; `EXTRA orphan` is the LANE's to emit after it reports, the same ownership rule as `EXTRA fallback`. **`tok=none` is a real value** and the ONLY correct one when the worker reported no counts (engine `cli` often does not): `tok=0/0/0/0` would tell `/orc-budget` the run was free, while a measured zero — engine `api`'s `cw`, always — is a different fact. **On a lane with no score `band=` carries `slot:<slot>`** (v0.55.0 — `slot:doc-writer`, `slot:wiki-scanner-light`): the field NAME is unchanged, so this parser, the eight-field dedupe and the ` :: ` tolerance are untouched, and `orc extra stats` gives each POSITION its own row for free. This is the verb `/orc-retro` reads to answer the only question that matters: is the cheap model actually cheaper once you count the repairs |
267
- | `FINISH :: <detail>` | orc → writer | run ended |
268
-
269
- `SPAWN`/`RETURN`/`PHASE-EDGE` come from the hook automatically. Every other verb
270
- reaches the file through a packet — you never append lines by hand.
271
-
272
- ### Why `STATS` exists as its own line (v0.42.0)
273
-
274
- `orc stats` counts usage from these files. Lane and date are free — they are in
275
- the filename, which is already DATA. Everything else would cost a full parse of
276
- a 20-minute trace, per run, forever. One deterministic line at a step that
277
- already exists makes the depth free instead: `orc stats` reads the tail of each
278
- file and nothing more.
279
-
280
- Two consequences to keep true, because a counting tool built on a drifting log
281
- produces confident WRONG numbers, which is worse than no numbers:
282
-
283
- - **A run with no `FINISH` is counted as unfinished, permanently.** That is
284
- correct behaviour and it is why `FINISH` is mandatory even on an abort.
285
- - **A trace older than v0.42.0 has no `STATS` line.** `orc stats` falls back to
286
- counting `DISPATCH` lines — orchestrator-written and present in every lane
287
- (including `/orc-quick`, whose ad-hoc recon emits no `SPAWN`/`RETURN`). Old
288
- traces still count, with less detail. Never back-fill a `STATS` line into an
289
- old trace: the numbers would be invented, and the trace is append-only.
290
-
291
- **Skeleton caveat (read every retro metric with it):** the hook only sees a NEW
292
- dispatch. CONTINUING an already-running agent fires no PreToolUse/SubagentStop
293
- pair, so a lane driven by continuing one agent produces fewer `SPAWN`/`RETURN`
294
- lines than it did real work. The skeleton is a FLOOR on dispatch volume, never a
295
- census — narration coverage computed from it reads low, not wrong.
296
-
297
- ## Model source of truth — the claimed-vs-actual check
298
-
299
- A hook cannot read a subagent's model id (it lives only in the subagent's system
300
- prompt). So each dispatched agent returns two fields (see each agent's return
301
- contract):
302
-
303
- - `actual_model` — **quoted verbatim** from the agent's injected system-prompt
304
- model-id line ("The exact model ID is …"). Never a guess; `unknown` if absent.
305
- - `actual_effort` — the value of `$CLAUDE_EFFORT` (env var, read via Bash).
306
-
307
- For each spawn the orchestrator:
308
- 1. Derives the **expected** `(model, effort)` from the dispatched agent NAME via
309
- the `config.md` score→model table / `MODEL-MAPPING.md`.
310
- 2. Compares against the returned `actual_*` and puts a `VERIFY` line in the next
311
- packet — `✅ MATCH` or `⛔ DOWNGRADE`. A downgrade (the harness capped a high
312
- pin to the main-session tier) is surfaced to the user, not just logged.
313
-
314
- ## Announce-on-spawn
315
-
316
- When dispatching, announce the model to the user, derived from the agent NAME
317
- (e.g. "Spawning orc-executor-opus-5-low → claude-opus-5-5 / low"). Derive it
318
- from the name — do NOT pass the coarse `sonnet|opus|haiku` dispatch arg, which
319
- cannot express 4-7 vs 4-8 and would override the frontmatter pin.
320
-
321
- ## Compaction safety
322
-
323
- The checkpoint carries `logging_enabled` + `trace_path`. On resume, re-read them
324
- and continue dispatching packets against the same file. The hook backbone keeps
325
- emitting `SPAWN`/`RETURN`/`PHASE-EDGE` regardless of orchestrator memory, so a
326
- compacted run is never blind — at worst it loses the WHY layer for one phase.
327
- `/orc-ultra` is the `orc` skill with `ultra_mode: true`; its packets are just
328
- orc's plus the U0/judge ones.
329
-
330
- ## Write discipline
331
-
332
- - Append-only; one whole block per append (never edit prior lines).
333
- - The trace records behavior faithfully — including the ugly bits (over-asking,
334
- downgrades, failed waves). That honesty is the whole value.
89
+ If a phase went by without its packet, write it NOW with the events'
90
+ real timestamps — a block stamped "now" is a FALSE record. Never batch
91
+ everything at `FINISH`. **A run with no `FINISH` counts as unfinished,
92
+ permanently** — `FINISH` is mandatory even on an abort.
93
+
94
+ ## Model check, announce, compaction
95
+
96
+ - **Claimed vs actual.** Compare each return's `actual_model` / `actual_effort`
97
+ with the pair the agent NAME implies; put a `VERIFY` line in the next packet
98
+ and surface a ⛔ DOWNGRADE to the user in chat.
99
+ - **Announce-on-spawn** from the agent NAME ("Spawning orc-executor-opus-5-low →
100
+ claude-opus-5-5 / low"); never pass the coarse `sonnet|opus|haiku` arg.
101
+ - **Compaction.** The checkpoint carries `logging_enabled` + `trace_path`; on
102
+ resume, keep writing to the same file. `/orc-ultra` = `orc` + `ultra_mode: true`.
103
+ - Append-only, one whole block per append. Record the ugly bits too.
335
104
 
336
105
  <!-- /orc:layer -->
337
106
 
@@ -348,20 +117,20 @@ be the one lane that runs blind.
348
117
  `run-diy-<slug>-<DDMMYY>-<HHMMSS>.txt` AND `touch the trace file` of that name
349
118
  in the SAME step (a pointer naming a file that does not exist reads as dangling —
350
119
  the hook rotates away from it and the run splits across two files), then store
351
- `trace_path` in the checkpoint. The lane token is `diy`, whatever the flow is
120
+ `trace_path` in the checkpoint and run `orc run snapshot --run <run-slug>`. The lane token is `diy`, whatever the flow is
352
121
  named.
353
122
 
354
- **Narration is dispatched, never remembered:** record each event with its REAL
355
- timestamp into a phase packet (`PHASE`, `DISPATCH`/`VERIFY` per spawn —
123
+ **Narration is written by the CLI, never remembered:** record each event with
124
+ its REAL timestamp into a phase packet (`PHASE`, `DISPATCH`/`VERIFY` per spawn —
356
125
  `actual_model`/`actual_effort` vs expected, surface any ⛔ DOWNGRADE to the user
357
126
  — `SCORE`, `OUTCOME`, `GATE`, `FINDING`/`VERDICT` for whichever gates this flow
358
- enabled, `FINISH`, plus `decisions` = the WHY), then dispatch
359
- `orc-trace-writer-haiku-4-5` with it, PAIRED with the next phase's first
360
- dispatch. **One packet per ENABLED phase group, minimum 2** — the flow shape is
127
+ enabled, `FINISH`, plus `decisions` = the WHY), then pipe it to
128
+ `orc trace write --packet -` (exit ≠ 0 → `orc-trace-writer-haiku-4-5`), PAIRED
129
+ with the next phase's first dispatch. **One packet per ENABLED phase group, minimum 2** — the flow shape is
361
130
  composed, so the packet count is too; a phase this flow turned OFF owes nothing.
362
131
  A phase ending with `zero new trace lines is a protocol violation`.
363
132
 
364
- **Run end:** the `FINISH` packet goes out and RETURNS, then delete
133
+ **Run end:** write the `FINISH` packet, then delete
365
134
  `log_dir/.current`.
366
135
 
367
136
  <!-- /orc:layer -->
@@ -1,70 +1,62 @@
1
- # Phase — Verify — TDD gate + adversarial review (id: `verify`)
2
-
3
- > **Shared phase file.** Moved out of `orc/SKILL.md` at v1.0.0 W12, and into
4
- > this library at W13 when `orc-diy` became its second reader. A spine is loaded
5
- > IN FULL when its skill activates; this is loaded when the phase fires, and most
6
- > runs skip most phases.
7
- >
8
- > **Two layers, and a lane reads exactly one.** `full` is `/orc`'s procedure.
9
- > `composed` is what `orc diy compile` stitches — the same phase expressed as
10
- > `<!-- diy:when -->` variants over a composed flow, NOT a second copy of the
11
- > procedure. Reading the wrong one is the failure `README.md` names: a lane
12
- > doing a phase its product promise says it does differently.
13
- > `orc lane phases <lane> --json` names the layer for each lane.
14
-
15
- <!-- orc:layer full -->
16
-
17
- ## Verify: TDD gate + adversarial review (same subskill, phase=verify)
18
-
19
- Emit `PHASE verify start`. TWO halves in the SAME dispatched verifier slot
20
- (../../orc/subskills/orc-review-verify/ — Phase 5's reviewer stays separate):
21
- **1) TDD gate (deterministic):** run the plan's TDD suite — green IS the
22
- definition-of-done for non-exempt requirements; red → repair loop (implement→
23
- test→repair, cap `tdd_loop_max`; cap hit → STOP SEQUENCE + honest red report).
24
- **2) Adversarial review:** attack the green implementation — edge cases the
25
- spec missed, error paths, contract violations, race/ordering, workflow breaks
26
- (dead wiring, broken commands) — findings on the existing P0–P3 ladder. The
27
- verifier also checks the intent-spec's
28
- definition-of-done PLUS the pattern's `validation_gate[]` lines (each a
29
- criterion; unmet = P0). The return carries `criteria[]` {criterion, pass|fail,
30
- evidence} — every criterion needs evidence. Quote spot-check P0/P1 first, then:
31
- P0 → auto-fix once → re-verify once → second failure STOPS; P1 → ask before the
32
- one fix attempt, then re-verify (same single-retry cap).
33
- **Pact recheck (`pact_recheck_on_verify`, default true; emit `PACT recheck`):**
34
- after GREEN, run `orc pact check` scoped to the promises whose anchors intersect
35
- this run's CHANGED files. A promise that flips to BROKEN is a **P1 finding with its
36
- check output** — reported, never an automatic abort: the ledger may simply have
37
- outgrown the code, and that is the user's call. Emit
38
- `VERDICT pass|fail :: <detail>`, then `PHASE verify end`.
39
-
40
- <!-- /orc:layer -->
41
-
42
- <!-- orc:layer composed -->
43
-
44
- ## Phase: Verify
45
-
46
- <!-- diy:when verify=off -->
47
- Verification is DISABLED in this flow. The build+test evidence in each
48
- executor return is the only green signal; say "verify skipped by flow
49
- config" in the summary. Never claim criteria were verified.
50
- <!-- /diy:when -->
51
- <!-- diy:when verify=smoke -->
52
- Run a SMOKE verify only: dispatch the verifier
53
- (`orc-verifier-opus-5-med`) with an explicitly narrowed scope — build +
54
- full test suite, red/green verdict, NO per-criterion definition-of-done
55
- sweep. Red blocks ship exactly as a full verify would.
56
- <!-- /diy:when -->
57
- <!-- diy:when verify=full -->
58
- Dispatch verification exactly as the full lane does — follow the verify half
59
- of `.claude/skills/orc/subskills/orc-review-verify/SKILL.md` (build + tests +
60
- every acceptance criterion checked against the definition of done).
61
- <!-- /diy:when -->
62
- <!-- diy:when tdd=on -->
63
- TDD gate (rides the verify slot): the verifier slice carries the plan's
64
- `tdd_suite[]`; green is the definition-of-done for non-exempt requirements,
65
- red → the repair loop capped at `tdd_loop_max` (cap hit → STOP + honest red
66
- report). The adversarial half of the verify pass applies as the full lane
67
- defines it.
68
- <!-- /diy:when -->
69
-
70
- <!-- /orc:layer -->
1
+ # Phase — Verify — TDD gate + adversarial review (id: `verify`)
2
+
3
+ > **Shared phase file** — read when the phase fires. A lane reads ONE layer: `full` (`/orc`) or `composed` (the `<!-- diy:when -->` variants `orc diy compile` stitches). `orc lane phases <lane> --json` names it.
4
+
5
+ <!-- orc:layer full -->
6
+
7
+ ## Verify: TDD gate + adversarial review (same subskill, phase=verify)
8
+
9
+ Emit `PHASE verify start`. TWO halves in the SAME dispatched verifier slot
10
+ (../../orc/subskills/orc-review-verify/ — Phase 5's reviewer stays separate):
11
+ **1) TDD gate (deterministic):** run the plan's TDD suite — green IS the
12
+ definition-of-done for non-exempt requirements; red → the flaky check
13
+ (`../smoke-gate.md` §Flaky: exit 0 = not red, no round), then the repair loop (implement→
14
+ test→repair, cap `tdd_loop_max`; cap hit → STOP SEQUENCE + honest red report).
15
+ **2) Adversarial review:** attack the green implementation — edge cases the
16
+ spec missed, error paths, contract violations, race/ordering, workflow breaks
17
+ (dead wiring, broken commands) — findings on the existing P0–P3 ladder. The
18
+ verifier also checks the intent-spec's
19
+ definition-of-done PLUS the pattern's `validation_gate[]` lines (each a
20
+ criterion; unmet = P0). The return carries `criteria[]` {criterion, pass|fail,
21
+ evidence} — every criterion needs evidence. Quote spot-check P0/P1 first, then:
22
+ P0 → auto-fix once → re-verify once → second failure STOPS; P1 → ask before the
23
+ one fix attempt, then re-verify (same single-retry cap).
24
+ **Pact recheck (`pact_recheck_on_verify`, default true; emit `PACT recheck`):**
25
+ after GREEN, run `orc pact check` scoped to the promises whose anchors intersect
26
+ this run's CHANGED files. A promise that flips to BROKEN is a **P1 finding with its
27
+ check output** — reported, never an automatic abort: the ledger may simply have
28
+ outgrown the code, and that is the user's call. Emit
29
+ `VERDICT pass|fail :: <detail>`, then `PHASE verify end`.
30
+
31
+ <!-- /orc:layer -->
32
+
33
+ <!-- orc:layer composed -->
34
+
35
+ ## Phase: Verify
36
+
37
+ <!-- diy:when verify=off -->
38
+ Verification is DISABLED in this flow. The build+test evidence in each
39
+ executor return is the only green signal; say "verify skipped by flow
40
+ config" in the summary. Never claim criteria were verified.
41
+ <!-- /diy:when -->
42
+ <!-- diy:when verify=smoke -->
43
+ Run a SMOKE verify only: dispatch the verifier
44
+ (`orc-verifier-opus-5-med`) with an explicitly narrowed scope — build +
45
+ full test suite, red/green verdict, NO per-criterion definition-of-done
46
+ sweep. Red blocks ship exactly as a full verify would.
47
+ <!-- /diy:when -->
48
+ <!-- diy:when verify=full -->
49
+ Dispatch verification exactly as the full lane does — follow the verify half
50
+ of `.claude/skills/orc/subskills/orc-review-verify/SKILL.md` (build + tests +
51
+ every acceptance criterion checked against the definition of done).
52
+ <!-- /diy:when -->
53
+ <!-- diy:when tdd=on -->
54
+ TDD gate (rides the verify slot): the verifier slice carries the plan's
55
+ `tdd_suite[]`; green is the definition-of-done for non-exempt requirements,
56
+ red → the flaky check
57
+ (`.claude/skills/_shared/smoke-gate.md` §Flaky), then the repair loop capped at `tdd_loop_max` (cap hit → STOP + honest red
58
+ report). The adversarial half of the verify pass applies as the full lane
59
+ defines it.
60
+ <!-- /diy:when -->
61
+
62
+ <!-- /orc:layer -->