clearotron 0.5.0 → 0.5.1-beta.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (123) hide show
  1. package/CONTRIBUTING.md +2 -2
  2. package/INSTALL.md +334 -302
  3. package/QUICKSTART.md +12 -4
  4. package/README.md +12 -7
  5. package/THIRD-PARTY-NOTICES.md +4 -4
  6. package/bin/README.md +14 -11
  7. package/bin/clearotron.mjs +1 -1
  8. package/bin/connect.mjs +73 -25
  9. package/bin/example.mjs +4 -2
  10. package/bin/onboard.mjs +562 -336
  11. package/bin/start.mjs +184 -36
  12. package/bin/update.mjs +26 -13
  13. package/build-info.json +2 -2
  14. package/docs/PORTAL.md +2 -2
  15. package/docs/architecture/02-architecture.md +3 -3
  16. package/docs/architecture/04-configuration-reference.md +1 -2
  17. package/docs/architecture/05-config-governance.md +1 -1
  18. package/docs/architecture/06-operations-runbook.md +1 -1
  19. package/driver/CHANGELOG.md +77 -0
  20. package/driver/README.md +2 -2
  21. package/driver/config-inventory.mjs +20 -11
  22. package/driver/contract-e3-backlog.mjs +27 -27
  23. package/driver/contract-e3-baseline.json +2 -2
  24. package/driver/contract-vocabulary.mjs +1 -1
  25. package/driver/degraded-parts.mjs +67 -3
  26. package/driver/dev-portal.mjs +1 -1
  27. package/driver/digest-queue.mjs +5 -5
  28. package/driver/driver.config.mjs +9 -9
  29. package/driver/engine/CONTRACT.md +1 -1
  30. package/driver/engine/anthropic-agent.mjs +4 -2
  31. package/driver/engine/mcp/band-server.mjs +1 -21
  32. package/driver/engine/mcp/clarivate-propose-tool.mjs +26 -0
  33. package/driver/engine/mcp/clarivate-server.mjs +2 -18
  34. package/driver/engine/mcp/fixture-register-server.mjs +33 -0
  35. package/driver/engine/mcp/gather-config.mjs +48 -7
  36. package/driver/engine/mcp/recording-server.mjs +206 -14
  37. package/driver/engine/mcp/supplemental.mjs +4 -2
  38. package/driver/engine/openai-agent.mjs +3 -1
  39. package/driver/engine/probe.mjs +10 -0
  40. package/driver/filing-goods.mjs +95 -0
  41. package/driver/findings-model.mjs +3 -0
  42. package/driver/gateway.mjs +42 -40
  43. package/driver/knockout-assess-record.mjs +54 -4
  44. package/driver/knockout-correction-record.mjs +342 -0
  45. package/driver/knockout-frame-record.mjs +4 -2
  46. package/driver/knockout-register-read.mjs +705 -0
  47. package/driver/knockout-register-record.mjs +222 -0
  48. package/driver/knockout-review-record.mjs +96 -25
  49. package/driver/narrative-refutation-record.mjs +87 -1
  50. package/driver/order-tables.mjs +23 -0
  51. package/driver/owner-use-check.mjs +5 -2
  52. package/driver/package.json +1 -1
  53. package/driver/partial-payload-baseline.json +8 -0
  54. package/driver/pipeline-knockout.mjs +506 -313
  55. package/driver/pipeline.mjs +179 -86
  56. package/driver/portal-local-auth.mjs +7 -1
  57. package/driver/portal-service.mjs +62 -6
  58. package/driver/progress.mjs +2 -2
  59. package/driver/publish/index.mjs +18 -21
  60. package/driver/publish/knockout.mjs +40 -18
  61. package/driver/publish/render-knockout.mjs +40 -27
  62. package/driver/publish/report-dates.mjs +43 -0
  63. package/driver/recall-reconciliation.mjs +2 -2
  64. package/driver/record-goods.mjs +50 -9
  65. package/driver/register-count.mjs +12 -59
  66. package/driver/register-fixture-marker.mjs +22 -0
  67. package/driver/register-plan.mjs +48 -0
  68. package/driver/register-records.mjs +84 -266
  69. package/driver/register-taint.mjs +2 -2
  70. package/driver/repair-composers.mjs +15 -8
  71. package/driver/result-noun-fields.mjs +6 -2
  72. package/driver/run-requirements.mjs +54 -4
  73. package/driver/runner.mjs +4 -13
  74. package/driver/skills/clearance-register/providers/clarivate.md +2 -2
  75. package/driver/skills/knockout-assess/SKILL.md +101 -100
  76. package/driver/skills/knockout-frame/SKILL.md +3 -1
  77. package/driver/skills/knockout-register-read/SKILL.md +77 -0
  78. package/driver/stages-knockout.mjs +159 -98
  79. package/driver/stages.mjs +4 -2
  80. package/driver/suite-census.json +389 -71
  81. package/driver/systemd/README.md +2 -2
  82. package/driver/verify-knockout.mjs +175 -39
  83. package/driver/verify.mjs +10 -9
  84. package/mcp-server/CHANGELOG.md +4 -0
  85. package/mcp-server/CONNECT.md +4 -0
  86. package/mcp-server/demo-mode.mjs +6 -0
  87. package/mcp-server/lib/demo-texts.mjs +38 -0
  88. package/mcp-server/lib/http-handler.mjs +7 -1
  89. package/mcp-server/lib/knockout.mjs +3 -2
  90. package/mcp-server/lib/options.mjs +3 -1
  91. package/mcp-server/lib/plan.mjs +6 -1
  92. package/mcp-server/mint-token.mjs +1 -1
  93. package/mcp-server/package.json +1 -1
  94. package/mcp-server/serve.mjs +11 -0
  95. package/mcp-server/server.mjs +13 -5
  96. package/package.json +1 -1
  97. package/portal-ui/dist/assets/{index-D2wrw9cH.css → index-AtB9ZpDH.css} +29 -0
  98. package/portal-ui/dist/assets/{index-DcLbvFmQ.js → index-C1oE78Wk.js} +161 -195
  99. package/portal-ui/dist/index.html +2 -2
  100. package/portal-ui/package.json +4 -4
  101. package/providers/README.md +4 -4
  102. package/providers/_shared/execute-plan.mjs +45 -1
  103. package/providers/_shared/term-shape.mjs +1 -1
  104. package/providers/clarivate/src/capabilities.js +7 -6
  105. package/providers/clarivate/src/core.js +11 -7
  106. package/providers/clarivate/src/wider-list.js +104 -0
  107. package/providers/oauth-mcp-bridge/CHANGELOG.md +4 -0
  108. package/providers/oauth-mcp-bridge/package.json +1 -1
  109. package/providers/signa/src/capabilities.js +0 -9
  110. package/scripts/e2e-first-time.mjs +8 -7
  111. package/scripts/freeze-example-run.mjs +2 -2
  112. package/scripts/settings-render-check.mjs +5 -3
  113. package/scripts/test-run.mjs +8 -2
  114. package/shared/client-door.mjs +11 -8
  115. package/shared/connect-clients.mjs +10 -4
  116. package/shared/demo-connection.mjs +43 -0
  117. package/shared/demo-start-args.mjs +7 -2
  118. package/shared/invocation.mjs +18 -3
  119. package/shared/permanent-install.mjs +14 -0
  120. package/shared/scope.mjs +8 -1
  121. package/shared/stdio-connect.mjs +43 -21
  122. package/shared/trigger-lane.mjs +7 -0
  123. package/shared/tty-style.mjs +21 -5
