I have 703 notes in Obsidian, and I can only find things when I remember the exact word I used. Search is Ctrl-F with better typography. If I wrote "the 3060 box" in one note and "ai-vm" in another, the note I want may as well not exist.

I wanted a tool that could answer "which machine has the 3060" or "what did I decide about the reindex interval" from the vault itself, with a path and heading I could check. I did not want a chatbot. I wanted retrieval that Hermes, my local agent, could call before it answered, the same way I would open a note and read the paragraph before typing a reply. The system is read-only for now. Writing to the vault is a separate problem.

What RAG is, without the vendor deck

Retrieval-augmented generation, or RAG, is an open-book exam. You find the relevant passages first, then hand them to a language model and tell it to answer from those passages. The model does not need to know my notes; it needs to read the five paragraphs I give it.

Nearly all of the quality comes from the retrieval step. If the right paragraph is not in the context, the model will either say it does not know or make something up. If the right paragraph is there, a 9B model can usually write a decent answer. So I built the retrieval first and treated generation as optional. /search returns cited chunks and works with the GPU box turned off. /ask adds a generated answer when the 3060 is available.

My first plan was the obvious one: Ollama for the model, ChromaDB for the vectors, and the GPU in my Proxmox host, the P520, for the expensive part. I dropped the vector database after measuring the CPU version. At 8,723 chunks, the first retrieval stage takes 4.9 ms on the Mac mini. Chroma would add a process, a persistence format, and a failure mode to a step that already finishes before I notice. I kept Ollama for /ask.

Cutting 703 notes into 8,723 pieces

A note is too long to hand to a model whole. The average is about 6,000 characters, the longest is 76,000, and most of that is irrelevant to any one question. Ingest splits each note at headings, packs paragraphs into chunks of about 800 characters, and carries 100 characters of overlap so a sentence that crosses a boundary is still readable. That produced 8,032 body chunks.

Chunking also throws away the most useful part of my notes: the frontmatter. My notes have a summary field and a list of aliases, and those are where I write the thing I will actually search for. The note for my Windows desktop is called Creekwood. Its body never says "my main gaming desktop," because why would I write that about my own computer. The alias does. So ingest now writes one extra chunk per note, a card with the title, summary, aliases, and folder. That is 691 cards alongside the body chunks. The cards are cheap and they answer the "what is this thing" questions that chunking made harder.

The index is three files: a NumPy matrix of 8,723 × 384 float32 vectors, a JSON file with the chunk text and source path, and a metadata file with the commit and build time. Nothing else. Embeddings are cached by a hash of the model and text, so a rebuild only embeds what changed. The last incremental rebuild took 4.2 seconds.

Obsidian vault (703 notes)
  -> git mirror (15-30 min lag)
  -> ingest.py
  -> index/ (8,723 x 384 float32 + chunks.json)
  -> FastAPI (loopback)
       -> /search -> Hermes MCP, vault-search
       -> /ask -> qwen3.5:9b on RTX 3060

Two searches that fail differently

Every query runs through two searches. The first is dense. all-MiniLM-L6-v2 turns each chunk into 384 numbers, and texts about similar things end up near each other. "Which GPU is in the Proxmox box" lands near a paragraph about passing an RTX 3060 through to a VM even if they share no words. At query time I embed the question and multiply the matrix by the query vector. That is the whole vector search.

Dense search is good at meaning and bad at specifics. To MiniLM, two similar port numbers in otherwise similar sentences look nearly identical, and my notes are full of model numbers, ports, and hostnames. So the second search is BM25, the keyword formula search engines have used since the 1990s. It scores a chunk higher when it contains the query's terms, gives rare terms more weight, and stops rewarding repetition after a point. It has no idea what anything means, and it will not confuse two similar port numbers.

Fusion is plain arithmetic. BM25 scores have no fixed range, so I divide each one by the best BM25 score for that query, which puts the top keyword match at 1.0. Each chunk then gets half its cosine similarity and half its normalized BM25 score. I picked 0.5 by sweeping the 40-question dev set. Dense-only scored 0.800 recall@5 there; the hybrid did better, and BM25 alone matched it, which told me the questions were too close to my note wording. I tried reciprocal rank fusion, which is the usual recommendation, and it did worse on both question sets. The linear blend stayed.

The first twenty get a second look

Both first-stage searches score the question and the chunk separately. A chunk's embedding is computed long before anyone asks anything, so it cannot know which part of the chunk will matter. A cross-encoder fixes that by reading the question and the chunk together as one input and returning a single relevance score. It is much more accurate and far too slow to run over 8,723 chunks. So it only sees the top 20 from the fused list.

I use ms-marco-MiniLM-L-6-v2, which is small enough for the Mac mini's CPU. It adds about 87 ms per query, roughly 95% of total search time. Those 87 ms are the best-spent time in the system. On the 24 held-out questions, recall@5 went from 0.750 without the reranker to 0.958 with it. Depth 20, 30, and 50 scored identically, so 20 is not a tuned knob.

