@azure-id/orc 0.55.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 (449) hide show
  1. package/CHANGELOG.md +2017 -0
  2. package/README-id.md +521 -0
  3. package/README.md +485 -0
  4. package/bin/build-agents.js +86 -0
  5. package/bin/cli.js +29050 -0
  6. package/bin/mockrun-catalog.js +267 -0
  7. package/bin/onboarding-content.js +172 -0
  8. package/bin/pricing.json +200 -0
  9. package/bin/providers.json +437 -0
  10. package/bin/ui.js +95 -0
  11. package/bin/verify-contracts.js +3277 -0
  12. package/bin/verify-package.js +498 -0
  13. package/bin/webui/api.js +1163 -0
  14. package/bin/webui/app.html +198 -0
  15. package/bin/webui/css/00-tokens.css +92 -0
  16. package/bin/webui/css/01-base.css +42 -0
  17. package/bin/webui/css/02-shell.css +103 -0
  18. package/bin/webui/css/03-components.css +462 -0
  19. package/bin/webui/css/04-motion.css +91 -0
  20. package/bin/webui/css/05-tour.css +100 -0
  21. package/bin/webui/css/06-responsive.css +108 -0
  22. package/bin/webui/css/panels/boundary.css +26 -0
  23. package/bin/webui/css/panels/challenge.css +151 -0
  24. package/bin/webui/css/panels/crosslink.css +194 -0
  25. package/bin/webui/css/panels/docs.css +254 -0
  26. package/bin/webui/css/panels/experiment.css +23 -0
  27. package/bin/webui/css/panels/extra.css +536 -0
  28. package/bin/webui/css/panels/flow.css +177 -0
  29. package/bin/webui/css/panels/handoff.css +67 -0
  30. package/bin/webui/css/panels/knowledge.css +86 -0
  31. package/bin/webui/css/panels/learn.css +154 -0
  32. package/bin/webui/css/panels/maintenance.css +55 -0
  33. package/bin/webui/css/panels/mockrun.css +268 -0
  34. package/bin/webui/css/panels/overview.css +100 -0
  35. package/bin/webui/css/panels/pact.css +43 -0
  36. package/bin/webui/css/panels/runs.css +105 -0
  37. package/bin/webui/css/panels/settings.css +227 -0
  38. package/bin/webui/css/panels/stats.css +87 -0
  39. package/bin/webui/fixtures/boundary.js +92 -0
  40. package/bin/webui/fixtures/challenge.js +825 -0
  41. package/bin/webui/fixtures/crosslink.js +31 -0
  42. package/bin/webui/fixtures/docs.js +982 -0
  43. package/bin/webui/fixtures/extra.js +1934 -0
  44. package/bin/webui/fixtures/flow.js +81 -0
  45. package/bin/webui/fixtures/handoff.js +35 -0
  46. package/bin/webui/fixtures/index.js +486 -0
  47. package/bin/webui/fixtures/knowledge.js +291 -0
  48. package/bin/webui/fixtures/maintenance.js +42 -0
  49. package/bin/webui/fixtures/mockrun.js +36 -0
  50. package/bin/webui/fixtures/pact.js +111 -0
  51. package/bin/webui/fixtures/runs.js +109 -0
  52. package/bin/webui/fixtures/settings.js +78 -0
  53. package/bin/webui/fixtures/shell.js +48 -0
  54. package/bin/webui/fixtures/stats.js +104 -0
  55. package/bin/webui/i18n/TERMS.md +134 -0
  56. package/bin/webui/i18n/en/banner.json +29 -0
  57. package/bin/webui/i18n/en/boundary.json +20 -0
  58. package/bin/webui/i18n/en/challenge.json +106 -0
  59. package/bin/webui/i18n/en/common.json +69 -0
  60. package/bin/webui/i18n/en/crosslink.json +69 -0
  61. package/bin/webui/i18n/en/docs.json +175 -0
  62. package/bin/webui/i18n/en/experiment.json +17 -0
  63. package/bin/webui/i18n/en/extra.json +313 -0
  64. package/bin/webui/i18n/en/flow.json +30 -0
  65. package/bin/webui/i18n/en/handoff.json +37 -0
  66. package/bin/webui/i18n/en/knowledge.json +141 -0
  67. package/bin/webui/i18n/en/learn.json +16 -0
  68. package/bin/webui/i18n/en/maintenance.json +52 -0
  69. package/bin/webui/i18n/en/mockrun.json +19 -0
  70. package/bin/webui/i18n/en/nav.json +19 -0
  71. package/bin/webui/i18n/en/overview.json +89 -0
  72. package/bin/webui/i18n/en/pact.json +36 -0
  73. package/bin/webui/i18n/en/runs.json +51 -0
  74. package/bin/webui/i18n/en/settings.json +49 -0
  75. package/bin/webui/i18n/en/stats.json +69 -0
  76. package/bin/webui/i18n/en/tour.json +33 -0
  77. package/bin/webui/i18n/id/banner.json +29 -0
  78. package/bin/webui/i18n/id/boundary.json +20 -0
  79. package/bin/webui/i18n/id/challenge.json +106 -0
  80. package/bin/webui/i18n/id/common.json +70 -0
  81. package/bin/webui/i18n/id/crosslink.json +69 -0
  82. package/bin/webui/i18n/id/docs.json +175 -0
  83. package/bin/webui/i18n/id/experiment.json +17 -0
  84. package/bin/webui/i18n/id/extra.json +313 -0
  85. package/bin/webui/i18n/id/flow.json +30 -0
  86. package/bin/webui/i18n/id/handoff.json +37 -0
  87. package/bin/webui/i18n/id/knowledge.json +141 -0
  88. package/bin/webui/i18n/id/learn.json +16 -0
  89. package/bin/webui/i18n/id/maintenance.json +52 -0
  90. package/bin/webui/i18n/id/mockrun.json +19 -0
  91. package/bin/webui/i18n/id/nav.json +19 -0
  92. package/bin/webui/i18n/id/overview.json +89 -0
  93. package/bin/webui/i18n/id/pact.json +36 -0
  94. package/bin/webui/i18n/id/runs.json +51 -0
  95. package/bin/webui/i18n/id/settings.json +49 -0
  96. package/bin/webui/i18n/id/stats.json +69 -0
  97. package/bin/webui/i18n/id/tour.json +33 -0
  98. package/bin/webui/js/00-core.js +115 -0
  99. package/bin/webui/js/01-i18n.js +149 -0
  100. package/bin/webui/js/02-ui.js +211 -0
  101. package/bin/webui/js/03-md.js +286 -0
  102. package/bin/webui/js/04-router.js +51 -0
  103. package/bin/webui/js/05-banners.js +172 -0
  104. package/bin/webui/js/06-edit.js +183 -0
  105. package/bin/webui/js/90-tour.js +488 -0
  106. package/bin/webui/js/91-shortcuts.js +126 -0
  107. package/bin/webui/js/99-boot.js +118 -0
  108. package/bin/webui/js/panels/boundary.js +104 -0
  109. package/bin/webui/js/panels/challenge.js +781 -0
  110. package/bin/webui/js/panels/crosslink.js +654 -0
  111. package/bin/webui/js/panels/docs.js +1338 -0
  112. package/bin/webui/js/panels/experiment.js +98 -0
  113. package/bin/webui/js/panels/extra.js +3011 -0
  114. package/bin/webui/js/panels/flow.js +297 -0
  115. package/bin/webui/js/panels/handoff.js +169 -0
  116. package/bin/webui/js/panels/knowledge.js +890 -0
  117. package/bin/webui/js/panels/learn.js +220 -0
  118. package/bin/webui/js/panels/maintenance.js +235 -0
  119. package/bin/webui/js/panels/mockrun.js +227 -0
  120. package/bin/webui/js/panels/overview.js +447 -0
  121. package/bin/webui/js/panels/pact.js +189 -0
  122. package/bin/webui/js/panels/runs.js +416 -0
  123. package/bin/webui/js/panels/settings.js +573 -0
  124. package/bin/webui/js/panels/stats.js +378 -0
  125. package/bin/webui/serve.js +557 -0
  126. package/mock-run/INDEX.md +106 -0
  127. package/mock-run/a-normal-day.md +587 -0
  128. package/mock-run/context-combiner.md +100 -0
  129. package/mock-run/extra-recovery.md +330 -0
  130. package/mock-run/extra-slots.md +177 -0
  131. package/mock-run/media/README.md +43 -0
  132. package/mock-run/orc-aftermath.md +392 -0
  133. package/mock-run/orc-boundary.md +356 -0
  134. package/mock-run/orc-brainstorm.md +177 -0
  135. package/mock-run/orc-budget.md +534 -0
  136. package/mock-run/orc-challenge-council.md +262 -0
  137. package/mock-run/orc-challenge.md +416 -0
  138. package/mock-run/orc-cli.md +200 -0
  139. package/mock-run/orc-diy.md +129 -0
  140. package/mock-run/orc-doc.md +448 -0
  141. package/mock-run/orc-explain.md +86 -0
  142. package/mock-run/orc-export.md +423 -0
  143. package/mock-run/orc-extra.md +392 -0
  144. package/mock-run/orc-fast.md +106 -0
  145. package/mock-run/orc-grill.md +151 -0
  146. package/mock-run/orc-handoff.md +480 -0
  147. package/mock-run/orc-pact.md +421 -0
  148. package/mock-run/orc-pattern.md +112 -0
  149. package/mock-run/orc-plan.md +108 -0
  150. package/mock-run/orc-pr-setup.md +126 -0
  151. package/mock-run/orc-quick.md +113 -0
  152. package/mock-run/orc-route.md +93 -0
  153. package/mock-run/orc-ui.md +125 -0
  154. package/mock-run/orc-ultra.md +103 -0
  155. package/mock-run/orc.md +157 -0
  156. package/mock-run/the-example-project.md +55 -0
  157. package/package.json +39 -0
  158. package/templates/agents/MODEL-MAPPING.md +168 -0
  159. package/templates/agents/orc-advisor-fable-5.md +50 -0
  160. package/templates/agents/orc-advisor-opus-5-xhigh.md +56 -0
  161. package/templates/agents/orc-analyst-fable-5.md +115 -0
  162. package/templates/agents/orc-analyze-mini-opus-5-med.md +60 -0
  163. package/templates/agents/orc-analyze-mini-sonnet-5-high.md +58 -0
  164. package/templates/agents/orc-challenge-advisor-opus-5-med.md +75 -0
  165. package/templates/agents/orc-challenge-contrarian-opus-5-high.md +110 -0
  166. package/templates/agents/orc-challenge-executor-opus-5-med.md +114 -0
  167. package/templates/agents/orc-challenge-expansionist-opus-5-med.md +112 -0
  168. package/templates/agents/orc-challenge-judge-opus-5-high.md +132 -0
  169. package/templates/agents/orc-challenge-outsider-opus-5-low.md +109 -0
  170. package/templates/agents/orc-challenge-principles-opus-5-high.md +109 -0
  171. package/templates/agents/orc-challenge-reader-opus-5-low.md +90 -0
  172. package/templates/agents/orc-claude-writer-opus-4-8-high.md +53 -0
  173. package/templates/agents/orc-claude-writer-opus-5-med.md +55 -0
  174. package/templates/agents/orc-context-combiner-opus-5-high.md +88 -0
  175. package/templates/agents/orc-doc-checker-opus-5-low.md +108 -0
  176. package/templates/agents/orc-doc-writer-opus-5-med.md +134 -0
  177. package/templates/agents/orc-executor-haiku-4-5.md +113 -0
  178. package/templates/agents/orc-executor-opus-4-7-high.md +114 -0
  179. package/templates/agents/orc-executor-opus-4-7-med.md +114 -0
  180. package/templates/agents/orc-executor-opus-4-8-high.md +114 -0
  181. package/templates/agents/orc-executor-opus-5-high.md +114 -0
  182. package/templates/agents/orc-executor-opus-5-low.md +114 -0
  183. package/templates/agents/orc-executor-opus-5-med.md +114 -0
  184. package/templates/agents/orc-executor-sonnet-4-6-high.md +114 -0
  185. package/templates/agents/orc-executor-sonnet-4-6-med.md +114 -0
  186. package/templates/agents/orc-executor-sonnet-5-high.md +114 -0
  187. package/templates/agents/orc-judge-fable-5.md +79 -0
  188. package/templates/agents/orc-judge-opus-5-xhigh.md +85 -0
  189. package/templates/agents/orc-learn-writer-opus-5-low.md +73 -0
  190. package/templates/agents/orc-pattern-codifier-opus-5-med.md +65 -0
  191. package/templates/agents/orc-pattern-codifier-sonnet-5-high.md +63 -0
  192. package/templates/agents/orc-planner-fable-5.md +152 -0
  193. package/templates/agents/orc-planner-mini-opus-5-med.md +69 -0
  194. package/templates/agents/orc-planner-mini-sonnet-5-high.md +67 -0
  195. package/templates/agents/orc-planner-opus-5-med.md +160 -0
  196. package/templates/agents/orc-retro-opus-5-med.md +73 -0
  197. package/templates/agents/orc-retro-sonnet-5-high.md +72 -0
  198. package/templates/agents/orc-reviewer-fable-5.md +57 -0
  199. package/templates/agents/orc-reviewer-opus-5-med.md +60 -0
  200. package/templates/agents/orc-scout-opus-5-low.md +40 -0
  201. package/templates/agents/orc-scout-sonnet-4-6-high.md +39 -0
  202. package/templates/agents/orc-system-analyst-opus-5-high.md +120 -0
  203. package/templates/agents/orc-test-author-opus-5-med.md +71 -0
  204. package/templates/agents/orc-trace-writer-haiku-4-5.md +107 -0
  205. package/templates/agents/orc-verifier-opus-5-med.md +69 -0
  206. package/templates/agents/orc-wiki-scanner-opus-4-8-high.md +79 -0
  207. package/templates/agents/orc-wiki-scanner-opus-5-med.md +81 -0
  208. package/templates/agents/orc-wiki-scanner-sonnet-5-high.md +106 -0
  209. package/templates/commands/orc-aftermath.md +49 -0
  210. package/templates/commands/orc-analyze.md +21 -0
  211. package/templates/commands/orc-boundary.md +46 -0
  212. package/templates/commands/orc-brainstorm.md +51 -0
  213. package/templates/commands/orc-budget.md +54 -0
  214. package/templates/commands/orc-challenge.md +58 -0
  215. package/templates/commands/orc-claude.md +14 -0
  216. package/templates/commands/orc-diy.md +13 -0
  217. package/templates/commands/orc-doc.md +128 -0
  218. package/templates/commands/orc-explain.md +20 -0
  219. package/templates/commands/orc-export.md +46 -0
  220. package/templates/commands/orc-fast.md +15 -0
  221. package/templates/commands/orc-grill.md +40 -0
  222. package/templates/commands/orc-handoff.md +52 -0
  223. package/templates/commands/orc-learn.md +17 -0
  224. package/templates/commands/orc-mini.md +12 -0
  225. package/templates/commands/orc-pact.md +44 -0
  226. package/templates/commands/orc-pattern.md +15 -0
  227. package/templates/commands/orc-plan.md +22 -0
  228. package/templates/commands/orc-poly.md +21 -0
  229. package/templates/commands/orc-pr-driver.md +30 -0
  230. package/templates/commands/orc-pr-setup.md +31 -0
  231. package/templates/commands/orc-quick.md +33 -0
  232. package/templates/commands/orc-retro.md +17 -0
  233. package/templates/commands/orc-route.md +41 -0
  234. package/templates/commands/orc-ultra.md +17 -0
  235. package/templates/commands/orc-verify.md +11 -0
  236. package/templates/commands/orc-wiki.md +42 -0
  237. package/templates/commands/orc.md +16 -0
  238. package/templates/hooks/orc-effort-guard.js +178 -0
  239. package/templates/hooks/orc-statusline.js +305 -0
  240. package/templates/hooks/orc-trace.js +471 -0
  241. package/templates/hooks/orc-update-lib.js +125 -0
  242. package/templates/skills/_shared/README.md +50 -0
  243. package/templates/skills/_shared/detecting-artifacts.md +90 -0
  244. package/templates/skills/_shared/drift-recovery.md +98 -0
  245. package/templates/skills/_shared/extra-dispatch.md +1051 -0
  246. package/templates/skills/_shared/fable5-override.md +56 -0
  247. package/templates/skills/_shared/fallback-handoff.md +42 -0
  248. package/templates/skills/_shared/gh-stack-commands.md +65 -0
  249. package/templates/skills/_shared/gotchas.md +177 -0
  250. package/templates/skills/_shared/interview.md +144 -0
  251. package/templates/skills/_shared/lane-suspend.md +82 -0
  252. package/templates/skills/_shared/opus5-only.md +131 -0
  253. package/templates/skills/_shared/pr-templates.md +106 -0
  254. package/templates/skills/_shared/read-ladder.md +54 -0
  255. package/templates/skills/_shared/return-validation.md +145 -0
  256. package/templates/skills/_shared/smoke-gate.md +28 -0
  257. package/templates/skills/_shared/stack-plan.md +135 -0
  258. package/templates/skills/_shared/untrusted-input.md +63 -0
  259. package/templates/skills/context-combiner/SKILL.md +187 -0
  260. package/templates/skills/context-combiner/schemas/combined-report.md +78 -0
  261. package/templates/skills/context-combiner/schemas/combined-requirement-spec.md +87 -0
  262. package/templates/skills/orc/README.md +150 -0
  263. package/templates/skills/orc/SKILL.md +526 -0
  264. package/templates/skills/orc/config.md +389 -0
  265. package/templates/skills/orc/examples/full-run-mock.md +73 -0
  266. package/templates/skills/orc/references/analyst-gates.md +124 -0
  267. package/templates/skills/orc/references/effort-and-mode.md +224 -0
  268. package/templates/skills/orc/references/house-rules.md +20 -0
  269. package/templates/skills/orc/references/intake.md +120 -0
  270. package/templates/skills/orc/references/log-protocol.md +39 -0
  271. package/templates/skills/orc/references/pattern-gate.md +89 -0
  272. package/templates/skills/orc/references/plan-handoff.md +84 -0
  273. package/templates/skills/orc/references/preflight-report.md +220 -0
  274. package/templates/skills/orc/references/security-checklist.md +39 -0
  275. package/templates/skills/orc/references/stop-and-resume.md +160 -0
  276. package/templates/skills/orc/references/trace-protocol.md +314 -0
  277. package/templates/skills/orc/references/ultra-mode.md +123 -0
  278. package/templates/skills/orc/references/wave-grouping.md +121 -0
  279. package/templates/skills/orc/references/wiki-consult.md +177 -0
  280. package/templates/skills/orc/schemas/checkpoint.md +122 -0
  281. package/templates/skills/orc/schemas/intent-spec.md +42 -0
  282. package/templates/skills/orc/schemas/planning-output.md +279 -0
  283. package/templates/skills/orc/subskills/orc-checkpoint/SKILL.md +55 -0
  284. package/templates/skills/orc/subskills/orc-execution/SKILL.md +72 -0
  285. package/templates/skills/orc/subskills/orc-execution/core.md +151 -0
  286. package/templates/skills/orc/subskills/orc-execution/subagent.md +13 -0
  287. package/templates/skills/orc/subskills/orc-planner/SKILL.md +264 -0
  288. package/templates/skills/orc/subskills/orc-planner-mini/SKILL.md +121 -0
  289. package/templates/skills/orc/subskills/orc-pr/SKILL.md +51 -0
  290. package/templates/skills/orc/subskills/orc-pr/pr.md +22 -0
  291. package/templates/skills/orc/subskills/orc-pr/stack-gate.md +108 -0
  292. package/templates/skills/orc/subskills/orc-review-verify/SKILL.md +76 -0
  293. package/templates/skills/orc/subskills/orc-review-verify/core.md +135 -0
  294. package/templates/skills/orc/subskills/orc-review-verify/subagent.md +7 -0
  295. package/templates/skills/orc/subskills/orc-testgen/SKILL.md +45 -0
  296. package/templates/skills/orc/subskills/orc-testgen/core.md +59 -0
  297. package/templates/skills/orc/subskills/orc-testgen/subagent.md +7 -0
  298. package/templates/skills/orc-advisor/SKILL.md +60 -0
  299. package/templates/skills/orc-aftermath/SKILL.md +136 -0
  300. package/templates/skills/orc-aftermath/references/report.md +95 -0
  301. package/templates/skills/orc-analyze/SKILL.md +220 -0
  302. package/templates/skills/orc-analyze/examples/analyze-mock.md +42 -0
  303. package/templates/skills/orc-analyze/references/branching.md +51 -0
  304. package/templates/skills/orc-analyze/references/deep-mode.md +27 -0
  305. package/templates/skills/orc-analyze/references/thin-input.md +77 -0
  306. package/templates/skills/orc-analyze/schemas/report-audit.md +83 -0
  307. package/templates/skills/orc-analyze/schemas/report-prose.md +63 -0
  308. package/templates/skills/orc-analyze/schemas/report-requirement.md +78 -0
  309. package/templates/skills/orc-analyze/schemas/requirement-spec.md +77 -0
  310. package/templates/skills/orc-analyze-mini/SKILL.md +112 -0
  311. package/templates/skills/orc-analyze-mini/examples/quick-analysis-mock.md +31 -0
  312. package/templates/skills/orc-boundary/SKILL.md +208 -0
  313. package/templates/skills/orc-boundary/references/card.md +78 -0
  314. package/templates/skills/orc-boundary/references/gate.md +113 -0
  315. package/templates/skills/orc-brainstorm/SKILL.md +339 -0
  316. package/templates/skills/orc-brainstorm/references/brainstorm-doc.md +133 -0
  317. package/templates/skills/orc-brainstorm/references/lenses.md +152 -0
  318. package/templates/skills/orc-budget/SKILL.md +225 -0
  319. package/templates/skills/orc-budget/references/corpus.md +87 -0
  320. package/templates/skills/orc-challenge/README.md +142 -0
  321. package/templates/skills/orc-challenge/SKILL.md +255 -0
  322. package/templates/skills/orc-challenge/examples/code-module.md +110 -0
  323. package/templates/skills/orc-challenge/examples/council-full-roster.md +273 -0
  324. package/templates/skills/orc-challenge/examples/tsd-two-iterations.md +213 -0
  325. package/templates/skills/orc-challenge/references/conservation.md +107 -0
  326. package/templates/skills/orc-challenge/references/council.md +315 -0
  327. package/templates/skills/orc-challenge/references/cycle-state.md +185 -0
  328. package/templates/skills/orc-challenge/references/dimensions.md +121 -0
  329. package/templates/skills/orc-challenge/references/fix-brief.md +130 -0
  330. package/templates/skills/orc-challenge/references/intake.md +171 -0
  331. package/templates/skills/orc-challenge/references/kinds.md +44 -0
  332. package/templates/skills/orc-challenge/references/plain-english.md +98 -0
  333. package/templates/skills/orc-challenge/references/rubric.md +109 -0
  334. package/templates/skills/orc-challenge/references/sealed-slice.md +97 -0
  335. package/templates/skills/orc-challenge/references/verdict-doc.md +154 -0
  336. package/templates/skills/orc-claude/SKILL.md +199 -0
  337. package/templates/skills/orc-claude/examples/claude-run-mock.md +65 -0
  338. package/templates/skills/orc-claude/references/refresh.md +76 -0
  339. package/templates/skills/orc-claude/references/template.md +109 -0
  340. package/templates/skills/orc-diy/README.md +142 -0
  341. package/templates/skills/orc-diy/SKILL.md +70 -0
  342. package/templates/skills/orc-diy/references/blocks/analyze.md +24 -0
  343. package/templates/skills/orc-diy/references/blocks/execution.md +42 -0
  344. package/templates/skills/orc-diy/references/blocks/extra.md +55 -0
  345. package/templates/skills/orc-diy/references/blocks/header.md +55 -0
  346. package/templates/skills/orc-diy/references/blocks/mock-example.md +22 -0
  347. package/templates/skills/orc-diy/references/blocks/pattern.md +18 -0
  348. package/templates/skills/orc-diy/references/blocks/planning.md +34 -0
  349. package/templates/skills/orc-diy/references/blocks/review.md +18 -0
  350. package/templates/skills/orc-diy/references/blocks/scoring.md +16 -0
  351. package/templates/skills/orc-diy/references/blocks/security.md +25 -0
  352. package/templates/skills/orc-diy/references/blocks/ship.md +25 -0
  353. package/templates/skills/orc-diy/references/blocks/summary.md +18 -0
  354. package/templates/skills/orc-diy/references/blocks/testgen.md +17 -0
  355. package/templates/skills/orc-diy/references/blocks/trace.md +28 -0
  356. package/templates/skills/orc-diy/references/blocks/verify.md +25 -0
  357. package/templates/skills/orc-diy/references/blocks/wiki.md +26 -0
  358. package/templates/skills/orc-diy/references/compile.md +59 -0
  359. package/templates/skills/orc-diy/references/flow-schema.md +100 -0
  360. package/templates/skills/orc-diy/references/locked-blocks.md +37 -0
  361. package/templates/skills/orc-doc/README.md +229 -0
  362. package/templates/skills/orc-doc/SKILL.md +444 -0
  363. package/templates/skills/orc-doc/examples/orc-doc-prd-run.md +325 -0
  364. package/templates/skills/orc-doc/references/chunking.md +527 -0
  365. package/templates/skills/orc-doc/references/gates.md +311 -0
  366. package/templates/skills/orc-doc/references/generation-rules.md +122 -0
  367. package/templates/skills/orc-doc/references/house-rules.md +170 -0
  368. package/templates/skills/orc-doc/references/import-targets.md +40 -0
  369. package/templates/skills/orc-doc/references/plain-language.md +66 -0
  370. package/templates/skills/orc-doc/references/portable-markdown.md +74 -0
  371. package/templates/skills/orc-doc/references/resume-protocol.md +228 -0
  372. package/templates/skills/orc-doc/references/templates/collaboration.md +118 -0
  373. package/templates/skills/orc-doc/references/templates/prd.md +133 -0
  374. package/templates/skills/orc-doc/references/templates/report.md +102 -0
  375. package/templates/skills/orc-doc/references/templates/tsd.md +122 -0
  376. package/templates/skills/orc-doc/references/templates/workflow.md +112 -0
  377. package/templates/skills/orc-explain/SKILL.md +57 -0
  378. package/templates/skills/orc-export/SKILL.md +154 -0
  379. package/templates/skills/orc-fast/SKILL.md +188 -0
  380. package/templates/skills/orc-grill/SKILL.md +207 -0
  381. package/templates/skills/orc-grill/references/grill-doc.md +105 -0
  382. package/templates/skills/orc-handoff/SKILL.md +204 -0
  383. package/templates/skills/orc-handoff/references/handoff-log.md +67 -0
  384. package/templates/skills/orc-handoff/references/surfaces.md +88 -0
  385. package/templates/skills/orc-judge/SKILL.md +82 -0
  386. package/templates/skills/orc-learn/SKILL.md +156 -0
  387. package/templates/skills/orc-learn/examples/learn-run-mock.md +61 -0
  388. package/templates/skills/orc-learn/references/deepen.md +70 -0
  389. package/templates/skills/orc-learn/references/refresh.md +65 -0
  390. package/templates/skills/orc-learn/references/template-knowledge.md +83 -0
  391. package/templates/skills/orc-learn/references/template-learning.md +67 -0
  392. package/templates/skills/orc-mini/SKILL.md +226 -0
  393. package/templates/skills/orc-mini/examples/mini-run-mock.md +50 -0
  394. package/templates/skills/orc-pact/SKILL.md +218 -0
  395. package/templates/skills/orc-pact/references/gate.md +70 -0
  396. package/templates/skills/orc-pact/references/ledger.md +99 -0
  397. package/templates/skills/orc-pattern/SKILL.md +124 -0
  398. package/templates/skills/orc-pattern/references/INDEX.md +73 -0
  399. package/templates/skills/orc-pattern/references/be-django.md +80 -0
  400. package/templates/skills/orc-pattern/references/be-express.md +82 -0
  401. package/templates/skills/orc-pattern/references/be-fastapi.md +107 -0
  402. package/templates/skills/orc-pattern/references/be-go.md +96 -0
  403. package/templates/skills/orc-pattern/references/be-nestjs.md +86 -0
  404. package/templates/skills/orc-pattern/references/be-postgres.md +98 -0
  405. package/templates/skills/orc-pattern/references/fe-a11y.md +36 -0
  406. package/templates/skills/orc-pattern/references/fe-angular.md +87 -0
  407. package/templates/skills/orc-pattern/references/fe-nextjs.md +65 -0
  408. package/templates/skills/orc-pattern/references/fe-perf.md +39 -0
  409. package/templates/skills/orc-pattern/references/fe-react.md +83 -0
  410. package/templates/skills/orc-pattern/references/fe-vue.md +75 -0
  411. package/templates/skills/orc-pattern/schemas/pattern-doc.md +62 -0
  412. package/templates/skills/orc-poly/SKILL.md +216 -0
  413. package/templates/skills/orc-poly/examples/poly-run-mock.md +51 -0
  414. package/templates/skills/orc-poly/references/gather.md +70 -0
  415. package/templates/skills/orc-poly/references/poly-spec.md +84 -0
  416. package/templates/skills/orc-pr-driver/README.md +349 -0
  417. package/templates/skills/orc-pr-driver/SKILL.md +167 -0
  418. package/templates/skills/orc-pr-driver/references/conflict-playbook.md +78 -0
  419. package/templates/skills/orc-pr-driver/references/green-gate.md +105 -0
  420. package/templates/skills/orc-pr-driver/references/orc-run-split.md +99 -0
  421. package/templates/skills/orc-pr-setup/README.md +436 -0
  422. package/templates/skills/orc-pr-setup/SKILL.md +184 -0
  423. package/templates/skills/orc-pr-setup/references/certainty-gate.md +66 -0
  424. package/templates/skills/orc-pr-setup/references/layer-taxonomy.md +67 -0
  425. package/templates/skills/orc-quick/README.md +423 -0
  426. package/templates/skills/orc-quick/SKILL.md +306 -0
  427. package/templates/skills/orc-quick/references/context-doc.md +114 -0
  428. package/templates/skills/orc-quick/references/dispatch-gate.md +163 -0
  429. package/templates/skills/orc-quick/references/gh-mode.md +127 -0
  430. package/templates/skills/orc-retro/SKILL.md +222 -0
  431. package/templates/skills/orc-retro/examples/retro-mock.md +171 -0
  432. package/templates/skills/orc-route/SKILL.md +165 -0
  433. package/templates/skills/orc-verify/SKILL.md +86 -0
  434. package/templates/skills/orc-verify/examples/verify-mock.md +33 -0
  435. package/templates/skills/orc-wiki/README.md +325 -0
  436. package/templates/skills/orc-wiki/SKILL.md +322 -0
  437. package/templates/skills/orc-wiki/examples/wiki-run-mock.md +37 -0
  438. package/templates/skills/orc-wiki/references/claude-md-injection.md +61 -0
  439. package/templates/skills/orc-wiki/references/crosslink-compile.md +39 -0
  440. package/templates/skills/orc-wiki/references/crosslink-kinds.md +57 -0
  441. package/templates/skills/orc-wiki/references/crosslink.md +284 -0
  442. package/templates/skills/orc-wiki/references/extra.md +79 -0
  443. package/templates/skills/orc-wiki/references/integrity-check.md +86 -0
  444. package/templates/skills/orc-wiki/references/orientation.md +51 -0
  445. package/templates/skills/orc-wiki/references/partial-refresh.md +203 -0
  446. package/templates/skills/orc-wiki/references/pattern-prewarm.md +19 -0
  447. package/templates/skills/orc-wiki/references/staleness.md +288 -0
  448. package/templates/skills/orc-wiki/schemas/crosslink-tag.md +166 -0
  449. package/templates/skills/orc-wiki/schemas/wiki-doc.md +120 -0
