// Extracted from a private product repo for methodology illustration. // Not runnable standalone: imports reference the private engine. Shapes, // checks, judge prompts, and flow are shown as actually used, July 2026. /* eslint-disable @typescript-eslint/no-explicit-any */ // Run a scored batch of simulated interviews against the current (or a // candidate) voice register. // npx tsx --env-file=.env.local scripts/eval-interviews.ts --n 6 --label baseline // npx tsx --env-file=.env.local scripts/eval-interviews.ts --n 6 --label candidate --register-file evals/candidates/foo.txt import { mkdirSync, writeFileSync } from "node:fs"; import { buildMeasuredContext, buildOpeningMove, TEXT_REGISTER } from "../src/engine"; import { getRoleMap } from "../src/lib/role-map"; import { loadRegister, loadRolesFromDb, printSummary, runBatch } from "./eval-lib"; function arg(name: string, fallback?: string) { const i = process.argv.indexOf(`--${name}`); return i > -1 ? process.argv[i + 1] : fallback; } async function main() { const n = Number(arg("n", "6")); const label = arg("label", "eval")!; const registerText = loadRegister(arg("register-file")) ?? TEXT_REGISTER; const { roles, titles } = await loadRolesFromDb(); // --measured injects the measured-map context (buildMeasuredContext) into // each interview, for testing early-payoff candidates. Off by default: the // shipped interviewer doesn't carry it (three variants regressed tone_gift // hard — see ledger 2026-07-10), so the default eval measures the product. const withMeasured = process.argv.includes("--measured"); // --opening injects the shipped opening move (buildOpeningMove) so the // ice_break axis measures the product's designed opening (R3). const withOpening = process.argv.includes("--opening"); const roleSuffixes: Record = {}; if (withMeasured || withOpening) { for (const t of titles) { const map = await getRoleMap(t).catch(() => null); roleSuffixes[t] = (withOpening ? buildOpeningMove(map) : "") + (withMeasured ? buildMeasuredContext(map) : ""); } } console.log(`Running ${n} simulated interviews [${label}]${withMeasured ? " (measured)" : ""}${withOpening ? " (opening move)" : ""} across: ${titles.join(", ")}`); const { summary, results } = await runBatch({ n, registerText, label, seedData: { roles }, titles, roleSuffixes }); printSummary(summary); mkdirSync("evals/results", { recursive: true }); const path = `evals/results/${label}-${new Date().toISOString().replace(/[:.]/g, "-").slice(0, 19)}.json`; writeFileSync(path, JSON.stringify({ summary, registerText, results }, null, 2)); console.log(`\nSaved ${path}`); } main().catch((e) => { console.error(e); process.exit(1); });