/** * [INPUT]: MemoryEntry/Episode/WorkEntry, project, context tags, config weights * [OUTPUT]: retrieval score (Stanford: Recency + Importance + Relevance) * [POS]: Core ranking algorithm — used by engine for injection budget allocation * * Key innovation: uses per-entry adaptive strength (not global half-life) * for Recency, implementing Ebbinghaus spaced repetition. */ import type { Episode, MemoryEntry, WorkEntry } from "./types.js"; export declare function daysSince(iso: string): number; /** Ebbinghaus decay: R = e^(-t * ln2 / S) where S = per-entry strength */ export declare function decay(ageDays: number, strength: number): number; export declare function extractTags(text: string): string[]; export declare function tagOverlap(a: string[], b: string[]): number; export interface ScoreWeights { recency: number; importance: number; relevance: number; } export declare function scoreEntry(e: MemoryEntry, project: string, ctx: string[], defaultHalfLife: Record, weights: ScoreWeights): number; export declare function scoreEpisode(ep: Episode, project: string, ctx: string[], defaultHalfLife: Record, weights: ScoreWeights): number; export declare function scoreWorkEntry(w: WorkEntry, project: string, ctx: string[], defaultHalfLife: Record, weights: ScoreWeights): number; /** Budget-constrained top-k selection by score */ export declare function pickTop(items: T[], scoreFn: (t: T) => number, lenFn: (t: T) => number, budget: number): T[];