@whyshouldaicareone AI disaster a day, and the fix

Make Claude quote your docs or say it doesn't know

Without the book, AI answers from memory: 30 days, not 14. This prompt makes it quote the page or admit it doesn't know.

The fix

Point Claude at the file with @, then give it three rules: quote first, answer only from the quotes, and say so when the file has no answer.

copy and paste
Answer only from @docs/refund-policy.md.
1. Quote the exact sentences that answer the question,
   with the heading or page number.
2. Then answer, using only those quotes.
If the file has no answer, say "Not in the document."
Do not use anything you remember.

What is the refund window?

Check it worked

Find the quote yourself. If the sentence is not in the file, the answer is not grounded. Then ask a question the file cannot answer. The reply should be "Not in the document."

copy and paste
grep -n -F "14 days" docs/refund-policy.md

Pro tip: write the rule down once

CLAUDE.md is read at the start of every conversation, so the rule does not need retyping. Keep it short, and link to the documents instead of pasting them in.

copy and paste
# CLAUDE.md
- Policy questions: read the file in docs/ first.
  Quote the exact sentence. If it is not there,
  say you don't know. Never answer from memory.

Pro tip: if you build an app, use citations

The API can return the cited passage for you. Add "citations": {"enabled": true} to a document block in the message content. Each cited claim in the reply comes with cited_text and a location: a character range, or a page number for PDFs (counting from 1). The API guarantees the pointers are valid. Citations cannot be combined with structured outputs: the API returns a 400 error.

copy and paste
{
  "type": "document",
  "source": {"type": "text",
             "media_type": "text/plain",
             "data": "Refunds within 14 days."},
  "title": "Refund policy",
  "citations": {"enabled": true}
}

Common mistake

Assuming Claude read the whole file. An @ file is included only when it fits the Read tool's token limit, 25,000 tokens by default. A text file over 256KB is not included. Split a long document into parts, and ask Claude to say which file and heading each quote came from.

Official docs

One fix of twenty: the whole Claude Code survival kit.

Follow @whyshouldaicare

A new disaster and its fix every day. Comment the word under a reel to get its guide.