/** * Pure-math judge-agreement metrics for v0.5 Step 6 calibration. * * Per ADR-19 §2 + §5, Step 6 calibration produces two metric families: * - Within-judge consistency: Sonnet regrades the same trial; per-axis * within-1-point agreement gates Step 7 (≥80% per axis), with an * aggregate exact-match diagnostic floor (≥50%; reported, not gating). * - Travis-intuition correlation: aggregate Spearman across pooled * grade pairs (≥0.6) AND per-axis direction-agreement (≥75% per * axis on trial-pair comparisons). Per ADR-19 §2, breaching either * trigger fires Opus escalation. * * MAD (mean absolute difference) is reported as diagnostic-only per * ADR-19 §2 + 1.2 lock — MAD never alone fails the gate; lenience/ * strictness recovery is rubric anchor refinement, not Opus escalation. * * Spearman correlation here is computed as Pearson correlation of * average-tied ranks (matches scipy.stats.spearmanr default). The * simplified formula `1 - 6Σd²/(n(n²-1))` is exact only when no ties * exist; for our 0-3 ordinal scale with small n=10-20, ties are * guaranteed, so we use the proper tied-rank-Pearson computation. * * All functions are pure: no IO; no API calls; deterministic. * Length mismatches between parallel-array inputs throw (programming * error; loud-fail discipline). Undefined statistics (e.g., zero- * variance Spearman input) return NaN; evaluateStep6Gates treats * non-finite observed values as gate failures with NaN preserved in * the failure record's observed field for diagnostic clarity. * * Per ADR-02 (amended 2026-04-30), this module is part of src/grading/ * — research-time module independence preserved; deliberately does * NOT import from src/extraction/. */ import type { AxisName, RubricResult } from "./types.js"; export declare const WITHIN_ONE_POINT_GATE = 0.8; export declare const EXACT_MATCH_DIAGNOSTIC_FLOOR = 0.5; export declare const ESCALATION_AGGREGATE_SPEARMAN_FLOOR = 0.6; export declare const ESCALATION_DIRECTION_AGREEMENT_FLOOR = 0.75; export declare const MAD_DISCLOSURE_THRESHOLD = 0.5; export declare const MAD_REFINEMENT_THRESHOLD = 1.5; export declare const COMPRESSION_SPEARMAN_THRESHOLD = 0.85; export declare function withinOnePointAgreementPerAxis(pass1: RubricResult[], pass2: RubricResult[]): Record; export declare function exactMatchRate(pass1: RubricResult[], pass2: RubricResult[]): number; export declare function spearmanCorrelation(x: number[], y: number[]): number; export declare function aggregateSpearman(judgeScores: RubricResult[], travisScores: RubricResult[]): number; export declare function directionAgreementPerAxis(judgeScores: RubricResult[], travisScores: RubricResult[]): Record; export declare function meanAbsoluteDifferencePerAxis(judgeScores: RubricResult[], travisScores: RubricResult[]): Record; export type GateFailure = { kind: "within-judge-axis"; axis: AxisName; observed: number; threshold: number; } | { kind: "travis-aggregate-spearman"; observed: number; threshold: number; } | { kind: "travis-direction-agreement-axis"; axis: AxisName; observed: number; threshold: number; }; export interface Step6Diagnostics { withinJudgeWithinOnePointPerAxis: Record; withinJudgeExactMatchRate: number; travisAggregateSpearman: number; travisDirectionAgreementPerAxis: Record; madPerAxis: Record; } export interface Step6Result { pass: boolean; failures: GateFailure[]; diagnostics: Step6Diagnostics; } export interface Step6GateInput { judgeScoresPass1: RubricResult[]; judgeScoresPass2: RubricResult[]; judgeScoresOnTravisSubset: RubricResult[]; travisScores: RubricResult[]; } export interface Step6GateOptions { withinJudgeFloor?: number; travisAggregateSpearmanFloor?: number; travisDirectionAgreementFloor?: number; } export declare function evaluateStep6Gates(input: Step6GateInput, options?: Step6GateOptions): Step6Result; //# sourceMappingURL=agreement-stats.d.ts.map