Reading on the web?Subscribe free →

SmarterContext

Issue #003 · Sun, Jun 28, 2026
Your AI keeps forgetting what you told it. Learn to fix that.
RAG basics: how to fetch knowledge, not paste it
When your knowledge is bigger than the chat window, you stop pasting and start retrieving.
Pasting works until your knowledge base is 200 pages. Then you need retrieval-augmented generation: store your documents as searchable chunks, and at query time fetch only the few most relevant pieces and feed those to the model. The AI answers from your actual docs instead of guessing — and you only spend context window on what's relevant to this question. The whole game is good chunks + good search, not a bigger prompt.
▸ The template
# Minimal RAG loop (pseudocode, any stack)

# 1. INDEX (once, when docs change)
for doc in knowledge/*.md:
    for chunk in split(doc, ~500 tokens, overlap=50):
        store(embed(chunk), text=chunk, source=doc)

# 2. RETRIEVE + ANSWER (every query)
q      = user_question
hits   = vector_search(embed(q), top_k=5)
prompt = f"""Answer using ONLY this context.
If it's not here, say so.

{join(hits)}

Question: {q}"""
answer = llm(prompt)
▸ Level it up
New to this: Use a tool that lets you 'chat with your documents' (upload a PDF and ask). That IS retrieval — you're already doing RAG without the plumbing.
Vibe coder: Drop your docs into a notebook-style tool that cites which file each answer came from, so you can verify the AI isn't making it up.
Advanced: Run your own pipeline: embed with a known model, store in pgvector/FAISS, add a reranker over the top-k, and always force 'answer only from context or say you don't know' to kill hallucination.
Takeaway: When knowledge outgrows the window, retrieve the relevant slice instead of pasting the whole library.
▶️ Pro audio
Listen to this issue
▶️ Play the narrated audio
🎧 Or add your private podcast feed: subscribe in your podcast app →
Know someone fighting the same context problem?
Forward it. Refer 3 friends and we'll send you our private context-template pack.
Refer & get the template pack →
From our network
Sharpen how you prompt AI   PromptSharp →
Everything AI, every morning   The AI Rundown →
SmarterContext · works with any AI model.
smartercontext.ai · Archive · Archive