The reranker also made the cards useful. The best cards always make it into the reranker's pool. If no card reaches the top five but one is close, it takes the fifth slot. That is how the Creekwood card got to rank 5 for "what CPU and GPU are in my main gaming desktop?" The query never says Creekwood. The card does.

The GPU sits this one out

The Mac mini M4 has 10 cores, 4 performance and 6 efficiency, and 16 GB of unified memory. Retrieval and reranking run there, with torch capped at four threads to keep the reranker on the performance cores. The RTX 3060 lives in a VM on the P520 and runs qwen3.5:9b at about 44 tokens per second. A warm answer takes 1.6–3.5 seconds of generation; a cold model load is about 19 seconds. My last end-to-end test was 6.9 seconds.

I tried the GPU for retrieval too. bge-m3, a 1024-dimensional embedding model, re-embedded all 7,693 chunks on the 3060 in 142 seconds and improved the first stage. After the same reranker, it tied CPU MiniLM exactly on recall@5. The 3060 is also shared with another workload, and pinning search to it would make search disappear whenever that workload had the card. The GPU earns its place on generation. It does not earn it on retrieval.

There is no vector database. At this size, a brute-force NumPy scan is a few milliseconds and has no moving parts. I would revisit that around 100,000 chunks, or when the index stops fitting in memory comfortably. At 8,723 chunks it fits with room to spare.

Everything that broke was plumbing

The first problem was getting Python to open a Markdown file. iCloud had evicted the vault: the files still appeared in a directory listing with a dataless flag, but their contents were not on disk. Reading one returned errno 11, "Resource deadlock avoided." I pulled down 622 files in 11 seconds with a materialization script. Ingest still handles the error: on errno 11 it runs brctl download, waits a second, and tries once more.

A downloaded file can still be unreadable to the process that needs it. macOS TCC denied Hermes reads inside the iCloud vault with "Operation not permitted." I moved the indexer and the full-note reader to a local clone of the private git mirror. The clone has ordinary files on disk, and the agent can read them. The cost is freshness. Vault edits take roughly 15–30 minutes to reach the mirror, and the Mac checks for updates every 10 minutes. A note I just wrote can be missing from search long enough for me to wonder whether I wrote it.

The refresh job pulls the clone and skips the rebuild when the commit is unchanged. When it does rebuild, it reuses embeddings whose model and text match the previous build. The service hot-reloads when meta.json changes, and the script restarts it only if the served commit check fails.

The answer endpoint hit a second macOS permission problem. A launchd test job got errno 65, "No route to host," when it tried the local network. macOS Local Network privacy was blocking the connection. I reach Ollama over a private network instead. Search still runs when the GPU is down. If Ollama is unreachable, /ask returns the source list with generator: "offline". Hermes can fetch its own sources.

Privacy is a filter on the same index. Ninety-six notes are marked visibility: private; they are still embedded, and they are excluded from search and ask by default. /search and the MCP search tool can opt in with include_private=true; /ask cannot. The full-note reader refuses private paths and non-Markdown files by default. The boundary is imperfect because the index still contains the text, but it keeps the default path from handing private notes to a model.

I graded my own homework

The first evaluation looked good. I wrote 40 questions, tuned the fusion weight on them, and got 0.925 recall@5. Then I wrote 24 new questions and scored 0.750 on the same first-stage setup. That is the difference between a test set and a tuning set. Reranking brought the 24 to 0.958.

Set recall@5 note recall@5
Dev (40 q) 0.925 1.000
Held-out (24 q) 0.958 0.958

MRR was 0.850 on the dev set and 0.770 on the held-out set.

The two misses are more useful than the averages. h11 asked for "my main gaming desktop" without naming Creekwood; the card and the reserved slot now put the right note at rank 5. h04 asks which laptop is on the someday list for a NixOS install. The answer is at rank 4, in the NixOS note, while the gold path is a different note. Strict path recall counts that as a miss. Fact recall gives it credit. I left the strict metric alone because it is the one that tells me whether the note I wanted is actually in the result.

I also tuned the card slot on the held-out set. That makes 0.958 a validation number, not an unbiased estimate. With 24 questions, one question moves the score by about 4 points. The honest summary is that the system is good enough to use and not good enough to stop measuring.

The no-answer side is simpler. Ten off-topic questions, including the capital of France and the boiling point of water, all scored 0.0. /search flags a top score below 0.03 as low confidence. /ask abstains below 0.30 and does not call the generator. The 0.30 gate is a precision gate, not proof that the answer exists. I would rather it refuse than invent a citation.

What I'd change

I would write the held-out set before tuning anything. I would put no-answer questions in the evaluation from the start instead of probing ten by hand after the fact. I would add a way to read the live vault on demand, either Full Disk Access or a small materializer, so a note I just wrote does not wait for the mirror. And I would add obsidian:// links to the results so a citation opens the note rather than only the path.

Vault writes and automatic tagging can wait. The system already does the thing I wanted: when I ask Hermes a question about my machines, it can open the right note first. The rest is plumbing I no longer have to think about.

I asked it which GPU was in the P520 while I was writing this. It returned the P520 note, the VM note, and the paragraph about the passthrough. I read the paragraph and went back to writing. That is the whole feature.