NewVol. 42 · Published Nov 26, 2026 · Book + Claude skill + MCP
The Rag & Knowledge Base Playbook
Build an AI Assistant That Answers From Your Own Documents, With Sources
$29 $5.80 Save 80%
Instant digital delivery. About 15k words.
About this playbook
Make AI answer from your own documents
Most RAG projects start with a vector database and a demo. Then someone asks the right question in the wrong words, and the assistant gives a confident wrong answer or shows a document the user should never have seen. The RAG & Knowledge Base Playbook replaces spot checks with a nine-step method that an AI agent can run with you, one approval gate at a time.
You define an answer contract, build the evaluation set before anything else, and pick the simplest architecture that passes it. Then you parse, chunk and index your documents, generate cited answers that decline when the evidence is missing, enforce permissions in code, defend against prompt injection and keep improving from production failures. Templates, SQL and API examples, prompts, a checklist and metric definitions are included.
Who it's for
- Founders and indie developers adding a document-based AI assistant to their product
- Support and product leads who want a help assistant that cites sources and hands off to a human when it cannot answer
- Engineers who already run a RAG system and need to measure it and find what is failing
- Teams with permission-sensitive or multi-tenant content that must never leak across users
- Anyone deciding between long context, managed file search, a custom pipeline and agentic search
What you'll be able to do
- Write an answer contract with in-scope and out-of-scope questions, source precedence and numeric targets
- Build a versioned evaluation set from real user questions, including unanswerable, permission, adversarial and lifecycle items
- Choose between full context, managed file search, a custom pipeline, agentic search and live lookup using clear decision rules
- Parse, deduplicate and chunk documents so that tables, procedures and policy exceptions survive
- Set up hybrid lexical and vector retrieval with permission filters inside every search, fusion and reranking
- Produce cited answers with defined states for partial answers, clarifications, conflicts, abstention and service failures
- Enforce access control, defend against indirect prompt injection and make deletions and revocations reach every derived copy
What's inside
Inside this volume
- 01
The problem and what good looks like
A failure-layer table from source to operations, the sufficient-context diagnostic, and why an assistant's answers count as your organisation's statements.
- 02
Define the job and the answer contract
Question maps in users' own wording, source precedence, time behaviour and an answer contract template with targets.
- 03
Build the evaluation set first
A JSONL record format, development and test splits, four diagnostic conditions, and how to calibrate LLM judges against human grading.
- 04
Choose the architecture
Five patterns with decision rules, platform facts to plan around, and a decision record that says when you would switch.
- 05
Govern, ingest, parse and chunk
A source register, a ten-step ingestion sequence, table and OCR handling, structure-based chunking and contextual enrichment.
- 06
Index, retrieve and generate cited answers
Hybrid search with reciprocal rank fusion in Postgres and pgvector, reranking, query rewriting, an answer system prompt and answer states.
- 07
Secure, launch and improve
Permission-aware retrieval that fails closed, prompt injection defences, staged launch, monitoring, and prompts, a checklist and metrics for the agent.
Use it with your AI agent
Ask for the work. Your agent follows the playbook.
Install the Claude skill or connect the MCP with your license key. Then ask in plain language:
- “Turn these 120 support tickets into a versioned evaluation set with expected answer states, required facts and at least 15% unanswerable items.”
- “Compare lexical, vector and hybrid retrieval on our eval set with real tenant filters, and report recall for each one.”
- “Rewrite our chunker so that headings stay with their content and tables stay whole, then show me 30 random chunks to review.”
- “Red-team our help assistant with at least 20 attacks, including injected instructions in documents, and confirm that no restricted content leaks.”
Questions
FAQ
Do I need a vector database?
Not always. For a small, stable corpus that every user may see in full, the playbook suggests trying full context with prompt caching first. Managed file search or agentic keyword search may also be enough. You choose by running your own evaluation set.
Does it work with OpenAI, Gemini and Anthropic?
Yes. It covers OpenAI file search, Gemini File Search and Anthropic's search_result citation blocks, as well as custom pipelines on Postgres, OpenSearch or Elasticsearch. Platform details change, so it tells you to check the current docs.
How does it keep users from seeing documents they should not see?
Permissions are enforced in the retrieval query and in every later step, including expansions, caches and citation previews, never by instructing the model. Sources with missing permission data are left out until someone verifies them.
What if I already run RAG in production?
Start with the evaluation set and the monitoring step, measure where you are, then go back to the step your numbers point to.
Is this legal advice for GDPR or the EU AI Act?
No. It points out the data protection and transparency questions to settle before you ingest anything and cites the relevant guidance. Your counsel or privacy lead should assess your actual use.
Better together
The Builder's Codex
Design, build, polish and ship apps with AI agents.
$551 $15.80 Save 97%