import type { MemoryKind } from "./constants.js"; import type { MemoryRecord } from "./types.js"; export declare const DECOCTION_DEFAULT_MIN_COSINE = 0.75; export declare const DECOCTION_MIN_PROJECTS = 4; export declare const DECOCTION_DEFAULT_SNIPPET_CHARS = 280; /** The corpus fields needed by read-only decoction discovery. */ export type DecoctionDiscoveryMemory = Pick; /** Matches the memories + embeddings portion of AugmentService's corpus snapshot. */ export interface DecoctionDiscoveryInput { memories: readonly DecoctionDiscoveryMemory[]; embeddings: ReadonlyMap; /** Raw cosine floor used for every pair in a cluster. */ minCosine?: number; /** Maximum normalized body characters returned per source. */ snippetChars?: number; } export interface DecoctionDiscoverySource { id: number; /** Durable identity; numeric ids can churn during an index rebuild. */ relative_path: string; project_name: string; kind: MemoryKind; content_hash: string; frontmatter_hash: string; snippet: string; } export interface DecoctionDiscoveryCluster { sources: DecoctionDiscoverySource[]; distinct_projects: number; project_names: string[]; /** Lowest raw cosine among every pair of sources in this complete-link cluster. */ min_pairwise_cosine: number; } export interface DecoctionDiscoveryOutput { /** Policy-eligible memories, including any that currently lack an embedding. */ eligible: number; /** Eligible memories that have an embedding and therefore entered clustering. */ embedded: number; min_cosine: number; min_projects: typeof DECOCTION_MIN_PROJECTS; clusters: DecoctionDiscoveryCluster[]; } /** * Find cross-project evidence groups without mutating the corpus. * * This is agglomerative complete-link clustering: two groups can merge only * when every cross-group source pair meets the raw cosine floor. In contrast * to connected components, a chain of individually similar neighbors cannot * pull dissimilar endpoints into the same generic-memory candidate. */ export declare function discoverDecoctionCandidates(input: DecoctionDiscoveryInput): DecoctionDiscoveryOutput;