agentfootprint
Version:
The explainable agent framework — backtrack a wrong answer to the exact context that caused it (evidence, not guesses). Built on footprintjs.
60 lines • 3.33 kB
TypeScript
/**
* skillEntryEvidence — the two graph-level rows about GUESSED entries.
*
* Pattern: pure check module composed into `graph.checkup()` (the
* skillExamples.ts shape: frozen empties when nothing applies, so a
* graph that never heard of this pays one array scan).
* Role: states the PRECONDITION of a recorded failure class, once per
* graph, with a named cure — never nineteen errors on a shape the
* library documents as legitimate.
*
* The recorded failure: an entry regex matched the noun "zone" inside a
* request to FIND something, the turn started on an audit skill, and no
* declared edge could ever leave it — so one wrong guess owned all 30 calls.
* Three independent designers first proposed a per-node "every position must
* have an exit" lint; run against the real 20-skill graph it flags 0 of 20
* (the reachability union makes it vacuous) and with the union dropped it
* flags 19 of 20, including documented-correct shapes. What survives are two
* ONE-ROW facts, each checkable from the declaration alone:
*
* `one-way-entries` (WARNING, ≤1 per graph) — three or more rule-driven
* entries AND more than half of them have no declared outgoing edge. Not a
* claim of a trap: the stated precondition for one. If a guess can drop the
* cursor on most positions and no declared edge can ever move it off them,
* a mis-entry is permanent for the whole turn. Silent on a pipeline, a
* decision tree, a two-skill agent, and a graph whose entries mostly route
* onward.
*
* `no-negative-evidence` (WARNING, ≤1 per graph) — three or more
* rule-driven entries and ZERO `examples` rows and ZERO `neverRoutes`
* phrases anywhere. The proving machinery ships (a `neverRoutes` phrase a
* rule claims is a build ERROR with a witness; an `examples` phrase proves
* which rule wins it); this row exists because the consumer that hit the
* recorded failure declared neither, anywhere — the fix existed and was
* unused. One row would have turned the incident into build-time
* arithmetic.
*
* Both are WARNINGS on purpose: escalating either to a refusal would break
* existing consumers' builds on upgrade (the zero-delta law). The runtime
* repair for the same failure class is the maps kernel (`.maps()`), which
* parks a guessed engagement that earns no corroboration.
*/
import type { GraphProblem } from './skillGraphCheckup.js';
export interface EntryEvidenceInput {
/** Declared entries, with whether each is rule-driven (conditional) and
* whether it declares build-time `examples`. */
readonly entries: ReadonlyArray<{
readonly id: string;
readonly conditional: boolean;
readonly hasExamples: boolean;
}>;
/** Every `fromId` that has at least one declared outgoing route. */
readonly routeFromIds: ReadonlySet<string>;
/** How many `neverRoutes` phrases the graph declares. */
readonly neverRoutesCount: number;
/** Decision trees route by predicate — neither row applies. */
readonly isTree: boolean;
}
/** Run both rows. Pure; returns the same frozen empty when nothing applies. */
export declare function checkEntryEvidence(input: EntryEvidenceInput): readonly GraphProblem[];
//# sourceMappingURL=skillEntryEvidence.d.ts.map