/** * Session accounting for the context saver, so its value can be measured instead of assumed: * how often large outputs appear, how many were compressed or dropped as duplicates, how much was removed, how many * turns that removal was spared from (token-turns), and how often the agent went back for the full text. A recall means * the excerpt was not enough; a whole-file recall also undoes the saving, a scoped one keeps it. Deterministic; no requests. */ export interface ContextLedgerSnapshot { /** Single-text-block outputs at or above tailMinChars, i.e. candidates for compression. */ large: number; compressed: number; /** Results replaced by a duplicate note because an identical result already exists in this session. */ duplicates: number; bytesSaved: number; /** Assistant turns completed since the session started. */ turns: number; /** Sum over turns of the bytes that were no longer in context on that turn, in rough tokens (bytes / 4). */ tokenTurnsSaved: number; /** Times the agent went back to a stored full output after compression, by kind of access. */ recalls: number; recallsFull: number; } export type RecallKind = "full" | "scoped"; export declare class ContextLedger { private large; private compressed; private duplicates; private bytesSaved; private turns; private tokenTurnsSaved; private recalls; private recallsFull; private readonly stored; /** Every sizeable text result seen this session, by content key, with the tool that produced it and its stored copy if any. */ private readonly seen; candidate(): void; record(path: string, bytesSaved: number): void; /** Remember a result's identity so a later identical result can be dropped. `path` is set when a full copy exists. */ remember(key: string, tool: string, path?: string): void; duplicateOf(key: string): { tool: string; path?: string; } | undefined; duplicate(bytesSaved: number): void; /** One LLM turn finished: everything removed so far was absent from this turn's prompt. */ turnEnd(): void; /** The stored path that `text` (a path, command, or serialized input) mentions, if any. */ storedPathIn(text: string): string | undefined; /** Counts the first access to a compressed output; later accesses and duplicate-only copies are not new recalls. */ noteAccess(text: string, kind?: RecallKind): string | undefined; snapshot(): ContextLedgerSnapshot; /** Paths to temp files for cleanup at session start. Internal only — paths never leave the machine. */ storedPaths(): string[]; reset(): void; } /** One line for /warden status. Says when there is nothing to report instead of printing zeros. */ export declare function formatLedger(snapshot: ContextLedgerSnapshot): string;