P1 · RETRIEVE AND ANSWER HONESTLY

Retrieval built for the moment confidence runs out.

LIVEv1.0.0 · main 3b54d85 · CI greenVerified 2026-08-14

Most retrieval demos answer every question. This one is designed around the case that costs a company money: the corpus does not contain the answer. Dense and sparse search run over the same collection and fuse with reciprocal rank fusion, a cross-encoder reranks and degrades ordering rather than availability, and the generated answer is accepted only when every [n] marker resolves to a block that was actually in the prompt. When it does not, the system refuses and says why. Hire this if you need retrieval a reviewer can audit line by line.

CLONE · runs at $0

git clone https://github.com/pabloalvarez99/production-rag

No .env required. The default embedder, LLM, and judge are deterministic local fakes, so the demo costs $0 and reads no key.

LIVE

Every line here is backed by a test, a route, or a file in the repository at v1.0.0 · main 3b54d85 · CI green.

  • Dense + sparse retrieval in Qdrant, fused with RRF, with an optional cross-encoder rerank that fails open on ordering rather than dropping availability.
  • Citation markers validated against the prompt blocks, not against a later hit list, so a marker that cannot resolve becomes a refusal.
  • Refusal as a first-class terminal outcome, distinct from a dependency failure, which reports itself as an error instead.
  • A server-rendered query UI pinned to the local providers, carrying the allowlisted metadata filter control, additive stream, and filter-aware cache on main 3b54d85.
  • Allowlisted metadata filters on every query path, fail closed, with a typed 422 for a field posted by hand (ADR 0011).
  • Two evaluation tiers with paired statistics, and scorecard publication that fails closed.

NOT SHIPPED

The boundary, stated before you find it yourself. Nothing below is presented as built, hidden in a footnote, or described as coming soon.

  • No hosted-provider quality numbers. The published scorecard comes from deterministic local providers: it proves the measurement path works and says nothing about retrieval or answer quality.
  • No authentication, authorization, or rate limiting. A metadata allowlist bounds which fields a query may filter on, never which documents a caller may see.
  • No metrics endpoint. The configuration shape exists and is marked DECLARED; the route does not.
  • No retry, timeout, or circuit-breaker policy, no multi-tenancy, and no load or concurrency figure.
  • No judge validated against human labels. The tier-2 judged columns are indicative and every report says so.
  • Not hosted. Hybrid retrieval needs a local Qdrant, so this system is clone-and-run until that changes.

Capture

One image from the repository at the commit named in the caption.

Production RAG returning a grounded answer with resolvable citations and pipeline timings
Grounded answer with citations, from the free local stack. Source file

INTERVIEW THIS SYSTEM

Three questions worth asking, and the answers I would give.

Published in advance, because a trade-off I can only defend when nobody has read it first is not a trade-off I understand.

  1. 01

    Why RRF instead of a weighted sum of the dense and sparse scores?

    A weighted sum needs the two score distributions to be comparable, and they are not: cosine similarity and BM25 live on different scales that shift with the corpus. RRF only reads rank, so it needs no calibration and no per-corpus tuning constant.

  2. 02

    Why must a citation marker resolve against the prompt blocks rather than the retrieved hit list?

    The hit list is what retrieval found; the prompt is what the model could actually see. Validating against the hit list would accept a marker pointing at a document that was truncated out of context — a citation that looks resolvable and is not.

  3. 03

    The filter allowlist is a field allowlist. Why is that not access control?

    It bounds which fields a query may filter on, never which documents a caller may read. Anyone who reaches the port can query everything. The hardening lives in P5, and saying so is cheaper than discovering it in an audit.

Keys

How to turn the pages

On
15
Open a chapter
g h
Home
g i
Interview kit
g s
Studio
/ or CtrlK
Jump: type a word, not a command
?
This page
Esc
Close it again

Chapters

  1. 1
    01 Production RAGRetrieve and answer honestly
  2. 2
    02 Agentic ResearchAct with tools under budget
  3. 3
    03 Multi-Agent OrchestrationCoordinate specialists
  4. 4
    04 RepoMindUnderstand codebases
  5. 5
    05 AI PlatformOperate the system

Keys sleep while a field has focus, so typing a g into the jump box types a g.