/** * The run's session ledger: a deterministic record of WHAT EACH SESSION * DID, derived from the working tree (git status + mtimes around the * session), never from the model's own account — so it cannot be * hallucinated. Later sessions receive the ledger inside their task text * and read the named files directly instead of re-surveying the * repository, which was the single largest observed token cost (each * cold session spent ~15 turns rediscovering what the previous one * wrote). * * Persisted as a sidecar in the journal directory so a RESUMED run's * sessions are exactly as informed as the original's; the journal * deletes it when the run finishes. * * Pure-judgment steps (failure-judgment) neither receive nor produce * entries: their task already carries everything they judge, and they * touch no files. */ import type { CommandRunner } from "./commands.js"; import type { StepExecutor } from "./claude-step.js"; import type { WorkKind } from "./model-roster.js"; export declare const LEDGER_FILENAME = "session-ledger.json"; export interface LedgerEntry { kind: WorkKind; /** Repo-relative paths the session changed; empty = it changed no files. */ files: string[]; } export interface SessionLedger { /** Wrap a step executor: inject the ledger into tasks, record what ran. */ wrap(step: StepExecutor): StepExecutor; } export declare function sessionLedger(options: { repoRoot: string; journalDir: string; runner: CommandRunner; }): SessionLedger;