Why this is harder than it looks
Giving an agent your company’s knowledge sounds simple, and the first version usually works in an afternoon. The trouble starts weeks later, when a doc changes and the agent keeps quoting the old one. Most setups keep two copies of your knowledge: the docs themselves, and a search database built from them. When the two drift apart, the agent keeps answering, just from old text. The doc was right. The agent read an old copy.
The fixes sound simple. Add a job that keeps the two in sync, or drop the database and let agents read the files straight from one object storage bucket. Both get harder as your knowledge grows. The sync job has more to copy and more ways to fail. And a bucket is not a folder: before an agent can open a file, it has to download it. Company knowledge bases often run to hundreds of gigabytes.
The usual setup
What we’ll build
In this guide we’ll show how to build it the other way. The docs and their search index live in the same bucket, tied to the same version of your docs. There is no second copy to fall behind, and agents read only the parts of a file they need.
What we’re building
By the end, you’ll have:
- Your docs saved on a disk, with every change kept as a commit.
- Search next to them that finds answers by meaning and by exact words.
- One search tool your agent can call, which tells you which file it used.
- A way to update a doc and have the agent see it right away.
- Drafts, so you can test big rewrites before customers see them.
You’ll need a Skywake API key and Node. Set SKYWAKE_API_KEY, then install the SDK with npm i skywake.
Step 1
Put your docs in one place
Start with the folder you already have. Markdown or plain text works best: whatever your help center exports. Ours looks like this:
help-center/
- billing/refunds.md# the one that will change
- billing/invoices.md
- plans/annual.md
- account/reset-password.md
- account/sso.md
We’ll upload it to a disk called help. A disk holds files the way a Git repository does: each save is a commit, and you can always go back and see what changed. The upload lands on the disk’s first branch, main, as one commit.
import { Skywake } from "skywake";
const sky = new Skywake();
const help = sky.disk("help");
await help.upload("./help-center", { message: "Help center today" });That’s it. main is now the one true copy of your docs, stored in your own bucket.
Step 2
Turn on search next to them
Next, search. A disk can keep a search index of its own files. For each doc it keeps two things: the text, so it can match exact words, and a vector, a list of numbers that captures what the text means.
Why both? Customers ask “can I get my money back?” while your doc says “refund”. Search by meaning finds that. They also type “SSO” or an error code, and search by words finds that better. A good knowledge base needs both.
await help.configure({ search: true });Search is on by default when your environment has an embedding model, so this line only makes sure. From now on the server indexes every file you commit, and makes the vectors for you. There is no sync job to write.
Step 3
Give your agent a search tool
Your agent needs one tool: search the docs. query runs both kinds of search in a single call. Docs found by both rank highest, so a question in the customer’s own words still lands on the right page.
export async function searchDocs(question: string) {
const hits = await help.query(question, { limit: 5 });
return hits.map((hit) => ({ path: hit.path, text: hit.snippet }));
}Each hit is a file’s path and the part of it that matched. Hand searchDocs to your agent as a tool, let it read the files it gets back with help.read(path), and ask it to name the file it used.
Tip: always cite the file
When an answer looks wrong, the file name tells you exactly which doc to fix. It also builds trust with the people reading the answers.
Step 4
Keep it current
Here’s the part that broke in the old setup. The refund policy changes. Write the new doc:
await help.write(
"billing/refunds.md",
"Annual plans can be refunded within 30 days.",
{ message: "Refunds: 30 days, not 60" },
);That is the whole update. The write is a commit, and only billing/refunds.md is indexed again. Ask the agent the same question a moment later, and the answer has changed:
Can I get a refund on my annual plan?
Yes, within 60 days of purchase.
Before the changeYes, in full within 30 days of purchase.
After · from billing/refunds.mdThere is no separate job to run after each commit, no job to watch, and no night when it quietly stops.
Step 5
Test big changes on a draft
Small edits can go straight to main. But say new pricing launches next month and half your billing docs will change. You want to see how the agent answers before any customer does.
Fork the disk into a draft, and change the docs there. A fork copies nothing, so it is instant even with thousands of docs, and it brings its search with it. Customers keep getting answers from main the whole time.
const draft = await help.fork("new-pricing");
await draft.write(
"plans/annual.md",
"The annual plan costs 10 times the monthly price.",
{ message: "New pricing" },
);Give a test agent the same tool, with draft.query in place of help.query, and ask it the questions customers ask most. When the answers read well, merge:
await draft.mergeInto("main");The new docs and their search go live at the same moment.
Growing to millions of docs
Everything above works the same at five docs or five million. A few things to know as it grows:
- Updates stay small. Each commit indexes only what changed, so a big knowledge base costs no more to update than a small one.
- Search stays fast. A warm query over 10 million vectors takes about 10 ms.
- Drafts stay instant. Forking copies nothing, whatever the size.
- It all stays yours. Docs and index live in your own bucket. There is no second database to run or pay for.