clearotron 0.5.1 → 0.6.0-beta.1

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 (390) hide show
  1. package/.env.example +7 -7
  2. package/INSTALL.md +10 -10
  3. package/QUICKSTART.md +6 -6
  4. package/README.md +2 -2
  5. package/THIRD-PARTY-NOTICES.md +4 -4
  6. package/bin/README.md +2 -2
  7. package/bin/clearotron.mjs +1 -1
  8. package/bin/connect.mjs +1 -1
  9. package/bin/disconnect.mjs +1 -1
  10. package/bin/example.mjs +2 -2
  11. package/bin/grant.mjs +1 -1
  12. package/bin/onboard.mjs +78 -23
  13. package/bin/start.mjs +88 -33
  14. package/bin/update.mjs +13 -3
  15. package/build-info.json +2 -2
  16. package/docs/DELIVERY.md +1 -1
  17. package/docs/PORTAL.md +1 -1
  18. package/docs/RELEASES.md +1 -1
  19. package/docs/architecture/02-architecture.md +10 -2
  20. package/docs/architecture/03-run-lifecycle.md +6 -2
  21. package/docs/architecture/04-configuration-reference.md +3 -3
  22. package/docs/architecture/05-config-governance.md +5 -4
  23. package/docs/architecture/08-development-guide.md +4 -4
  24. package/docs/architecture/09-security-and-data.md +1 -1
  25. package/{driver/skills/clearance-search/SKILL.md → docs/architecture/retired-manuals/clearance-search-spine.md} +17 -30
  26. package/{driver/skills/clearance-search/templates/email/generic.md → docs/architecture/retired-manuals/email-generic.md} +1 -1
  27. package/{driver/skills/clearance-search → docs/architecture/retired-manuals}/template-formatting.md +3 -4
  28. package/docs/configuration.md +1 -1
  29. package/docs/decisions/0002-no-dark-functionality.md +5 -0
  30. package/driver/CHANGELOG.md +69 -0
  31. package/driver/README.md +11 -1
  32. package/driver/accepted-order.mjs +13 -5
  33. package/driver/attempt-rows.mjs +64 -0
  34. package/driver/attributed-span.mjs +1 -1
  35. package/driver/authority-trees.mjs +1 -1
  36. package/driver/band-shape.mjs +21 -3
  37. package/driver/best-draft.mjs +3 -3
  38. package/driver/blind-frame-record.mjs +2 -2
  39. package/driver/cancel.mjs +3 -2
  40. package/driver/carry-through.mjs +2 -2
  41. package/driver/citation-census.json +3 -3
  42. package/driver/clearance-variants-record.mjs +4 -10
  43. package/driver/common-law-coverage-status.mjs +3 -3
  44. package/driver/common-law-receipts.mjs +2 -2
  45. package/driver/commonlaw-carry-floor.json +3 -3
  46. package/driver/compare.mjs +1 -1
  47. package/driver/config-inventory.mjs +6 -79
  48. package/driver/consumption-ledger.mjs +2 -1
  49. package/driver/contract-arm2-baseline.json +2 -3
  50. package/driver/contract-dictation-registry.mjs +5 -0
  51. package/driver/contract-e3-backlog.mjs +45 -66
  52. package/driver/contract-e3-baseline.json +16 -16
  53. package/driver/contract-vocabulary.mjs +8 -6
  54. package/driver/corrections-feedforward.mjs +3 -1
  55. package/driver/coverage-form-io.mjs +7 -8
  56. package/driver/coverage-tool.mjs +1 -1
  57. package/driver/declination-tool.mjs +2 -2
  58. package/driver/degraded-parts.mjs +9 -9
  59. package/driver/demo-container.mjs +5 -4
  60. package/driver/demo-posture.mjs +17 -0
  61. package/driver/deploy-live-run-guard.mjs +19 -7
  62. package/driver/derived-state.mjs +2 -2
  63. package/driver/dev-portal.mjs +2 -1
  64. package/driver/dispatch-record.mjs +1 -1
  65. package/driver/disposition-tool.mjs +2 -1
  66. package/driver/doubt-closure-tool.mjs +2 -2
  67. package/driver/driver.config.mjs +35 -724
  68. package/driver/e2e-rounds.mjs +3 -4
  69. package/driver/engine/CONTRACT.md +3 -0
  70. package/driver/engine/README.md +2 -0
  71. package/driver/engine/anthropic-agent.mjs +13 -42
  72. package/driver/engine/auth.mjs +74 -0
  73. package/driver/engine/child-record.mjs +1 -1
  74. package/driver/engine/deny-authority-write.mjs +2 -2
  75. package/driver/engine/jx-turn.mjs +10 -2
  76. package/driver/engine/mcp/README.md +1 -1
  77. package/driver/engine/mcp/band-server.mjs +20 -13
  78. package/driver/engine/mcp/codex-config.mjs +1 -1
  79. package/driver/engine/mcp/declination-server.mjs +2 -3
  80. package/driver/engine/mcp/dispositions-server.mjs +3 -3
  81. package/driver/engine/mcp/gather-config.mjs +24 -19
  82. package/driver/engine/mcp/grid-provenance.mjs +1 -1
  83. package/driver/engine/mcp/held-answers.mjs +5 -5
  84. package/driver/engine/mcp/perplexity-server.mjs +16 -7
  85. package/driver/engine/mcp/recording-server.mjs +7 -6
  86. package/driver/engine/mcp/register-server.mjs +29 -0
  87. package/driver/engine/mcp/stdio-server.mjs +5 -5
  88. package/driver/engine/mcp/supplemental.mjs +9 -9
  89. package/driver/engine/openai-agent.mjs +5 -2
  90. package/driver/engine/registry.mjs +103 -0
  91. package/driver/engine/run-choices.mjs +162 -0
  92. package/driver/engine/stamps.mjs +35 -0
  93. package/driver/enqueue-schema.mjs +4 -4
  94. package/driver/envelope-settle.mjs +3 -2
  95. package/driver/feedback-issues.mjs +1 -1
  96. package/driver/feedback-mint.mjs +3 -2
  97. package/driver/feedback-store.mjs +3 -2
  98. package/driver/findings-model.mjs +1 -1
  99. package/driver/flag-snapshot.mjs +5 -4
  100. package/driver/floor-duty.mjs +3 -3
  101. package/driver/foreign-record-links.mjs +1 -1
  102. package/driver/frame-diff-record.mjs +2 -8
  103. package/driver/framework.mjs +1 -1
  104. package/driver/gate-metrics.mjs +10 -11
  105. package/driver/gateway.mjs +220 -839
  106. package/driver/goods-evidence.mjs +26 -14
  107. package/driver/jx-lanes.mjs +3 -3
  108. package/driver/jx-units.mjs +31 -37
  109. package/driver/jx.mjs +44 -59
  110. package/driver/knockout-assess-record.mjs +3 -3
  111. package/driver/knockout-caveats.mjs +21 -0
  112. package/driver/knockout-correction-record.mjs +58 -28
  113. package/driver/knockout-frame-record.mjs +2 -2
  114. package/driver/knockout-register-read.mjs +38 -21
  115. package/driver/knockout-register-record.mjs +5 -6
  116. package/driver/knockout-review-record.mjs +12 -11
  117. package/driver/ladder/model-gauge.mjs +88 -0
  118. package/driver/ladder/next-rung.mjs +296 -0
  119. package/driver/ladder/rescue.mjs +146 -0
  120. package/driver/ladder/stage-tools.mjs +57 -0
  121. package/driver/ladder/turn-failure.mjs +166 -0
  122. package/driver/log.mjs +2 -2
  123. package/driver/matter-frame-record.mjs +4 -4
  124. package/driver/methodology-witness.mjs +2 -2
  125. package/driver/named-band.mjs +60 -3
  126. package/driver/narrative-refutation-record.mjs +145 -42
  127. package/driver/one-build-per-run.mjs +62 -0
  128. package/driver/outbox-backoff.mjs +4 -4
  129. package/driver/owner-screen.mjs +0 -10
  130. package/driver/owner-use-check.mjs +2 -28
  131. package/driver/package.json +1 -1
  132. package/driver/partial-payload-baseline.json +1 -1
  133. package/driver/parts-not-completed.mjs +1 -1
  134. package/driver/pipeline-knockout.mjs +1015 -1001
  135. package/driver/pipeline.mjs +714 -9351
  136. package/driver/placement-decisions.mjs +2 -2
  137. package/driver/placement-form-io.mjs +7 -9
  138. package/driver/placement-union.mjs +0 -6
  139. package/driver/plan-stability.mjs +7 -10
  140. package/driver/portal-acks.mjs +3 -2
  141. package/driver/portal-confirmation.mjs +48 -0
  142. package/driver/portal-families.mjs +3 -2
  143. package/driver/portal-local-auth.mjs +1 -2
  144. package/driver/portal-routes/README.md +24 -0
  145. package/driver/portal-routes/admin.mjs +425 -0
  146. package/driver/portal-routes/compose.mjs +66 -0
  147. package/driver/portal-routes/config.mjs +118 -0
  148. package/driver/portal-routes/connect.mjs +283 -0
  149. package/driver/portal-routes/feedback.mjs +178 -0
  150. package/driver/portal-routes/me.mjs +165 -0
  151. package/driver/portal-routes/queue.mjs +64 -0
  152. package/driver/portal-routes/report.mjs +106 -0
  153. package/driver/portal-routes/run.mjs +508 -0
  154. package/driver/portal-routes/runs.mjs +127 -0
  155. package/driver/portal-routes/usage.mjs +82 -0
  156. package/driver/portal-runs.mjs +588 -0
  157. package/driver/portal-service.mjs +82 -2593
  158. package/driver/portal-static.mjs +3 -1
  159. package/driver/predelivery-lint.mjs +101 -9
  160. package/driver/production-pool-guard.mjs +1 -1
  161. package/driver/profiles.mjs +5 -4
  162. package/driver/progress.mjs +29 -24
  163. package/driver/publish/README.md +10 -5
  164. package/driver/publish/archive-tags.mjs +3 -2
  165. package/driver/publish/demo-marking.mjs +2 -2
  166. package/driver/publish/index.mjs +215 -140
  167. package/driver/publish/knockout.mjs +153 -107
  168. package/driver/publish/office-record-links.mjs +22 -0
  169. package/driver/publish/parse.mjs +20 -5
  170. package/driver/publish/pool-admin.mjs +9 -3
  171. package/driver/publish/render.mjs +11 -3
  172. package/driver/publish/report-dates.mjs +3 -4
  173. package/driver/publish/report-registry.mjs +7 -10
  174. package/driver/publish/seed-pool.mjs +3 -2
  175. package/driver/publish/shell.mjs +106 -0
  176. package/driver/publish/templates/report.css +9 -7
  177. package/driver/queue-order.mjs +4 -3
  178. package/driver/record-carry.mjs +0 -9
  179. package/driver/record-discard.mjs +1 -4
  180. package/driver/record-fold.mjs +3 -3
  181. package/driver/record-goods.mjs +79 -23
  182. package/driver/reference-score.mjs +2 -3
  183. package/driver/register-capabilities.mjs +0 -6
  184. package/driver/register-count.mjs +3 -2
  185. package/driver/register-digest-record.mjs +7 -7
  186. package/driver/register-fixture-marker.mjs +3 -3
  187. package/driver/register-plan.mjs +2 -2
  188. package/driver/register-records.mjs +2 -2
  189. package/driver/register-taint.mjs +3 -3
  190. package/driver/register-unit-record.mjs +48 -9
  191. package/driver/register-unreachable.mjs +4 -3
  192. package/driver/registry-fidelity.mjs +79 -34
  193. package/driver/repair-composers.mjs +14 -9
  194. package/driver/repair-digest.mjs +4 -6
  195. package/driver/repair-scope.mjs +3 -3
  196. package/driver/repair-targets.mjs +24 -9
  197. package/driver/repairs.mjs +44 -58
  198. package/driver/replay-archive.mjs +7 -7
  199. package/driver/report-card-record.mjs +3 -3
  200. package/driver/report-overview-record.mjs +4 -4
  201. package/driver/research-answers.mjs +38 -6
  202. package/driver/research-checks.mjs +4 -4
  203. package/driver/result-noun-fields.mjs +28 -11
  204. package/driver/review-addresses.mjs +163 -0
  205. package/driver/rule-shape.mjs +1 -1
  206. package/driver/run-delivered.mjs +340 -0
  207. package/driver/run-economics.mjs +8 -26
  208. package/driver/run-failed.mjs +545 -0
  209. package/driver/run-integrity.mjs +1 -1
  210. package/driver/run-outcome.mjs +314 -0
  211. package/driver/run-park.mjs +23 -0
  212. package/driver/run-quote.mjs +32 -0
  213. package/driver/run-record.mjs +352 -0
  214. package/driver/run-requirements.mjs +22 -0
  215. package/driver/run-shell.mjs +55 -0
  216. package/driver/runner.mjs +71 -33
  217. package/driver/saved-register-pages.mjs +4 -4
  218. package/driver/score-redaction.mjs +2 -2
  219. package/driver/search-policy.mjs +12 -13
  220. package/driver/settle-stamp.mjs +4 -3
  221. package/driver/skeptic-record.mjs +2 -2
  222. package/driver/skeptic-search.mjs +1 -1
  223. package/driver/skills/README.md +7 -7
  224. package/driver/skills/blind-frame/SKILL.md +1 -2
  225. package/driver/skills/case-law-citation/SKILL.md +9 -37
  226. package/driver/skills/case-law-citation/sources/courtlistener.md +1 -3
  227. package/driver/skills/case-law-citation/sources/eurlex.md +8 -11
  228. package/driver/skills/case-law-citation/sources/legaldatahunter.md +1 -1
  229. package/driver/skills/clearance-common-law/SKILL.md +45 -111
  230. package/driver/skills/clearance-common-law/perplexity-prompts.md +7 -79
  231. package/driver/skills/clearance-register/SKILL.md +15 -33
  232. package/driver/skills/clearance-register/digest.md +35 -96
  233. package/driver/skills/clearance-register/providers/clarivate.md +2 -2
  234. package/driver/skills/clearance-register/providers/corsearch.md +5 -5
  235. package/driver/skills/clearance-register/providers/euipo.md +1 -2
  236. package/driver/skills/clearance-register/providers/free-tier.md +0 -19
  237. package/driver/skills/clearance-register/providers/signa.md +6 -25
  238. package/driver/skills/clearance-register/providers/uspto-local.md +0 -24
  239. package/driver/skills/clearance-register/register-recipes.md +8 -15
  240. package/driver/skills/clearance-register/status-rules.md +6 -24
  241. package/driver/skills/clearance-register/unit.md +11 -20
  242. package/driver/skills/clearance-search/delivery-contract.md +24 -120
  243. package/driver/skills/clearance-search/field-doctrine-pharma.md +1 -5
  244. package/driver/skills/clearance-search/firm-wide-reasoning.md +24 -43
  245. package/driver/skills/clearance-search/phase2-execution.md +29 -77
  246. package/driver/skills/clearance-search/report-prose.md +3 -4
  247. package/driver/skills/clearance-search/risk-framework-demo.md +1 -1
  248. package/driver/skills/clearance-search/risk-framework-triage.manifest.json +3 -3
  249. package/driver/skills/clearance-search/risk-framework-triage.md +7 -9
  250. package/driver/skills/clearance-search/risk-framework.manifest.json +1 -1
  251. package/driver/skills/clearance-search/risk-framework.md +1 -1
  252. package/driver/skills/clearance-search/synthesis-rules.md +30 -107
  253. package/driver/skills/clearance-search/worked-examples.md +5 -5
  254. package/driver/skills/clearance-variants/SKILL.md +46 -45
  255. package/driver/skills/clearance-variants/transliteration-scripts.md +4 -4
  256. package/driver/skills/frame-diff/SKILL.md +1 -1
  257. package/driver/skills/knockout-assess/SKILL.md +6 -14
  258. package/driver/skills/knockout-frame/SKILL.md +1 -1
  259. package/driver/skills/matter-frame/SKILL.md +7 -12
  260. package/driver/skills/matter-frame/watchlist-reference.md +1 -4
  261. package/driver/skills/narrative-refutation/SKILL.md +20 -30
  262. package/driver/skills/placement-inquiry/SKILL.md +10 -20
  263. package/driver/skills-store-provenance.mjs +1 -1
  264. package/driver/stage-context.mjs +32 -35
  265. package/driver/stage-freshness.mjs +127 -11
  266. package/driver/stages-knockout.mjs +49 -22
  267. package/driver/stages.mjs +89 -288
  268. package/driver/status-snapshot.mjs +2 -1
  269. package/driver/steps/correction-cycle.mjs +311 -0
  270. package/driver/steps/corrections.mjs +644 -0
  271. package/driver/steps/delivery.mjs +1287 -0
  272. package/driver/steps/frame-comparison.mjs +927 -0
  273. package/driver/steps/intake.mjs +84 -0
  274. package/driver/steps/open-run.mjs +419 -0
  275. package/driver/steps/overview-and-cards.mjs +899 -0
  276. package/driver/steps/placement-and-digest.mjs +23 -0
  277. package/driver/steps/register-sweep.mjs +1563 -0
  278. package/driver/steps/skeptic-and-follow-up.mjs +836 -0
  279. package/driver/steps/synthesis.mjs +261 -0
  280. package/driver/steps/verdict-gate.mjs +968 -0
  281. package/driver/suite-census.json +456 -96
  282. package/driver/surface-exit-verdict.mjs +0 -8
  283. package/driver/synthesis-record.mjs +72 -6
  284. package/driver/terminal-clamp.mjs +10 -0
  285. package/driver/tokens.mjs +8 -62
  286. package/driver/tool-calls.mjs +2 -2
  287. package/driver/unexecuted-asserts.json +2 -2
  288. package/driver/unit-state-verdict.mjs +1 -1
  289. package/driver/usage-ledger.mjs +2 -1
  290. package/driver/verify-knockout.mjs +20 -35
  291. package/driver/verify.mjs +47 -36
  292. package/driver/web-grid.mjs +3 -4
  293. package/driver/whatif-memo-run.mjs +2 -2
  294. package/driver/whatif-queue.mjs +4 -3
  295. package/driver/withheld-families.mjs +14 -15
  296. package/driver/worker-heartbeat.mjs +3 -2
  297. package/driver/write-up-form.mjs +0 -3
  298. package/mcp-server/CHANGELOG.md +8 -0
  299. package/mcp-server/http-server.mjs +11 -12
  300. package/mcp-server/lib/brief.mjs +22 -4
  301. package/mcp-server/lib/events.mjs +2 -2
  302. package/mcp-server/lib/evidence.mjs +3 -2
  303. package/mcp-server/lib/findings.mjs +2 -1
  304. package/mcp-server/lib/knockout.mjs +9 -10
  305. package/mcp-server/lib/ops.mjs +9 -9
  306. package/mcp-server/lib/runs.mjs +9 -10
  307. package/mcp-server/lib/trace.mjs +1 -1
  308. package/mcp-server/lib/whatif.mjs +2 -3
  309. package/mcp-server/package.json +1 -1
  310. package/mcp-server/server.mjs +5 -5
  311. package/node_modules/buffers/package.json +1 -1
  312. package/package.json +2 -1
  313. package/portal-ui/dist/assets/{index-fPqAU0sx.js → index-CYaO2ygd.js} +26 -14
  314. package/portal-ui/dist/assets/{index-AtB9ZpDH.css → index-izLa9apq.css} +2 -2
  315. package/portal-ui/dist/index.html +4 -4
  316. package/portal-ui/package.json +3 -3
  317. package/providers/README.md +1 -1
  318. package/providers/_shared/answer-memory.mjs +4 -5
  319. package/providers/_shared/execute-plan.mjs +48 -1
  320. package/providers/_shared/records-from-search.mjs +46 -0
  321. package/providers/clarivate/README.md +2 -2
  322. package/providers/clarivate/src/adapter.js +147 -0
  323. package/providers/clarivate/src/core.js +1 -14
  324. package/{driver/engine/mcp/clarivate-server.mjs → providers/clarivate/src/mount.js} +5 -10
  325. package/providers/corsearch/README.md +3 -3
  326. package/providers/corsearch/src/adapter.js +80 -0
  327. package/providers/corsearch/src/core.js +14 -11
  328. package/{driver/engine/mcp/corsearch-server.mjs → providers/corsearch/src/mount.js} +5 -10
  329. package/providers/euipo/README.md +2 -2
  330. package/providers/euipo/src/adapter.js +85 -0
  331. package/providers/euipo/src/core.js +1 -1
  332. package/providers/euipo/src/euipo-client.js +1 -2
  333. package/{driver/engine/mcp/euipo-server.mjs → providers/euipo/src/mount.js} +5 -10
  334. package/providers/free-tier/README.md +2 -2
  335. package/providers/free-tier/src/adapter.js +127 -0
  336. package/{driver/engine/mcp/free-tier-server.mjs → providers/free-tier/src/mount.js} +5 -10
  337. package/providers/jx-subclass/coverage.mjs +1 -6
  338. package/providers/jx-subclass/score-truth.mjs +2 -1
  339. package/providers/oauth-mcp-bridge/CHANGELOG.md +8 -0
  340. package/providers/oauth-mcp-bridge/package.json +1 -1
  341. package/providers/perplexity/src/core.js +2 -2
  342. package/providers/signa/README.md +2 -2
  343. package/providers/signa/src/adapter.js +157 -0
  344. package/providers/signa/src/capabilities.js +0 -3
  345. package/providers/signa/src/core.js +2 -2
  346. package/{driver/engine/mcp/signa-server.mjs → providers/signa/src/mount.js} +7 -12
  347. package/providers/signa/src/offices.generated.js +17 -15
  348. package/providers/uspto-local/README.md +1 -1
  349. package/providers/uspto-local/bin/verify-index.mjs +1 -1
  350. package/providers/uspto-local/src/adapter.js +75 -0
  351. package/{driver/engine/mcp/uspto-local-server.mjs → providers/uspto-local/src/mount.js} +5 -10
  352. package/scripts/band-shape-probe.mjs +2 -2
  353. package/scripts/citation-line-check.mjs +7 -7
  354. package/scripts/compare.mjs +1 -1
  355. package/scripts/dead-names.mjs +2 -2
  356. package/scripts/e2e-first-time.mjs +19 -7
  357. package/scripts/e2e.mjs +13 -13
  358. package/scripts/engine-probe.mjs +1 -1
  359. package/scripts/env-audit.mjs +7 -4
  360. package/scripts/env-classify.mjs +5 -1
  361. package/scripts/feedback-mint.mjs +1 -1
  362. package/scripts/freeze-example-run.mjs +7 -7
  363. package/scripts/mint-suite-census.mjs +2 -2
  364. package/scripts/nightly-notice.mjs +1 -1
  365. package/scripts/release-cut-decision.mjs +7 -2
  366. package/scripts/release-note-required.mjs +26 -9
  367. package/scripts/release-notes-lint.mjs +3 -2
  368. package/scripts/release-version-pr-checks.mjs +1 -1
  369. package/scripts/render-check.mjs +1 -1
  370. package/scripts/settings-render-check.mjs +23 -3
  371. package/scripts/test-run.mjs +5 -5
  372. package/scripts/travelling-predicates.mjs +1 -1
  373. package/scripts/undeclared-field-census.mjs +1 -1
  374. package/scripts/unexecuted-asserts.mjs +3 -3
  375. package/scripts/verify-publishable.mjs +1 -1
  376. package/shared/client-door.mjs +1 -1
  377. package/shared/connect-clients.mjs +1 -1
  378. package/shared/connector-signin-probe.mjs +1 -1
  379. package/shared/customer-store.mjs +3 -2
  380. package/shared/env-aliases.mjs +1 -1
  381. package/shared/invocation.mjs +14 -2
  382. package/shared/names-in-force.mjs +2 -0
  383. package/shared/register-selection.mjs +2 -2
  384. package/shared/store-in-repo.mjs +3 -3
  385. package/shared/summary-blocks.mjs +0 -3
  386. package/shared/trigger-lane.mjs +1 -1
  387. package/shared/vacuous-pass.mjs +2 -2
  388. package/shared/verb-shim.mjs +4 -2
  389. package/vendor/buffers/package.json +1 -1
  390. package/node_modules/exceljs/README.md +0 -3023
