agentleFS
stevemarksavastevemarksava/superteam/skills/semantic-search/SKILL.md

semantic-search

Skill1 starsChanged 2 months agoMITView on GitHub

Vector-embedding retrieval plus hybrid ranking — corpus, query, embeddings, BM25 fusion, scored results with rationale.

5 other projects use a version of this.

Adopted by

Most recently taken up by

The file

We split this skill into the rules it gives an agent

3 rules. 0 are common, 3 are distinctive, and 0 are very specific to this project.

  • 0

    Common

    Most of the 5 edited versions we read keep these.

  • 3

    Distinctive

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

    Hybrid rank: Run BM25 (sparse, lexical) over the corpus in parallel with vector cosine similarity (dense, semantic).

    line 21
  2. Distinctive:

    Never mix embeddings from different models in the same index — score comparisons are meaningless

    line 31
  3. Distinctive:

    Always run hybrid (dense + sparse) unless the query is a pure semantic paraphrase — lexical catches exact-term hits dense misses

    line 32

“Common” is measured: kept by at least 6 in 10 of the 5 edited versions of this file we could read. “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

/semantic-search — Hybrid Vector + Lexical Retrieval

Semantic search is a workflow, not a library. The right embedding model depends on corpus size, latency budget, and quality bar. Hybrid ranking (dense + sparse) beats either alone. Every result carries a score and a reason.

When to invoke

  • Athanasios needs to find prior art across .squad/decisions/ or past reports
  • Superman asks "have we already decided this?"
  • Coach is deduplicating near-identical patterns across game tapes
  • Kevin is writing a section and needs related docs surfaced

Steps

  1. Define corpus and query. Enumerate the document set (paths, IDs, count, total tokens). Write the exact query you will run against it. Small corpus (<10k docs) — in-memory is fine. Large — plan a vector store (Azure AI Search, pgvector, Qdrant). Verify current versions at author time.
  2. Choose the embedding model. Verify latest at author time — as of this skill, OpenAI text-embedding-3-large (3072-dim, English + multilingual) or text-embedding-3-small (1536-dim, cheaper) are the defaults. On Azure OpenAI, deploy text-embedding-3-large in a region that supports it. For fully Microsoft-native, evaluate MAI embeddings when GA. Do not pull a model ID from memory — check the vendor docs.
  3. Generate embeddings. Batch the corpus (100–500 docs per API call). Store the vectors keyed by doc ID. Cache — embeddings are re-generatable but not free. Log the model ID and dimension alongside the vectors so the index knows what it holds.
  4. Hybrid rank. Run BM25 (sparse, lexical) over the corpus in parallel with vector cosine similarity (dense, semantic). Fuse scores with Reciprocal Rank Fusion (RRF, k=60 is a sensible default) or a weighted blend. Take top N (typically 5–20).
  5. Return with scores and rationale. For each result: dense score, sparse score, fused rank, and a one-line rationale ("matches on query term X + close in embedding space to phrase Y"). Include the doc ID / path so the caller can open it.
  6. Log cost. Note the number of embeddings generated and the per-call cost. Push to G's pricing.json if this runs regularly.

Deliverable format

  • Ranked list of results — top N, each with {doc_id, dense_score, sparse_score, fused_rank, rationale, path}
  • Embedding model ID and dimension noted
  • Corpus size and total embedding cost for the run

Non-negotiables

  • Never mix embeddings from different models in the same index — score comparisons are meaningless
  • Always run hybrid (dense + sparse) unless the query is a pure semantic paraphrase — lexical catches exact-term hits dense misses
  • Pin the embedding model version in the index metadata — re-embed on model upgrades
  • Cost-log every batch — this is a per-token API surface

References

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.