← ClaudeAtlas

lexical-retrieval-usagelisted

This skill should be used when indexing or searching a corpus with the contextual lexical retriever (TF-IDF + BM25 fused with reciprocal-rank fusion), optionally enriching document text with LLM-generated context before indexing, or when a zero-dependency offline search over project files is needed.
josix/agentic-retrieval · ★ 0 · Data & Documents · score 72
Install: claude install-skill josix/agentic-retrieval
# Lexical Retrieval Usage Contextual lexical retrieval: TF-IDF + BM25 fused with reciprocal-rank fusion (RRF), with an optional LLM-enrichment step at index time. Pure stdlib at its core — the zero-dependency baseline every other retrieval method in this plugin is compared against. ## What it is `LexicalRetriever` (`retrieval/retrievers.py`) builds two classical sparse indexes over the same corpus — a `TfidfIndex` and a `BM25Index` — and fuses their per-query rankings with RRF (`retrieval/fusion.py`). Both algorithms match on shared **tokens**, not meaning: a document ranks highly only if it contains words the query contains (or word forms close enough for the tokenizer to treat as the same term). `ContextualLexicalRetriever` (same module) is `LexicalRetriever` plus one extra step at index time: each document's text is prefixed with a short LLM-generated context (topics + key entities) before TF-IDF/BM25 are fit. This closes the vocabulary-mismatch gap *before* ranking runs, rather than changing the ranking function itself — see Anthropic's Contextual Retrieval. A chunk-level equivalent that indexes the invoking project's own files (`ContextualRetriever` in `retrieval/index.py`, driven by `load_chunks(root)`) uses a cheap deterministic heuristic contextualizer (`retrieval/contextualizer.py`) instead of an LLM call. ## When to use it (vs turbovec / pi-serini) **Strengths:** - Zero required dependencies — pure stdlib, always available, no GPU, no embedding model, no JVM