Skip to content
LucasSantana-DevPublic

About

Portable hybrid (BM25 + dense + RRF) retrieval engine and a label-free evaluation harness — extracted from a personal AI-assistant memory index and decoupled to run on any source tree.

Topics

Resources

Contributing

Stars

4 stars

Watchers

0 watching

Forks

Repository files navigation

hitgate

eval-gate (advisory) Python 3.10+ License: MIT

An evaluation harness for hybrid RAG retrieval (BM25 + dense + RRF): label-free evals and a CI gate that fails when ranking regresses.

A real hitgate run: the hybrid retriever passes the gate, a BM25-only change fails it

Real run, outputs captured with timestamps. The ~10 s eval waits are sped up and labeled.

Measured results

99 golden cases over this repo, pure retrieval, no reranker. Reproduce with the commands in docs/benchmarks.md.

Retriever Hit@1 Hit@5 MRR
BM25 only 0.747 0.909 0.804
Dense only 0.646 0.899 0.744
Hybrid (BM25 + dense + RRF) 0.616 0.990 0.765

Hybrid is the only mode that keeps Hit@5 near 1.0 (+8 to +9 points). BM25 still wins Hit@1 and MRR on this identifier-heavy corpus, and that stays in the table on purpose. On six external corpora with zero tuning, Hit@5 ranges from 0.741 to 1.0 (benchmarks). Self-indexed sets are optimistic by construction: use them to compare two configurations, not to certify quality.

Install

pip install "hitgate[hybrid]"   # harness plus the bundled hybrid retriever; the core has no dependencies

Quickstart

hitgate-demo .                                # index this repo, mine a golden set, measure Hit@K and MRR
hitgate-init . --output eval/golden.jsonl     # keep the golden set, curate it, freeze a baseline
hitgate-compare ci.json baseline.json         # exit 1 when any gated metric drops more than 5 points

The gate loop (run, freeze, compare) and how to point it at your own retriever (--retriever mypkg:retrieve) are in docs/byo-retriever.md.

Agent context: does your skill or memory edit still reach its target?

The same gate runs over a context directory (skills, memory notes, agents) with no index and no extra dependencies:

hitgate-context ~/.claude/skills --label before   # freeze
# edit a skill description, add a skill, rewrite a memory note
hitgate-context ~/.claude/skills --label after --baseline context.before.json   # exit 1 if any case lost its hit

Cases are mined from the corpus itself: each skill's trigger phrases must rank that skill's description first; each note's description must rank its own body first. The shadowing report names the document that won instead. It is a lexical proxy for discoverability, not a judgement of the model's choice (ADR-0015).

What it does, and does not

  • Detects retrieval regressions between two runs, with zero labeled data to start.
  • Gates Hit@1/3/5, MRR and a per-intent breakdown. Plugs into any callable (query, top, scope) -> [results].
  • Does not measure absolute quality, and is not a framework, a hosted service or a maintained product.
  • Complements answer-level tools such as RAGAS and DeepEval. It gates the retrieval layer, label-free (comparison).

Documentation

Everything else lives in docs/:

License

MIT, see LICENSE.

About

Portable hybrid (BM25 + dense + RRF) retrieval engine and a label-free evaluation harness — extracted from a personal AI-assistant memory index and decoupled to run on any source tree.

Topics

Resources

Contributing

Stars

4 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages