Index Design
MuninnDB maintains three concurrent indexes. All three feed into ACTIVATE Phase 2 as parallel candidate sources, merged by RRF Fusion in Phase 3.
BM25 Full-Text Search
The inverted index implements BM25 ranking (k1=1.2, b=0.75) — the same algorithm behind Elasticsearch and Lucene. On every write, concept and content are tokenized and indexed.
BM25 is the only index active with zero plugins. It handles keyword and phrase matching without embeddings.
Fuzzy matching: if BM25 returns zero results, the engine falls back to trigram similarity (n=3) as a fuzzy secondary.
HNSW Vector Index (Plugin)
When the Embed plugin is enabled, MuninnDB builds an HNSW (Hierarchical Navigable Small World) index over engram embeddings. HNSW provides approximate nearest neighbor search in O(log n) time with configurable precision/speed trade-off.
The index is persisted to disk (not rebuilt on startup) using a custom serialization format. New embeddings are added incrementally — no full rebuild required.
Adjacency Graph
Associations between engrams are stored as a weighted directed adjacency graph in the KV store. BFS traversal (Phase 5) uses this graph to surface related engrams not found by FTS or vector search.
The graph is updated automatically by the Hebbian worker as co-activation patterns emerge, and can also be updated explicitly via the SDK or REST API.