@@ -1,87 +1,48 @@
1
1
  // SPDX-License-Identifier: AGPL-3.0-only
2
2
  // Copyright 2026 Cordillera Sàrl. Additional terms under section 7 of the AGPL-3.0 apply — see ADDITIONAL-TERMS.md
3
- // register-records.mjs — the FILINGS behind the narrow numbers.
3
+ // register-records.mjs — the neutral record of a filing, and the sentences that speak about a name's filings.
4
4
  //
5
- // A count nobody can inspect is a teaser, not a finding. "59 identical" has no faces: the count
6
- // predicate returns a total and no rows, so the one question a reader asks next — WHICH filings? — had
7
- // no answer anywhere, not in the report, not in the workbook, not over MCP.
5
+ // A count nobody can inspect is a teaser, not a finding. The filings behind a knockout's counts are read by its
6
+ // reading step (knockout-register-read.mjs); this module holds what every surface shares about them.
8
7
  //
9
- // This lane answers it for the NARROW predicates only, and lists raw register facts. It is the counts
10
- // lane's sibling and it inherits every one of its rules unchanged.
11
- //
12
- // ══ WHICH PREDICATES, AND WHY NOT THE THIRD ════════════════════════════════════════════════════════
13
- //
14
- // identical — the mark itself. Listed.
15
- // close — each generated variant form (register-variants.mjs). Listed, per form, with the form
16
- // that found it recorded on every row.
17
- // containing — NEVER. That column is a breadth proxy over the register's broad name match, and its
18
- // figures run to the hundreds; listing it would bury the two narrow answers under a
19
- // list nobody asked for and turn a bounded fetch into an unbounded one. The owner ruled
20
- // it out and the reason is the same one that keeps the column labelled a proxy.
21
- //
22
- // ══ THE RULES, EXTENDED FROM THE COUNTS LANE ═══════════════════════════════════════════════════════
23
- //
24
- // 1. NO MODEL TOUCHES A ROW. Code asks, code writes the sidecar, code renders the table. Not one field
25
- // passes through a turn, so a row cannot be paraphrased, re-ordered or invented.
26
- // 2. A FETCH THAT FAILED IS NOT AN EMPTY LIST. `records: []` reads as "no filings" — which is a
27
- // finding, and a false one. Every term carries its own status, and a term whose fetch failed says so
28
- // with the provider's own words. The absence of the artifact, the absence of a term and an
29
- // empty-but-answered term are three different facts and they stay three.
30
- // 3. NO JUDGMENT IS ADDED. No similarity score, no "this one matters", no status interpretation. The
31
- // fields are what the register said: mark, owner, status, classes, territory, and the record's own
32
- // address. Whether any of it blocks anything is lawyer work this product does not do.
33
- //
34
- // ══ WHERE IT CAN RUN ═══════════════════════════════════════════════════════════════════════════════
35
- //
36
- // Off `capabilities.screenSource`, which is already declared and already probed for exactly this
37
- // question — does a search ROW carry the fields, or do the fields cost a separate billed fetch?
38
- //
39
- // "search-row" / "bulk-endpoint" euipo, uspto-local, free-tier, corsearch. The rows come back with
40
- // the search. Listing is one call per term.
41
- // "billed-record-fetch" clarivate. Its search answers with record IDENTIFIERS and nothing
42
- // else, so the fields cost a further call — but that call is a BATCH
43
- // of 100 ids (POST /text, TEXT_BATCH_MAX), and it hydrates all 100.
44
- // Listing is one search + ceil(N/100) screen calls per term. The flag
45
- // says the fields cost a fetch; it does NOT say the fetch is per
46
- // record, and reading it that way priced this lane out by ~50× and
47
- // would have shipped it inert on the register the deployment wires.
48
- //
49
- // ══ COST ═══════════════════════════════════════════════════════════════════════════════════════════
50
- //
51
- // One call per listed term, on top of the count lane's own call for the same term. They cannot share:
52
- // the count rides `cheapCountParams` (`limit:1, fields:["uri"]` — the smallest response the API will
53
- // give), that probe is BUILT BY makeEnumerate as well as by the count kernel, and widening it would
54
- // change what every enumerate call fetches. So the listing pays its own way, and the receipts ledger
55
- // carries a line per call with `stage: "records"` on it so the two lanes' costs can be told apart.
56
- //
57
- // corsearch one billable page-0 search per term. This is where the delta bites.
58
- // euipo free in money, one request against the daily allowance per term.
59
- // uspto-local free — a local SQLite read.
60
- // clarivate one search + one POST /text per 100 listed ids per term — 2 calls at this lane's cap.
61
- // The ids are capped BEFORE the screen, because this provider's search is single-shot
62
- // and returns the complete guid set; screening what came back would be the runaway.
63
- //
64
- // This counts CALLS, which is the unit the receipts ledger records. What a call costs under any
65
- // provider contract is not in this repo, so nothing here converts these into money.
8
+ // 1. NO MODEL TOUCHES A ROW. Code asks, code writes the record, code renders the table. Not one field passes through a
9
+ // turn, so a row cannot be paraphrased, re-ordered or invented.
10
+ // 2. A FETCH THAT FAILED IS NOT AN EMPTY LIST. `records: []` reads as "no filings", which is a finding and a false one.
11
+ // A question carries its own status, and the absence of the artifact, the absence of a question and an
12
+ // empty-but-answered question are three different facts and they stay three.
13
+ // 3. NO JUDGMENT IS ADDED by code. The fields are what the register said: mark, owner, status, classes, territory, and
14
+ // the record's own address.
66
15
 
