agentleFS
D-SheyD-Shey/autoharness/.agents/skills/hybrid-semantic-search/SKILL.md

hybrid-semantic-search

Skill10 starsChanged yesterdayMITView on GitHub

Reciprocal Rank Fusion hybrid retrieval combining BM25 keyword matching and dense vector similarity

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
  1. Distinctive:

    Use when neither keyword search (BM25) nor pure semantic vector search alone is sufficient: BM25 excels at exact symbol and variable names, …

    line 9
  2. Very specific:

    Test exact symbol match: querying TopologicalSorter ranks highest via BM25 boost.

    line 22
  3. Very specific:

    Test conceptual paraphrase: querying order tasks before running them ranks highest via vector boost.

    line 23
  4. Distinctive:

    Test combined RRF ordering: documents present in both top lists receive the highest merged priority.

    line 24

≈ “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.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

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

  1. Execute BM25 search on SQLite FTS5 index (memory_fts MATCH ... ORDER BY bm25(...)).
  2. Execute vector cosine similarity search on the compact vector index (vector_docs).
  3. 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.
  4. Normalize and sort merged results by combined RRF score.
  5. Return top-K blended results with source attribution (BM25 rank, vector cosine score, combined RRF score).

How to verify

  1. Test exact symbol match: querying TopologicalSorter ranks highest via BM25 boost.
  2. Test conceptual paraphrase: querying order tasks before running them ranks highest via vector boost.
  3. 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.

Download now (ZIP)

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
What did you use it for? e.g. Reviewing pull requests in a Rails app

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.