/** * Query Router + RRF fusion — Phase 4 of the cognee port plan. * * routeQuery: cognee's rule-based (non-LLM) recall router scaled to our four * retrieval surfaces — document chunks, knowledge-graph triplets, distilled * rules, and org/pattern memories. Weighted regex rules with a negation * window, a confidence gate (winner must be ≥2× runner-up), and an in-memory * misroute counter for debuggability. * * rrfFuse: Reciprocal Rank Fusion across result lists whose raw scores are * not comparable (cosine vs blended vs keyword) — `Σ 1/(rrf_k + rank + 1)` * with cognee's adaptive rrf_k = max(30, min(60, 20 + 2·top_k)). * * @module v1/cli/memory/query-router */ export type RetrievalSurface = 'chunks' | 'kg' | 'rules' | 'memory'; export interface RouteDecision { /** Surfaces to hit, best first. Always non-empty ('chunks' is the fallback). */ surfaces: RetrievalSurface[]; /** Winner's score ≥ 2× runner-up (cognee's confidence gate). Low-confidence * routes should hit ALL surfaces and fuse. */ confident: boolean; scores: Record; } export declare function routeQuery(query: string): RouteDecision; /** Call when a route proved wrong (caller retried another surface) — counts * feed debugging, mirroring cognee's record_override telemetry. */ export declare function recordRouteOverride(from: RetrievalSurface, to: RetrievalSurface): void; /** In-memory counts from this process only; pass merged=true to include the * persisted cross-process counts from .monomind/metrics/route-overrides.json. */ export declare function getRouteOverrides(merged?: boolean): Record; export interface FusableResult { /** Stable identity across lists (id or key). */ id: string; /** Importance factor input in [0,1]; defaults 0.5. */ importance?: number; [extra: string]: unknown; } /** Fuse ranked lists via RRF × importance factor (cognee hybrid/ranking.py). * Input lists must each be ranked best-first; raw scores are ignored. */ export declare function rrfFuse(lists: T[][], topK: number): (T & { rrf: number; })[]; //# sourceMappingURL=query-router.d.ts.map