/** * Data hygiene for ~/.blockrun/. * * Several files in this directory are written by the @blockrun/llm SDK or * by older Franklin versions that didn't ship retention. Without periodic * trimming they grow unbounded: * * - ~/.blockrun/data/ — every paid API call gets a JSON blob * dropped here for forensic replay. SDK * has no rotation; verified 5.7 MB across * ~2 months of light use, will be 30 MB * by year-end and slow `franklin insights`. * - ~/.blockrun/cost_log.jsonl — append-only ledger of every paid call's * cost. Same SDK; no rotation. * - brcc-debug.log / brcc-stats.json / 0xcode-stats.json * — legacy stats / log files from earlier * product names. Not written by any * current code path. * * Hygiene runs once per session start (cheap — just stat() + filter + * unlinkSync). Best-effort: every operation is wrapped so a single failure * never breaks agent boot. */ /** * Summary of what hygiene removed/trimmed in one pass. Returned so the * caller (agent loop) can log it — silent hygiene is hard to verify * without poking at disk yourself, which is exactly the kind of thing * users shouldn't have to do. */ export interface HygieneReport { legacyFilesRemoved: number; dataFilesTrimmed: number; costLogRowsTrimmed: number; orphanToolResultsRemoved: number; brainJunkEntitiesRemoved: number; oldTasksRemoved: number; } /** * Top-level entry. Call once at agent session start. Catches its own * errors so a bad disk never blocks startup. Returns counts so callers * can log a one-line summary — verified 2026-05-04 from a real session * where hygiene was running silently for hours and there was no way to * tell from the log whether anything was being cleaned. */ export declare function runDataHygiene(): HygieneReport;