A common way to use a model for research is to ask a question and read the answer. The answer is fluent, which is the problem. Fluency is not evidence, and a reader cannot tell which sentences rest on a source and which are the model filling a gap.
A better target is an evidence packet: a list of claims, each with one exact quote and the source it came from, plus a record of what was searched and what was not found. A person can check a packet in a way they cannot check a summary. This guide builds the mechanical checks around such a packet and, just as important, shows what those checks cannot see. It makes no claim about how much time research takes with or without an agent. The sources and claims in the examples are invented, and the code ran only on that synthetic material.
Why summaries are risky and packets are checkable
OWASP's entry on misinformation describes the core problem. Models can produce false or misleading content that looks credible, and hallucination, where the model generates something that seems accurate but is fabricated, is a major cause. It names a related risk, overreliance, where users trust generated content without checking it. Its mitigations include grounding answers in retrieved material, cross-verification with trusted sources, human oversight and fact-checking for critical content, and automatic validation of key outputs. It also says reviewers should be trained not to over-trust AI output.
An evidence packet puts those mitigations into the shape of the output. Each claim has to point at a quote. Plain code checks the quote. A person reads the result. The model's job narrows to finding candidate passages and writing claims from them, which is work a reader can inspect.
What goes in a packet
A packet needs five things.
- The question and its sub-questions, so a reader can see what was asked.
- Captured sources. For each, the URL, when it was retrieved, a publication date if the page states one, the saved text, and a hash of that text. The hash lets you tell later whether a page has changed.
- Claims. Each claim is one sentence, with one or more pieces of evidence. Each piece of evidence is a source and an exact quote, with a stance: supports or contradicts.
- A status for each claim, computed by code.
- What was not found, including searches that returned nothing useful.
The fifth item is easy to leave out and matters most. An agent that reports only what it found cannot show that it looked in the right places.
Dates are harder than they look
Recency checks need a date, and the date is often missing or misleading. The HTTP specification defines the Last-Modified header as the time the origin server believes the selected representation was last modified. That is a statement about the server's record, set by whatever generated the page, and it is not a publication date. A page can be edited without its meaning changing, or regenerated daily with a fresh timestamp. Use a date stated in the page content when there is one. When there is none, record the date as unknown and treat the source as undated.
Pages are untrusted input
A research agent reads text written by strangers. OWASP's guidance on prompt injection describes content from external sources, such as websites and files, altering what a model does. The mitigations include least privilege, human approval for high-impact actions, and separating untrusted content from instructions. For research, that means page text goes into the packet as quoted data. It does not go into the agent's instructions, and the agent should not hold credentials or tools it does not need.
Vendor citation features
Some model APIs now return citations. Anthropic's documentation describes a citations feature in which documents are chunked, by default into sentences for plain text and PDFs, and the response carries pointers to the passages used. The documentation says the API parses the citations itself, so each one contains a valid pointer into the documents you provided, and that the cited text field is extracted by the API. It also notes that citations cannot be combined with structured outputs. Treat that as a statement about pointers. A valid pointer shows where a passage is. It does not show that the passage supports the sentence it is attached to, and a feature that cites sentences cannot read a negation in the next one. Such features can reduce invented citations, and a reader still has to check support.
The checks
The code below is the core. It treats a claim's evidence as a list of quotes and runs mechanical checks on each, then rolls the results up per claim. It is the code the tests ran. The tests load it straight from this page.
Each quote gets two lists back, and the difference between them matters most for contradicting quotes.
- Problems mean the quote cannot be relied on at all, whichever way it points: the source is unknown, the quote is blank or missing, the quote is not found in the source text, the page changed since capture, or the stance label is not one of the two allowed values. A blank quote is checked first, because an empty string is found inside every text and would otherwise pass.
- Warnings are heuristics about weight: a short quote, a number in the claim that the quote lacks, a missing date, an old date. A supporting quote must pass every one of them to count. A contradicting quote counts once it has no problems, and its warnings are carried into the packet as flags a reader sees. A quote that says a release shipped on 19 March does not contain the claim's 12 March, and a contradiction from an old or undated page can still be the page that is right. Dropping those quietly would make the packet look cleaner than the evidence is.
The stance label ("supports" or "contradicts") is written by the model and nothing here checks it. The code verifies that a quote exists in a source. It does not verify that the quote points the way the label says. The number check is the same kind of screen: it catches an obvious mismatch, and a quote that contains every number in the claim can still deny it.
import hashlib
import re
from datetime import date
from urllib.parse import urlsplit
NUM = re.compile(r"\d[\d,]*(?:\.\d+)?")
MIN_QUOTE_WORDS = 5
STANCES = ("supports", "contradicts")
def norm(s):
s = s.replace("\u2019", "'").replace("\u2018", "'").replace("\u201c", '"').replace("\u201d", '"')
return re.sub(r"\s+", " ", s).strip().casefold()
def numbers(s):
return {n.replace(",", "").rstrip(".") for n in NUM.findall(s)}
def domain(url):
h = urlsplit(url).hostname or ""
return h[4:] if h.startswith("www.") else h
def sha(text):
return hashlib.sha256(text.encode("utf-8")).hexdigest()
def check_evidence(ev, claim_text, sources, today, max_age_days):
"""Check one quote, whichever way its stance label points. Returns (problems, warnings).
problems: the quote cannot be relied on at all. Unknown source, blank or missing quote, quote not
found in the source, source text changed since capture, unknown stance label.
These apply to supporting and contradicting quotes alike.
warnings: heuristics that say how much weight a quote can carry. Missing or old date, short quote,
a number in the claim that the quote lacks. They are always reported.
"""
src = sources.get(ev.get("source_id"))
if not src:
return ["unknown source"], []
problems, warnings = [], []
if ev.get("stance", "supports") not in STANCES:
problems.append("stance label is not supports or contradicts")
quote = ev.get("quote")
has_quote = isinstance(quote, str) and bool(norm(quote))
if not has_quote:
problems.append("quote is empty or missing") # an empty string is "found" in every text, so test it first
elif norm(quote) not in norm(src.get("text") or ""):
problems.append("quote not found in source")
if src.get("text_sha256") and src["text_sha256"] != sha(src.get("text") or ""):
problems.append("source text changed since it was captured")
if has_quote and len(quote.split()) < MIN_QUOTE_WORDS:
warnings.append("quote too short to show anything")
if has_quote and numbers(claim_text) - numbers(quote):
warnings.append("number in claim is not in the quote")
if not src.get("published"):
warnings.append("source has no date")
else:
try:
if (today - date.fromisoformat(src["published"])).days > max_age_days:
warnings.append("source may be out of date")
except (TypeError, ValueError):
warnings.append("source date not understood")
return problems, warnings
def check_packet(packet, sources, today, max_age_days=730):
out = []
for c in packet["claims"]:
res = {"id": c["id"], "evidence": [], "flags": []}
support_domains, contradictions = set(), 0
for ev in c["evidence"]:
problems, warnings = check_evidence(ev, c["text"], sources, today, max_age_days)
stance = ev.get("stance", "supports")
res["evidence"].append({"source_id": ev.get("source_id"), "stance": stance,
"problems": problems, "warnings": warnings})
if problems:
if stance == "contradicts":
res["flags"].append("a contradicting quote did not verify: " + "; ".join(problems))
continue
if stance == "contradicts":
contradictions += 1 # found in a real source: counts, with its warnings attached
if warnings:
res["flags"].append("contradicting quote from %s has warnings: %s"
% (ev["source_id"], "; ".join(warnings)))
elif not warnings: # support must pass every heuristic as well
support_domains.add(domain(sources[ev["source_id"]]["url"]))
if contradictions:
res["flags"].append("stance labels come from the model and are not checked")
if support_domains and contradictions:
res["status"] = "contested: quotes found on both sides"
elif contradictions:
res["status"] = "contradicted: only a contradicting quote was found"
elif not support_domains:
res["status"] = "rejected: no supporting quote passed every check"
elif c.get("key") and len(support_domains) < 2:
res["status"] = "single source: needs a second independent source"
else:
res["status"] = "quote verified: support not reviewed"
out.append(res)
return out
Notice the best status is "quote verified: support not reviewed". There is no status called "true", because the code cannot establish one.
The two statuses for opposing evidence say different things. "Contested: quotes found on both sides" means a supporting quote passed every check and a quote labelled as contradicting was found in a real source. "Contradicted: only a contradicting quote was found" means no supporting quote passed. A contradicting quote that failed verification, for example because the model invented it, does not create a contest. It is listed as a flag so the reader knows the model offered one.
What the tests showed
The tests used seven invented pages about a fictional library called Harbor: a release page, a review, a legal page, an undated wiki copy, an older release page, a mirror and a page for a different version. There were sixteen cases, run against the code printed above and not against a separate copy.
On the supporting side, a fabricated quote, one that sounded plausible but did not appear in the page, was rejected. A real quote with a wrong number in the claim, a different release day, was rejected, and the warning "number in claim is not in the quote" was listed. A quote of two words, a page past the age limit and an undated page each produced a warning that kept the quote from counting as support. A claim marked as key, supported by one verified domain plus one undated copy, came back as single source. When two different domains passed, the claim reached the best status. Tightening the age limit removed the older domain and dropped the claim back to single source. A page whose text changed after capture failed the hash check for both stances. Line breaks and curly quotes in a source did not break matching, and a loosely reworded quote did.
On the opposing side, the test cases were the ones a support-only check would have dropped. A claim that a release shipped on 4 March was paired with a mirror page saying 19 March. The quote lacks the claim's day number, and it counted: the status was contested, with the number mismatch listed as a flag. The claim "shipped on 12 March" against a vendor page saying 19 March was marked contradicted. A contradicting quote from a page dated 2020 and one from an undated page also counted, each with its date warning shown, and a three-word contradicting quote counted with a short-quote warning. A contradiction with no support got a different status from a contradiction with verified support. A fabricated contradicting quote did not turn a supported claim into a contested one. It appeared as a flag.
Blank quotes were never valid in either stance. An empty string, whitespace only, a null value, a number in place of text and a missing quote field all returned "quote is empty or missing". A source id that was absent, null or not in the packet returned "unknown source". An unrecognised stance label was a problem and not a silent support.
The most useful test was the failure. A claim that the library is licensed under the GPL was paired with a real, verbatim quote from the legal page: that the library is not licensed under the GPL. Every mechanical check passed, because the quote exists and the claim has no numbers. The same shape appeared in a milder form in the contested-claim test, where the quote that "supported" a claim about the latest release came from the page for an older release. Only a reader looking at the quote beside the claim sees either problem.
These tests show that the checks do what they say. They do not show that an agent finds good sources, that real pages capture cleanly, or that a reviewer reads every quote.
Failure cases
Negation and context. A true quote can be attached to a false claim. The check cannot see it.
Wrong version or wrong subject. A page about an older release or a similar product supports a claim only by matching words.
Copy chains. Two domains can repeat one origin. A second domain is a weak form of independence.
Pages that do not capture. Paywalls, scripts that build the page after load and scanned documents can leave empty or partial text. A quote check against partial text will fail or, worse, match the wrong part.
PDF and extraction noise. Hyphenation and column breaks can make a faithful quote fail to match. Normalizing whitespace helps, and anything more aggressive can let altered quotes through.
Selective evidence. Choosing only the supporting quotes is a bias the checks do not detect. Recording what was searched and what contradicted the claim is the defense.
Ranking is not credibility. A search result near the top is not a reason to trust a page. Prefer primary sources, such as the specification, the vendor's own documentation or the original data.
Next step
Take a question you recently researched. Write five claims you would put in a report. For each, find one source, copy one exact quote of at least a sentence, and record the source's URL, retrieval date and stated publication date. Run the checks, then read each quote beside its claim and mark whether it supports it. Count how many claims changed after you read them. Use that count, from your own work, to decide how much review an agent's packets need.
Sources
- OWASP, LLM09 Misinformation: misinformation and hallucination, overreliance, and the mitigations of grounding, cross-verification, human oversight and automatic validation.
- OWASP, LLM01 Prompt Injection: indirect injection from external content, least privilege, human approval, and separating untrusted content.
- Anthropic, Citations: sentence chunking, citation pointers, the statement that pointers are valid references to provided documents, and the incompatibility with structured outputs.
- RFC 9110, HTTP Semantics: the definition of
Last-Modifiedas the origin server's belief about when a representation was last modified.
