/** * SessionConsolidator — Hermes-inspired automatic memory extraction. * * Hermes Agent syncs conversation turns to memory after each response and * extracts memories on session end. This module replicates that loop for * cortex-engine: * * - observe / wonder / speculate call notifyObservation() after every write. * - When pending count hits AUTO_THRESHOLD per namespace, dreamPhaseA * (NREM: cluster → refine → create) fires in the background without * blocking the tool call that triggered it. * - On process exit (SIGTERM / SIGINT), flush() runs dreamPhaseA across * all namespaces with unprocessed observations. * * dreamPhaseA is intentionally lightweight — no REM (edges, abstraction, * FSRS scoring). Those still belong in the scheduled full `dream` cycle. * The point is that raw observations do not sit unprocessed across session * boundaries; they become searchable memories within the same session. */ import type { EmbedProvider } from '../core/embed.js'; import type { LLMProvider } from '../core/llm.js'; import type { NamespaceManager } from '../namespace/manager.js'; /** Number of new observations per namespace that trigger an auto-consolidation. */ export declare const AUTO_THRESHOLD = 10; export declare class SessionConsolidator { private readonly namespaces; private readonly embed; private readonly llm; /** pending[namespace] = count of new observations since last auto-run */ private pending; /** running[namespace] = true while a background Phase A is in flight */ private running; private shuttingDown; constructor(namespaces: NamespaceManager, embed: EmbedProvider, llm: LLMProvider); /** * Call this after every successful observation write. When the pending * count crosses AUTO_THRESHOLD, schedules a background Phase A run. */ notifyObservation(namespace: string): void; /** * Flush all namespaces — called on process exit. Awaitable so the * exit handler can give it a chance to complete before the process dies. */ flush(): Promise; private runPhaseA; } //# sourceMappingURL=auto-consolidate.d.ts.map