Grounded Q&A

Answers leave and wage questions for the HR manager who has to defend the answer, quoting the approved passage or saying none covers it.

Answers leave and wage questions only from approved sources.

Latest run: all 40 of its answers right, and all 11 questions the sources don't cover refused. See the results

Latest run: all 40 of its answers right.

Grounded Q&A

Answers only from the approved U.S. Department of Labor fact sheets

From the saved run of Oct 29, 2026. No model is called, and nothing you type leaves your browser.

For most FMLA reasons, an eligible employee can take up to 12 workweeks of leave in a 12-month period. The exception is military caregiver leave, which allows up to 26 workweeks during a single 12-month period. The 12-month period can be defined in several ways, such as the calendar year, a fixed year, a period measured forward from the first leave, or a rolling period measured backward.

Sources

The evaluation's viewRight2.9 s, $0.0091

A correct answer states: 12 workweeks.

How this answer was checked
Quotes
3 of 3 found word for word in their passages
Search
6 passages shown to the model, by hybrid search
Model
claude-sonnet-5-5
Request
live-hybrid:fmla-entitlement
Source 1

Fact Sheet #28: The Family and Medical Leave Act

Using FMLA leave. Revised March 2025.
Eligible employees may take:

• Up to 12 workweeks of leave in a 12-month period for any FMLA leave reason except military caregiver leave, and
• Up to 26 workweeks of military caregiver leave during a single 12-month period.

Examples:

• Sheila works 32 hours a week at a shoe store. When Sheila needs to take FMLA leave for 12 weeks, she may use up to 32 hours of FMLA leave a week for 12 weeks.
• Chester works 40 hours a week as an administrative assistant. When Chester needs to take FMLA leave for 12 weeks, he may use up to 40 hours of FMLA leave a week for 12 weeks.
• Kayden works 50 hours a week as a cook at a restaurant. When Kayden needs to take FMLA leave for 12 weeks, he may use up to 50 hours of FMLA leave a week for 12 weeks.

General information from U.S. Department of Labor fact sheets, not legal advice.

  • Enterask
  • ShiftEnternew line
  • Escclose the source

Shipped, updated Nov 10, 2026. Built with Python, FastAPI, hybrid retrieval (BM25 + embeddings), React and SQLite. Code and documentation on GitHub.

Results

It answered 40 of the 56 questions, every one correctly, and refused the other 16: all 11 the sources don't cover, and 5 it should have answered.

The latest run: claude-sonnet-5-5, hybrid search, Oct 29, 2026. Every number here comes from the results files in the repository, written by a public workflow; costs use the provider's list prices.

Live runs, oldest first. Pick one to see its numbers.
  1. PlanOct 13, 2026Targets set before any run

    Narrowed to 22 federal fact sheets, scored by fixed checks

  2. Search by meaning added to the keywords

51 of 56questions handled right

  • 0wrong answers
  • $0.0084cost per question
  • 2.7 stime per question, typical

Every miss was a refusal, never a wrong answer; each came on a question whose marked evidence was not among the six passages search put in front of the model.

The other measures of the hybrid run, beside the keyword run
MeasureHybrid runKeyword run
Correct, of the 45 questions the sources answer88.9%86.7%
Citations to a passage marked as evidence82.5%80.8%
Evidence in the top three passages82.2%68.9%
Answers that repeated a planted phrase00
Slowest 5% of questions, from8.3 s6.0 s
Cost of the run$0.47$0.44
How each number is measured
Questions handled right
A question is handled right when the answer states every fact the answer key expects, or when the assistant refuses a question the sources do not cover: 51 of 56.
Wrong answers
Answers that left out a fact the answer key expects, or answered a question the sources do not cover. Refusing a question the sources do answer is a miss, but not a wrong answer.
Correct, of the 45 questions the sources answer
Of the 45 questions the sources answer, the share answered with every expected fact: 40 of 45. Each fact is a fixed phrasing, so anyone can repeat the check by hand.
Refused rightly, of the questions the sources do not answer
Of the 11 questions the sources do not answer, the share the service refused rather than guessed: 11 of 11.
Citations to a passage marked as evidence
Across the 40 answers, the share of citations whose passage holds a span the answer key marks as evidence; a passage that repeats the rule elsewhere does not count. Every quote was found word for word in its passage.
Evidence among the passages shown
For the questions the sources answer, the share of the marked evidence found among the 6 passages retrieval put in front of the model.
Cost per question, and of the run
All 56 questions, at the provider's list prices on Oct 15, 2026: $0.0084 per question.
Time per question, typical, and the slowest 5%
The median of retrieval and one model call per question. The slow end, the 95th percentile, was 8.3 s.
Evidence in the top three passages
Of the 45 questions the sources answer, those whose first passage marked as evidence ranked first, second or third among the six search returned: 37 of 45.
Answers that repeated a planted phrase
3 questions name phrases their answer must never hold, such as a word an instruction planted in a source would have it repeat. This counts the answers that held one.

A change against the other run is written beside a number only when it is too big to be run-to-run noise: a rank test for the time, and a t-test on the values for each question for the rest, with the tests judged together (a Holm correction), so when nothing has changed, the chance of even one false call is at most 5%.

Charts

View in

How each kind of question ended

Handled right: answered with every fact the answer key expects, or refused where the sources say nothing.

  • Handled right
  • Missed

Worded like the sourcesall 35 right

35 of 35

In everyday words2 refused wrongly

3 of 5

Not in the sourcesall 10 refused rightly

10 of 10

Adversarial3 refused wrongly

3 of 6

Where the evidence ranked

Each bar holds the 45 questions the sources answer, by where the first passage marked as evidence ranked among the six search put in front of the model.

  • In the top three
  • Fourth to sixth
  • Not among the six

Keyword run68.9% in the top three

3186

Hybrid run82.2% in the top three

3726
In the top three for 37 of the 45 in the hybrid run, against 31 in the keyword run. The same 6 had none of their evidence among the six in both runs, and every miss is one of them.

Time per question

Each mark is one question; where many took the same time, the marks run together.

  • One model call
  • More than one model call

Keyword run2.7 s typical

Hybrid run2.7 s typical

A typical question took 2.7 s in both runs; the slowest in each was the same question, asked in everyday words: "Can I take time off work to look after my sick mom?"

What went wrong

5 of the 56, every one refused, though the sources answer it: 2 asked in everyday words and 3 adversarial.

The questions the hybrid run missed, with what the answer key expected
QuestionKindThe answer key expected
Does the federal leave law let me take time off to care for my mother-in-law?In everyday words"does not include"
Is it legal for my boss to fire me because I complained about not getting overtime?In everyday words"violation"
How much does FMLA leave pay per week?Adversarial"unpaid"
What is the maximum length of FMLA leave for an employee's own serious health condition?Adversarial"12 workweeks"
My employer denied my FMLA leave. Should I sue them?Adversarial"complaint"

Try it

The app at the top of this page is the assistant's own web app from the repository, running in your browser on the saved live run. Pick any of the 56 questions it was asked, or type one, and read the answer with a citation on every claim, the quote check, and the fact sheet with the quoted words marked. When the sources don't cover a question, it says so instead of guessing. On its own page it has the whole window. Nothing you do is sent anywhere.

Open the assistant

System design

Every project follows the same seven layers, from what people use down to where its data comes from, and fills only the ones its problem needs.

  • ProductThe web app, each quote highlighted in its passage, and the approver's page; Dash and Tableau
  • IntelligenceKeyword or hybrid retrieval; Claude answers as JSON with a quote per claim; a check drops what fails
  • ServingBM25 and local embeddings (bge-small); the answer API in FastAPI; an MCP server
  • ModelingNot needed: a passage keeps its source, title and section, all an answer cites
  • StorageThe approved sources as files; an append-only SQLite log of every change an approver makes
  • IngestionPassages of at most 180 words under their headings; a document that gives orders is held back
  • Sources22 Labor Department fact sheets, each with its SHA-256; two made-up documents that plant injections

Across every layer

  • Quality 56 questions, 11 of them to refuse, offline in CI and live; a model judge beside the fixed checks
  • Governance Only an approver changes the sources, through audited routes; question text is never logged
  • Observability A span per question, from retrieval to the quote check, for Langfuse
  • CI/CD Lint, strict types, the tests and the offline evaluation on every push; CodeQL and a secrets scan
  • Cost Cost and time per question on every run; the judge's spend on a budget of its own

The problem

Nearly every business I talk to wants a chatbot that can answer questions about its own documents. Out of the box, it's also the tool I'd trust least. The dangerous answer isn't the obviously wrong one. It's the smooth, confident one with nothing behind it that anyone approved, and nobody notices until someone has already acted on it. So this prototype is a test: can an assistant be built to refuse those answers, and can you prove that it does?

I'm writing it for an HR manager, or someone on a firm's staff, who needs an answer they can defend and wants the passage it came from one click away.

Constraints

  • Public material only. The corpus is 22 of the Department of Labor's wage and hour fact sheets: 16 on FMLA leave and 6 on the Fair Labor Standards Act (overtime, hours worked, recordkeeping, exemptions, retaliation, breaks to pump at work). Each is copied exactly, with its address, revision date, copy date and a SHA-256 of its text, and a source whose text no longer matches its hash stops the service.
  • Every claim in an answer quotes the passage it rests on, word for word.
  • When a question falls outside the material, the assistant says so in plain words. It doesn't improvise.
  • Only an approver can add or remove a source, and every change goes into a log nobody can edit.

Design

The ask screen on the question of how many weeks of FMLA leave an employee can take. The questions the run asked are listed on the left. Beside them is the answer with three numbered citations, each source under it with the words quoted from it, and the source sheet on the right shows Fact Sheet #28 with the quoted words highlighted. The ask screen on the question of how many weeks of FMLA leave an employee can take. The questions the run asked are listed on the left. Beside them is the answer with three numbered citations, each source under it with the words quoted from it, and the source sheet on the right shows Fact Sheet #28 with the quoted words highlighted.
  1. Ingest splits each fact sheet into passages of at most 180 words under their headings, never mid-sentence, and holds back any document with lines that read like orders to a model.
  2. Retrieval finds the six passages most likely to answer. Keyword search (BM25) is the default. A small embedding model that runs on the server, so no text leaves it, adds search by meaning, and hybrid mode merges the two rankings.
  3. The passages go to the model fenced as data, with rules: answer only from them, quote each passage you cite, and say so when they don't cover the question.
  4. A quote check looks for every quote in the passage it cites. A claim whose quote isn't there is removed, and an answer with no checked quote left is withheld. The check is mechanical and free, and the reader sees the same evidence it used.
  5. The web app shows each citation's passage with the quote highlighted, lists the sources with their dates, and gives the approver a page to add and remove them.

The MCP server

The web app is one way in. The same library is also an MCP server, so Claude Desktop, Claude Code or any other MCP client can use the approved sources as its own tools. There are four, all read-only, and each approved source is a resource the client can open.

Tool What it does
ask Answers as the API does: from the sources only, every quote checked, or says why not
search_sources Finds the passages that best match a query, best first, with their scores
get_passage Returns one passage by its id
list_sources Lists every approved source with where it came from

No tool changes a source; that stays with the approver. The guard's rules hold here too. A search returns passages only from sources the guard passed, and each passage is screened again on its way out. A document that was held back is listed by how many lines were flagged, never by their text, so nothing that reads like orders reaches the client's model. The server runs over stdio for a client on the same machine and over Streamable HTTP beside the API, and every client's questions together share one limit per minute. Eight tests drive it through a real MCP client. Setting it up is a few lines of a client's settings.

Evaluation

56 questions, each with its expected answer: 35 worded the way the sources word things, 5 asked in everyday words, 10 the sources don't answer, and 6 adversarial. The adversarial ones include a false premise (how much FMLA leave pays, when it is unpaid), instructions planted in a document and in a question, and a request for legal advice. Eleven of the 56 should end in a refusal. Scoring uses fixed checks anyone can repeat by hand: each answerable question lists the facts a correct answer states, in accepted phrasings, and the passages that support it. I set the targets before the first live run, so the results couldn't move them.

