@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
@@ -0,0 +1,447 @@
1
+ # Phase reference — Trace verbs (id: `trace-verbs`)
2
+
3
+ > **Library file, read ON DEMAND** — only for a verb not in `orc lane phases <lane> --json` → `trace_grammar`, or for a verb's detail. Data: `TRACE_VERBS` in `bin/cli.js`; `npm run verify` fails when they disagree or a phase lists an unknown verb.
4
+
5
+ <!-- orc:layer core -->
6
+
7
+ ## Verb set (CLOSED — never invent new verbs)
8
+
9
+ "Emitted by" now reads **orc → writer** for the narrated verbs: the orchestrator
10
+ supplies the fact in a packet, the writer writes the line. `SPAWN`, `RETURN` and
11
+ `PHASE-EDGE` stay hook-owned and need no cooperation at all. ` · ` separates the
12
+ sub-forms of one verb. "Owner" is the file that holds the detail; a verb whose
13
+ owner is this file has its detail in "Verb detail" below.
14
+
15
+ | Verb | Emitted by | Meaning | Owner |
16
+ |------|-----------|---------|-------|
17
+ | `PHASE <name> start\|end` | orc → writer | phase transition | `_shared/phases/trace.md` |
18
+ | `PHASE-EDGE <role-family> :: first=<agent>` | hook | deterministic phase inference: a SPAWN whose role family differs from the previous one opens an edge | `hooks/orc-trace.js` |
19
+ | `CONFIG <key=value …>` | orc → writer | Phase 1 — the resolved config values this run will consume, ALWAYS with opus5_only | `_shared/phases/trace-verbs.md` |
20
+ | `WIKI-CONSULT <fresh\|aging\|stale\|absent\|empty> :: docs=<list\|none>` | orc → writer | project wiki consulted for grounding, with its staleness tier | `_shared/phases/wiki-consult.md` |
21
+ | `CROSSLINK <cached\|configured-no-cache\|none> :: boundaries=<n> peers=<names> · CROSSLINK inject task=<id> :: <boundary>` | orc → writer | cross-repo peer-knowledge state at the consult point; `inject` when a slice receives a linked contract | `_shared/phases/wiki-consult.md` |
22
+ | `GRAPH-CONSULT <fresh\|updated\|built\|drifted\|none\|off> :: files=<n> symbols=<n>[ density=<n>[ thin=1]] · GRAPH-CONSULT card task=<id> :: targets=<…>` | orc → writer | the code graph's preflight state, copied VERBATIM from the CLI `trace` field | `_shared/code-graph.md` |
23
+ | `GRAPH-UPDATE <state> :: parsed=<n> reused=<n> deleted=<n> gen=<n> route=<n> ms=<n>` | orc → writer | one graph update, the `trace` field of `orc graph update --json`, verbatim | `_shared/phases/trace-verbs.md` |
24
+ | `GRAPH-MAP <repo\|focused> :: files=<shown>/<total> [focus=<a,b>] gen=<n>` | orc → writer | ONE line at the start of planning, the `trace` field of `orc graph map --json`, verbatim | `_shared/phases/trace-verbs.md` |
25
+ | `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 | `_shared/phases/trace-verbs.md` |
26
+ | `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 the `--complexity` impact call, verbatim | `_shared/phases/trace-verbs.md` |
27
+ | `GRAPH-COCHANGE <found\|none> :: rows=<n> commits=<n>` | orc → writer | one line per planning batch, for the file that produced the widest answer | `_shared/phases/trace-verbs.md` |
28
+ | `GRAPH-HINT injected=<n> subagent_start=<n> read_notes=<n> updates=<n>` | orc → writer | ONE line per phase close, the graph hook's counters; omitted when the counter file does not exist | `_shared/phases/trace-verbs.md` |
29
+ | `GRAPH-GAIN paid=<n> low=<n> high=<n> calls=<n>` | orc → writer | ONE line per run at ship; `paid` is exact, `low`/`high` are an estimate never collapsed into one number | `_shared/phases/trace-verbs.md` |
30
+ | `GRAPH-NOTES <applied\|below-min\|none\|deferred\|off\|skipped> :: <detail>` | orc → writer | one notes batch; `applied` copies the noter's one-line return verbatim | `_shared/phases/trace-verbs.md` |
31
+ | `SPAWN <agent>` | hook | an agent dispatch was observed (skeleton) | `hooks/orc-trace.js` |
32
+ | `RETURN <agent> :: <desc> dur=<m>m<s>s [model=<id>]` | hook | a subagent finished (skeleton) — not an orchestrator obligation; the model check is VERIFY | `hooks/orc-trace.js` |
33
+ | `DISPATCH <agent> :: <task> expect=<model>/<effort>[ via=extra:<profile>]` | orc → writer | orchestrator dispatched a named agent (the claim) | `_shared/phases/trace-verbs.md` |
34
+ | `SCORE task=<id> score=<n> band=<range> model=<m> facets=<compact-vector>[ via=extra:<profile>] :: <reason>` | orc → writer | scoring decision (tunes the rubric); a fix cycle emits `task=fix-<n>` | `_shared/phases/scoring.md` |
35
+ | `VERIFY <task> actual=<model>/<effort> ✅ MATCH · VERIFY <task> actual=<model>/<effort> ⛔ DOWNGRADE expected=<m>/<e>` | orc → writer | claimed-vs-actual model check; surface a downgrade to the user, not just the trace | `_shared/return-validation.md` |
36
+ | `ASK <qid> :: offered=<o1\|o2\|…> rec=<o\|none> chose=<o\|other> by=<user\|ledger\|learned\|config\|default> [pre=<o>] [ctx=<k=v,…>]` | orc → writer | one answered decision point — what `orc habit` learns from; the free text of an `other` answer is never stored | `_shared/phases/trace-verbs.md` |
37
+ | `QUESTION count=<n> :: <topic>` | subagent→orc → writer | stopped to ask the user | `_shared/phases/trace-verbs.md` |
38
+ | `CONTEXT-GAP :: <what was already known>` | subagent→orc → writer | asked/re-derived something already in context | `_shared/phases/trace-verbs.md` |
39
+ | `REPLAN wave=<n> :: <reason>` | orc → writer | re-planned after a conflict/failure | `_shared/phases/trace-verbs.md` |
40
+ | `GATE <grounding\|coverage\|graph\|evidence\|derivation\|facet\|schema\|judgment\|wave-boundary\|budget\|stack-gate\|stack-certainty\|layer-green> pass\|bounce\|escalate :: <detail>` | orc → writer | exit-gate result; `escalate` is judgment-only; bounce detail lists the misses | `_shared/phases/trace-verbs.md` |
41
+ | `ADVISE :: brief=<path> questions=<n>` | orc → writer | ultra Phase U0 — advisor brief received, clarification round relayed | `orc/references/ultra-mode.md` |
42
+ | `JUDGE <analysis\|plan\|implementation> <verdict> round=<n> blocking=<n> advisory=<n> downgraded=<n>` | orc → writer | ultra judgment verdict | `orc/references/ultra-mode.md` |
43
+ | `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 | `_shared/phases/execution.md` |
44
+ | `FINDING p0=<n> p1=<n> p2=<n> p3=<n>[ pre=<n> suppressed=<n> folded=<n>]` | reviewer→orc → writer | review outcome (P0–P3 severity ladder); the tail counts the after-filter's buckets | `_shared/phases/review.md` |
45
+ | `FINDING-OUTCOME addressed=<n> disputed=<n> wontfix=<n> open=<n> pre=<n> suppressed=<n> :: <cat>:<addressed>/<total>,…` | orc → writer | ONE line at review close (a clean review too) — what became of each finding; `orc gotcha quality` counts it as a review | `_shared/phases/trace-verbs.md` |
46
+ | `REVIEW-WHICH chose=<orc\|project\|skip> name=<the review the rule names> by=<user\|ledger\|learned> :: <file:line of the rule>` | orc → writer | the answer to §0 "which review" when the project names its own review — written ALWAYS, also under habits off; the FINISH nudge reads it | `_shared/phases/trace-verbs.md` |
47
+ | `FIX source=<sonar\|ci\|defect\|pr\|review\|other> introduced_by=<orc\|ai\|human\|unknown> by=<user\|evidence> obs=<id8>[ missed_by=<run>] :: <path:lines> <rule or finding>` | cli | one fix recorded by `orc fix record` (/orc-fix) into the HOST run's trace — the CLI writes it, never a packet | `orc-fix/SKILL.md` |
48
+ | `VERDICT pass\|fail :: <detail>` | verifier→orc → writer | verification outcome | `_shared/phases/verify.md` |
49
+ | `DRIFT loop=<n> :: <user description, compressed>` | orc → writer | mock-example drift-recovery loop opened (hard cap 2 loops) | `_shared/drift-recovery.md` |
50
+ | `TDD-RED task=<id> iter=<n> :: <failing tests>` | executor→orc → writer | TDD repair-loop iteration — the plan's acceptance tests still red | `_shared/phases/trace-verbs.md` |
51
+ | `TDD-GREEN task=<id> iter=<n>` | executor→orc → writer | the task's TDD acceptance tests pass | `_shared/phases/trace-verbs.md` |
52
+ | `REPRO red\|green :: <cmd> exit=<n> · REPRO none :: <reason>` | executor→orc → writer | a DEFECT task's reproduction: RED before the fix, GREEN after | `_shared/return-validation.md` |
53
+ | `NOTE :: <decisions>` | writer | the packet's `decisions` field — the WHY layer; one line, only when non-empty | `agents/orc-trace-writer-haiku-4-5.md` |
54
+ | `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 summary line per run, in the FINISH packet, immediately BEFORE the FINISH line | `_shared/phases/trace-verbs.md` |
55
+ | `PACT <state> :: <ids> · PACT inject task=<id> :: <PACT-id> · PACT recheck pass\|fail :: <ids>` | orc → writer | invariant-ledger state at the Phase-1 probe, a promise injected into a task, the Phase-6 recheck | `orc-pact/references/gate.md` |
56
+ | `BOUNDARY <EXECUTE\|ESCALATE\|REFUSE\|unknown> task=<id> :: <area> · BOUNDARY lift task=<id> :: <area>` | orc → writer | per-task boundary verdict; an uncarded area is `unknown`, never REFUSE | `orc-boundary/references/gate.md` |
57
+ | `CHALLENGE iter=<n> findings=P0:<n>/P1:<n>/P2:<n> coverage=<n>% verdict=PASS\|FAIL · CHALLENGE accept\|rebut :: <id> · CHALLENGE regoal\|retemplate :: v<n>` | orc → writer | one line per completed /orc-challenge iteration — `orc challenge record`'s `trace_line`, verbatim | `orc-challenge/SKILL.md` |
58
+ | `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 · EXTRA fallback task=<id> :: <reason> → <agent> · EXTRA substitution task=<id> :: requested=<m> reported=<m> · EXTRA reroute task=<id> :: <providers> · EXTRA resume task=<id> attempt=<n> :: from=<reason> attribution=<verdict> target=<extra:profile\|agent> files_preexisting=<n> · EXTRA orphan task=<id> :: attempt=<n> lease-expired files_changed=<n> state=<state> · EXTRA demote run=<slug> :: profile=<p> reason=<consecutive-stall\|stale-live-attempt\|manual> n=<k> → <ladder>` | orc → writer | one line per FOREIGN dispatch — `orc extra dispatch`'s `trace_line`, verbatim | `_shared/extra-dispatch.md` |
59
+ | `FINISH :: <detail>` | orc → writer | run ended — mandatory, even on an abort | `_shared/phases/trace.md` |
60
+
61
+ `SPAWN`/`RETURN`/`PHASE-EDGE` come from the hook automatically. Every other verb
62
+ reaches the file through a packet — you never append lines by hand.
63
+
64
+ ## Verb detail
65
+
66
+ - **`PHASE-EDGE`.** ORC agent names encode their role, so when a SPAWN's role
67
+ family differs from the previous SPAWN's, the hook segments the run itself.
68
+ Families: `recon → recon` (v1.9.0 — /orc-quick's read-only half; a question
69
+ answered for a person is not an analysis), `analyst|scout → analysis`,
70
+ `planner → planning`, `executor → execution`, `reviewer → review`,
71
+ `verifier → verify`, `test-author → testgen`, `advisor|judge → ultra-gate`
72
+ (the trace writer never opens an edge). Zero model dependence: even a run
73
+ where every writer dispatch was forgotten still reads planning → execution →
74
+ review → verify, and `/orc-retro` computes NARRATION COVERAGE from edges with
75
+ vs without a writer `SPAWN` between them.
76
+ - **`CONFIG`.** ALWAYS carries `opus5_only` — it selects the executor table AND
77
+ every fixed role, so retro can segment outcomes by dispatch mode. Runtime
78
+ proof that the run honored the config; `/orc-retro` audits it against behavior.
79
+ - **`ASK`.** One line per answered decision point. `qid` is a row of
80
+ `orc habit points --json`; a qid the registry does not know is dropped and
81
+ `orc habit doctor` counts it. `offered`, `rec`, `chose` and `pre` are option
82
+ ids, never free text: an answer typed in words is `chose=other`, and the words
83
+ are never stored. `by` says how the answer came: `user` typed it, `ledger` said
84
+ it up front in the request, `learned` took what an accepted habit pre-selected,
85
+ `config` or `default` answered without showing the question (not a choice, so
86
+ not counted). `ctx` carries only what the lane knows (`branch`, `kind`, `size`,
87
+ `risk`). `orc habit` reads these lines; it never applies a habit without a yes.
88
+ - **`WIKI-CONSULT`.** Full/mini at planning; fast at slice-build. `docs=` is the
89
+ pages pulled/handed to the executor (comma list) or `none`. It records whether
90
+ the run grounded in the wiki and whether it was stale (grounding + staleness
91
+ for later audit).
92
+ - **`CROSSLINK`.** `cached` = peer cache present; `configured-no-cache` =
93
+ crosslink configured but the cache is not built. It records whether peer
94
+ contracts were injected this run. Full orc consumes only the pre-built
95
+ crosslink cache — it never reads peer source live (mechanism in
96
+ `wiki-consult.md`).
97
+ - **`GRAPH-CONSULT`.** Copied VERBATIM from the `trace` field of
98
+ `orc graph status --heal --json --brief` (`code-graph.md` §4). `density=` is
99
+ the named symbols per file, and `thin=1` means most files hold none, so most
100
+ questions asked of the graph will not find one (v1.9.1). A `GATE` line that
101
+ describes the graph in other words does not replace it. The `card` form is the
102
+ `trace` of `orc graph ctx --json`, with `task=` added, when a slice receives
103
+ cards.
104
+ - **`GRAPH-UPDATE`.** One graph update at a wave close, a green smoke gate, a
105
+ code-writing `/orc-quick` request, or ship. The graph HOOK writes its own
106
+ `GRAPH-UPDATE … :: by=hook …` lines directly; never copy one of those, it is
107
+ already in the file.
108
+ - **`GRAPH-MAP`.** Also at a `/orc-quick` Q1 look that had no file to name.
109
+ `files=` is how many the budget SHOWED over how many the repository has, so a
110
+ short map can be told from a small repository. `focused` means `--focus`
111
+ re-ranked the repository around what the request named. RANK is a hint about
112
+ where to look first and the trace never says more than that.
113
+ - **`GRAPH-CHANGES`.** `high` counts symbols that are exported, have three or
114
+ more callers and NO test reaching them.
115
+ - **`GRAPH-COMPLEXITY`.** The `trace` field of
116
+ `orc graph impact … --complexity --json`. The CLI computes the verdict from the
117
+ four thresholds in `bin/graph-signals.js`; `maybe` is reported and never trips
118
+ one. Mini's own `GATE complexity :: <the line>` is separate: it records what
119
+ the USER chose after the offer.
120
+ - **`GRAPH-COCHANGE`.** Not per file — the `trace` field of
121
+ `orc graph cochange --json` for the file that produced the widest answer.
122
+ - **`GRAPH-HINT`.** Not one per hint — the counters `orc-graph-hook.js` keeps in
123
+ `<log_dir>/<run>.graph-hook.json`. Omitted when the file does not exist (the
124
+ hook is off, or it never had anything to say).
125
+ - **`GRAPH-GAIN`.** The `trace` field of `orc graph gain --run <trace name>
126
+ --json`, verbatim. `paid` is exact (the tokens the graph put in); `low`/`high`
127
+ are an ESTIMATE of the retrieval it kept out. Omitted when the ledger is empty
128
+ or the graph is off.
129
+ - **`GRAPH-NOTES`.** The `trace` field of `orc graph notes pending --json` when
130
+ it exited 3 or 5; `skipped` under the Opus-5-only mode.
131
+ - **`RETURN`.** The hook attributes the RETURN to the finishing agent from the
132
+ SubagentStop payload (`~<agent>` = approximate FIFO match on older Claude Code
133
+ that omits `agent_type`; `~agent :: unattributed` = ≥2 agents in flight, so it
134
+ deliberately claimed NO pending record rather than starve the right one),
135
+ echoes the SPAWN's desc + wall-clock duration, and appends `model=<id>` when
136
+ the return's `actual_model` is visible in the last message. A duplicate stop
137
+ for an agent whose record was already consumed is DROPPED, never written as a
138
+ desc-less RETURN. Still hook-written skeleton — NOT an orchestrator
139
+ obligation; the authoritative model check is the `VERIFY` line.
140
+ - **`DISPATCH`.** **A FOREIGN dispatch appends `via=extra:<profile>`** and its
141
+ `expect=` names the profile's model rather than a Claude tier — additive, the
142
+ way `/orc-doc`'s `sections=` was. A foreign worker is not a Claude subagent, so
143
+ the hook emits NO `SPAWN` and NO `RETURN` for it (P7, the `/orc-quick`
144
+ ad-hoc-recon precedent): this line and `EXTRA` are the whole record, which is
145
+ why neither is optional. **The `/orc-doc` lane's tail NAMES ITS SECTIONS**
146
+ (v0.49.2) — `doc write sections=03-scope,04-risks part=sections/03-scope.md`,
147
+ `doc check sections=03-goals`, `doc digest source=<path>` — which is the only
148
+ thing that makes `orc doc cost`'s per-section attribution honest rather than a
149
+ guess. It is additive: the tail was already captured whole.
150
+ - **`SCORE`.** **A task the resolver sent foreign appends `via=extra:<profile>`**,
151
+ and `model=` is the foreign model id — so `/orc-retro` can segment a band's
152
+ outcomes by WHO ran it. `facets=` is the planner-emitted vector
153
+ (breadth·novelty·logic·test·fan·unc·risk) the score was computed from —
154
+ `/orc-retro` reads it to recalibrate the formula. Fix-cycle dispatches emit
155
+ `SCORE task=fix-<n> …` the same way.
156
+ - **`VERIFY`.** The COMPARISON stays the orchestrator's obligation — surface a
157
+ downgrade to the user, not just the trace.
158
+ - **`GATE`.** `facet` is the plan's facet-vocabulary check
159
+ (`effort-and-mode.md`); `schema` is the plan-handoff schema check; `judgment`
160
+ is ultra (`escalate` is judgment-only); `budget` is the Phase-1
161
+ `run_budget_dispatches` forecast gate — `pass` or the `stop` that blocks
162
+ wave 1, emitted only when the key is > 0; `stack-gate` is the Phase 8
163
+ stacked-PR threshold + handoff; `stack-certainty` is a stacked-PR seam
164
+ decision; `layer-green` is one layer's green-gate ladder. The shared-band
165
+ SIBLING-CONSISTENCY determination is NOT a gate name — carry it in the
166
+ packet's `decisions`, never as an invented verb. Bounce detail lists the
167
+ misses (feeds `/orc-retro` gate-bounce rates).
168
+ - **`OUTCOME`.** Feeds `/orc-retro` calibration.
169
+ - **`FINDING-OUTCOME`.** At review close: `/orc` Phase 7, `/orc-mini` after the
170
+ risk option, `/orc-quick` after the review offer. The counts are PROGRAMMATIC
171
+ (`_shared/gotchas.md` §10): the flagged lines changed before ship = addressed;
172
+ the user said "not a problem here" = disputed; declined with no reason = wontfix.
173
+ `pre` and `suppressed` copy the after-filter's buckets; they never gate. The
174
+ `FINDING` tail `pre= suppressed= folded=` is additive (the `sections=` precedent).
175
+ - **`REVIEW-WHICH`** (v2.1.0). ONE line, before ship, in every coding lane that
176
+ changed code, when the `review-policy` probe says `policy: project`
177
+ (the review slice, §0). It is written ALWAYS — habits off too — because it is a
178
+ record of what ran, not a habit. The `ASK any.review.which` line is written in
179
+ addition only when habits is on. A run that changed code under `policy:
180
+ project` with no `REVIEW-WHICH` line gets one nudge at FINISH.
181
+ - **`FIX`** (v2.1.0). Written by `orc fix record` ITSELF into the run in flight
182
+ (`/orc-fix`, a rider that opens no run). A packet that carries it is refused.
183
+ A lane never narrates it and never repeats it; `orc stats` and `/orc-retro`
184
+ read it like any other line.
185
+ - **`DRIFT`.** `PHASE mock-example`; canonical `_shared/drift-recovery.md`.
186
+ - **`TDD-RED` / `TDD-GREEN`.** Cap `tdd_loop_max`; a paired TDD task's red proof
187
+ also emits iter=0. `TDD-GREEN` is the non-exempt definition-of-done.
188
+ - **`REPRO`.** `_shared/return-validation.md` §5d. TWO lines per reproduced
189
+ defect, in this order: the `before` run must be RED and the `after` run GREEN,
190
+ or the return was malformed. `REPRO none :: <reason>` when no reproduction
191
+ could be written — an honest answer, never a missing line. A reproduction is
192
+ NOT a plan-time acceptance test, so it never reuses `TDD-RED`/`TDD-GREEN`:
193
+ `/orc-retro` counts "we proved the bug first" apart from "we drove the plan's
194
+ acceptance tests".
195
+ - **`NOTE`.** Scoring rationale, user answers verbatim, what was rejected. One
196
+ line per packet, only when `decisions` is non-empty.
197
+ - **`PACT`.** At the Phase-1 probe (`pact_gate`); `inject` when a
198
+ DRIFTED/BROKEN promise is appended to a task's `constraints[]`; `recheck` at
199
+ Phase 6. Records whether last month's decisions constrained this month's plan.
200
+ - **`BOUNDARY`.** `lift` when `boundary_gate: block` removes ONE task from a
201
+ wave (the wave still runs). `/orc-retro` reads these to answer the question
202
+ the lane exists for: how much work did we stop attempting, and was that right.
203
+ - **`CHALLENGE`.** **Copy `orc challenge record`'s `trace_line` verbatim** — the
204
+ CLI assembles it so the lane never composes a second wording for the same
205
+ number. `accept`/`rebut` when an escape valve is used; `regoal|retemplate` on a
206
+ re-freeze. `/orc-retro` reads the sequence to answer whether a cycle converged
207
+ or stalled.
208
+ - **`EXTRA`.** A slice that executed on a non-Claude worker
209
+ (`_shared/extra-dispatch.md`). **Copy `orc extra dispatch`'s `trace_line`
210
+ verbatim** — the CLI assembles it, exactly as `orc challenge record` does, so
211
+ the lane never composes a second wording for the same numbers. The sub-forms:
212
+ `fallback` when a failed foreign dispatch re-dispatches to Claude (P6);
213
+ `substitution` / `reroute` when the endpoint answered with a different model,
214
+ or the same model served by a different company; `resume` (v0.54.0) when a
215
+ dispatch CONTINUES a position an earlier attempt left on disk; `orphan` when
216
+ preflight reports a dispatch that never reported back; `demote` (v1.0.0) when
217
+ this run DROPS a foreign profile to the bottom of the ladder after two
218
+ consecutive stalls, a stale live attempt, or `orc extra demote`.
219
+ - **A demotion that leaves no line cannot be counted** either — copy
220
+ `orc extra demotion`’s `trace_line` VERBATIM and emit it before the next
221
+ dispatch, beside the mandatory announce line. A demotion is RUN state: it
222
+ never writes the config and it is never promoted back on its own.
223
+ - **A resume that leaves no line cannot be counted** — neither
224
+ `orc extra stats` nor `/orc-retro` can then learn whether resuming works, or
225
+ which providers ignore the resume preamble. `EXTRA resume` rides in the
226
+ resumed dispatch's own `trace_extras[]`; `EXTRA orphan` is the LANE's to
227
+ emit after it reports, the same ownership rule as `EXTRA fallback`.
228
+ - **`tok=none` is a real value** and the ONLY correct one when the worker
229
+ reported no counts (engine `cli` often does not): `tok=0/0/0/0` would tell
230
+ `/orc-budget` the run was free, while a measured zero — engine `api`'s `cw`,
231
+ always — is a different fact.
232
+ - **On a lane with no score `band=` carries `slot:<slot>`** (v0.55.0 —
233
+ `slot:doc-writer`, `slot:wiki-scanner-light`): the field NAME is unchanged,
234
+ so this parser, the eight-field dedupe and the ` :: ` tolerance are
235
+ untouched, and `orc extra stats` gives each POSITION its own row for free.
236
+ - This is the verb `/orc-retro` reads to answer the only question that
237
+ matters: is the cheap model actually cheaper once you count the repairs.
238
+
239
+ ## `STATS` — what `orc stats` reads
240
+
241
+ `orc stats` reads the tail of each file and nothing more: one line per file,
242
+ never a parse of the whole trace. Omit a field you genuinely do not have (a lane
243
+ with no waves omits `waves=`); never guess one. Every trace-owning lane emits
244
+ it, not just `orc`.
245
+
246
+ - **A run with no `FINISH` is counted as unfinished, permanently.** That is
247
+ correct behaviour and it is why `FINISH` is mandatory even on an abort.
248
+ - **A trace older than v0.42.0 has no `STATS` line.** `orc stats` falls back to
249
+ counting `DISPATCH` lines — orchestrator-written and present in every lane
250
+ (including `/orc-quick`, whose ad-hoc recon emits no `SPAWN`/`RETURN`). Old
251
+ traces still count, with less detail. Never back-fill a `STATS` line into an
252
+ old trace: the numbers would be invented, and the trace is append-only.
253
+
254
+ **Skeleton caveat (read every retro metric with it):** the hook only sees a NEW
255
+ dispatch. CONTINUING an already-running agent fires no PreToolUse/SubagentStop
256
+ pair, so a lane driven by continuing one agent produces fewer `SPAWN`/`RETURN`
257
+ lines than it did real work. The skeleton is a FLOOR on dispatch volume, never a
258
+ census — narration coverage computed from it reads low, not wrong.
259
+
260
+
261
+ ## Protocol detail — the WHY behind `trace.md`
262
+
263
+ `trace.md` carries the rules a run applies at every phase close. This section
264
+ keeps the reasons and the per-lane detail behind them, for a reader who needs it.
265
+
266
+ Purpose: capture the flow of a run — phases, spawns, the model that actually
267
+ answered, scoring decisions, user questions, review/verify outcomes — so the
268
+ skills can be improved from real traces. This is NOT the decision log
269
+ (`run/…md`, agent knowledge, deleted on success). The trace is a separate,
270
+ **persistent** artifact and the two never mix.
271
+
272
+ There is no gate. Behavior-trace logging is PERMANENT — every run traces. The
273
+ `orc-trace.js` hook is the deterministic guarantee: on the first ORC-agent
274
+ dispatch it bootstraps `log_dir` + the run pointer itself, so a `.txt` is created
275
+ for every run even if the orchestrator never writes a rich marker. Only
276
+ `log_dir` (default `.claude/orc/logs`) is configurable.
277
+
278
+ ### Narration
279
+
280
+ - **The pen (v2.0.0).** `orc trace write --packet -` reads the packet on stdin
281
+ and writes the `.txt` lines AND the `.jsonl` rows from it, in the writer's
282
+ formats — the two halves agree by construction. An unknown verb, a missing or
283
+ "now" `ts`, or a parse error exits 2 and writes NOTHING; a missing `.current`
284
+ on a later packet exits 3. Only on exit ≠ 0 does the lane dispatch
285
+ `orc-trace-writer-haiku-4-5` with the SAME packet (the fallback).
286
+ - **Pairing rule (the anti-forget mechanism).** The write for phase N is issued
287
+ **in the same tool block as phase N+1's first dispatch** — logging
288
+ piggybacks on the very action the model reliably performs. A phase with no next
289
+ dispatch (FINISH, an abort, a pure-question phase) writes SOLO, before
290
+ printing that phase's user-facing output.
291
+ - **First write is solo** — before the planner/analyst goes out. It carries
292
+ `run_meta` and performs the rename repair (below) while nothing else is in
293
+ flight.
294
+ - **Last write (run end).** The FINISH packet (final report summary, ship
295
+ state, verdict totals) is written BEFORE you delete `.current`.
296
+
297
+ A fallback writer's own `SPAWN`/`RETURN` are logged like any `orc*` agent.
298
+ `/orc-retro` audits narration coverage from the narrated (non-`hook`) lines
299
+ stamped inside each `PHASE-EDGE` interval, or a writer SPAWN there.
300
+
301
+ ### Phase packet
302
+
303
+ - The packet is built from the phase's **actual working state as the phase
304
+ closes** — never reconstructed later from memory.
305
+ - `ts` is each event's REAL time. The writer stamps nothing itself: the block is
306
+ a faithful late append of events that happened seconds ago, not an end-of-run
307
+ summary. Retro sorts by stamp, not by file order.
308
+ - Subagent-returned markers (`QUESTION`, `FINDING`, `VERDICT`, a return's
309
+ `actual_model`) are folded into the NEXT packet, never written directly.
310
+ - `VERIFY` stays an orchestrator OBLIGATION — you compare claimed vs actual and
311
+ surface any ⛔ DOWNGRADE to the user in chat; only the LINE travels by packet.
312
+ - The writer NEVER invents: an absent field is omitted, never guessed.
313
+
314
+ ### Packet units per lane (full detail)
315
+
316
+ | Tier | Lanes | Packets |
317
+ |------|-------|---------|
318
+ | 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) |
319
+ | 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 |
320
+ | 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) |
321
+ | 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 |
322
+ | 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** |
323
+
324
+ **`context-combiner` is NOT a lane — it is a PHASE inside the analyze run.** It
325
+ has no slash command and no entry point of its own: `orc-analyze` Phase F
326
+ dispatches it while `.current` still points at that run's `run-analyze-…` file.
327
+ So it never writes a pointer, never touches a trace file, and never emits its own
328
+ `FINISH`; its `DISPATCH`/`RETURN`, its Phase D challenge verdicts and its
329
+ conservation-gate result all fold into **orc-analyze's** end-of-run packet. The
330
+ hook agrees — `context-combiner` maps to its own `PHASE-EDGE` role family
331
+ (`combine`), which segments the phase *within* that trace. Listing it as a lane
332
+ (as this table did before v0.42.0) declared a run nothing could ever open.
333
+
334
+ **The single-packet obligation is defined HERE, once** (every trace-owning lane
335
+ already loads this reference) — micro-lane spines keep only their existing trace
336
+ pointer. That packet is dispatched SOLO after the lane's main return validates
337
+ and BEFORE `.current` is deleted; it carries `run_meta` (so the rename repair
338
+ works there too) plus the lane's whole event list: intake decisions, the user's
339
+ answers, `DISPATCH`/`VERIFY`, gate/verdict lines, `FINISH`. One Haiku call per
340
+ run buys the WHY layer for every lane. Haiku cost is noise against any run's
341
+ executor spend.
342
+
343
+ `/orc-retro` is the ONE exception: it mines traces and writes none (its hard
344
+ rule 4). The hook enforces this — `orc-retro-*` dispatches never bootstrap a
345
+ trace and never emit `SPAWN`/`RETURN`.
346
+
347
+ ### Files & lifecycle
348
+
349
+ - Folder: `log_dir` (default `.claude/orc/logs/`). Persistent (deliberate
350
+ opposite of the decision log): kept until you run `orc clear logs --apply`, or
351
+ until the automatic sweep removes it (`log_retention_auto: on`, older than
352
+ `log_retention_days`). Top level holds the run `.txt` plus
353
+ its sidecars (`.pending.json`, `.jsonl`); generated reports live in
354
+ subfolders (`retro/`).
355
+ - One file per run: **`run-<lane>-<slug>-<DDMMYY>-<HHMMSS>.txt`**, append-only.
356
+ - `lane` — the trace-owning skill's short name: one value of the
357
+ `run_meta.lane` enum in `trace.md`. That enum is the ONE list — the lane
358
+ vocabulary `orc stats` and `/orc-retro` count against. Every value there is
359
+ a lane some entry point actually opens — keep it that way. `ultra` = an
360
+ /orc-ultra run, the ONLY lane the orc spine can emit besides `orc`. No other
361
+ value is legal: a lane no entry point opens is a lane every counting tool
362
+ reports as permanently zero.
363
+ - `slug` — kebab-cased short user context from the intent (`[a-z0-9-]`, ≤32
364
+ chars, filesystem-safe, no trailing hyphen) — same derivation as the
365
+ run-folder slug.
366
+ - `HHMMSS` — so two same-day runs never collide.
367
+ - e.g. `run-orc-cas-multi-exchange-withdrawal-240726-002352.txt`.
368
+ - The name is DATA: `/orc-retro` aggregates per lane straight from it, without
369
+ parsing content.
370
+ - **Why the pointer and the file are made together.** A pointer naming a file
371
+ that does not exist yet is indistinguishable from a dangling one by content
372
+ alone. That used to split a run across two files (a generic bootstrap holding
373
+ the hook skeleton + a rich file holding every narrated line, each looking
374
+ correct alone). The `orc-trace.js` hook reads the pointer to know which file
375
+ to append to, and since v0.34.2 it also honors a POINTER whose mtime is fresh
376
+ even when the file is not there yet — the two fixes are independent on purpose.
377
+ - **Why a resumed lane re-writes the pointer.** Otherwise every line it writes
378
+ after the return goes nowhere: the v0.34.2 split-run signature, reached by a
379
+ different road. Two traces for a suspend is CORRECT — two lanes ran, and
380
+ `orc stats` counts two.
381
+ - **The hook bootstrap.** When no usable pointer exists as the first ORC-agent
382
+ dispatch fires, the hook creates the folder + a generic
383
+ `run-<DDMMYY>-<HHMMSS>.txt` and points at it. The FIRST writer dispatch
384
+ repairs that — a MOVE, decided against disk (the writer's contract). Non-ORC
385
+ Tasks never trace — the hook only bootstraps for agent names starting with `orc`.
386
+
387
+ ### Write cadence
388
+
389
+ The trace is a **running record**, not an end-of-run report. Each phase's packet
390
+ goes out AT that phase's close — coupled to the next phase's first dispatch:
391
+
392
+ | Moment | Packet carries |
393
+ |--------|----------------|
394
+ | a phase closes | that phase's events + the decisions behind them |
395
+ | dispatching an agent | the `DISPATCH` line (folded into the closing phase's packet) |
396
+ | a return validates | its `VERIFY` + any subagent-returned marker |
397
+ | a task closes | its `OUTCOME` |
398
+ | review/verify verdict | `FINDING` / `VERDICT` |
399
+ | run end | `FINISH` — dispatched SOLO and returned before `.current` is deleted |
400
+
401
+ About the self-check in `trace.md`:
402
+ The failure this prevents is a fully-executed run behind a one-line trace. If a
403
+ phase went by without its packet, write it NOW with the events' real
404
+ timestamps rather than skipping them — a late block with true stamps is a late
405
+ record; a block stamped "now" is a FALSE one. Batching everything at `FINISH` is
406
+ the classic failure: by then the run's context is compacted and the detail is gone.
407
+
408
+ ### Model source of truth — the claimed-vs-actual check
409
+
410
+ A hook cannot read a subagent's model id (it lives only in the subagent's system
411
+ prompt). So each dispatched agent returns two fields (see each agent's return
412
+ contract):
413
+
414
+ - `actual_model` — **quoted verbatim** from the agent's injected system-prompt
415
+ model-id line ("The exact model ID is …"). Never a guess; `unknown` if absent.
416
+ - `actual_effort` — the value of `$CLAUDE_EFFORT` (env var, read via Bash).
417
+
418
+ For each spawn the orchestrator:
419
+ 1. Derives the **expected** `(model, effort)` from the dispatched agent NAME via
420
+ the `config.md` score→model table / `MODEL-MAPPING.md`.
421
+ 2. Compares against the returned `actual_*` and puts a `VERIFY` line in the next
422
+ packet — `✅ MATCH` or `⛔ DOWNGRADE`. A downgrade (the harness capped a high
423
+ pin to the main-session tier) is surfaced to the user, not just logged.
424
+
425
+ ### Announce-on-spawn
426
+
427
+ When dispatching, announce the model to the user, derived from the agent NAME
428
+ (e.g. "Spawning orc-executor-opus-5-low → claude-opus-5-5 / low"). Derive it
429
+ from the name — do NOT pass the coarse `sonnet|opus|haiku` dispatch arg, which
430
+ cannot express 4-7 vs 4-8 and would override the frontmatter pin.
431
+
432
+ ### Compaction safety
433
+
434
+ The checkpoint carries `logging_enabled` + `trace_path`. On resume, re-read them
435
+ and continue dispatching packets against the same file. The hook backbone keeps
436
+ emitting `SPAWN`/`RETURN`/`PHASE-EDGE` regardless of orchestrator memory, so a
437
+ compacted run is never blind — at worst it loses the WHY layer for one phase.
438
+ `/orc-ultra` is the `orc` skill with `ultra_mode: true`; its packets are just
439
+ orc's plus the U0/judge ones.
440
+
441
+ ### Write discipline
442
+
443
+ - Append-only; one whole block per append (never edit prior lines).
444
+ - The trace records behavior faithfully — including the ugly bits (over-asking,
445
+ downgrades, failed waves). That honesty is the whole value.
446
+
447
+ <!-- /orc:layer -->