clearotron 0.7.0-beta.2 → 0.7.0-beta.4

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 (137) hide show
  1. package/INSTALL.md +5 -5
  2. package/QUICKSTART.md +4 -4
  3. package/README.md +2 -2
  4. package/bin/README.md +3 -4
  5. package/bin/clearotron.mjs +1 -1
  6. package/bin/onboard.mjs +28 -40
  7. package/bin/status.mjs +11 -0
  8. package/build-info.json +2 -2
  9. package/docs/DELIVERY.md +30 -6
  10. package/docs/architecture/04-configuration-reference.md +1 -0
  11. package/driver/CHANGELOG.md +34 -0
  12. package/driver/compose-read.mjs +4 -3
  13. package/driver/contract-arm2-baseline.json +1 -2
  14. package/driver/contract-dictation-registry.mjs +7 -48
  15. package/driver/contract-e3-backlog.mjs +55 -52
  16. package/driver/contract-e3-baseline.json +22 -7
  17. package/driver/contract-vocabulary.mjs +4 -2
  18. package/driver/coverage-form.mjs +4 -0
  19. package/driver/coverage-rows-run.mjs +68 -4
  20. package/driver/engine/anthropic-agent.mjs +10 -13
  21. package/driver/engine/common.mjs +34 -22
  22. package/driver/engine/health.mjs +251 -0
  23. package/driver/engine/jx-turn.mjs +2 -1
  24. package/driver/engine/mcp/codex-config.mjs +16 -1
  25. package/driver/engine/mcp/crowd-note.mjs +1 -1
  26. package/driver/engine/mcp/gather-config.mjs +34 -9
  27. package/driver/engine/mcp/perplexity-server.mjs +33 -23
  28. package/driver/engine/mcp/recording-server.mjs +67 -58
  29. package/driver/engine/mcp/unit-note-server.mjs +2 -0
  30. package/driver/engine/openai-agent.mjs +9 -24
  31. package/driver/engine/probe.mjs +24 -7
  32. package/driver/findings-model.mjs +54 -0
  33. package/driver/jx-units.mjs +139 -30
  34. package/driver/knockout-assess-record.mjs +2 -2
  35. package/driver/knockout-correction-check.mjs +119 -0
  36. package/driver/knockout-correction-record.mjs +1 -1
  37. package/driver/knockout-frame-record.mjs +24 -10
  38. package/driver/knockout-review-record.mjs +35 -430
  39. package/driver/ladder/dispatch.mjs +4 -2
  40. package/driver/ladder/form-repair.mjs +5 -5
  41. package/driver/ladder/form-sync.mjs +4 -6
  42. package/driver/ladder/next-rung.mjs +10 -0
  43. package/driver/ladder/repair-messages.mjs +37 -65
  44. package/driver/ladder/stage.mjs +3 -3
  45. package/driver/ladder/turn-signals.mjs +4 -14
  46. package/driver/manual-paragraphs.mjs +22 -2
  47. package/driver/mark-logos.mjs +25 -9
  48. package/driver/package.json +1 -1
  49. package/driver/pipeline-knockout.mjs +2 -2
  50. package/driver/predelivery-lint.mjs +39 -7
  51. package/driver/product-fault.mjs +53 -0
  52. package/driver/publish/knockout.mjs +2 -1
  53. package/driver/publish/register-record-html.mjs +7 -9
  54. package/driver/publish/register-record.mjs +0 -1
  55. package/driver/publish/render.mjs +16 -10
  56. package/driver/publish/strings.mjs +0 -1
  57. package/driver/publish/templates/knockout.css +1 -1
  58. package/driver/publish/templates/report.css +2 -4
  59. package/driver/recording-agreement.mjs +6 -4
  60. package/driver/register-band-run.mjs +2 -2
  61. package/driver/register-digest-record.mjs +31 -9
  62. package/driver/register-unit-record.mjs +10 -1
  63. package/driver/repair-composers.mjs +12 -11
  64. package/driver/repair-contract.mjs +6 -6
  65. package/driver/repair-targets.mjs +7 -6
  66. package/driver/run-outcome.mjs +8 -0
  67. package/driver/runner.mjs +42 -3
  68. package/driver/skills/README.md +5 -4
  69. package/driver/skills/blind-frame/SKILL.md +1 -1
  70. package/driver/skills/case-law-citation/SKILL.md +1 -1
  71. package/driver/skills/clearance-common-law/SKILL.md +6 -423
  72. package/driver/skills/clearance-common-law/grid.md +272 -0
  73. package/driver/skills/clearance-common-law/meaning.md +142 -0
  74. package/driver/skills/clearance-common-law/perplexity-prompts.md +4 -2
  75. package/driver/skills/clearance-register/SKILL.md +7 -174
  76. package/driver/skills/clearance-register/digest.md +89 -25
  77. package/driver/skills/clearance-register/providers/clarivate-questions.md +154 -0
  78. package/driver/skills/clearance-register/providers/clarivate.md +5 -149
  79. package/driver/skills/clearance-register/providers/signa-questions.md +120 -0
  80. package/driver/skills/clearance-register/providers/signa.md +3 -114
  81. package/driver/skills/clearance-register/providers/uspto-local.md +3 -3
  82. package/driver/skills/clearance-register/register-recipes.md +10 -10
  83. package/driver/skills/clearance-register/status-rules.md +2 -2
  84. package/driver/skills/clearance-register/unit.md +96 -54
  85. package/driver/skills/clearance-search/delivery-contract.md +11 -49
  86. package/driver/skills/clearance-search/firm-wide-reasoning.md +10 -13
  87. package/driver/skills/clearance-search/look-at-what-you-have.md +7 -0
  88. package/driver/skills/clearance-search/phase2-execution.md +12 -117
  89. package/driver/skills/clearance-search/report-card-rules.md +2 -2
  90. package/driver/skills/clearance-search/report-prose.md +30 -23
  91. package/driver/skills/clearance-search/synthesis-rules.md +27 -69
  92. package/driver/skills/clearance-search/worked-examples.md +11 -16
  93. package/driver/skills/clearance-variants/SKILL.md +7 -7
  94. package/driver/skills/clearance-variants/transliteration-scripts.md +2 -2
  95. package/driver/skills/frame-diff/SKILL.md +1 -1
  96. package/driver/skills/knockout-assess/SKILL.md +54 -41
  97. package/driver/skills/knockout-frame/SKILL.md +13 -12
  98. package/driver/skills/knockout-register-read/SKILL.md +2 -10
  99. package/driver/skills/matter-frame/SKILL.md +2 -2
  100. package/driver/skills/narrative-refutation/SKILL.md +7 -6
  101. package/driver/skills/placement-inquiry/SKILL.md +3 -3
  102. package/driver/skills/skeptic/SKILL.md +111 -0
  103. package/driver/skills/whatif-memo/SKILL.md +5 -2
  104. package/driver/stage-declarations.mjs +6 -0
  105. package/driver/stages-knockout.mjs +36 -38
  106. package/driver/stages.mjs +69 -64
  107. package/driver/steps/delivery.mjs +6 -4
  108. package/driver/steps/open-run.mjs +2 -0
  109. package/driver/steps/overview-and-cards.mjs +2 -2
  110. package/driver/steps/register-sweep.mjs +20 -1
  111. package/driver/steps/synthesis.mjs +28 -11
  112. package/driver/suite-census.json +217 -61
  113. package/driver/synthesis-record.mjs +24 -2
  114. package/driver/verify-knockout.mjs +23 -3
  115. package/driver/whatif-memo-run.mjs +39 -10
  116. package/driver/whatif-queue.mjs +53 -7
  117. package/mcp-server/CHANGELOG.md +8 -0
  118. package/mcp-server/lib/ops.mjs +19 -10
  119. package/mcp-server/lib/whatif.mjs +7 -6
  120. package/mcp-server/package.json +1 -1
  121. package/mcp-server/server.mjs +55 -19
  122. package/package.json +1 -1
  123. package/portal-ui/package.json +1 -1
  124. package/providers/clarivate/src/adapter.js +3 -0
  125. package/providers/jx/src/nativeread.js +5 -3
  126. package/providers/oauth-mcp-bridge/CHANGELOG.md +8 -0
  127. package/providers/oauth-mcp-bridge/package.json +1 -1
  128. package/providers/perplexity/src/core.js +7 -2
  129. package/providers/signa/src/adapter.js +3 -0
  130. package/scripts/e2e-first-time.mjs +2 -2
  131. package/shared/brand.mjs +0 -2
  132. package/shared/connector-signin-probe.mjs +1 -1
  133. package/shared/names-in-force.mjs +1 -0
  134. package/skills/clearotron-account/SKILL.md +21 -11
  135. package/skills/clearotron-client/SKILL.md +15 -15
  136. package/skills/clearotron-ops/COURIER.md +5 -1
  137. package/skills/clearotron-ops/SKILL.md +21 -14
