<?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>Forem: Leo KIM</title>
    <description>The latest articles on Forem by Leo KIM (@leokim_kr).</description>
    <link>https://forem.com/leokim_kr</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.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F3853452%2F37546be2-9af9-4e02-addb-bcaa7ef6c8a5.png</url>
      <title>Forem: Leo KIM</title>
      <link>https://forem.com/leokim_kr</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/leokim_kr"/>
    <language>en</language>
    <item>
      <title>I Built a RAG-like Context Engine for Claude Code — Without Vector DB</title>
      <dc:creator>Leo KIM</dc:creator>
      <pubDate>Tue, 31 Mar 2026 12:23:17 +0000</pubDate>
      <link>https://forem.com/leokim_kr/i-built-a-rag-like-context-engine-for-claude-code-without-vector-db-3k0b</link>
      <guid>https://forem.com/leokim_kr/i-built-a-rag-like-context-engine-for-claude-code-without-vector-db-3k0b</guid>
      <description>&lt;h2&gt;
  
  
  The Problem
&lt;/h2&gt;

&lt;p&gt;Claude Code reads your &lt;code&gt;CLAUDE.md&lt;/code&gt; once at session start. But here's the thing — &lt;a href="https://vercel.com/blog/how-we-build-software-with-ai" rel="noopener noreferrer"&gt;Vercel's engineering team found&lt;/a&gt; that skills-based retrieval was &lt;strong&gt;skipped in 56% of eval cases&lt;/strong&gt;. The model simply didn't invoke them.&lt;/p&gt;

&lt;p&gt;I run Claude Code as my daily coding assistant across 26+ custom resources. After months of watching Claude forget rules, ignore conventions, and skip critical project knowledge, I built a system to fix it.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Solution: Context Feeder
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Context Feeder&lt;/strong&gt; is a lightweight context injection engine that runs on Claude Code hooks. It doesn't ask the model what's relevant — it &lt;strong&gt;force-injects&lt;/strong&gt; matched context on every message.&lt;/p&gt;

&lt;p&gt;No vector database. No embeddings. No cloud API. Just JSON tags + shell scripts.&lt;/p&gt;

&lt;p&gt;🔗 &lt;strong&gt;GitHub&lt;/strong&gt;: &lt;a href="https://github.com/friends0485-cyber/context-feeder" rel="noopener noreferrer"&gt;github.com/friends0485-cyber/context-feeder&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  How It Works: 3-Stage Chain
&lt;/h2&gt;

