hybrid-search-advisor
Skill3 starsChanged 4 months agoMITView on GitHub
Design hybrid search strategy combining dense vector retrieval and sparse keyword search (BM25) with fusion ranking. Use when working on RAG pipelines, chunking, embeddings, retrieval, or hybrid search.
In this repository59 other files it gives its agents.
- agent-memory-designerSkill
- ai-cost-optimizerSkill
- ai-evaluation-builderSkill
- ai-latency-optimizerSkill
- ai-solution-architectSkill
- ai-workflow-builderSkill
- context-engineeringSkill
- human-in-the-loop-designerSkill
- multi-agent-plannerSkill
- prompt-engineerSkill
- prompt-optimizerSkill
- prompt-reviewerSkill
- adr-generatorSkill
- api-designerSkill
- architecture-reviewSkill
- component-diagram-builderSkill
- container-diagram-builderSkill
- data-flow-analyzerSkill
- integration-plannerSkill
- observability-plannerSkill
- scalability-advisorSkill
- solution-architectureSkill
- system-context-builderSkill
- experiment-designerSkill
- go-to-market-plannerSkill
- pricing-strategy-advisorSkill
- mcp-best-practicesSkill
- mcp-client-generatorSkill
- mcp-security-reviewSkill
- mcp-server-generatorSkill
- mcp-tool-generatorSkill
- acceptance-criteria-generatorSkill
- analytics-instrumentation-plannerSkill
- competitive-analysisSkill
- epic-generatorSkill
- feature-prioritizationSkill
- idea-validatorSkill
- north-star-metric-advisorSkill
- okr-builderSkill
- persona-generatorSkill
- prd-generatorSkill
- problem-statement-builderSkill
- product-discovery-assistantSkill
- product-vision-builderSkill
- sprint-plannerSkill
- story-mappingSkill
- user-story-generatorSkill
- value-proposition-designerSkill
- chunking-strategy-advisorSkill
- embedding-strategy-advisorSkill
- knowledge-ingestion-plannerSkill
- rag-architecture-designerSkill
- retriever-optimizerSkill
- ai-governance-advisorSkill
- ai-threat-modelingSkill
- guardrails-builderSkill
- owasp-llm-reviewerSkill
- prompt-injection-detectorSkill
- skill-nameSkill
The file
We split this skill into the rules it gives an agent
3 rules. About 0 are common, 3 are distinctive, and 0 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈3
Distinctive · estimate
This author's own choices. Worth a look.
0
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 33
If none apply, document why dense-only is sufficient.
- Distinctive: line 112
Start with RRF (no weight tuning needed).
- Distinctive: line 113
Use query classification only when eval shows benefit.
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Hybrid Search Advisor
Purpose
Design hybrid search strategy combining dense vector retrieval and sparse keyword search (BM25) with fusion ranking.
Input: Query patterns, retrieval failure analysis, corpus characteristics
Output: Hybrid search specification with fusion method, weights, and evaluation plan
Examples: See examples.md for worked input/output.
Workflow
Step 1: Assess hybrid search need
Indicators for hybrid:
- Exact match queries (IDs, codes, names)
- Technical vocabulary not in embedding training
- Low recall on keyword-specific queries in failure analysis
- Mixed query types (semantic + exact)
If none apply, document why dense-only is sufficient.
Step 2: Design dual retrieval paths
| Path | Method | Index | Strength |
| Dense | Vector similarity | Vector DB | Semantic |
| Sparse | BM25 / TF-IDF | Inverted index | Exact match |
Step 3: Select fusion strategy
| Method | How | When |
| Reciprocal Rank Fusion (RRF) | Rank-based merge | Default, robust |
| Weighted sum | Score normalization + weights | Calibrated scores |
| Cascade | Sparse filter → dense rerank | Large corpus |
| Learned fusion | ML ranker | Sufficient training data |
Recommend with rationale.
Step 4: Tune weights
| Query type | Dense weight | Sparse weight |
| Semantic | 0.8 | 0.2 |
| Exact match | 0.2 | 0.8 |
| Mixed | 0.5 | 0.5 |
Define query classifier or use RRF without weights.
Step 5: Plan evaluation
Compare on golden set:
- Dense-only vs sparse-only vs hybrid
- Metrics: recall@k, MRR, latency
Step 6: Validate
Run Validation checklist.
Decision Rules
| Condition | Action |
| All queries semantic | Hybrid may be unnecessary; document decision |
| Exact match failures > 20% | Recommend hybrid with RRF |
| Latency budget tight | Consider cascade over parallel dual search |
| No sparse index exists | Plan BM25 index alongside vector index |
| Small corpus (<1000 chunks) | Sparse-only may suffice; compare before hybrid |
Validation
- Hybrid need assessment documented
- Both retrieval paths specified
- Fusion method selected with rationale
- Weight or RRF strategy defined
- Eval plan comparing dense/sparse/hybrid
- Latency impact of dual search estimated
- Query type routing rules if applicable
Anti-patterns
- Hybrid by default — adding BM25 without failure evidence.
- Unnormalized fusion — combining incomparable score scales naively.
- Double latency — parallel search without timeout budget.
- Ignoring sparse maintenance — stale keyword index.
- Fixed weights — same weights for all query types.
Best Practices
- Start with RRF (no weight tuning needed).
- Use query classification only when eval shows benefit.
- Index same chunks in both systems with shared IDs.
- Monitor per-path contribution in production logs.
- Align with retriever-optimizer failure analysis.
Output Structure
# Hybrid Search Strategy: [System Name]
## Need Assessment
[Why hybrid or why not]
## Architecture
```mermaid
[dense + sparse + fusion diagram]Fusion
Method: RRF | Weighted | Cascade Config: [parameters]
Weights by Query Type
| Type | Dense | Sparse |
Evaluation Plan
| Config | Recall@5 | MRR | Latency |
Implementation Notes
[Index sync, shared IDs]
---
# Next Skills
| Outcome | Recommended Skill |
|---------|-------------------|
| Query rewriting | `rag/query-rewriter` |
| Hallucination check | `rag/hallucination-analyzer` |
| Retriever tuning | `rag/retriever-optimizer` |
| RAG evaluation | `rag/retrieval-evaluator` |Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

