<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Moses Lee</title>
    <description>The latest articles on DEV Community by Moses Lee (@lbhbanboo).</description>
    <link>https://dev.to/lbhbanboo</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F4258268%2F5e5218f5-bec9-4f8f-9e7d-060b80429758.jpg</url>
      <title>DEV Community: Moses Lee</title>
      <link>https://dev.to/lbhbanboo</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/lbhbanboo"/>
    <language>en</language>
    <item>
      <title>I removed vector search from my knowledge base. Here's what replaced it.</title>
      <dc:creator>Moses Lee</dc:creator>
      <pubDate>Sun, 22 Nov 2026 05:05:26 +0000</pubDate>
      <link>https://dev.to/lbhbanboo/i-removed-vector-search-from-my-knowledge-base-heres-what-replaced-it-1i91</link>
      <guid>https://dev.to/lbhbanboo/i-removed-vector-search-from-my-knowledge-base-heres-what-replaced-it-1i91</guid>
      <description>&lt;p&gt;I ran a vector-search knowledge base for a month. Then I deleted the embeddings.&lt;/p&gt;

&lt;p&gt;Not because RAG is bad. Because I had misdiagnosed my problem.&lt;/p&gt;

&lt;h3&gt;
  
  
  The four questions a vector index can't answer
&lt;/h3&gt;

&lt;p&gt;Here's what actually hurt after a few thousand notes:&lt;/p&gt;

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

&lt;p&gt;All four need the same thing: &lt;strong&gt;an explicit, directed, checkable relationship.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;A vector index returns semantic neighbors. That's &lt;em&gt;similarity&lt;/em&gt;, not &lt;em&gt;relation&lt;/em&gt;. 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.&lt;/p&gt;

&lt;p&gt;Three symptoms pushed me over the edge:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Same question, twice, different answers.&lt;/strong&gt; 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."&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;No way to locate an error.&lt;/strong&gt; 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."&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;I stopped trusting it.&lt;/strong&gt; And a knowledge base you don't trust is just a very expensive text file.&lt;/li&gt;
&lt;/ol&gt;

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

&lt;h3&gt;
  
  
  The fix: relationships are typed fields, not prose
&lt;/h3&gt;

&lt;p&gt;The core move is one line of YAML:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight markdown"&gt;&lt;code&gt;---
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.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Two design decisions matter more than the rest:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;1. Edges are typed and directed.&lt;/strong&gt; &lt;code&gt;part_of&lt;/code&gt; and &lt;code&gt;implemented_by&lt;/code&gt; point in different directions and are not interchangeable. This is exactly why &lt;code&gt;[[wikilinks]]&lt;/code&gt; 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 (&lt;code&gt;docs/04-body-vs-relation.md&lt;/code&gt;).&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;2. The relation set is closed.&lt;/strong&gt; 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.&lt;/p&gt;

&lt;p&gt;Once the graph exists, the pipeline works:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;frontmatter → graph → deterministic query → assertion → regression test
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  What changes once relationships are executable
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;Queries become deterministic.&lt;/strong&gt; Same question, same answer, every time — it's graph traversal over registered edges, no probability involved.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;python3 vault/_kb/kb.py ask 注水手法      &lt;span class="c"&gt;# what does it depend on&lt;/span&gt;
python3 vault/_kb/kb.py impact 手冲咖啡    &lt;span class="c"&gt;# what changes if I edit this&lt;/span&gt;
python3 vault/_kb/kb.py lineage D-20260110-新手训练路径   &lt;span class="c"&gt;# what superseded what&lt;/span&gt;
python3 vault/_kb/kb.py chain D-20260401-新手训练路径改版 &lt;span class="c"&gt;# full decision chain&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Errors become testable.&lt;/strong&gt; This is the part I keep telling people about. You can encode "this technique must depend on that tool" as an assertion:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;python3 vault/_kb/kb.py &lt;span class="nb"&gt;test&lt;/span&gt;   &lt;span class="c"&gt;# 10/10 PASS&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



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

&lt;p&gt;&lt;strong&gt;Errors point at a field.&lt;/strong&gt; Validation says "card X's &lt;code&gt;part_of&lt;/code&gt; points at a nonexistent id" — not "the answer looks off."&lt;/p&gt;

&lt;p&gt;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.&lt;/p&gt;

&lt;h3&gt;
  
  
  Why zero dependencies
&lt;/h3&gt;

&lt;p&gt;The whole CLI is stdlib-only Python 3.9+. No install step:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git clone https://github.com/lbh-banboo/ontology-kb &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="nb"&gt;cd&lt;/span&gt; ontology-kb
python3 vault/_kb/kb.py check   &lt;span class="c"&gt;# expect violation 0&lt;/span&gt;
python3 vault/_kb/kb.py &lt;span class="nb"&gt;test&lt;/span&gt;    &lt;span class="c"&gt;# expect 10/10 PASS&lt;/span&gt;
python3 vault/_kb/kb.py stats   &lt;span class="c"&gt;# 11 cards / 1 placeholder / 19 edges&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;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.&lt;/p&gt;

&lt;h3&gt;
  
  
  Where this approach loses
&lt;/h3&gt;

&lt;p&gt;Being honest about the failure modes, because these are the ones that bit me:&lt;/p&gt;

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

&lt;p&gt;And the current status isn't "finished":&lt;/p&gt;

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

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

&lt;h3&gt;
  
  
  Minimal starting path
&lt;/h3&gt;

&lt;p&gt;Don't build a full ontology first. Three steps:&lt;/p&gt;

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

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

&lt;h3&gt;
  
  
  The short version
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;Vector search solves "I can't find it." An ontology solves "I can't state it precisely."&lt;/strong&gt;&lt;/p&gt;

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

&lt;p&gt;Repo (code Apache-2.0, docs and cards CC BY 4.0): &lt;strong&gt;github.com/lbh-banboo/ontology-kb&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;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.&lt;/p&gt;

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

</description>
      <category>opensource</category>
      <category>python</category>
      <category>architecture</category>
      <category>pkm</category>
    </item>
  </channel>
</rss>