67
- import { appendFileSync } from "node:fs";
16
+ import { readFileSync } from "node:fs";
17
+ import { join } from "node:path";
68
18
 
69
- import { resolveRegions } from "./register-plan.mjs";
70
- import { reachableRegions } from "./register-availability.mjs"; // — pure; the env binding is injected
71
- import { variantForms, VARIANT_CAP } from "./register-variants.mjs";
72
19
  import { recordOriginsFor } from "./record-origins.mjs"; // — provider-derived, never CLEAROTRON_DATABASE
20
+ import { recordGoods, rowGoods, untaggedIsEnglish } from "./record-goods.mjs";
73
21
 
74
- /** Records per MARK, across every listed term. A bound on cost, on artifact size and on what a reader
75
- * can usefully hold — and it is stated wherever the list renders, per the ruling. */
76
- export const RECORD_CAP = 100;
22
+ /**
23
+ * Was this listing made by the reading step? Its sentences say what that step did. A listing written before it keeps the
24
+ * sentences the product printed for it until then, so an archived run re-renders as delivered. PURE.
25
+ */
26
+ export const readByJudgment = (doc) => Number(doc?.schema) >= 2;
27
+ /**
28
+ * The sentence under a listing: the shipped one for its kind. PURE.
29
+ *
30
+ * NEVER THE TEXT STORED IN ITS FILE. Until the reading step every page printed one constant for every listing, whatever the
31
+ * file held, and an older file holds a word since retired from what a client reads: "weighed", which the sentence in
32
+ * `ARCHIVED_RECORD_BASIS` replaced with "rated". Measured 2026-11-05: an archived listing whose file still held that word
33
+ * printed it again once the stored text was trusted.
34
+ */
35
+ export const recordBasisOf = (doc) => (readByJudgment(doc) ? RECORD_BASIS : ARCHIVED_RECORD_BASIS);
77
36
 
78
- /** The floor on a single term's share of the cap. Without it a name generating twelve forms would give
79
- * each form eight rows, and a form with eight rows tells a reader almost nothing. */
80
- const PER_TERM_FLOOR = 5;
37
+ /** What a listing written before the reading step is, in the sentence the product printed for it. Rendered verbatim. */
38
+ export const ARCHIVED_RECORD_BASIS = "The filings behind the two narrow counts — the name itself and each close "
39
+ + "variation of it — as the register holds them, class-scoped exactly as the counts were. Raw register "
40
+ + "facts only: nothing here is rated, ranked or interpreted, and a filing appearing in this list is "
41
+ + "not a finding that it blocks anything.";
81
42
 
82
43
  /** What the listing is, in one client-safe sentence. Rendered verbatim on every surface. */
83
- export const RECORD_BASIS = "The filings behind the two narrow counts — the name itself and each close "
84
- + "variation of it — as the register holds them, class-scoped exactly as the counts were. Raw register "
44
+ export const RECORD_BASIS = "The filings this search read and carried forward: the name itself and the near "
45
+ + "names and wider searches it chose, as the register holds them. Raw register "
85
46
  // "RATED", NOT "WEIGHED" (owner,) — the word only; the disclaimer this sentence
86
47
  // exists to make is untouched, and it is the load-bearing half: a filing in this list is not a
87
48
  // finding that it blocks anything.
@@ -105,30 +66,9 @@ export function recordsPreflight({ capabilities, hasAdapter = true }) {
105
66
  return null;
106
67
  }
107
68
 
108
- // bounded-concurrency fan-out — the same local idiom as register-count.mjs, for the same reason.
109
- async function runBatched(items, limit, fn) {
110
- const results = new Array(items.length);
111
- let i = 0;
112
- const cap = Number.isFinite(limit) && limit >= 1 ? Math.floor(limit) : 1;
113
- const workers = Array.from({ length: Math.max(1, Math.min(cap, items.length)) }, async () => {
114
- while (i < items.length) { const idx = i++; results[idx] = await fn(items[idx], idx); }
115
- });
116
- await Promise.all(workers);
117
- return results;
118
- }
119
-
120
- /** The terms one mark is listed under, in report order: the mark, then its generated forms. */
121
- export function listedTerms(name, { variantCap = VARIANT_CAP } = {}) {
122
- const v = variantForms(name, { cap: variantCap });
123
- return [
124
- { term: v.base, basis: "identical", label: "the name itself" },
125
- ...v.forms.map((f) => ({ term: f.form, basis: "close", label: `close variation (${f.rules.join(", ")})`, rules: [...f.rules] })),
126
- ];
127
- }
128
-
129
69
  /** One provider row → the neutral record. Every field is EXPLICIT, and an absent one is null rather
130
70
  * than missing: a blank cell and an unstated field read alike to a human, and only one is honest. */
