Archilyzer · Source

archilyzer

Archilyzer
git clone https://archilyzer.pages.dev/source/archilyzer.git
Log | Files | Refs | README | LICENSE

commit b8b9fd72db416c88b2e6e884e126ed50500a8417
parent e62c00751e1a1ea81184be414c6af715c3f61142
Author: I Mean I'm Just Saying <imeanimjustsaying@kiwifarms.st>
Date:   Sat, 17 Oct 2026 00:49:22 -0400

common: the verdict bench asks every claim by default — dedupe (a repeated claim asked once) is an explicit option: --dedupe, the bench-verdicts body's dedupe: true; a run made with it records dedupe and a continuation must agree; never with items-from (operator ruling 2026-10-17)

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

Diffstat:
Mcommon/bin/archilyzer.ts | 4++--
Mcommon/bin/reports-bench-verdicts.ts | 6+++++-
Mcommon/controller/benchVerdicts.ts | 6+++++-
Mcommon/lib/report/draft/bench/bench.test.ts | 14++++++++++++--
Mcommon/lib/report/draft/bench/items.ts | 12+++++++-----
Mcommon/lib/report/draft/bench/run.ts | 18++++++++++++++++--
Mcommon/lib/report/draft/bench/store.ts | 2++
7 files changed, 49 insertions(+), 13 deletions(-)

diff --git a/common/bin/archilyzer.ts b/common/bin/archilyzer.ts @@ -431,8 +431,8 @@ export const COMMANDS: Command[] = [ { path: ["reports", "bench-verdicts"], usage: - "--models <a,b,…> [--report <id,…>] [--window <s>] [--window-mode seconds|turn] [--max-usd <n>] [--limit <n>] [--items-from <run>] [--run <id>] [--dry] [--here] [--wait] [--json] the verdict bench (release 28; release 29 V1): every claim of the registry's fact-checks (or of --report) with the operator's verdict and a citation with cues, asked of each model one claim per call — the report's title, the claim's section, the claim, its quotes (their speaker and the recording's date) and the transcript within --window seconds (default 60) of each cited span, or with --window-mode turn the cited speaker's turn bounded by --window, never the findings or the verdict — and scored against the rulings (agreement, the confusion matrix, CONTRADICTED and NOT_FOUND recall, not-CORROBORATED precision and recall, against an always-CORROBORATED baseline). --limit takes a stratified sample (by the operator's verdict: every verdict kept); --items-from takes an earlier run's exact items (no --report, --window, --window-mode or --limit with it). The run records its prompt version and its items' hash. --dry lists the items, the skipped claims and the dropped citations and estimates the cost, asking nothing. Otherwise through the editor (`pnpm ops bench-verdicts`; a local model through the GPU arbiter; --wait follows the job), or --here in this process for API models only. The run stops at --max-usd (default 5, the whole run); a --run that exists continues with this invocation's --models only (refused under another prompt version). Results stay local, in .generation/bench/verdicts/<run>/ (umtool's /tools/bench) (exit 1 when the run stopped early or was refused; 2 for usage)", - flags: { report: "string", models: "string", window: "string", "window-mode": "string", "max-usd": "string", limit: "string", "items-from": "string", run: "string", dry: "boolean", here: "boolean", wait: "boolean", json: "boolean" }, + "--models <a,b,…> [--report <id,…>] [--window <s>] [--window-mode seconds|turn] [--max-usd <n>] [--limit <n>] [--items-from <run>] [--dedupe] [--run <id>] [--dry] [--here] [--wait] [--json] the verdict bench (release 28; release 29 V1): every claim of the registry's fact-checks (or of --report) with the operator's verdict and a citation with cues, asked of each model one claim per call — the report's title, the claim's section, the claim, its quotes (their speaker and the recording's date) and the transcript within --window seconds (default 60) of each cited span, or with --window-mode turn the cited speaker's turn bounded by --window, never the findings or the verdict — and scored against the rulings (agreement, the confusion matrix, CONTRADICTED and NOT_FOUND recall, not-CORROBORATED precision and recall, against an always-CORROBORATED baseline). --limit takes a stratified sample (by the operator's verdict: every verdict kept); --items-from takes an earlier run's exact items (no --report, --window, --window-mode, --limit or --dedupe with it); --dedupe asks a claim that repeats an earlier one (the same text over the same cited spans) once — without it every claim is asked. The run records its prompt version and its items' hash. --dry lists the items, the skipped claims and the dropped citations and estimates the cost, asking nothing. Otherwise through the editor (`pnpm ops bench-verdicts`; a local model through the GPU arbiter; --wait follows the job), or --here in this process for API models only. The run stops at --max-usd (default 5, the whole run); a --run that exists continues with this invocation's --models only (refused under another prompt version). Results stay local, in .generation/bench/verdicts/<run>/ (umtool's /tools/bench) (exit 1 when the run stopped early or was refused; 2 for usage)", + flags: { report: "string", models: "string", window: "string", "window-mode": "string", "max-usd": "string", limit: "string", "items-from": "string", dedupe: "boolean", run: "string", dry: "boolean", here: "boolean", wait: "boolean", json: "boolean" }, run: async (ctx) => (await import("./reports-bench-verdicts")).benchRow(ctx), }, { diff --git a/common/bin/reports-bench-verdicts.ts b/common/bin/reports-bench-verdicts.ts @@ -1,11 +1,13 @@ // `archilyzer reports bench-verdicts --models a,b,c [--report <id>,…] [--window 60] // [--window-mode seconds|turn] [--max-usd 5] [--limit n] [--items-from <run>] -// [--run <id>] [--dry] [--here] [--wait] [--json]` +// [--dedupe] [--run <id>] [--dry] [--here] [--wait] [--json]` // (release 28 M7; release 29 V1) — the verdict bench: every ruled claim of the // registry's fact-checks asked of each model, one claim per call, and scored // against the operator's rulings (lib/report/draft/bench/). V1: `--window-mode // turn` (the cited speaker's turn, bounded by --window), a stratified `--limit` // (by the operator's verdict), `--items-from <run>` (that run's exact items). +// `--dedupe` asks a repeated claim once (off by default: every claim is asked; +// operator ruling 2026-10-17). // // --dry lists the items (key, the operator's verdict, quotes, cues — no // claim text unless --json) and the skipped claims with their @@ -72,6 +74,7 @@ export function benchOptionsOf(flags: Record<string, FlagValue>): BenchOptions { } if (typeof flags["items-from"] === "string") o.itemsFrom = flags["items-from"]; if (typeof flags.run === "string") o.runId = flags.run; + if (flags.dedupe === true) o.dedupe = true; validateBenchOptions(o); if (o.runId !== undefined && !isBenchRunId(o.runId)) throw new BenchInputError("--run is a run id: lowercase letters, digits and dashes"); return o; @@ -170,6 +173,7 @@ export async function benchMain(flags: Record<string, FlagValue>, deps: BenchDep if (opts.limit !== undefined) body.limit = opts.limit; if (opts.windowMode !== undefined) body.windowMode = opts.windowMode; if (opts.itemsFrom !== undefined) body.itemsFrom = opts.itemsFrom; + if (opts.dedupe) body.dedupe = true; return deps.runOps(["bench-verdicts", "--json", JSON.stringify(body), ...(flags.wait === true ? ["--wait"] : [])]); } diff --git a/common/controller/benchVerdicts.ts b/common/controller/benchVerdicts.ts @@ -54,7 +54,7 @@ import { llmConfigOf } from "./reportDraft"; export const BENCH_VERDICTS_JOB_KIND = "bench-verdicts"; export const BENCH_VERDICTS_RESULT_MARKER = "@@bench-verdicts "; -export const BENCH_VERDICTS_BODY_KEYS = ["run", "reports", "models", "window", "windowMode", "maxUsd", "limit", "itemsFrom"] as const; +export const BENCH_VERDICTS_BODY_KEYS = ["run", "reports", "models", "window", "windowMode", "maxUsd", "limit", "itemsFrom", "dedupe"] as const; const fail = (msg: string): never => { throw new BenchInputError(msg); @@ -94,6 +94,10 @@ export function parseBenchVerdictsBody(b: Record<string, unknown>): BenchOptions if (!isBenchRunId(b.itemsFrom)) fail(`"itemsFrom" is a run id: lowercase letters, digits and dashes`); out.itemsFrom = b.itemsFrom as string; } + if (b.dedupe !== undefined) { + if (typeof b.dedupe !== "boolean") fail(`"dedupe" is true or false`); + out.dedupe = b.dedupe as boolean; + } validateBenchOptions(out); return out; } diff --git a/common/lib/report/draft/bench/bench.test.ts b/common/lib/report/draft/bench/bench.test.ts @@ -16,6 +16,7 @@ import { LOCAL_PROMPT_CAP, passesBar, planVerdictBench, + validateBenchOptions, readBenchRun, runVerdictBench, scoreBench, @@ -718,7 +719,8 @@ test("v3 items: a claim's posts and pages are its evidence (quoted, never a note await s.done(); } - // A report re-cut from another: its claims repeat the first's — asked once. + // A report re-cut from another: its claims repeat the first's — asked once + // with dedupe, every claim asked without it (the default; ruling 2026-10-17). const t = await store(); try { const report = JSON.parse(await readFile(RULED, "utf8")); @@ -727,13 +729,21 @@ test("v3 items: a claim's posts and pages are its evidence (quoted, never a note await mkdir(path.join(t.paths.articlesDir, report.id), { recursive: true }); await writeFile(path.join(t.paths.articlesDir, report.id, "report.json"), JSON.stringify(report)); const reports = await benchReportsOf(t.paths); - const { items, skipped } = await benchItemsOf(reports, { cuesOf }); + const all = await benchItemsOf(reports, { cuesOf }); + assert.equal(all.items.length, 14); + assert.equal(all.skipped.filter((x) => x.reason.startsWith("the same claim as")).length, 0); + const { items, skipped } = await benchItemsOf(reports, { cuesOf, dedupe: true }); assert.equal(items.length, 8); assert.deepEqual(items.filter((i) => i.report === "synth-ruled-recut").map((i) => i.claim), ["r01"]); const same = skipped.filter((x) => x.reason.startsWith("the same claim as")); assert.equal(same.length, 6); assert.deepEqual(same[0], { key: "synth-ruled-recut/r02", report: "synth-ruled-recut", claim: "r02", reason: "the same claim as synth-ruled/r02" }); assert.equal((await benchItemsOf(reports, { cuesOf, dedupe: false })).items.length, 14); + // The bench's option: a plan with dedupe asks 8, without it 14; dedupe + // never goes with items-from (that run's items are taken as they are). + assert.equal((await planVerdictBench({ models: ["qwen3:8b"] }, { paths: t.paths, cuesOf })).items.length, 14); + assert.equal((await planVerdictBench({ models: ["qwen3:8b"], dedupe: true }, { paths: t.paths, cuesOf })).items.length, 8); + assert.throws(() => validateBenchOptions({ models: ["qwen3:8b"], itemsFrom: "vb-x", dedupe: true }), /drop the dedupe/); } finally { await t.done(); } diff --git a/common/lib/report/draft/bench/items.ts b/common/lib/report/draft/bench/items.ts @@ -19,7 +19,9 @@ // (`sectionNamesVerdict`); // - a claim that repeats an earlier item — the same text over the same cited // spans, as a report re-cut from another carries — is SKIPPED as the same -// claim (`benchItemsOf`'s `dedupe`, on by default): counted once, asked once. +// claim (`benchItemsOf`'s `dedupe`) — counted once, asked once. OFF by +// default (operator ruling 2026-10-17): a fresh bench asks every claim, and +// dedupe is an explicit option (`--dedupe`, the body's `dedupe: true`). // // THE WINDOW MODES (V1): // seconds the cues within ±`windowS` of the cited span (M7's, the default) @@ -495,9 +497,9 @@ export const SAME_CLAIM_REASON = "the same claim as"; const sameness = (i: Pick<BenchItem, "text" | "quotes">) => JSON.stringify([i.text.trim(), i.quotes.map((q) => [q.channel, q.id, q.start, q.end]).sort()]); -// Every item of every report, in report then claim order; `dedupe` (default -// on) skips a claim that repeats an earlier item (SAME_CLAIM_REASON and its -// key); `limit` keeps a stratified sample (the rest are skipped, LIMIT_REASON). +// Every item of every report, in report then claim order; `dedupe: true` +// (default off) skips a claim that repeats an earlier item (SAME_CLAIM_REASON +// and its key); `limit` keeps a stratified sample (the rest are skipped, LIMIT_REASON). export async function benchItemsOf(reports: readonly BenchReport[], o: ItemOptions & { limit?: number; dedupe?: boolean }): Promise<BenchItems> { const items: BenchItem[] = []; const skipped: BenchSkipped[] = []; @@ -507,7 +509,7 @@ export async function benchItemsOf(reports: readonly BenchReport[], o: ItemOptio const got = await benchItemsOfReport(r, o); skipped.push(...got.skipped); for (const it of got.items) { - const same = o.dedupe === false ? undefined : seen.get(sameness(it)); + const same = o.dedupe === true ? seen.get(sameness(it)) : undefined; if (same) { skipped.push({ key: it.key, report: it.report, claim: it.claim, reason: `${SAME_CLAIM_REASON} ${same}` }); continue; diff --git a/common/lib/report/draft/bench/run.ts b/common/lib/report/draft/bench/run.ts @@ -93,6 +93,9 @@ export type BenchOptions = { limit?: number; // The exact items of this earlier run (no reports, window or limit with it). itemsFrom?: string; + // Ask a claim that repeats an earlier one (same text, same cited spans) once + // (items.ts SAME_CLAIM_REASON). Off by default: every claim is asked. + dedupe?: boolean; }; // The model, injected (R6's shape; tests): a structured answer to the prompt. @@ -134,7 +137,7 @@ export type BenchPlan = { estimateUsd: number; }; -export type ValidBenchOptions = { models: string[]; windowS: number; windowMode: WindowMode; maxUsd: number; limit?: number; itemsFrom?: string }; +export type ValidBenchOptions = { models: string[]; windowS: number; windowMode: WindowMode; maxUsd: number; limit?: number; itemsFrom?: string; dedupe?: true }; export function validateBenchOptions(o: BenchOptions): ValidBenchOptions { const models = [...new Set((o.models ?? []).map((m) => m.trim()).filter(Boolean))]; @@ -149,9 +152,10 @@ export function validateBenchOptions(o: BenchOptions): ValidBenchOptions { if (!Number.isFinite(maxUsd) || maxUsd <= 0) throw new BenchInputError("maxUsd must be a positive number of dollars"); if (maxUsd > BENCH_MAX_USD_LIMIT) throw new BenchInputError(`maxUsd $${maxUsd} is over the bench's limit of $${BENCH_MAX_USD_LIMIT}`); if (o.limit !== undefined && (!Number.isInteger(o.limit) || o.limit < 1)) throw new BenchInputError("limit is a whole number of items, at least 1"); + if (o.dedupe !== undefined && typeof o.dedupe !== "boolean") throw new BenchInputError("dedupe is true or false"); if (o.itemsFrom !== undefined) { if (!isBenchRunId(o.itemsFrom)) throw new BenchInputError("items-from is a run id: lowercase letters, digits and dashes"); - const also = [o.reports?.length ? "reports" : "", o.windowS !== undefined ? "window" : "", o.windowMode !== undefined ? "window mode" : "", o.limit !== undefined ? "limit" : ""].filter(Boolean); + const also = [o.reports?.length ? "reports" : "", o.windowS !== undefined ? "window" : "", o.windowMode !== undefined ? "window mode" : "", o.limit !== undefined ? "limit" : "", o.dedupe ? "dedupe" : ""].filter(Boolean); if (also.length) throw new BenchInputError(`items-from takes ${o.itemsFrom}'s items as they are: drop the ${also.join(", ")}`); } return { @@ -161,6 +165,7 @@ export function validateBenchOptions(o: BenchOptions): ValidBenchOptions { maxUsd, ...(o.limit !== undefined ? { limit: o.limit } : {}), ...(o.itemsFrom !== undefined ? { itemsFrom: o.itemsFrom } : {}), + ...(o.dedupe === true ? { dedupe: true as const } : {}), }; } @@ -198,6 +203,7 @@ type ItemSet = { windowMode: WindowMode; limit?: number; itemsFrom?: string; + dedupe?: true; }; // The context lines an item made before V1 lacks (the report's title, the @@ -244,6 +250,7 @@ async function itemSetOf(v: ValidBenchOptions, o: BenchOptions, deps: Pick<Bench windowS: src.summary.windowS, windowMode: src.summary.windowMode ?? "seconds", ...(src.summary.limit !== undefined ? { limit: src.summary.limit } : {}), + ...(src.summary.dedupe ? { dedupe: true as const } : {}), itemsFrom: v.itemsFrom, }; } @@ -255,6 +262,7 @@ async function itemSetOf(v: ValidBenchOptions, o: BenchOptions, deps: Pick<Bench ...(deps.turnsOf ? { turnsOf: deps.turnsOf } : {}), ...(deps.dateOf ? { dateOf: deps.dateOf } : {}), ...(v.limit ? { limit: v.limit } : {}), + ...(v.dedupe ? { dedupe: true } : {}), }); return { ...got, @@ -262,6 +270,7 @@ async function itemSetOf(v: ValidBenchOptions, o: BenchOptions, deps: Pick<Bench windowS: v.windowS, windowMode: v.windowMode, ...(v.limit !== undefined ? { limit: v.limit } : {}), + ...(v.dedupe ? { dedupe: true as const } : {}), // (planVerdictBench names the reports it read; a run records what was asked.) }; } @@ -326,6 +335,9 @@ export async function runVerdictBench(o: BenchOptions, deps: BenchDeps): Promise if (o.limit !== undefined && o.limit !== s.limit) { throw new BenchInputError(`run ${id} was made ${s.limit === undefined ? "with no limit" : `with a limit of ${s.limit}`}: drop the limit, or start a new run`); } + if (o.dedupe !== undefined && o.dedupe !== (s.dedupe === true)) { + throw new BenchInputError(`run ${id} was made ${s.dedupe ? "with" : "without"} dedupe: drop it, or start a new run`); + } if (o.reports?.length && [...o.reports].sort().join(",") !== [...s.reports].sort().join(",")) { throw new BenchInputError(`run ${id} was made over other reports: drop them, or start a new run`); } @@ -345,6 +357,7 @@ export async function runVerdictBench(o: BenchOptions, deps: BenchDeps): Promise windowMode: s.windowMode ?? "seconds", ...(s.limit !== undefined ? { limit: s.limit } : {}), ...(s.itemsFrom ? { itemsFrom: s.itemsFrom } : {}), + ...(s.dedupe ? { dedupe: true as const } : {}), }; results = prior.results; models = [...s.models, ...v.models.filter((m) => !s.models.includes(m))]; @@ -385,6 +398,7 @@ export async function runVerdictBench(o: BenchOptions, deps: BenchDeps): Promise maxUsd: v.maxUsd, reports: set.reports, ...(set.limit !== undefined ? { limit: set.limit } : {}), + ...(set.dedupe ? { dedupe: true as const } : {}), spentUsd: round6(priorSpend + meter.usd), items: items.length, skipped: set.skipped, diff --git a/common/lib/report/draft/bench/store.ts b/common/lib/report/draft/bench/store.ts @@ -61,6 +61,8 @@ export type BenchSummary = { // The reports asked for (empty: every fact-check in the registry). reports: string[]; limit?: number; + // A run made with dedupe (a repeated claim asked once); absent: every claim asked. + dedupe?: true; spentUsd: number; items: number; skipped: BenchSkipped[];