The knowledge base I described in October maintains itself, but its search was grep. Grep is file-based: it finds the exact words you type, and the corpus rarely uses yours. Ask it how sure I am of an article and the result is empty, because the article says “Status: established, two sources”.
For an agent, that miss costs a round-trip: another query with different words, the files it opens while checking, and the tokens all of it consumes.
The Embedding Layer
The new part is semantic search. The model is EmbeddingGemma 2, a 310 MB GGUF, Apache 2.0. llama.cpp serves it locally on port 8199, launched detached, and a launchd agent restarts it within ten seconds if it dies.
The model reads words and writes out an embedding, a vector in a space where nearby vectors mean the same thing, with or without shared words. Documents are filed with the model’s trained title: … | text: … prefix and questions arrive as task: search result | query: …, so both sides of a search live in the same space.
The layer is a mirror of the markdown library. Every section of Wiki/ and Outputs/ — 2,032 of them across 361 files — is filed as a vector in a 12 MB SQLite file. There is no vector database: a question is ranked by brute-force cosine similarity against all two thousand vectors, about 0.1 seconds.
The mirror lives outside git, one per machine. The writing skills keep it current: kb-compile and kb-draft run kb-index after the commit, and it re-embeds only what that pass changed. kb-index --status says what is pending, and a full rebuild of the corpus takes 31 seconds on my M5 Max, 32 sections at a time.
Asking
kb-question uses the layer whenever a question is a paraphrase: kb-search finds the articles by meaning, and the hits arrive with each article’s Status and Provenance, which is how the answer is weighted. Exact strings, [[links]] and filenames still go to grep.
With kb-question answering on top of the retrieval, that is RAG, pointed at a markdown library instead of the open web.
The question no longer has to be phrased the way the article is.