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
@@ -9,7 +9,7 @@ import { atomicWrite, paths } from "../run-record.mjs";
9
9
  import { ensureDriverDir } from "../../shared/driver-dir.mjs";
10
10
  import { applyAskClosure, deriveAsks, finalizeOpenHandoffs, summarizeAsks } from "../ask-ledger.mjs";
11
11
  import { mintCommonLawCarryDoubts } from "../commonlaw-carry.mjs";
12
- import { consolidateFindingsFile, deriveCommonLawCarry, injectDeferralCoverage, injectLaneDepthCoverage, injectMeaningGapCoverage, injectScreenGateCoverage, injectScriptScopeCoverage, injectUncoveredMarketCoverage, localLanguageStateOf, planWriteUps, stampCoverageJudgmentRows, writeShortEntries } from "../coverage-rows-run.mjs";
12
+ import { consolidateFindingsFile, deriveCommonLawCarry, injectDeferralCoverage, injectLaneDepthCoverage, injectMeaningGapCoverage, injectScreenGateCoverage, injectSearchesOpenCoverage, injectScriptScopeCoverage, injectUncoveredMarketCoverage, localLanguageStateOf, planWriteUps, stampCoverageJudgmentRows, writeShortEntries } from "../coverage-rows-run.mjs";
13
13
  import { readDeclinations } from "../declination-tool.mjs";
14
14
  import { keepDeliveredRecordAsHistory, readFindingsForReport, readReadingLog, rebuildDeliveredRecord, rewriteFromBeforeTheSeam, withdrawSupersededAudit } from "../delivered-record-run.mjs";
15
15
  import { caseLawJoin, settleDerivedBases } from "../dispatch-extras.mjs";
