Imagine you run Nimbus, a coffee subscription company. You want a support bot that knows everything — shipping, refunds, every coffee, every brewing guide. But a chatbot can only read so much text at once. Your help docs don't fit. So what do you do? This page is the answer you can click.
A language model has a fixed reading limit per message (its "context window"). Your knowledge base does not.
Stuff all your docs into every single message. Works with 5 docs. Falls apart with 500: it's slow, it's expensive, and eventually it just doesn't fit.
Store every doc on disk. For each question, pull only the 2–3 docs that actually answer it into the message. The other 9,997 stay on the shelf.
Ask the Nimbus bot a question. On the right, watch exactly what happens under the hood: which words it pulls out, which docs it grabs, and the actual message it builds. Nothing here is faked — the panel runs the same keyword-ranking math (BM25) that ContextForge uses internally.
👆 Ask a question and this panel shows the retrieval, step by step.
Here's the part that matters. Drag the slider to add more help docs to Nimbus. Watch what happens to the size of each message the bot sends.
This isn't magic, it's keyword matching — so it has a real blind spot. It finds docs that share words with your question. Ask the same thing in different words, and it can whiff. Click this and watch it miss:
Everything you just clicked is about 15 lines. This is the actual ContextForge API:
# Once: load your whole knowledge base from contextforge import ContextForge cf = ContextForge( db_path="nimbus.db", min_score=2.0, # ignore weak matches ) await cf.ingest("./help_docs") # 10,000 files # Per question: it grabs only what's needed reply = await cf.chat("How do I get a refund?") # → only the Returns doc enters the prompt. # The other 9,999 stay on disk. ~150 tokens.
# Paste the entire knowledge base into # every single message, forever: docs = load_all("./help_docs") # 10,000 files prompt = ( SYSTEM + "\n".join(docs) + # 👈 everything user_question ) reply = await llm.chat(prompt) # → ~600,000 tokens. Every turn. # Slow, expensive, and won't even fit. 💸
Swap "Nimbus coffee" for anything with more docs than fits in a prompt. Same trick, instant payoff: