Problem
The vault holds decisions, build logs, and project context that are only useful when they can be found. Keyword search gets most of the way, but it misses a question phrased differently from the note that answers it. I wanted retrieval that connects the two while the vault never leaves my machines.
Approach
Everything runs offline. A local all-MiniLM-L6-v2 model embeds the notes on CPU, a numpy matrix holds the vectors, and an in-memory BM25 index covers exact terms like model numbers and VM ids. A query scores both and fuses them with one weight. Then a small cross-encoder rescores the top 20 candidates. Search returns source chunks with the note path and heading. Nothing at this stage generates or paraphrases text.
Architecture and workflow
vault (git mirror, hourly pull)
│
▼
ingest.py ── heading-aware 800/100 chunks
│ boilerplate dropped, embeddings reused by content hash
▼
index/ (vectors + chunks + meta, written atomically)
│ service hot-reloads on change, no restart
▼
FastAPI on the Mac mini (CPU, always on)
├─ /search dense + BM25 → cross-encoder rerank → cited chunks
└─ /ask same sources → local LLM on the homelab GPU, if it's up
▲
MCP tool for my agent · terminal CLI
The service runs as a background job on my Mac mini. My agent reaches it as an MCP tool, and I reach it from a terminal CLI. An hourly job pulls the vault mirror and rebuilds the index. Only new or changed chunks get re-embedded, so a typical rebuild takes under a second instead of about 22.
Important decisions
Measure before generating. The scorer is strict. A hit counts only when the chunk comes from the right note and contains the answer text verbatim.
Hold something out. The fusion weight was tuned on the original 40 questions, so I wrote 24 new questions from notes those 40 never touch. On the held-out set, the version I had been running scored 0.75 recall@5, well below the 0.925 it reported on the tuned set. That gap is the real finding of this project.
Keep search off the GPU. The homelab's one RTX 3060 normally drives a wallboard kiosk, and a separate VM borrows it for AI work. Tying search to that VM would make search disappear whenever the kiosk has the card. The GPU also turned out not to matter for retrieval. Re-embedding every chunk with the much larger bge-m3 model on the 3060 took 142 s and improved the first stage. After the rerank, though, it scored exactly the same as CPU MiniLM. The GPU earns its keep for generation, so that's all it does here.
Current result
692 notes → 7,693 chunks. Scores are recall@5 / recall@10 / MRR.
| Configuration | Tuned set (40) | Held-out (24) | p50 / query |
|---|---|---|---|
| Dense + BM25 (previous) | 0.925 / 0.975 / 0.80 | 0.750 / 0.917 / 0.71 | ~7 ms |
| Reciprocal-rank fusion | 0.875 / 0.925 / 0.75 | 0.792 / 0.917 / 0.66 | ~7 ms |
| bge-m3 on GPU + BM25 | 0.950 / 0.950 / 0.83 | 0.792 / 0.875 / 0.69 | ~14 ms |
| Dense + BM25 + rerank (current) | 0.975 / 0.975 / 0.92 | 0.958 / 0.958 / 0.79 | ~85 ms |
The rerank depth isn't a tuned knob: depths 20, 30, and 50 score identically. One question in the tuned set is unanswerable now because its source note was regenerated, so 0.975 there means 39 of 39 answerable questions. Latency is in-process on a busy host. Over HTTP it's about 150 ms.
The optional /ask path hands the same cited sources to a 9B model on the 3060. The model writes a short answer with [n] citations, or says "Not in the vault." Warm answers took 1.6–3.5 s. When the GPU is busy with the kiosk, /ask still returns the sources with no answer instead of failing.
Lessons
- A benchmark you tuned on is a progress bar, not a result. The held-out set moved the honest number down by 17.5 points.
- Fixing the reranker did more than an embedding model 25× larger running on a GPU.
- Most of the audit's fixes were boring. Before them, the service rebuilt everything hourly, restarted mid-request, checked the model hub on every start despite being "offline", and indexed the same 94-copy template line as if it were content.
- macOS Local Network privacy blocks background services from reaching LAN addresses. The fix was routing to the GPU box over the tailnet.
Next steps
A larger held-out set that includes no-answer questions, obsidian:// links on results, and a small read-only UI over /ask that shows its sources.