/** * PURE deterministic, STORE-ONLY retrieval of relevant project facts for the planner. * * Opens the FactStore once, reads active facts for the requested scope, then * performs all ranking in memory (pure). Mirrors the retrieve.ts pattern for lessons. * * PURE beyond the single store open/read/close — no network, no Date.now(), no LLM. */ import type { FactRecord } from "../../state/facts.js"; /** * Load and rank at most `topK` active facts from the store that are relevant * to the given `keywords` and `scope`. * * ONE store open/read/close, then pure ranking. Scope isolation is enforced by * the SQL WHERE clause in FactStore.getActiveFacts(scope) — facts in scope A * NEVER surface when querying scope B. * * Scoring: deterministic token-overlap between lowercased keyword tokens and * each record's subject + predicate + value tokens. * Sort: score DESC, then id ASC (byte-stable tiebreak, mirrors retrieve.ts:103). * * Design note: when keywords is empty, keywordTokens.size === 0, scoreFact * returns 0 for all records, and the score > 0 filter yields an empty result. * This matches retrieve.ts behaviour. Project facts are few and always written * with known predicates, so callers should pass relevant keywords (e.g. from * the user prompt) to surface them. * * @param projectRoot - Absolute path to the project root containing .bober/ * @param scope - Fact scope (e.g. "" for default/programming team) * @param keywords - Keywords to rank against (e.g. from the user prompt) * @param options - topK cap and optional namespace (selects DB file location) */ export declare function retrieveRelevantFacts(projectRoot: string, scope: string, keywords: string[], { topK, namespace, }?: { topK?: number; namespace?: string; }): Promise; /** * Render a compact planner context block from an array of FactRecord values. * * Mirrors serializeLessonsForPlanner (retrieve.ts:122-144): * - Empty input → "" * - Header line + one "- subject/predicate: value" line per fact * - Hard charBudget slice (output length is GUARANTEED ≤ charBudget) * * @param records - Already-ranked records (from retrieveRelevantFacts) * @param options - charBudget: hard character limit (default DEFAULT_CHAR_BUDGET) * @returns Compact string block, at most charBudget characters */ export declare function serializeFactsForContext(records: FactRecord[], { charBudget }?: { charBudget?: number; }): string; //# sourceMappingURL=fact-retrieve.d.ts.map