Say you ask a coding assistant why the nightly import job charges a few customers twice. The answer comes back in seconds. It names the right module, suggests a tidy refactor of the retry logic and even writes a test. It reads like it came from someone who's been on the team for years. Then you ask one follow-up: "Which files did you actually read to get there?" The handler and one helper. It never opened the usecase that decides when to retry, or the migration that added the idempotency key. The rest came from what retry bugs usually look like.
Nothing in the first answer was obviously wrong, and that's the problem. A fluent answer built on two files looks exactly like one built on twenty. The fix is a small habit: before you accept a conclusion, ask the assistant to show its working context.
What "working context" means
I don't mean the model's private chain of thought. I mean the parts you can check:
- Which files and functions it read, with paths and ideally line ranges.
- Which logs, error messages or traces it's working from.
- Which spec lines, tickets or docs it relied on.
- Which tests back the claim, and whether it actually ran them.
- What it didn't open, and which parts are still a guess.
That last line pulls a lot of weight. The guesses deserve their own conversation, and Ask the AI to Name Its Assumptions First covers them in depth. This post is about the evidence side: what the answer is built on.
Why ask for sources instead of an explanation
"Explain your reasoning" feels like the obvious follow-up. The catch is that a model's account of its reasoning isn't always what drove the answer. In a 2025 study, Anthropic researchers slipped hints into questions and checked whether reasoning models admitted to using them. Claude 3.7 Sonnet mentioned the hint about 25% of the time, DeepSeek R1 about 39% (Reasoning models don't always say what they think). The researchers' own conclusion: "we can't always rely on what they tell us about their reasoning."
A file path works differently. You can open it. A test name is something you can run. A quote from the spec is either in the spec or it isn't. You're asking for claims you can check in a minute, so you don't have to take a nice story on trust.
The vendors' own docs point the same way. Anthropic's guide to reducing hallucinations suggests making a response "auditable by having it cite quotes and sources for each of its claims," and asking the model to retract any claim it can't back with a quote (Reduce hallucinations, checked November 2026).
Read the list like a reviewer
Once the list is on screen, the gaps jump out:
- It cites the HTTP handler but not the usecase where the business rule lives. The diagnosis may be about the wrong layer.
- It found the helper but not the migration that changed the column. The data shape it assumes may be out of date.
- It can't name a failing test. Then the diagnosis is still a hypothesis, and step one is writing that test.
- It lists 40 files. Having something in the context window doesn't mean the model used it well. The "Lost in the Middle" study found models do best when the relevant information sits at the start or end of a long input, and worse when it's buried in the middle (Liu et al., 2023). Ask which three files actually decided the answer.
A short evidence list also keeps the fix small. Assistants love proposing big cleanups, because a big cleanup is easy to describe. If the evidence says the bug is one endpoint, one data shape and one regression test, you have a solid reason to keep the PR that size.
Prompts you can copy
"Before you write the patch, list the files and line ranges you're relying on, plus anything you didn't open that might matter."
"For each claim in your diagnosis, point to the log line, test or code that supports it. Drop any claim you can't point to."
"What evidence would prove this diagnosis wrong, and how would I check it?"
"Which of these files actually changed your answer, and which did you only skim?"
These make the assistant a little slower, in a good way. It moves from finishing your sentence to showing its work. If your tool already shows which files an agent opened, read that list before you read the diff.
You still do the checking
The assistant can misread a file, overstate what a log proves or cite something beside the point. Anthropic's guide says as much: these techniques reduce hallucinations without getting rid of them, so "always validate critical information." Open the files. Run the test. Decide for yourself whether the evidence supports the conclusion.
This matters most in big systems, where the right answer often hangs on a tenant rule, an old client version, a feature flag or an ops convention that no prompt mentions. A visible context list shows you what the model saw, and by leaving things out, what it missed. For the facts it couldn't have seen in the first place, read What AI Can't Know From the Prompt Alone.
Leave a trace for the next person
Put a short version of the list in your PR description: what the AI drafted, what you verified and how, and which files or logs settled it. Three lines is plenty. Six months from now, when someone asks why the retry logic looks the way it does, the answer will be right there in the PR.
Try this week
- Next time an AI answer sounds right, ask which files, logs and tests it's based on before you act on it.
- Open at least one cited file and check the claim against it yourself.
- Add a three-line "AI context" note to your next AI-assisted PR.