Skip to content

abso-core

Public

abso is version control for agents: the client, the engine and a server you can run on your own Cloudflare account.

Check passed

Versions 190 to 318

Compare

+36 −11 in 4 places
Lines 1–30 at 318 (were 1–14 at 190)
1−// Score Jev against how agents really settled past holds (#19).
1+// Score a model against how agents really settled past holds (#19).
22//
3−// node scripts/autosettle/score.ts <cases.json> [--out <report.json>] [--model jev-latest]
3+// node scripts/autosettle/score.ts <cases.json> [--via workers-ai|clef|jev] [--model <id>] [--out <report.json>]
44//
5+// --via workers-ai (the default) needs the Worker in workers-ai/ running under wrangler dev.
6+//
57// A case is one settled collision: base, yours, theirsLines, context, both
68// pushes' messages, and `kept` from the server's settled record (yours, theirs,
7−// both, or rewrote, which counts as "agent": a hand edit). Needs JEV_API_KEY.
9+// both, or rewrote, which counts as "agent": a hand edit). --via jev needs JEV_API_KEY.
911import { readFileSync, writeFileSync } from "node:fs";
10−import { ask, dollars, type Hold, PICKS, type Pick, type Verdict } from "./jev.ts";
12+import { askClef } from "./clef.ts";
13+import { ask, dollars, type Hold, PICKS, type Pick } from "./jev.ts";
14+import { askWorkersAi } from "./workers-ai.ts";
1115
16+/** What score needs from either model. */
17+interface Verdict {
18+ pick: Pick;
19+ confidence: number;
20+ model: string;
21+ ms: number;
22+ inputTokens: number;
23+ reason?: string;
24+ probabilities?: Record<Pick, number>;
25+ orders?: readonly { pick: Pick }[];
26+}
1228interface Case {
1329 id: string;
1430 file: string;
Lines 63–86 at 318 (were 47–63 at 190)
4763}
4864
4965const args = process.argv.slice(2);
66+const via = flag(args, "--via") ?? "workers-ai";
5067const cases = (JSON.parse(readFileSync(args[0]!, "utf8")) as Case[]).filter(
5168 (c) => c.yours !== null && c.theirsLines !== null,
5269);
5370const rows: { id: string; truth: Pick; verdict: Verdict; right: boolean }[] = [];
5471for (const c of cases) {
5572 try {
56− const verdict = await ask(holdOf(c), { ...(flag(args, "--model") ? { model: flag(args, "--model") } : {}) });
73+ const model = flag(args, "--model") ? { model: flag(args, "--model")! } : {};
74+ const verdict: Verdict =
75+ via === "jev"
76+ ? await ask(holdOf(c), model)
77+ : via === "clef"
78+ ? await askClef(holdOf(c), { model: (model.model as "clef" | "clef-flash") ?? "clef" })
79+ : await askWorkersAi(holdOf(c), model);
5780 const t = truth(c.kept);
5881 rows.push({ id: c.id, truth: t, verdict, right: verdict.pick === t });
5982 console.log(
60− `${verdict.pick === t ? "agree" : "DIFFER"} ${c.id}: agent ${t}, Jev ${verdict.pick} ${verdict.confidence.toFixed(2)} (${verdict.ms.toFixed(0)} ms)`,
83+ `${verdict.pick === t ? "agree" : "DIFFER"} ${c.id}: agent ${t}, model ${verdict.pick} ${verdict.confidence.toFixed(2)} (${verdict.ms.toFixed(0)} ms)`,
6184 );
6285 } catch (e) {
6386 console.log(`error ${c.id}: ${(e as Error).message}`);
Lines 97–103 at 318 (were 74–79 at 190)
7497 return { threshold, settled: sure.length, agreed: sure.filter((r) => r.right).length };
7598};
7699const report = {
100+ via,
77101 model: rows[0]?.verdict.model,
78102 cases: rows.length,
79103 skipped: cases.length - rows.length,
Lines 111–129 at 318 (were 87–104 at 190)
87111 Object.fromEntries(PICKS.map((p) => [p, rows.filter((r) => r.truth === t && r.verdict.pick === p).length])),
88112 ]),
89113 ),
90− ordersDisagreed: rows.filter((r) => r.verdict.orders[0]!.pick !== r.verdict.orders[1]!.pick).length,
114+ ordersDisagreed: rows.filter((r) => r.verdict.orders && r.verdict.orders[0]!.pick !== r.verdict.orders[1]!.pick)
115+ .length,
91116 latencyMs: { median: ms[Math.floor(ms.length / 2)], max: ms[ms.length - 1], mean: mean(ms) },
92117 inputTokensMean: mean(tokens),
93− dollarsPerCall: dollars(mean(tokens)),
118+ ...(via === "jev" ? { dollarsPerCall: dollars(mean(tokens)) } : {}),
94119 rows: rows.map((r) => ({
95120 id: r.id,
96121 agent: r.truth,
97− jev: r.verdict.pick,
122+ model: r.verdict.pick,
98123 confidence: r.verdict.confidence,
99124 probabilities: r.verdict.probabilities,
100− orders: r.verdict.orders.map((o) => o.pick),
101− signs: r.verdict.signs,
125+ orders: r.verdict.orders?.map((o) => o.pick),
126+ reason: r.verdict.reason,
102127 ms: Math.round(r.verdict.ms),
103128 })),
104129};
MCP
compare on this site's /mcp
CLI
abso diff 190 318 scripts/autosettle/score.ts --json
JSON
/christopher/abso-core/compare/190..318?file=scripts%2Fautosettle%2Fscore.ts&format=json