If you made it this far in the series, you've already given your AI memory and learned how not to lose your work. The next rung shows up when your AI has to handle A LOT of information: dozens of PDFs, a huge manual, transcripts, your whole business knowledge base. That's where RAG shines: instead of feeding everything to the AI every time (crazy expensive in tokens), it hands over only the relevant little pieces — and that's where you save a ton of money. BUT there's an uncomfortable truth almost nobody tells you: if your information is small, setting up a RAG just overcomplicates things and costs you more. In this guide you'll understand what RAG is in plain terms, why it saves tokens, the exact rule (from Anthropic itself) for knowing when you SHOULD, and the THREE ways to implement it depending on your level: no code, with an open-source repo, and the RAG behind a super-app — the very one we use, from the inside. No hype, in order, step by step.
The need arises at a very specific moment: when your AI has to work with a lot of information at once and starts to fail. Typical signs: you upload 30 PDFs and the AI "forgets" half of them; you paste in a long manual and it answers by mixing things up or making stuff up; or you have to paste the same giant document into every conversation because it doesn't hold onto it. That's when someone tells you "you need a RAG."
RAG stands for "retrieval-augmented generation." It sounds awful, but the idea is simple: instead of feeding ALL your documents to the AI every time (crazy expensive, and impossible if there are many), you store your documents separately and, when you ask something, a search engine retrieves only the relevant little pieces and hands them to the AI so it answers from those. Search first, answer after.
The big bonus: because the AI answers from specific pieces of YOUR documents, it can cite the source for you ("this comes from the manual, page 12"). That's what kills the hallucinations: if it's not in your documents, it doesn't make it up.
Here's the main reason RAG exists, and it's no small thing: saving money. Every word you feed the AI costs tokens, and tokens cost cash. If you have 5,000 pages of documents and you paste them all in on EVERY question, you pay a fortune (and often they don't even fit). RAG solves that: instead of sending the 5,000 pages, it sends only the 3 or 4 little pieces that actually answer your question.
Chunk means "piece" or "bit." It's the central piece of RAG, so it's worth understanding. Your documents are NOT stored whole: they're cut into small pieces — each chunk is usually a paragraph or a couple of them — and each piece is stored with a kind of "fingerprint of its meaning."
Here's the fact almost no "guru" tells you, and it comes from Anthropic itself (the creators of Claude). The rule is surprisingly generous:
Why does it matter so much? Because 500 pages is a LOT for most projects. Your brand manual, your templates, your business policies, a couple of books… it usually fits. And if it fits, setting up a RAG just overcomplicates your life for no reason. RAG is for when you genuinely go past that size: huge libraries, thousands of documents, data that changes all the time.
RAG isn't the first step or the last — it's a rung on a staircase. Climb it in order; don't skip rungs just because it's trendy:
There isn't just one way to set up a RAG: there are three, from least to most effort and power. What matters is choosing the one that actually fits you, not the flashiest one. Here they are, and then we'll go through them one by one:
If you passed the filter and RAG really is for you, good news: you don't need to program or set up databases. There are tools where you drag in your documents and that's it — you've got your smart search engine with citations. Two that anyone can use today:
When your project grows or you want control on your own server, there are powerful, free open-source tools. The two friendliest for non-experts (your AI helps you install them):
RAGFlow — the leading open-source RAG engine, built for non-developers: you assemble your pipeline visually and it understands complex documents (Word, PDFs, Excel, scans, images). It answers with source citations. Blends RAG with agent capabilities.
AnythingLLM — an "all-in-one" desktop app to have your own RAG chat over your documents, local and private. "Stop renting your intelligence, make it yours." Ideal if you want your data to never leave your machine.
I want to set up an open-source RAG over my documents using one of these repos: - RAGFlow (https://github.com/infiniflow/ragflow) — visual RAG, ideal if I want something complete. - AnythingLLM (https://github.com/Mintplex-Labs/anything-llm) — desktop app, local and private. Guide me step by step in simple language, assuming I don't know how to code: 1. Help me choose which one suits me based on my case: [describe your documents, whether you want everything to be local/private, and your operating system]. 2. Tell me how to install it (with its requirements, e.g. Docker) and do it yourself wherever you can. 3. Help me upload my documents and create the knowledge base. 4. Configure it to answer ONLY with what's in my documents and to ALWAYS cite the source. 5. Give me 3 test questions to confirm it's reading my documents properly. If there's a step I have to do by hand, tell me with exact instructions.
The third way is the most serious: when you build a super-app — a platform with tons of information and many users — no turnkey tool cuts it. That's where you build your own custom RAG engine. It's engineer-level (you do it yourself, or your team does, directing coding agents), but we'll show it to you from the inside, no hype, so you can see how far it can go: this is how the RAG engine we use in our applications works.
pgvector extension (on Supabase) + an HNSW index to search fast across hundreds of thousands of vectors.Copy it and paste it to your coding agent (Claude Code, Cursor) when you're about to build a custom RAG. It comes with the decisions that work for us built in, so it starts on solid ground instead of improvising:
You're going to help me build a custom RAG for a large-scale application. Do NOT write code yet. First, PLAN with me, because the most expensive mistake is coding without having decided the architecture. STEP 1 — Interview me (one question at a time, in simple language): - What information will the RAG index and how much? (document types, approximate volume) - How many users and how many queries per day do you expect? - Does the data change often? Do I need to delete/update chunks? - Is it multi-tenant (several customers with separate data)? Is there sensitive data? - What stack do I already use (database, language, where it's hosted)? STEP 2 — Propose the architecture, using these proven decisions as a starting point (and tell me whether, in my case, it's worth changing them and why): - Vector store: PostgreSQL + pgvector with an HNSW index (if I already use Postgres/Supabase, reuse it). - Embeddings: a cheap or free model (e.g. Gemini), storing the dimension you choose. - Chunking: pieces of ~200 tokens with a little overlap, and store metadata (source, date, section). - Hybrid search: combine vector + exact text, and a re-ranking to surface the most relevant. - Isolation: if it's multi-tenant, ALWAYS filter by the customer id on every query. STEP 3 — Give me a PHASED PLAN (what to build first, what to leave for later) with a minimal phase that works end-to-end before optimizing. STEP 4 — List the 5 most common mistakes in a production RAG and how to avoid them from day one (e.g. not filtering by tenant, badly-cut chunks, not handling updates, trusting without citing the source, not measuring answer quality). When we approve the plan, only then do we start building phase 1, step by step, and we save the progress in GitHub at every phase that works.
Before setting anything up, let your AI tell you which rung you're really on. Copy it and paste it to ChatGPT, Claude, or your agent:
I want to know if I really need a RAG or if I'm overcomplicating things. Ask me these questions one by one, wait for my answer, and at the end tell me which rung I'm on and why: 1. How many documents do I have, roughly, and what size? (a rough total-pages estimate) 2. Does that information change often or is it stable? 3. Do I need it to cite the source of each answer? 4. Is it just for me, or for an app that many people will use? 5. What AI tool do I use today? Rules for your recommendation: - If all my material fits in ~500 pages (about 200,000 tokens), tell me I do NOT need RAG: that I should paste everything into the context, it's simpler and more accurate. - If it's clearly more than that, or changes a lot, or is for many users, recommend RAG and tell me whether the no-code path (NotebookLM / Custom GPT) is enough or whether I need something open-source. - Don't push me toward over-engineering. Recommend the SIMPLEST rung that solves my case, and justify it.
If the diagnosis said "yes, no-code RAG," this prompt guides you to set it up and, above all, to verify that it's really reading your documents and not making things up:
I'm going to set up a no-code RAG to query my documents. Guide me step by step, in simple language, assuming I don't know how to code. 1. Recommend between NotebookLM (free) and a ChatGPT Custom GPT based on my case: I have [describe your documents: how many, what type, what I'll query them for]. 2. Give me the exact steps (with clicks) to create the space and upload my documents. 3. Write me the instructions I should give it so it answers ONLY with what's in my documents, cites the source, and clearly says "it's not in the documents" instead of making it up. 4. Give me 3 test questions to confirm it's really reading my documents (and not answering from general memory). 5. Tell me how to notice if it's making things up, and what to adjust if it happens. Keep it simple. If there's something I can only do myself on the website, tell me with the exact clicks.
RAG is a powerful piece, but it's just one: it searches your documents. When you build a real app, that app also needs to remember each user and, sometimes, understand how everything connects. All three together — RAG + memory + graph — form what's called a brain, your app's own brain. That's the next resource, and it brings together everything you've seen.
Join 4,200+ builders. No credit card. Build your first app with AI in minutes.