hybrid-retrieval-usagelisted
Install: claude install-skill josix/agentic-retrieval
# Hybrid Retrieval Usage
Combine two or more retrieval methods with reciprocal rank fusion (RRF), and
decide when a single method is enough versus when to fuse or contextualize.
## What it is
`retrieval/fusion.py::reciprocal_rank_fusion(rankings, k=60)` takes a list of
ranked lists (each an ordered list of document indices, best first) and
returns a single fused ranking, scored by `sum(1 / (k + rank + 1))` across all
lists a document appears in. `LexicalRetriever` already uses this internally
to fuse its own TF-IDF and BM25 rankings; the same function fuses rankings
**across** retrievers — e.g. `LexicalRetriever` + `TurbovecRetriever` — to get
the benefit of both token-matching and semantic-matching signals in one
ranked list.
The same lexical + dense fusion also ships prepackaged as a first-class
strategy: `retrieval.retrievers.HybridRetriever` (REGISTRY key `hybrid`,
built via `build_retriever("hybrid")`) indexes a `LexicalRetriever` and a
`TurbovecRetriever` over the same corpus and fuses their rankings with RRF at
search time — this is what `retrieval index`/`query --retriever hybrid`
use. It needs the same `turbovec` + `local` extras as `TurbovecRetriever`
(indexing raises their guidance `RuntimeError` when absent). Use the class
when you want the standard lexical+dense pairing; use the manual
`reciprocal_rank_fusion` recipe below when fusing a different pair (e.g.
lexical + Lucene) or more than two arms.
Contextualization is a complementary, index-time lever (not a