DEV Community

Moses Lee
Moses Lee

Posted on

I removed vector search from my knowledge base. Here's what replaced it.

I ran a vector-search knowledge base for a month. Then I deleted the embeddings.

Not because RAG is bad. Because I had misdiagnosed my problem.

The four questions a vector index can't answer

Here's what actually hurt after a few thousand notes:

  • "If I change A, what else has to change?"
  • "Which version settled this conclusion, and why was the previous one rejected?"
  • "Where did this rule come from — is there any basis for it?"
  • "Is this a universal claim, or something that was true for one system at one point in time?"

All four need the same thing: an explicit, directed, checkable relationship.

A vector index returns semantic neighbors. That's similarity, not relation. Ask "what does this pouring technique depend on" and you get three more articles about pouring — but the "depends on" edge was never stored anywhere, so no retrieval method can recover it.

Three symptoms pushed me over the edge:

  1. Same question, twice, different answers. Fine for a chatbot. Fatal for a knowledge base — I need "what is this rule", not "what would the model say about this rule today."
  2. No way to locate an error. Was it chunking, the embedding, or a genuine contradiction in the source? Whole pipeline is a black box, so the only debugging strategy is "start over."
  3. I stopped trusting it. And a knowledge base you don't trust is just a very expensive text file.

The realization: I had a data problem and I was solving it with retrieval. Retrieval's ceiling is the source text. Anything not written down cannot be retrieved, however clever the index.

The fix: relationships are typed fields, not prose

The core move is one line of YAML:

---
id: KB:coffee.method.Pour
type: Method
obj_type: 流程
domain: 咖啡冲煮域
modality: universal
definition: 分三段注水并各留一次排气间隙的做法
part_of: ["[[手冲咖啡]]"]
implemented_by: ["[[V60 滤杯]]"]
anchors: ["示例数据:虚构"]
evidence_level: C
---
Body text mentioning [[金杯准则]] is just a mention. It does not enter the graph.
Enter fullscreen mode Exit fullscreen mode

Two design decisions matter more than the rest:

1. Edges are typed and directed. part_of and implemented_by point in different directions and are not interchangeable. This is exactly why [[wikilinks]] in body text are not enough: a wikilink says "mentioned", not "how it relates". That distinction is the single biggest source of confusion in note-taking systems — I ended up writing a whole doc about it (docs/04-body-vs-relation.md).

2. The relation set is closed. Five entity types (Concept / Method / Tool / Scenario / Pattern), fifteen relations. Nothing else. Every extra relation costs you a validation rule and a batch of edge cases. An ontology you can't fully validate is worse than no ontology.

Once the graph exists, the pipeline works:

frontmatter → graph → deterministic query → assertion → regression test
Enter fullscreen mode Exit fullscreen mode

What changes once relationships are executable

Queries become deterministic. Same question, same answer, every time — it's graph traversal over registered edges, no probability involved.

python3 vault/_kb/kb.py ask 注水手法      # what does it depend on
python3 vault/_kb/kb.py impact 手冲咖啡    # what changes if I edit this
python3 vault/_kb/kb.py lineage D-20260110-新手训练路径   # what superseded what
python3 vault/_kb/kb.py chain D-20260401-新手训练路径改版 # full decision chain
Enter fullscreen mode Exit fullscreen mode

Errors become testable. This is the part I keep telling people about. You can encode "this technique must depend on that tool" as an assertion:

python3 vault/_kb/kb.py test   # 10/10 PASS
Enter fullscreen mode Exit fullscreen mode

Break the relationship later, and the regression suite goes red. Your knowledge base now has unit tests. That's a sentence I couldn't write about any of the RAG setups I built.

Errors point at a field. Validation says "card X's part_of points at a nonexistent id" — not "the answer looks off."

There's also a pre-commit gate with three checks: required frontmatter fields, target existence, and body-mention vs. declared-relation consistency. Errors get blocked before they pollute the graph, instead of being discovered months later through a wrong answer.

Why zero dependencies

The whole CLI is stdlib-only Python 3.9+. No install step:

git clone https://github.com/lbh-banboo/ontology-kb && cd ontology-kb
python3 vault/_kb/kb.py check   # expect violation 0
python3 vault/_kb/kb.py test    # expect 10/10 PASS
python3 vault/_kb/kb.py stats   # 11 cards / 1 placeholder / 19 edges
Enter fullscreen mode Exit fullscreen mode

This is a deliberate constraint, not minimalism for its own sake. A tool that manages your notes for a decade has to survive dependency rot. If it needs a venv, a lockfile, and two major-version upgrades a year, it will be dead in five.

Where this approach loses

Being honest about the failure modes, because these are the ones that bit me:

  • "I remember reading something about X." Vector search wins outright. A typed graph can't help at all.
  • Long unstructured sources (papers, books) that can't be decomposed into cards. The upfront cost will make you quit.
  • Small libraries (a few dozen notes). Manual relation maintenance costs more than full-text search.

And the current status isn't "finished":

  • check is violation 0 and test is 10/10 PASS, but both at demo scale (11 cards, 19 edges).
  • The evaluation gate is PENDING. I haven't built a 100-question set, so there are no measured numbers for the four thresholds.
  • Ontology completeness has open items, listed in ontology.md §7.

That's in the README's status table on purpose. A knowledge base project that hides its unfinished parts isn't worth trusting — which is the same argument as "a knowledge base must be checkable."

Minimal starting path

Don't build a full ontology first. Three steps:

  1. Scope to one narrow domain. Not "all my knowledge" — "coffee brewing" or "our team's deployment conventions." Something you can enumerate in an afternoon.
  2. Three entity types, five relations. Work backwards from "what are the three questions I ask most often." That determines which edges you actually need.
  3. Get check and test green before adding content. The reverse order costs you two weeks of card writing followed by an ontology redesign and a full redo.

The 12-step playbook is in docs/10-playbook.md — and every step has an acceptance criterion, not just a task description. "Done" means "satisfies this criterion", which is a different sentence.

The short version

Vector search solves "I can't find it." An ontology solves "I can't state it precisely."

The first is a recall problem. The second is a data problem. You need both eventually, but the order isn't flexible — without relationship data, better retrieval just means sifting sentences out of noise more efficiently.

Repo (code Apache-2.0, docs and cards CC BY 4.0): github.com/lbh-banboo/ontology-kb

The repo ships method and tooling only — no real personal knowledge content. Sample data is a fictional coffee-brewing domain, which exists purely to prove the spec and the tooling run.

If this is useful to you, what I want isn't a star. It's one failure mode you hit, with an executable criterion attached. There are 17 in docs/09-failure-modes.md right now, and every single one was earned the hard way.

Top comments (0)