@@ -1294,7 +1294,7 @@ export function permissionProseChecks({ text, surface = "report", idSuffix = "",
1294
1294
  }
1295
1295
  // Whole-text pass: splitCards drops everything outside a `## ` card. On report.md that shell is the
1296
1296
  // front-matter, `# Actions` and `# Methodology` — all authored by report-overview, so the shell redo can
1297
- // genuinely fix what this names. (The coverage LEDGER is not here: delivery-contract.md:147 forbids
1297
+ // genuinely fix what this names. (The coverage LEDGER is not here: delivery-contract.md ("does not author a `# Coverage`") forbids
1298
1298
  // report-overview from authoring a `# Coverage` section, and the panel renders from the typed coverage[]
1299
1299
  // array — so ledger prose reaches this check on the findings surface, which is structural with no redo by
1300
1300
  // design.) Deduped by POSITION, never by phrase: a card and the shell routinely carry the same anchor, and
@@ -1909,6 +1909,30 @@ export function actionCitationChecks({ actionsRegister, findings }) {
1909
1909
  return [c];
1910
1910
  }
1911
1911
 
1912
+ // An open coverage row citing a finding that is gone. A row written while its finding stood ("the position in finding
1913
+ // 12 remains unresolved") outlives the review that withdraws the finding, and "Left open" prints it with the owner in
1914
+ // its title, though no card carries that number: measured on a delivered report, 2026-11-25, sixteen such rows. The
1915
+ // row is the writer's record, so it goes to the writer's repair as the four answers' citations do, read with the word
1916
+ // "finding" before the number, as a writer's ground is read, so that a class written after a hash sign is never one.
1917
+ // THE WRITER'S NUMBERING. The rows are the writer's prose, which the delivery seam's fold copies and does not renumber,
1918
+ // so they are judged against the record the writer wrote (`narrativeFindings` while a fold is in force), and the
1919
+ // numbers they carry reach the writer's repair as written.
1920
+ // ABSENT ⇒ SILENT: a record with no coverage register emits nothing, and the replay harness passes none.
1921
+ export function coverageCitationChecks({ coverageRegister, findings }) {
1922
+ if (!Array.isArray(coverageRegister)) return [];
1923
+ const live = new Set((findings ?? []).filter((f) => f && f.disposition !== "withdrawn").map((f) => Number(f.ordinal)));
1924
+ const withdrawn = new Set((findings ?? []).filter((f) => f && f.disposition === "withdrawn").map((f) => Number(f.ordinal)));
1925
+ const cites = [];
1926
+ coverageRegister.forEach((row, i) => {
1927
+ for (const ord of citedFindingNumbers(`${row?.area ?? ""}\n${row?.note ?? ""}`, { bare: false }))
1928
+ if (!live.has(ord)) cites.push({ row: i, area: String(row?.area ?? ""), ordinal: ord, withdrawn: withdrawn.has(ord) });
1929
+ });
1930
+ const c = check("coverage-citations", "reference", "report", cites.length === 0, cites.length
1931
+ ? `open coverage row(s) cite finding(s) that are not there: ${cites.map((x) => `"${x.area}" cites #${x.ordinal}, which ${x.withdrawn ? "the review WITHDREW" : "this run has no finding for"}`).join("; ")}` : "");
1932
+ if (cites.length) Object.assign(c, { register: "coverage", cites, writersNumbering: true });
1933
+ return [c];
1934
+ }
1935
+
1912
1936
  export function fourAnswersCoherenceChecks({ fourAnswers, findings, verdictDoc }) {
1913
1937
  if (!fourAnswers || typeof fourAnswers !== "object") return [];
1914
1938
  const out = [];
@@ -2503,7 +2527,7 @@ export function cardBudgetChecks({ cardFolds }) {
2503
2527
  `assembly folded ${folds.length} surface(s) to the level budgets (moved, never deleted): ${folds.map((f) => `${f.surface} → +${f.movedSentences} sentence(s)/${f.movedWords} word(s) into depth`).join("; ")}`)];
2504
2528
  }
2505
2529
 
2506
- export function runLint({ followUpKinds = null, depth, commonLawGrid, matterContext, clientPartyName, reportMd, overviewMd = null, emailConditions = null, clientSummaryMd, narrativeMd, auditMd, recordsByUri, searchedNames, headerName, ratedNames, actionsText, fetchFailures, extraPlatformNames, findings, narrativeFindings = null, findingsRaw, actionsRegister, actionsExpected, intakeAsks, askAnswers, cardFolds, verdictDoc, manifest, seniorRights, seniorRightsExpected, markAssessment, markAssessmentExpected, fourAnswers, contentModelExpected, findingsSchemaVersion, placements, ownerScreen, recordCarry, commonLawCarries, searchedJurisdictions = null, goodsEvidence = null, goodsHanded = null }) {
2530
+ export function runLint({ followUpKinds = null, depth, commonLawGrid, matterContext, clientPartyName, reportMd, overviewMd = null, emailConditions = null, clientSummaryMd, narrativeMd, auditMd, recordsByUri, searchedNames, headerName, ratedNames, actionsText, fetchFailures, extraPlatformNames, findings, narrativeFindings = null, findingsRaw, actionsRegister, coverageRegister = null, actionsExpected, intakeAsks, askAnswers, cardFolds, verdictDoc, manifest, seniorRights, seniorRightsExpected, markAssessment, markAssessmentExpected, fourAnswers, contentModelExpected, findingsSchemaVersion, placements, ownerScreen, recordCarry, commonLawCarries, searchedJurisdictions = null, goodsEvidence = null, goodsHanded = null }) {
2507
2531
  // WS-B: the run's profile platforms join the vocabulary for this run. Profiles carry store
2508
2532
  // DOMAINS by contract, so derive the name tokens a report would actually print: the raw norm
2509
2533
  // ("thomasnetcom"), the separator-spaced phrase ("thomasnet com" / "made in china com"), and the
@@ -2652,6 +2676,7 @@ export function runLint({ followUpKinds = null, depth, commonLawGrid, matterCont
2652
2676
  // meant a down-level file switched off the check that reports a down-level file.
2653
2677
  checks.push(...schemaVersionChecks({ schemaVersion: findingsSchemaVersion })); // — the declared contract version
2654
2678
  checks.push(...actionCitationChecks({ actionsRegister, findings })); // a forward step resting on a finding that is gone: the writer's repair
2679
+ checks.push(...coverageCitationChecks({ coverageRegister, findings: narrativeFindings ?? findings })); // an open coverage row citing a finding that is gone: the writer's repair, in its numbering
2655
2680
  checks.push(...fourAnswersCoherenceChecks({ fourAnswers, findings, verdictDoc })); // P5 review — the four answers must not contradict the verdict or the findings (flag-only, absent ⇒ silent)
2656
2681
  checks.push(...placementsChecks({ placements })); // B2 — an empty structured mirror is a flag a human reads, never an unrepairable validator kill
2657
2682
  checks.push(...recordCarryChecks({ recordCarry })); // — a retrieved record dropped with no recorded ground, and a drop that is really an incomplete stage
@@ -2689,10 +2714,13 @@ export function runLint({ followUpKinds = null, depth, commonLawGrid, matterCont
2689
2714
  //
2690
2715
  // Derivation. The knockout lane's ONE model-authored artifact is knockout-findings.json. It has no
2691
2716
  // register RECORD store (it counts, it does not retrieve), no actions register, no verdict sidecar, no
2692
- // client summary, no card assembly, no reviewer correction cycle, no intake-ask register. So the
2693
- // applicable checks are exactly those whose whole input is model-authored TEXT:
2717
+ // client summary, no card assembly, no intake-ask register. So the applicable checks are those whose
2718
+ // whole input is model-authored TEXT:
2694
2719
  // permission-prose · scope-numbers-in-prose · counting-consistency · wipo-designation-language ·
2695
2720
  // prescription-prose
2721
+ // and one more since every Knockout is reviewed and corrected once: correction-consistency, which the
2722
+ // publish computes from the run's own round (knockout-correction-check.mjs) and hands in, because the
2723
+ // round's records are read off the run directory and this module reads none.
2696
2724
  // Everything else is ABSENT BY DESIGN and says so in the receipt (KNOCKOUT_ABSENT_BY_DESIGN below) —
2697
2725
  // never an entry that silently passes, which is the failure mode this tranche exists to kill. Measured
2698
2726
  // against two archived knockout runs, from 2026-07-28 and 2026-07-29: zero flags on the
@@ -2913,7 +2941,6 @@ export const KNOCKOUT_ABSENT_BY_DESIGN = [
2913
2941
  ["senior-rights-present", "registry", "no senior-right receipt — the closure that owes it is clearance machinery"],
2914
2942
  ["senior-right-coverage", "registry", "same"],
2915
2943
  ["counting-vs-findings", "counting", "reads the clearance finding set's owner + registration URIs; knockout findings carry neither"],
2916
- ["correction-consistency", "corrections", "no reviewer correction cycle on this lane — nothing is corrected or withdrawn after rating"],
2917
2944
  ["client-tier-match", "client", "no client summary (one report), so there is no second tier word to disagree"],
2918
2945
  ["overall-tier", "client", "the overall band is DERIVED in code (worstBand over the rated marks) and cannot drift from the finding set"],
2919
2946
  ["actions-reachability", "actions", "no actions register and no ask bucket"],
@@ -2936,7 +2963,7 @@ export const KNOCKOUT_ABSENT_BY_DESIGN = [
2936
2963
  * Returns { checks, failures, notApplicable } in runLint's shape. FLAG-ONLY by construction: it
2937
2964
  * decides nothing, throws nothing, and the caller writes its receipt best-effort.
2938
2965
  */
2939
- export function runKnockoutLint({ findings }) {
2966
+ export function runKnockoutLint({ findings, correction = null }) {
2940
2967
  const { report, working } = knockoutSurfaces(findings);
2941
2968
  const checks = [];
2942
2969
  // The client-facing page. permission-prose here is NOT a re-run of the hard gate: verify-knockout's
@@ -2969,8 +2996,13 @@ export function runKnockoutLint({ findings }) {
2969
2996
  // the plain-language reviewer, over the fields a reader meets before opening a
2970
2997
  // fold. Internal by surface, so a hit reaches whoever is fixing the run and never a delivery surface.
2971
2998
  checks.push(...plainLanguageChecks({ findings }));
2999
+ // A corrected Knockout delivers its correction (knockout-correction-check.mjs). The caller reads the round; a caller that
3000
+ // hands none, and a run that holds no review, list the check with the reason rather than pass it.
3001
+ checks.push(...(correction?.checks ?? []));
3002
+ const unchecked = !correction ? { id: "correction-consistency", family: "corrections", reason: "the run's review round was not handed to this check" }
3003
+ : correction.notApplicable;
2972
3004
  const failures = checks.filter((c) => !c.pass);
2973
- return { checks, failures, notApplicable: KNOCKOUT_ABSENT_BY_DESIGN };
3005
+ return { checks, failures, notApplicable: unchecked ? [...KNOCKOUT_ABSENT_BY_DESIGN, unchecked] : KNOCKOUT_ABSENT_BY_DESIGN };
2974
3006
  }
2975
3007
 
2976
3008
  // The raw check detail, INTERNAL side only: the _driver sink, the run log, the staff diagnosis lane.
@@ -0,0 +1,53 @@
1
+ // SPDX-License-Identifier: AGPL-3.0-only
2
+ // Copyright 2026 Cordillera Sàrl. Additional terms under section 7 of the AGPL-3.0 apply — see ADDITIONAL-TERMS.md
3
+ //
4
+ // product-fault.mjs — a call that failed because of the product, not because of the step's work.
5
+ //
6
+ // ONE ANSWER, WORDED ONCE (ruled 2026-11-24). Every place that establishes a product fault hands the step this message
7
+ // and nothing else of the fault: what failed, and why, stays in the run's own record. The step is not asked to repeat
8
+ // the call, the retry ladder does not ask it either, and the run delivers what the call could not produce as a gap it
9
+ // states. The record rule a recording step carries (engine/common.mjs, `recordRule`) tells it to stop on a refusal that
10
+ // says the failure is a product fault, so the message keeps those words.
11
+ //
12
+ // A FAULT IS ESTABLISHED FROM THE RUN'S OWN RECORD, never inferred from an absence. The register's call log
13
+ // (tool-calls.mjs) holds a start line for every register call and a settle line for every one that returned, so a call
14
+ // that started and never settled was sent and never came back. No log, or a call that returned, is not a fault.
15
+ import { existsSync } from "node:fs";
16
+ import { paths } from "./run-record.mjs";
17
+ import { registerPlanCallKilled } from "./tool-calls.mjs";
18
+ import { plainCause } from "./deferral-row.mjs";
19
+
20
+ export const PRODUCT_FAULT_MESSAGE =
21
+ "This failed because of a product fault, not your work. Don't repeat the call. Finish the rest of your task and hand back what you have.";
22
+
23
+ /** The register unit's axis a stage label names, or null for any other stage. PURE. */
24
+ const registerUnitAxis = (label) => /^register-unit:([a-z0-9-]+)$/.exec(String(label ?? ""))?.[1] ?? null;
25
+
26
+ /**
27
+ * The product fault a failed attempt ended on, or null when its failure is the step's own to correct.
28
+ *
29
+ * A register unit whose plan call was sent and never returned has no band, and its note cannot be filed without one, so
30
+ * the attempt ends as `tool_timeout` (the note was there), as a missing note, or as a turn that ended with the call
31
+ * still out. Each is the call that never came back: the call log says so for that unit's axis, and the band is absent.
32
+ * A rate limit is not one of these; it keeps its own wait-and-resume path. Returns `{ cause, axis, tool }`.
33
+ */
34
+ export function productFaultOf({ fail, runDir = null, label = null } = {}) {
35
+ const f = String(fail ?? "");
36
+ if (!f || f === "rate_limited") return null;
37
+ const timeout = /(?:^|:)tool_timeout:([a-z_]+):([a-z0-9-]+)/.exec(f);
38
+ if (timeout) return { cause: "tool_timeout", tool: timeout[1], axis: timeout[2] };
39
+ const axis = registerUnitAxis(label);
40
+ if (axis && runDir && !existsSync(paths(runDir).registerBand(axis))) {
41
+ const killed = registerPlanCallKilled(runDir, axis);
42
+ if (killed) return { cause: "tool_timeout", tool: String(killed.tool ?? ""), axis };
43
+ }
44
+ return null;
45
+ }
46
+
47
+ /**
48
+ * The reader's line for a slice a product fault left open: the shipped line for a search left open. A call that started and
49
+ * never returned shows only that no answer was recorded. It does not show whether the source received the request, timed
50
+ * out, or answered after our process stopped (even `tool_timeout` is minted from the missing return), so the line says
51
+ * what is known and no more. The attempt's own failure stays in the run's record. PURE.
52
+ */
53
+ export const productFaultReason = () => plainCause("unfinished");
@@ -14,6 +14,7 @@ import { join } from 'node:path';
14
14
  import { EMAIL_TIER } from '../../shared/brand.mjs';
15
15
  import { riskTier, TONE_TIER, regenIndex, regenSurfaces, auditRouteFor, markReportRouteFor, reportRouteFor } from './index.mjs';
16
16
  import { runKnockoutLint, deliveryFlagLines } from '../predelivery-lint.mjs';
17
+ import { knockoutCorrectionChecks, readCorrectionRound } from '../knockout-correction-check.mjs'; // a corrected Knockout delivers its correction
17
18
  import { note } from '../log.mjs';
18
19
  import { addSheet } from './xlsx.mjs';
19
20
  import { KNOCKOUT_EMAIL as KO, KNOCKOUT_WORKBOOK as KW, KNOCKOUT_PAGE as KP } from './strings.mjs';
@@ -639,7 +640,7 @@ function readTheMachineChecks({ runDir, findings, receipts }) {
639
640
  // rewriting history; where the run store is read-only it simply does not land.
640
641
  let qcFlags = [], machineChecksFailed = null;
641
642
  try {
642
- const lint = runKnockoutLint({ findings });
643
+ const lint = runKnockoutLint({ findings, correction: knockoutCorrectionChecks({ findings, round: readCorrectionRound(runDir) }) });
643
644
  qcFlags = deliveryFlagLines(lint.failures.filter((c) => c.surface === 'report'));
644
645
  try {
645
646
  ensureDriverDir(runDir);
@@ -7,7 +7,7 @@
7
7
  // The rows come from registerRecordView, which copies every fact from the saved record; this module lays them out
8
8
  // once, so the two pages cannot drift apart. What differs between the pages is an input: the register number's cell,
9
9
  // which each page already prints its own way, the receipt line, and the owner's name as that page resolves it.
10
- import { registerRecordView, RECORD_LABELS as L, countryOf, LOGO_NOT_RETRIEVED } from './register-record.mjs';
10
+ import { registerRecordView, RECORD_LABELS as L, countryOf } from './register-record.mjs';
11
11
  import { REC, inPriorityWindow } from '../registry-fidelity.mjs';
12
12
  import { registrationSystem } from '../jurisdiction-systems.mjs';
13
13
  import { normRegion } from './regions.mjs';
@@ -88,16 +88,14 @@ export function recordEntryHtml(rec, { uri = '', jurisdiction = '', receipt = nu
88
88
  }
89
89
 
90
90
  /**
91
- * One logo in its fixed box: the saved image, or "Logo not retrieved" where the fetch failed, opening the office's
92
- * record at `href` when there is one. `logo` is { state, src } from the run's logo step; `caption` draws the
93
- * register under the box. Null when the registration has no logo to show. PURE.
91
+ * One logo in its fixed box: the saved image, opening the office's record at `href` when there is one. `logo` is
92
+ * { state, src } from the run's logo step; `caption` draws the register under the box. Null when the run saved no
93
+ * image, a failed fetch included: a picture is a real one or nothing (owner, 2026-11-25). PURE.
94
94
  */
95
95
  export function logoFigureHtml(rec, { uri = '', logo = null, href = null, caption = true }) {
96
- if (!logo || (logo.state !== 'fetched' && logo.state !== 'failed')) return null;
96
+ if (logo?.state !== 'fetched') return null;
97
97
  const { logo: v } = registerRecordView(rec, { uri });
98
- const link = (inner, cls = '') => (href ? `<a${cls} href="${href}" target="_blank" rel="noopener noreferrer">${inner}</a>` : inner);
99
- const body = logo.state === 'fetched'
100
- ? link(`<img src="${logo.src}" alt="${escAttr(v.alt || '')}">`)
101
- : (href ? link(esc(LOGO_NOT_RETRIEVED), ' class="rr-nologo"') : `<span class="rr-nologo">${esc(LOGO_NOT_RETRIEVED)}</span>`);
98
+ const img = `<img src="${logo.src}" alt="${escAttr(v.alt || '')}">`;
99
+ const body = href ? `<a href="${href}" target="_blank" rel="noopener noreferrer">${img}</a>` : img;
102
100
  return `<figure class="rr-lg">${body}${caption && v.caption ? `<figcaption>${esc(v.caption)}</figcaption>` : ''}</figure>`;
103
101
  }
@@ -27,7 +27,6 @@ export const RECORD_LABELS = R.labels;
27
27
  export const MT_NOTE = R.mtNote;
28
28
  export const NO_GOODS = R.noGoods;
29
29
  export const CLASS_NOT_STATED = R.classNotStated;
30
- export const LOGO_NOT_RETRIEVED = R.logoNotRetrieved;
31
30
  export const registrationsCount = R.registrationsCount;
32
31
  export const showAllTerms = R.showAllTerms;
33
32
  const machineTranslation = R.machineTranslation;
@@ -1945,6 +1945,14 @@ function fullDetail(f, card, recordsByUri = new Map()) {
1945
1945
  // AT MOST EIGHT ENTRIES, in the card's order, then the line that sends the reader to the audit workbook for all of
1946
1946
  // them (owner, 2026-11-18). A card citing dozens of registrations otherwise runs to pages.
1947
1947
  const RECORD_CAP = 8;
1948
+ /**
1949
+ * The registrations a card's logo line draws, in the card's order: those whose record the run saved, at most RECORD_CAP,
1950
+ * as its register record lists them. The logo step asks for logos for these alone (mark-logos.mjs), so no logo is paid for
1951
+ * that no reader sees. `hasRecord` takes a registration's lower-cased address. PURE.
1952
+ */
1953
+ export function shownRegistrations(f, hasRecord) {
1954
+ return (f?.owner?.registrations || []).filter((r) => r?.uri && hasRecord(String(r.uri).toLowerCase())).slice(0, RECORD_CAP);
1955
+ }
1948
1956
  function registerRecordBlock(f, recordsByUri, numberOf) {
1949
1957
  const cited = (f.owner?.registrations || [])
1950
1958
  .map((r) => ({ r, rec: r?.uri ? recordsByUri.get(String(r.uri).toLowerCase()) : null }))
@@ -1959,15 +1967,13 @@ function registerRecordBlock(f, recordsByUri, numberOf) {
1959
1967
 
1960
1968
  // LOGOS ON THE CARD, ON A LINE OF THEIR OWN (owner, 2026-11-18). Under the owner line, one logo per registration
1961
1969
  // in the card's register record whose logo the run saved, each in a box of one fixed size captioned with its
1962
- // register, so nothing in the card head moves when a card has logos. A logo the run tried and failed to fetch reads
1963
- // "Logo not retrieved" and opens the office's record; a registration with no logo, or one the run never asked
1964
- // about, draws nothing, so a run that fetched no logos draws no line. A grouped negative row shows up to three small
1970
+ // register, so nothing in the card head moves when a card has logos. A registration with no logo, one the run never
1971
+ // asked about, or one whose fetch failed draws nothing (owner, 2026-11-25), so a card with no saved logo draws no
1972
+ // line. A grouped negative row shows up to three small
1965
1973
  // logos and "+N" under its text. The image travels inside the report; nothing points at the register's image.
1966
1974
  function logoLine(f, recordsByUri, { small = false } = {}) {
1967
1975
  if (!LOGOS.size) return '';
1968
- const figures = (f.owner?.registrations || [])
1969
- .filter((r) => r?.uri && recordsByUri.get(String(r.uri).toLowerCase()))
1970
- .slice(0, RECORD_CAP)
1976
+ const figures = shownRegistrations(f, (uri) => Boolean(recordsByUri.get(uri)))
1971
1977
  .map((r) => {
1972
1978
  const rec = recordsByUri.get(String(r.uri).toLowerCase());
1973
1979
  const href = hrefAttr(RECORD_LINKS?.get(String(r.uri).toLowerCase())?.href) || hrefAttr(registerRecordView(rec, { uri: r.uri }).logo.href);
@@ -2460,8 +2466,8 @@ function markAssessmentBlock(ma) {
2460
2466
  if (!dist && !conn) return '';
2461
2467
  return `${SEC}
2462
2468
  <div class="markassess">
2463
- ${dist ? `<p><strong>${R.markItself.distinctiveness}</strong> ${esc(dist)}</p>` : ''}
2464
- ${conn ? `<p><strong>${esc(R.markItself.connotation)}</strong> ${esc(conn)}</p>` : ''}
2469
+ ${dist ? `<p><strong>${R.markItself.distinctiveness}</strong> ${inline(dist)}</p>` : ''}
2470
+ ${conn ? `<p><strong>${esc(R.markItself.connotation)}</strong> ${inline(conn)}</p>` : ''}
2465
2471
  </div>`;
2466
2472
  }
2467
2473
  const lead = (v) => {
@@ -2487,8 +2493,8 @@ function markAssessmentBlock(ma) {
2487
2493
  const toggle = (label, rows) => rows.length ? `<details class="ma-more"><summary>${label} (${rows.length})</summary><ul class="ma-rows">${rows.join('')}</ul></details>` : '';
2488
2494
  return `${SEC}
2489
2495
  <div class="markassess">
2490
- ${dist ? `<p><strong>${R.markItself.distinctiveness}</strong> ${esc(dist)}</p>` : ''}
2491
- ${conn ? `<p><strong>${esc(R.markItself.connotation)}</strong> ${esc(conn)}</p>` : ''}
2496
+ ${dist ? `<p><strong>${R.markItself.distinctiveness}</strong> ${inline(dist)}</p>` : ''}
2497
+ ${conn ? `<p><strong>${esc(R.markItself.connotation)}</strong> ${inline(conn)}</p>` : ''}
2492
2498
  ${toggle(R.markItself.byClassAndMarket, cmRows)}
2493
2499
  ${toggle(R.markItself.registrationsConsidered, crRows)}
2494
2500
  </div>`;
@@ -307,7 +307,6 @@ export const REGISTER_RECORD = Object.freeze({
307
307
  mtNote: 'For the original wording, open the register number or use Ask AI.',
308
308
  noGoods: 'The record states no goods or services.',
309
309
  classNotStated: 'Class not stated',
310
- logoNotRetrieved: 'Logo not retrieved',
311
310
  registrationsCount: (n) => `${n} registrations`,
312
311
  showAllTerms: (n) => `Show all ${n} terms`,
313
312
  // `language` is the record's language by its English name, or null when the record does not say.
@@ -97,7 +97,7 @@
97
97
  .ko-scroll{container-type:inline-size}
98
98
  .rr-krow td>details,.ko-forms .ko-formsline{position:sticky;left:24px;box-sizing:border-box;max-width:calc(100cqw - 48px)}
99
99
  }
100
- @media (max-width:640px){.rr-ko .rr-lg,.rr-ko .rr-lg img,.rr-ko .rr-nologo{width:72px}.rr-ko .rr-lg img,.rr-ko .rr-nologo{height:56px}}
100
+ @media (max-width:640px){.rr-ko .rr-lg,.rr-ko .rr-lg img{width:72px}.rr-ko .rr-lg img{height:56px}}
101
101
  .ko-counts td.na{font-family:var(--mono);font-size:12.5px;color:var(--slate)}
102
102
  .ko-counts tr.ko-forms td{font-size:12px;color:var(--slate);line-height:1.55;padding:0 24px 13px;
103
103
  font-family:var(--mono);word-break:break-word}
@@ -263,13 +263,11 @@
263
263
  .rr-lg{margin:0;width:94px;text-align:center}
264
264
  .rr-lg img{display:block;width:94px;height:72px;object-fit:contain;background:#fff;border:1px solid var(--line);border-radius:8px;padding:5px;box-sizing:border-box}
265
265
  .rr-lg figcaption{font-size:10.5px;letter-spacing:.04em;color:var(--slate);margin-top:3px}
266
- .rr-nologo{width:94px;height:72px;box-sizing:border-box;border-radius:8px;border:1px dashed var(--line2);display:flex;align-items:center;justify-content:center;text-align:center;padding:6px;font-size:11px;line-height:1.3;color:var(--slate);text-decoration:none}
267
- a.rr-nologo{color:var(--slate)}
268
266
  .rr-band{max-width:none;justify-content:flex-start;gap:10px;margin:10px 0 12px}
269
267
  .rn>summary .rr-sm{flex:0 0 100%;box-sizing:border-box;padding-left:14px;margin:2px 0 0}
270
268
  .rr-more{align-self:center;font-size:11px;color:var(--slate)}
271
269
  .rr-sm{max-width:none;justify-content:flex-start;gap:4px;margin-left:4px}
272
- .rr-sm .rr-lg,.rr-sm .rr-lg img,.rr-sm .rr-nologo{width:40px;height:30px;padding:2px;font-size:7.5px}
270
+ .rr-sm .rr-lg,.rr-sm .rr-lg img{width:40px;height:30px;padding:2px}
273
271
  .internal{background:#F6ECF7;border:1px dashed #C9A9CC;border-radius:9px;padding:9px 12px;margin-top:11px;font-size:12.5px;color:#6a2b6e}
274
272
  .internal .tag{font-size:9px;font-weight:700;letter-spacing:.1em;text-transform:uppercase;color:#8a3a8f;display:block;margin-bottom:3px}
275
273
  /* (spec-49 T4: the collapsible QC-banner rules died with the quarantine/review banners.) */
@@ -543,7 +541,7 @@
543
541
  .fourans ul.fa-obstacles{margin:6px 0 0;padding-left:18px}
544
542
  .fourans ul.fa-obstacles li{margin:0 0 4px;font-size:13px}
545
543
  @media (max-width:640px){.fourans .fa-row{flex-direction:column;gap:2px}.fourans .fa-k{flex:auto}}
546
- @media (max-width:640px){.rr-row{grid-template-columns:1fr;gap:0}.rr-band .rr-lg,.rr-band .rr-lg img,.rr-band .rr-nologo{width:72px}.rr-band .rr-lg img,.rr-band .rr-nologo{height:56px}}
544
+ @media (max-width:640px){.rr-row{grid-template-columns:1fr;gap:0}.rr-band .rr-lg,.rr-band .rr-lg img{width:72px}.rr-band .rr-lg img{height:56px}}
547
545
 
548
546
  /* ── the coverage ledger stops being the page's smallest print ─────────────────────────────
549
547
  `details.scope` had NO screen rule at all: its summary rendered at the browser default, in the
@@ -131,16 +131,18 @@ export function blockAround(text, needle) {
131
131
  export const WRITE_ORDER_MARKERS = Object.freeze([
132
132
  { id: "writeReturn:absolute-path", re: /ABSOLUTE path/ },
133
133
  { id: "writeReturn:you-owe", re: /YOU OWE \d+ FILES/ },
134
- { id: "repair-tail:write-tool", re: /with the Write tool/ },
135
- { id: "repair-tail:edit-tool", re: /using the Edit tool/ },
136
- { id: "corrective:max-tokens-write-tool", re: /CALL THE WRITE TOOL/ },
134
+ // The repair tails and the output-ceiling corrective name no engine's tool: both engines write files, each with its own
135
+ // operation. So the markers are the orders themselves.
136
+ { id: "repair-tail:write-complete", re: /Write the COMPLETE file now/ },
137
+ { id: "repair-tail:targeted-edits", re: /by TARGETED EDITS to/ },
138
+ { id: "corrective:max-tokens-write", re: /write the required file\(s\) as soon/ },
137
139
  // ADDED BY THE THIRD CONVERSION, and the way it was found is the argument for the anti-rot arm below.
138
140
  // `warmPatchMessage`'s sibling branch orders "Re-save the COMPLETE corrected JSON at <path>" — a
139
141
  // hand-write with no Write/Edit token and no `ABSOLUTE path` in it, so the four markers above were all
140
142
  // blind to it. On frame-diff the sibling IS the tool-written artifact, so that branch was ordering a
141
143
  // hand-write of a driver-owned file on every `framediff_*` token, and direction (b) reported clean.
142
144
  // A marker list is only as good as the composers it has met; this is the fifth composer it has met.
143
- { id: "warm-sibling:re-save-complete", re: /Re-save the COMPLETE/ },
145
+ { id: "warm-sibling:re-save-complete", re: /re-save the COMPLETE/i },
144
146
  ]);
145
147
 
146
148
  // THE RESIDUAL GAP, STATED RATHER THAN LEFT FOR SOMEBODY TO DISCOVER. This list is the composers as they
@@ -914,12 +914,12 @@ export function noteChannelCoverageAtStageExit(P, mergedGrid) {
914
914
  * search that never reached the register. A slice with a block, a timed-out one included, is not among them: the band
915
915
  * already accounts for it. A guarded child is left to the plan join, which reads it off its parent. PURE but for the read.
916
916
  */
917
- export function slicesUnitNeverReached(P, plan, axis) { // @internal
917
+ export function slicesUnitNeverReached(P, plan, axis, reason = plainDeferralReason("slice-not-landed")) { // @internal
918
918
  let band = [];
919
919
  try { const parsed = JSON.parse(readFileSync(P.registerBand(axis), "utf8")); band = Array.isArray(parsed) ? parsed : []; } catch { band = []; }
920
920
  const held = new Set(band.map((b) => b?.qid).filter(Boolean).map(String));
921
921
  return (plan?.entries ?? []).filter((e) => e?.axis === axis && e?.qid && !e.when && !held.has(String(e.qid)))
922
- .map((e) => ({ axis, qid: String(e.qid), reason: plainDeferralReason("slice-not-landed") }));
922
+ .map((e) => ({ axis, qid: String(e.qid), reason }));
923
923
  }
924
924
 
925
925
  /** The unit a run records as unfinished, taken as its band stands: its note rendered from it, nothing dispatched. */
@@ -424,7 +424,9 @@ const table = (columns, rows) => [row(columns), `|${columns.map(() => "---").joi
424
424
  * recordHost → the full clickable record URL (code-rendered)
425
425
  * counts → ## Summary counts (code-extracted)
426
426
  * auditRows → Audit trail (code-extracted)
427
- * readIds → the record ids read while answering each instructed check (code-extracted)
427
+ * readIds → every record id this run's reading audit logged as read, rendered once under the audit trail
428
+ * (code-extracted). It is no answer's support: a read proves a record was opened, not which
429
+ * answer it bears on, so each answer carries its own `records`.
428
430
  * positions → the crowd row's counted denominator (code-rendered, via the coverage form)
429
431
  */
430
432
  export function emptyFacts() {
@@ -599,14 +601,15 @@ export function renderRegisterFindings(model, facts = emptyFacts()) {
599
601
  for (const [heading, body] of [[DIGEST_SECTIONS.crossChecks, model.cross_checks], [DIGEST_SECTIONS.openFlags, model.open_flags]])
600
602
  if (body) out.push(heading, "", body, "");
601
603
 
602
- // ### Answers to the instructed checks — the ANSWER is the seat's, the record ids it read while
603
- // answering are the reading audit's. doubt-ledger's answerWatchlistLines scans this section by its
604
- // /answer|watchlist/i heading test, so every line under it is a line that join can reach.
604
+ // ### Answers to the instructed checks — the ANSWER and the records it relies on are the seat's. An answer
605
+ // recorded before it could name them shows none: its attribution is unknown, and the run's reads are no
606
+ // stand-in for it. doubt-ledger's answerWatchlistLines scans this section by its /answer|watchlist/i heading
607
+ // test, so every line under it is a line that join can reach.
605
608
  if (model.instructed_checks.length) {
606
609
  out.push(DIGEST_SECTIONS.instructed, "");
607
610
  for (const c of model.instructed_checks) {
608
611
  out.push(`- You asked: ${c.ask} → ${c.answer}`);
609
- if (facts.readIds?.length) out.push(` - records read: ${facts.readIds.join(", ")}`);
612
+ if (c.records?.length) out.push(` - Records relied on: ${c.records.join(", ")}`);
610
613
  }
611
614
  out.push("");
612
615
  }
@@ -618,10 +621,15 @@ export function renderRegisterFindings(model, facts = emptyFacts()) {
618
621
  out.push("");
619
622
  }
620
623
 
621
- if (facts.auditRows?.length) {
622
- out.push(DIGEST_SECTIONS.auditTrail, "",
623
- table(["Unit", "Searches", "Detail fetches", "_query"], facts.auditRows.map((a) =>
624
+ // The run's reads, once, for audit, where a run answers instructed checks: what was opened, not what any
625
+ // answer rests on. A line, not a table, so the published audit's table reader leaves it here.
626
+ const reads = model.instructed_checks.length && facts.readIds?.length ? facts.readIds : [];
627
+ if (facts.auditRows?.length || reads.length) {
628
+ out.push(DIGEST_SECTIONS.auditTrail, "");
629
+ if (facts.auditRows?.length)
630
+ out.push(table(["Unit", "Searches", "Detail fetches", "_query"], facts.auditRows.map((a) =>
624
631
  [a.unit, a.searches, a.detail_fetches, a.query ?? ""])), "");
632
+ if (reads.length) out.push(`- records read: ${reads.join(", ")}`, "");
625
633
  }
626
634
  if (facts.counts) {
627
635
  const statusRow = facts.counts.find(([l]) => /status/i.test(l));
@@ -785,12 +793,26 @@ export function acceptRegisterDigest(params, facts = emptyFacts()) {
785
793
  screen_verdict: verdict });
786
794
  }
787
795
 
796
+ // THE RECORDS AN ANSWER RELIES ON are the seat's to name and the driver's to resolve. The reading audit proves a
797
+ // record was opened somewhere in the run, not which answer it supports, so it is no answer's citation. Each named
798
+ // record must be one the run holds, and is kept as the band carries it. An answer resting on a search's count, a
799
+ // verified zero or an open question names none: its receipt is its basis.
788
800
  const instructed_checks = [];
789
801
  for (const c of Array.isArray(params?.instructed_checks) ? params.instructed_checks : []) {
790
802
  const ask = str(c?.ask), answer = str(c?.answer);
791
803
  if (!ask || !answer)
792
804
  return { ok: false, reason: `registerdigest_instructed_incomplete:${(ask || answer).slice(0, 60) || "(empty)"} — every instructed check carries the ask AND the answer, including the honest "the frozen material cannot answer this"` };
793
- instructed_checks.push({ ask, answer });
805
+ if (c?.records != null && !Array.isArray(c.records))
806
+ return { ok: false, reason: `registerdigest_relied_records_invalid:${ask.slice(0, 60)} — \`records\` is a list of the held record uris this answer relies on` };
807
+ const records = [];
808
+ for (const id of c?.records ?? []) {
809
+ const rec = byUri.get(joinKey(id));
810
+ if (!rec)
811
+ return { ok: false, reason: `registerdigest_relied_record_unknown:${str(id).slice(0, 60) || "(empty)"} (${ask.slice(0, 60)}) — no record in this run's band carries that uri. Name only held records this answer relies on, and none where it rests on a search rather than a record` };
812
+ const uri = identifierCells(rec, facts.recordHost).uri;
813
+ if (!records.includes(uri)) records.push(uri);
814
+ }
815
+ instructed_checks.push({ ask, answer, ...(records.length ? { records } : {}) });
794
816
  }
795
817
 
796
818
  const disagreement_resolutions = [];
@@ -34,6 +34,7 @@ import { captureCall, stampVerdict } from "./call-capture.mjs";
34
34
  import { join, dirname, basename } from "node:path";
35
35
  import { refuseUndeclared as refuseUndeclaredShared, keepIfAbsent, lastAccepted, acceptedEnvelope } from "./preserve-merge.mjs";
36
36
  import { paths, readJson } from "./run-record.mjs";
37
+ import { registerPlanCallKilled } from "./tool-calls.mjs";
37
38
 
38
39
  /**
39
40
  * THE REPAIR TAIL FOR THIS STAGE'S BESPOKE FOLLOWUPS — one implementation, used by all of them.
@@ -275,7 +276,15 @@ export function recordUnitNote(runDir, received, { now = () => new Date().toISOS
275
276
  return { written: null, refused: undeclared, captured: closeCapture({ ok: false, refused: undeclared }), capture_failed: captureFailed };
276
277
  }
277
278
  const call = mergeUnitNoteCall(lastAcceptedUnitNote(dir0, axis), received);
278
- const v = acceptUnitNote(call, { account: readBandAccount(dir0, axis), planned: plannedEntries(dir0, axis) });
279
+ const account = readBandAccount(dir0, axis);
280
+ // NO BAND BECAUSE THE PLAN CALL NEVER CAME BACK is a product fault, not a unit that has not run: the call log holds
281
+ // its start and no return. The step is told so, and is not sent back to make the call again (product-fault.mjs).
282
+ if (!account) {
283
+ const killed = registerPlanCallKilled(dir0, axis);
284
+ if (killed) return { written: null, refused: null, product_fault: `${killed.tool ?? "register call"} for ${axis} never returned`,
285
+ captured: closeCapture({ ok: false, product_fault: true }), capture_failed: captureFailed };
286
+ }
287
+ const v = acceptUnitNote(call, { account, planned: plannedEntries(dir0, axis) });
279
288
  if (!v.ok) {
280
289
  // BEST-EFFORT, and it must stay that way: a journal write that failed a refusal would turn a defect
281
290
  // the seat can fix into one it cannot see. The refusal is the return value; this is the audit trail.
@@ -42,6 +42,7 @@
42
42
  // "no unregistered composers" and read as a pass.
43
43
 
44
44
  import { lines } from "./stages.mjs";
45
+ import { FINDINGS_SCHEMA_VERSION } from "./findings-model.mjs";
45
46
  import { editRepairTail, abbrev } from "./repair-contract.mjs";
46
47
  // `connotation-remedy` quotes the refusal token and turns it into a fix instruction. Both helpers
47
48
  // are the gateway's, and calling them here rather than re-deriving the text is the point: one
@@ -210,7 +211,7 @@ const correctiveRules = ({ narrative, findings, placement, rulingsTail, adds = f
210
211
  // 2026-07-04 (the VENZY corrective thrash): three attempts died inventing three different keys
211
212
  // while trying to EXPRESS a hold. The contract is closed and every correction is expressible
212
213
  // inside it — say so.
213
- `THE FINDINGS CONTRACT IS CLOSED — MINIMAL CHANGE ONLY: start from the finding objects as you last sent them and change the smallest set of existing fields the flags require; NEVER invent a key, a state, or an enum value (any unknown key fails the file and, repeated, fails the WHOLE RUN). Every correction the reviewer can ask for is expressible with existing fields: an unsourced/confabulated attribution ⇒ that finding gets "disposition":"withdrawn" + "withdrawn_reason", OR its owner/prose is re-attributed to what the sources actually support — an identity that needs the applicant's confirmation is stated in the finding's prose/impact text, NEVER as a new field or note-type; use_check.quality is EXACTLY one of owner-site | independent | register-mirror or omitted; context_notes entries are EXACTLY {"type","mark","owner","context"}. RE-TYPING A DISPOSITION CARRIES ITS FIELDS WITH IT — this is the one case where a minimal edit MUST add a key, and these are the only keys it may add: re-typing a finding TO "off-field" also sets "off_field_ground" (EXACTLY "different-field" — only where that finding's own goods_proximity meter reads "low" — or "no-material-risk"), and re-typing AWAY from "off-field" REMOVES it; any finding that is not "withdrawn" keeps a non-empty "legal_position" and "practical_position", so a re-type that lands on a finding missing either must write both. Nothing else may be added.`,
214
+ `THE FINDINGS CONTRACT IS CLOSED — MINIMAL CHANGE ONLY: start from the finding objects as you last sent them and change the smallest set of existing fields the flags require; NEVER invent a key, a state, or an enum value (any unknown key fails the file and, repeated, fails the WHOLE RUN). Every correction the reviewer can ask for is expressible with existing fields: an unsourced/confabulated attribution ⇒ that finding gets "disposition":"withdrawn" + "withdrawn_reason", OR its owner/prose is re-attributed to what the sources actually support — an identity that needs the applicant's confirmation is stated in the finding's prose/impact text, NEVER as a new field or note-type; use_check.quality is EXACTLY one of owner-site | independent | register-mirror or omitted; context_notes entries are EXACTLY {"type","mark","context"} plus an OPTIONAL "owner". RE-TYPING A DISPOSITION CARRIES ITS FIELDS WITH IT — this is the one case where a minimal edit MUST add a key, and these are the only keys it may add: re-typing a finding TO "off-field" also sets "off_field_ground" (EXACTLY "different-field" — only where that finding's own goods_proximity meter reads "low" — or "no-material-risk"), and re-typing AWAY from "off-field" REMOVES it; any finding that is not "withdrawn" keeps a non-empty "legal_position" and "practical_position", so a re-type that lands on a finding missing either must write both. Nothing else may be added.`,
214
215
  rulingsTail ? lines(
215
216
  `PLACEMENT RULINGS TAIL (verbatim from ${placement}, provided AS DATA — do NOT re-read the placement file; where a flagged correction touches a coverage disposition, a coverage[] row, or a placement call, adjudicate it against these rulings — adopt each ruling or counter-reason it, never silently drop one):`,
216
217
  "```markdown",
@@ -302,8 +303,8 @@ export const REPAIR_COMPOSERS = [
302
303
  stage: "synthesis",
303
304
  key: "synthesis:schema-downlevel",
304
305
  compose: ({ findings, declaredSv, frameworkKey, bandLabels }) => lines(
305
- `This is a fresh session: your earlier synthesis is not in your context. The findings file you emitted (${findings}) declares "schema_version": ${declaredSv}, but the dictation requires "schema_version": 4 — rated in the framework's band WORDS with a top-level "rated_under_framework": "${frameworkKey}", and NO composite/level/dispute_type keys (that scale is retired).`,
306
- `Re-emit the COMPLETE record through \`record_synthesis\` at schema_version 4 — same findings, same judgments, each rated finding carrying "band" (EXACTLY one of: ${bandLabels.join(" / ")}) per the original dictation. Change nothing else. This one is a whole re-send rather than a patch, because the key set itself changes shape: there is no set of named findings to correct.`,
306
+ `This is a fresh session: your earlier synthesis is not in your context. The findings file you emitted (${findings}) declares "schema_version": ${declaredSv}, but the dictation requires "schema_version": ${FINDINGS_SCHEMA_VERSION} — rated in the framework's band WORDS with a top-level "rated_under_framework": "${frameworkKey}", and NO composite/level/dispute_type keys (that scale is retired).`,
307
+ `Re-emit the COMPLETE record through \`record_synthesis\` at schema_version ${FINDINGS_SCHEMA_VERSION}, each rated finding carrying "band" (EXACTLY one of: ${bandLabels.join(" / ")}) per the original dictation. Keep the findings and their judgments. Supply the fields the current record requires. This one is a whole re-send rather than a patch, because the key set itself changes shape: there is no set of named findings to correct.`,
307
308
  ),
308
309
  // A WHOLE-FILE EMISSION WITH NO REPAIR TAIL, AND THE SITE SAYS WHY: the key set changes shape, so
309
310
  // there is no small set of named lines to patch. Declared "none" with that reason rather than left
@@ -318,9 +319,9 @@ export const REPAIR_COMPOSERS = [
318
319
  // `narrative` is named because a fresh session has not read it, and the register it is asked for is the
319
320
  // forward steps that narrative names.
320
321
  compose: ({ findings, narrative }) => lines(
321
- `This is a fresh session: your earlier synthesis is not in your context. The findings file you emitted (${findings}) has no top-level "actions" array, but the dictation requires the ACTIONS REGISTER: ONE object per forward step your opinion names that a HUMAN must still take, each EXACTLY {"id","kind","text","ordinals"} (+ optional "deadline":{"kind","date"}) — kinds: conditions consent / coexistence-agreement / territorial-delimitation / goods-amendment / mark-modification / senior-clearance / proceeding-response / counsel-opinion-required; advisory client-fact / commercial-decision / monitoring / filing-routine.`,
322
- `Add ONE top-level "actions": [...] key that registers every forward step your own narrative (${narrative}) names ("actions": [] ONLY if the opinion genuinely demands nothing beyond ordinary filing). Same findings, same judgments — the findings themselves do not change.`,
323
- `Send it with \`record_synthesis\` as a PATCH call carrying only "actions". The driver merges this patch into the last accepted record, keeps the values the patch does not replace, and renders both files. There is no file for you to write or edit.`,
322
+ `This is a fresh session: your earlier synthesis is not in your context. The findings file you emitted (${findings}) has no top-level "actions" array, but the dictation requires the ACTIONS REGISTER: ONE object per forward step your opinion names that a HUMAN must still take, each EXACTLY {"id","kind","text","ordinals"} plus an OPTIONAL "deadline" {"kind","date"} and an OPTIONAL "condition" (CONDITION kinds only) — kinds: conditions consent / coexistence-agreement / territorial-delimitation / goods-amendment / mark-modification / senior-clearance / proceeding-response / counsel-opinion-required; advisory client-fact / commercial-decision / monitoring / filing-routine. A deadline, when present, needs a date and may include a kind.`,
323
+ `Add ONE "actions": [...] field to the findings document that registers every forward step your own narrative (${narrative}) names ("actions": [] ONLY if the opinion genuinely demands nothing beyond ordinary filing). Same findings, same judgments — the findings themselves do not change.`,
324
+ `Send the complete actions list in \`findings.actions\` through \`record_synthesis\`. The driver merges this patch into the last accepted record, keeps the values the patch does not replace, and renders both files. There is no file for you to write or edit.`,
324
325
  ),
325
326
  samples: [{ name: "the actions register demand", tail: "tool", args: { findings: "findings.json", narrative: "narrative.md" } }],
326
327
  },
@@ -674,8 +675,8 @@ export const REPAIR_COMPOSERS = [
674
675
  // The id is what the seat can find its own row by; `kind` is echoed because a kind defect is
675
676
  // the one case where the id alone does not locate the fault in the seat's own reading.
676
677
  ...bad.map((q) => `- action id ${q.id ?? "(unreadable)"}${q.kind ? ` (kind "${String(q.kind).slice(0, 40)}")` : ""} at index ${q.index}: ${String(q.error ?? "invalid shape").slice(0, 160)}`),
677
- `THE ACTION CONTRACT IS CLOSED — MINIMAL EDIT ONLY. Each action is EXACTLY {"id","kind","text","ordinals"} plus an OPTIONAL "deadline" {"kind","date"} and an OPTIONAL "condition" (CONDITION kinds only). Change the smallest set of existing fields these errors require and NEVER invent a key. Do not resolve a defect by DELETING the action: a forward legal step your own opinion names must survive this edit, and a dropped condition changes the delivered verdict.`,
678
- `Send the corrected action(s) with \`record_synthesis\` as a PATCH call carrying only "actions" — the complete register with these objects fixed. The driver is holding your findings and re-renders from them; nothing else moves, and there is no file for you to write or edit.`,
678
+ `THE ACTION CONTRACT IS CLOSED — MINIMAL EDIT ONLY. Each action is EXACTLY {"id","kind","text","ordinals"} plus an OPTIONAL "deadline" {"kind","date"} and an OPTIONAL "condition" (CONDITION kinds only). A deadline, when present, needs a date and may include a kind. Change the smallest set of existing fields these errors require and NEVER invent a key. Do not resolve a defect by DELETING the action: a forward legal step your own opinion names must survive this edit, and a dropped condition changes the delivered verdict.`,
679
+ `Send the complete actions list in \`findings.actions\` through \`record_synthesis\`. Send every existing action and all its fields, including any condition and deadline. Change only the fields this repair identifies. The driver is holding your findings and re-renders from them; nothing else moves, and there is no file for you to write or edit.`,
679
680
  ),
680
681
  samples: [{ name: "one malformed action", tail: "tool", args: { findings: "findings.json", bad: [{ id: "a1", kind: "consent", index: 0, error: "no ordinals" }] } }],
681
682
  },
@@ -777,7 +778,7 @@ export const REPAIR_COMPOSERS = [
777
778
  key: "common-law:grid-ledger",
778
779
  compose: ({ gridLedger, gridSpecPath }) => lines(
779
780
  `This is a fresh session: your earlier common-law work is not in your context. Your findings file is already written and stands.`,
780
- `The grid ledger ${gridLedger} is missing — the deterministic grid call did not complete. Call perplexity_research again with enable_sandbox:true and grid_spec_path: ${gridSpecPath}. The tool writes the ledger itself from the API response; do NOT write it yourself and do NOT re-emit the grid JSON.`,
781
+ `The grid ledger ${gridLedger} is missing — the deterministic grid call did not complete. Call perplexity_research again with grid_spec_path: ${gridSpecPath}. The tool writes the ledger itself from the API response; do NOT write it yourself and do NOT re-emit the grid JSON.`,
781
782
  `Then return ONLY: the grid ledger path + one line confirming the tool reported it written.`,
782
783
  ),
783
784
  samples: [{ name: "the ledger the grid call never wrote", tail: "tool", args: { gridLedger: "grid-ledger.json", gridSpecPath: "grid-spec.json" } }],
@@ -788,7 +789,7 @@ export const REPAIR_COMPOSERS = [
788
789
  key: "common-law:coverage-closure",
789
790
  compose: ({ findingsFile, suppSpec, suppSpecPath, closable, cellKey }) => lines(
790
791
  `This is a fresh session: your earlier common-law work is not in your context, and your findings file is ${findingsFile}. Do NOT redo the full sweep.`,
791
- suppSpec ? `These ${closable.length} grid cells are recorded as not-executed/coverage-limited with NO mechanical failure behind them — they are closable now. Run them via the DETERMINISTIC supplementary search-as-code grid: call perplexity_research with enable_sandbox:true and grid_spec_path: ${suppSpecPath}. The tool runs EXACTLY the dictated cells and WRITES the supplementary ledger to its output_path itself — do NOT save it yourself and do NOT re-emit the grid JSON. The cells:` : "",
792
+ suppSpec ? `These ${closable.length} grid cells are recorded as not-executed/coverage-limited with NO mechanical failure behind them — they are closable now. Run them via the DETERMINISTIC supplementary search-as-code grid: call perplexity_research with grid_spec_path: ${suppSpecPath}. The tool runs EXACTLY the dictated cells and WRITES the supplementary ledger to its output_path itself — do NOT save it yourself and do NOT re-emit the grid JSON. The cells:` : "",
792
793
  ...(suppSpec ? closable.map((c) => `- ${cellKey(c)}`) : []),
793
794
  // The edit direction has to be SCOPED here: this prompt already forbids saving the grid JSON,
794
795
  // and the tail below is the first thing in it that hands over the Edit tool. A model that reads
@@ -805,7 +806,7 @@ export const REPAIR_COMPOSERS = [
805
806
  key: "common-law-half:coverage-closure",
806
807
  compose: ({ findingsFile, gridSpecPath, suppSpec, suppSpecPath, cells, cellKey }) => lines(
807
808
  `This is a fresh session: your earlier common-law work is not in your context, and your findings file is ${findingsFile}. Do NOT redo the full sweep. You own ONE HALF of this matter's grid (your half-grid spec: ${gridSpecPath}).`,
808
- suppSpec ? `These ${cells.length} grid cells are recorded as not-executed/coverage-limited with NO mechanical failure behind them — they are closable now. Run them via the DETERMINISTIC supplementary search-as-code grid: call perplexity_research with enable_sandbox:true and grid_spec_path: ${suppSpecPath}. The tool runs EXACTLY the dictated cells and WRITES the supplementary ledger to its output_path itself — do NOT save it yourself and do NOT re-emit the grid JSON. The cells:` : "",
809
+ suppSpec ? `These ${cells.length} grid cells are recorded as not-executed/coverage-limited with NO mechanical failure behind them — they are closable now. Run them via the DETERMINISTIC supplementary search-as-code grid: call perplexity_research with grid_spec_path: ${suppSpecPath}. The tool runs EXACTLY the dictated cells and WRITES the supplementary ledger to its output_path itself — do NOT save it yourself and do NOT re-emit the grid JSON. The cells:` : "",
809
810
  ...(suppSpec ? cells.map((c) => `- ${cellKey(c)}`) : []),
810
811
  `Then update ONLY those Negative-results matrix rows with their real receipts ("No results" / "No similar listings (N candidates reviewed)" / "Similar listing(s) found — see Findings") and reconcile the Coverage ledger rows they close, preserving everything else. The driver validates grid completeness from the ledgers the tool wrote — never from your prose. The edit direction below covers ${findingsFile} ONLY; the machine ledgers stay the tool's.`,
811
812
  editRepairTail(findingsFile),