131
- function toRecord(row, { term, basis, provider }) {
71
+ export function toRecord(row, { term, basis, provider }) {
132
72
  const classes = Array.isArray(row?.classes) ? row.classes
133
73
  : (Number.isInteger(row?.classes) ? [row.classes] : null);
134
74
  const territory = row?.office ?? (typeof row?.jurisdictions === "string" ? row.jurisdictions : null)
@@ -158,168 +98,16 @@ function toRecord(row, { term, basis, provider }) {
158
98
  matchedBasis: basis,
159
99
  url: row?.record_url ?? null,
160
100
  provider,
101
+ // WHAT THE FILING COVERS, where the search row itself says. A register whose goods come with the full record says
102
+ // nothing here, and filing-goods.mjs reads them from the body the run holds, which also says how far they go.
103
+ goods: goodsOnRow(row),
161
104
  };
162
105
  }
163
106
 
164
- /**
165
- * List the filings behind the narrow counts, for every mark in the batch.
166
- *
167
- * @param marks [{ name, classes? }] — the request's rows, same source as the counts lane.
168
- * @param lister async (term, { classes, regions, limit }) => { ok, records[], total, reason }
169
- * @returns the sidecar document, ready to write. Never throws for one mark or one term: a failed fetch
170
- * is a recorded status, and the caller decides what a batch-wide failure means.
171
- */
172
- export async function listRegisterRecords({
173
- marks, classes = null, jurisdictions = null, provider, capabilities,
174
- lister, concurrency = 3, ledgerPath = null, now = () => new Date(),
175
- cap = RECORD_CAP, variantCap = VARIANT_CAP, unreachable = [],
176
- }) {
177
- const { regions: coveredRegions, deferred, worldwide } = resolveRegions(jurisdictions, capabilities);
178
- // — the same office split the count lane above does, for the same reason and with the same
179
- // helper. This lane had the identical defect: full declared coverage handed straight to a composite
180
- // adapter, which fans out to a member the box cannot reach. Fixing only the counts would leave a
181
- // report whose figures cover EU and whose listed filings claim to cover EU+US.
182
- //
183
- // NO PREFLIGHT REFUSAL HERE, deliberately. The empty-coverage case is caught by countPreflight, which
184
- // runs first and throws inside the same `if (probeWanted)` block (pipeline-knockout.mjs), so this lane
185
- // is only reached when something is reachable. Adding a second refusal would also change this lane's
186
- // contract: recordsPreflight's refusals are non-fatal by design — "the counts are unaffected and still
187
- // run" — and a fatal one here would take down the product for a gap in its explanation.
188
- const { regions, dropped } = reachableRegions(coveredRegions, unreachable, capabilities?.offices?.covered, worldwide === true);
189
- const officeScope = dropped.length
190
- ? { listed: regions, unlisted: dropped.map((d) => ({ office: d.office, memberId: d.memberId, missing: [...(d.missing ?? [])] })) }
191
- : null;
192
- const batchClasses = (Array.isArray(classes) ? classes : []).filter((n) => Number.isInteger(n));
193
- const markCap = Number.isFinite(cap) && cap >= 1 ? Math.floor(cap) : 0;
194
-
195
- const rows = await runBatched(marks ?? [], concurrency, async (m) => {
196
- const name = String(m?.name ?? "").trim();
197
- const own = (Array.isArray(m?.classes) ? m.classes : []).filter((n) => Number.isInteger(n));
198
- const scoped = own.length ? own : batchClasses;
199
- const terms = listedTerms(name, { variantCap });
200
- // THE SHARE IS DECIDED BEFORE THE FIRST CALL, and it is even. The obvious alternative — let the
201
- // identical predicate fill the cap and give the forms what is left — silently produces a listing
202
- // with no close variations in it on exactly the crowded names where the close variations are the
203
- // point. A term with fewer filings than its share simply returns fewer; the unused room is not
204
- // redistributed, because doing so would need a second pass and a second call per term.
205
- const perTerm = Math.max(PER_TERM_FLOOR, Math.floor(markCap / Math.max(1, terms.length)));
206
-
207
- const seen = new Set();
208
- const records = [];
209
- let capped = false;
210
- const termRows = await runBatched(terms, 1, async (t) => {
211
- const started = Date.now();
212
- const remaining = markCap - records.length;
213
- if (remaining <= 0) {
214
- capped = true;
215
- // NOT AN EMPTY RESULT. The term was never asked, and saying so is the difference between "no
216
- // filings under this form" and "we stopped before we got here".
217
- return { ...t, ok: false, fetched: 0, total: null, notAsked: true,
218
- reason: `the ${markCap}-record cap for this name was reached before this form was fetched` };
219
- }
220
- const want = Math.min(perTerm, remaining);
221
- let r;
222
- try { r = await lister(t.term, { classes: scoped, regions, limit: want, basis: t.basis }); }
223
- catch (e) { r = { ok: false, records: null, reason: `record listing threw: ${String(e?.message ?? e).slice(0, 200)}` }; }
224
- const ok = Boolean(r?.ok) && Array.isArray(r?.records);
225
- let fetched = 0;
226
- if (ok) {
227
- for (const raw of r.records) {
228
- // THE SHARE IS ENFORCED ON INGEST, not only on the request. `limit` is a request to the
229
- // provider and a provider is free to answer with more — a fixture does, and so does any
230
- // source whose paging knob was named differently from the one we sent (euipo pages on `size`
231
- // and would ignore a `limit` entirely). Trusting the request alone let the first term swallow
232
- // the whole cap, which is exactly the outcome the even share exists to prevent: a crowded
233
- // name crowding its own variants off its own listing.
234
- if (fetched >= want) break;
235
- if (records.length >= markCap) { capped = true; break; }
236
- const rec = toRecord(raw, { term: t.term, basis: t.basis, provider });
237
- // Dedupe across terms: one filing can answer the name AND a variation of it, and printing it
238
- // twice would inflate a list a reader counts. The FIRST term to find it keeps it, and terms
239
- // run in report order, so a filing on the name is attributed to the name.
240
- const key = rec.recordId ?? `${rec.mark}|${rec.owner}|${rec.territory}`;
241
- if (seen.has(key)) continue;
242
- seen.add(key);
243
- records.push(rec);
244
- fetched += 1;
245
- }
246
- }
247
- if (ledgerPath) {
248
- try {
249
- appendFileSync(ledgerPath, JSON.stringify({
250
- ts: now().toISOString(), stage: "records", mark: name, term: t.term, basis: t.basis,
251
- classes: scoped, regions, provider, ok, requested: want, fetched,
252
- total: Number.isFinite(r?.total) ? r.total : null, took_ms: Date.now() - started,
253
- ...(ok && r?.approximate === true ? { approximate: true, floor: Number.isFinite(r?.floor) ? r.floor : null } : {}),
254
- ...(ok && Array.isArray(r?.warnings) && r.warnings.length ? { warnings: r.warnings } : {}),
255
- ...(ok ? {} : { cause: String(r?.reason ?? "unknown").slice(0, 300) }),
256
- }) + "\n");
257
- } catch { /* receipts are best-effort, never fatal */ }
258
- }
259
- return {
260
- ...t, ok, fetched,
261
- // How many the register HOLDS under this term, where it said. `fetched` under `total` is the
262
- // truncation, and it is stated rather than left for a reader to notice.
263
- total: Number.isFinite(r?.total) ? r.total : null,
264
- // An approximation is carried as one, exactly as the count lane records it: no number in
265
- // `total`, the register's floor beside it. Only a provider whose listing states it sets it.
266
- ...(ok && r?.approximate === true ? { approximate: true, floor: Number.isFinite(r?.floor) ? r.floor : null } : {}),
267
- // The register's own notes on this answer, as it sent them — absent when it sent none, which is
268
- // not evidence that the answer carried no caveat on a register that sends none at all.
269
- ...(ok && Array.isArray(r?.warnings) && r.warnings.length ? { warnings: r.warnings } : {}),
270
- ...(ok ? {} : { reason: String(r?.reason ?? "the filings could not be fetched").slice(0, 300) }),
271
- };
272
- });
273
-
274
- return {
275
- name,
276
- classes: scoped.length ? scoped : null,
277
- classScope: scoped.length ? (own.length ? "mark" : "batch") : "all-classes",
278
- terms: termRows,
279
- records,
280
- // The three numbers a reader needs to trust the list: how many are here, how many the register
281
- // said there are under the listed terms, and whether the cap cut it.
282
- fetched: records.length,
283
- // NO SUM WHEN ANY ANSWERED TERM IS APPROXIMATE. An approximation carries a floor and no number, so a
284
- // sum around it counts only the exact terms: a name the register answered as more than 10,000 read
285
- // "out of 800 hits" beside its two close forms. With no honest total none is stated (recordsLine
286
- // drops the clause for a non-number), and the counts line still carries the approximation.
287
- available: termRows.some((t) => t.ok && t.approximate === true) ? null
288
- : termRows.reduce((n, t) => (Number.isFinite(t.total) ? n + t.total : n), 0),
289
- capped: capped || records.length >= markCap,
290
- cap: markCap,
291
- // — which registers this listing covers, present only when one was dropped. Per-mark for the
292
- // same reason as the counts lane: recordsLine is handed one row.
293
- ...(officeScope ? { officeScope } : {}),
294
- // — territories ordered for this matter that this register does not cover at all. Carried
295
- // beside officeScope and never merged with it: covered-but-unreachable and never-covered send an
296
- // operator to different places.
297
- ...(deferred.length ? { deferredScope: deferred.map((d) => d.jurisdiction) } : {}),
298
- };
299
- });
300
-
301
- return {
302
- schema: 1,
303
- provider, providerLabel: capabilities?.label ?? provider,
304
- takenAt: now().toISOString(),
305
- basis: RECORD_BASIS,
306
- cap: markCap,
307
- // Stated on the artifact so a reader never has to infer it from an absence: the breadth column is
308
- // not listed, on purpose.
309
- listedPredicates: ["identical", "close"],
310
- excludedPredicates: [{ key: "containing", why: "a breadth proxy over the register's broad name match — its figures run to the hundreds, and listing them would bury the two narrow answers" }],
311
- scope: {
312
- jurisdictions: (jurisdictions ?? []).length ? jurisdictions : null,
313
- regions: regions.length ? regions : null,
314
- deferredJurisdictions: deferred.length ? deferred.map((d) => d.jurisdiction) : null,
315
- // — covered by the provider, unreachable on this box. See the counts sidecar for why this is
316
- // a separate field from the line above and not folded into it.
317
- ...(officeScope ? { unreachableOffices: officeScope.unlisted } : {}),
318
- classes: batchClasses.length ? batchClasses : null,
319
- },
320
- marks: rows,
321
- };
322
- }
107
+ const goodsOnRow = (row) => {
108
+ const statements = rowGoods(row) ?? recordGoods(row, { english: untaggedIsEnglish(row?.record_id) });
109
+ return statements.length ? statements : null;
110
+ };
323
111
 
324
112
  /** How many marks got at least one filing. Zero means the listing produced nothing anyone can read. */
325
113
  export function listedMarks(doc) {
@@ -399,6 +187,19 @@ export function normalizeRegisterRecordLinks(doc) {
399
187
  * It states the truncation and the failures, because both are the difference between "these are the
400
188
  * filings" and "these are some of the filings".
401
189
  */
190
+ export const NONE_CARRIED_FORWARD = "Filings: none were carried forward for assessment.";
191
+ /**
192
+ * The reading finished and kept no filing, and this is not a clean answer: a question stayed open, a list was set aside, or
193
+ * one was not asked. It says so without claiming the register holds none. A reading that did not finish is a failed listing,
194
+ * and an archived listing has no reading at all. PURE.
195
+ */
196
+ export function noneCarriedForward(entry) {
197
+ if (!entry || entry.records?.length || !entry.reading || entry.reading.notFinished) return false;
198
+ const terms = entry.terms ?? [];
199
+ if (terms.some((t) => !t.ok && !t.notAsked)) return false;
200
+ return !(terms.some((t) => t.ok && !t.setAside) && !terms.some((t) => t.notAsked) && !terms.some((t) => t.setAside));
201
+ }
202
+
402
203
  export function recordsLine(entry) {
403
204
  if (!entry) return null;
404
205
  const failed = (entry.terms ?? []).filter((t) => !t.ok && !t.notAsked);
@@ -446,21 +247,24 @@ export function recordsLine(entry) {
446
247
  // the byte: a listing whose searches failed already said so, and this is not the item that touches it.
447
248
  // A run with both failures and stopped forms therefore still reports only its failures — pre-existing,
448
249
  // and left alone rather than widened on the way past.
449
- const answered = (entry.terms ?? []).filter((t) => t.ok);
250
+ // A LIST COUNTED AND NOT READ IS NOT NONE EITHER: the register holds filings under it and this run set them aside.
251
+ const answered = (entry.terms ?? []).filter((t) => t.ok && !t.setAside);
252
+ const setAside = (entry.terms ?? []).filter((t) => t.setAside);
450
253
  if (failed.length) {
451
254
  return `Filings: not available — ${failed.length} of ${(entry.terms ?? []).length} search(es) could not be run.`
452
255
  + officeNote + coverageNote;
453
256
  }
454
- return (answered.length && !skipped.length
257
+ return (answered.length && !skipped.length && !setAside.length
455
258
  ? `Filings: the register returned none under the name or any close variation of it, in the classes counted${unlisted.length ? ` and in the register${(entry.officeScope?.listed ?? []).length === 1 ? "" : "s"} searched (${(entry.officeScope?.listed ?? []).join(", ")})` : ""}.`
259
+ : noneCarriedForward(entry) ? NONE_CARRIED_FORWARD
456
260
  : "Filings: the listing did not complete, so nothing here says whether one stands.")
457
261
  + officeNote + coverageNote;
458
262
  }
459
263
  const parts = [`${entry.records.length} filing${entry.records.length === 1 ? "" : "s"} listed`];
460
- // "of N" is the SUM ACROSS THE SEARCHES, not a count of distinct filings — a filing that answers both
461
- // the name and a variation of it is listed once here and counted twice there. Worded so a reader does
462
- // not read it as a distinct-record total, which would make the listed fraction look smaller than it is.
463
- if (Number.isFinite(entry.available) && entry.available > entry.records.length)
264
+ // "of N" IS THE SAME POPULATION AS THE LIST: the distinct filings this name's questions returned. A filing weighed for this name and
265
+ // found under another is listed and is no part of that N, so a list holding one states no fraction.
266
+ const found = entry.records.filter((r) => !r?.foundUnder).length;
267
+ if (found === entry.records.length && Number.isFinite(entry.available) && entry.available > found)
464
268
  parts.push(`out of ${entry.available} hits across the searches run`);
465
269
  if (entry.capped) parts.push(`capped at ${entry.cap} per name`);
466
270
  if (failed.length) parts.push(`${failed.length} search(es) could not be run`);
@@ -495,12 +299,26 @@ export function resolveRecordExecutor({ lister = null, adapter = null, agentId =
495
299
  };
496
300
  }
497
301
 
498
- /** The $0 dev/e2e executor: a directory of <term-lower>.json files, each `{ records: [...], total: n }`. */
499
- function fixtureLister(dir) {
500
- return async (term) => {
501
- const { readFileSync } = await import("node:fs");
502
- const { join } = await import("node:path");
503
- const file = join(dir, `${String(term).toLowerCase().replace(/[^a-z0-9]+/g, "-")}.json`);
302
+ const fixtureSlug = (s) => String(s ?? "").toLowerCase().replace(/[^a-z0-9]+/g, "-");
303
+
304
+ /**
305
+ * Which file answers a question. The term alone is the exact question over the run's whole scope. A question with a
306
+ * filter is a different question and has a different answer, so each filter is in the name: a goods-narrowed question
307
+ * never reads the crowd's file, and one with no file is a question the fixture does not answer. PURE.
308
+ */
309
+ export function fixtureFileName(term, { matchMode = "exact", goods = null, regions = null, classes = null, scoped = false } = {}) {
310
+ const parts = [fixtureSlug(term)];
311
+ if (matchMode && matchMode !== "exact") parts.push(fixtureSlug(matchMode));
312
+ if (Array.isArray(goods) && goods.length) parts.push(`goods-${fixtureSlug(goods.join(" "))}`);
313
+ if (scoped && Array.isArray(regions) && regions.length) parts.push(`in-${fixtureSlug(regions.join(" "))}`);
314
+ if (scoped && Array.isArray(classes) && classes.length) parts.push(`class-${fixtureSlug(classes.join(" "))}`);
315
+ return `${parts.join(".")}.json`;
316
+ }
317
+
318
+ /** The $0 dev/e2e executor: a directory of answer files (fixtureFileName), each `{ records: [...], total: n }`. */
319
+ export function fixtureLister(dir) {
320
+ return async (term, question = {}) => {
321
+ const file = join(dir, fixtureFileName(term, question));
504
322
  let doc;
505
323
  try { doc = JSON.parse(readFileSync(file, "utf8")); }
506
324
  catch (e) { return { ok: false, records: null, reason: `record fixture missing for ${term}: ${e.message}` }; }
@@ -11,7 +11,7 @@
11
11
  // attempt?
12
12
  //
13
13
  // THE RULE (bandPassTaint): rows are scanned in order. A SUPERSEDING success is a fresh full pass
14
- // (not a followup — an escalation/envelope followup RESUMES the prior session and PATCHES its output,
14
+ // (not a followup — an escalation/envelope followup PATCHES the prior pass's output in a fresh session,
15
15
  // so it can never launder a tainted base). tainted ⟺ a kill-class row sits BOTH after the FIRST
16
16
  // superseding success (a kill that mutated a band that had already passed validation — the incident
17
17
  // class) AND after the PREVIOUS superseding success (the region feeding the current band; an older
@@ -36,7 +36,7 @@
36
36
  //
37
37
  // Legacy rows (pre-taint-chain runs, incl. copper-lattice) lack `followup`/`killed`/`signals`; the
38
38
  // fail/code discriminators still classify them, and followup detection falls back to key-reuse (a
39
- // followup resumes a key that already succeeded — a fresh pass never does).
39
+ // followup re-uses a key that already succeeded — a fresh pass never does).
40
40
  //
41
41
  // PURE over pre-read lines (repo doctrine: tests offline); readRegisterTaint is the one IO wrapper.
42
42
  // Missing/unreadable jsonl ⇒ untainted — legacy runs and replay stay no-op safe.
@@ -156,7 +156,7 @@ const correctiveRules = ({ narrative, findings, placement, rulingsTail, adds = f
156
156
  // broadening happens.
157
157
  //
158
158
  // AND THE RESOLUTION WITH THE LINE ABOVE IS STATED, BECAUSE THE TWO LOOK LIKE THEY FIGHT.
159
- // "Never softened" forbids adding hedges; "may never broaden" requires claiming less. A model
159
+ // "Never softened" forbids adding hedges; "narrow it" requires claiming less. A model
160
160
  // handed both without the distinction will pick one. Narrowing is not hedging: stating a
161
161
  // smaller claim, or removing the claim, is a correction; keeping the same claim and wrapping it
162
162
  // in "may" or "appears to" is the hedge. Said in the text, not just here.
@@ -169,8 +169,15 @@ const correctiveRules = ({ narrative, findings, placement, rulingsTail, adds = f
169
169
  // corrective pair, by `evidenceClaimViolations` (pipeline.mjs ~10973) — but it reads
170
170
  // `findings.json` meters, and a narrative sentence with no findings-side counterpart is invisible
171
171
  // to it. That prose gap is conversion-era work, not an instruction. This is the instruction.
172
- `A REPAIR MAY NARROW A CLAIM AND MAY NEVER BROADEN ONE. If a flagged statement is wrong because it claims too much, the correction states LESS: strike the claim, or replace it with the smaller claim the evidence actually carries. Never restate the same claim in different words, and never replace a specific sentence with a general one. NARROWING IS NOT HEDGING and the rule above still holds — claiming less is a correction; keeping the claim and wrapping it in "may", "appears to" or "broadly" is the hedge that is forbidden.`,
173
- `THE COVERAGE ACCOUNT IS NOT YOURS TO REOPEN HERE. Do not introduce any statement about what was searched, counted, screened, finished, or came back empty that is not already in ${narrative}. That account was settled when you wrote it against the evidence in front of you; this pass has the reviewer's flags and not that evidence, so it is not in a position to widen it. Deleting a false coverage sentence is a correction. Replacing it with a different coverage sentence is not — strike it and say nothing in its place.`,
172
+ `REPAIR THE FLAGGED CLAIM TO WHAT ITS HELD EVIDENCE SUPPORTS. If the error is an overclaim, narrow it: remove the unsupported part or replace it with the smaller supported claim. Do not replace a specific result with a general conclusion. Narrowing is not hedging: reduce the claim itself rather than keeping it behind “may”, “appears to” or “broadly”.`,
173
+ // A CORRECTION KEEPS THE TRUE PART OF THE PASSAGE IT CORRECTS. The rule that stood here ordered a false
174
+ // coverage sentence struck with nothing in its place, beside the rule above that allows the smaller supported
175
+ // claim, and the two disagreed. In one test run's correction, two true zero results that shared a passage with
176
+ // a wrong statement went with it, and no coverage line the reader sees kept them (read on saved data,
177
+ // 2026-11-05). A fact this pass restates or corrects comes from a record it can name and open at this step,
178
+ // inside that record's limits; a reviewer's suggested wording is a proposal, not that record. Design's wording
179
+ // (2026-11-05).
180
+ `CORRECT ONLY THE FLAGGED COVERAGE ACCOUNT. Preserve true, relevant coverage facts already in ${narrative}. Where a flagged passage mixes a true fact with an error, correct only the error; you may restate the supported part or correct its factual details from an identified record held at this step. Read that record before relying on it, and keep its question, territory, class, mode and outcome limits. A zero for one question is not a general absence of rights, and a failed, skipped or unread question is not a zero. If the supporting record is unavailable or does not settle the claim, remove the unsupported part and keep the uncertainty explicit. Reconcile the corresponding coverage fields. Do not reopen unrelated coverage, add a new search or claim more than the held record establishes.`,
174
181
  `IF YOU REMOVE THE SUPPORT FOR A CLAIM, THE CLAIM GOES WITH IT. Deleting the evidence and leaving the sentence standing does not make it safer, it makes it unsupported and therefore stronger than the record allows. A run was refused for exactly this.`,
175
182
  `1. Correct the flagged narrative sections — send back ONLY the sections a flag names, and every section the flags do not name is left out and comes back byte-identical;`,
176
183
  `2. mirror every correction into the finding objects the flags name (owner names, levels/composites, meters). A finding the review KILLS is not deleted: keep its object, set "disposition": "withdrawn" and add "withdrawn_reason": "<the review flag that killed it>". Add a "corrections": {"applied": true, "note": "<one line per flagged entity: corrected / withdrawn / no-change-because-…>"} marker inside the call's \`findings\` object.`,
@@ -178,10 +185,10 @@ const correctiveRules = ({ narrative, findings, placement, rulingsTail, adds = f
178
185
  // ordinal, so step 2 cannot reach them, and nothing said where a rewrite of one goes: seven such
179
186
  // flags survived one clearance on the test box, each recorded as naming nothing (2026-09-11). The
180
187
  // channel already existed — a PATCH copies a top-level register of the findings document through
181
- // — and this names it. The coverage-account rule above forbids NEW claims about what was searched;
182
- // rewording a note keeps its claims, and the text says so, or the seat reads the two as a conflict
183
- // and does nothing, which is what it did.
184
- `3. A flag about a line the reader sees that is NOT a finding — a coverage row's "note", an action's "text", or the mark assessment's "distinctiveness" or "connotation" — is applied in the same PATCH, inside the call's \`findings\` object beside the "corrections" marker: send the complete \`coverage\` array (every row, the unflagged ones exactly as you last sent them), the complete \`actions\` array, or the complete \`mark_assessment\` object, with the flagged line rewritten. A row left out of the array is a row deleted, so send every row. Rewording a coverage note is NOT reopening the coverage account: keep its area, its state and every fact it states, and change only how it says them. A flagged line you leave as written is named in the "corrections" note with the reason, as the flag names it — for example: the coverage line for "<area>": no-change-because …`,
188
+ // — and this names it. The coverage-account rule above forbids claims the held record does not establish;
189
+ // a wording change keeps a note's facts and a factual error in one is corrected under that rule. The text
190
+ // says both, or the seat reads the two as a conflict and does nothing, which is what it did.
191
+ `3. A flag about a line the reader sees that is NOT a finding — a coverage row's "note", an action's "text", or the mark assessment's "distinctiveness" or "connotation" — is applied in the same PATCH, inside the call's \`findings\` object beside the "corrections" marker: send the complete \`coverage\` array (every row, the unflagged ones exactly as you last sent them), the complete \`actions\` array, or the complete \`mark_assessment\` object, with the flagged line rewritten. A row left out of the array is a row deleted, so send every row. A wording-only change to a coverage note preserves its area, state and supported facts. If the flag identifies a factual error, correct that error and any corresponding coverage fields under the flagged-coverage rule above; preserve the supported facts and the limits of the identified held record. Leave unrelated coverage unchanged. A flagged line you leave as written is named in the "corrections" note with the reason, as the flag names it — for example: the coverage line for "<area>": no-change-because …`,
185
192
  // THE ANSWERS THAT NAME THE FINDINGS. The four answers cite the findings they rest on by ordinal, and step 3 names
186
193
  // the other registers a correction may send but not this one, so a correction that raised a finding to High left
187
194
  // the third-party-rights answer naming findings 1 to 3 (test run, 2026-11-03). The transport always took it. Design's
@@ -423,7 +430,7 @@ export const REPAIR_COMPOSERS = [
423
430
  // re-derive which parts of two long documents changed. The driver already knows: it holds the
424
431
  // pre-corrective snapshot and compared every finding outside the declared scope.
425
432
  correctionsScope?.scoped
426
- ? `The synthesis author applied your flagged corrections. YOU DECLARED WHICH FINDINGS YOUR FLAGS WERE ABOUT, so read narrowly: in ${findings}, verify ${correctionsScope.named.length ? correctionsScope.named.map((o) => `#${o}`).join(", ") : NO_FINDING_NAMED} and the narrative passages in ${narrative} that discuss them.${correctionsScope.positions?.length ? " For each excluded position your flags named, check the resulting finding or renewed exclusion against the evidence and the specific objection you raised. A newly recorded ground alone does not settle the flag. Retain the flag if its factual error, reasoning error, or relevant uncertainty remains." : ""} THE DRIVER COMPARED EVERY OTHER FINDING OBJECT against the pre-correction file${correctionsScope.moved.length ? ` and ${correctionsScope.moved.length} moved anyway — ${correctionsScope.moved.map((o) => `#${o}`).join(", ")}; read those too and say whether the change is defended` : " and none moved, so you do not need to re-read them"}. Then re-write ${seniorEyeReview}: the verdict (CLEAR / CONDITIONAL / BLOCKING) on the FIRST line, then any corrections that still stand.`
433
+ ? `The synthesis author applied your flagged corrections. Read narrowly. Named findings in ${findings}: ${correctionsScope.named.length ? correctionsScope.named.map((o) => `#${o}`).join(", ") : NO_FINDING_NAMED}. Review those findings, the excluded positions your flags name, and the document passages your flags identify in ${narrative}, together with conclusions that depend on the corrections. Judge whether each correction answers its flag; the recorded outcome alone is not proof.${correctionsScope.positions?.length ? " For each excluded position your flags named, check the resulting finding or renewed exclusion against the evidence and the specific objection you raised. A newly recorded ground alone does not settle the flag. Retain the flag if its factual error, reasoning error, or relevant uncertainty remains." : ""} THE DRIVER COMPARED EVERY OTHER FINDING OBJECT against the pre-correction file${correctionsScope.moved.length ? ` and ${correctionsScope.moved.length} moved anyway — ${correctionsScope.moved.map((o) => `#${o}`).join(", ")}; read those too and say whether the change is defended` : " and none moved, so you do not need to re-read them"}. Then re-write ${seniorEyeReview}: the verdict (CLEAR / CONDITIONAL / BLOCKING) on the FIRST line, then any corrections that still stand.`
427
434
  : `The synthesis author applied your flagged corrections and re-emitted the narrative ${narrative} AND the machine findings ${findings}. Re-read BOTH updated files — verify the structured findings (owners, tiers, dispositions; a killed finding must be "withdrawn") carry your corrections — re-verify your prior concerns, then re-write ${seniorEyeReview}: the verdict (CLEAR / CONDITIONAL / BLOCKING) on the FIRST line, then any corrections that still stand.`,
428
435
  // THOSE TWO FILES ARE THE ONLY EVIDENCE THAT EXISTS YET. report.md is BUILT FROM the narrative at
429
436
  // report-overview / report-card, both of which run AFTER this gate, so they hold the PREVIOUS
@@ -59,9 +59,13 @@ export const RESULT_NOUN_FIELDS = Object.freeze([
59
59
  why: "the repair verdict the same row tests with `ok: outcome === \"repaired\"`; judged, not dispatched" },
60
60
  { file: "driver/gateway.mjs", noun: "settled", sites: 2, atWriteSite: 2, verdict: "result",
61
61
  why: "counts read off the coverage/placement unions" },
62
- { file: "driver/pipeline-knockout.mjs", noun: "recovered", sites: 1, atWriteSite: 1, verdict: "result",
62
+ { file: "driver/pipeline-knockout.mjs", noun: "recovered", sites: 2, atWriteSite: 1, verdict: "result",
63
63
  why: "written after the chunk files were actually removed" },
64
- { file: "driver/pipeline-knockout.mjs", noun: "outcome", sites: 3, atWriteSite: 3, verdict: "result",
64
+ { file: "driver/knockout-correction-record.mjs", noun: "outcome", sites: 5, atWriteSite: 0, verdict: "out-of-scope",
65
+ why: "the model's answer to a defect, `changed` or `stands`, and the driver's own reading of a defect beside it, both read back and never returned by a call being logged" },
66
+ { file: "driver/engine/mcp/recording-server.mjs", noun: "outcome", sites: 1, atWriteSite: 0, verdict: "out-of-scope",
67
+ why: "a tool schema's description of the field a defect's answer carries" },
68
+ { file: "driver/pipeline-knockout.mjs", noun: "outcome", sites: 4, atWriteSite: 4, verdict: "result",
65
69
  why: "the reviewing pass's own verdict on itself, read at each writing site: `nothing-flagged` when "
66
70
  + "the record had no line a reader meets first, `applied` after the rewrite passed the merged gate and was "
67
71
  + "written, and the `keep()` forms after the artifact or the gate refused it. Every one is a fact "