clearotron 0.5.1 → 0.6.0-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.
- package/.env.example +7 -7
- package/INSTALL.md +10 -10
- package/QUICKSTART.md +6 -6
- package/README.md +2 -2
- package/THIRD-PARTY-NOTICES.md +4 -4
- package/bin/README.md +2 -2
- package/bin/clearotron.mjs +1 -1
- package/bin/connect.mjs +1 -1
- package/bin/disconnect.mjs +1 -1
- package/bin/example.mjs +2 -2
- package/bin/grant.mjs +1 -1
- package/bin/onboard.mjs +78 -23
- package/bin/start.mjs +49 -18
- package/bin/update.mjs +13 -3
- package/build-info.json +2 -2
- package/docs/DELIVERY.md +1 -1
- package/docs/PORTAL.md +1 -1
- package/docs/RELEASES.md +1 -1
- package/docs/architecture/02-architecture.md +10 -2
- package/docs/architecture/03-run-lifecycle.md +6 -2
- package/docs/architecture/04-configuration-reference.md +3 -3
- package/docs/architecture/05-config-governance.md +5 -4
- package/docs/architecture/08-development-guide.md +4 -4
- package/docs/architecture/09-security-and-data.md +1 -1
- package/{driver/skills/clearance-search/SKILL.md → docs/architecture/retired-manuals/clearance-search-spine.md} +17 -30
- package/{driver/skills/clearance-search/templates/email/generic.md → docs/architecture/retired-manuals/email-generic.md} +1 -1
- package/{driver/skills/clearance-search → docs/architecture/retired-manuals}/template-formatting.md +3 -4
- package/docs/configuration.md +1 -1
- package/docs/decisions/0002-no-dark-functionality.md +5 -0
- package/driver/CHANGELOG.md +60 -0
- package/driver/README.md +11 -1
- package/driver/accepted-order.mjs +13 -5
- package/driver/attempt-rows.mjs +64 -0
- package/driver/attributed-span.mjs +1 -1
- package/driver/authority-trees.mjs +1 -1
- package/driver/best-draft.mjs +3 -3
- package/driver/blind-frame-record.mjs +2 -2
- package/driver/cancel.mjs +3 -2
- package/driver/carry-through.mjs +2 -2
- package/driver/citation-census.json +3 -3
- package/driver/clearance-variants-record.mjs +4 -10
- package/driver/common-law-coverage-status.mjs +3 -3
- package/driver/common-law-receipts.mjs +2 -2
- package/driver/compare.mjs +1 -1
- package/driver/config-inventory.mjs +6 -79
- package/driver/consumption-ledger.mjs +2 -1
- package/driver/contract-dictation-registry.mjs +5 -0
- package/driver/contract-e3-backlog.mjs +45 -66
- package/driver/contract-e3-baseline.json +16 -16
- package/driver/contract-vocabulary.mjs +8 -6
- package/driver/corrections-feedforward.mjs +3 -1
- package/driver/coverage-form-io.mjs +7 -8
- package/driver/coverage-tool.mjs +1 -1
- package/driver/declination-tool.mjs +2 -2
- package/driver/degraded-parts.mjs +9 -9
- package/driver/demo-container.mjs +5 -4
- package/driver/deploy-live-run-guard.mjs +19 -7
- package/driver/derived-state.mjs +2 -2
- package/driver/dev-portal.mjs +2 -1
- package/driver/dispatch-record.mjs +1 -1
- package/driver/disposition-tool.mjs +2 -1
- package/driver/doubt-closure-tool.mjs +2 -2
- package/driver/driver.config.mjs +35 -724
- package/driver/e2e-rounds.mjs +3 -4
- package/driver/engine/CONTRACT.md +3 -0
- package/driver/engine/README.md +2 -0
- package/driver/engine/anthropic-agent.mjs +8 -37
- package/driver/engine/auth.mjs +74 -0
- package/driver/engine/child-record.mjs +1 -1
- package/driver/engine/deny-authority-write.mjs +2 -2
- package/driver/engine/jx-turn.mjs +10 -2
- package/driver/engine/mcp/README.md +1 -1
- package/driver/engine/mcp/band-server.mjs +6 -6
- package/driver/engine/mcp/codex-config.mjs +1 -1
- package/driver/engine/mcp/declination-server.mjs +2 -3
- package/driver/engine/mcp/dispositions-server.mjs +3 -3
- package/driver/engine/mcp/gather-config.mjs +24 -19
- package/driver/engine/mcp/grid-provenance.mjs +1 -1
- package/driver/engine/mcp/held-answers.mjs +5 -5
- package/driver/engine/mcp/perplexity-server.mjs +16 -7
- package/driver/engine/mcp/recording-server.mjs +7 -6
- package/driver/engine/mcp/register-server.mjs +29 -0
- package/driver/engine/mcp/stdio-server.mjs +5 -5
- package/driver/engine/mcp/supplemental.mjs +9 -9
- package/driver/engine/openai-agent.mjs +5 -2
- package/driver/engine/registry.mjs +103 -0
- package/driver/engine/run-choices.mjs +162 -0
- package/driver/engine/stamps.mjs +35 -0
- package/driver/enqueue-schema.mjs +4 -4
- package/driver/envelope-settle.mjs +3 -2
- package/driver/feedback-issues.mjs +1 -1
- package/driver/feedback-mint.mjs +3 -2
- package/driver/feedback-store.mjs +3 -2
- package/driver/findings-model.mjs +1 -1
- package/driver/flag-snapshot.mjs +5 -4
- package/driver/floor-duty.mjs +3 -3
- package/driver/foreign-record-links.mjs +1 -1
- package/driver/frame-diff-record.mjs +2 -8
- package/driver/framework.mjs +1 -1
- package/driver/gate-metrics.mjs +10 -11
- package/driver/gateway.mjs +220 -839
- package/driver/goods-evidence.mjs +10 -6
- package/driver/jx-lanes.mjs +3 -3
- package/driver/jx-units.mjs +31 -37
- package/driver/jx.mjs +44 -59
- package/driver/knockout-assess-record.mjs +3 -3
- package/driver/knockout-caveats.mjs +21 -0
- package/driver/knockout-correction-record.mjs +58 -28
- package/driver/knockout-frame-record.mjs +2 -2
- package/driver/knockout-register-read.mjs +38 -21
- package/driver/knockout-register-record.mjs +5 -6
- package/driver/knockout-review-record.mjs +12 -11
- package/driver/ladder/model-gauge.mjs +88 -0
- package/driver/ladder/next-rung.mjs +296 -0
- package/driver/ladder/rescue.mjs +146 -0
- package/driver/ladder/stage-tools.mjs +57 -0
- package/driver/ladder/turn-failure.mjs +166 -0
- package/driver/log.mjs +2 -2
- package/driver/matter-frame-record.mjs +4 -4
- package/driver/methodology-witness.mjs +2 -2
- package/driver/narrative-refutation-record.mjs +145 -42
- package/driver/one-build-per-run.mjs +62 -0
- package/driver/outbox-backoff.mjs +4 -4
- package/driver/owner-screen.mjs +0 -10
- package/driver/owner-use-check.mjs +2 -28
- package/driver/package.json +1 -1
- package/driver/partial-payload-baseline.json +1 -1
- package/driver/parts-not-completed.mjs +1 -1
- package/driver/pipeline-knockout.mjs +1015 -1001
- package/driver/pipeline.mjs +511 -9265
- package/driver/placement-decisions.mjs +2 -2
- package/driver/placement-form-io.mjs +7 -9
- package/driver/placement-union.mjs +0 -6
- package/driver/plan-stability.mjs +7 -10
- package/driver/portal-acks.mjs +3 -2
- package/driver/portal-confirmation.mjs +48 -0
- package/driver/portal-families.mjs +3 -2
- package/driver/portal-local-auth.mjs +1 -2
- package/driver/portal-routes/README.md +24 -0
- package/driver/portal-routes/admin.mjs +425 -0
- package/driver/portal-routes/compose.mjs +66 -0
- package/driver/portal-routes/config.mjs +118 -0
- package/driver/portal-routes/connect.mjs +283 -0
- package/driver/portal-routes/feedback.mjs +178 -0
- package/driver/portal-routes/me.mjs +165 -0
- package/driver/portal-routes/queue.mjs +64 -0
- package/driver/portal-routes/report.mjs +106 -0
- package/driver/portal-routes/run.mjs +508 -0
- package/driver/portal-routes/runs.mjs +127 -0
- package/driver/portal-routes/usage.mjs +82 -0
- package/driver/portal-runs.mjs +588 -0
- package/driver/portal-service.mjs +78 -2592
- package/driver/portal-static.mjs +3 -1
- package/driver/predelivery-lint.mjs +92 -9
- package/driver/production-pool-guard.mjs +1 -1
- package/driver/profiles.mjs +5 -4
- package/driver/progress.mjs +29 -24
- package/driver/publish/README.md +10 -5
- package/driver/publish/archive-tags.mjs +3 -2
- package/driver/publish/demo-marking.mjs +2 -2
- package/driver/publish/index.mjs +215 -140
- package/driver/publish/knockout.mjs +153 -107
- package/driver/publish/office-record-links.mjs +22 -0
- package/driver/publish/parse.mjs +20 -5
- package/driver/publish/pool-admin.mjs +9 -3
- package/driver/publish/render.mjs +11 -3
- package/driver/publish/report-dates.mjs +3 -4
- package/driver/publish/report-registry.mjs +7 -10
- package/driver/publish/seed-pool.mjs +3 -2
- package/driver/publish/shell.mjs +106 -0
- package/driver/publish/templates/report.css +3 -1
- package/driver/queue-order.mjs +4 -3
- package/driver/record-carry.mjs +0 -9
- package/driver/record-discard.mjs +1 -4
- package/driver/record-fold.mjs +3 -3
- package/driver/record-goods.mjs +5 -5
- package/driver/reference-score.mjs +2 -3
- package/driver/register-capabilities.mjs +0 -6
- package/driver/register-count.mjs +3 -2
- package/driver/register-digest-record.mjs +7 -7
- package/driver/register-fixture-marker.mjs +3 -3
- package/driver/register-plan.mjs +2 -2
- package/driver/register-records.mjs +2 -2
- package/driver/register-taint.mjs +3 -3
- package/driver/register-unit-record.mjs +48 -9
- package/driver/register-unreachable.mjs +4 -3
- package/driver/registry-fidelity.mjs +79 -34
- package/driver/repair-composers.mjs +14 -9
- package/driver/repair-digest.mjs +4 -6
- package/driver/repair-scope.mjs +3 -3
- package/driver/repair-targets.mjs +24 -9
- package/driver/repairs.mjs +44 -58
- package/driver/replay-archive.mjs +7 -7
- package/driver/report-card-record.mjs +3 -3
- package/driver/report-overview-record.mjs +4 -4
- package/driver/research-answers.mjs +38 -6
- package/driver/research-checks.mjs +4 -4
- package/driver/result-noun-fields.mjs +28 -11
- package/driver/review-addresses.mjs +163 -0
- package/driver/rule-shape.mjs +1 -1
- package/driver/run-delivered.mjs +340 -0
- package/driver/run-economics.mjs +8 -26
- package/driver/run-failed.mjs +545 -0
- package/driver/run-integrity.mjs +1 -1
- package/driver/run-outcome.mjs +314 -0
- package/driver/run-park.mjs +23 -0
- package/driver/run-quote.mjs +32 -0
- package/driver/run-record.mjs +352 -0
- package/driver/run-requirements.mjs +22 -0
- package/driver/run-shell.mjs +55 -0
- package/driver/runner.mjs +71 -33
- package/driver/saved-register-pages.mjs +4 -4
- package/driver/score-redaction.mjs +2 -2
- package/driver/search-policy.mjs +12 -13
- package/driver/settle-stamp.mjs +4 -3
- package/driver/skeptic-record.mjs +2 -2
- package/driver/skeptic-search.mjs +1 -1
- package/driver/skills/README.md +7 -7
- package/driver/skills/blind-frame/SKILL.md +1 -2
- package/driver/skills/case-law-citation/SKILL.md +9 -37
- package/driver/skills/case-law-citation/sources/courtlistener.md +1 -3
- package/driver/skills/case-law-citation/sources/eurlex.md +8 -11
- package/driver/skills/case-law-citation/sources/legaldatahunter.md +1 -1
- package/driver/skills/clearance-common-law/SKILL.md +45 -111
- package/driver/skills/clearance-common-law/perplexity-prompts.md +7 -79
- package/driver/skills/clearance-register/SKILL.md +15 -33
- package/driver/skills/clearance-register/digest.md +31 -92
- package/driver/skills/clearance-register/providers/clarivate.md +2 -2
- package/driver/skills/clearance-register/providers/corsearch.md +5 -5
- package/driver/skills/clearance-register/providers/euipo.md +1 -2
- package/driver/skills/clearance-register/providers/free-tier.md +0 -19
- package/driver/skills/clearance-register/providers/signa.md +6 -25
- package/driver/skills/clearance-register/providers/uspto-local.md +0 -24
- package/driver/skills/clearance-register/register-recipes.md +8 -15
- package/driver/skills/clearance-register/status-rules.md +6 -24
- package/driver/skills/clearance-register/unit.md +11 -20
- package/driver/skills/clearance-search/delivery-contract.md +24 -120
- package/driver/skills/clearance-search/field-doctrine-pharma.md +1 -5
- package/driver/skills/clearance-search/firm-wide-reasoning.md +24 -43
- package/driver/skills/clearance-search/phase2-execution.md +29 -77
- package/driver/skills/clearance-search/report-prose.md +3 -4
- package/driver/skills/clearance-search/risk-framework-demo.md +1 -1
- package/driver/skills/clearance-search/risk-framework-triage.manifest.json +3 -3
- package/driver/skills/clearance-search/risk-framework-triage.md +7 -9
- package/driver/skills/clearance-search/risk-framework.manifest.json +1 -1
- package/driver/skills/clearance-search/risk-framework.md +1 -1
- package/driver/skills/clearance-search/synthesis-rules.md +30 -107
- package/driver/skills/clearance-search/worked-examples.md +5 -5
- package/driver/skills/clearance-variants/SKILL.md +46 -45
- package/driver/skills/clearance-variants/transliteration-scripts.md +4 -4
- package/driver/skills/frame-diff/SKILL.md +1 -1
- package/driver/skills/knockout-assess/SKILL.md +6 -14
- package/driver/skills/knockout-frame/SKILL.md +1 -1
- package/driver/skills/matter-frame/SKILL.md +7 -12
- package/driver/skills/matter-frame/watchlist-reference.md +1 -4
- package/driver/skills/narrative-refutation/SKILL.md +20 -30
- package/driver/skills/placement-inquiry/SKILL.md +8 -18
- package/driver/skills-store-provenance.mjs +1 -1
- package/driver/stage-context.mjs +32 -35
- package/driver/stage-freshness.mjs +127 -11
- package/driver/stages-knockout.mjs +49 -22
- package/driver/stages.mjs +88 -283
- package/driver/status-snapshot.mjs +2 -1
- package/driver/steps/correction-cycle.mjs +311 -0
- package/driver/steps/corrections.mjs +644 -0
- package/driver/steps/delivery.mjs +1287 -0
- package/driver/steps/frame-comparison.mjs +922 -0
- package/driver/steps/intake.mjs +84 -0
- package/driver/steps/open-run.mjs +419 -0
- package/driver/steps/overview-and-cards.mjs +899 -0
- package/driver/steps/placement-and-digest.mjs +23 -0
- package/driver/steps/register-sweep.mjs +1563 -0
- package/driver/steps/skeptic-and-follow-up.mjs +831 -0
- package/driver/steps/synthesis.mjs +261 -0
- package/driver/steps/verdict-gate.mjs +968 -0
- package/driver/suite-census.json +403 -91
- package/driver/surface-exit-verdict.mjs +0 -8
- package/driver/synthesis-record.mjs +72 -6
- package/driver/terminal-clamp.mjs +10 -0
- package/driver/tokens.mjs +8 -62
- package/driver/tool-calls.mjs +2 -2
- package/driver/unit-state-verdict.mjs +1 -1
- package/driver/usage-ledger.mjs +2 -1
- package/driver/verify-knockout.mjs +20 -35
- package/driver/verify.mjs +47 -36
- package/driver/web-grid.mjs +3 -4
- package/driver/whatif-memo-run.mjs +2 -2
- package/driver/whatif-queue.mjs +4 -3
- package/driver/withheld-families.mjs +14 -15
- package/driver/worker-heartbeat.mjs +3 -2
- package/driver/write-up-form.mjs +0 -3
- package/mcp-server/CHANGELOG.md +4 -0
- package/mcp-server/http-server.mjs +1 -1
- package/mcp-server/lib/brief.mjs +22 -4
- package/mcp-server/lib/events.mjs +2 -2
- package/mcp-server/lib/evidence.mjs +3 -2
- package/mcp-server/lib/findings.mjs +2 -1
- package/mcp-server/lib/knockout.mjs +9 -10
- package/mcp-server/lib/ops.mjs +9 -9
- package/mcp-server/lib/runs.mjs +9 -10
- package/mcp-server/lib/trace.mjs +1 -1
- package/mcp-server/lib/whatif.mjs +2 -3
- package/mcp-server/package.json +1 -1
- package/mcp-server/server.mjs +5 -5
- package/package.json +2 -1
- package/portal-ui/dist/assets/{index-fPqAU0sx.js → index-D5rkCjDc.js} +26 -14
- package/portal-ui/dist/index.html +1 -1
- package/portal-ui/package.json +3 -3
- package/providers/README.md +1 -1
- package/providers/_shared/answer-memory.mjs +4 -5
- package/providers/_shared/execute-plan.mjs +48 -1
- package/providers/_shared/records-from-search.mjs +46 -0
- package/providers/clarivate/README.md +2 -2
- package/providers/clarivate/src/adapter.js +147 -0
- package/providers/clarivate/src/core.js +1 -14
- package/{driver/engine/mcp/clarivate-server.mjs → providers/clarivate/src/mount.js} +5 -10
- package/providers/corsearch/README.md +3 -3
- package/providers/corsearch/src/adapter.js +80 -0
- package/providers/corsearch/src/core.js +14 -11
- package/{driver/engine/mcp/corsearch-server.mjs → providers/corsearch/src/mount.js} +5 -10
- package/providers/euipo/README.md +2 -2
- package/providers/euipo/src/adapter.js +85 -0
- package/providers/euipo/src/core.js +1 -1
- package/providers/euipo/src/euipo-client.js +1 -2
- package/{driver/engine/mcp/euipo-server.mjs → providers/euipo/src/mount.js} +5 -10
- package/providers/free-tier/README.md +2 -2
- package/providers/free-tier/src/adapter.js +127 -0
- package/{driver/engine/mcp/free-tier-server.mjs → providers/free-tier/src/mount.js} +5 -10
- package/providers/jx-subclass/coverage.mjs +1 -6
- package/providers/jx-subclass/score-truth.mjs +2 -1
- package/providers/oauth-mcp-bridge/CHANGELOG.md +4 -0
- package/providers/oauth-mcp-bridge/package.json +1 -1
- package/providers/perplexity/src/core.js +2 -2
- package/providers/signa/README.md +2 -2
- package/providers/signa/src/adapter.js +157 -0
- package/providers/signa/src/capabilities.js +0 -3
- package/providers/signa/src/core.js +2 -2
- package/{driver/engine/mcp/signa-server.mjs → providers/signa/src/mount.js} +7 -12
- package/providers/signa/src/offices.generated.js +17 -15
- package/providers/uspto-local/README.md +1 -1
- package/providers/uspto-local/bin/verify-index.mjs +1 -1
- package/providers/uspto-local/src/adapter.js +75 -0
- package/{driver/engine/mcp/uspto-local-server.mjs → providers/uspto-local/src/mount.js} +5 -10
- package/scripts/band-shape-probe.mjs +2 -2
- package/scripts/citation-line-check.mjs +7 -7
- package/scripts/compare.mjs +1 -1
- package/scripts/dead-names.mjs +2 -2
- package/scripts/e2e-first-time.mjs +19 -7
- package/scripts/e2e.mjs +13 -13
- package/scripts/engine-probe.mjs +1 -1
- package/scripts/env-audit.mjs +7 -4
- package/scripts/env-classify.mjs +5 -1
- package/scripts/feedback-mint.mjs +1 -1
- package/scripts/freeze-example-run.mjs +7 -7
- package/scripts/mint-suite-census.mjs +2 -2
- package/scripts/nightly-notice.mjs +1 -1
- package/scripts/release-cut-decision.mjs +7 -2
- package/scripts/release-note-required.mjs +26 -9
- package/scripts/release-notes-lint.mjs +3 -2
- package/scripts/release-version-pr-checks.mjs +1 -1
- package/scripts/settings-render-check.mjs +23 -3
- package/scripts/test-run.mjs +5 -5
- package/scripts/travelling-predicates.mjs +1 -1
- package/scripts/undeclared-field-census.mjs +1 -1
- package/scripts/unexecuted-asserts.mjs +1 -1
- package/scripts/verify-publishable.mjs +1 -1
- package/shared/client-door.mjs +1 -1
- package/shared/connect-clients.mjs +1 -1
- package/shared/connector-signin-probe.mjs +1 -1
- package/shared/env-aliases.mjs +1 -1
- package/shared/invocation.mjs +14 -2
- package/shared/names-in-force.mjs +2 -0
- package/shared/register-selection.mjs +2 -2
- package/shared/store-in-repo.mjs +3 -3
- package/shared/summary-blocks.mjs +0 -3
- package/shared/trigger-lane.mjs +1 -1
- package/shared/vacuous-pass.mjs +2 -2
- package/shared/verb-shim.mjs +4 -2
- package/node_modules/exceljs/README.md +0 -3023
|
@@ -48,7 +48,9 @@
|
|
|
48
48
|
import { createHash } from "node:crypto";
|
|
49
49
|
import { readFileSync, writeFileSync, existsSync, readdirSync, unlinkSync } from "node:fs";
|
|
50
50
|
import { join, basename } from "node:path";
|
|
51
|
-
import { driverDir, ensureDriverDir } from "
|
|
51
|
+
import { atomicWrite, driverDir, ensureDriverDir, paths, readJson } from "./run-record.mjs"; // — one definition of where `_driver/` is
|
|
52
|
+
import { runLog, note } from "./log.mjs";
|
|
53
|
+
import { parseFindingsJsonLenient } from "./findings-model.mjs";
|
|
52
54
|
|
|
53
55
|
const STAMP_DIR = "stage-inputs";
|
|
54
56
|
const sha12 = (buf) => createHash("sha256").update(buf).digest("hex").slice(0, 12);
|
|
@@ -64,8 +66,8 @@ export function shaOf(absPath) {
|
|
|
64
66
|
* skeptic-flags file that did not exist when synthesis ran, and exists now, is new material.
|
|
65
67
|
* PURE-ish (reads only the paths it is given).
|
|
66
68
|
*/
|
|
67
|
-
export function fingerprint(inputPaths = [], { label = null, project = null } = {}) {
|
|
68
|
-
|
|
69
|
+
export function fingerprint(inputPaths = [], { label = null, project = null, values = null } = {}) {
|
|
70
|
+
const files = [...new Set(inputPaths.filter(Boolean).map(String))].sort()
|
|
69
71
|
.map((p) => {
|
|
70
72
|
const e = { name: basename(p), path: p, sha: shaOf(p) };
|
|
71
73
|
// — the PROJECTION, recorded beside the whole-file sha and never instead of it. Omitted
|
|
@@ -75,6 +77,11 @@ export function fingerprint(inputPaths = [], { label = null, project = null } =
|
|
|
75
77
|
if (typeof proj === "string" && proj) e.proj = proj;
|
|
76
78
|
return e;
|
|
77
79
|
});
|
|
80
|
+
// WHAT A STAGE READ THAT IS NOT A FILE: the message it was handed, which carries the order's own words, or the list
|
|
81
|
+
// of files a folder held. Each is recorded under `value:<name>` with the sha of its text, after the files, and is
|
|
82
|
+
// compared like a file. Omitted when none is given, so every caller that passes none writes exactly as before.
|
|
83
|
+
const named = values && typeof values === "object" ? Object.keys(values).sort() : [];
|
|
84
|
+
return [...files, ...named.map((k) => ({ name: k, path: `value:${k}`, sha: sha12(String(values[k] ?? "")) }))];
|
|
78
85
|
}
|
|
79
86
|
|
|
80
87
|
/**
|
|
@@ -113,22 +120,30 @@ export function diffFingerprint(recorded, current) {
|
|
|
113
120
|
const stampPath = (runDir, label) => driverDir(runDir, STAMP_DIR, `${label.replace(/[^\w.:-]/g, "_")}.json`);
|
|
114
121
|
|
|
115
122
|
/** Record the inputs a stage's CURRENT output was produced from. Best-effort; never throws. */
|
|
116
|
-
export function writeStamp(runDir, label, inputPaths, { project = null } = {}) {
|
|
123
|
+
export function writeStamp(runDir, label, inputPaths, { project = null, values = null } = {}) {
|
|
124
|
+
writeFingerprint(runDir, label, fingerprint(inputPaths, { label, project, values }));
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
/**
|
|
128
|
+
* Record a fingerprint taken earlier, as the stamp of `label`. A stage that rewrites one of its own inputs while it runs
|
|
129
|
+
* takes its fingerprint before it runs, so the stamp says what it was based on rather than what it left. Best-effort.
|
|
130
|
+
*/
|
|
131
|
+
export function writeFingerprint(runDir, label, inputs) {
|
|
117
132
|
try {
|
|
118
133
|
ensureDriverDir(runDir, STAMP_DIR);
|
|
119
|
-
writeFileSync(stampPath(runDir, label), JSON.stringify({ label, ts: new Date().toISOString(), inputs
|
|
134
|
+
writeFileSync(stampPath(runDir, label), JSON.stringify({ label, ts: new Date().toISOString(), inputs }, null, 2) + "\n");
|
|
120
135
|
} catch { /* a stamp we could not write just means "not stale" downstream — never worse than today */ }
|
|
121
136
|
}
|
|
122
137
|
|
|
123
138
|
export function readStamp(runDir, label) {
|
|
124
|
-
try { return
|
|
139
|
+
try { return readJson(stampPath(runDir, label)); } catch { return null; }
|
|
125
140
|
}
|
|
126
141
|
|
|
127
142
|
/** Is this stage's output stale with respect to its declared inputs' current bytes? Never throws. */
|
|
128
|
-
export function stageStaleness(runDir, label, inputPaths, { project = null } = {}) {
|
|
143
|
+
export function stageStaleness(runDir, label, inputPaths, { project = null, values = null } = {}) {
|
|
129
144
|
const stamp = readStamp(runDir, label);
|
|
130
145
|
if (!stamp) return { stale: false, changed: [] }; // legacy / first run after this ships ⇒ today's behaviour
|
|
131
|
-
return diffFingerprint(stamp.inputs, fingerprint(inputPaths, { label, project }));
|
|
146
|
+
return diffFingerprint(stamp.inputs, fingerprint(inputPaths, { label, project, values }));
|
|
132
147
|
}
|
|
133
148
|
|
|
134
149
|
/**
|
|
@@ -145,7 +160,7 @@ export function restamp(runDir, absPath, { project = null } = {}) {
|
|
|
145
160
|
if (!f.endsWith(".json")) continue;
|
|
146
161
|
const p = join(dir, f);
|
|
147
162
|
let doc;
|
|
148
|
-
try { doc =
|
|
163
|
+
try { doc = readJson(p); } catch { continue; }
|
|
149
164
|
let hit = false;
|
|
150
165
|
// — a mutator accounts for the PROJECTION too. Refreshing only the whole-file sha would leave
|
|
151
166
|
// a stale projection that no recompute could settle — the mirror of the defect restamp exists for.
|
|
@@ -198,7 +213,7 @@ export function restampStage(runDir, label, absPath, { project = null } = {}) {
|
|
|
198
213
|
try {
|
|
199
214
|
const p = stampPath(runDir, label);
|
|
200
215
|
if (!existsSync(p)) return miss;
|
|
201
|
-
const doc =
|
|
216
|
+
const doc = readJson(p);
|
|
202
217
|
const sha = shaOf(absPath);
|
|
203
218
|
let matched = false, changed = false;
|
|
204
219
|
for (const e of doc?.inputs ?? []) {
|
|
@@ -276,7 +291,7 @@ export function reconcileStamps(runDir, inputsFor, exclude = null, { project = n
|
|
|
276
291
|
if (!f.endsWith(".json")) continue;
|
|
277
292
|
const p = join(dir, f);
|
|
278
293
|
let doc;
|
|
279
|
-
try { doc =
|
|
294
|
+
try { doc = readJson(p); } catch { continue; }
|
|
280
295
|
if (!doc?.label) continue;
|
|
281
296
|
// An exclude entry may be a full label OR a bare stage name — a bare name excludes every
|
|
282
297
|
// axis-qualified stamp of that stage ("register-digest" covers "register-digest:primary-sweep").
|
|
@@ -290,3 +305,104 @@ export function reconcileStamps(runDir, inputsFor, exclude = null, { project = n
|
|
|
290
305
|
} catch { /* best-effort */ }
|
|
291
306
|
return touched;
|
|
292
307
|
}
|
|
308
|
+
|
|
309
|
+
// ── findings.json: one write, and its stamp choice stated where it is made ─────────────────────────────
|
|
310
|
+
//
|
|
311
|
+
// findings.json is the record every client surface renders from, and a dozen driver arms rewrite it after
|
|
312
|
+
// synthesis has written it. Each rewrite makes one of two choices about the stamps. It can leave them alone,
|
|
313
|
+
// so the stages that read the file read it as moved and run again: the comment above `injectFrontMatter`
|
|
314
|
+
// in pipeline.mjs says that is what those rewrites are for. Or it can settle the stamp of a one-shot stage,
|
|
315
|
+
// which has no in-process re-run and would otherwise park the run at the delivery gate. `writeFindings` is
|
|
316
|
+
// the one place both choices are made, so a write that settles nothing says so by passing nothing.
|
|
317
|
+
//
|
|
318
|
+
// `settleOneShotStamp` and `projectStageInput` sit here for that reason: the write cannot reach them in
|
|
319
|
+
// pipeline.mjs, which imports this module.
|
|
320
|
+
|
|
321
|
+
// ── — WHAT A STAGE COMPARES INSTEAD OF THE WHOLE FILE ──────────────────────────────────────────
|
|
322
|
+
// A `report-card:N` declares findings.json and READS NONE OF IT: its finding arrives inline on the
|
|
323
|
+
// message as ctx.finding, and the file is declared so the freshness gate sees it move at all. So a
|
|
324
|
+
// sanctioned late arm that edits ONE finding — corrective synthesis, a verdict recheck — moved the
|
|
325
|
+
// whole-file sha and made all 26 cards read stale at the delivery gate. The tail repair then re-derived
|
|
326
|
+
// them: 496,327 output tokens, 48.0M cache read, 43 dispatches of which 33 were repeats, 1h29m. A third
|
|
327
|
+
// of that run's output and 29% of its wall clock, re-deriving work already on disk and already valid.
|
|
328
|
+
//
|
|
329
|
+
// The projection is EXACTLY WHAT THE STAGE WAS FED — the finding object at that ordinal, serialized the
|
|
330
|
+
// way the card's own message serializes it. Deliberately not canonicalized: the message renders the raw
|
|
331
|
+
// object, so a key reordering genuinely changes what the model saw and must genuinely read as stale.
|
|
332
|
+
//
|
|
333
|
+
// A NULL PROJECTION IS A FALLBACK, NEVER A PASS. Ordinal absent from the current file, an unreadable or
|
|
334
|
+
// rejected findings.json, any throw — all return null, the compare falls back to the whole-file sha, and
|
|
335
|
+
// the card stays stale. Ordinals are safe to key on because consolidateFindingsFile RENUMBERS before the
|
|
336
|
+
// cards are dispatched, and a renumber that moves a finding away from ordinal N changes N's projection,
|
|
337
|
+
// which is correctly stale.
|
|
338
|
+
//
|
|
339
|
+
// This is NOT the settleOneShotStamp blessing warns about: nothing is declared settled and no
|
|
340
|
+
// artifact is blessed past a live consumer. And it narrows what is COMPARED, never what is DECLARED —
|
|
341
|
+
// narrowing the declaration would let a card be repaired ahead of its stale upstream, which is the one
|
|
342
|
+
// thing item 15a exists to prevent, and dependency-repair.test.mjs pins that edge.
|
|
343
|
+
export function projectStageInput(label, absPath) {
|
|
344
|
+
if (typeof label !== "string" || !label.startsWith("report-card:")) return null;
|
|
345
|
+
if (basename(String(absPath ?? "")) !== "findings.json") return null;
|
|
346
|
+
const ord = Number(label.slice("report-card:".length));
|
|
347
|
+
if (!Number.isFinite(ord)) return null;
|
|
348
|
+
try {
|
|
349
|
+
const doc = parseFindingsJsonLenient(readFileSync(absPath, "utf8"));
|
|
350
|
+
const f = (doc?.findings ?? []).find((x) => Number(x?.ordinal) === ord);
|
|
351
|
+
if (!f) return null;
|
|
352
|
+
return createHash("sha256").update(JSON.stringify(f)).digest("hex").slice(0, 12);
|
|
353
|
+
} catch { return null; }
|
|
354
|
+
}
|
|
355
|
+
|
|
356
|
+
/**
|
|
357
|
+
* follow-up (2026-08-04) — account for a SANCTIONED in-pass rewrite in a ONE-SHOT stage's stamp.
|
|
358
|
+
*
|
|
359
|
+
* A one-shot stage reads its evidence at a fixed seam and has no in-process re-run: frame-diff's own
|
|
360
|
+
* contract says "NO in-process re-diff". When a later arm legitimately rewrites an artifact such a
|
|
361
|
+
* stage declared, there is no repair to schedule — the delivery precondition simply reads it stale and
|
|
362
|
+
* parks the run, which pays a park plus a full re-drive to re-dispatch a stage whose every consumer
|
|
363
|
+
* already ran. `restampStage` is the sanctioned-rewrite mechanism (the settlement flush's own idiom);
|
|
364
|
+
* this wraps it so every call site says WHICH artifacts moved and WHY, in one place.
|
|
365
|
+
*
|
|
366
|
+
* NARROW ON PURPOSE. `files` is the list the calling arm actually rewrote, never "everything this stage
|
|
367
|
+
* declares": blessing the whole declaration would quietly widen the grant every time an input is added,
|
|
368
|
+
* and a blind-frame model or a manifest that moves between passes is NEW MATERIAL that must still force
|
|
369
|
+
* the diff (the copper-vault catch).
|
|
370
|
+
*
|
|
371
|
+
* AND IT IS NOT SILENT WHEN IT MATCHES NOTHING. Every `files` entry is a literal path whose declaration
|
|
372
|
+
* lives in stages.mjs; moved frame-diff's list and turned an existing restamp call into a
|
|
373
|
+
* guaranteed no-op that nothing recorded. A file this label does not declare now lands a `restamp-miss`
|
|
374
|
+
* row in run.jsonl — the absence becomes a finding, and the next input-list move cannot go unnoticed.
|
|
375
|
+
* Logged rather than thrown: the freshness module is best-effort by contract, and killing a run over
|
|
376
|
+
* bookkeeping would trade a cheap park for a dead one.
|
|
377
|
+
*/
|
|
378
|
+
export function settleOneShotStamp(runDir, label, files, why) {
|
|
379
|
+
const changed = [], missed = [];
|
|
380
|
+
for (const f of files.filter(Boolean)) {
|
|
381
|
+
const r = restampStage(runDir, label, f, { project: projectStageInput });
|
|
382
|
+
if (r.changed) changed.push(f);
|
|
383
|
+
if (r.stamped && !r.matched) missed.push(f);
|
|
384
|
+
}
|
|
385
|
+
for (const f of missed) {
|
|
386
|
+
runLog(runDir, { event: "restamp-miss", stage: label, path: f, why });
|
|
387
|
+
note(`stage-freshness: restamp of ${label} against ${basename(f)} matched nothing — ${label} does not declare that file (${why}); the compensating rewrite is aimed at nothing`);
|
|
388
|
+
}
|
|
389
|
+
if (changed.length) runLog(runDir, { event: "one-shot-stamp-settled", stage: label, why, changed });
|
|
390
|
+
return { changed, missed };
|
|
391
|
+
}
|
|
392
|
+
|
|
393
|
+
/**
|
|
394
|
+
* Write the run's findings.json, then settle the stamp of each one-shot stage in `settles`.
|
|
395
|
+
*
|
|
396
|
+
* `doc` is the record as an object, written the way every site wrote it before (two-space JSON and a
|
|
397
|
+
* final newline), or as text, written exactly as given: a restore puts back the bytes it saved. The write
|
|
398
|
+
* is atomic and throws as `atomicWrite` does, so a caller's existing `try` still decides what a failed
|
|
399
|
+
* write means. `why` names the arm; it reaches run.jsonl only through a settlement, so a write that
|
|
400
|
+
* settles nothing adds no row. Returns what each settlement changed and missed, by stage.
|
|
401
|
+
*/
|
|
402
|
+
export function writeFindings(runDir, doc, { why, settles = [] } = {}) {
|
|
403
|
+
const file = paths(runDir).findings;
|
|
404
|
+
atomicWrite(file, typeof doc === "string" ? doc : JSON.stringify(doc, null, 2) + "\n");
|
|
405
|
+
const settled = {};
|
|
406
|
+
for (const label of settles) settled[label] = settleOneShotStamp(runDir, label, [file], why);
|
|
407
|
+
return { file, settled };
|
|
408
|
+
}
|
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
// kept in its OWN table: the knockout lane is a different product shape (a 5–15 mark triage batch), and
|
|
6
6
|
// its stages must never leak into the clearance STAGE_ORDER. New-named stages get [] MCP tool groups
|
|
7
7
|
// automatically (gather-config prefix map — the matter-frame precedent), so frame/assess run lean.
|
|
8
|
+
import { paths } from "./run-record.mjs";
|
|
8
9
|
import { existsSync, readFileSync } from "node:fs";
|
|
9
10
|
import { join } from "node:path";
|
|
10
11
|
import { driverDir } from "../shared/driver-dir.mjs"; //
|
|
@@ -15,10 +16,11 @@ import { kebab, PRODUCT_POLICIES } from "./search-policy.mjs";
|
|
|
15
16
|
import { requestNamesClasses } from "./enqueue-schema.mjs";
|
|
16
17
|
import { knockoutAssessChunkFile } from "./knockout-assess-record.mjs";
|
|
17
18
|
import { chunkScope, knockoutCorrectionFile, sameFinding, validateKnockoutCorrectionFile } from "./knockout-correction-record.mjs";
|
|
18
|
-
import { methodDictation, inputsShape } from "./framework-method.mjs";
|
|
19
|
+
import { FROZEN_METHOD_FILE, methodDictation, inputsShape } from "./framework-method.mjs";
|
|
19
20
|
import { knockoutReviewFile, validateKnockoutReviewFile } from "./knockout-review-record.mjs";
|
|
20
21
|
import { knockoutRegisterFile, validateKnockoutRegisterFile } from "./knockout-register-record.mjs";
|
|
21
22
|
import { narrowingOrderLine } from "./effective-scope.mjs";
|
|
23
|
+
import { REVIEW_APPLIES_THE_SUPPLIED_FRAMEWORK } from "./stages.mjs";
|
|
22
24
|
export { kebab }; // one definition (search-policy) — re-exported for the lane's existing imports
|
|
23
25
|
|
|
24
26
|
const lines = (...xs) => xs.filter(Boolean).join("\n");
|
|
@@ -64,8 +66,8 @@ export function koPaths(runDir) {
|
|
|
64
66
|
review: knockoutReviewFile(runDir),
|
|
65
67
|
// Depth 2: the code-authoritative count sidecar + its per-call receipts. Both live under
|
|
66
68
|
// _driver/ — they are the driver's own measurements, never a model's output.
|
|
67
|
-
registerCounts:
|
|
68
|
-
countLedger:
|
|
69
|
+
registerCounts: paths(runDir).registerCounts,
|
|
70
|
+
countLedger: paths(runDir).registerCount,
|
|
69
71
|
// part 5 — the filings behind the narrow counts, beside the counts they explain. Because the
|
|
70
72
|
// MCP server serves run artifacts generically, landing it here makes the filings queryable over MCP
|
|
71
73
|
// with no MCP-side work at all. Its receipts ride the count lane's ledger file and are the ONLY
|
|
@@ -73,18 +75,18 @@ export function koPaths(runDir) {
|
|
|
73
75
|
// cost", and the two lanes are told apart by a key the older lines simply do not have. The count
|
|
74
76
|
// rows were left exactly as they were rather than gaining a matching marker: their shape is pinned
|
|
75
77
|
// byte-for-byte by register-count.test.mjs, and a discriminator only one side needs is enough.
|
|
76
|
-
registerRecords:
|
|
78
|
+
registerRecords: paths(runDir).registerRecords,
|
|
77
79
|
// THE READING STEP'S RECORD, a model output and so at the run root: what it carried forward, set aside and did not
|
|
78
80
|
// ask. The questions and their rows are the register tool's, in the bands under `register-units/`.
|
|
79
81
|
registerReading: knockoutRegisterFile(runDir),
|
|
80
|
-
inboundRequest:
|
|
82
|
+
inboundRequest: paths(runDir).inboundRequest,
|
|
81
83
|
// The scoped owner lookups this run owes its promoted filings, and their receipts. Both under `_driver/` because both are the DRIVER's own measurement of a call it made — the
|
|
82
84
|
// rule stated fourteen lines above. The seat reads the payloads under research/, never these.
|
|
83
|
-
ownerChecks:
|
|
84
|
-
ownerCheckLedger:
|
|
85
|
+
ownerChecks: paths(runDir).ownerChecks,
|
|
86
|
+
ownerCheckLedger: paths(runDir).ownerCheck,
|
|
85
87
|
researchDir: join(runDir, "research"),
|
|
86
88
|
research: (markKebab) => join(runDir, "research", `${markKebab}.md`),
|
|
87
|
-
sweepLedger:
|
|
89
|
+
sweepLedger: paths(runDir).knockoutSweep,
|
|
88
90
|
// What each web call returned, verbatim, one file per call: the pages a search reached, which the ledger
|
|
89
91
|
// above and the payload under research/ do not carry. A directory, because every `_driver/*.jsonl` is
|
|
90
92
|
// read as a stage log. The driver's own record of a call it made, so under `_driver/`.
|
|
@@ -111,18 +113,13 @@ export function koPaths(runDir) {
|
|
|
111
113
|
// driver would write where the pipeline does not read and every arm on both sides would stay green.
|
|
112
114
|
// One producer, imported.
|
|
113
115
|
assessChunk: (n) => knockoutAssessChunkFile(runDir, n),
|
|
114
|
-
|
|
115
|
-
// through the Bash bypass — must still resume without re-dispatching a paid stage, so the reader falls
|
|
116
|
-
// back to this and nothing ever writes it again. Delete once no resumable run predates the move.
|
|
117
|
-
assessChunkLegacy: (n) => driverDir(runDir, `knockout-assess-${n}.json`),
|
|
118
|
-
instructedScope: driverDir(runDir, "instructed-scope.json"),
|
|
116
|
+
instructedScope: paths(runDir).instructedScope,
|
|
119
117
|
// The client's own words, written at intake as on the clearance lane (stages.mjs, the same two names).
|
|
120
|
-
|
|
121
|
-
confirmationBrief: join(runDir, "confirmation-brief.md"),
|
|
118
|
+
confirmationBrief: paths(runDir).confirmationBrief,
|
|
122
119
|
// as on the clearance lane, and apart from instructed-scope.json for the same reason: the frame
|
|
123
120
|
// quotes that file's values verbatim. Written at intake, read by no stage.
|
|
124
|
-
defaultTerritories:
|
|
125
|
-
emailBody:
|
|
121
|
+
defaultTerritories: paths(runDir).defaultTerritories,
|
|
122
|
+
emailBody: paths(runDir).emailBody,
|
|
126
123
|
};
|
|
127
124
|
}
|
|
128
125
|
|
|
@@ -264,12 +261,30 @@ export function koSteps({ registerProbe = false } = {}) {
|
|
|
264
261
|
}
|
|
265
262
|
|
|
266
263
|
// ── Stage defs ───────────────────────────────────────────────────────────────────────────────────────
|
|
264
|
+
// ── WHAT EACH STAGE READS, SO A RESUME CAN TELL WHETHER ITS OUTPUT STILL STANDS ─────────────────────────────────
|
|
265
|
+
//
|
|
266
|
+
// A Knockout stage reuses its output only while what it read is unchanged, as a clearance stage does (stage-freshness.mjs).
|
|
267
|
+
// `reads` names the files a stage reads, read off its message: the files the message names, and the frozen files it
|
|
268
|
+
// rates or frames under. `dirs` are folders it may read any file of, recorded as the files they hold, so a research
|
|
269
|
+
// payload added or removed is a change. `message: true` records the message itself, which carries what the order and
|
|
270
|
+
// the frozen profile said in their own words (goods, instructions, territories, the profile's industry and classes),
|
|
271
|
+
// and the defects or table a second look is given. The correction does not record its message: it is composed from the
|
|
272
|
+
// chunk the correction rewrites, so it would read the correction's own edit as a change. What it was based on is in the
|
|
273
|
+
// correction work, which holds the rated record and every defect, and in the first review.
|
|
274
|
+
//
|
|
275
|
+
// A stage that rates, reviews or corrects also reads the framework: its band words and order (`framework.json`) and its
|
|
276
|
+
// method (`framework-method.json`), both frozen with the run, and its deck, the prose the model reasons with. `deck: true`
|
|
277
|
+
// records the deck as the file the model is sent to, from the layer in force (pipeline-knockout.mjs koReadsNow).
|
|
278
|
+
const asRequested = (K) => [K.inboundRequest, K.confirmationBrief];
|
|
279
|
+
const frozenRules = (K) => [paths(K.runDir).profile, paths(K.runDir).framework, driverDir(K.runDir, FROZEN_METHOD_FILE)];
|
|
280
|
+
|
|
267
281
|
export const KO_STAGES = {
|
|
268
282
|
"knockout-frame": {
|
|
269
283
|
model: "opus", thinking: "high", timeoutSec: 420, stallSec: 300,
|
|
270
284
|
skillReads: ["skills/knockout-frame/SKILL.md"],
|
|
271
285
|
out: (K) => K.plan,
|
|
272
286
|
validate: koValidators.knockoutPlan,
|
|
287
|
+
reads: (K) => ({ files: [K.instructedScope, ...asRequested(K), paths(K.runDir).profile], message: true }),
|
|
273
288
|
message: ({ K, job, profile }) => lines(
|
|
274
289
|
reads(["skills/knockout-frame/SKILL.md"]),
|
|
275
290
|
// ── NO DEPTH NUMBER ──────────────────────────────────────────────────────
|
|
@@ -331,6 +346,7 @@ export const KO_STAGES = {
|
|
|
331
346
|
skillReads: ["skills/knockout-register-read/SKILL.md"],
|
|
332
347
|
out: (K) => K.registerReading,
|
|
333
348
|
validate: validateKnockoutRegisterFile,
|
|
349
|
+
reads: (K) => ({ files: [K.instructedScope, K.inboundRequest, K.plan, paths(K.runDir).profile], message: true }),
|
|
334
350
|
message: ({ K, job = {}, profile = null, readingLines = [], providerDoc = null, inScope = null }) => lines(
|
|
335
351
|
reads(["skills/knockout-register-read/SKILL.md", providerDoc].filter(Boolean)),
|
|
336
352
|
`You are reading the register for a KNOCKOUT batch, name by name. You rate nothing; the step after you rates what you carry forward, with your reasons.`,
|
|
@@ -376,6 +392,8 @@ export const KO_STAGES = {
|
|
|
376
392
|
// out/validate are per-CHUNK; the merged knockout-findings.json is validated separately in code.
|
|
377
393
|
out: (K, chunkNo) => K.assessChunk(chunkNo),
|
|
378
394
|
validate: koValidators.knockoutAssessChunk,
|
|
395
|
+
reads: (K) => ({ files: [K.plan, K.instructedScope, ...asRequested(K), ...frozenRules(K), K.registerRecords, K.registerCounts, K.ownerChecks],
|
|
396
|
+
dirs: [K.researchDir], message: true, deck: true }),
|
|
379
397
|
message: ({ K, job, chunkNo, chunkMarks, chunkTotal, framework, frameworkPath, probeNote, frameworkMethod }) => lines(
|
|
380
398
|
// The deck path comes from ctx (attachKnockoutFramework resolves it once, on the fresh and the
|
|
381
399
|
// resume path both) — never recomputed here, because "which deck" is one decision.
|
|
@@ -443,9 +461,9 @@ export const KO_STAGES = {
|
|
|
443
461
|
// a finding with no register evidence. Omitting either field is always safe: the card keeps its
|
|
444
462
|
// neutral line, which describes the card and is true.
|
|
445
463
|
registerRecordHeld(K)
|
|
446
|
-
? `WHEN YOU WEIGH ONE OF THOSE FILINGS, SAY SO BY ITS OWN ID — copy "recordId" verbatim from the file above. "registerReads" on the MARK: rows of ${frameworkMethod ? "{recordId, read, band?, inputs?}" : "{recordId, read, band?}"} for a filing you weighed that did NOT become a findings[] record; "read" is what you concluded about THAT filing — how its goods meet the goods the client asked about, whether it bears on the rating, and why — and it prints on that filing's card in the reader's own report. "band" is OPTIONAL and is your rating of THAT filing on its own, in the framework's band words: send it whenever you formed a view on the filing itself, because a registered right left unbanded is the only card on the page with no rating while softer uses beside it carry one, which reads as though the registration mattered least. Omit it and your read still prints, claiming no rating.${frameworkMethod ? ' A row that carries "band" also carries "inputs", the framework\'s own inputs for that filing; a row with no band carries none.' : ""} "weighedFilings" on a FINDING: the recordIds whose evidence your reasoning for that conflict actually used, because the report derives that finding's source labelling from it.
|
|
464
|
+
? `WHEN YOU WEIGH ONE OF THOSE FILINGS, SAY SO BY ITS OWN ID — copy "recordId" verbatim from the file above. "registerReads" on the MARK: rows of ${frameworkMethod ? "{recordId, read, band?, inputs?}" : "{recordId, read, band?}"} for a filing you weighed that did NOT become a findings[] record; "read" is what you concluded about THAT filing — how its goods meet the goods the client asked about, whether it bears on the rating, and why — and it prints on that filing's card in the reader's own report. "band" is OPTIONAL and is your rating of THAT filing on its own, in the framework's band words: send it whenever you formed a view on the filing itself, because a registered right left unbanded is the only card on the page with no rating while softer uses beside it carry one, which reads as though the registration mattered least. Omit it and your read still prints, claiming no rating.${frameworkMethod ? ' A row that carries "band" also carries "inputs", the framework\'s own inputs for that filing; a row with no band carries none.' : ""} "weighedFilings" on a FINDING: the recordIds whose evidence your reasoning for that conflict actually used, because the report derives that finding's source labelling from it. Omit these fields when their information does not apply. When a finding's reasoning uses a held filing, record its ID in \`weighedFilings\`. When you weigh a filing without making it a finding, record the read in \`registerReads\`. Never invent a read or citation to fill a field. Both are joined against the filings you were given, so an id we do not hold is refused by name.`
|
|
447
465
|
: "",
|
|
448
|
-
`The FROZEN framework in force (rate in ITS band vocabulary, highest→lowest ${framework.bands.map((b) => b.label).join(" · ")}): ${
|
|
466
|
+
`The FROZEN framework in force (rate in ITS band vocabulary, highest→lowest ${framework.bands.map((b) => b.label).join(" · ")}): ${paths(K.runDir).framework}`,
|
|
449
467
|
frameworkMethod ? methodDictation(frameworkMethod) : "",
|
|
450
468
|
frameworkMethod ? `- inputs: ${inputsShape(frameworkMethod)} — the framework's own inputs for this finding, each one of the values it lists, reasoned in its order before the band. On every rated finding.` : "",
|
|
451
469
|
// A seam for a note about Depth 2, and it stays UNUSED on purpose (2026-07-22). The counts
|
|
@@ -540,6 +558,8 @@ export const KO_STAGES = {
|
|
|
540
558
|
// A later pass reads the corrected record, under its own artifact: `knockout-review#1`.
|
|
541
559
|
out: (K, pass) => (pass ? knockoutReviewFile(K.runDir, pass) : K.review),
|
|
542
560
|
validate: validateKnockoutReviewFile,
|
|
561
|
+
reads: (K) => ({ files: [K.findings, K.plan, ...asRequested(K), ...frozenRules(K), K.registerRecords, K.ownerChecks],
|
|
562
|
+
dirs: [K.researchDir], message: true, deck: true }),
|
|
543
563
|
// ── THE MESSAGE PROMISES A TABLE ONLY WHEN IT HAS ONE ──────────────────────────
|
|
544
564
|
//
|
|
545
565
|
// `evidenceLines` is the driver's measurement, passed at dispatch. Two things follow, and the arms
|
|
@@ -550,16 +570,20 @@ export const KO_STAGES = {
|
|
|
550
570
|
// exists to stop. A record the driver's read flags nowhere is handed its first-read lines instead,
|
|
551
571
|
// by the owner's ruling of 2026-10-10, so both branches have rows under them; a record with no such
|
|
552
572
|
// line is not dispatched at all.
|
|
553
|
-
message: ({ K, frameworkPath = null, evidenceLines = [], firstReadLines = [], exclusionNote = "", recheckTable = "", sourceAnswers = [] }) => lines(
|
|
573
|
+
message: ({ K, frameworkPath = null, evidenceLines = [], firstReadLines = [], exclusionNote = "", recheckTable = "", sourceAnswers = [], movedNames = [], comparisonComplete = true }) => lines(
|
|
554
574
|
// THE CLIENT'S QUESTION LEADS, in the owner's words (ruling 2026-09-24), ahead of the rewrite job.
|
|
555
575
|
`Does the report answer the client's question: who could object, how strong they are, what the client should do? Are the marks a lawyer would list present, and is each position written from the record that matters? Answer that before any check on wording.`,
|
|
556
576
|
reads(["skills/knockout-assess/SKILL.md", "skills/clearance-search/firm-wide-reasoning.md", "skills/clearance-search/report-prose.md", frameworkPath].filter(Boolean)),
|
|
577
|
+
REVIEW_APPLIES_THE_SUPPLIED_FRAMEWORK,
|
|
557
578
|
`You are the INDEPENDENT CHECK on a knockout screen: another step rated this batch. Check what the client is told against the request, the framework and the evidence, then check its wording. You change no band and no finding yourself.`,
|
|
558
579
|
`Apply the frozen framework, the knockout assessment manual and shared firm-wide reasoning. Read report-prose.md for writing standards; its links do not import clearance-only finding or placement rules into this screen. An unidentified owner is an explicit evidence gap, not by itself grounds to remove or lower a finding's band. Never invent attribution or a right; explain what the held evidence supports and what remains uncertain.`,
|
|
559
580
|
requestLine(K, (at) => `The client's request, as it arrived: ${at}`, (at) => `The available brief: ${at}. The original request is not held here.`),
|
|
560
581
|
recheckTable
|
|
561
582
|
? [`THIS IS THE SECOND LOOK. An earlier check raised the defects below. The table says what the driver saw of each, including any the rating step did not answer, and the record you are reading is the record as it now stands.`,
|
|
562
583
|
recheckTable,
|
|
584
|
+
// What the correction changed under names no defect named, and a comparison the driver could not make, read in full.
|
|
585
|
+
movedNames.length ? `THE CORRECTION ALSO CHANGED THESE NAMES, WHICH NO DEFECT NAMED: ${movedNames.map((n) => `"${n}"`).join(", ")}. Read each changed finding, answer and summary block against its evidence, and say whether the change is defended. A change that is not defended is a material defect.` : "",
|
|
586
|
+
comparisonComplete ? "" : `THE DRIVER COULD NOT COMPARE THE NAMES NO DEFECT NAMED. Recheck the whole corrected batch, not only the names the defects concern.`,
|
|
563
587
|
`Recheck every material defect raised by the first review, every changed answer and summary, and any other conclusion that the changes could affect. Unchanged text does not by itself establish that a conclusion is unaffected. Consult the whole held batch and its evidence where needed; if you cannot bound the effects of a change, check the full batch. Keep unresolved defects visible and report any additional material defect you discover. Do not restart a prose edit of accepted text outside the affected scope.`,
|
|
564
588
|
`A changed finding or band must agree with its name's basis, factors, opening read and block in the batch summary. There is no further correction after this one, so send as \`material\` only what is still wrong; it stays on the record for the reviewing lawyer.`].join("\n")
|
|
565
589
|
: [
|
|
@@ -603,6 +627,8 @@ export const KO_STAGES = {
|
|
|
603
627
|
skillReads: ["skills/knockout-assess/SKILL.md", "skills/clearance-search/firm-wide-reasoning.md"],
|
|
604
628
|
out: (K, chunkNo) => knockoutCorrectionFile(K.runDir, chunkNo),
|
|
605
629
|
validate: validateKnockoutCorrectionFile,
|
|
630
|
+
reads: (K) => ({ files: [paths(K.runDir).knockoutCorrectionWork, knockoutReviewFile(K.runDir, 0), K.plan, K.instructedScope,
|
|
631
|
+
...asRequested(K), ...frozenRules(K), K.registerRecords, K.ownerChecks], dirs: [K.researchDir], deck: true }),
|
|
606
632
|
message: ({ K, job = {}, chunkNo, work = null, chunkMarks = [], frameworkPath = null, frameworkMethod = null }) => {
|
|
607
633
|
const asRated = (() => { try { return JSON.parse(readFileSync(K.assessChunk(chunkNo), "utf8")); } catch { return null; } })();
|
|
608
634
|
const scope = chunkScope(work, chunkNo, asRated);
|
|
@@ -610,12 +636,13 @@ export const KO_STAGES = {
|
|
|
610
636
|
const named = new Set(scope.defects.map((d) => d.mark));
|
|
611
637
|
return lines(
|
|
612
638
|
reads(["skills/knockout-assess/SKILL.md", frameworkPath, "skills/clearance-search/firm-wide-reasoning.md"].filter(Boolean)),
|
|
639
|
+
REVIEW_APPLIES_THE_SUPPLIED_FRAMEWORK,
|
|
613
640
|
`An independent check read this rated batch and raised the defects below. Repair what the evidence supports, and nothing else.`,
|
|
614
641
|
requestLine(K,
|
|
615
642
|
(at) => `THE CLIENT'S OWN REQUEST, VERBATIM: ${at}. Read it before you rate. Its stated goods, services, and intended use lead over the plan; the customer's profile fills gaps. Keep a guessed use as a possibility. Do not use that guess to narrow the instructed scope or lower a rating.`,
|
|
616
643
|
(at) => `AVAILABLE BRIEF: ${at}. The original request is not held here. Read the brief before you rate, keep its stated scope, and distinguish supplied facts from inferred uses. Do not lower a rating on a guessed use.`),
|
|
617
644
|
`The record as rated: ${K.assessChunk(chunkNo)}. The ordinals you use are the ones in that file.`,
|
|
618
|
-
`The batch plan: ${K.plan}. The frozen framework's bands: ${
|
|
645
|
+
`The batch plan: ${K.plan}. The frozen framework's bands: ${paths(K.runDir).framework}.`,
|
|
619
646
|
`Each name's research payload: ${chunkMarks.filter((m) => named.has(m.name)).map((m) => K.research(kebab(m.name))).join(" · ")}. The batch's other recorded research payloads are under ${K.researchDir}.`,
|
|
620
647
|
existsSync(K.ownerChecks) ? `The recorded owner checks, with the owner and filing each belongs to: ${K.ownerChecks}.` : "",
|
|
621
648
|
existsSync(K.registerRecords) ? `The filings this run read: ${K.registerRecords}. \`read_register_list\` reads any question's whole list by qid, and fetches nothing.` : "",
|
|
@@ -625,7 +652,7 @@ export const KO_STAGES = {
|
|
|
625
652
|
`A DEFECT IS ANOTHER READER'S FINDING, NOT AN ORDER. Check it against the evidence. Where it holds, repair the finding or the rating. Where it does not, leave the record and say why.`,
|
|
626
653
|
frameworkMethod ? methodDictation(frameworkMethod) : "",
|
|
627
654
|
frameworkMethod ? `- inputs: ${inputsShape(frameworkMethod)} — the framework's own inputs for this finding, each one of the values it lists, reasoned in its order before the band. On every rated finding.` : "",
|
|
628
|
-
`HAND BACK BY CALLING \`record_knockout_correction\`, sending only what changes. THERE IS NO FILE FOR YOU TO WRITE. For a name: the fields that change. A finding goes back whole under its ordinal, and a new one takes the next ordinal.
|
|
655
|
+
`HAND BACK BY CALLING \`record_knockout_correction\`, sending only what changes. THERE IS NO FILE FOR YOU TO WRITE. For a name: the fields that change. A finding goes back whole under its ordinal, and a new one takes the next ordinal. Change a name no defect concerns only for a finding it shares with a name you repair, or an answer that depends on your repair; a shared rating alone is not such a dependency. List each finding you change or remove there in that defect's \`findings\`, and say why. Within an affected name, repair the findings and dependent answers needed to resolve the defect, and explain their connection to it. Leave unrelated findings unchanged.`,
|
|
629
656
|
`A filing held for this batch may bear on more than one name. Weigh it against the particular name and its instructed scope, and cite its held recordId and source. Keep where it was found: using that filing does not mean its original search answered this name's register question.`,
|
|
630
657
|
`${CITED_URL_RULE} ${SIBLING_SOURCE}`,
|
|
631
658
|
OWNER_SOURCE,
|