&lt;p&gt;Your Message&lt;br&gt;
→ Parser (keyword match against tags.json)&lt;br&gt;
→ Counter (track frequency, assign rank: best/normal/worst)&lt;br&gt;
→ Injector (check rank threshold, read file, output to Claude's context)&lt;/p&gt;
&lt;h3&gt;
  
  
  Stage 1: Parser (&lt;code&gt;tag_search.py&lt;/code&gt;)
&lt;/h3&gt;

&lt;p&gt;Reads the user message from Claude Code's &lt;code&gt;UserPromptSubmit&lt;/code&gt; hook via stdin, scans for keywords defined in &lt;code&gt;tags.json&lt;/code&gt;, and saves matched file paths.&lt;/p&gt;
&lt;h3&gt;
  
  
  Stage 2: Counter (&lt;code&gt;counter.py&lt;/code&gt;)
&lt;/h3&gt;

&lt;p&gt;Tracks how many times each tag has been called in the current session. Assigns a rank:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Rank&lt;/th&gt;
&lt;th&gt;Threshold&lt;/th&gt;
&lt;th&gt;Meaning&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;best&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;1st match → inject&lt;/td&gt;
&lt;td&gt;Frequently used tag&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;normal&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;2nd match → inject&lt;/td&gt;
&lt;td&gt;Standard frequency&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;worst&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;3rd match → inject&lt;/td&gt;
&lt;td&gt;Rarely used, auto-deleted after 30 days&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;
&lt;h3&gt;
  
  
  Stage 3: Injector (&lt;code&gt;tag_injector.sh&lt;/code&gt;)
&lt;/h3&gt;

&lt;p&gt;Reads the ranked results, checks a 30-minute cooldown (prevents re-injection of the same file), and outputs matched TOML content to stdout — which Claude Code injects into the conversation context.&lt;/p&gt;
&lt;h2&gt;
  
  
  Context File Format
&lt;/h2&gt;

&lt;p&gt;Rules and knowledge are stored as &lt;code&gt;.toml&lt;/code&gt; files:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight toml"&gt;&lt;code&gt;&lt;span class="nn"&gt;[rule_001]&lt;/span&gt;
&lt;span class="py"&gt;title&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="s"&gt;"API Error Handling"&lt;/span&gt;
&lt;span class="py"&gt;tags&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s"&gt;"error"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s"&gt;"catch"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s"&gt;"try"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s"&gt;"exception"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
&lt;span class="py"&gt;content&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="s"&gt;'''
All API endpoints must:
- Wrap async handlers with error middleware
- Return structured error responses
- Never expose stack traces to clients
'''&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The &lt;code&gt;tags&lt;/code&gt; field is what the parser matches against. The &lt;code&gt;content&lt;/code&gt; is what gets injected.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why Not RAG?
&lt;/h2&gt;

&lt;p&gt;Claude Code's own team &lt;a href="https://zerofilter.medium.com/why-claude-code-is-special-for-not-doing-rag-vector-search-agent-search-tool-calling-versus-41b9a6c0f4d9" rel="noopener noreferrer"&gt;confirmed&lt;/a&gt; they dropped vector DB-based RAG early on:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;"We tried RAG… we tried a few different kinds of search tools. And eventually, we landed on just agentic search… One is it outperformed everything. By a lot."&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Context Feeder follows the same philosophy — deterministic keyword matching instead of probabilistic similarity search. It's faster, simpler, and requires zero infrastructure.&lt;/p&gt;

&lt;h2&gt;
  
  
  Key Differences from Existing Tools
&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Tool&lt;/th&gt;
&lt;th&gt;Approach&lt;/th&gt;
&lt;th&gt;Context Feeder&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;CLAUDE.md&lt;/td&gt;
&lt;td&gt;Read once, model decides relevance&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;Force-injected on every match&lt;/strong&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;RAG + Vector DB&lt;/td&gt;
&lt;td&gt;Embeddings + infrastructure&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;JSON keywords + shell scripts&lt;/strong&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Claude-Mem&lt;/td&gt;
&lt;td&gt;Session memory (past observations)&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;Rule injection (present context)&lt;/strong&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Skills&lt;/td&gt;
&lt;td&gt;Model chooses to invoke&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;System forces delivery&lt;/strong&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h2&gt;
  
  
  Quick Start
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;Clone the repo&lt;/li&gt;
&lt;li&gt;Add your rules as &lt;code&gt;.toml&lt;/code&gt; files in &lt;code&gt;contexts/&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Register keywords in &lt;code&gt;config/tags.json&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Connect to Claude Code hooks in &lt;code&gt;.claude/settings.json&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Done — next message triggers automatic injection&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Beyond the Core Engine
&lt;/h2&gt;

&lt;p&gt;The open-source release is the core 3-stage chain. My production system has 10 interconnected modules including a logger (21 categories), watchdog (real-time dashboard), reminder (workflow violation detection), and a live console UI. The full architecture is documented in the repo.&lt;/p&gt;

&lt;h2&gt;
  
  
  What's Next
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Auto-scanner that rebuilds tags.json from your TOML files (included)&lt;/li&gt;
&lt;li&gt;Community-contributed context templates for popular frameworks&lt;/li&gt;
&lt;li&gt;Integration patterns for monorepos&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;I'd love to hear how others are handling context injection with Claude Code hooks. What patterns have worked for you?&lt;/p&gt;




&lt;p&gt;&lt;em&gt;Built by Leo KIM — AI Automation Engineer&lt;/em&gt;&lt;br&gt;
&lt;em&gt;GitHub: &lt;a href="https://github.com/friends0485-cyber/context-feeder" rel="noopener noreferrer"&gt;context-feeder&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;  &lt;iframe src="https://www.youtube.com/embed/9Z3eW1VVQ8c"&gt;
  &lt;/iframe&gt;
&lt;/p&gt;

</description>
      <category>ai</category>
      <category>python</category>
      <category>opensource</category>
      <category>productivity</category>
    </item>
  </channel>
</rss>