@@ -17,7 +17,7 @@
17
17
  },
18
18
  "common-law": {
19
19
  "literal-json-skeleton": 0,
20
- "exactly-these-keys": 2,
20
+ "exactly-these-keys": 0,
21
21
  "dictated-line-shape": 0
22
22
  },
23
23
  "common-law-half": {
@@ -105,7 +105,7 @@
105
105
  "skills/clearance-variants/transliteration-scripts.md": {
106
106
  "literal-json-skeleton": 0,
107
107
  "exactly-these-keys": 0,
108
- "dictated-line-shape": 1
108
+ "dictated-line-shape": 0
109
109
  },
110
110
  "skills/blind-frame/SKILL.md": {
111
111
  "literal-json-skeleton": 4,
@@ -115,25 +115,25 @@
115
115
  "skills/clearance-common-law/SKILL.md": {
116
116
  "literal-json-skeleton": 0,
117
117
  "exactly-these-keys": 1,
118
- "dictated-line-shape": 2
118
+ "dictated-line-shape": 1
119
119
  },
120
120
  "skills/clearance-register/SKILL.md": {
121
121
  "literal-json-skeleton": 0,
122
122
  "exactly-these-keys": 0,
123
- "dictated-line-shape": 3
123
+ "dictated-line-shape": 2
124
124
  },
125
125
  "skills/clearance-register/unit.md": {
126
126
  "literal-json-skeleton": 5,
127
127
  "exactly-these-keys": 0,
128
- "dictated-line-shape": 6
128
+ "dictated-line-shape": 5
129
129
  },
130
130
  "skills/placement-inquiry/SKILL.md": {
131
- "literal-json-skeleton": 1,
132
- "exactly-these-keys": 3,
131
+ "literal-json-skeleton": 0,
132
+ "exactly-these-keys": 2,
133
133
  "dictated-line-shape": 1
134
134
  },
135
135
  "skills/clearance-register/digest.md": {
136
- "literal-json-skeleton": 1,
136
+ "literal-json-skeleton": 0,
137
137
  "exactly-these-keys": 1,
138
138
  "dictated-line-shape": 4
139
139
  },
@@ -150,7 +150,7 @@
150
150
  "skills/clearance-search/synthesis-rules.md": {
151
151
  "literal-json-skeleton": 1,
152
152
  "exactly-these-keys": 1,
153
- "dictated-line-shape": 2
153
+ "dictated-line-shape": 1
154
154
  },
155
155
  "skills/clearance-search/firm-wide-reasoning.md": {
156
156
  "literal-json-skeleton": 0,
@@ -165,7 +165,7 @@
165
165
  "skills/clearance-search/worked-examples.md": {
166
166
  "literal-json-skeleton": 0,
167
167
  "exactly-these-keys": 0,
168
- "dictated-line-shape": 1
168
+ "dictated-line-shape": 0
169
169
  },
170
170
  "skills/clearance-search/report-prose.md": {
171
171
  "literal-json-skeleton": 0,
@@ -175,21 +175,21 @@
175
175
  "skills/case-law-citation/SKILL.md": {
176
176
  "literal-json-skeleton": 0,
177
177
  "exactly-these-keys": 1,
178
- "dictated-line-shape": 1
178
+ "dictated-line-shape": 0
179
179
  },
180
180
  "skills/narrative-refutation/SKILL.md": {
181
181
  "literal-json-skeleton": 0,
182
182
  "exactly-these-keys": 2,
183
- "dictated-line-shape": 1
183
+ "dictated-line-shape": 0
184
184
  },
185
185
  "skills/clearance-search/delivery-contract.md": {
186
186
  "literal-json-skeleton": 0,
187
- "exactly-these-keys": 1,
188
- "dictated-line-shape": 1
187
+ "exactly-these-keys": 0,
188
+ "dictated-line-shape": 0
189
189
  }
190
190
  },
191
191
  "totals": {
192
- "stages": 43,
193
- "files": 62
192
+ "stages": 41,
193
+ "files": 49
194
194
  }
195
195
  }
@@ -17,7 +17,7 @@
17
17
  //
18
18
  // D1 verify.mjs connotationDispositionFail fail(`connotation_${reason}:…`) — reason is a member of CALL_REASON_SET
19
19
  // D2 verify.mjs checkFindingsSibling fail(String(e.message)…) — parseFindingsJson throws token-first
20
- // D3 verify.mjs:1259 checkJson: fail(String(e.message)…) — FIVE parsers reach this one site
20
+ // D3 verify.mjs:1270 checkJson: fail(String(e.message)…) — FIVE parsers reach this one site
21
21
  // D4 verify.mjs parseCoverageLedgerJson, same shape
22
22
  // D5 verify.mjs validators.registerFindings fail(`${unaccounted[0].token}:…`) — token minted in a DATA ROW
23
23
  // D6 verify.mjs validators.registerFindings fail(`${violations[0].token}…`) — findUnexecutedCleanClaims() in register-plan.mjs
@@ -341,7 +341,7 @@ export const ARM1_EXEMPTIONS = [
341
341
  * STAGE-UNREACHABLE VALIDATORS — not exemptions, a SCOPE statement.
342
342
  *
343
343
  * verify.mjs wires four validators no STAGES entry reaches: findings, report, audit,
344
- * clientSummary. They are NOT dead code — replay-archive.mjs:128 replayRun and check() in mcp-server/lib/coverage.mjs
344
+ * clientSummary. They are NOT dead code — replay-archive.mjs:130 replayRun and check() in mcp-server/lib/coverage.mjs
345
345
  * index validators[key] dynamically and the MCP server declares `audit` required — but no stage dispatches
346
346
  * them, so their tokens are unaccountable BY CONSTRUCTION with respect to a stage partition. The
347
347
  * client-summary STAGE was deleted 2026-08-01 (no line to cite: the stage is gone) and its validator outlived it.
@@ -431,7 +431,7 @@ export const TRIPWIRE_OUT_OF_SCOPE = [
431
431
  {
432
432
  prefix: "framework_",
433
433
  site: "driver/framework.mjs, driver/framework-method.mjs",
434
- reason: "parseFrameworkManifest's throws never reach a stage: verify.mjs:70 readRunFramework wraps the call and returns {invalid:true}, and verify.mjs:1180 checkFindingsSibling emits its OWN token (framework_manifest_unreadable) instead. The family is unreachable by construction. parseFrameworkMethod's `framework_method_*` throws take the same road: readFrozenMethod wraps the parse and returns {invalid}, and checkFindingsSibling emits its own `framework_method_unreadable`.",
434
+ reason: "parseFrameworkManifest's throws never reach a stage: verify.mjs:70 readRunFramework wraps the call and returns {invalid:true}, and verify.mjs:1197 checkFindingsSibling emits its OWN token (framework_manifest_unreadable) instead. The family is unreachable by construction. parseFrameworkMethod's `framework_method_*` throws take the same road: readFrozenMethod wraps the parse and returns {invalid}, and checkFindingsSibling emits its own `framework_method_unreadable`.",
435
435
  },
436
436
  {
437
437
  prefix: "register_plan_",
@@ -485,11 +485,11 @@ export const INNER_CODES = Object.freeze([
485
485
  { code: "quote_unbound", mints: ["driver/connotation-search.mjs:2113"], rollsUpTo: ["connotation_quote_unbound"],
486
486
  why: "The ruled-but-unbound row. Projected as `unbound` in connotationDispositionFail() in verify.mjs, and reported only once nothing is unruled." },
487
487
  { code: "token_absent", mints: ["driver/connotation-search.mjs:2140"], rollsUpTo: ["connotation_token_absent"],
488
- why: "#592 split this out of no_ruling. Row-level only — PROGRESS_TOKENS declared in repairs.mjs says so in as many words: `never a top-level token`." },
488
+ why: "#592 split this out of no_ruling. Row-level only: connotationDispositionFail() in verify.mjs never reports it as a top-level token, so PROGRESS_TOKENS declared in repairs.mjs has no row for it." },
489
489
  { code: "cite_absent", mints: ["driver/connotation-search.mjs:2149"], rollsUpTo: ["connotation_cite_absent"],
490
- why: "#592, as token_absent. PROGRESS_TOKENS declared in repairs.mjs: `row-level only — never a top-level token`." },
490
+ why: "#592, as token_absent: row-level only, never a top-level token, and no row in PROGRESS_TOKENS declared in repairs.mjs." },
491
491
  { code: "no_ruling", mints: ["driver/connotation-search.mjs:2156"], rollsUpTo: ["connotation_no_ruling"],
492
- why: "The residual the other two split off from, and it has representatives — see the mint site. Declared as a corrective token at repairs.mjs:308 and in stages.mjs's E1 rows, always namespaced." },
492
+ why: "The residual the other two split off from, and it has representatives — see the mint site. Declared as a corrective token in PROGRESS_TOKENS in repairs.mjs and in stages.mjs's E1 rows, always namespaced." },
493
493
  // THE ONE THAT IS RENAMED, NOT NAMESPACED — and it is the reason this table stores the composite as
494
494
  // data rather than deriving it. Every derivation anyone would write is `connotation_` + the code, and
495
495
  // for this row that produces `connotation_no_recorded_queries`, which nothing mints and nothing covers.
@@ -560,6 +560,8 @@ export const COVERED_SOURCES = [
560
560
  "verify.mjs", "gateway.mjs",
561
561
  "common-law-receipts.mjs", "connotation-search.mjs",
562
562
  "disposition-union.mjs", "record-origins.mjs",
563
+ // The door to a run's files. It mints no token today; reading it means a parser added there is seen.
564
+ "run-record.mjs",
563
565
  // B — verify.mjs reaches the typed transport's audit and its path resolver, so the tripwire reads both.
564
566
  // `disposition-call-audit.mjs` is where the four transport reasons live as literals; without it here
565
567
  // that family could grow a fifth member no vocabulary row covers, and nothing would notice.
@@ -349,7 +349,9 @@ export function buildCorrectionsApplied(rows, preDoc, postDoc, { sections = null
349
349
  // note, an action or the mark assessment is about that line, and a mark or owner named inside the
350
350
  // line it quotes is incidental. Asked only where no ordinal was declared: a declaration still wins.
351
351
  const sec = !declaredOrds.length ? (sections ?? []).find((x) => x.n === r.n) ?? null : null;
352
- const hit = preDoc && !declaredOrds.length && !sec ? linesOf(r.text, preLines) : [];
352
+ // A flag that declared its parts by address is bound to those lines; only a flag that declared none is matched by prose.
353
+ const declaredLines = (Array.isArray(r.lines) ? r.lines : []).map((a) => preLines.find((l) => l.key === a)).filter(Boolean);
354
+ const hit = preDoc && !declaredOrds.length && !sec ? (declaredLines.length ? declaredLines : linesOf(r.text, preLines)) : [];
353
355
  const targets = declaredOrds.length ? declaredOrds.map(label)
354
356
  : sec ? [sec.label]
355
357
  : hit.length ? hit.map((l) => l.label) : targetsOf(r.text, known);
@@ -27,12 +27,12 @@
27
27
 
28
28
  import { existsSync, mkdirSync, readFileSync, readdirSync, writeFileSync } from "node:fs";
29
29
  import { join, dirname, basename } from "node:path";
30
- import { driverDir } from "../shared/driver-dir.mjs"; //
31
30
  import { COVERAGE_STATUSES, COVERAGE_FORM_NAME, REGISTER_AXES } from "./coverage-ledger.mjs";
32
31
  import { coverageFormSidecarName, parseCoverageForm } from "./coverage-form.mjs";
33
32
  import { capabilitiesFor } from "./register-capabilities.mjs";
34
33
  import { readWithheldFamilies, splitWaitingFamilies } from "./withheld-families.mjs";
35
34
  import { slicesTakenOutByAxis } from "../shared/slices-taken-out.mjs"; // the slices the searches record took out of the band
35
+ import { driverDir, paths, readJsonOrNull } from "./run-record.mjs";
36
36
 
37
37
  export { COVERAGE_FORM_NAME };
38
38
 
@@ -53,14 +53,13 @@ export function coverageFormPaths(runDir, formName = COVERAGE_FORM_NAME) {
53
53
  };
54
54
  }
55
55
 
56
- const readJson = (p) => { try { return JSON.parse(readFileSync(p, "utf8")); } catch { return null; } };
57
56
 
58
57
  /**
59
58
  * The era stamp, read. Returns {required, formName} — `required` is true only when a driver carrying
60
59
  * this code stamped it, so every archived run answers false and the arm stays off for all of them.
61
60
  */
62
61
  export function coverageFormStamp(runDir) {
63
- const s = readJson(driverDir(runDir, "coverage-enum.json"));
62
+ const s = readJsonOrNull(paths(runDir).coverageEnum);
64
63
  return {
65
64
  required: s?.form_required === true,
66
65
  formName: (typeof s?.form_path === "string" && s.form_path.trim())
@@ -89,16 +88,16 @@ export function coverageFormStamp(runDir) {
89
88
  * (`generated_from.bands_unreadable`) rather than swallowed, so the absence is visible in the artifact.
90
89
  */
91
90
  export function coverageFormInput(runDir) {
92
- const exec = readJson(driverDir(runDir, "plan-execution.json"));
91
+ const exec = readJsonOrNull(paths(runDir).planExecution);
93
92
  if (!exec || typeof exec !== "object" || !Array.isArray(exec.skeleton)) return { input: null, absent: "no_plan_execution_receipt" };
94
- const plan = readJson(driverDir(runDir, "register-plan.json"));
93
+ const plan = readJsonOrNull(paths(runDir).registerPlan);
95
94
  if (!plan || !Array.isArray(plan.entries)) return { input: null, absent: "no_frozen_plan" };
96
95
  const bandBlocksByAxis = {};
97
96
  const bandsUnreadable = [];
98
97
  for (const s of exec.skeleton) {
99
98
  const axis = String(s?.axis ?? "").trim();
100
99
  if (!axis) continue;
101
- const parsed = readJson(join(runDir, "register-units", `${axis}-band.json`));
100
+ const parsed = readJsonOrNull(join(runDir, "register-units", `${axis}-band.json`));
102
101
  if (parsed == null) { bandsUnreadable.push(axis); continue; }
103
102
  bandBlocksByAxis[axis] = Array.isArray(parsed) ? parsed : (Array.isArray(parsed?.blocks) ? parsed.blocks : []);
104
103
  }
@@ -218,7 +217,7 @@ export function writeCoverageForm(runDir, form, formName = COVERAGE_FORM_NAME) {
218
217
  * The existing off-enum sentinel content is preserved — one file, two facts, one write.
219
218
  */
220
219
  export function armCoverageForm(runDir, formName = COVERAGE_FORM_NAME) {
221
- const p = driverDir(runDir, "coverage-enum.json");
220
+ const p = paths(runDir).coverageEnum;
222
221
  mkdirSync(dirname(p), { recursive: true });
223
222
  writeFileSync(p, JSON.stringify({
224
223
  statuses: COVERAGE_STATUSES,
@@ -229,7 +228,7 @@ export function armCoverageForm(runDir, formName = COVERAGE_FORM_NAME) {
229
228
 
230
229
  /** The off-enum sentinel WITHOUT the form arm — a run whose plan apparatus is out of reach. */
231
230
  export function armCoverageEnumOnly(runDir) {
232
- const p = driverDir(runDir, "coverage-enum.json");
231
+ const p = paths(runDir).coverageEnum;
233
232
  mkdirSync(dirname(p), { recursive: true });
234
233
  writeFileSync(p, JSON.stringify({ statuses: COVERAGE_STATUSES }, null, 2) + "\n");
235
234
  }
@@ -29,7 +29,7 @@
29
29
 
30
30
  import { readFileSync, writeFileSync, mkdirSync, appendFileSync } from "node:fs";
31
31
  import { join, basename } from "node:path";
32
- import { driverDir } from "../shared/driver-dir.mjs"; //
32
+ import { driverDir } from "./run-record.mjs"; //
33
33
  import { coverageFormAbsence, formRowKey } from "./coverage-form.mjs";
34
34
  import { unionCoverageForm, outstandingCoverageRows } from "./coverage-union.mjs";
35
35
  import { coverageFormStamp, coverageFormInput, coverageFormPaths, readCoverageForm, writeCoverageForm } from "./coverage-form-io.mjs";
@@ -17,12 +17,12 @@
17
17
  // from a clean accept and reads differently to the next reader.
18
18
  import { readFileSync, writeFileSync, mkdirSync, appendFileSync } from "node:fs";
19
19
  import { join, basename } from "node:path";
20
- import { driverDir, ensureDriverDir } from "../shared/driver-dir.mjs"; // — one definition of where `_driver/` is
21
20
  import { acceptDeclinationCall, MAX_DECLINATIONS_PER_CALL, PAGE_KEY_PREFIX } from "./declination-call.mjs";
22
21
  import { normalizeRecordUri } from "./registry-fidelity.mjs";
23
22
  import { citedFindingNumbers } from "./finding-citations.mjs"; // the findings a ground cites, recorded with it
24
23
  import { idSetHash, priorCallWithIdSet, listGeneration } from "./call-repeat.mjs"; //
25
24
  import { PARK_AFTER_REFUSALS, parkedIds, refusalCountsBy } from "./refusal-bound.mjs"; //
25
+ import { driverDir, ensureDriverDir, readJson } from "./run-record.mjs"; // — one definition of where `_driver/` is
26
26
 
27
27
  const CALLS_DIR = "declination-calls";
28
28
  export const DECLINATION_LEDGER_NAME = "declinations.json";
@@ -84,7 +84,7 @@ export function callsSoFar(runDir) {
84
84
  export function readDeclinations(runDir) {
85
85
  const { ledger } = declinationCallPaths(runDir, 0);
86
86
  try {
87
- const raw = JSON.parse(readFileSync(ledger, "utf8"));
87
+ const raw = readJson(ledger);
88
88
  const byUri = new Map();
89
89
  const byPage = new Map(); // a page the web notes marked, keyed by its normalised address
90
90
  for (const d of Array.isArray(raw?.declinations) ? raw.declinations : []) {
@@ -24,10 +24,10 @@
24
24
  // are PRODUCTION, into anything that imports it.
25
25
  import { readFileSync, readdirSync, writeFileSync } from "node:fs";
26
26
  import { join } from "node:path";
27
- import { driverDir, labelOfDriverFile } from "../shared/driver-dir.mjs"; // a card's label carries a colon, which Windows writes %3A
28
27
  import { deferralCoverageRow } from "./deferral-row.mjs";
29
28
  import { PUBLISH_INPUTS, readStore } from "./publish/publish-inputs.mjs";
30
29
  import { readPartNotCompleted } from "./parts-not-completed.mjs";
30
+ import { driverDir, labelOfDriverFile, paths, readJson } from "./run-record.mjs"; // a card's label carries a colon, which Windows writes %3A
31
31
 
32
32
  // The name each part is given: a label the report or the workbook already prints. Never a new phrase.
33
33
  export const PART_NAMES = {
@@ -196,7 +196,7 @@ function register(runDir, log) {
196
196
  (searches.disclosed_axes ?? []).length ? `the pass on ${searches.disclosed_axes.join(", ")} timed out, read as it stands with its clean claims open` : "",
197
197
  ].filter(Boolean).join("; ") + `: ${searches.reason ?? "no cause recorded"}` }, "the searches"]);
198
198
  let reopen = null;
199
- try { reopen = JSON.parse(readFileSync(driverDir(runDir, "frame-reopen.json"), "utf8")); } catch { reopen = null; }
199
+ try { reopen = readJson(paths(runDir).frameReopenReceipt); } catch { reopen = null; }
200
200
  if (reopen?.dominant_element_gap === true && reopen?.domClosed !== true)
201
201
  failed.push([{ fail: "the omission the blind frame comparison flagged was not closed by the reopen pass" }, "the dominant-element crowd"]);
202
202
  if (!failed.length) return null;
@@ -286,7 +286,7 @@ export function recordsState(runDir) {
286
286
  if (!files.length) return "absent";
287
287
  for (const f of files) {
288
288
  try {
289
- const body = JSON.parse(readFileSync(join(runDir, "_records", f), "utf8"));
289
+ const body = readJson(join(runDir, "_records", f));
290
290
  if (body && typeof body === "object" && !Array.isArray(body)) return "read";
291
291
  } catch { /* the next file */ }
292
292
  }
@@ -325,7 +325,7 @@ function coverageRows(runDir, log) {
325
325
  function evidenceStamps(runDir, log) {
326
326
  const threw = failedStep(log, "basis-derivation", "basis-derivation-failed");
327
327
  let record = null;
328
- try { record = JSON.parse(readFileSync(driverDir(runDir, "basis-derivation.json"), "utf8")); } catch { record = null; }
328
+ try { record = readJson(paths(runDir).basisDerivation); } catch { record = null; }
329
329
  const standing = threw ? 0 : Number(record?.unwritable) || 0;
330
330
  if (!threw && !standing) return null;
331
331
  return { part: "evidence-stamps", name: RULED_WORDS.officialRecords, reason: NOT_COMPLETED,
@@ -342,7 +342,7 @@ const CHECKS = [assessment, overview, courtDecisions, searchLog, register, local
342
342
  * already carries that input's failure. PURE apart from reading `runDir`.
343
343
  */
344
344
  export function degradedParts(runDir, opts = {}) {
345
- const log = readJsonl(driverDir(runDir, "run.jsonl"));
345
+ const log = readJsonl(paths(runDir).run);
346
346
  return CHECKS.map((check) => check(runDir, log, opts)).filter(Boolean);
347
347
  }
348
348
 
@@ -375,7 +375,7 @@ export function writeDegradedParts(runDir, parts) {
375
375
  /** The rows written at delivery, or [] for a run that wrote none (every run before this change). */
376
376
  export function readDegradedPartRows(runDir) {
377
377
  try {
378
- const rows = JSON.parse(readFileSync(driverDir(runDir, DEGRADED_PARTS_FILE), "utf8"))?.rows;
378
+ const rows = readJson(driverDir(runDir, DEGRADED_PARTS_FILE))?.rows;
379
379
  return Array.isArray(rows) ? rows.filter((r) => r && typeof r.area === "string" && typeof r.note === "string") : [];
380
380
  } catch { return []; }
381
381
  }
@@ -439,7 +439,7 @@ export function storeStates(base) {
439
439
  /** The store states delivery recorded, or null for a run delivered before it recorded them. */
440
440
  export function readDeliveredStores(runDir) {
441
441
  try {
442
- const stores = JSON.parse(readFileSync(driverDir(runDir, DEGRADED_PARTS_FILE), "utf8"))?.stores;
442
+ const stores = readJson(driverDir(runDir, DEGRADED_PARTS_FILE))?.stores;
443
443
  return stores && typeof stores === "object" && !Array.isArray(stores) ? stores : null;
444
444
  } catch { return null; }
445
445
  }
@@ -478,11 +478,11 @@ export function mergeDegradedRows(...lists) {
478
478
  // The listing of filings and the owner lookups each end in one run-log event, a success or a failure, and
479
479
  // the last of the pair is the step's state at delivery, so a resume that succeeded clears it. The
480
480
  // plain-language review logs its outcome; the three that ship the rater's wording unreviewed are failures.
481
- const REVIEW_FAILED = ["stage-failed", "artifact-unreadable", "rewrite-refused-by-the-merged-gate", "correction-failed", "correction-refused-by-the-merged-gate", "correction-moved-what-no-defect-named", "recheck-failed"];
481
+ const REVIEW_FAILED = ["stage-failed", "artifact-unreadable", "rewrite-refused-by-the-merged-gate", "correction-failed", "correction-refused-by-the-merged-gate", "recheck-failed"];
482
482
 
483
483
  /** Which of the knockout's whole steps ended failed, each with its raw cause for the run's record. */
484
484
  export function knockoutStepFailures(runDir) {
485
- const log = readJsonl(driverDir(runDir, "run.jsonl"));
485
+ const log = readJsonl(paths(runDir).run);
486
486
  const listing = lastEvent(log, ["knockout-register-records", "knockout-register-records-refused", "knockout-register-records-failed"]);
487
487
  const owners = failedStep(log, "knockout-owner-checks", "knockout-owner-checks-failed");
488
488
  const review = lastEvent(log, ["knockout-review"]);
@@ -23,10 +23,11 @@
23
23
  // stage apart. This module is the single answer. `cut/` cannot import it (that directory does not travel
24
24
  // and this one does), so the pack gate restates the disjunction and its own test pins the two together.
25
25
 
26
- import { cpSync, existsSync, mkdirSync, mkdtempSync, readdirSync, readFileSync, rmSync, writeFileSync } from "node:fs";
26
+ import { cpSync, existsSync, mkdirSync, mkdtempSync, readdirSync, rmSync, writeFileSync } from "node:fs";
27
27
  import { tmpdir } from "node:os";
28
28
  import { basename, dirname, join, resolve, sep } from "node:path"; import { studioDirFor } from "../shared/pre-rename-spellings.mjs";
29
29
  import { config } from "./driver.config.mjs"; // — the install's own default agent, never a literal
30
+ import { readJson } from "./run-record.mjs";
30
31
 
31
32
  /** The entry file each lane's publisher reads as its source, in the order a child is probed for one. */
32
33
  export const ENTRY_FILES = Object.freeze(["report.md", "knockout-findings.json"]);
@@ -91,7 +92,7 @@ export function prepareSample(dir, { repoRoot, tmp } = {}) {
91
92
  if (!isFrozen(dir)) return { name, why: NOT_FROZEN };
92
93
  const manifest = join(dir, "meta.json");
93
94
  let meta;
94
- try { meta = JSON.parse(readFileSync(manifest, "utf8")); } catch (e) { return { name, why: `its meta.json could not be read (${why(e)})` }; }
95
+ try { meta = readJson(manifest); } catch (e) { return { name, why: `its meta.json could not be read (${why(e)})` }; }
95
96
  if (!meta?.runId) return { name, why: `${manifest} names no runId, so it is not a frozen demo manifest` };
96
97
  try { return { sample: { dir, meta, name, publishFrom: publishSource(dir, { repoRoot, ...(tmp ? { tmp } : {}) }) } }; }
97
98
  catch (e) { return { name, why: `it could not be copied to publish from (${why(e)})` }; }
@@ -199,7 +200,7 @@ export function seedDemoRuns({ workspace, examplesDir, portalOrigin = null }) {
199
200
  for (const name of demoChildren(examplesDir)) {
200
201
  const run = join(examplesDir, name, "run");
201
202
  let s;
202
- try { s = JSON.parse(readFileSync(join(run, "status.json"), "utf8")); } catch { continue; }
203
+ try { s = readJson(join(run, "status.json")); } catch { continue; }
203
204
  if (!s?.slug || !s?.codename || !s?.date) continue;
204
205
  // THE FALLBACK IS THE INSTALL'S OWN DEFAULT AGENT, not a literal (ruling 563). It fires only for a
205
206
  // sample whose status.json carries no agent; all four shipped samples carry one.
@@ -231,7 +232,7 @@ export const reportRoute = (runId) => `/portal/report/${encodeURIComponent(runId
231
232
  */
232
233
  export function stampReportLinks(statusFile, origin) {
233
234
  let s;
234
- try { s = JSON.parse(readFileSync(statusFile, "utf8")); } catch { return false; }
235
+ try { s = readJson(statusFile); } catch { return false; }
235
236
  if (!s?.runId) return false;
236
237
  const base = String(origin).replace(/\/+$/, "");
237
238
  const local = (url) => {
@@ -137,3 +137,20 @@ export function demoPostureLine(env = process.env, { roster, projects } = {}) {
137
137
  ? " Nothing here is configured against a real customer, and nothing needs to be." : "";
138
138
  return `${head}: it carries ${carries}, and ${reports} ready to open.${unreal}`;
139
139
  }
140
+
141
+ /**
142
+ * The door's count of the companies it read, and from where: the store set, or the folder that ships with this install.
143
+ * One company is "1 customer". PURE.
144
+ */
145
+ export function rosterCountLine(roster, { configured = null, bundledDir }) {
146
+ const n = roster.length;
147
+ const from = configured || `the folder that ships with this install, ${bundledDir} (CLEAROTRON_CUSTOMERS_DIR is unset)`;
148
+ return `roster: ${n} ${n === 1 ? "customer" : "customers"} from ${from} — [${roster.join(", ")}]`;
149
+ }
150
+
151
+ /** The boot line for a door reading the company folder that ships with this install. PURE. */
152
+ export function bundledRosterLine(count) {
153
+ return `CLEAROTRON_CUSTOMERS_DIR is unset, so start_run reads the ${count} ${count === 1 ? "company" : "companies"} in the folder that ships with this install `
154
+ + "(driver/profiles). A company absent from that folder is refused with \"names no known customer\". If its profile is in a "
155
+ + "separate config store, set CLEAROTRON_CUSTOMERS_DIR to that store's profiles directory.";
156
+ }
@@ -26,6 +26,7 @@
26
26
  import { readdirSync, readFileSync } from "node:fs";
27
27
  import { join } from "node:path";
28
28
  import { claimerIsAlive, parseClaimSidecar } from "./claim-liveness.mjs";
29
+ import { liveQueueState } from "./queue-markers.mjs";
29
30
 
30
31
  /** A directory that is not there yet holds nothing; one we may not READ is a different answer entirely. */
31
32
  function listDir(dir) {
@@ -42,17 +43,26 @@ function listDir(dir) {
42
43
  * real, and a guard that reads one of them passes over work sitting in
43
44
  * the other.
44
45
  * @param {string} a.lockDir the run-slot lock dir — a slot file is held for the life of a pipeline.
45
- * @returns {{queued, claimed, stale, slots, unreadable}} — plain arrays, safe to print.
46
+ * @param {Array<{codename: string, runDir: string}>} a.parkedRunDirs run folders the runner will resume on its
47
+ * own (runner.mjs `parkedRunDirOrphans`), passed in so this module stays light.
48
+ * @returns {{queued, claimed, stale, parked, slots, unreadable}} — plain arrays, safe to print.
49
+ *
50
+ * A PARKED RUN HOLDS THE DEPLOYMENT. It is part-way through a search and comes back on its own, and the owner's ruling
51
+ * of 2026-11-09 is that a search is not upgraded part-way: an update waits for it, as it waits for a running one.
46
52
  */
47
- export function liveRunHolds({ queueDirs = [], lockDir = null, isAlive = claimerIsAlive } = {}) {
48
- const queued = [], claimed = [], stale = [], slots = [], unreadable = [];
53
+ export function liveRunHolds({ queueDirs = [], lockDir = null, parkedRunDirs = [], isAlive = claimerIsAlive } = {}) {
54
+ const queued = [], claimed = [], stale = [], parked = [], slots = [], unreadable = [];
49
55
 
50
56
  for (const q of (Array.isArray(queueDirs) ? queueDirs : []).filter(Boolean)) {
51
57
  const { names, error } = listDir(q);
52
58
  if (error) { unreadable.push({ path: q, error }); continue; }
53
59
  for (const n of names) {
54
- if (n.endsWith(".json") && !n.endsWith(".tmp")) { queued.push({ queue: q, id: n.replace(/\.json$/, "") }); continue; }
55
- if (!n.endsWith(".processing")) continue;
60
+ const state = n.endsWith(".tmp") ? null : liveQueueState(n);
61
+ if (state === "json") { queued.push({ queue: q, id: n.replace(/\.json$/, "") }); continue; }
62
+ if (state === "postponed") { parked.push({ queue: q, id: n.replace(/\.postponed$/, "") }); continue; }
63
+ if (state !== "processing") continue;
64
+ // The claim lock is a `.processing` mid-rename, with no sidecar of its own yet: held, as the next line holds one with none.
65
+ if (!n.endsWith(".processing")) { claimed.push({ queue: q, id: n.replace(/\.processing\.claimed-\S+$/, ""), pid: null }); continue; }
56
66
  const id = n.replace(/\.processing$/, "");
57
67
  let rec = null;
58
68
  try { rec = parseClaimSidecar(readFileSync(join(q, `${n}.pid`), "utf8")); } catch { /* legacy claim, no sidecar */ }
@@ -79,7 +89,9 @@ export function liveRunHolds({ queueDirs = [], lockDir = null, isAlive = claimer
79
89
  }
80
90
  }
81
91
 
82
- return { queued, claimed, stale, slots, unreadable };
92
+ for (const r of Array.isArray(parkedRunDirs) ? parkedRunDirs : []) parked.push({ runDir: r.runDir, id: r.codename });
93
+
94
+ return { queued, claimed, stale, parked, slots, unreadable };
83
95
  }
84
96
 
85
97
  /**
@@ -106,7 +118,7 @@ export function deployRefusal(holds, { override = "" } = {}) {
106
118
  const name = (rows, what) => rows?.length
107
119
  ? `${rows.length} ${what}: ${rows.slice(0, 6).map((r) => r.id ?? r.file ?? r.path).join(", ")}${rows.length > 6 ? `, +${rows.length - 6} more` : ""}`
108
120
  : null;
109
- for (const [rows, what] of [[h.queued, "QUEUED"], [h.claimed, "CLAIMED and live"], [h.stale, "CLAIMED by a dead pid (a takeover will resume it)"], [h.slots, "run slot(s) held by a live pid"]]) {
121
+ for (const [rows, what] of [[h.queued, "QUEUED"], [h.claimed, "CLAIMED and live"], [h.stale, "CLAIMED by a dead pid (a takeover will resume it)"], [h.parked, "PARKED and resuming on their own"], [h.slots, "run slot(s) held by a live pid"]]) {
110
122
  const s = name(rows, what);
111
123
  if (s) parts.push(s);
112
124
  }
@@ -22,7 +22,7 @@ import { readFileSync, readdirSync, statSync } from "node:fs";
22
22
  import { createHash } from "node:crypto";
23
23
  import { join, relative } from "node:path";
24
24
  import { CONTEXT_DERIVATIONS, derivationsFor } from "./stage-context.mjs";
25
- import { driverDir } from "../shared/driver-dir.mjs";
25
+ import { paths } from "./run-record.mjs";
26
26
 
27
27
  /** A file's identity by content, or a directory's by its entries' names and sizes, recursively. `sha` null when absent. */
28
28
  function identityOf(path, runDir) {
@@ -65,7 +65,7 @@ const sameFiles = (a, b) => Array.isArray(a) && Array.isArray(b) && a.length ===
65
65
  /** The derived state recorded on the run's last dispatch of `label` with this trigger, or null when none was recorded. */
66
66
  export function recordedDerivedState(runDir, label, trigger = "fresh") {
67
67
  let rows = [];
68
- try { rows = readFileSync(driverDir(runDir, "run.jsonl"), "utf8").split("\n"); } catch { return null; }
68
+ try { rows = readFileSync(paths(runDir).run, "utf8").split("\n"); } catch { return null; }
69
69
  let found = null;
70
70
  for (const line of rows) {
71
71
  if (!line.includes('"derivedState"')) continue;
@@ -44,6 +44,7 @@ import { readFlagSnapshot, registerTerritoriesFor } from "./flag-snapshot.mjs";
44
44
  import { builtFor, registerCanCountFor } from "./flag-snapshot.mjs";
45
45
  import { productAvailability, UNAVAILABLE_NOTE, PRODUCT_POLICIES } from "./search-policy.mjs";
46
46
  import { isEntrypoint } from "../shared/is-entrypoint.mjs"; // — one entry-point test, all spellings
47
+ import { readJson } from "./run-record.mjs";
47
48
 
48
49
  const HERE = dirname(fileURLToPath(import.meta.url));
49
50
  const LOOPBACK = new Set(["127.0.0.1", "::1"]);
@@ -142,7 +143,7 @@ function scanRuns(workspaceRoot) {
142
143
  const out = [];
143
144
  const readRun = (dir, slug, runName, archived) => {
144
145
  try {
145
- const s = JSON.parse(readFileSync(join(dir, "status.json"), "utf8"));
146
+ const s = readJson(join(dir, "status.json"));
146
147
  out.push({ runId: s.runId ?? `${slug}-${runName}`, slug: s.slug ?? slug, codename: s.codename ?? null,
147
148
  agent: s.agent ?? null, state: s.state ?? null, stepN: s.stepN ?? null, stepLabel: s.stepLabel ?? null,
148
149
  stepTotal: s.stepTotal ?? null, signoff: s.review?.signoff ?? s.verdict ?? null, tier: s.tier ?? null, sendPending: s.sendPending ?? null,
@@ -37,7 +37,7 @@
37
37
  import { createHash } from "node:crypto";
38
38
  import { mkdirSync, readFileSync, renameSync, writeFileSync, existsSync } from "node:fs";
39
39
  import { join } from "node:path";
40
- import { driverDir, driverFileName } from "../shared/driver-dir.mjs"; //
40
+ import { driverDir, driverFileName } from "./run-record.mjs"; //
41
41
 
42
42
  export const DISPATCH_SUFFIX = "dispatch.txt";
43
43
 
@@ -40,6 +40,7 @@ import { connotationObligations, obligationRows, parsePrRiskResults, parseDispos
40
40
  import { unionDispositionForm, formSidecarPath } from "./disposition-union.mjs";
41
41
  import { validateDispositionCall, callAnswer, addressableRows, evidenceSatisfiable, MAX_ROWS_PER_CALL } from "./disposition-call.mjs";
42
42
  import { PARK_AFTER_REFUSALS, parkedIds, refusalCountsBy } from "./refusal-bound.mjs"; //
43
+ import { readJson } from "./run-record.mjs";
43
44
 
44
45
  const CALLS_DIR = "disposition-calls";
45
46
 
@@ -65,7 +66,7 @@ export function obligationsSidecarPath(outputPath) {
65
66
  */
66
67
  export function toldRowIds(outputPath) {
67
68
  try {
68
- const told = JSON.parse(readFileSync(obligationsSidecarPath(outputPath), "utf8"))?.rowsTold;
69
+ const told = readJson(obligationsSidecarPath(outputPath))?.rowsTold;
69
70
  return Array.isArray(told) && told.length ? told.map((x) => String(x ?? "").trim()) : null;
70
71
  } catch { return null; }
71
72
  }
@@ -49,9 +49,9 @@
49
49
  // Writing a second application path would be the second writer, one artifact earlier.
50
50
  import { readFileSync, writeFileSync, mkdirSync, appendFileSync, readdirSync } from "node:fs";
51
51
  import { join, basename } from "node:path";
52
- import { driverDir } from "../shared/driver-dir.mjs"; //
53
52
  import { acceptClosureCall, toClosureLines, MAX_CLOSURES_PER_CALL } from "./doubt-closure-call.mjs";
54
53
  import { idSetHash as idSetHashOf, priorCallWithIdSet as priorCallWithIdSetIn } from "./call-repeat.mjs"; //
54
+ import { driverDir, readJson } from "./run-record.mjs";
55
55
 
56
56
  const CALLS_DIR = "doubt-closure-calls";
57
57
  const ARTIFACT = "doubt-closure.md"; // conversion 6 — the driver's render, read by validators.doubtClosure
@@ -294,7 +294,7 @@ export function readAcceptedClosures(runDir) {
294
294
  try { names = readdirSync(dir).filter((f) => /^accepted-\d+\.json$/.test(f)).sort(); } catch { return out; }
295
295
  for (const n of names) {
296
296
  try {
297
- const doc = JSON.parse(readFileSync(join(dir, n), "utf8"));
297
+ const doc = readJson(join(dir, n));
298
298
  if (Array.isArray(doc?.lines?.doubt)) out.doubt.push(...doc.lines.doubt);
299
299
  if (Array.isArray(doc?.lines?.ask)) out.ask.push(...doc.lines.ask);
300
300
  out.files++;