@@ -68,7 +68,7 @@ export async function runOverviewAndCards({ P, applyCoverageFloor, clampOnTheWri
68
68
  // A pass follows each rewrite of findings.json and adds the rows below again, so delivery reads only the adders
69
69
  // that failed since the last of these.
70
70
  runLog(run.runDir, { event: "coverage-rows-pass" });
71
- injectDeferralCoverage(P, run.runDir, note); injectMeaningGapCoverage(P, run.runDir, note); // A3: unclosed reopen directives, and meaning searches that did not complete, become reader-visible coverage rows first
71
+ injectDeferralCoverage(P, run.runDir, note); injectMeaningGapCoverage(P, run.runDir, note); injectSearchesOpenCoverage(P, run.runDir, note); // A3: unclosed reopen directives, and meaning searches that did not complete, become reader-visible coverage rows first
72
72
  // qw/cn-scope-honesty — the sibling injection: a CN-family-scope run whose zh lane did not run
73
73
  // discloses what the native-language investigation would have searched, and where it is offered
74
74
  // (coverage-limited: never clamps, never gates).
@@ -13,13 +13,14 @@ import { connotationObligations, parseDispositionForm, parsePrRiskResults, rende
13
13
  import { NON_MATERIAL_AXES } from "../coverage-ledger.mjs";
14
14
  import { undecidedCrossChecks, waitingCrossCheck, withoutWait } from "../cross-check-wait.mjs";
15
15
  import { plainDeferralReason } from "../deferral-row.mjs";
16
+ import { productFaultOf, productFaultReason } from "../product-fault.mjs";
16
17
  import { formSidecarPath, outstandingRows, unionDispositionForm } from "../disposition-union.mjs";
17
18
  import { config, envGateOn } from "../driver.config.mjs";
18
19
  import { registerAdapter } from "../engine/run-choices.mjs"; // the run's register adapter, from ctx.register
19
20
  import { readStickyGaps, receiptSettled, settleReceipt } from "../envelope-settle.mjs";
20
21
  import { note, runLog } from "../log.mjs";
21
22
  import { findCollapsedBands, quarantineUnknownStates, taintQuarantineCleanBlocks } from "../named-band.mjs";
22
- import { readPartNotCompleted } from "../parts-not-completed.mjs";
23
+ import { readPartNotCompleted, slicesNotYetRecorded, unitsNotYetRecorded, writePartNotCompleted } from "../parts-not-completed.mjs";
23
24
  import { gridBatchFor } from "../profiles.mjs";
24
25
  import { countLaneCalls } from "../provider-usage.mjs";
25
26
  import { atomicWrite, driverDir, readJson } from "../run-record.mjs";
@@ -268,6 +269,24 @@ export async function runRegisterSweep({ P, agent, axes, ctx, job, opts, run, ru
268
269
  runLog(run.runDir, { event: "connotation-reissue-failed", error: String(err?.message ?? err).slice(0, 160) });
269
270
  }
270
271
  }
272
+ // A REGISTER UNIT WHOSE PLAN CALL NEVER CAME BACK is a product fault (product-fault.mjs): it is not sent again, by a retry,
273
+ // a recovery pass or a resume. It is recorded at once in the searches' record and taken as its band stands, so the run
274
+ // goes on, and its slices are delivered open. Only that unit: a sibling that failed on its own work keeps its own
275
+ // failure and its normal recovery below.
276
+ const killedCall = (i) => Boolean(productFaultOf({ fail: gatherResults[i]?.fail, runDir: run.runDir, label: `register-unit:${gather[i].axis}` }));
277
+ const faulted = gather.map((g, i) => i).filter((i) => gather[i].name === "register-unit" && gather[i].axis
278
+ && !gatherResults[i]?.ok && !gatherResults[i]?.resetsAt && killedCall(i));
279
+ if (faulted.length) {
280
+ const held = readPartNotCompleted(run.runDir, "searches");
281
+ const axes = faulted.map((i) => gather[i].axis);
282
+ const slices = faulted.flatMap((i) => slicesUnitNeverReached(P, ctx.registerPlan, gather[i].axis, productFaultReason()));
283
+ writePartNotCompleted(run.runDir, "searches", { stage: `register-unit:${axes[0]}`, reason: gatherResults[faulted[0]]?.fail ?? "product fault",
284
+ slices: [...(Array.isArray(held?.slices) ? held.slices : []), ...slicesNotYetRecorded(held, slices)],
285
+ disclosedAxes: Array.isArray(held?.disclosed_axes) ? held.disclosed_axes : [],
286
+ unfinishedUnits: [...(Array.isArray(held?.unfinished_units) ? held.unfinished_units : []), ...unitsNotYetRecorded(held, axes)] });
287
+ runLog(run.runDir, { event: "unit-product-fault", units: axes, slices: slices.length });
288
+ for (const i of faulted) gatherResults[i] = unfinishedUnitAsItStands({ ...ctx, axis: gather[i].axis });
289
+ }
271
290
  // A REGISTER UNIT THAT WROTE NO RESULT is the searches not completed, after every other member has been held to its
272
291
  // own failure as before (unfinishedUnitAsItStands, above). A rate limit keeps its own path.
273
292
  const unfinished = gather.map((g, i) => i).filter((i) => gather[i].name === "register-unit" && gather[i].axis
@@ -8,7 +8,7 @@
8
8
  import { caseLawSourceRows } from "../case-law-sources.mjs";
9
9
  import { caseLawInventory } from "../config-inventory.mjs";
10
10
  import { composeDispatchExtra, decideCaseLaw, prepareDeclinationSpec, readCoverageJudgment, refute, settleDerivedBases } from "../dispatch-extras.mjs";
11
- import { parseFindingsJsonLenient } from "../findings-model.mjs";
11
+ import { parseFindingsJsonLenient, FINDINGS_SCHEMA_VERSION } from "../findings-model.mjs";
12
12
  import { note, runLog } from "../log.mjs";
13
13
  import { readPartNotCompleted } from "../parts-not-completed.mjs";
14
14
  import { recordSynthesisSeam } from "../record-carry-trace.mjs";
@@ -18,6 +18,22 @@ import { repairFollowup } from "../repair-composers.mjs";
18
18
  import { asPartNotCompleted, goodsEvidenceForTheWriter, keepGoodsEvidenceAsWritten, quarantineSynth, stage, stageCharter } from "../stage-dispatch.mjs";
19
19
  import { readFileSync, renameSync, writeFileSync } from "node:fs";
20
20
 
21
+ /**
22
+ * WHAT THE RECORD SAYS WHEN THE VERSION RE-ASK'S REPLY IS STILL SHORT: the version the findings file declares after the
23
+ * re-ask, against the one it asked for. A reply below it is recorded at any version: one at 4 to 6 still reads, under
24
+ * its own version's rules, and is not the record the re-ask demanded. null where the file meets it or could not be read.
25
+ * No further attempt follows from it. PURE.
26
+ */
27
+ /**
28
+ * WHAT A FINDINGS FILE BELOW THE CURRENT VERSION GETS AFTER SYNTHESIS: on a synthesis that ran this turn, the bounded
29
+ * re-ask for the whole record ("reask"); on a resumed one, its accepted record kept as it is, at its own version
30
+ * ("keep"). null where the file is at the current version or could not be read. PURE.
31
+ */
32
+ export const versionRecovery = (declared, skipped) => (declared === null || declared === undefined || declared >= FINDINGS_SCHEMA_VERSION
33
+ ? null : skipped ? "keep" : "reask");
34
+ export const versionStillShort = (declared) => (declared !== null && declared !== undefined && declared < FINDINGS_SCHEMA_VERSION
35
+ ? { event: "findings-schema-downlevel", declared, required: FINDINGS_SCHEMA_VERSION } : null);
36
+
21
37
  export async function runSynthesis({ P, checkLateBind, ctx, job, opts, run }) {
22
38
  // Steps 3/3.5/4 synthesis → optional 4.5 case-law grounding ∥ Step 4.7 refutation.
23
39
  // case-law and refutation are independent siblings of synthesis (case-law reads narrative.md;
@@ -95,17 +111,17 @@ export async function runSynthesis({ P, checkLateBind, ctx, job, opts, run }) {
95
111
  try { return parseFindingsJsonLenient(readFileSync(P.findings, "utf8")).schemaVersion ?? 1; } catch { return null; }
96
112
  };
97
113
  const declaredSv = readSchemaVersion();
98
- // doc 50 — the dictation demands schema_version 4 (band-rated under the framework in force).
99
- // The demand fires ONLY when synthesis actually RAN this turn: a skip-resumed stage (a parked run
100
- // whose prior v3 findings.json still validates on the legacy path) keeps its declared version —
101
- // forcing a mid-run contract switch across the deploy boundary would burn a followup fighting
102
- // the run's own frozen artifact. Logged loudly instead; that run's gates judge it as v3.
103
- if (declaredSv !== null && declaredSv < 4 && synth.skipped) {
104
- note(`[findings] schema_version ${declaredSv} retained on a resumed run (pre-doc-50 artifact) — v${declaredSv} gates apply; no re-emit demanded`);
114
+ // The dictation demands the current schema_version (`versionRecovery`). The demand fires ONLY when synthesis
115
+ // actually RAN this turn: a skip-resumed stage keeps the version its accepted record declares — forcing a mid-run
116
+ // contract switch across the deploy boundary would burn a followup fighting the run's own frozen artifact. Logged
117
+ // loudly instead; that run's gates judge it at its own version.
118
+ const recovery = versionRecovery(declaredSv, synth.skipped);
119
+ if (recovery === "keep") {
120
+ note(`[findings] schema_version ${declaredSv} retained on a resumed run — v${declaredSv} gates apply; no re-emit demanded`);
105
121
  runLog(run.runDir, { event: "findings-schema-legacy", declared: declaredSv });
106
122
  }
107
- if (declaredSv !== null && declaredSv < 4 && !synth.skipped) {
108
- note(`[findings] schema_version ${declaredSv} < 4 — the dictated band rating is missing; demanding the re-emit`);
123
+ if (recovery === "reask") {
124
+ note(`[findings] schema_version ${declaredSv} < ${FINDINGS_SCHEMA_VERSION} — not the dictated record; demanding the re-emit`);
109
125
  // This one keeps the FULL re-emission on purpose, against the targeted-edit rule the other corrective
110
126
  // followups now follow. A down-level file is not a valid document with one defect in it — it is the
111
127
  // WRONG CONTRACT throughout: every rated object's vocabulary changes, the retired composite/level/
@@ -122,7 +138,8 @@ export async function runSynthesis({ P, checkLateBind, ctx, job, opts, run }) {
122
138
  }) + stageCharter("synthesis", ctx.depth, ctx.framework),
123
139
  });
124
140
  const afterSv = readSchemaVersion();
125
- if (afterSv !== null && afterSv < 3) runLog(run.runDir, { event: "findings-schema-downlevel", declared: afterSv });
141
+ const short = versionStillShort(afterSv);
142
+ if (short) runLog(run.runDir, short);
126
143
  }
127
144
 
128
145
  // spec 64 — the typed forward-action register. The disposition derivation (legalActions arm of the