● ● ● ● ● ○ ○ ○ ○ Lesson 5 of 9
Build a docs Skill · A brown-bag
The smartest search tech is right there. Why would we pick the simplest math instead?
Lesson 4 proved it with a number: we need full-text search. Now the real question — how do we build it, and how do we ship it?
Two tempting options jump out, both "better" on paper:
But before we fall for either, remember what a skill actually is:
That one constraint quietly kills both fancy options. Let's watch it happen.
Option 1 — the site's search (Inkeep). Rejected: brittle. The live docs use a hosted AI search called Inkeep. To call it, you'd have to get past a security gate (a "proof-of-work" puzzle) whose exact rules are buried in minified JavaScript that can change any day. Hardcode it and your skill breaks the next time they ship.
"the Inkeep JS can change whenever they want — hardcoding the algo is a brittle maintenance trap." — CORPUS.md, Act C
Option 2 — embeddings / vector search. Rejected: you can't ship it. Here's the catch most people miss. To search with embeddings, you turn each page into a list of numbers (a "vector") using a model. Fine — do that once at build time. But to search, you must turn the user's question into a vector too — and that needs the same model, running on the client, every single query. You cannot pack a model into a static file.
"the client also needs to run the same embedding model … unless you serve this as an MCP server?" — CORPUS.md, Act C
So embeddings only work if you host a server. Park that thought — it's the road we weigh in Lesson 9.
The winner — TF-IDF. Just arithmetic. It scores pages by counting words. No model. No server. No gate. You do the math once, save the numbers in a JSON file, and ship that file inside the skill.
"TF-IDF is just arithmetic … No model, no training, no GPU." … "No auth, no PoW, no browser, no model." — CORPUS.md, Act C
The whole decision in one picture:
TF-IDF is two simple ideas multiplied together:
pg_hba.conf) is a strong signal. So weight rare words higher:
IDF = log(total pages / pages containing the word).Multiply them — weight = TF × IDF — add up the weights of the query's
words for each page, and the highest total wins. That's it.
The shipping trick is when you do the math:
This is the build-time vs query-time split: heavy work happens once when you build the index; the downloaded skill does only cheap lookups. It's also the next short round of Agile iteration — we've gone from "search the title" to "search the body by word weight," each round tested before the next.
One honesty note to carry forward: the body-only evals from Lesson 4 are now our contract. Whatever engine we pick must pass them. TF-IDF does.
But here's the trap waiting in that simple weight = TF × IDF.
A huge page — say a 3,000-line changelog — contains every word many times. What
happens to our ranking when sheer page size starts winning?
That's Lesson 6: raw counts lie.
Quick self-check (recall before you peek):
A skill is a file other agents download — so the search must ship as a plain file and work with no server, keys, or model. "Which ships?", not "which is smartest?"
To search, the client must turn each query into a vector using the same model — and you can't pack a model into a file. Embeddings need a hosted server.
It weights rare words higher and common words lower — a word in almost every page tells you nothing; a rare one is a strong signal.
Do the heavy math once at build time and save the numbers; the shipped skill only does cheap lookups and addition at query time — no model, no GPU.