Community post
The Open-Book AI
How my computer got smart about my stuff — explained so a 12-year-old could build one.
I gave the AI on my Mac permission to cheat on every test — and that one trick is the whole secret behind making an AI that actually knows about your life.
The problem: a genius who's never met you
An AI model is like a friend who has read basically the whole internet. Ask about volcanoes, the French Revolution, Minecraft redstone — no problem. But ask it "When is my science project due?" and it has no idea. It never saw your homework planner. Worse, instead of saying "I don't know," it sometimes just makes up a confident-sounding answer. AI people call that hallucinating, and it's the #1 reason you can't fully trust an AI about your own stuff.
So the question is: how do you get an AI to answer questions about your documents — your notes, your family's plans, your team's files — without it making things up?
The trick: make every test open-book
Here's the whole idea in one sentence: before the AI answers, someone hands it the exact pages it needs — and then it answers using those pages instead of its memory.
That's called RAG, which stands for Retrieval-Augmented Generation. Fancy name, simple meaning:
- Retrieval = go find the right pages.
- Augmented = add them to the question.
- Generation = now write the answer.
It's an open-book test. The AI is still the one writing the essay — but it's copying facts from real pages sitting right in front of it, and it can even point at which page each fact came from (those are called citations).
Wait — who hands it the pages?
Not a person! That's the clever part. A little librarian program finds the right pages automatically, in about a tenth of a second. The rest of this post is about how that librarian works.
Building the library (this happens once per document)
Before the librarian can find anything, you have to build the library. Every document you want the AI to know about goes through four steps:
- Extract — turn everything into plain text. PDFs, Word docs, notes — strip away the fonts and pictures until only the words are left. Computers are great with plain text.
- Chunk — cut it into index cards. A 30-page document is too big to hand over whole. So you snip it into pieces of about a paragraph each — roughly 1,000 characters. Think of each piece as one index card.
- Embed — give every card a "meaning address." This is the magical step. A small AI reads each card and turns it into a long list of numbers that captures what the card is about. Cards about similar things get similar numbers — like a library where books about the same topic sit on the same shelf, even if their titles share no words. "My dog Max" and "our golden retriever" end up neighbors.
- Store — file the cards away. All the cards and their meaning-addresses go into a special filing cabinet called a vector database. Now the library is ready.
Answering a question (this happens every single time)
- Your question gets a meaning-address too. The same small AI reads "When is the science project due?" and turns it into numbers.
- Find the nearest cards. The librarian walks to that address in the filing cabinet and grabs the closest cards — say, the top 10 most similar ones. This is the "retrieval" part, and it takes a blink.
- Staple the cards to the question. The AI gets a note that basically says: "Answer this question. Use ONLY these cards. Here they are."
- The AI writes the answer — open book. Now it's not remembering or guessing. It's reading your actual documents and telling you what they say.
The one thing most people get wrong
The big smart AI never searches for anything. All the searching happens before it wakes up. So if the librarian grabs the wrong cards, even the smartest AI in the world writes a beautiful essay about the wrong thing. When RAG breaks, it's almost always the librarian's fault, not the AI's.
The day my librarian messed up (a true story)
I have notes about several of my coding projects, and each note has a section called "Tech Stack" (the tools that project uses). I asked my AI about one specific project's tech stack… and the librarian brought back the wrong project's cards.
Why? Picture cutting up five different cookbooks into index cards. Now you're holding a card that just says "Chapter 2: Ingredients — flour, sugar, eggs." Which cookbook is it from? The card doesn't say. My "Tech Stack" cards were exactly like that — the project's name was at the top of the document, but not on each card. To the librarian, all five projects' cards looked nearly identical, and the right one ranked around 18th place.
Two ways to fix it:
- The quick fix (what I did first): tell the librarian to grab way more cards — 28 instead of 3 — so the right one makes it into the pile even at 18th place. It works, but it's like dumping a whole drawer on the AI's desk.
- The real fix: write the book's name on every single card when you cut them up. "Betty's Cookbook — Chapter 2: Ingredients." Then the librarian finds the right card immediately, and you can go back to grabbing just a few.
That lesson generalizes to every RAG system ever built: every card must make sense on its own, because the librarian only ever sees one card at a time.
Another sneaky trap: pictures of words
A scanned PDF looks like text to you, but to the computer it's just a photo. The extract step gets… nothing. Your important document becomes invisible to the AI, and nothing warns you! The fix is OCR — software that literally looks at the picture and reads the letters off it. Always check that your documents actually turned into text.
Okay — how would YOU build one?
The no-code way (about 20 minutes)
There's a free app called Open WebUI that does almost everything above with buttons:
- Create a "Knowledge" collection. That's your library. Name it something like "school-stuff."
- Drag your files onto it. The app extracts, chunks, embeds, and files them automatically. That's the whole library-building pipeline in a drag-and-drop.
- Create a custom model and attach the collection. Pick an AI, write it instructions ("You are my homework helper"), and connect your library to it.
- Ask it something only your documents know. If it answers correctly with a citation, it works. If it shrugs, your librarian needs help — usually the cookbook-card problem or the picture-of-words problem.
The catch with clicking: when a document changes, you have to notice, delete the old version, and re-upload it. For ten files that's fine. For hundreds that update every week, you'd want a small script that syncs automatically — which is exactly what I built. Same architecture, just repeatable.
The code way (the whole thing is ~20 lines)
If you know a little Python, here is genuinely the entire core of RAG. Everything else any company builds is just armor around this:
build the library
for doc_id, text in my_documents():
cards = cut_into_chunks(text) # index cards
db.add(cards, embedder.encode(cards)) # meaning-addresses -> filing cabinet
answer a question
cards = db.find_nearest(embedder.encode(question), top_k=8)
answer = ai(f"Answer using ONLY these notes:\n{cards}\n\nQ: {question}")
The checklist (tape this to your monitor)
- Check your text extraction first. If garbage goes into the library, the librarian can only ever find garbage.
- Write the book's name on every card. Cards get read alone — they have to make sense alone.
- When it breaks, blame the librarian first. Look at which cards were actually retrieved before blaming the AI.
- Keep the library fresh. An out-of-date library confidently gives out-of-date answers.
- Test with questions only your documents can answer. "What's the capital of France?" proves nothing. "What date is on my permission slip?" proves everything.
That's it. No PhD required — just a genius who's never met you, a very fast librarian, and an open book.
Written after building a five-persona local AI team — all models and documents running privately on one Mac.
After doing all this work I had AI teach me what it did and thought it would be a good idea to turn this into a blog/tutorial for others. This is written by the AI BRAIN TRUST
Replies (2)
Would notebook not be more or less something like this... just not that versatile, I guess, since you can't use different models on it.
or is I confuzzled?
Congratulations @excomunicado! You have completed the following achievement on the Hive blockchain And have been rewarded with New badge(s)
Your next target is to reach 1250 upvotes.
You can view your badges on your board and compare yourself to others in the Ranking
If you no longer want to receive notifications, reply to this comment with the word
STOPCheck out our last posts: