agentfootprint
Version:
The explainable agent framework — backtrack a wrong answer to the exact context that caused it (evidence, not guesses). Built on footprintjs.
54 lines (53 loc) • 2.71 kB
TypeScript
/**
* variableToBacktrackTrace — serialize a JOINED VARIABLE LIFE
* ({@link AgentVariableSlice}, from `traceVariable` / `joinVariableSlice`) onto
* the same BacktrackTrace board agentThinkingUI's <BacktrackView> renders.
*
* The third sibling of that board, and the most literal one:
* - `toBacktrackTrace` — a LOCALIZER REPORT (scored suspects, ablation
* verdicts): proxy ranking, causal stamps.
* - `sliceToBacktrackTrace` — a footprintjs DEPENDENCY SLICE: exact
* structure, no influence claims.
* - THIS ONE — one variable's recorded LIFE: every write and every read, in
* commit order, labeled with the loop it happened in and the agent source
* it introduced.
*
* Same board, honestly weakest chips:
* - `mode` is ALWAYS `'correlational'`. Nothing here was ablated — the join
* measures nothing — so the causal chip is unreachable by construction.
* - every card is `upperBound: true`: the score is `1/(1+age)` over write
* recency, a deterministic LAYOUT AID, not evidence of anything.
* - the claims lines say out loud that these moments are STRUCTURAL FACTS —
* recorded reads and writes — so a reader can tell this board apart from an
* influence board at a glance.
* - footprintjs's honesty notes ride along verbatim, and honest ABSENCE
* renders an empty board that says why, never a fabricated suspect.
*
* Pure mapping, no UI dependency, framework-agnostic JSON on both sides — the
* human and the LLM triage the SAME artifact.
*/
import type { BacktrackTrace } from './toBacktrackTrace.js';
import type { AgentVariableSlice } from './variable-recall.js';
export interface VariableToBacktrackTraceOptions {
/** The visible outcome being questioned (the board's answer bubble). */
readonly answer: {
readonly text: string;
readonly label?: string;
readonly tone?: 'error' | 'question';
};
/** Headline question. Default: `What happened to '<key>'?`. */
readonly claim?: string;
/** How the latest writer renders: rule diamond or LLM brain. Default 'rule'. */
readonly decidedAtKind?: 'llm' | 'rule';
/** Override the mode chip label. */
readonly modeLabel?: string;
readonly agent?: string;
readonly model?: string;
/** Max suspect cards (one per write). Default 6. The rest fold into one line. */
readonly maxSuspects?: number;
}
/**
* Serialize a joined variable life for agentThinkingUI's BacktrackView.
* See the module doc — structural honesty is the whole design.
*/
export declare function variableToBacktrackTrace(agentSlice: AgentVariableSlice, opts: VariableToBacktrackTraceOptions): BacktrackTrace;