/** * LLM-powered refinement of consolidated semantic memories. * * The rule-based `mergeContents` in consolidate.ts produces functional but * ugly semantic memories — typically "[Consolidated from N related memories]" * prepended to the longest source, or a bulleted list. `hippo refine` takes * those and asks Claude to synthesize a clean, generalized principle. * * Design choices: * - Separate command (not baked into `hippo sleep`) so API-key users opt in. * - Idempotent via the `llm-refined` tag — re-running skips already-refined. * - Uses fetch directly so no SDK dependency. * - On failure (API error, bad response), the original memory is untouched. */ import { MemoryEntry } from './memory.js'; export interface RefineOptions { apiKey: string; model?: string; limit?: number; dryRun?: boolean; /** Ignore the llm-refined tag and re-refine everything eligible. */ all?: boolean; /** Injected for testing — defaults to the real fetch. */ fetcher?: typeof fetch; /** * L9: tenant scope. When provided, refineStore only scans consolidated * entries belonging to this tenant, and parent lookups are scoped to the * same tenant. Cross-tenant parents return null from readEntry and are * silently skipped (refine still produces output from merged content). * Undefined preserves pre-1.12.1 host-wide scan behaviour. */ tenantId?: string; } export interface RefineResult { scanned: number; refined: number; skipped: number; failed: number; details: Array<{ id: string; status: 'refined' | 'skipped' | 'failed'; reason?: string; }>; } /** * Ask Claude to synthesize a clean semantic memory from the merged content * plus the original source memories. Returns the refined content string or * `null` when the API call failed. */ export declare function refineSemanticMemory(merged: string, sources: MemoryEntry[], opts: { apiKey: string; model?: string; fetcher?: typeof fetch; }): Promise; /** * Scan the store for consolidated semantic memories, refine each with the * LLM, and write the refined content back. Tags with `llm-refined` so * repeated runs are idempotent (unless `all` is set). */ export declare function refineStore(hippoRoot: string, opts: RefineOptions): Promise; //# sourceMappingURL=refine-llm.d.ts.map