@@ -0,0 +1,982 @@
1
+ "use strict";
2
+ /* fixtures/docs.js — canned data for `orc ui --fixtures`.
3
+ Document list, per-slug status, the derived section map, lint findings, the
4
+ batching plan and one extracted section.
5
+
6
+ THE RULE FOR EVERY FILE IN HERE: carry ONE OF EVERY STATE, including the
7
+ ugly ones. You cannot DESIGN a STALE chip on a fresh wiki, and a state
8
+ with no fixture is a state nobody has ever looked at. A per-state count
9
+ test asserts this, so a new state cannot ship without one.
10
+
11
+ Shapes MUST match what `bin/cli.js --json` really emits — a drifted
12
+ fixture is worse than no fixture. */
13
+
14
+ const { PROJECT } = require("./shell.js");
15
+
16
+ const docList = {
17
+ ok: true,
18
+ dir: "orc/orc-doc",
19
+ total: 4,
20
+ documents: [
21
+ {
22
+ slug: "prd-checkout-refund-130826",
23
+ title: "Checkout refunds",
24
+ type: "prd",
25
+ target: "notion",
26
+ language: "en",
27
+ cycle: 2,
28
+ document: "present",
29
+ lines: 487,
30
+ sections_total: 17,
31
+ sections_written: 14,
32
+ user_edited: ["02-summary", "08-functional-requirements"],
33
+ where: "Where it stands: /orc-doc · PRD · cycle 2 · 14 of 17 sections written",
34
+ dir: PROJECT + "/orc/orc-doc/prd-checkout-refund-130826",
35
+ next: "/orc-doc resume prd-checkout-refund-130826",
36
+ },
37
+ {
38
+ // The finished one. `complete` is the only state that offers `git add`.
39
+ slug: "runbook-payout-freeze-110826",
40
+ title: "Payout freeze runbook",
41
+ type: "workflow",
42
+ target: "confluence",
43
+ language: "en",
44
+ cycle: 3,
45
+ document: "present",
46
+ lines: 212,
47
+ sections_total: 12,
48
+ sections_written: 12,
49
+ user_edited: [],
50
+ where: "Where it stands: /orc-doc · WORKFLOW · cycle 3 · 12 of 12 sections written",
51
+ dir: PROJECT + "/orc/orc-doc/runbook-payout-freeze-110826",
52
+ next: "/orc-doc resume runbook-payout-freeze-110826",
53
+ },
54
+ {
55
+ // SHIPPED (v0.48.1). The state the panel had no way to show before, and
56
+ // the reason the whereLine grew a suffix: a finished document and a
57
+ // DELIVERED one used to look exactly the same in a listing.
58
+ slug: "adr-queue-choice-070826",
59
+ title: "Queue choice",
60
+ type: "workflow",
61
+ target: "generic",
62
+ language: "en",
63
+ cycle: 3,
64
+ document: "present",
65
+ lines: 212,
66
+ sections_total: 9,
67
+ sections_written: 9,
68
+ user_edited: [],
69
+ where:
70
+ "Where it stands: /orc-doc · WORKFLOW · cycle 3 · 9 of 9 sections written · shipped 12-08-2026 → Notion › Platform › Payout freeze",
71
+ dir: PROJECT + "/orc/orc-doc/adr-queue-choice-070826",
72
+ next: "/orc-doc resume adr-queue-choice-070826",
73
+ },
74
+ {
75
+ // The MONSTER: 40 sections, which is what forces ribbon overflow. It is
76
+ // also the one the split offer exists for.
77
+ slug: "tsd-ledger-rewrite-090826",
78
+ title: "Ledger rewrite",
79
+ type: "tsd",
80
+ target: "docusaurus",
81
+ language: "en",
82
+ cycle: 1,
83
+ document: "present",
84
+ lines: 3140,
85
+ sections_total: 40,
86
+ sections_written: 31,
87
+ user_edited: ["05-detailed-design"],
88
+ where: "Where it stands: /orc-doc · TSD · cycle 1 · 31 of 40 sections written",
89
+ dir: PROJECT + "/orc/orc-doc/tsd-ledger-rewrite-090826",
90
+ next: "/orc-doc resume tsd-ledger-rewrite-090826",
91
+ },
92
+ {
93
+ // NOT STARTED: the outline exists, nothing has been assembled. The CLI's
94
+ // own phrase, and it is never softened into "failed" or "empty".
95
+ slug: "collab-risk-and-payments-130826",
96
+ title: "Risk and Payments working agreement",
97
+ type: "collaboration",
98
+ target: "generic",
99
+ language: "id",
100
+ cycle: 0,
101
+ document: "not started",
102
+ lines: 0,
103
+ sections_total: 13,
104
+ sections_written: 0,
105
+ user_edited: [],
106
+ where: "Where it stands: /orc-doc · COLLABORATION · cycle 0 · 0 of 13 sections written",
107
+ dir: PROJECT + "/orc/orc-doc/collab-risk-and-payments-130826",
108
+ next: "/orc-doc resume collab-risk-and-payments-130826",
109
+ },
110
+ ],
111
+ };
112
+
113
+ const docStatuses = {
114
+ "prd-checkout-refund-130826": {
115
+ ok: true,
116
+ slug: "prd-checkout-refund-130826",
117
+ title: "Checkout refunds",
118
+ type: "prd",
119
+ target: "notion",
120
+ language: "en",
121
+ cycle: 2,
122
+ version: 2,
123
+ state: "in-progress",
124
+ write_mode: "partial",
125
+ // v0.52.0 (D9) — this document's sections are WRITTEN off Claude, which is
126
+ // the state the row chip exists for. A document is the one artifact where
127
+ // the model choice is visible in the output.
128
+ extra: "writer",
129
+ wave: { done: 5, total: 7, role: "write" },
130
+ // document.md behind its own sections/ — coverage-relative, and NAMED.
131
+ document_stale: [{ id: "04-goals-and-success-metrics", heading: "Goals and success metrics", reason: "changed" }],
132
+ sections_dir: "orc/orc-doc/prd-checkout-refund-130826/sections",
133
+ document: "orc/orc-doc/prd-checkout-refund-130826/document.md",
134
+ lines: 487,
135
+ sections_total: 17,
136
+ sections_written: 14,
137
+ open_sections: [
138
+ { id: "12-risks-and-open-questions", heading: "Risks and open questions" },
139
+ { id: "13-rollout-and-measurement-plan", heading: "Rollout and measurement plan" },
140
+ ],
141
+ user_edited: [
142
+ { id: "02-summary", heading: "Summary" },
143
+ { id: "08-functional-requirements", heading: "Functional requirements" },
144
+ ],
145
+ lint: { errors: 2, warnings: 6, target: "notion" },
146
+ dir: PROJECT + "/orc/orc-doc/prd-checkout-refund-130826",
147
+ where: "Where it stands: /orc-doc · PRD · cycle 2 · 14 of 17 sections written",
148
+ resume: "/orc-doc resume prd-checkout-refund-130826",
149
+ },
150
+ "runbook-payout-freeze-110826": {
151
+ ok: true,
152
+ slug: "runbook-payout-freeze-110826",
153
+ title: "Payout freeze runbook",
154
+ type: "workflow",
155
+ target: "confluence",
156
+ language: "en",
157
+ cycle: 3,
158
+ version: 2,
159
+ state: "complete",
160
+ write_mode: "all",
161
+ extra: "off",
162
+ wave: { done: 4, total: 4, role: "write" },
163
+ document_stale: [],
164
+ sections_dir: "orc/orc-doc/runbook-payout-freeze-110826/sections",
165
+ document: "orc/orc-doc/adr-queue-choice-070826/document.md",
166
+ lines: 212,
167
+ sections_total: 12,
168
+ sections_written: 12,
169
+ open_sections: [],
170
+ user_edited: [],
171
+ lint: { errors: 0, warnings: 1, target: "confluence" },
172
+ dir: PROJECT + "/orc/orc-doc/adr-queue-choice-070826",
173
+ where: "Where it stands: /orc-doc · WORKFLOW · cycle 3 · 12 of 12 sections written",
174
+ resume: "/orc-doc resume runbook-payout-freeze-110826",
175
+ },
176
+ "collab-risk-and-payments-130826": {
177
+ ok: true,
178
+ slug: "collab-risk-and-payments-130826",
179
+ title: "Risk and Payments working agreement",
180
+ type: "collaboration",
181
+ target: "generic",
182
+ language: "id",
183
+ cycle: 0,
184
+ // A document started before sections/ became the source of truth. You cannot
185
+ // design the migrate card on a document that is already v2.
186
+ version: 1,
187
+ state: "not-started",
188
+ write_mode: null,
189
+ extra: "off",
190
+ wave: null,
191
+ document_stale: [],
192
+ sections_dir: "orc/orc-doc/collab-risk-and-payments-130826/sections",
193
+ document: null,
194
+ lines: 0,
195
+ sections_total: 13,
196
+ sections_written: 0,
197
+ open_sections: [],
198
+ user_edited: [],
199
+ lint: null,
200
+ dir: PROJECT + "/orc/orc-doc/collab-risk-and-payments-130826",
201
+ where: "Where it stands: /orc-doc · COLLABORATION · cycle 0 · 0 of 13 sections written",
202
+ resume: "/orc-doc resume collab-risk-and-payments-130826",
203
+ },
204
+ };
205
+
206
+ // The map carries one of EVERY section state, plus a repaired rename and a
207
+ // section with findings — none of which exist on a healthy document.
208
+
209
+ const docMapSections = [
210
+ { id: "01-document-info", heading: "Document info", level: 2, start: 3, end: 24, lines: 22, hash: "a91f4c02de77", state: "checked", required: true, findings: 0, renamed_from: null },
211
+ { id: "02-summary", heading: "Summary", level: 2, start: 25, end: 41, lines: 17, hash: "4c02aa1791ff", state: "user-edited", required: true, findings: 0, renamed_from: null },
212
+ { id: "03-the-problem-we-are-solving", heading: "The problem we are solving", level: 2, start: 42, end: 118, lines: 77, hash: "7731bb04ce19", state: "written", required: true, findings: 1, renamed_from: "03-problem-and-context" },
213
+ { id: "04-goals-and-success-metrics", heading: "Goals and success metrics", level: 2, start: 119, end: 176, lines: 58, hash: "5d642c42aa10", state: "written", required: true, findings: 2, renamed_from: null },
214
+ { id: "05-non-goals", heading: "Non-goals", level: 2, start: 177, end: 181, lines: 5, hash: "c28656c5be31", state: "open", required: true, findings: 0, renamed_from: null },
215
+ { id: "06-users-and-jobs-to-be-done", heading: "Users and jobs to be done", level: 2, start: 182, end: 240, lines: 59, hash: "a0c7398aff02", state: "checked", required: true, findings: 0, renamed_from: null },
216
+ { id: "07-scenarios-and-user-stories", heading: "Scenarios and user stories", level: 2, start: 241, end: 333, lines: 93, hash: "3c5eb244cd18", state: "written", required: true, findings: 0, renamed_from: null },
217
+ { id: "08-functional-requirements", heading: "Functional requirements", level: 2, start: 334, end: 470, lines: 137, hash: "be7aca8c0091", state: "user-edited", required: true, findings: 0, renamed_from: null },
218
+ { id: "09-non-functional-requirements", heading: "Non-functional requirements", level: 2, start: 471, end: 480, lines: 10, hash: "4ff6336511cc", state: "planned", required: true, findings: 0, renamed_from: null },
219
+ // v0.49.0 — a file on disk that no validated return ever confirmed. This is
220
+ // exactly what a wave killed by a usage limit leaves behind, and you cannot
221
+ // design the chip for it on a document where every wave finished.
222
+ { id: "09b-open-questions", heading: "Open questions", level: 2, start: 481, end: 486, lines: 6, hash: "9b0c1177fe20", state: "unconfirmed", required: true, findings: 0, renamed_from: null },
223
+ { id: "10-revision-history", heading: "Revision history", level: 2, start: 481, end: 487, lines: 7, hash: "0d8c6a9d7742", state: "written", required: true, findings: 0, renamed_from: null },
224
+ ];
225
+
226
+ const docMap = {
227
+ ok: true,
228
+ slug: "prd-checkout-refund-130826",
229
+ file: "orc/orc-doc/prd-checkout-refund-130826/document.md",
230
+ lines: 487,
231
+ preamble_end: 2,
232
+ sections: docMapSections,
233
+ repaired: [{ from: "03-problem-and-context", to: "03-the-problem-we-are-solving", heading: "The problem we are solving" }],
234
+ note: "line numbers are DERIVED on every read and never stored — a stored line number is a wrong line number one edit later",
235
+ };
236
+
237
+ // A lint-RED card against --target notion. You cannot design the error chip, the
238
+ // rule bars or the import note on a clean document.
239
+
240
+ const docLint = {
241
+ ok: true,
242
+ slug: "prd-checkout-refund-130826",
243
+ file: PROJECT + "/orc/orc-doc/prd-checkout-refund-130826/document.md",
244
+ target: "notion",
245
+ target_label: "Notion",
246
+ max_heading: 3,
247
+ front_matter: "ban",
248
+ lines: 487,
249
+ errors: 2,
250
+ warnings: 6,
251
+ findings: [
252
+ { id: "D-001", severity: "error", rule: "heading-too-deep", line: 128, what: "H4 is deeper than Notion supports (max H3) — it degrades to bold text", quote: "Refund windows" },
253
+ { id: "D-002", severity: "error", rule: "hard-wrap", line: 204, what: "a hard-wrapped paragraph — one paragraph must be one line, or the wrap becomes a line break on import", quote: "The refund window closes at the end of the settlement day, and any" },
254
+ { id: "D-003", severity: "warn", rule: "long-sentence", line: 141, what: "a 47-word sentence — one idea per sentence, and the bar is 35", quote: "Once the settlement job has been started the reconciliation is not run until…" },
255
+ { id: "D-004", severity: "warn", rule: "long-sentence", line: 262, what: "a 39-word sentence — one idea per sentence, and the bar is 35", quote: "Merchants who have opted into instant payouts and who also…" },
256
+ { id: "D-005", severity: "warn", rule: "undefined-acronym", line: 141, what: '"SoR" is used without being expanded on first use', quote: "the SoR for a refund is the ledger" },
257
+ { id: "D-006", severity: "warn", rule: "undefined-acronym", line: 310, what: '"PSP" is used without being expanded on first use', quote: null },
258
+ { id: "D-007", severity: "warn", rule: "placeholder", line: 179, what: "leftover placeholder text: TBD", quote: "> **Open:** TBD — the fraud limit" },
259
+ { id: "D-008", severity: "warn", rule: "fence-no-language", line: 356, what: "a code fence with no language tag", quote: null },
260
+ ],
261
+ readability: {
262
+ sentences: 214,
263
+ avg_sentence_words: 21.4,
264
+ avg_bar: 20,
265
+ longest_sentence_words: 47,
266
+ longest_sentence_line: 141,
267
+ long_word_pct: 18,
268
+ passive_constructions: 31,
269
+ undefined_acronyms: [
270
+ { acronym: "SoR", line: 141 },
271
+ { acronym: "PSP", line: 310 },
272
+ ],
273
+ },
274
+ honesty: [
275
+ "A readability signal is a SIGNAL, not a verdict. This never blocks anything.",
276
+ "It is English-specific and heuristic: passive voice is a pattern match and a syllable count is an estimate.",
277
+ ],
278
+ import_note: null,
279
+ };
280
+
281
+ // A plan with a CLAMP and an OVERSIZED section — both are states you cannot see
282
+ // on a well-shaped document, and both are things the panel must say out loud.
283
+
284
+ const docPlan = {
285
+ ok: true,
286
+ slug: "prd-checkout-refund-130826",
287
+ role: "write",
288
+ agent: "orc-doc-writer-opus-5-med",
289
+ budget_lines: 400,
290
+ parallel: 4,
291
+ clamped: { from: 6, to: 4 },
292
+ waves: [
293
+ {
294
+ n: 1,
295
+ agents: [
296
+ { agent: "orc-doc-writer-opus-5-med", sections: ["09-non-functional-requirements"], headings: ["Non-functional requirements"], budget_lines: 120, oversized: false, part: ".work/09-non-functional-requirements.md" },
297
+ { agent: "orc-doc-writer-opus-5-med", sections: ["12-risks-and-open-questions", "13-rollout-and-measurement-plan"], headings: ["Risks and open questions", "Rollout and measurement plan"], budget_lines: 160, oversized: false, part: ".work/12-risks-and-open-questions.md" },
298
+ { agent: "orc-doc-writer-opus-5-med", sections: ["05-non-goals"], headings: ["Non-goals"], budget_lines: 40, oversized: false, part: ".work/05-non-goals.md" },
299
+ { agent: "orc-doc-writer-opus-5-med", sections: ["08-functional-requirements"], headings: ["Functional requirements"], budget_lines: 620, oversized: true, part: ".work/08-functional-requirements.md" },
300
+ ],
301
+ },
302
+ {
303
+ n: 2,
304
+ agents: [
305
+ { agent: "orc-doc-writer-opus-5-med", sections: ["16-glossary", "17-revision-history"], headings: ["Glossary", "Revision history"], budget_lines: 60, oversized: false, part: ".work/16-glossary.md" },
306
+ ],
307
+ },
308
+ ],
309
+ agents: 5,
310
+ oversized: ["08-functional-requirements"],
311
+ hint: null,
312
+ note: "no section is ever split across two agents, and no two agents ever share a file",
313
+ };
314
+
315
+ const docShow = {
316
+ ok: true,
317
+ slug: "prd-checkout-refund-130826",
318
+ title: "Checkout refunds",
319
+ type: "prd",
320
+ language: "en",
321
+ target: "notion",
322
+ length: "standard",
323
+ template: { source: "shipped:prd", label: "PRD — Product Requirements Document" },
324
+ cycle: 2,
325
+ dir: PROJECT + "/orc/orc-doc/prd-checkout-refund-130826",
326
+ document: PROJECT + "/orc/orc-doc/prd-checkout-refund-130826/document.md",
327
+ total_lines: 487,
328
+ outline: docMapSections.map((s) => ({
329
+ id: s.id,
330
+ heading: s.heading,
331
+ level: 2,
332
+ required: s.id !== "10-revision-history" ? true : true,
333
+ purpose: "what this section is for, in one line",
334
+ affinity: null,
335
+ budget_lines: 120,
336
+ })),
337
+ sections: docMapSections,
338
+ extracts: {},
339
+ cycles: [
340
+ { n: 1, at: "13-08-2026 09:14:02", kind: "write", agents: 5, sections: ["01-document-info", "02-summary"] },
341
+ { n: 2, at: "14-08-2026 11:02:47", kind: "edit", agents: 2, sections: ["04-goals-and-success-metrics"] },
342
+ ],
343
+ lock: null,
344
+ where: "Where it stands: /orc-doc · PRD · cycle 2 · 14 of 17 sections written",
345
+ };
346
+
347
+ // ONE section's text, and only on an explicit Reveal click.
348
+
349
+ const docSection = {
350
+ ok: true,
351
+ slug: "prd-checkout-refund-130826",
352
+ section: "05-non-goals",
353
+ heading: "Non-goals",
354
+ start: 177,
355
+ end: 181,
356
+ lines: 5,
357
+ state: "open",
358
+ hash: "c28656c5be31",
359
+ text: "## Non-goals\n\n> **Open:** nobody has decided whether subscription refunds are in scope. Needed before the rollout section can commit to a date.\n",
360
+ };
361
+
362
+ /* ── v0.48.1: the ugly states ─────────────────────────────────────────────
363
+ You cannot DESIGN a `shipped-drifted` chip, a journal gap row or a
364
+ SOURCE-DRIFTED reference on a document where none of them happen. Every
365
+ state below exists so that somebody has actually looked at it once. */
366
+
367
+ // A document that SHIPPED and has not moved since.
368
+ const docShipped = {
369
+ ok: true,
370
+ slug: "adr-queue-choice-070826",
371
+ title: "Queue choice",
372
+ type: "workflow",
373
+ target: "generic",
374
+ language: "en",
375
+ cycle: 3,
376
+ state: "shipped",
377
+ shipped: {
378
+ at: "12-08-2026 16:40:11",
379
+ where: "Notion › Platform › Payout freeze",
380
+ note: "handed to the on-call rotation",
381
+ cycle: 3,
382
+ lines: 212,
383
+ forced: false,
384
+ force_reason: null,
385
+ },
386
+ drifted_sections: [],
387
+ document: "orc/orc-doc/adr-queue-choice-070826/document.md",
388
+ lines: 212,
389
+ sections_total: 9,
390
+ sections_written: 9,
391
+ open_sections: [],
392
+ user_edited: [],
393
+ lint: { errors: 0, warnings: 2, target: "generic" },
394
+ dir: PROJECT + "/orc/orc-doc/adr-queue-choice-070826",
395
+ where:
396
+ "Where it stands: /orc-doc · WORKFLOW · cycle 3 · 9 of 9 sections written · shipped 12-08-2026 → Notion › Platform › Payout freeze",
397
+ resume: "/orc-doc resume adr-queue-choice-070826",
398
+ };
399
+
400
+ // The same document after somebody edited two sections. `shipped-drifted`
401
+ // KEEPS ITS SLOT — it is an answer, not a gap — and it NAMES what moved,
402
+ // because a whole-file "something changed" cannot tell you what to re-read.
403
+ const docShippedDrifted = {
404
+ ...docShipped,
405
+ slug: "tsd-ledger-rewrite-090826",
406
+ title: "Ledger rewrite",
407
+ type: "tsd",
408
+ state: "shipped-drifted",
409
+ shipped: {
410
+ at: "09-08-2026 11:02:44",
411
+ where: "Slack #platform-eng thread of 9 Aug",
412
+ note: null,
413
+ cycle: 4,
414
+ lines: 640,
415
+ // A FORCED ship, so the override and its verbatim reason are designable.
416
+ forced: true,
417
+ force_reason: "the review was that afternoon and the risks section could follow",
418
+ },
419
+ drifted_sections: [
420
+ { id: "05-data-model", heading: "Data model", reason: "changed" },
421
+ { id: "09-risks", heading: "Risks", reason: "added" },
422
+ ],
423
+ document: "orc/orc-doc/tsd-ledger-rewrite-090826/document.md",
424
+ lines: 661,
425
+ sections_total: 12,
426
+ sections_written: 12,
427
+ user_edited: [{ id: "05-data-model", heading: "Data model" }],
428
+ where:
429
+ "Where it stands: /orc-doc · TSD · cycle 4 · 12 of 12 sections written · shipped 09-08-2026 → Slack #platform-eng thread of 9 Aug (drifted: 2 sections)",
430
+ resume: "/orc-doc resume tsd-ledger-rewrite-090826",
431
+ };
432
+
433
+ // `orc doc next` in each of its three shapes: a FREE action, a PAID action,
434
+ // and a block that names the human decision.
435
+ const docNext = {
436
+ "prd-checkout-refund-130826": {
437
+ ok: true,
438
+ slug: "prd-checkout-refund-130826",
439
+ phase: "D7",
440
+ action: "lint",
441
+ command: "orc doc lint prd-checkout-refund-130826 --json",
442
+ why: "3 sections were written since the last assemble; the free check runs before the paid one",
443
+ paid: false,
444
+ blocked_by: null,
445
+ alternatives: ["orc doc map prd-checkout-refund-130826 --json"],
446
+ },
447
+ "collab-risk-and-payments-130826": {
448
+ ok: true,
449
+ slug: "collab-risk-and-payments-130826",
450
+ phase: "D6",
451
+ action: "plan-write",
452
+ command: "orc doc plan collab-risk-and-payments-130826 --role write --json",
453
+ why: "4 required sections still open",
454
+ paid: true,
455
+ blocked_by: null,
456
+ alternatives: [],
457
+ },
458
+ "tsd-ledger-rewrite-090826": {
459
+ ok: true,
460
+ slug: "tsd-ledger-rewrite-090826",
461
+ phase: "D9",
462
+ action: "ask",
463
+ command: null,
464
+ why: "shipped to Slack #platform-eng thread of 9 Aug, then 2 sections changed (Data model, Risks). Re-send it, or say why not.",
465
+ paid: false,
466
+ blocked_by:
467
+ "shipped to Slack #platform-eng thread of 9 Aug, then 2 sections changed (Data model, Risks). Re-send it, or say why not.",
468
+ alternatives: ['orc doc ship tsd-ledger-rewrite-090826 --where "<where it went this time>"'],
469
+ },
470
+ };
471
+
472
+ // A dirty audit with four classes, each carrying a fix and a route. One has
473
+ // `panel: null` — there is genuinely nothing to press, and a button that goes
474
+ // nowhere is worse than no button.
475
+ const docAudit = {
476
+ "tsd-ledger-rewrite-090826": {
477
+ ok: true,
478
+ slug: "tsd-ledger-rewrite-090826",
479
+ clean: false,
480
+ findings: [
481
+ {
482
+ id: "ship-drifted",
483
+ level: "warn",
484
+ summary:
485
+ "shipped 09-08-2026 11:02:44 to Slack #platform-eng thread of 9 Aug, and 2 sections changed since: Data model, Risks.",
486
+ fix: 'orc doc ship tsd-ledger-rewrite-090826 --where "<where it went this time>"',
487
+ panel: "docs",
488
+ },
489
+ {
490
+ id: "orphan-extract",
491
+ level: "warn",
492
+ summary: ".work/05-data-model.md was extracted (4 days old) and never spliced back.",
493
+ fix: "orc doc splice tsd-ledger-rewrite-090826",
494
+ panel: "docs",
495
+ },
496
+ {
497
+ id: "section-vanished",
498
+ level: "error",
499
+ summary: 'outline lists "Migration plan" but the document has no such heading.',
500
+ fix: "orc doc map tsd-ledger-rewrite-090826",
501
+ panel: "docs",
502
+ },
503
+ {
504
+ id: "source-drifted",
505
+ level: "warn",
506
+ summary: "1 reference file moved since the brief was frozen: docs/ledger-contract.md (SOURCE-DRIFTED)",
507
+ fix: "orc doc context tsd-ledger-rewrite-090826",
508
+ panel: "docs",
509
+ },
510
+ {
511
+ id: "cycle-mismatch",
512
+ level: "warn",
513
+ summary: "doc.json says cycle 4 but records 3 cycles.",
514
+ fix: "orc doc show tsd-ledger-rewrite-090826 --json",
515
+ panel: null,
516
+ },
517
+ ],
518
+ user_edited: [{ id: "05-data-model", heading: "Data model" }],
519
+ },
520
+ "prd-checkout-refund-130826": {
521
+ ok: true,
522
+ slug: "prd-checkout-refund-130826",
523
+ clean: true,
524
+ findings: [],
525
+ user_edited: [
526
+ { id: "02-summary", heading: "Summary" },
527
+ { id: "08-functional-requirements", heading: "Functional requirements" },
528
+ ],
529
+ },
530
+ };
531
+
532
+ // A RICH multi-session journal, and — separately — one with nothing recorded
533
+ // at all, so the gap rows are designable. You cannot lay out "no request was
534
+ // recorded for it" on a document that logged everything.
535
+ const docJournalRich = {
536
+ ok: true,
537
+ slug: "prd-checkout-refund-130826",
538
+ entries: 8,
539
+ recorded: 4,
540
+ gaps: 1,
541
+ journal: [
542
+ {
543
+ at: "13-08-2026 09:02:11",
544
+ origin: "recorded",
545
+ kind: "request",
546
+ text: "write the refund PRD for checkout, and do not invent an SLA — we have not agreed one",
547
+ cycle: 0,
548
+ sections: [],
549
+ source: "user",
550
+ },
551
+ { at: "13-08-2026 09:14:02", origin: "derived", kind: "write cycle", text: null, cycle: 1, sections: ["01-document-info", "02-summary"], agents: 5 },
552
+ {
553
+ at: "13-08-2026 09:40:55",
554
+ origin: "recorded",
555
+ kind: "decision",
556
+ text: "partial refunds are out of scope for v1",
557
+ cycle: 1,
558
+ sections: ["05-non-goals"],
559
+ source: "/orc-grill",
560
+ },
561
+ { at: "13-08-2026 10:11:30", origin: "derived", kind: "check cycle", text: null, cycle: 2, sections: ["02-summary"], agents: 3 },
562
+ { at: null, origin: "observed", kind: "you edited", text: null, cycle: 2, sections: ["02-summary"] },
563
+ {
564
+ at: "14-08-2026 08:20:03",
565
+ origin: "recorded",
566
+ kind: "request",
567
+ text: "the goals section reads like marketing — make it measurable",
568
+ cycle: 2,
569
+ sections: ["04-goals-and-success-metrics"],
570
+ source: "user",
571
+ },
572
+ { at: "14-08-2026 08:44:19", origin: "derived", kind: "edit cycle", text: null, cycle: 3, sections: ["04-goals-and-success-metrics"], agents: 1, gap: true },
573
+ { at: "15-08-2026 17:05:00", origin: "recorded", kind: "note", text: "waiting on legal before the rollout section", cycle: 3, sections: [], source: "user" },
574
+ ],
575
+ };
576
+
577
+ const docJournalEmpty = {
578
+ ok: true,
579
+ slug: "collab-risk-and-payments-130826",
580
+ entries: 3,
581
+ recorded: 0,
582
+ gaps: 3,
583
+ journal: [
584
+ { at: "13-08-2026 14:00:00", origin: "derived", kind: "write cycle", text: null, cycle: 1, sections: ["01-purpose"], agents: 2, gap: true },
585
+ { at: "13-08-2026 14:38:00", origin: "derived", kind: "check cycle", text: null, cycle: 2, sections: ["01-purpose"], agents: 2, gap: true },
586
+ { at: "13-08-2026 15:02:00", origin: "derived", kind: "write cycle", text: null, cycle: 3, sections: ["02-decisions"], agents: 2, gap: true },
587
+ ],
588
+ };
589
+
590
+ // A frozen brief whose reference files no longer all hold, and one where D2
591
+ // was answered "none" — which is an ANSWER and keeps its slot.
592
+ const docContext = {
593
+ "prd-checkout-refund-130826": {
594
+ ok: true,
595
+ slug: "prd-checkout-refund-130826",
596
+ drifted: ["docs/refund-policy.md"],
597
+ context: {
598
+ exists: true,
599
+ path: PROJECT + "/orc/orc-doc/prd-checkout-refund-130826/context.md",
600
+ frozen_at: "13-08-2026",
601
+ request: "write the refund PRD for checkout, and do not invent an SLA — we have not agreed one",
602
+ purpose:
603
+ "- **Intent:** hand to the payments backend team\n- **Audience:** backend engineers (assumed: they know the checkout flow, not the refund ledger)\n- **Expectation:** after reading, they can size the work without asking us anything",
604
+ template: "Shipped base template: PRD (references/templates/prd.md)",
605
+ decisions: "| # | Date | Decision | Asked by |\n|---|---|---|---|\n| 1 | 13-08 | Partial refunds out of scope for v1 | /orc-grill |",
606
+ sources: [
607
+ {
608
+ path: "docs/refund-policy.md",
609
+ read: true,
610
+ digest: "context-sources.md §1",
611
+ state: "SOURCE-DRIFTED",
612
+ note: "changed since the brief was frozen — the brief is not wrong, but it is older than this file",
613
+ },
614
+ { path: "docs/ledger-contract.md", read: true, digest: "context-sources.md §2", state: "ok" },
615
+ { path: "docs/deleted-spec.md", read: true, digest: "context-sources.md §3", state: "MISSING", note: "the file the brief was built on is gone" },
616
+ ],
617
+ source_commit: "b72bd91",
618
+ },
619
+ },
620
+ "collab-risk-and-payments-130826": {
621
+ ok: true,
622
+ slug: "collab-risk-and-payments-130826",
623
+ drifted: [],
624
+ context: {
625
+ exists: true,
626
+ path: PROJECT + "/orc/orc-doc/collab-risk-and-payments-130826/context.md",
627
+ frozen_at: "13-08-2026",
628
+ request: "we need one page risk and payments can both edit before Thursday",
629
+ purpose: "- **Intent:** get two teams to agree in writing\n- **Audience:** risk + payments leads",
630
+ template: "Shipped base template: Collaboration (references/templates/collaboration.md)",
631
+ decisions: null,
632
+ sources: [],
633
+ source_commit: "b72bd91",
634
+ },
635
+ },
636
+ };
637
+
638
+
639
+ // ── the SECTION FILES (v0.49.0) ─────────────────────────────────────────────
640
+ // ONE OF EVERY STATE, the ugly ones included: a section stored as SUB-PARTS
641
+ // (with one of them changed), an `unconfirmed` file a killed wave left behind,
642
+ // a `planned` row that KEEPS ITS SLOT, a `user-edited` one, and a misnumbered
643
+ // id. You cannot design the `unconfirmed` chip on a document where every wave
644
+ // finished, and you cannot design the nested rows on a flat one.
645
+ const docParts = {
646
+ "prd-checkout-refund-130826": {
647
+ ok: true,
648
+ slug: "prd-checkout-refund-130826",
649
+ dir: "orc/orc-doc/prd-checkout-refund-130826/sections",
650
+ front: "sections/00-front.md",
651
+ confirmed: [],
652
+ total: 10,
653
+ written: 6,
654
+ missing: ["09-non-functional-requirements"],
655
+ unconfirmed: ["09b-open-questions"],
656
+ misnumbered: ["09b-open-questions"],
657
+ problems: [],
658
+ wave: { done: 5, total: 7, role: "write" },
659
+ parts: [
660
+ { id: "01-document-info", heading: "Document info", required: true, files: ["sections/01-document-info.md"], nested: false, exists: true, lines: 22, hash: "a91f4c02de77", state: "checked", subsections: [], ordinal_ok: true, findings: 0 },
661
+ { id: "02-summary", heading: "Summary", required: true, files: ["sections/02-summary.md"], nested: false, exists: true, lines: 17, hash: "4c02aa1791ff", state: "user-edited", subsections: [], ordinal_ok: true, findings: 0 },
662
+ { id: "03-the-problem-we-are-solving", heading: "The problem we are solving", required: true, files: ["sections/03-the-problem-we-are-solving.md"], nested: false, exists: true, lines: 77, hash: "7731bb04ce19", state: "written", subsections: [], ordinal_ok: true, findings: 1 },
663
+ {
664
+ // The nested one: a big section stored as sub-parts, invisible to the
665
+ // reader and to `orc doc map`, and only the sub-part that MOVED is
666
+ // marked — which is what makes a re-check cost one small read.
667
+ id: "04-goals-and-success-metrics",
668
+ heading: "Goals and success metrics",
669
+ required: true,
670
+ files: [
671
+ "sections/04-goals-and-success-metrics/00-head.md",
672
+ "sections/04-goals-and-success-metrics/01-north-star.md",
673
+ "sections/04-goals-and-success-metrics/02-guardrails.md",
674
+ ],
675
+ nested: true,
676
+ exists: true,
677
+ lines: 58,
678
+ hash: "5d642c42aa10",
679
+ state: "written",
680
+ subsections: [
681
+ { id: "01-north-star", heading: "North star", file: "sections/04-goals-and-success-metrics/01-north-star.md", exists: true, lines: 21, hash: "aa10c42b7731", changed: false },
682
+ { id: "02-guardrails", heading: "Guardrails", file: "sections/04-goals-and-success-metrics/02-guardrails.md", exists: true, lines: 24, hash: "c42baa1077f3", changed: true },
683
+ ],
684
+ ordinal_ok: true,
685
+ findings: 2,
686
+ },
687
+ { id: "05-non-goals", heading: "Non-goals", required: true, files: ["sections/05-non-goals.md"], nested: false, exists: true, lines: 5, hash: "c28656c5be31", state: "written", subsections: [], ordinal_ok: true, findings: 0 },
688
+ { id: "06-users-and-jobs-to-be-done", heading: "Users and jobs to be done", required: true, files: ["sections/06-users-and-jobs-to-be-done.md"], nested: false, exists: true, lines: 59, hash: "a0c7398aff02", state: "checked", subsections: [], ordinal_ok: true, findings: 0 },
689
+ { id: "07-scenarios-and-user-stories", heading: "Scenarios and user stories", required: true, files: ["sections/07-scenarios-and-user-stories.md"], nested: false, exists: true, lines: 93, hash: "3c5eb244cd18", state: "written", subsections: [], ordinal_ok: true, findings: 0 },
690
+ { id: "08-functional-requirements", heading: "Functional requirements", required: true, files: ["sections/08-functional-requirements.md"], nested: false, exists: true, lines: 137, hash: "be7aca8c0091", state: "user-edited", subsections: [], ordinal_ok: true, findings: 0 },
691
+ // Not written yet. It KEEPS ITS SLOT — "not written" is an answer.
692
+ { id: "09-non-functional-requirements", heading: "Non-functional requirements", required: true, files: [], nested: false, exists: false, lines: 0, hash: null, state: "planned", subsections: [], ordinal_ok: true, findings: 0 },
693
+ // A file a usage limit left behind: on disk, never confirmed by a return.
694
+ { id: "09b-open-questions", heading: "Open questions", required: true, files: ["sections/09b-open-questions.md"], nested: false, exists: true, lines: 6, hash: "9b0c1177fe20", state: "unconfirmed", subsections: [], ordinal_ok: false, findings: 0 },
695
+ ],
696
+ note: "the section files ARE the progress — there is no checkpoint file to invent and none to drift",
697
+ },
698
+ "runbook-payout-freeze-110826": {
699
+ ok: true,
700
+ slug: "runbook-payout-freeze-110826",
701
+ dir: "orc/orc-doc/runbook-payout-freeze-110826/sections",
702
+ front: null,
703
+ confirmed: [],
704
+ total: 2,
705
+ written: 2,
706
+ missing: [],
707
+ unconfirmed: [],
708
+ misnumbered: [],
709
+ problems: [],
710
+ wave: { done: 4, total: 4, role: "write" },
711
+ parts: [
712
+ { id: "01-purpose", heading: "Purpose", required: true, files: ["sections/01-purpose.md"], nested: false, exists: true, lines: 12, hash: "77f3aa10c42b", state: "checked", subsections: [], ordinal_ok: true, findings: 0 },
713
+ { id: "02-the-procedure", heading: "The procedure", required: true, files: ["sections/02-the-procedure.md"], nested: false, exists: true, lines: 84, hash: "0091be7aca8c", state: "checked", subsections: [], ordinal_ok: true, findings: 0 },
714
+ ],
715
+ note: "the section files ARE the progress — there is no checkpoint file to invent and none to drift",
716
+ },
717
+ // Nothing written at all: the card still has to read well, and `orc doc parts`
718
+ // still answers with its object rather than an error.
719
+ "collab-risk-and-payments-130826": {
720
+ ok: true,
721
+ slug: "collab-risk-and-payments-130826",
722
+ dir: "orc/orc-doc/collab-risk-and-payments-130826/sections",
723
+ front: null,
724
+ confirmed: [],
725
+ total: 2,
726
+ written: 0,
727
+ missing: ["01-document-info", "02-purpose-and-scope"],
728
+ unconfirmed: [],
729
+ misnumbered: [],
730
+ problems: [],
731
+ wave: null,
732
+ parts: [
733
+ { id: "01-document-info", heading: "Document info", required: true, files: [], nested: false, exists: false, lines: 0, hash: null, state: "planned", subsections: [], ordinal_ok: true, findings: 0 },
734
+ { id: "02-purpose-and-scope", heading: "Purpose and scope", required: true, files: [], nested: false, exists: false, lines: 0, hash: null, state: "planned", subsections: [], ordinal_ok: true, findings: 0 },
735
+ ],
736
+ note: "the section files ARE the progress — there is no checkpoint file to invent and none to drift",
737
+ },
738
+ };
739
+
740
+
741
+ /* ── v0.49.2 — house rules, the run map, and what it cost ───────────────────
742
+
743
+ ONE OF EVERY STATE, including the ugly ones: no rules · P0-only · all three
744
+ priorities with a DISABLED rule · frozen-and-clean · frozen-and-drifted ·
745
+ a forecast with real history · a forecast that REFUSES for no history ·
746
+ a naive floor · a cost report fully joined · one only partly joined · one
747
+ with nothing joined at all. You cannot design a `—` row on a table where
748
+ every row has a number. */
749
+
750
+ const DOC_RULES_BOUNDARY =
751
+ "House rules govern WHAT the document says and HOW it reads. They can never " +
752
+ "change how this lane runs: never read the body, never store a line number, " +
753
+ "one file per section, a human's paragraph is sacred, never invent a fact, " +
754
+ "never stage, never commit. A rule that asks for one of those comes back as " +
755
+ "unsupported_request — never a guessed compromise.";
756
+
757
+ // v0.49.5 — the ledger is a PLAIN TEXT config, so a fixture is a FILE, not a
758
+ // row list. The states that matter here: a file with all three blocks filled ·
759
+ // a file that is still the bare template · one that was just MIGRATED from the
760
+ // old row store and left a disabled rule behind. You cannot design the migration
761
+ // note on a ledger that was never migrated.
762
+ const NL = String.fromCharCode(10);
763
+ const DOC_RULES_PREAMBLE = [
764
+ "# ORC \u00b7 doc house rules",
765
+ "#",
766
+ "# This project's own standing instructions about WHAT a document says and HOW",
767
+ "# it reads. Put each one under the heading you want it read at \u2014 P0 first,",
768
+ "# then P1, then P2 \u2014 in as many lines as you like. There is no one-line rule",
769
+ "# and no rule count: the whole block is handed to every writer VERBATIM.",
770
+ "#",
771
+ "# Anything above the first `## P0` heading is a note to yourself and is never",
772
+ "# dispatched. Edit this file directly, or in `orc ui` \u25b8 Docs.",
773
+ ].join(NL);
774
+
775
+ const RULE_BLOCKS = {
776
+ P0: [
777
+ "Every document opens with a one-paragraph summary a PM can read on a phone.",
778
+ "Money is always written with its currency, never a bare number.",
779
+ "Never name a customer, a partner or an employee without written consent \u2014 use",
780
+ "a role instead (\"the merchant\", \"the on-call engineer\").",
781
+ ].join(NL),
782
+ P1: [
783
+ "Use the customer's words for a customer-facing concept, not the internal",
784
+ "table name. If both are needed, lead with the customer's.",
785
+ ].join(NL),
786
+ P2: "Prefer a table over a list of more than six items.",
787
+ };
788
+
789
+ const rulesFile = (blocks) => {
790
+ const L = [DOC_RULES_PREAMBLE, ""];
791
+ for (const pr of ["P0", "P1", "P2"]) {
792
+ L.push("## " + pr, "");
793
+ if (blocks[pr]) L.push(blocks[pr], "");
794
+ }
795
+ return L.join(NL);
796
+ };
797
+
798
+ const rulesSlice = (blocks) => {
799
+ const L = [];
800
+ for (const pr of ["P0", "P1", "P2"]) if (blocks[pr]) L.push(pr, blocks[pr], "");
801
+ return L.join(NL).replace(/\s+$/, "");
802
+ };
803
+
804
+ const docRules = {
805
+ ok: true,
806
+ file: PROJECT + "/.claude/orc/doc-house-rules.md",
807
+ exists: true,
808
+ priorities: ["P0", "P1", "P2"],
809
+ preamble: DOC_RULES_PREAMBLE,
810
+ blocks: RULE_BLOCKS,
811
+ text: rulesFile(RULE_BLOCKS),
812
+ slice: rulesSlice(RULE_BLOCKS),
813
+ line: "house rules: 7 lines (P0 4 \u00b7 P1 2 \u00b7 P2 1)",
814
+ counts: { P0: 4, P1: 2, P2: 1 },
815
+ empty: false,
816
+ migrated: null,
817
+ template: rulesFile({ P0: "", P1: "", P2: "" }),
818
+ boundary: DOC_RULES_BOUNDARY,
819
+ };
820
+
821
+ // The bare template. It is NOT an empty card: the headings are already there,
822
+ // which is the whole point of a text config.
823
+ const docRulesEmpty = {
824
+ ok: true,
825
+ file: docRules.file,
826
+ exists: false,
827
+ priorities: ["P0", "P1", "P2"],
828
+ preamble: DOC_RULES_PREAMBLE,
829
+ blocks: { P0: "", P1: "", P2: "" },
830
+ text: docRules.template,
831
+ slice: "",
832
+ line: "house rules: none",
833
+ counts: { P0: 0, P1: 0, P2: 0 },
834
+ empty: true,
835
+ migrated: null,
836
+ template: docRules.template,
837
+ boundary: DOC_RULES_BOUNDARY,
838
+ };
839
+
840
+ // Just migrated from the v0.49.2 row store, with a disabled rule left behind.
841
+ const docRulesMigrated = Object.assign({}, docRules, {
842
+ migrated: { from: PROJECT + "/.claude/orc/doc-house-rules.json", dropped_disabled: 1 },
843
+ });
844
+
845
+ // FROZEN, per document. One clean, one drifted \u2014 and the drifted one NAMES the
846
+ // block that moved and shows what the project says now.
847
+ const docRulesFrozen = {
848
+ "prd-checkout-refund-130826": {
849
+ ok: true,
850
+ slug: "prd-checkout-refund-130826",
851
+ priorities: ["P0", "P1", "P2"],
852
+ frozen: { P0: RULE_BLOCKS.P0, P1: "Use the customer's words.", P2: "" },
853
+ project: RULE_BLOCKS,
854
+ counts: { P0: 4, P1: 1, P2: 0 },
855
+ line: "house rules: 5 lines (P0 4 \u00b7 P1 1)",
856
+ text: rulesSlice({ P0: RULE_BLOCKS.P0, P1: "Use the customer's words.", P2: "" }),
857
+ boundary: DOC_RULES_BOUNDARY,
858
+ drift: {
859
+ drifted: true,
860
+ changed: [
861
+ { priority: "P1", from: "Use the customer's words.", to: RULE_BLOCKS.P1 },
862
+ { priority: "P2", from: "", to: RULE_BLOCKS.P2 },
863
+ ],
864
+ },
865
+ },
866
+ "runbook-payout-freeze-110826": {
867
+ ok: true,
868
+ slug: "runbook-payout-freeze-110826",
869
+ priorities: ["P0", "P1", "P2"],
870
+ frozen: RULE_BLOCKS,
871
+ project: RULE_BLOCKS,
872
+ counts: docRules.counts,
873
+ line: docRules.line,
874
+ text: docRules.slice,
875
+ boundary: DOC_RULES_BOUNDARY,
876
+ drift: { drifted: false, changed: [] },
877
+ },
878
+ };
879
+
880
+ const V = (i, cw, cr, o) => ({ input: i, cache_write: cw, cache_read: cr, output: o });
881
+
882
+ const docForecast = {
883
+ "prd-checkout-refund-130826": {
884
+ ok: true,
885
+ slug: "prd-checkout-refund-130826",
886
+ write_mode: "partial",
887
+ stops: 3,
888
+ waves: [
889
+ { n: 1, agents: 2, sections: ["01-summary", "02-context"], headings: ["Summary", "Context"], budget_lines: 380, p50: V(9000, 61000, 121000, 11000), p90: V(14000, 92000, 190000, 18000) },
890
+ { n: 2, agents: 2, sections: ["03-goals", "04-scope"], headings: ["Goals", "Scope"], budget_lines: 410, p50: V(9600, 66000, 133000, 12000), p90: V(15000, 99000, 205000, 19000) },
891
+ { n: 3, agents: 1, sections: ["05-design"], headings: ["Design"], budget_lines: 300, p50: V(5000, 33000, 66000, 6000), p90: V(8000, 50000, 102000, 9500) },
892
+ ],
893
+ checks: { agents: 3, p50: V(4200, 21000, 58000, 3100), p90: V(6800, 33000, 91000, 5200), note: "the check pass is forecast separately — it is a second decision, not part of the write" },
894
+ tokens: { p50: V(27800, 181000, 378000, 32100), p90: V(43800, 274000, 588000, 51700) },
895
+ raw: { p50: 618900, p90: 957500 },
896
+ weighted: { p50: 278700, p90: 427100 },
897
+ usd: { p50: 6.41, p90: 9.88 },
898
+ price_table: { as_of: "2026-07-01", age_days: 48, stale: false },
899
+ quota: { available: true, label: "Max 20x", window_pct: 4.2, weekly_pct: 1.1 },
900
+ min_samples: 5,
901
+ samples: { write: 14, check: 9 },
902
+ low_confidence_roles: [],
903
+ naive: false,
904
+ unattributed: { blocks: 3, tokens: V(900, 12000, 24000, 1100) },
905
+ free_steps: ["orc doc compile", "orc doc lint", "orc doc parts", "orc doc audit"],
906
+ shown_at: "15-08-2026 17:05:00",
907
+ view: "all",
908
+ },
909
+ // LOW CONFIDENCE, and a naive floor — the state where the honest answer is
910
+ // "this is a floor, not a range".
911
+ "tsd-ledger-rewrite-090826": {
912
+ ok: true,
913
+ slug: "tsd-ledger-rewrite-090826",
914
+ write_mode: "all",
915
+ stops: 1,
916
+ waves: [{ n: 1, agents: 2, sections: ["01-overview", "02-interfaces"], headings: ["Overview", "Interfaces"], budget_lines: 240, p50: V(12000, 40000, 90000, 6000), p90: V(12000, 40000, 90000, 6000) }],
917
+ checks: { agents: 0, p50: V(0, 0, 0, 0), p90: V(0, 0, 0, 0), note: "nothing to check yet" },
918
+ tokens: { p50: V(12000, 40000, 90000, 6000), p90: V(12000, 40000, 90000, 6000) },
919
+ raw: { p50: 148000, p90: 148000 },
920
+ weighted: { p50: 67000, p90: 67000 },
921
+ usd: { p50: 1.62, p90: 1.62 },
922
+ price_table: { as_of: "2025-11-02", age_days: 289, stale: true },
923
+ quota: { available: false, reason: "budget_plan is not set (orc config set budget_plan pro|max5|max20|api)" },
924
+ min_samples: 5,
925
+ samples: { write: 1, check: 0 },
926
+ low_confidence_roles: ["orc-doc-writer-opus-5-med", "orc-doc-checker-opus-5-low"],
927
+ naive: true,
928
+ unattributed: { blocks: 0, tokens: V(0, 0, 0, 0) },
929
+ free_steps: ["orc doc compile", "orc doc lint"],
930
+ shown_at: null,
931
+ view: "all",
932
+ },
933
+ // The REFUSAL. It keeps its slot and says why.
934
+ "collab-risk-and-payments-130826": {
935
+ ok: false,
936
+ reason: "no-history",
937
+ slug: "collab-risk-and-payments-130826",
938
+ hint: "BUDGET · no forecast\n 0 joinable dispatches in .claude/orc/logs.\n I will not invent numbers. Write one wave, then ask again.",
939
+ },
940
+ };
941
+
942
+ const docCost = {
943
+ "prd-checkout-refund-130826": {
944
+ ok: true,
945
+ slug: "prd-checkout-refund-130826",
946
+ runs: [
947
+ { trace: "run-doc-prd-checkout-refund-130826-130826-090211.txt", lane: "doc", date: "2026-08-13", tokens: V(11000, 71000, 152000, 13000), weighted: 110200 },
948
+ { trace: "run-doc-prd-checkout-refund-130826-150826-170500.txt", lane: "doc", date: "2026-08-15", tokens: V(8000, 54000, 121000, 9000), weighted: 83100 },
949
+ ],
950
+ total: { tokens: V(19000, 125000, 273000, 22000), raw: 439000, weighted: 193300, usd: 4.42 },
951
+ by_role: {
952
+ write: { dispatches: 5, tokens: V(14000, 96000, 201000, 17000), weighted: 147100 },
953
+ check: { dispatches: 3, tokens: V(4200, 24000, 61000, 4200), weighted: 38500 },
954
+ digest: { dispatches: 1, tokens: V(800, 5000, 11000, 800), weighted: 7700 },
955
+ },
956
+ by_section: [
957
+ { id: "01-summary", heading: "Summary", dispatches: 2, joined: true, tokens: V(3800, 24000, 51000, 4300), weighted: 37200, usd: 0.86 },
958
+ { id: "02-context", heading: "Context", dispatches: 2, joined: true, tokens: V(4100, 26000, 55000, 4600), weighted: 40100, usd: 0.92 },
959
+ // A SECTION NOTHING COULD BE JOINED TO. `—`, never 0.
960
+ { id: "03-goals", heading: "Goals", dispatches: 1, joined: false, tokens: null, weighted: null, usd: null },
961
+ { id: "04-scope", heading: "Scope", dispatches: 2, joined: true, tokens: V(5000, 31000, 68000, 5500), weighted: 49300, usd: 1.13 },
962
+ ],
963
+ dispatches: 9,
964
+ joined: 8,
965
+ unattributed: { blocks: 2, tokens: V(400, 3000, 7000, 500) },
966
+ price_table: { as_of: "2026-07-01", age_days: 48, stale: false },
967
+ honesty: [
968
+ "The join is nearest-in-time between an ORC trace and a local usage transcript. A dispatch the transcript cannot confirm is reported, never estimated.",
969
+ "A slice that covered two sections splits its cost evenly between them — an even split, not a measurement.",
970
+ "A section with no joinable dispatch reads —, never 0. An unknown reported as a number is worse than an unknown reported as unknown.",
971
+ ],
972
+ },
973
+ // NOTHING joined. An answer, and it keeps its slot.
974
+ "collab-risk-and-payments-130826": {
975
+ ok: false,
976
+ reason: "no-trace",
977
+ slug: "collab-risk-and-payments-130826",
978
+ hint: "no trace for this document yet. A cost report is joined from traces and local transcripts — it is never estimated.",
979
+ },
980
+ };
981
+
982
+ module.exports = { docList, docParts, docStatuses, docMapSections, docMap, docLint, docPlan, docShow, docSection, docShipped, docShippedDrifted, docNext, docAudit, docJournalRich, docJournalEmpty, docContext, docRules, docRulesEmpty, docRulesMigrated, docRulesFrozen, docForecast, docCost };