@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,527 @@
1
+ # The token architecture — sections, parts, compile
2
+
3
+ This file is the point of the lane.
4
+
5
+ > **The orchestrator never reads the document body.**
6
+ > **a lane that reads its own document** has broken this contract.
7
+
8
+ ## The one sentence that changed in v0.49.0
9
+
10
+ **`sections/` is the source of truth. `document.md` is a build artifact.**
11
+
12
+ Before this, `document.md` was the truth and the part files were scratch. So
13
+ every later change was *extract* (copy a section OUT of the monolith) → edit →
14
+ *splice* (write it back IN). The section files existed and were dead, and a
15
+ resumed session, an update and a re-check all routed through the 10,000-line
16
+ file.
17
+
18
+ Now a section lives in its own file, which is the source of truth, and the
19
+ document is rebuilt from those files on demand. **`orc doc compile` costs zero
20
+ model tokens** — it is Node code in the same process, and it always was free.
21
+ Anyone who tells you this release made compiling cheaper is selling something.
22
+ What it bought is **early review, a resumable wave, no round trip, and bounded
23
+ reads**.
24
+
25
+ ## What the orchestrator may hold
26
+
27
+ | It DOES hold | It NEVER holds |
28
+ |---|---|
29
+ | `context.md` (small, written by itself) | the body of `document.md` |
30
+ | `outline.md` (headings only) | the body of any supporting document |
31
+ | `orc doc parts --json` (one row per section: file, state, hash) | the body of any section file |
32
+ | `orc doc map --json` (heading + line range + hash + state per section) | the raw template file |
33
+ | `orc doc lint --json` (findings with line numbers) | anything an agent read to produce its return |
34
+ | each agent's **structured return** (≤ ~40 lines) | |
35
+
36
+ If the orchestrator ever needs a fact from inside the document, **it dispatches
37
+ for it.** Reading is delegated, always.
38
+
39
+ ## What lands on disk
40
+
41
+ ```
42
+ orc/orc-doc/<slug>/
43
+ ├── doc.json CLI-owned state (version 2). Never hand-edited
44
+ ├── context.md the FROZEN brief. Written ONCE, quoted verbatim
45
+ ├── context-sources.md the digest of the D2 documents (anchored)
46
+ ├── outline.md DERIVED by the CLI from doc.json
47
+ ├── gaps.md DERIVED — every Open / Assumption, OUT of the document
48
+ ├── changelog.md one entry per cycle: what changed, and who asked
49
+ ├── sections/ ◄── THE SOURCE OF TRUTH
50
+ │ ├── 00-front.md anything above the first `## ` (front matter, an H1)
51
+ │ ├── 01-document-info.md
52
+ │ ├── 02-summary.md
53
+ │ └── 04-detailed-design/ ◄── a big section, stored as sub-parts
54
+ │ ├── 00-head.md the `## ` heading + any intro prose
55
+ │ ├── 01-data-model.md `### Data model`
56
+ │ └── 02-api-surface.md `### API surface`
57
+ └── document.md ◄── THE BUILD ARTIFACT. Rebuilt, never edited by ORC
58
+
59
+ .claude/orc/run/<slug>/
60
+ └── RESUME.md ◄── the registered v0.42.0 home, and the ONLY place
61
+ `orc resume` and `orc run list` look
62
+ ```
63
+
64
+ `sections/<NN>-<slug>.md` starts with its own `## Heading` and contains nothing
65
+ else. **Directly readable, directly editable, directly diffable in a PR.**
66
+
67
+ **The join key is the FILENAME.** No markers inside the files: an HTML comment
68
+ is a *lint error* in this lane and mangles on a Notion or Google Docs import,
69
+ and the deliverable's cleanliness is this lane's entire product. A marker that
70
+ buys nothing costs the import.
71
+
72
+ **Order comes from `doc.json.outline`, never from the filename number.** The
73
+ number is a *mirror* of the outline index, kept in sync by the CLI — which is
74
+ why `orc doc outline --set` renames the files on disk in the same step. This is
75
+ the existing rule one level up: *a section's id comes from the OUTLINE, never
76
+ from the file's own ordinal.*
77
+
78
+ ## The section map — derived, never stored
79
+
80
+ ```
81
+ $ orc doc map prd-checkout-refund-130826 --json
82
+ {
83
+ "file": "orc/orc-doc/prd-checkout-refund-130826/document.md",
84
+ "lines": 487,
85
+ "sections": [
86
+ { "id": "01-document-info", "heading": "Document info", "level": 2,
87
+ "start": 5, "end": 18, "lines": 14, "hash": "a91f…", "state": "written" },
88
+ { "id": "02-summary", "heading": "Summary", "level": 2,
89
+ "start": 19, "end": 31, "lines": 13, "hash": "4c02…", "state": "user-edited" }
90
+ ]
91
+ }
92
+ ```
93
+
94
+ - **`id`** = ordinal + slugified heading. Stable across every rewrite of the
95
+ BODY, which is what a re-check needs.
96
+ - **`hash`** = SHA-256 of the section's exact text, and it does three jobs:
97
+ **drift detection** (did the user edit it?), **conflict detection** (did it
98
+ change between two sessions?), and **skip detection** (a section whose hash
99
+ has not moved does not need re-checking). *The hash is what turns a re-check
100
+ from a full pass into a diff.*
101
+ - **`state`** ∈ `planned | written | checked | user-edited | open | unconfirmed`.
102
+ COMPUTED from the disk every time — never stored as a claim.
103
+ - **Renames are repaired, not lost.** A heading whose text changed but whose
104
+ position and neighbours match is the same section with a new `id`; `doc.json`
105
+ is updated and the history follows it. A heading that appears with no such
106
+ match is new.
107
+
108
+ Because the map is re-derived after every single write, **no line number in this
109
+ system is ever stale.** That is what makes range-based reading safe.
110
+
111
+ ### `unconfirmed` — the state a usage limit leaves behind
112
+
113
+ A part is `written` only when its hash was recorded from a **validated return**
114
+ (`orc doc parts <slug> --confirm <ids>`, run at the wave's stop sequence). **A
115
+ file present with no recorded hash is `unconfirmed`:** a writer killed mid-flight
116
+ leaves a truncated file, and detection is already paid for. `orc doc parts`
117
+ reports it, `orc doc next` offers to re-write it, and `compile` includes it only
118
+ under `--partial` with the state named. **A half-written section never silently
119
+ becomes the deliverable.**
120
+
121
+ ## Dispatch #0 — digesting the supporting documents
122
+
123
+ The one place a lot of foreign text has to be read, and it is read by a
124
+ dispatched writer:
125
+
126
+ - one dispatch per supporting document, ≤ `doc_max_parallel` in parallel;
127
+ - each returns a **digest, not the content**: the claims that bear on the D1
128
+ context, each anchored `path:line`, plus an explicit `not_covered[]`;
129
+ - the orchestrator concatenates the digests into `context-sources.md` and holds
130
+ only that;
131
+ - a document longer than `doc_max_lines_per_agent` is split the same way
132
+ everything else is, digested in parts, and the parts concatenated.
133
+
134
+ ## The write wave — the CLI computes the batching
135
+
136
+ ```
137
+ $ orc doc plan prd-checkout-refund-130826 --role write --json
138
+ { "write_mode": "partial", "more_waves": 6,
139
+ "waves": [ { "n": 1, "agents": [
140
+ { "agent": "orc-doc-writer-opus-5-med",
141
+ "sections": ["02-summary","03-problem"],
142
+ "parts": [ { "id": "02-summary", "file": "sections/02-summary.md" },
143
+ { "id": "03-problem", "file": "sections/03-problem.md" } ],
144
+ "budget_lines": 120 } ] } ] }
145
+ ```
146
+
147
+ Rules the planner obeys, and none of them is the model's to decide:
148
+
149
+ 1. **Never split a section across two agents.** A writer given half a section
150
+ writes half an idea.
151
+ 2. **one file per section** — never one file for a two-section slice. A slice
152
+ covering two sections returns two `parts[]` entries with two distinct paths.
153
+ Before v0.49.0 it returned one file named after the first section while
154
+ compile looked one up per outline id, so the second section's file never
155
+ existed at all. That was a live bug, and this rule fixes it by construction.
156
+ 3. **≤ `doc_max_parallel` agents per wave** — default 2, and the **hard cap is
157
+ 2**. A larger value is clamped and the clamp is announced.
158
+ 4. **≤ `doc_max_lines_per_agent` planned lines per agent** (default 400).
159
+ 5. Sections that reference each other (`Goals` ↔ `Non-goals`, `Alternatives` ↔
160
+ `Detailed design`) share an `affinity` and land in the **same** agent
161
+ wherever the budget allows — cross-agent consistency is expensive to check
162
+ and free to prevent.
163
+ 6. A single section whose budget exceeds the cap is a **planning smell**: it is
164
+ returned in `oversized[]`. The offer at the outline gate is *"add
165
+ sub-headings and store it in parts"* first, *"make them real sections"*
166
+ second — never an over-budget slice.
167
+
168
+ **Each writer owns exactly ONE file.** No two agents ever share one, and nobody
169
+ ever has `document.md` open. That is why parallel writing is safe here.
170
+
171
+ ### The slice order — `house rules are read first`
172
+
173
+ **Every** dispatched slice (writer, checker, digest) opens with the project's own
174
+ house rules, VERBATIM, **above every ORC instruction**:
175
+
176
+ ```
177
+ HOUSE RULES — this project's own, read these first (verbatim, do not paraphrase)
178
+ P0
179
+ Every document opens with a one-paragraph summary a busy exec can read.
180
+ Money is always written with its currency, never a bare number.
181
+
182
+ P1
183
+ Use the customer's words for a customer-facing concept, not the internal table
184
+ name.
185
+
186
+ These govern WHAT the document says and HOW it reads. They cannot change how
187
+ this lane runs. If a house rule asks for something this lane structurally
188
+ cannot do, return it as unsupported_request — never guess a compromise.
189
+ ```
190
+
191
+ Then ORC's own generation rules (`generation-rules.md`), then the role's own
192
+ fields. **That order is the contract.** The block is `orc doc plan --json`'s
193
+ `doc_rules_text` — already rendered, priority word and all — paired with
194
+ `doc_rules_boundary`. The skill pastes it and never composes a second wording,
195
+ and never re-wraps it: a house rule is the project's own words, and since
196
+ v0.49.5 it is as many lines as the project wanted.
197
+
198
+ Every return carries `doc_rules_applied[]` (the priority words it acted on) and
199
+ `doc_rules_conflicts[]`. A conflict becomes a gap via
200
+ `orc doc log --kind gap`, never a silent resolution.
201
+
202
+ ### The writer's slice
203
+
204
+ ```
205
+ role: write
206
+ language: en
207
+ type: PRD
208
+ audience: <D4 audience, verbatim>
209
+ expectation: <D4 expectation, verbatim>
210
+ sections: [{ id, heading, level, purpose, required, budget_lines }]
211
+ context: <context.md, in full — it is small>
212
+ evidence: <only the context-sources.md entries relevant to these sections>
213
+ rules: references/plain-language.md + references/portable-markdown.md
214
+ + references/generation-rules.md (5b no questions · 5c N/A not filler
215
+ · 5d no local-only references)
216
+ budget: under the budget is correct; over it is a finding
217
+ template: LOCKED — allowed_headings[] is the complete list. You may not add,
218
+ rename, merge or drop a heading. What does not fit is a GAP
219
+ write to: sections/02-summary.md ← one file, and only this one
220
+ ```
221
+
222
+ `template` is present only when `orc doc plan --json` reports
223
+ `template_locked: true` — a supplied template. A shipped base template is a
224
+ floor, and the line is omitted.
225
+
226
+ The return contract is in the agent file. The one thing to enforce on receipt:
227
+ `start` / `end` are **part-local**. Absolute line numbers are the CLI's job at
228
+ compile — asking an agent for an absolute number in a file it cannot see is
229
+ exactly how that number gets invented.
230
+
231
+ ## Partial writing — the biggest saving in the lane
232
+
233
+ `doc_write_mode` is `ask | partial | all`, default `ask`. It is asked **once per
234
+ run and stored** (`orc doc mode <slug> --set partial`), never decided per wave by
235
+ the orchestrator — that is remembered-not-dispatched protocol, the failure this
236
+ repo has already paid for twice.
237
+
238
+ In `partial`, `orc doc plan --role write` returns **wave 1 only**, with
239
+ `more_waves: N`. The rest cannot be bought by accident. You read what wave 1
240
+ wrote, and you redirect before waves 2..N are paid for.
241
+
242
+ ## Compile — free, on demand, deterministic
243
+
244
+ ```
245
+ orc doc compile <slug> [--partial] [--strip-annotations] [--json]
246
+ ```
247
+
248
+ 1. `front` = `sections/00-front.md`, verbatim and first, if it exists.
249
+ 2. `# <title>` — **unless** the front file already carries an H1.
250
+ 3. Every outline entry whose source resolves, **in outline order**.
251
+ 4. Blank-line normalisation runs **ONCE, at the very end**, so a nested join is
252
+ never normalised twice.
253
+
254
+ `--partial` writes what exists. **A missing section is simply ABSENT — never
255
+ stubbed with a note.** The omission is reported loudly OUTSIDE the document: in
256
+ compile's own output, in `status`, in `next` and in `audit`.
257
+
258
+ ### The deliverable carries content only
259
+
260
+ No `> **Open:**`, no `> **Assumption:**`, no note callout, no HTML comment — not
261
+ in `document.md`, and not in any file under `sections/`. This does not relax the
262
+ never-invent-a-fact rule; it moves where the honesty is written down. A gap goes
263
+ to `orc doc log --kind gap` and lands in `gaps.md`; a settled choice goes to
264
+ `--kind decision` and lands in the journal.
265
+
266
+ `orc doc lint`'s **`annotation-in-body`** is an ERROR and matches an EXACT,
267
+ narrow set — `> **Open:**`, `> **Assumption:**`, `> **Note (ORC):**`, an
268
+ `orc-doc:` fence — and nothing else. A user's own line beginning "Note:" is
269
+ content. `compile` **REPORTS** every match in `annotations[]` and never silently
270
+ strips one: rule 4 outranks tidiness, because we cannot tell whose line it is.
271
+ `--strip-annotations` is the explicit opt-in.
272
+
273
+ **Determinism:** the same sources always produce the same file, byte for byte.
274
+ Nothing in the compile reads a clock, a config that could change, or the
275
+ filesystem order — `readdir` is never the order, the outline is.
276
+
277
+ ### `source_hashes` — why nothing has to be remembered
278
+
279
+ `compile` records `compiled.source_hashes = { id → hash of that section's
280
+ assembled source }`. **`document.md` is stale ⇔ some section hashes differently
281
+ today than that recorded.** Pure disk comparison, coverage-relative, no stored
282
+ status word — the `computeWikiFreshness` / `shipped-drifted` rule applied to a
283
+ build artifact. It is why `orc doc ship` can refuse on a stale document and
284
+ *name the sections*.
285
+
286
+ ## The reverse direction: `orc doc split` (also free)
287
+
288
+ ```
289
+ orc doc split <slug> document.md → sections/
290
+ orc doc split <slug> --section <id> --by-heading one section → sub-parts
291
+ ```
292
+
293
+ `docScan` already returns every `##` section with its exact text and
294
+ `docReconcile` already re-keys those to outline ids, so decomposing a monolith
295
+ costs nothing. This is what the migration uses, and it is also what recovers a
296
+ document a human reshaped by hand in an editor.
297
+
298
+ **Round-trip property:** `split` then `compile` reproduces `document.md`
299
+ byte-for-byte for any document the CLI itself produced. There is a test.
300
+
301
+ ## A section too big for one file — sub-parts
302
+
303
+ One head section with a lot of text splits **underneath**, and the reader never
304
+ knows. Forcing it to become several `##` sections would change the document a
305
+ reader sees in order to solve ORC's storage problem, which is backwards.
306
+
307
+ Where the sub-headings come from — and this is the elegant part: **nowhere new.**
308
+ `docScan` already collects every heading level; it merely filtered to level 2.
309
+ So a user template that already has `###` under a `##` carries its own
310
+ sub-structure for free. Three sources, all deterministic, all zero-token:
311
+
312
+ 1. `orc doc init --template <path>` — the `###` under each `##` become `subsections[]`
313
+ 2. `orc doc outline <slug> --set <file>` — same parse
314
+ 3. `orc doc split <slug> --section <id> --by-heading`
315
+
316
+ **When it splits.** A section is stored as sub-parts when it has `subsections[]`
317
+ **and** its budget exceeds `doc_max_lines_per_agent`, or when asked explicitly.
318
+ **No new config key** — `doc_max_lines_per_agent` is already the threshold.
319
+
320
+ ### The five rules that make nesting safe
321
+
322
+ Every one is a **refuse-and-name**, never a silent fix:
323
+
324
+ 1. **Exactly one `##` per section.** `00-head.md` carries it; if that file is
325
+ absent, compile emits the outline's own heading.
326
+ 2. **A child that starts with `##` is a REFUSAL, named by file.** Demoting it to
327
+ `###` would restructure the deliverable; promoting it would split one section
328
+ into two. Neither is ours to choose.
329
+ 3. **A child must start at `###` or deeper.** Anything else is a refusal, named.
330
+ 4. **Order is `outline[i].subsections[]`** — never `readdir`, never the filename
331
+ number.
332
+ 5. **Blank-line normalisation runs ONCE, at the very end.**
333
+
334
+ **One helper, every consumer.** `docSectionSource` returns a section's files and
335
+ its assembled text, and resolves flat-or-nested in one place. Compile, `parts`,
336
+ the staleness check, `extract` and the check-dispatch all call it. A second idea
337
+ of "what a section's source is" is exactly the drift this lane exists to prevent.
338
+
339
+ **Invisible above and below.** `docScan` on the compiled document still cuts on
340
+ `##` only, so `map`, `lint`, `ship` and `audit` are completely unchanged — a
341
+ split section is one section with one range. And the reader gets an ordinary
342
+ document.
343
+
344
+ **Sub-part hashes** live in `doc.json.sections[id].parts`, so a single changed
345
+ sub-part is detectable and **only that sub-part is re-checked**.
346
+
347
+ ## Lint → map → check
348
+
349
+ 1. **`orc doc lint <slug> --target <t> --json`** — **free**. Every mechanical
350
+ portability rule plus the readability signals. Exit 0 clean · 1 findings ·
351
+ 2 no document. **Free checks run before paid ones. Always.**
352
+ 2. **`orc doc map <slug> --json`** — the fresh absolute line numbers.
353
+ 3. **`orc doc plan <slug> --role check --json`** — the checker batches.
354
+
355
+ ### The checker's slice
356
+
357
+ ```
358
+ role: check
359
+ read ONLY: sections/04-goals-and-metrics.md ← Read(file_path), offset 1
360
+ sections: ["04-scope"]
361
+ purpose: <what this section is supposed to do, from outline.md>
362
+ audience: <D4 audience>
363
+ expectation: <D4 expectation>
364
+ language: en
365
+ already reported by lint: [{line: 13, rule: "long-sentence", …}]
366
+ rules: references/generation-rules.md (5b · 5c · 5d, and the template lock)
367
+ ```
368
+
369
+ **One bounded part file per checker, so there is no line arithmetic anywhere in
370
+ the check loop**, and no two checkers ever share a file. A checker never opens a
371
+ second file and is never given the whole document. Findings the lint already
372
+ reported are never re-reported — paying a model to repeat a free check is the
373
+ mistake this ordering exists to prevent.
374
+
375
+ `severity` reuses the house ladder: **P0/P1 block the handoff, P2/P3 are
376
+ advisory** and are shown to the user as optional.
377
+
378
+ ### The dispatch tail NAMES ITS SECTIONS
379
+
380
+ Every `DISPATCH` line this lane writes carries the sections it was for:
381
+
382
+ ```
383
+ DISPATCH orc-doc-writer-opus-5-med :: doc write sections=03-scope,04-risks part=sections/03-scope.md expect=claude-opus-5/medium
384
+ DISPATCH orc-doc-checker-opus-5-low :: doc check sections=03-scope expect=claude-opus-5/low
385
+ DISPATCH orc-doc-writer-opus-5-med :: doc digest source=<path> expect=claude-opus-5/medium
386
+ ```
387
+
388
+ That is what makes `orc doc cost`'s **per-section** attribution honest instead of
389
+ a guess. A slice covering two sections splits its cost evenly between them, said
390
+ out loud; a dispatch nothing can join reads `—`, never `0`.
391
+
392
+ ## The edit round
393
+
394
+ Open `sections/<id>.md`, edit it in place, `orc doc compile`. **No extract, no
395
+ splice, no monolith touched.** For a section stored as sub-parts, the writer
396
+ opens the one ~150-line sub-part rather than the whole 900 lines.
397
+
398
+ **Before each edit dispatch, print one line per finding, in the shape
399
+ `sections/<id>.md · line <n> · <rule>`:**
400
+
401
+ ```
402
+ sections/03-scope.md · line 42 · long-sentence
403
+ sections/03-goals/02-metrics.md · line 12 · local-reference
404
+ ```
405
+
406
+ The numbers are **PART-LOCAL** — the part file is what the writer opens — and
407
+ they come from `orc doc lint <slug> --section <id> --json` and from the
408
+ `findings[]` anchors on each `plan --role edit` part. **After the round, print
409
+ each file touched and the line count it moved by.** The compiled `document.md`
410
+ line number is deliberately never carried: it is stale the moment anything is
411
+ written, which is what rule 2 exists for.
412
+
413
+ **Repair is capped at 2 rounds.** After that the lane reports what is still
414
+ open, honestly, and stops — the same cap-and-report shape as
415
+ `../../_shared/drift-recovery.md`.
416
+
417
+ ## The user's edits are sacred
418
+
419
+ A `user-edited` section is **never** rewritten without an explicit instruction
420
+ naming it. If a finding lands inside one, the finding is *reported* and the fix
421
+ is *offered*, never applied.
422
+
423
+ ## Worked example — a 10,000-line document
424
+
425
+ | | |
426
+ |---|---|
427
+ | Document | 10,000 lines, 40 sections, ~250 lines each |
428
+ | `doc_max_lines_per_agent` | 400 |
429
+ | `doc_max_parallel` | 2 |
430
+ | Batches | 40 sections → 25 agent slices (1–2 sections each) |
431
+ | Waves | ⌈25 / 2⌉ = **13 waves**, parallel within each |
432
+ | In `partial` | **wave 1 is bought, then the lane STOPS.** Waves 2–13 are only paid for if wave 1 was right |
433
+ | Orchestrator context spent | 25 returns × ~30 lines ≈ **750 lines**, plus the map |
434
+ | Naive alternative | 10,000 lines read at least twice ≈ **20,000+ lines** |
435
+
436
+ Where the saving actually is:
437
+
438
+ | Flow | before v0.49.0 | now |
439
+ |---|---|---|
440
+ | First pass | 25 slices, **all bought before anything is viewable** | wave 1 → you read it → redirect or continue |
441
+ | The session dies mid-run | the write loop lived in the orchestrator's head, and `orc resume` could not even see the run | **the section files on disk ARE the progress**; `RESUME.md` is rewritten every wave and `orc resume` finds it |
442
+ | Update 2 sections, fresh session | `map` (40 rows) → `extract` ×2 → `splice` (rewrites the 10k file) | `parts` (40 rows) → open two files, edit in place |
443
+ | Update inside a 900-line section | the writer opens all 900 lines | it opens the one ~150-line sub-part |
444
+ | Re-check after that edit | a RANGE of a document whose line numbers moved | **one bounded part file, offset 1** |
445
+ | Resume months later | needs `document.md` to exist | `status` + `parts` — works before a single compile has ever run |
446
+ | Compile | free | free. It always was |
447
+
448
+ At 40 sections the lane also raises the split offer at the outline gate: a
449
+ document this size is usually several documents.
450
+
451
+ ## Edge cases
452
+
453
+ | Situation | What happens |
454
+ |---|---|
455
+ | The supplied template is enormous or unparseable | Parse headings only. None found → say so, show the shipped outline, ask which to use. Never guess a structure out of prose |
456
+ | The user reshapes `document.md` by hand | `orc doc split` recovers it: rename repair handles a changed heading, and anything ambiguous is a refusal that names the section |
457
+ | `document.md` deleted, `sections/` intact | Nothing is lost. `orc doc compile` rebuilds it, free |
458
+ | `sections/` deleted, `document.md` intact | `orc doc split` recovers every section from it |
459
+ | A wave partially fails | Each section file is independent. Re-dispatch the failed slices only; a file with no validated return is `unconfirmed` and is named |
460
+ | A wave is killed by a usage limit | The files already written stay. `RESUME.md` names where it stopped, `orc resume` finds it, and the next session starts at wave K+1 and re-reads nothing |
461
+ | Two sessions on one slug | The **hash is the guard**, not a lock file: a section whose hash moved is `user-edited`, and nothing rewrites one without an instruction naming it |
462
+
463
+ ## Backward compatibility — v1 → v2
464
+
465
+ `doc.json.version` goes 1 → 2. The migration is **lazy, free, idempotent and
466
+ non-destructive**, and it runs on the first `orc doc <anything> <slug>` — never
467
+ on `list`, because a listing must not mutate.
468
+
469
+ - `document.md` is **split into `sections/` and NEVER deleted** — it becomes the
470
+ build artifact, and `compiled.source_hashes` is seeded from the sections just
471
+ written, so it starts life *fresh*, not stale.
472
+ - A recorded `.work/` extract is the newer edit, so **it wins** for that id.
473
+ - Part files with no `document.md` (a run killed mid-write) are **moved**.
474
+ - A section body that is nothing but a `> **Open:**` stub **does not survive**:
475
+ it becomes `planned`, so the pipeline offers to write it.
476
+ - `RESUME.md` is **moved** to `{run_dir}/{slug}/` and its heading prefix is
477
+ stripped, so the line finally parses.
478
+ - An **unparseable** document (no `##` at all) is a **REFUSAL**: `version` stays
479
+ 1, nothing is written. A guessed structure is worse than none.
480
+
481
+ `assemble`, `extract` and `splice` survive as thin aliases for one release —
482
+ `orc doc next` output gets copied into notes and scripts, and a v1 document
483
+ mid-flight still emits them.
484
+
485
+ ---
486
+
487
+ ## The pipeline is CLI-computed, not remembered (v0.48.1)
488
+
489
+ Everything above describes what each phase DOES. What decides **which phase is
490
+ next** is `orc doc next <slug> --json`, and this lane renders it rather than
491
+ reasoning about it.
492
+
493
+ ```json
494
+ { "ok": true, "slug": "…", "phase": "D7",
495
+ "action": "lint",
496
+ "command": "orc doc lint acme-prd --json",
497
+ "why": "3 sections changed since the last compile; the free check runs before the paid one",
498
+ "paid": false,
499
+ "blocked_by": null,
500
+ "alternatives": ["orc doc map acme-prd --json"] }
501
+ ```
502
+
503
+ Exit **0** = an action is available · **1** = waiting on a human decision, named
504
+ in `blocked_by` · **2** = unknown slug. The same convention as
505
+ `orc pattern status` and `orc diy status`.
506
+
507
+ `paid` is what lets a caller obey the W2 rule — **a free action gets a button, a
508
+ paid action gets a copy-able command** — without holding a second idea of which
509
+ steps cost money.
510
+
511
+ **The wave-review gate is just another `blocked_by`**, which is why partial mode
512
+ needs no new prose: after each wave `next` exits 1 and names the human decision.
513
+
514
+ Never run a command `next` did not name, and never invent the next step. A
515
+ session that improvises the order is exactly the drift this command exists to
516
+ prevent, and it is the drift that is invisible until months later, in a fresh
517
+ context, on a resumed run.
518
+
519
+ ## Reading a section, and who is allowed to
520
+
521
+ `orc doc read <slug> [--section <id>|--toc]` prints the table of contents, or ONE
522
+ section straight from its own file.
523
+
524
+ **The orchestrator never runs `orc doc read`.** It is a command for the HUMAN,
525
+ the same way `orc challenge report` is. Hard rule 0 is not softened by a command
526
+ that happens to print prose: reading the document is still delegated, always, to
527
+ a checker that receives one bounded part file and nothing else.