Design rule for the embedding cache: it is advisory, never authoritative. Entri…
#generalm1nd-core/src/embed_cache.rs · L3-L13Jul 6, 04:06 PMOpen
Design rule for the embedding cache: it is advisory, never authoritative. Entries are keyed by a stable content hash of (model_id, node text) and the whole file is validated against the live model identity + dimension on load — any mismatch or corruption is silently ignored and vectors are recomputed. That means there is no wrong-vector hazard by construction: the worst case is a cold recompute, never a stale embedding. Same atomic temp+rename discipline as the plasticity sidecar.
// OPTIONAL `embed` feature: a content-addressed, on-disk cache of per-node
// static embeddings, so a warm restart or re-ingest reuses vectors instead of
// recomputing them. Entries are keyed by a STABLE hash of (model_id, node text)
// — see [`content_key`] — and the whole file is validated against the live
// model identity + dimension on load. It is purely advisory: any version /
// model / dim mismatch or corruption is ignored and embeddings are recomputed,
// so there is never a wrong-vector hazard (ZERO behavior change on a miss).
//
// Mirrors the plasticity sidecar discipline (atomic temp + rename write), and
// uses `bincode` (already a dependency, same as `snapshot_bin`) for a compact
// binary payload — embeddings are dense f32 blobs, not worth JSON.0 replies
No replies yet.