hybrid-search-implementation

hybrid-search-implementation is a skill for Claude Code, Codex from NOMARJ/sigil. It costs 35 tokens per session (3,830 once invoked), scanned A, a copy of hybrid-search-implementation, Apache-2.0.

A guide to combining vector search, which matches meaning, with keyword search, which matches exact words and terms.

In plain words
What is it for?
Use it in search engines and RAG systems where both semantic similarity and exact matching are important.
Why use it?
Using only one search method can miss either related wording or important names, codes, and technical terms.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one. Also seen: positional $N argument.

Good fit Use it in search engines and RAG systems where both semantic similarity and exact matching are important.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/nomarj/sigil/hybrid-search-implementation
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add NOMARJ/sigil --skill hybrid-search-implementation
Clone the repo
git clone --depth 1 https://github.com/NOMARJ/sigil

Made for: Claude Code, Codex.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for hybrid-search-implementation

README.md
[![agentmods](https://agentmods.dev/badge/skills/nomarj/sigil/hybrid-search-implementation/github.svg)](https://agentmods.dev/skills/nomarj/sigil/hybrid-search-implementation)
Your own site
<a href="https://agentmods.dev/skills/nomarj/sigil/hybrid-search-implementation"><img src="https://agentmods.dev/badge/skills/nomarj/sigil/hybrid-search-implementation/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for hybrid-search-implementation

Your own site · 80×15
<a href="https://agentmods.dev/skills/nomarj/sigil/hybrid-search-implementation"><img src="https://agentmods.dev/badge/skills/nomarj/sigil/hybrid-search-implementation.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 35 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 3,830 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 1 finding. A grade says what 26 rules found in the file — not that it is safe.
Origin 83% copy Near-identical to another mod in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00035 $0.03830
Opus 5 $0.00017 $0.01915
Sonnet 5 $0.00007 $0.00766
Haiku 4.5 $0.00003 $0.00383

Measured 8d ago against content hash 082542a7eb3c, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-11, from the pricing page.

Security

Grade A, and why

hybrid-search-implementation scanned grade A with 1 finding against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 8d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Makes network callslowCapability

Not a fault in itself. Listed so you know the mod talks to something, and to what.

results = await conn.fetch(f"""
Origin

This is a copy

83% identical to hybrid-search-implementation — 518 lines differ, which has more behind it and is treated as the original. This page carries a canonical link to it rather than competing with it.

packs/data/skills/llm/hybrid-search-implementation/SKILL.md · 571 lines

How it starts

The opening of the file, as written. The whole thing — 571 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Hybrid Search Implementation

Patterns for combining vector similarity and keyword-based search.

When to Use This Skill

  • Building RAG systems with improved recall
  • Combining semantic understanding with exact matching
  • Handling queries with specific terms (names, codes)
  • Improving search for domain-specific vocabulary
  • When pure vector search misses keyword matches

Core Concepts

1. Hybrid Search Architecture

Query → ┬─► Vector Search ──► Candidates ─┐
        │                                  │
        └─► Keyword Search ─► Candidates ─┴─► Fusion ─► Results

2. Fusion Methods

Method Description Best For
RRF Reciprocal Rank Fusion General purpose
Linear Weighted sum of scores Tunable balance
Cross-encoder Rerank with neural model Highest quality
Cascade Filter then rerank Efficiency

Templates

Template 1: Reciprocal Rank Fusion

from typing import List, Dict, Tuple
from collections import defaultdict

def reciprocal_rank_fusion(
    result_lists: List[List[Tuple[str, float]]],
    k: int = 60,
    weights: List[float] = None
) -> List[Tuple[str, float]]:
    """
    Combine multiple ranked lists using RRF.

    Args:
        result_lists: List of (doc_id, score) tuples per search method
        k: RRF constant (higher = more weight to lower ranks)
        weights: Optional weights per result list

    Returns:
        Fused ranking as (doc_id, score) tuples
    """
    if weights is None:
        weights = [1.0] * len(result_lists)

    scores = defaultdict(float)

    for result_list, weight in zip(result_lists, weights):
        for rank, (doc_id, _) in enumerate(result_list):
            # RRF formula: 1 / (k + rank)
            scores[doc_id] += weight * (1.0 / (k + rank + 1))

    # Sort by fused score
    return sorted(scores.items(), key=lambda x: x[1], reverse=True)


def linear_combination(
    vector_results: List[Tuple[str, float]],
    keyword_results: List[Tuple[str, float]],
    alpha: float = 0.5
) -> List[Tuple[str, float]]:
    """
    Combine results with linear interpolation.

    Args:
        vector_results: (doc_id, similarity_score) from vector search
        keyword_results: (doc_id, bm25_score) from keyword search
        alpha: Weight for vector search (1-alpha for keyword)
    """
    # Normalize scores to [0, 1]
    def normalize(results):
        if not results:
            return {}
        scores = [s for _, s in results]
        min_s, max_s = min(scores), max(scores)
        range_s = max_s - min_s if max_s != min_s else 1
        return {doc_id: (score - min_s) / range_s for doc_id, score in results}

    vector_scores = normalize(vector_results)
    keyword_scores = normalize(keyword_results)

    # Combine
    all_docs = set(vector_scores.keys()) | set(keyword_scores.keys())
    combined = {}

    for doc_id in all_docs:
        v_score = vector_scores.get(doc_id, 0)
        k_score = keyword_scores.get(doc_id, 0)
        combined[doc_id] = alpha * v_score + (1 - alpha) * k_score

    return sorted(combined.items(), key=lambda x: x[1], reverse=True)

Read the full file on GitHub · 571 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 8d ago First seen · 571 lines · 35 tokens per session scan A 082542a7eb3c

Subscribe to this mod's changes

hybrid-search-implementation is a skill published in the GitHub repository NOMARJ/sigil (5 stars, last pushed 6d ago), licensed Apache-2.0. It adds 35 tokens to every session and 3,830 once invoked, about $0.0002 per session on Opus 5. A static security scan graded it A with 1 finding (makes network calls). It is 83% identical to hybrid-search-implementation, differing in 518 lines, and is treated as a copy.

Related

Other skills, from other repositories