v11.2.0 — Hybrid Runtime Integration (Phase 5.5.2)
Added
- Hybrid Runtime Integration: New
nreki_navigate action="hybrid_search"exposes the Type Ledger semantic + BM25 lexical fusion (RRF) documented in the Phase 5 paper to the production MCP runtime. Previously only reachable via eval scripts. src/bm25-engine.ts: BM25 lexical retrieval migrated fromscripts/eval-phase5/runners/bm25-runner.ts. Standard Okapi (k1=1.5, b=0.75); code-aware tokenization (PascalCase / snake_case / camelCase decomposition, 2-char minimum). Lazy in-memory index built on firstsearch(); invalidated onindexFile()/indexDirectory()mutations.src/hybrid-engine.ts: Hybrid RRF engine. Calls NREKI semantic search + BM25 in parallel, fuses file rankings via Reciprocal Rank Fusion (k=60), deterministic tie-break bylocaleCompare. Returns unified results withsource: "nreki" | "bm25" | "both"origin tracking.- Foveal compression on BM25-only files (Reto 5): Files surfaced exclusively by BM25 (≥100 lines) receive
tfcCompresswith a focus symbol extracted from the query. NrekiEngine.getHybridEngine()+invalidateHybridIndex(): lazy-construction of the hybrid stack; BM25 cache auto-invalidates onindexFile()andindexDirectory().BM25EngineOptions.excludedDirs: configurable directory exclusion. Default excludesnode_modules,.git,.nreki,dist,build,coverage,.next,__pycache__,corpus, plus any dot-prefixed directory.scripts/benchmark-hybrid-smoke.ts: reproducible dogfood smoke bench (action="search"vsaction="hybrid_search").docs/sprint-6.5-empirical.md: honest Sprint 6.5 empirical findings + N=99 PolyBench re-bench deferral disclosure.- 28 new tests:
tests/bm25-engine.test.ts(16) +tests/hybrid-engine.test.ts(12). Full suite: 1384 pass.
Changed
nreki_navigateaction enum:hybrid_searchadded to MCP schema + router. Existing 10 actions (search,fast_grep,definition,references,outline,map,prepare_refactor,orphan_oracle,type_shape,type_graph) preserved — backward compatible.
Empirical findings (honest)
- Dogfood smoke (73 files, 8 queries):
searchrecall 60% vshybrid_searchrecall 60% (Δ=0pp). Hybrid pays 207% token overhead with no recall gain on this micro-corpus. Expected — Sprint 6.4 paper's +15pp FHR gain was measured on N=99 diverse external repos. - Sprint 6.5 N=99 PolyBench re-benchmark: DEFERRED. Reason: eval orchestrator needs re-plumbing to invoke production
HybridEngine; multi-hour wall clock. Tracked as Sprint 6.5.1 indocs/sprint-6.5-empirical.md.
Architectural decision
"El mejor que se quede" — hybrid USES the underlying retrievers, does NOT replace them. Users still pick search for pure topological queries (lower tokens) and hybrid_search for accuracy-critical retrieval (≈3-5x tokens per Sprint 6.4 paper; dogfood shows up to ~3x).