Find out whether it was the search or the answer.

“Is our AI making things up, and is the problem the search or the answer?”

Grades answers from your documents two ways: a script checks the search found the right passage, and two trust-tested judges check every claim is in the sources and that it declines when they are silent.

RUN THE OPERATOR SYSTEMADVANCEDANTHROPIC API KEYYOUR DOCUMENTS AS MARKDOWN, FOR THE RAG SKILLS✓ APPROVED 4/4
EXAMPLE PROMPTS
>Grade my knowledge base bot. Is it sticking to our docs?
>Did it cite the right source, or is it making claims the docs do not support?
>Run a hallucination check on these answers and tell me whether search or answer failed
ABOUT THIS SKILL

What this skill does

A RAG answer can go wrong in two places, and they need different fixes.

The search can miss: the passage holding the answer never reached the model, so it either declined or worked with the wrong passages. Or the answer can drift: the right passages were there, and the model added a number they never said, swapped a figure, or filled a gap from general knowledge. A wrong answer looks the same either way. The fix does not. A search miss is fixed in your documents and your chunking. A drift is fixed in your instructions or your model.

This skill grades both, in the order that costs least:

  1. A script for the search. Each test question carries a phrase from the passage that answers it. The script checks whether any passage the model was shown contains that phrase. It also flags answers with no citation and unanswerable questions that got answered anyway.
  2. A judge for grounding. Every factual claim in the answer has to be supported by the passages shown. True in the world but absent from the passages counts as unsupported.
  3. A judge for declining. The answer has to answer when the passages hold the answer, and say "not in the sources" when they do not. A hedged guess ("probably around 20 percent") is still a guess.

Both judges are tested before they count, the same way agent-judge tests its judges: on answers you already trust, and on copies with one mistake planted.

Inputs

  • Works today with: answers saved as Markdown with three sections, ## Question, ## Sources, ## Answer. rag-explained writes exactly that. For any other system, save its output in that shape.
  • Questions with evidence: for each answerable question, a short phrase from the passage that holds the answer. Plus a few questions with no answer in your documents.
  • Answers you have read and trust: 10 or more, to test the judges on.
  • An Anthropic API key and Python 3.10 or newer.

How it works

  1. 1
    Step 1: Save answers in a gradeable shape

    Each answer needs the question, the exact passages the model was shown, and the answer, in one file. Without the passages nobody can tell a search miss from a drift. rag-explained saves this automatically.

  2. 2
    Step 2: Check the search with a script

    For each answerable question, write down a short phrase from the passage that answers it. Then check whether any passage the model was shown contains that phrase. Count misses at the passage level: the right document with the wrong passage is still a miss. The same script flags answers with no citation, and unanswerable questions that got answered.

  3. 3
    Step 3: Judge grounding

    One rule: every factual claim in the answer is supported by the passages shown. Ask the judge to work in steps (list the claims, find the passage for each, fail if any has none) and name the near misses that must pass: a faithful paraphrase, extra context from another shown passage, an answer that notes a conflict between passages.

  4. 4
    Step 4: Judge declining

    One rule, both directions: answer when the passages hold the answer, decline when they do not. Name the hedged guess as a fail, because it is the failure people miss: "the sources don't say exactly, but it's probably..." reads as careful and is still invented.

  5. 5
    Step 5: Test the judges before they count

    Plant mistakes in copies of trusted answers: an unsupported number added, a figure changed, a confident answer where the passages had none, a decline where they had one. After the first run, add a new style the rubric never saw, such as a true-sounding fact from outside the passages, and keep it out of tuning. Run everything at least twice and read every disagreement. A judge counts once it catches the planted and held-out mistakes, passes the clean answers, and gives the same verdict across repeats.

  6. 6
    Step 6: Fix the right layer
    • Passage missed: fix the documents (clearer headings, tables turned into sentences), the chunk size, or the search. Not the prompt.
    • Claim unsupported: fix the answer instructions or the model. Not the search.
    • Wrong decline or a guess: fix the instructions, and add the question to the test set.

Output format

The fictional sample from a fresh install.

RETRIEVAL CHECK
Passage found for 8 of 8 answerable questions. Uncited answers: 0.
Unanswerable questions answered: 0.

JUDGE TRUST REPORT          the fictional sample, 2 repeats, 72 judge calls, about $0.25

judge                 false alarms   planted   held out   script     consistency
                      on clean       caught    caught     caught
grounded              0 of 11        6 of 6    2 of 2     0 of 8     1.00
answers_when_it_can   0 of 11        5 of 5    1 of 1     3 of 6     1.00

MODELS
  both judges on Claude Sonnet 5.5

DISAGREEMENTS, for a person to read
  none on this run.

NEXT
  plant a mistake of your own in one answer file and rerun. a sample this small
  proves the plumbing, not the judges. trust them on your own answers.

Tips

  • The retrieval script runs before any judge, and misses are counted per passage.
  • Every judge maps to one rule, with its near misses named.
  • Both judges were tested on clean, planted, and held-out answers before their verdicts counted.
  • Held-out mistake styles were added after the first run and never used to tune a rubric.
  • Every disagreement was read by a person.
  • The judge model was chosen by a measured rerun.
  • The skill says what it cannot see: pages the system never fetched.
  • No em dashes anywhere.
RELATED SKILLS
ALL RUN THE OPERATOR SYSTEM SKILLS →