hybrid-semantic-search
Skill10 starsChanged yesterdayMITView on GitHub
Reciprocal Rank Fusion hybrid retrieval combining BM25 keyword matching and dense vector similarity
In this repository44 other files it gives its agents.
- llms-full.txtllms.txt
- llms.txtllms.txt
- ai-prompt-engineering-safety-reviewSkill
- ast-codemapSkill
- ast-grepSkill
- autoharnessSkill
- autonomous-backlog-driverSkill
- claude-kimi-mcp-normalizationSkill
- cli-self-updaterSkill
- code-frugalitySkill
- codemode-gatewaySkill
- codemode-typesSkill
- consequence-simulationSkill
- context-pruningSkill
- github-update-checkerSkill
- google-agents-cli-evalSkill
- google-agents-cli-scaffoldSkill
- history-searchSkill
- hook-gatingSkill
- kimi-code-agent-integrationSkill
- kimi-mcp-configurationSkill
- leann-vectorSkill
- log-summarizerSkill
- markdown-vagueSkill
- memory-reconciliationSkill
- mode-classificationSkill
- multiagent-orchestrationSkill
- output-compressionSkill
- prompt-injectionSkill
- python-anti-patternsSkill
- regression-sentinelSkill
- restart-trackingSkill
- rollback-guardSkill
- rust-call-graphSkill
- secrets-managementSkill
- security-best-practicesSkill
- session-compactorSkill
- sqlite-memorySkill
- swarm-barrierSkill
- swarm-dagSkill
- autoharnessSkill
- code-reliability-checksSkill
- skill-threat-rulesSkill
- autoharnessSkill
The file
We split this skill into the rules it gives an agent
4 rules. About 0 are common, 2 are distinctive, and 2 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈2
Distinctive · estimate
This author's own choices. Worth a look.
2
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 9
Use when neither keyword search (BM25) nor pure semantic vector search alone is sufficient: BM25 excels at exact symbol and variable names, …
- Very specific: line 22
Test exact symbol match: querying TopologicalSorter ranks highest via BM25 boost.
- Very specific: line 23
Test conceptual paraphrase: querying order tasks before running them ranks highest via vector boost.
- Distinctive: line 24
Test combined RRF ordering: documents present in both top lists receive the highest merged priority.
≈ “Common” is an estimate: at least 1 in 5 of the 372,429 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-semantic-search
When to use
Use when neither keyword search (BM25) nor pure semantic vector search alone is sufficient: BM25 excels at exact symbol and variable names, while vector search excels at conceptual intent and paraphrased queries.
Steps
- Execute BM25 search on SQLite FTS5 index (
memory_fts MATCH ... ORDER BY bm25(...)). - Execute vector cosine similarity search on the compact vector index (
vector_docs). - Apply Reciprocal Rank Fusion (RRF) to merge both rankings:
- For each document appearing in rank list $R$, compute: $RRF_score(doc) = \sum_{r \in R} \frac{1}{k + rank(r)}$
- Constant $k = 60$ balances influence between top-ranked items and longer tails.
- Normalize and sort merged results by combined RRF score.
- Return top-K blended results with source attribution (BM25 rank, vector cosine score, combined RRF score).
How to verify
- Test exact symbol match: querying
TopologicalSorterranks highest via BM25 boost. - Test conceptual paraphrase: querying
order tasks before running themranks highest via vector boost. - Test combined RRF ordering: documents present in both top lists receive the highest merged priority.
Facts found here
- Reciprocal Rank Fusion with $k=60$ is proven by information retrieval research to outperform either sparse (BM25) or dense (vector) alone without requiring hyperparameter fine-tuning.
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.

