You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This commit was created on GitHub.com and signed with GitHub’s verified signature.
Add neighbor expansion for contiguous RAG context (X19 Stage 3) (#324)
Pulls chunks adjacent to each retrieval hit into the RAG context for contiguous reading.
- VectorIndex.ExpandNeighbors: chunk_index ± radius within the same file, bounded to the hit's section (else page), clamped at file edges, merged into contiguous runs ordered by hit rank. Neighbors hydrate from stored text (no embedding, no reindex).
- RetrievalResult.IsNeighbor flags context chunks (no score, excluded from topK).
- RagPromptBuilder budgets hit-first: matched chunks claim the budget before neighbors, which stay adjacent and are never shown alone.
- PortableConfig.RetrievalNeighborRadius (default 1, 0 = off); ChatService expands after retrieval.
Eval stays retrieval-only (expansion is context delivery, not ranking), so the 0.90 baseline is unaffected; expansion is covered by unit tests.
PR2 of X19; completes the hybrid retrieval overhaul.