agentfootprint
Version:
The explainable agent framework — backtrack a wrong answer to the exact context that caused it (evidence, not guesses). Built on footprintjs.
38 lines (37 loc) • 2.28 kB
TypeScript
/**
* cost — the SECOND score of two-score localization (proposal 004).
*
* A context bug costs you twice: a wrong ANSWER (the flip `verdict`, the strong
* causal tier) OR extra COST — loops/tokens — even when a capable model recovers
* and answers correctly. This module reads the cost score from the SAME ablation
* reruns (`AblationRunStats.cost`, captured in `runAblationProbe`) and attaches a
* `CostVerdict` to each suspect, then classifies each on the 2×2.
*
* HONEST TIER (the two-lens review): the cost score is a WEAKER, gated tier than
* the flip. Removing a piece reducing cost shows **necessity for the cost, NOT
* that the work was "wasted"** (the piece could be load-bearing scaffolding). So:
* - PLACEBO control — a cost cause must beat the loops-saved of pieces whose
* removal did NOT flip the answer (benign path variance), leave-one-out;
* (v1 limitation: the placebo population is the non-flipping suspects, which
* may themselves include real cost causes — so the band's MAX is CONSERVATIVE
* and UNDER-detects when several pieces reduce cost by similar amounts. Safe
* direction for a causal-ish claim. A dedicated neutral-filler placebo is v2.)
* - STABILITY — every ablated rerun used no MORE loops than baseline
* (consistent reduction; an integer ±1 delta is brittle — determinism ≠
* robustness), AND a placebo band existed to clear.
*/
import type { AblationRunStats, Suspect, SuspectClass } from './types.js';
/** Minimum loops saved (over the placebo band) to call a piece a cost cause. */
export declare const MIN_LOOPS_SAVED = 1;
/**
* Attach a `CostVerdict` to each suspect from the ablation reruns + a
* leave-one-out placebo control. Suspects without cost data are returned
* unchanged (quality-only). See the module honesty note.
*/
export declare function assignCostVerdicts(suspects: readonly Suspect[], baseline: AblationRunStats): Suspect[];
/**
* Derive the 2×2 class from the flip verdict (quality) and the cost verdict.
* The no-bug cell is `'no-detected-effect'` — never "innocent" (a piece can
* matter in ways neither axis sees: overdetermination, same-loops-different-path).
*/
export declare function classifySuspect(suspect: Suspect): SuspectClass;