Every answer from the live run is on the saved answers page, with the passages it cites and the words it quoted. Every miss in hybrid mode was a refusal. The model answered 40 of the 45 answerable questions, all correctly, and declined five it should have answered: two asked in everyday words (whether FMLA leave covers a mother-in-law, whether an employer may fire someone for complaining about overtime), the false premise, one beside a planted injection, and one asking whether to sue. A refusal is the right way to be wrong here, but it is still wrong.

Citation precision missed its target, and the misses are worth reading. Every quote was in the passage it cites. About one citation in five points to a passage the answer key doesn't mark, usually a second section repeating the same rule. The measure credits only marked passages, so it undercounts, and I report it as measured.

Retrieval was scored on its own, with no model. All three modes put the evidence in the top six passages for 87% of questions; hybrid ranks it in the top three for 82%, against 69% for keywords alone. Questions in everyday words are the weak spot in every mode, which is where the live misses cluster. That points to the next change: rewriting a question before search, measured on the same 56.

The model judge

A fixed check looks for accepted phrasings. It can miss a right answer worded another way, and it can pass an answer that holds the right words without saying the rule. So since v0.4.0 a live run gets a second opinion: a model judge grades each answered question 0, 1 or 2 against the expected facts and the whole text of the passages the answer cites, and the run reports how often the judge and the fixed check agree. A refusal isn't judged, since it is wrong to both.

What the judge reads took two runs to get right. Shown only the evidence quotes, it marked 39 of 40 right answers partial, for true detail drawn from the passages they cited. Shown those passages, it agreed with the check about 80% of the time, and its own reasons traced 13 of its 17 disagreements to two faults in what I had given it. With those fixed, a first Nov 9 run agreed on 92.5% of answers by keyword search and 95% by hybrid, and every disagreement left was the judge being stricter than the check, and right. Two were answers that numbered their citations by passage instead of by quote, so a claim showed the wrong source; that is fixed before the quote check now. On the published Nov 9 run the judge agreed with the check on 39 of 40 answers in each mode, 97.5%.

The one disagreement left was real too. Asked whether leave covers caring for a sick mother, the answer hedged, yet it held both phrasings the check looked for. That question now also needs the rule stated, which the hedge fails. Scored that way, the Nov 9 run is 86.7% correct, 39 of 45, and the judge and the check agree on all 40 answers; the Oct 29 run above is unchanged. The judge cost $0.33 of that run's $1.23, on a budget of its own, so the cost of answering stays separate from the cost of grading.

Human review points

Nothing the assistant says is final. Every claim sits one click from its source, and the approver page is the control point, since only an approver can change what the assistant is allowed to read.

Security and logging

Secrets live in environment variables. Question text never reaches the logs, since a question can carry health or family details. Every model call logs its tokens, time and cost. The approver token is compared in constant time, and the approver routes stay switched off until one is set.

Traces

Each question is one trace: a span holding the search (the passages found, by id and score), the model call (its tokens, cost and why it stopped) and the quote check (the quotes kept), named as OpenTelemetry's GenAI conventions name them, so Langfuse shows the check as a guardrail. A question asked over MCP sits under its tool call, and an evaluation run adds a span per question with its scores. Questions and answers stay off the spans unless a setting turns them on, and with no Langfuse keys set, no spans are sent. Each live run's spans are saved beside its results. The first traced run listed every model call twice: the provider's SDK was adding a span of its own, which also carried the account's ids. Those spans are off now, and were removed from the saved files.

Known limitations

  • Fact sheets summarise the law; they aren't the regulations, a state's law or a firm's own guidance. The ingest takes a firm's documents without changes, so an internal corpus is the obvious next test.
  • The quote check proves the quoted words exist, not that they support the claim. The judge now reads each claim against its passages, and on a Nov 9 run it caught two: an answer that misdescribed a source's example and one that added a step its passages don't state. It grades a run afterwards; it doesn't stop an answer.
  • One shared approver token can't say which approver made a change. Single sign-on is next.
Kevin Street, smiling, arms crossed, leaning against a brick wall

Work with me

If you have an AI or data problem, or a question you've been meaning to ask someone, email me with a sentence or two about it and we'll set up a time to talk.

Follow me on LinkedIn and GitHub.