/** * embedding-config.ts — one place that decides which embedding model the * memory path loads and what dimension its vectors have (#2305). * * `embeddings init` (commands/embeddings.ts) and the `embeddings_init` MCP * tool write `/.claude-flow/embeddings.json` with `{ model, * dimension, ... }`. Before this module only those two files read it: the * memory path, the AgentDB bridge and the router's task embedder all loaded * 'Xenova/all-MiniLM-L6-v2' and assumed 384 dimensions regardless of what the * user configured. * * Precedence: `.claude-flow/embeddings.json` → defaults (MiniLM / 384). There * is no embedding-model environment override in this codebase today, so none * is invented here. * * Safety: a store that already holds vectors keeps its recorded dimension. * When the configured dimension differs, `resolveEffectiveEmbeddingConfig()` * returns the recorded shape and warns once — it never mixes dimensions in one * store and never rebuilds or rewrites existing vectors. */ export declare const DEFAULT_EMBEDDING_MODEL = "Xenova/all-MiniLM-L6-v2"; export declare const DEFAULT_EMBEDDING_DIMENSION = 384; /** Same directory + file name commands/embeddings.ts and embeddings-tools.ts write. */ export declare const EMBEDDINGS_CONFIG_DIR = ".claude-flow"; export declare const EMBEDDINGS_CONFIG_FILE = "embeddings.json"; export interface EmbeddingConfig { /** Model id passed to the transformers `pipeline()` (always namespaced, e.g. `Xenova/...`). */ model: string; dimension: number; /** `config` = read from embeddings.json; `recorded` = kept from an existing store; `default` otherwise. */ source: 'default' | 'config' | 'recorded'; configPath: string; } /** Shape of the vectors an existing store already holds. */ export interface RecordedEmbeddingShape { dimension: number; model?: string | null; } export type RecordedShapeReader = (dbPath: string) => Promise; /** * `embeddings init` records the bare name it was given (default * `all-MiniLM-L6-v2`), while the MCP tool records `Xenova/...`. The * transformers pipeline needs the namespaced id, so bare names get `Xenova/`. */ export declare function normalizeEmbeddingModel(model: string): string; /** * Resolve the configured embedding model + dimension for a project root * (default: cwd, which is where `embeddings init` writes its config). * Cached per root; never throws. */ export declare function resolveEmbeddingConfig(root?: string): EmbeddingConfig; /** * Keep an existing store's recorded dimension when it differs from the * configured one. Warns once per store; returns the configured value * untouched when there is nothing recorded or the dimensions agree. */ export declare function reconcileWithRecordedShape(configured: EmbeddingConfig, recorded: RecordedEmbeddingShape | null, storeLabel: string): EmbeddingConfig; /** * Default reader: the most recently written real (non-hash) vector in * `memory_entries`. A store with no such vector records nothing, so a fresh * or empty database follows the configuration. */ export declare const readRecordedEmbeddingShape: RecordedShapeReader; /** * The embedding config to actually use: the configured model, unless one of * the stores in `dbPaths` already holds vectors of another dimension. The * memory path writes the same vectors to memory.db and (through the AgentDB * bridge) agentdb-memory.db, so callers pass both and every caller converges * on one answer: the first store with recorded vectors wins. Cached per * (root, dbPaths). */ export declare function resolveEffectiveEmbeddingConfig(options?: { root?: string; dbPaths?: ReadonlyArray; readRecordedShape?: RecordedShapeReader; }): Promise; /** Test seam: forget cached resolutions and emitted warnings. */ export declare function _resetEmbeddingConfigCache(): void; //# sourceMappingURL=embedding-config.d.ts.map