/** * Daily Session Rotation * * Runs the nightly (4 AM) memory-integrity pass for EVERY non-worker thread: * consolidate episodes → run narratives → advance `session_reset_at`. * This is unconditional — memory hygiene is required by all threads, not just * those opted into rotation. Workers are excluded (their memory is no-persist). * * Separately, threads that opt in via the `daily_rotation` flag are ALSO * force-restarted after their memory pass: the running CLI process is killed so * the keeper respawns a fresh session. `session_reset_at` already advanced the * episode-window boundary, so the fresh session cold-starts on a clean context * rehydrated from its normal briefing — deliberately WITHOUT any "reconstruct * the context / re-read episodes" instruction (that removed clean_shutdown * anti-pattern caused over-reading on every restart). A scheduled rotation is an * EXPECTED event, so the fresh session simply continues from its briefing. * * Only keepAlive threads are restarted, because only they are respawned by the * keeper; a non-keepAlive thread would just die. */ import { initMemoryDb } from "../data/memory/schema.js"; interface DailyRotationResult { rootThreadId: number; previousSessionResetAt: string | null; newSessionResetAt: string; consolidated: boolean; /** True when the thread was force-restarted after its memory pass (daily_rotation opt-in). */ restarted: boolean; error?: string; } /** * Rotate a single root thread's daily session. * 1. Run consolidation (distill episodes into knowledge) * 2. Run narrative generation (best-effort) * 3. Update session_reset_at on the thread_registry row */ export declare function rotateDailySession(rootThreadId: number, db?: ReturnType): Promise; /** * Run the nightly memory pass for every non-worker thread, and force-restart the * subset that opted into `daily_rotation`. Called from the background runner on a * schedule (4 AM). Idempotent per day via the daily marker and per-thread via * session_reset_at, so a late or repeated call is safe. */ export declare function rotateAllDailySessions(): Promise; export {}; //# sourceMappingURL=daily-session.d.ts.map