<?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: Trust Mutemasango</title>
    <description>The latest articles on DEV Community by Trust Mutemasango (@trust_mutemasango_c24e776).</description>
    <link>https://dev.to/trust_mutemasango_c24e776</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%2F1989855%2Fab567576-da4f-4c79-9dfb-902df82cde70.jpg</url>
      <title>DEV Community: Trust Mutemasango</title>
      <link>https://dev.to/trust_mutemasango_c24e776</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/trust_mutemasango_c24e776"/>
    <language>en</language>
    <item>
      <title>YodaMan 0.6.7 and Context Expert 1.4.0: we wrote down what our tool does, and found 50 bugs</title>
      <dc:creator>Trust Mutemasango</dc:creator>
      <pubDate>Sat, 21 Nov 2026 20:31:15 +0000</pubDate>
      <link>https://dev.to/trust_mutemasango_c24e776/yodaman-067-and-context-expert-140-we-wrote-down-what-our-tool-does-and-found-50-bugs-508o</link>
      <guid>https://dev.to/trust_mutemasango_c24e776/yodaman-067-and-context-expert-140-we-wrote-down-what-our-tool-does-and-found-50-bugs-508o</guid>
      <description>&lt;p&gt;YodaMan is a developer tool that runs entirely on your own machine. It searches your code, maps how your files depend on each other, and keeps track of what your project's specs say. It answers questions with a local model through Ollama. Nothing leaves your computer: no cloud model, no API key, no telemetry.&lt;/p&gt;

&lt;p&gt;Under the hood, every search goes through three steps:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Context Expert&lt;/strong&gt; (&lt;code&gt;ctx&lt;/code&gt;) finds the code that matches your question.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Graphify&lt;/strong&gt; ranks the results using your project's dependency graph.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;OpenSpec&lt;/strong&gt; tags each result with the spec that describes it.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;This post covers two releases that shipped together: &lt;strong&gt;YodaMan 0.6.7&lt;/strong&gt; and &lt;strong&gt;Context Expert 1.4.0&lt;/strong&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  We wrote down what YodaMan does. All of it.
&lt;/h2&gt;

&lt;p&gt;Before this release, YodaMan had no written description of how it is supposed to behave. The code was the only source of truth, and code is a poor place to look up intent.&lt;/p&gt;

&lt;p&gt;So we wrote one. YodaMan now has a full &lt;a href="https://github.com/Fission-AI/OpenSpec" rel="noopener noreferrer"&gt;OpenSpec&lt;/a&gt; specification: 17 areas (search, the agent, approvals, the desktop app, plugins, releases and more) and about 250 requirements. Each requirement says what the tool must do, with concrete examples: the exact route, the exact error message, the exact file.&lt;/p&gt;

&lt;p&gt;Writing it meant checking every claim against the code. That is where things got interesting.&lt;/p&gt;

&lt;h2&gt;
  
  
  Writing the spec found about 50 bugs
&lt;/h2&gt;

&lt;p&gt;When you describe behaviour precisely, you notice where the code does something else. We found about fifty places like that. A few highlights:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Ask skipped the search pipeline.&lt;/strong&gt; The "ask a question" route called Context Expert directly, so answers were not scoped to your workspace and not ranked by your dependency graph. It now goes through all three steps, like every other search.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;A live update channel did not check who was asking.&lt;/strong&gt; Any web page open in your browser could listen to it. It now gets the same checks as the rest of the API.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Folder paths were trusted too much.&lt;/strong&gt; Several actions, including git commits and the agent, accepted any folder you named. They now only work on workspaces you have added to YodaMan.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Text could turn into command-line flags.&lt;/strong&gt; A file or branch name starting with &lt;code&gt;-&lt;/code&gt; could be read by git as an option. That is closed for git, Context Expert and Graphify.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Your disabled plugins came back after every upgrade.&lt;/strong&gt; The list lived inside the app itself. It now lives in your data folder.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;The Lightsaber plugin never reported a hotspot.&lt;/strong&gt; A broken regular expression made every file look simple.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Holocron VR could not draw its 3D view.&lt;/strong&gt; It crashed on the first frame. It now renders, and VR goes through three.js's own WebXR support.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;There were also smaller ones: an approval that accepted the text &lt;code&gt;"false"&lt;/code&gt; as a yes, a Dashboard button that could not work on most setups, a help command that hung instead of printing help, and docs that described routes and flags that no longer existed. The documentation was checked line by line against the code and corrected throughout.&lt;/p&gt;

&lt;h2&gt;
  
  
  Tests that stop the same bug coming back
&lt;/h2&gt;

&lt;p&gt;Fixing a bug is half the job. The other half is making sure it cannot quietly return.&lt;/p&gt;

&lt;p&gt;Every fix in this release ships with a test that &lt;strong&gt;fails on the old code&lt;/strong&gt; and passes on the new code. We checked each one by putting the bug back and watching the test fail.&lt;/p&gt;

&lt;p&gt;Where a bug was one example of a pattern, we added a broader "guard" test that scans the whole codebase for that pattern. For example:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Every API error must include an error code.&lt;/li&gt;
&lt;li&gt;Text from a request must never reach git or another tool as a flag.&lt;/li&gt;
&lt;li&gt;Any route that takes a folder must check that it is a registered workspace.&lt;/li&gt;
&lt;li&gt;The VS Code extension and mobile app may only read fields the server actually sends.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;There are 16 of these guards now. The next time someone writes one of these bugs, the build fails before it ships.&lt;/p&gt;

&lt;h2&gt;
  
  
  From now on, every change starts as a spec
&lt;/h2&gt;

&lt;p&gt;The biggest change in this release is in how YodaMan is built. Every feature, fix and chore now starts as an OpenSpec change: a short proposal, a list of tasks, and the spec updates it will make. When it is done, it is checked against the spec and archived, so the spec always matches the code.&lt;/p&gt;

&lt;p&gt;The OpenSpec workflows ship inside the repository, so anyone contributing with Claude Code gets them automatically. The same setup now covers all five YodaMan projects: the core app, Context Expert, Holocron VR, Lightsaber and the Homebrew tap.&lt;/p&gt;

&lt;h2&gt;
  
  
  Context Expert 1.4.0: better search in more languages
&lt;/h2&gt;

&lt;p&gt;Context Expert is the search engine behind YodaMan. It splits your code into chunks, turns them into vectors on your machine, and finds the best matches for a question. Version 1.4.0 makes those chunks smarter.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;15 languages are split at their definitions.&lt;/strong&gt; C, C++, PHP, Ruby, PowerShell, Dart, Kotlin and Swift join the list. Each method becomes its own chunk, labelled with its class, so search results point at the function you meant, not half a file.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;New file types are indexed:&lt;/strong&gt; Dart, VB.NET, PowerShell, plus Makefiles, Gemfiles, Podfiles and friends, which were silently skipped before.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Nothing gets dropped.&lt;/strong&gt; Some lines (like a lone &lt;code&gt;else {&lt;/code&gt; at the end of a file) fell outside every chunk and were never indexed. Every non-blank line now lands in exactly one chunk. A file the parser cannot read is still indexed, split by size, with a warning.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;No compiler needed.&lt;/strong&gt; Languages without a prebuilt parser ship as WebAssembly, so installing never builds anything.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Lots of small fixes:&lt;/strong&gt; &lt;code&gt;.tsx&lt;/code&gt; files use the right grammar, minified bundles are skipped, &lt;code&gt;search.top_k&lt;/code&gt; from your config is respected, tags you set are kept on re-index, and a failed first index leaves nothing behind.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Because chunks are split differently, &lt;strong&gt;re-index your projects after upgrading:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;ctx index &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;path&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; --force
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Upgrading
&lt;/h2&gt;

&lt;p&gt;YodaMan needs Node 24 or later.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# Homebrew&lt;/span&gt;
brew upgrade yodaman

&lt;span class="c"&gt;# or npm&lt;/span&gt;
npm install -g yodaman@0.6.7
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then let YodaMan bring Context Expert and the other tools up to date:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;yodaman setup
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Desktop downloads for macOS and Linux, the VS Code extension and the Holocron VR plugin are on the website. The VS Code extension updates from the Marketplace.&lt;/p&gt;

&lt;h2&gt;
  
  
  Thanks for reading
&lt;/h2&gt;

&lt;p&gt;YodaMan is open source under the MIT licence. If you try it, find a bug, or want to help, the repository is at &lt;a href="https://github.com/Yoda-Man/yodaman" rel="noopener noreferrer"&gt;github.com/Yoda-Man/yodaman&lt;/a&gt;. Issues and pull requests are welcome, and now every one of them starts with a spec.&lt;/p&gt;

</description>
      <category>developer</category>
      <category>llm</category>
      <category>softwaredevelopment</category>
      <category>tools</category>
    </item>
    <item>
      <title>Ask Your Code Questions: Meet yodaman-ctx</title>
      <dc:creator>Trust Mutemasango</dc:creator>
      <pubDate>Fri, 20 Nov 2026 08:27:30 +0000</pubDate>
      <link>https://dev.to/trust_mutemasango_c24e776/ask-your-code-questions-meet-yodaman-ctx-458l</link>
      <guid>https://dev.to/trust_mutemasango_c24e776/ask-your-code-questions-meet-yodaman-ctx-458l</guid>
      <description>&lt;p&gt;&lt;em&gt;A free tool that helps you find your way around any codebase, answers your questions with proof, and keeps your code on your own computer.&lt;/em&gt;&lt;/p&gt;




&lt;h2&gt;
  
  
  The problem every developer knows
&lt;/h2&gt;

&lt;p&gt;You open a project you have never seen before. Maybe you just joined the team, maybe you are picking up someone else's work, or maybe it is your own code from two years ago. You have a simple question:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Where do we stop people from logging in too many times?&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;The answer is in there somewhere. But the search box in your editor only finds the exact words you type, and the code never says "logging in too many times". The person who wrote it is busy, on holiday, or long gone.&lt;/p&gt;

&lt;p&gt;So you click through folders, open file after file, and lose an afternoon.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;yodaman-ctx&lt;/strong&gt; (ctx for short) is built to save you that afternoon.&lt;/p&gt;




&lt;h2&gt;
  
  
  What ctx does, in one sentence
&lt;/h2&gt;

&lt;p&gt;You point ctx at a project once, and from then on you can search it by what the code &lt;em&gt;does&lt;/em&gt;, not just what it is called, and ask questions that come back with answers and the exact files and lines they came from.&lt;/p&gt;

&lt;p&gt;It is free, open source (MIT licence), and runs entirely on your own machine.&lt;/p&gt;




&lt;h2&gt;
  
  
  The gaps it fills
&lt;/h2&gt;

&lt;h3&gt;
  
  
  1. Finding code when you don't know what it's called
&lt;/h3&gt;

&lt;p&gt;Ordinary search needs the exact word. ctx searches two ways at once:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;By name.&lt;/strong&gt; Type an exact function name or error code and ctx finds it, just like a normal search would. It even understands how programmers write names, so &lt;code&gt;getUserById&lt;/code&gt; is found whether you type the name itself or "get user by id".&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;By meaning.&lt;/strong&gt; Describe what you are looking for in plain words, and ctx finds code that does that, even when it uses completely different words.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;It then combines both, so the code that matches your question in &lt;em&gt;both&lt;/em&gt; ways rises to the top. It also pays attention to where code lives: a question about the chat agent's tool finds the file whose folder and file name contain those words.&lt;/p&gt;

&lt;h3&gt;
  
  
  2. Answers you can check, not just trust
&lt;/h3&gt;

&lt;p&gt;Ask ctx a question in plain English, and it answers using your actual code, with a list of the files and line numbers it relied on. You never have to take its word for it: every answer points you to the source so you can see for yourself.&lt;/p&gt;

&lt;p&gt;If you want to see exactly what information the answer was built from, ctx will show you that too.&lt;/p&gt;

&lt;h3&gt;
  
  
  3. Your code never leaves your computer
&lt;/h3&gt;

&lt;p&gt;Many AI coding tools send your code to a company's servers. ctx does not.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The part that understands meaning runs on your own computer. It downloads once (about 340 MB) and then works offline.&lt;/li&gt;
&lt;li&gt;Answers come from a local AI model that you run yourself through Ollama, a free tool for running models on your own machine.&lt;/li&gt;
&lt;li&gt;There is no cloud service and no account or API key to set up.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;For private, sensitive or client code, that matters.&lt;/p&gt;

&lt;h3&gt;
  
  
  4. Understands how code is organised
&lt;/h3&gt;

&lt;p&gt;ctx doesn't chop files up at random. It reads the structure of the code, so each result is a complete, meaningful piece: a whole function with its comments, or a whole section of a document with its heading.&lt;/p&gt;

&lt;p&gt;It does this for &lt;strong&gt;TypeScript, JavaScript, Python, Go, Rust, Java and C#&lt;/strong&gt;. Other languages are still searchable; they are split into evenly sized pieces instead.&lt;/p&gt;

&lt;h3&gt;
  
  
  5. Reads your documents, too
&lt;/h3&gt;

&lt;p&gt;Requirements and design notes often matter as much as the code. ctx also searches &lt;strong&gt;Markdown, plain text, Word documents and PDFs&lt;/strong&gt;, so an answer can come from a spec as easily as from the source. (A scanned PDF that is only images needs to be converted to text first.)&lt;/p&gt;

&lt;h3&gt;
  
  
  6. Many projects, one place
&lt;/h3&gt;

&lt;p&gt;Index as many projects as you like. Search one, or search them all at once. In a conversation, ctx works out which project you are asking about, or you can tell it to stay focused on one.&lt;/p&gt;

&lt;h3&gt;
  
  
  7. Tells you when it needs a refresh
&lt;/h3&gt;

&lt;p&gt;When ctx improves the way it reads code, older indexes keep working but give weaker results. ctx keeps track of this and tells you, with the exact command to run, when a project's index should be rebuilt. A quick health check (&lt;code&gt;ctx check&lt;/code&gt;) shows the same thing.&lt;/p&gt;

&lt;h3&gt;
  
  
  8. Works with your scripts and AI assistants
&lt;/h3&gt;

&lt;p&gt;Every command except the interactive chat can give its results in a structured format (JSON) that other programs can read. That makes ctx easy to plug into scripts, build pipelines, and AI coding assistants. It is also the search engine behind the YodaMan tool.&lt;/p&gt;

&lt;h3&gt;
  
  
  9. Proves how well it works
&lt;/h3&gt;

&lt;p&gt;ctx comes with a way to measure its own accuracy, and the results are published rather than guessed. On a test of 56 questions about ctx's own code:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;&lt;/th&gt;
&lt;th&gt;How often it's in the top 5 results&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;The right file&lt;/td&gt;
&lt;td&gt;91%&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;The exact passage that answers the question&lt;/td&gt;
&lt;td&gt;70%&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;You can run the same kind of test on your own projects with &lt;code&gt;ctx eval&lt;/code&gt;.&lt;/p&gt;




&lt;h2&gt;
  
  
  Everything it can do
&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Command&lt;/th&gt;
&lt;th&gt;What it does for you&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;ctx index&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Reads a project (or a folder of documents) so you can search it&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;ctx search&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Finds the most relevant code for a question or a name&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;ctx ask&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Answers a question from your code, with sources&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;ctx chat&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;A back-and-forth conversation about your projects&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;ctx list&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Shows the projects you have indexed&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;ctx status&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Shows how much is stored and which model is in use&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;ctx check&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Checks a project is ready to search, and what to fix if not&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;ctx remove&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Deletes a project's index&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;ctx config&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Changes settings, such as which local model answers&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;ctx eval&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Measures how well search works on your own questions&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Inside &lt;code&gt;ctx chat&lt;/code&gt; you can focus on one project, add a short description to help ctx route your questions, index a new project without leaving the chat, and export the whole conversation to a Markdown file to share.&lt;/p&gt;




&lt;h2&gt;
  
  
  What it doesn't do (yet)
&lt;/h2&gt;

&lt;p&gt;Good tools are honest about their limits:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;It isn't right every time.&lt;/strong&gt; On its own test, the exact answer is in the top five results about 7 times in 10. Some kinds of question are harder than others.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Very large projects are slower.&lt;/strong&gt; A search over a project of 25,000 pieces takes about a third of a second. At around 200,000 pieces it can take a few seconds.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Answers need a local model.&lt;/strong&gt; Searching works on its own, but to get written answers you need Ollama installed with a model downloaded.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Some computers use more memory.&lt;/strong&gt; On most Windows, Mac and Linux machines ctx searches directly from disk. On a few others, such as Windows on ARM, it still works but loads more into memory.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Upgrades sometimes need a rebuild.&lt;/strong&gt; After some updates, each project needs to be re-read once. ctx tells you when and how.&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  Who it's for
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Developers joining a new team&lt;/strong&gt; who need to understand a codebase quickly.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Teams working with private code&lt;/strong&gt; who can't send it to an outside service.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Anyone juggling several projects&lt;/strong&gt; who wants one place to search them all.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;People building AI tools and scripts&lt;/strong&gt; who need reliable, structured code search to plug in.&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  Getting started
&lt;/h2&gt;

&lt;p&gt;You'll need Node.js version 24 or later. Then, in three steps:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# 1. Read a project&lt;/span&gt;
ctx index ~/code/my-app --name my-app

&lt;span class="c"&gt;# 2. Search it by what the code does&lt;/span&gt;
ctx search &lt;span class="s2"&gt;"where are sessions refreshed"&lt;/span&gt; -p my-app

&lt;span class="c"&gt;# 3. Ask a question and get an answer with sources&lt;/span&gt;
ctx ask &lt;span class="s2"&gt;"How does the login flow work?"&lt;/span&gt; -p my-app
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The install command and full instructions are on GitHub: &lt;a href="https://github.com/Yoda-Man/ctx" rel="noopener noreferrer"&gt;github.com/Yoda-Man/ctx&lt;/a&gt;. It is published on npm as &lt;code&gt;yodaman-ctx&lt;/code&gt;.&lt;/p&gt;




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

&lt;p&gt;yodaman-ctx lets you ask your code questions in plain language and get answers you can check, without your code ever leaving your computer. It finds code by name or by meaning, reads seven programming languages by their structure along with your documents, handles many projects at once, works with your scripts and AI tools, and publishes how well it actually performs.&lt;/p&gt;

&lt;p&gt;Less time searching. More time building.&lt;/p&gt;

</description>
      <category>productivity</category>
      <category>search</category>
      <category>softwaredevelopment</category>
      <category>tools</category>
    </item>
    <item>
      <title>What's Better in yodaman-ctx 1.3.5</title>
      <dc:creator>Trust Mutemasango</dc:creator>
      <pubDate>Fri, 13 Nov 2026 09:42:29 +0000</pubDate>
      <link>https://dev.to/trust_mutemasango_c24e776/whats-better-in-yodaman-ctx-135-36a4</link>
      <guid>https://dev.to/trust_mutemasango_c24e776/whats-better-in-yodaman-ctx-135-36a4</guid>
      <description>&lt;p&gt;&lt;em&gt;Better answers to plain questions, two more languages read by structure, and indexing that cannot fail silently. Each change measured, and the limits that remain stated plainly.&lt;/em&gt;&lt;/p&gt;




&lt;p&gt;yodaman-ctx (ctx for short) is a command-line tool that lets you search and ask questions about your code. It indexes a project once, then finds code by its exact name or by what it does, and answers questions with the files and lines it used. Everything runs on your own machine.&lt;/p&gt;

&lt;p&gt;Version 1.3.5 works through the places where ctx was weakest. Every change to search was scored on the test ctx uses on itself: 56 questions about ctx's own code, each paired with the files that answer it. A change stayed only if it made results better. Where something could not be fixed, this article says so.&lt;/p&gt;




&lt;h2&gt;
  
  
  First, a sharper ruler
&lt;/h2&gt;

&lt;p&gt;Before improving search, it helped to measure it more precisely.&lt;/p&gt;

&lt;p&gt;ctx's test asked one question per result: did the answer's &lt;strong&gt;file&lt;/strong&gt; come back? That is generous. A file can have dozens of pieces, and a search can return the right file but the wrong piece of it, which is not much help when you are reading the result.&lt;/p&gt;

&lt;p&gt;The test can now also ask a stricter question: did the &lt;strong&gt;piece that actually contains the answer&lt;/strong&gt; come back? Each of the 56 questions stores a short pattern that the answering code or text must contain, and a result only counts if it matches.&lt;/p&gt;

&lt;p&gt;The difference is striking:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Before the changes below&lt;/th&gt;
&lt;th&gt;Right file in the top 5&lt;/th&gt;
&lt;th&gt;Right piece in the top 5&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;56 questions&lt;/td&gt;
&lt;td&gt;86%&lt;/td&gt;
&lt;td&gt;59%&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;ctx found the right file most of the time, but the exact piece you need noticeably less often. That second number is the one that matters to someone reading results, and it is the one every change was judged against. The same check is available in &lt;code&gt;ctx eval&lt;/code&gt; for your own projects.&lt;/p&gt;




&lt;h2&gt;
  
  
  1. Finding the file a question is really about
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;The weakness:&lt;/strong&gt; when ctx missed, it usually found the right part of the project but a neighbouring file. Asked which tool the chat agent calls to search code, for example, it returned other chat files instead of the tool itself.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What changed:&lt;/strong&gt; search now also reads each piece's &lt;strong&gt;file path&lt;/strong&gt;, in both of its halves. Keyword search matches words in the path. The chat agent's search tool lives in &lt;code&gt;agent/tools/retrieve-knowledge-tool.ts&lt;/code&gt;, so a question about the agent's tool now matches its path. Common parts of paths, such as &lt;code&gt;src&lt;/code&gt; and &lt;code&gt;ts&lt;/code&gt;, appear almost everywhere and count for almost nothing, so they do not crowd results.&lt;/p&gt;

&lt;p&gt;Meaning search sees the path too: each piece is now understood together with the name of the file it comes from.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The result&lt;/strong&gt;, each step measured against the one before:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;&lt;/th&gt;
&lt;th&gt;Before&lt;/th&gt;
&lt;th&gt;Paths in keyword search&lt;/th&gt;
&lt;th&gt;Paths in meaning search too&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Right file first (MRR)&lt;/td&gt;
&lt;td&gt;0.589&lt;/td&gt;
&lt;td&gt;0.625&lt;/td&gt;
&lt;td&gt;0.677&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Right file in the top 5&lt;/td&gt;
&lt;td&gt;86%&lt;/td&gt;
&lt;td&gt;88%&lt;/td&gt;
&lt;td&gt;89%&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Right piece first (chunk MRR)&lt;/td&gt;
&lt;td&gt;0.366&lt;/td&gt;
&lt;td&gt;0.393&lt;/td&gt;
&lt;td&gt;0.428&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Right piece in the top 5&lt;/td&gt;
&lt;td&gt;59%&lt;/td&gt;
&lt;td&gt;61%&lt;/td&gt;
&lt;td&gt;66%&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;The keyword step improved six questions and made one slightly worse; one of the improvements was a question ctx had missed entirely, about the chat agent's search tool. The meaning-search step raised every average again, but question by question it was more mixed: at the file level, ten questions improved and five got worse.&lt;/p&gt;




&lt;h2&gt;
  
  
  2. Java and C#, method by method
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;The weakness:&lt;/strong&gt; ctx read five languages by their structure (TypeScript, JavaScript, Python, Go and Rust) and split everything else by size. For Java and C#, that meant a class could be cut into pieces in the middle of a method.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What changed:&lt;/strong&gt; ctx now reads &lt;strong&gt;Java and C#&lt;/strong&gt; by their structure too. Because almost all code in those languages lives inside a class, ctx steps inside: each method, constructor or property becomes its own piece, labelled with the class it belongs to. Its documentation comment (&lt;code&gt;/** ... */&lt;/code&gt; in Java, &lt;code&gt;///&lt;/code&gt; in C#) and its annotations or attributes (&lt;code&gt;@Override&lt;/code&gt;, &lt;code&gt;[Obsolete]&lt;/code&gt;) stay attached. The class header and fields are kept together, and the closing brace joins the last method, so no line is lost. Both styles of C# namespace are handled.&lt;/p&gt;

&lt;p&gt;New tests confirm that, for both languages, every non-blank line of a file ends up in exactly one piece, and the existing tests for the five other languages still pass unchanged.&lt;/p&gt;

&lt;p&gt;Because this changes how files are split, and file paths now shape the meaning search, ctx shows its rebuild warning, with the exact command, for existing projects after you upgrade.&lt;/p&gt;




&lt;h2&gt;
  
  
  3. Matching forms of the same word
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;The weakness:&lt;/strong&gt; keyword search matched words exactly, so "authentication" in a question did not match "authenticate" in the code.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What changed:&lt;/strong&gt; each word is now also stored by its stem, the part that related forms share: "authentication" and "authenticate" both give "authent", and "refreshing" gives "refresh". The exact word is still stored too, so exact matches work as before.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The result&lt;/strong&gt; is a small gain: every average rose (right piece in the top 5: 66% to 70%), but question by question it was an even split, seven better and seven worse. It was kept because the averages improved and it costs nothing extra to index.&lt;/p&gt;

&lt;p&gt;One thing it cannot do: link words that share nothing, such as "authenticate" and &lt;code&gt;checkLogin&lt;/code&gt;. That is what meaning search is for.&lt;/p&gt;




&lt;h2&gt;
  
  
  4. Indexing that cannot quietly fail
&lt;/h2&gt;

&lt;p&gt;This problem turned up while running the test above.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The problem:&lt;/strong&gt; if the embedding model could not load (an interrupted download, for example), every piece of a project failed to embed. ctx then saved the project with &lt;strong&gt;no pieces at all&lt;/strong&gt;, marked it as up to date, and reported success. The first sign of trouble came later, as a confusing error when you searched.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What changed:&lt;/strong&gt; if no piece can be embedded, indexing now stops with a clear message naming the cause, saves nothing, and leaves any existing index for the project exactly as it was. A single piece that fails on its own is still skipped with a warning.&lt;/p&gt;




&lt;h2&gt;
  
  
  All together
&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;On the 56 questions&lt;/th&gt;
&lt;th&gt;Before&lt;/th&gt;
&lt;th&gt;1.3.5&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Right file in the top 5&lt;/td&gt;
&lt;td&gt;86%&lt;/td&gt;
&lt;td&gt;91%&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Right piece in the top 5&lt;/td&gt;
&lt;td&gt;59%&lt;/td&gt;
&lt;td&gt;70%&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;




&lt;h2&gt;
  
  
  What stays the same, and why
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Meaning search on very large projects is slow.&lt;/strong&gt; With realistic amounts of text per piece, a meaning search over 200,000 pieces takes about 2 to 4 seconds; for a project of 25,000 pieces it takes about a third of a second. Four ways of storing or reading the data were tried. Three made no measurable difference. The fourth, a purpose-built table in sqlite-vec, took about 40% less time, but it returned different results from the exact search, for reasons not yet understood, and it doubles the space the data takes. It was not shipped.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Some platforms load data into memory.&lt;/strong&gt; ctx's fast meaning search relies on an SQLite extension called sqlite-vec, which ships for Linux and macOS (x64 and arm64) and Windows (x64). Its newest test release covers the same platforms, so on others, such as Windows on ARM, ctx still works but loads the meaning-search data into memory. This depends on the sqlite-vec project, not on ctx.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;




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

&lt;p&gt;ctx 1.3.5 measures search by whether you get the exact piece of code you need, not just the right file. Measured that way, the piece you need is now in the top five for 70% of questions instead of 59%, because file names count in both halves of search and related word forms match. Java and C# are read method by method. And indexing can no longer fail silently. Each search change was kept only because the test showed it helped; the language support and the indexing fix are covered by new tests.&lt;/p&gt;

&lt;p&gt;What did not improve is stated plainly: speed on very large projects, and platforms that depend on another project.&lt;/p&gt;

&lt;p&gt;After upgrading, rebuild each project's index once with &lt;code&gt;ctx index &amp;lt;path&amp;gt; --force&lt;/code&gt;; ctx tells you which projects need it.&lt;/p&gt;

&lt;p&gt;ctx is MIT-licensed and available at &lt;a href="https://github.com/Yoda-Man/ctx" rel="noopener noreferrer"&gt;github.com/Yoda-Man/ctx&lt;/a&gt;.&lt;/p&gt;

</description>
      <category>cli</category>
      <category>code</category>
      <category>softwaredevelopment</category>
    </item>
    <item>
      <title>What yodaman-ctx Does for You</title>
      <dc:creator>Trust Mutemasango</dc:creator>
      <pubDate>Fri, 13 Nov 2026 08:36:56 +0000</pubDate>
      <link>https://dev.to/trust_mutemasango_c24e776/what-yodaman-ctx-does-for-you-24i4</link>
      <guid>https://dev.to/trust_mutemasango_c24e776/what-yodaman-ctx-does-for-you-24i4</guid>
      <description>&lt;p&gt;&lt;em&gt;A plain-language tour of a local code-search tool that finds code by its name or by what it does, answers with its sources, and keeps your code on your own machine.&lt;/em&gt;&lt;/p&gt;




&lt;p&gt;You have just joined a project. Nobody has time to walk you through it, and you have two questions.&lt;/p&gt;

&lt;p&gt;The first is precise:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Where is &lt;code&gt;ERR_CONN_RESET&lt;/code&gt; handled?&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;The second is not:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;How do we stop a user from logging in too many times?&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;The answer to the first question is a &lt;code&gt;catch&lt;/code&gt; block that checks for that exact constant. A search that understands meaning but not exact names may show you three files about connections and errors, none of which contains the constant you typed.&lt;/p&gt;

&lt;p&gt;The answer to the second is a function called &lt;code&gt;throttleAuthAttempts&lt;/code&gt;. It never uses the words "logging in" or "too many times", so a plain text search will walk right past it.&lt;/p&gt;

&lt;p&gt;Most tools are good at one of these questions. &lt;strong&gt;yodaman-ctx&lt;/strong&gt; (ctx for short) is built to handle both. This article explains what it does for you, how, and where its limits are, based on version 1.3.4, the latest release.&lt;/p&gt;




&lt;h2&gt;
  
  
  What ctx is, in one paragraph
&lt;/h2&gt;

&lt;p&gt;ctx is a command-line tool, published on npm as &lt;code&gt;yodaman-ctx&lt;/code&gt; under the MIT licence. You point it at a project once and it builds an index in a local SQLite database. After that you can search the project, ask it questions and get answers that name the files and lines they came from, or hold a conversation about it with &lt;code&gt;ctx chat&lt;/code&gt;. It can index many projects and search one or all of them.&lt;/p&gt;




&lt;h2&gt;
  
  
  1. It finds code whether or not you know its name
&lt;/h2&gt;

&lt;p&gt;ctx runs two searches for every question and combines them.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;A keyword search&lt;/strong&gt; finds the exact names you type: constants, error codes, function names.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;A meaning search&lt;/strong&gt; finds code that does what you describe, even when it uses different words.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The two result lists are merged so that a piece of code both searches agree on rises to the top. Here is how that plays out for the &lt;code&gt;ERR_CONN_RESET&lt;/code&gt; question:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Piece of code&lt;/th&gt;
&lt;th&gt;Keyword search&lt;/th&gt;
&lt;th&gt;Meaning search&lt;/th&gt;
&lt;th&gt;Combined score&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;The &lt;code&gt;catch&lt;/code&gt; block that handles &lt;code&gt;ERR_CONN_RESET&lt;/code&gt;
&lt;/td&gt;
&lt;td&gt;2nd&lt;/td&gt;
&lt;td&gt;3rd&lt;/td&gt;
&lt;td&gt;0.976&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;A log message that mentions &lt;code&gt;ERR_CONN_RESET&lt;/code&gt;
&lt;/td&gt;
&lt;td&gt;1st&lt;/td&gt;
&lt;td&gt;8th&lt;/td&gt;
&lt;td&gt;0.949&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;A general retry helper&lt;/td&gt;
&lt;td&gt;not found&lt;/td&gt;
&lt;td&gt;1st&lt;/td&gt;
&lt;td&gt;0.500&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;The &lt;code&gt;catch&lt;/code&gt; block is first in neither list, but it is the answer both searches support, so it comes out on top.&lt;/p&gt;

&lt;p&gt;ctx also understands how programmers write names. It keeps a name like &lt;code&gt;getUserById&lt;/code&gt; whole and also splits it into &lt;code&gt;get&lt;/code&gt;, &lt;code&gt;user&lt;/code&gt;, &lt;code&gt;by&lt;/code&gt; and &lt;code&gt;id&lt;/code&gt;. Search for the exact name and you find it; ask about "get user by id" in plain words and you find it too.&lt;/p&gt;




&lt;h2&gt;
  
  
  2. It understands how code is organised
&lt;/h2&gt;

&lt;p&gt;A search tool can only return the pieces it has indexed, so how it cuts files into pieces matters a great deal.&lt;/p&gt;

&lt;p&gt;For &lt;strong&gt;TypeScript, JavaScript, Python, Go and Rust&lt;/strong&gt;, ctx reads the actual structure of each file. Every function, class, type or Rust &lt;code&gt;impl&lt;/code&gt; block becomes its own piece, together with the comments, decorators or attributes written just above it. The code in between (imports, constants, setup) is kept as well, so every line of a file ends up in exactly one piece; tests check this for TypeScript, Python, Go and Rust files.&lt;/p&gt;

&lt;p&gt;For &lt;strong&gt;Markdown documentation&lt;/strong&gt;, each heading stays together with everything under it, so a table is always found along with its title.&lt;/p&gt;

&lt;p&gt;The result: when ctx shows you a match, you see a whole function with its doc comment, or a whole section with its heading, not a fragment cut off mid-thought.&lt;/p&gt;




&lt;h2&gt;
  
  
  3. Your code stays on your machine
&lt;/h2&gt;

&lt;p&gt;ctx does not send your code anywhere.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The embedding model that powers the meaning search runs on your own computer. It is about 340 MB and is cached in &lt;code&gt;~/.ctx/models&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;Answers come from a local model served by Ollama.&lt;/li&gt;
&lt;li&gt;There is no cloud provider anywhere in the code path.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;That matters for any team whose code is private or sensitive.&lt;/p&gt;




&lt;h2&gt;
  
  
  4. Quick to start, light on memory
&lt;/h2&gt;

&lt;p&gt;Both searches run inside the SQLite database that already holds your index, so nothing has to be loaded into memory before ctx can answer. Measured on test projects:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Project size&lt;/th&gt;
&lt;th&gt;Ready to search&lt;/th&gt;
&lt;th&gt;Meaning search, per query&lt;/th&gt;
&lt;th&gt;Keyword search, per query&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;25,000 pieces of code&lt;/td&gt;
&lt;td&gt;about 5 ms&lt;/td&gt;
&lt;td&gt;0.13 s&lt;/td&gt;
&lt;td&gt;3 to 9 ms&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;200,000 pieces of code&lt;/td&gt;
&lt;td&gt;about 5 ms&lt;/td&gt;
&lt;td&gt;0.97 s&lt;/td&gt;
&lt;td&gt;60 to 198 ms&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;The process holds almost no extra memory while it does this. Loading the same data into memory instead used about 1.1 GB and took several seconds at 200,000 pieces, before the first search could even start.&lt;/p&gt;

&lt;p&gt;Keyword search uses SQLite's built-in full-text index. Meaning search uses an SQLite extension, sqlite-vec, which has prebuilt versions for Linux and macOS (x64 and arm64) and Windows (x64). On other platforms ctx still works; it loads the meaning-search data into memory to search it.&lt;/p&gt;




&lt;h2&gt;
  
  
  5. Answers come with their sources
&lt;/h2&gt;

&lt;p&gt;When you use &lt;code&gt;ctx ask&lt;/code&gt;, ctx searches first and only then asks the local model to answer, using what it found. Before the model sees anything, ctx:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;removes near-duplicate pieces, so the same code does not crowd out other evidence,&lt;/li&gt;
&lt;li&gt;keeps the most relevant pieces within a size budget, and&lt;/li&gt;
&lt;li&gt;places the strongest pieces at the start and end of what the model reads, because language models tend to use information there more reliably than information in the middle.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Every piece is labelled with its file path and line range, so the answer can point you to exactly where it came from.&lt;/p&gt;

&lt;p&gt;If you ever want to see what the model was given, &lt;code&gt;ctx ask --context-only --json&lt;/code&gt; shows you the assembled context without generating an answer. That makes it easy to check, rather than trust.&lt;/p&gt;




&lt;h2&gt;
  
  
  6. Scores you can actually read
&lt;/h2&gt;

&lt;p&gt;Every result comes with a score from 0 to 1 that means something:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;1.0&lt;/strong&gt;: both searches ranked it first.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;About 0.5&lt;/strong&gt;: one search ranked it first and the other did not find it.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;That makes it easy to see at a glance which results both searches agree on, and a minimum-score filter on a 0 to 1 scale behaves the way you would expect.&lt;/p&gt;




&lt;h2&gt;
  
  
  7. Many projects, one conversation
&lt;/h2&gt;

&lt;p&gt;You can index as many projects as you like and search one or all of them. In &lt;code&gt;ctx chat&lt;/code&gt;, ctx works out which project a question is about:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Name one project, and it searches that project.&lt;/li&gt;
&lt;li&gt;Name two, or ask to "compare" across named projects, and it searches them together.&lt;/li&gt;
&lt;li&gt;Say "this project" or "this repo", or set a focus with &lt;code&gt;/focus&lt;/code&gt;, and it stays there.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This is mostly done with simple rules rather than by asking the model, which keeps routing fast and predictable. Staying in the focused project also keeps answers quick when you have many projects indexed.&lt;/p&gt;




&lt;h2&gt;
  
  
  8. It tells you when an index needs refreshing
&lt;/h2&gt;

&lt;p&gt;When the way ctx reads code improves, an index built the old way keeps working but quietly gives worse results. ctx records how each project's index was built. If it is out of date, ctx prints a warning with the exact command to rebuild it, and &lt;code&gt;ctx check&lt;/code&gt; lists it as well, so an outdated index does not go unnoticed.&lt;/p&gt;




&lt;h2&gt;
  
  
  9. Tuned by measurement, not guesswork
&lt;/h2&gt;

&lt;p&gt;ctx comes with its own test of search quality: 56 questions about ctx's own code, each paired with the files that answer it. It mixes exact-name questions, plain-language questions and documentation questions. On version 1.3.4, the right file is in the top five results for &lt;strong&gt;86%&lt;/strong&gt; of those questions.&lt;/p&gt;

&lt;p&gt;Every recent improvement had to prove itself on that test before it stayed:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Using the embedding model as its makers intended.&lt;/strong&gt; The model's documentation says search queries should start with a short instruction. Adding it put the right file in the top five more often (80% of questions instead of 73%).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Preferring code over documentation on close calls.&lt;/strong&gt; Documentation describes features in plain words, so it can crowd out the code it describes. A small preference for code improved 12 questions and made none worse, including the documentation questions.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Keeping an optional step optional.&lt;/strong&gt; ctx includes a second-pass ranking model, but testing showed it ranked tables and code lower, so it only runs when you ask for it with &lt;code&gt;ctx search --rerank&lt;/code&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The same evaluation command, &lt;code&gt;ctx eval&lt;/code&gt;, is available to you, so you can measure how well search works on your own projects instead of taking anyone's word for it.&lt;/p&gt;




&lt;h2&gt;
  
  
  Where ctx is still improving
&lt;/h2&gt;

&lt;p&gt;No search tool gets everything right, and it is better to know the limits up front.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Some areas are harder than others.&lt;/strong&gt; On the 56-question test, every question about the database and embedding code finds its answer first, though those groups are small (three and four questions), while questions about the chat agent are the weakest. When ctx misses, it usually finds the right part of the project but a neighbouring file, such as a file of type definitions next to the one you needed.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Five languages are read by structure.&lt;/strong&gt; TypeScript, JavaScript, Python, Go and Rust are split by function and class. Other languages, such as Java and C#, are split by size instead.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Names have to share something to match.&lt;/strong&gt; A keyword search links &lt;code&gt;getUserById&lt;/code&gt; to "get user by id", but not "authenticate" to &lt;code&gt;checkLogin&lt;/code&gt;. For those, the meaning search does the work.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Long chats on very large projects.&lt;/strong&gt; Each question searches the database afresh, which is what makes ctx quick to start. In a long chat on a project with 200,000 pieces, that means about a second per question for the meaning search.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Some platforms load data into memory.&lt;/strong&gt; Where sqlite-vec is not available, ctx still works, but meaning search needs more memory and time to get started.&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  Commands worth knowing
&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Command&lt;/th&gt;
&lt;th&gt;What it does&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;ctx search "your question"&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Finds the 10 most relevant pieces of code&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;ctx search "your question" --rerank&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Adds the optional second-pass ranking&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;ctx ask "your question"&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Answers from your code, with sources&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;ctx ask "your question" --context-only --json&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Shows exactly what the model would be given&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;ctx chat&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;A conversation about one or more projects; &lt;code&gt;/focus&lt;/code&gt; keeps it on one&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;ctx check&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Flags a project whose index needs rebuilding&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;ctx eval&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Measures search quality against your own set of questions&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;




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

&lt;p&gt;yodaman-ctx gives you one place to ask questions about your code, whether you know the exact name you are looking for or only what the code does. It runs entirely on your machine, has a project ready to search in milliseconds, shows you where every answer came from, and tells you when its index needs refreshing. Its improvements are measured rather than assumed, and its limits are stated plainly.&lt;/p&gt;

&lt;p&gt;ctx is MIT-licensed and available at &lt;a href="https://github.com/Yoda-Man/ctx" rel="noopener noreferrer"&gt;github.com/Yoda-Man/ctx&lt;/a&gt;.&lt;/p&gt;

</description>
      <category>programming</category>
      <category>search</category>
      <category>software</category>
      <category>tools</category>
    </item>
    <item>
      <title>Hybrid Search After the Theory: The Decisions You Make When You Build It</title>
      <dc:creator>Trust Mutemasango</dc:creator>
      <pubDate>Fri, 06 Nov 2026 09:06:18 +0000</pubDate>
      <link>https://dev.to/trust_mutemasango_c24e776/what-hybrid-search-looks-like-when-it-has-to-run-on-your-laptop-12b3</link>
      <guid>https://dev.to/trust_mutemasango_c24e776/what-hybrid-search-looks-like-when-it-has-to-run-on-your-laptop-12b3</guid>
      <description>&lt;p&gt;Suppose you are working in a codebase you did not write, and you type the following question:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Where is &lt;code&gt;ERR_CONN_RESET&lt;/code&gt; handled?&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;The answer exists. One file contains a &lt;code&gt;catch&lt;/code&gt; block that checks for exactly that constant and retries the request.&lt;/p&gt;

&lt;p&gt;A purely semantic search may not put that file first. It may return a connection-pool module, a general error-handling utility and a retry helper. All three are about the right topic. None of them necessarily contains the string you asked for.&lt;/p&gt;

&lt;p&gt;Now consider a second question:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;How do we stop a user from logging in too many times?&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;The relevant function is called &lt;code&gt;throttleAuthAttempts&lt;/code&gt;. Its body talks about a counter and a lockout window. It never uses the words "logging in" or "too many times". A keyword search may miss it. An embedding model has a much better chance of placing it near the question.&lt;/p&gt;

&lt;p&gt;This is the trade-off that hybrid retrieval exists to address, and it has been described well elsewhere: lexical search preserves exact identifiers, dense search preserves meaning, and neither preserves both. What is described less often is what happens after you accept that argument and actually build the system. Which BM25 parameters do you use? How does the tokenizer treat &lt;code&gt;getUserById&lt;/code&gt;? What does a fused score of 0.03 mean to a user? Where do the chunks come from in the first place?&lt;/p&gt;

&lt;p&gt;&lt;a href="https://github.com/Yoda-Man/ctx" rel="noopener noreferrer"&gt;ctx&lt;/a&gt; is a useful place to look for answers, because it is small enough to read and has to make all of those decisions in code. It is a TypeScript command-line tool (published on npm as &lt;code&gt;yodaman-ctx&lt;/code&gt;, a maintained fork of an earlier project called Context Expert) that indexes local projects into SQLite, searches them with BM25 and dense vectors fused by RRF, and answers questions through a local model served by Ollama. There is no cloud provider in the code path.&lt;/p&gt;

&lt;p&gt;Everything below describes ctx 1.3.3; file paths are relative to the repository root. This article walks through that pipeline in the order data moves through it: chunking, embedding, the two retrievers, fusion, optional reranking, context assembly and evaluation. At each stage, the same two questions apply: what does this step preserve, and what does it give up?&lt;/p&gt;




&lt;h2&gt;
  
  
  1. Before Retrieval: Deciding What a Document Is
&lt;/h2&gt;

&lt;p&gt;&lt;em&gt;A retriever can only return the units you gave it. In code, choosing those units is most of the work.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Retrieval papers usually start with a corpus of passages. A code-search tool has to create those passages first, and the choice determines what can be found at all.&lt;/p&gt;

&lt;p&gt;ctx routes each file by type in &lt;code&gt;src/indexer/chunker/chunker.ts&lt;/code&gt;. Config files become a single segment. Markdown goes to a section-based extractor. TypeScript, JavaScript, Python, Go and Rust go to a tree-sitter extractor. Every other language is treated as one segment and split by size.&lt;/p&gt;

&lt;p&gt;The tree-sitter extractor (&lt;code&gt;code-extractor.ts&lt;/code&gt;) walks the top-level statements of the file in order. Each definition becomes its own segment: a function, class, interface, type alias, enum, or a &lt;code&gt;const&lt;/code&gt; bound to an arrow function; in Go a &lt;code&gt;func&lt;/code&gt;, method or &lt;code&gt;type&lt;/code&gt;; in Rust a &lt;code&gt;fn&lt;/code&gt;, &lt;code&gt;struct&lt;/code&gt;, &lt;code&gt;enum&lt;/code&gt;, &lt;code&gt;trait&lt;/code&gt; or &lt;code&gt;impl&lt;/code&gt; block. Each segment includes the definition's &lt;code&gt;export&lt;/code&gt; keyword, decorators or Rust &lt;code&gt;#[...]&lt;/code&gt; attributes, and any comments that sit directly above it with no blank line in between. Everything that is not a definition (imports, constants, module setup, a Python &lt;code&gt;if __name__ == "__main__":&lt;/code&gt; block) is grouped with its neighbours into a &lt;code&gt;module&lt;/code&gt; segment. The comment at the top of the file states the invariant directly: every line of the file lands in exactly one segment.&lt;/p&gt;

&lt;p&gt;Languages whose code lives almost entirely inside one class or namespace per file, such as Java and C#, are not on the list. A top-level split would give each such file one segment, which the size-based splitter already produces.&lt;/p&gt;

&lt;p&gt;That invariant matters more than it looks. A chunker that keeps only functions and classes would leave constants, configuration objects and module-level setup in no chunk at all, and no ranking function can retrieve text that was never indexed. Tests in &lt;code&gt;src/indexer/__tests__/chunker.test.ts&lt;/code&gt; check the invariant for TypeScript, Python, Go and Rust files: every line appears in exactly one segment.&lt;/p&gt;

&lt;p&gt;Markdown follows the same principle at a different granularity. &lt;code&gt;markdown-extractor.ts&lt;/code&gt; uses the &lt;code&gt;marked&lt;/code&gt; lexer to find headings (so a &lt;code&gt;#&lt;/code&gt; inside a code fence is not mistaken for one) and makes each heading plus everything under it, up to the next heading, one segment. A table stays attached to its title. A heading with nothing under it is merged into the next section.&lt;/p&gt;

&lt;p&gt;Segments that fit within a size limit are kept whole. The limits are set per content type in &lt;code&gt;chunker/config.ts&lt;/code&gt;:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Content type&lt;/th&gt;
&lt;th&gt;Target size&lt;/th&gt;
&lt;th&gt;Overlap&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;code&lt;/td&gt;
&lt;td&gt;512 tokens&lt;/td&gt;
&lt;td&gt;50 tokens&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;docs&lt;/td&gt;
&lt;td&gt;1,024 tokens&lt;/td&gt;
&lt;td&gt;100 tokens&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;config&lt;/td&gt;
&lt;td&gt;256 tokens&lt;/td&gt;
&lt;td&gt;25 tokens&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;"Tokens" here is an estimate, not a tokenizer count: &lt;code&gt;estimateTokens&lt;/code&gt; returns &lt;code&gt;Math.ceil(text.length / 4)&lt;/code&gt;. Oversized code segments are split by a recursive character splitter. Oversized documentation segments are split by a semantic chunker that embeds sentences and starts a new chunk where similarity between neighbours drops below 0.5. If that embedding call fails, the code catches the error, records a warning, and falls back to the size-based splitter instead of aborting the index.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What this step preserves:&lt;/strong&gt; the boundaries a reader would recognise: a whole function with its doc comment, a whole section with its heading.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What it gives up:&lt;/strong&gt; precision on very large units. A 2,000-line class is still one definition, so it will be split by size, and the four-characters-per-token estimate means the real token count of a chunk can differ from the configured limit.&lt;/p&gt;




&lt;h2&gt;
  
  
  2. The Dense Side: One Vector per Chunk, Scanned Exactly
&lt;/h2&gt;

&lt;p&gt;&lt;em&gt;ctx uses a single local embedding model and compares every vector on every query.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;The default embedding model is &lt;code&gt;BAAI/bge-large-en-v1.5&lt;/code&gt;, which the provider rewrites to &lt;code&gt;Xenova/bge-large-en-v1.5&lt;/code&gt; so that it can run through &lt;code&gt;@huggingface/transformers&lt;/code&gt; in the Node process. It produces 1,024-dimensional vectors, L2-normalised. For BGE models the vector is taken from the first ([CLS]) token, which is how BAAI trained them; other models use the mean of all tokens (&lt;code&gt;poolingFor&lt;/code&gt; in &lt;code&gt;src/sdk/rag/embeddings/huggingface-provider.ts&lt;/code&gt;). The README states that the model is about 340 MB and is cached in &lt;code&gt;~/.ctx/models&lt;/code&gt;. An Ollama embedding model can be configured as a fallback, but the provider code refuses a fallback whose dimension differs from the primary model's, because the stored vectors would not be comparable.&lt;/p&gt;

&lt;p&gt;Queries and chunks are not embedded quite the same way. BAAI's model card for the English BGE models gives an instruction to put before a search query, and only before the query: "Represent this sentence for searching relevant passages: ". The Hugging Face provider adds it in &lt;code&gt;embedQuery()&lt;/code&gt;, which every search path uses, while chunks are embedded as they are. On the 56-question evaluation described in section 8, scored against one fixed index, the instruction raised MRR from 0.51 to 0.55 and put the expected file in the top five for 80% of questions instead of 73%; eight questions improved and four got worse.&lt;/p&gt;

&lt;p&gt;Stored vectors and chunks depend on how they were made, and an index built one way keeps working when the code changes: it just returns worse results. ctx guards against that. Each project records the index format it was built with (&lt;code&gt;index_version&lt;/code&gt;, defined in &lt;code&gt;src/database/index-version.ts&lt;/code&gt;), written only when an index run finishes. Loading a project whose format is older than the current one prints a warning with the exact re-index command, and &lt;code&gt;ctx check&lt;/code&gt; lists it. The comment above the constant states when it must change: whenever stored chunks or vectors change meaning, such as a different pooling method or a different way of splitting a language.&lt;/p&gt;

&lt;p&gt;At query time, the vector store is not an approximate nearest-neighbour index. It is an exact scan, and it runs inside SQLite. The embeddings already sit in the &lt;code&gt;chunks&lt;/code&gt; table as float32 blobs, and the &lt;a href="https://github.com/asg017/sqlite-vec" rel="noopener noreferrer"&gt;sqlite-vec&lt;/a&gt; extension, loaded on every database connection, scores them in C. &lt;code&gt;src/search/sqlite-vector-store.ts&lt;/code&gt; asks for the top &lt;em&gt;k&lt;/em&gt; in one query:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="k"&gt;SELECT&lt;/span&gt; &lt;span class="n"&gt;id&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;content&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;file_path&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;file_type&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="k"&gt;language&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;start_line&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;end_line&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;metadata&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
       &lt;span class="mi"&gt;1&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="n"&gt;vec_distance_cosine&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;embedding&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="o"&gt;?&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;AS&lt;/span&gt; &lt;span class="n"&gt;score&lt;/span&gt;
&lt;span class="k"&gt;FROM&lt;/span&gt; &lt;span class="n"&gt;chunks&lt;/span&gt;
&lt;span class="k"&gt;WHERE&lt;/span&gt; &lt;span class="n"&gt;project_id&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="o"&gt;?&lt;/span&gt;
&lt;span class="k"&gt;ORDER&lt;/span&gt; &lt;span class="k"&gt;BY&lt;/span&gt; &lt;span class="n"&gt;score&lt;/span&gt; &lt;span class="k"&gt;DESC&lt;/span&gt;
&lt;span class="k"&gt;LIMIT&lt;/span&gt; &lt;span class="o"&gt;?&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Why an exact scan, and why in SQL, both come back to the shape of the program. ctx is a CLI: each command is a new process, so anything built in memory is built again for every search. A comment in &lt;code&gt;src/search/store.ts&lt;/code&gt; records what an approximate index would cost on those terms: 8.3 seconds to build HNSW over 3,714 vectors, compared with 43 ms to scan 58,728. For a long-running server with millions of vectors, an approximate index is the normal choice. For a CLI that starts, answers one question and exits, the build cost dominates.&lt;/p&gt;

&lt;p&gt;The same reasoning applies to loading vectors at all. Measured on synthetic projects with 1,024-dimensional vectors, a project is ready to search in about 5 ms and the process holds almost no extra memory, because nothing is loaded; a query takes 0.13 seconds at 25,000 chunks and 0.97 seconds at 200,000. Loading the same vectors into memory first took 0.33 seconds and 0.2 GB at 25,000 chunks, and between 2.6 and 7.8 seconds and 1.1 GB at 200,000, before a faster scan. A long &lt;code&gt;ctx chat&lt;/code&gt; session, which asks many questions in one process, pays a little more per question this way; a single search pays much less. Tests in &lt;code&gt;src/search/__tests__/sqlite-vector-store.test.ts&lt;/code&gt; check that the SQL scan returns exactly what the in-memory scan returns.&lt;/p&gt;

&lt;p&gt;sqlite-vec ships prebuilt binaries for Linux and macOS on x64 and arm64 and for Windows on x64. Where it cannot load, &lt;code&gt;store.ts&lt;/code&gt; falls back to loading a project's vectors into memory, in batches paged by &lt;code&gt;rowid &amp;gt; ?&lt;/code&gt; rather than &lt;code&gt;OFFSET&lt;/code&gt; so each page is an index seek, and scanning them there. In both cases, a stored vector whose dimension differs from the project's stops the search with an error that tells the user to re-index with &lt;code&gt;--force&lt;/code&gt;, rather than comparing incompatible vectors.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What this step preserves:&lt;/strong&gt; paraphrase and intent. A question about "logging in too many times" can land near &lt;code&gt;throttleAuthAttempts&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What it gives up:&lt;/strong&gt; any explicit guarantee that a rare exact string will dominate. The identifier has to compete with everything else in the chunk for influence over a single 1,024-dimensional vector.&lt;/p&gt;




&lt;h2&gt;
  
  
  3. The Lexical Side: BM25 Inside SQLite
&lt;/h2&gt;

&lt;p&gt;&lt;em&gt;The formula is the textbook one. The interesting decisions are in the tokenizer, and in where the index lives.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Where the keyword index lives matters as much as the formula. ctx is a CLI: each command is a new process. An inverted index built in memory would have to be rebuilt from every chunk of a project at the start of every search. So ctx keeps its keyword index on disk too, in SQLite's FTS5 full-text extension, which ships with the &lt;code&gt;better-sqlite3&lt;/code&gt; package it already uses. Migration 008 in &lt;code&gt;src/database/migrate.ts&lt;/code&gt; creates the index and three triggers on the &lt;code&gt;chunks&lt;/code&gt; table:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="k"&gt;CREATE&lt;/span&gt; &lt;span class="n"&gt;VIRTUAL&lt;/span&gt; &lt;span class="k"&gt;TABLE&lt;/span&gt; &lt;span class="n"&gt;IF&lt;/span&gt; &lt;span class="k"&gt;NOT&lt;/span&gt; &lt;span class="k"&gt;EXISTS&lt;/span&gt; &lt;span class="n"&gt;chunks_fts&lt;/span&gt; &lt;span class="k"&gt;USING&lt;/span&gt; &lt;span class="n"&gt;fts5&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
  &lt;span class="n"&gt;tokens&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="n"&gt;content&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s1"&gt;''&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="n"&gt;contentless_delete&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="n"&gt;tokenize&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s1"&gt;'unicode61 remove_diacritics 0'&lt;/span&gt;
&lt;span class="p"&gt;);&lt;/span&gt;

&lt;span class="k"&gt;CREATE&lt;/span&gt; &lt;span class="k"&gt;TRIGGER&lt;/span&gt; &lt;span class="n"&gt;IF&lt;/span&gt; &lt;span class="k"&gt;NOT&lt;/span&gt; &lt;span class="k"&gt;EXISTS&lt;/span&gt; &lt;span class="n"&gt;chunks_fts_insert&lt;/span&gt; &lt;span class="k"&gt;AFTER&lt;/span&gt; &lt;span class="k"&gt;INSERT&lt;/span&gt; &lt;span class="k"&gt;ON&lt;/span&gt; &lt;span class="n"&gt;chunks&lt;/span&gt; &lt;span class="k"&gt;BEGIN&lt;/span&gt;
  &lt;span class="k"&gt;INSERT&lt;/span&gt; &lt;span class="k"&gt;INTO&lt;/span&gt; &lt;span class="n"&gt;chunks_fts&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;rowid&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;tokens&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;VALUES&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="k"&gt;new&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;rowid&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;ctx_tokens&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="k"&gt;new&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;content&lt;/span&gt;&lt;span class="p"&gt;));&lt;/span&gt;
&lt;span class="k"&gt;END&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The index is "contentless": it stores the tokens' positions but not the text, which stays in &lt;code&gt;chunks&lt;/code&gt;. The triggers fire on every insert, update and delete, including the delete-then-insert swap ctx uses when re-indexing a project, so no code path has to remember to update the keyword index. The migration also fills the index from any chunks already stored.&lt;/p&gt;

&lt;p&gt;Searching is one query in &lt;code&gt;src/search/bm25-store.ts&lt;/code&gt;: match any query token, join back to &lt;code&gt;chunks&lt;/code&gt; for the project and any file-type or language filter, and order by FTS5's &lt;code&gt;bm25()&lt;/code&gt; function. FTS5 uses the common defaults, &lt;code&gt;k1 = 1.2&lt;/code&gt; and &lt;code&gt;b = 0.75&lt;/code&gt;, with the standard saturated, length-normalised term frequency. The result is divided by the top score so the best keyword hit is 1.0. Here, a "document" is a chunk.&lt;/p&gt;

&lt;p&gt;Two properties of FTS5's scoring are worth knowing. First, it counts how rare a term is (its IDF) over every chunk in the index, not only the project being searched; with several projects indexed, a word common in one project but rare overall weighs more than it would within that project alone. Second, its IDF is &lt;code&gt;log((N − n + 0.5) / (n + 0.5))&lt;/code&gt;, with a zero or negative value replaced by 0.000001. Some BM25 implementations add 1 inside the logarithm so every term keeps a small positive weight; FTS5 does not, so a term found in half or more of all chunks adds almost nothing.&lt;/p&gt;

&lt;p&gt;Measured on the same synthetic projects, nothing is built when a search starts. A keyword query took between 3 and 9 ms at 25,000 chunks and between 60 and 198 ms at 200,000 across two runs, and indexing pays about 0.3 ms per chunk for the trigger, small next to computing the chunk's embedding.&lt;/p&gt;

&lt;p&gt;There is one caveat, which a comment in the migration states: the index is keyed on SQLite's internal row IDs, and a manual &lt;code&gt;VACUUM&lt;/code&gt; can renumber those. ctx never runs one.&lt;/p&gt;

&lt;p&gt;The part that most affects code search is not the formula but the tokenizer, in &lt;code&gt;src/sdk/rag/retrieval/bm25.ts&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;CAMEL_BOUNDARY&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="sr"&gt;/&lt;/span&gt;&lt;span class="se"&gt;(?&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;=&lt;/span&gt;&lt;span class="se"&gt;\p&lt;/span&gt;&lt;span class="sr"&gt;{Ll}&lt;/span&gt;&lt;span class="se"&gt;)(?=\p&lt;/span&gt;&lt;span class="sr"&gt;{Lu}&lt;/span&gt;&lt;span class="se"&gt;)&lt;/span&gt;&lt;span class="sr"&gt;|&lt;/span&gt;&lt;span class="se"&gt;(?&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;=&lt;/span&gt;&lt;span class="se"&gt;\p&lt;/span&gt;&lt;span class="sr"&gt;{Lu}&lt;/span&gt;&lt;span class="se"&gt;)(?=\p&lt;/span&gt;&lt;span class="sr"&gt;{Lu}&lt;/span&gt;&lt;span class="se"&gt;\p&lt;/span&gt;&lt;span class="sr"&gt;{Ll}&lt;/span&gt;&lt;span class="se"&gt;)&lt;/span&gt;&lt;span class="sr"&gt;/u&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="k"&gt;for &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;word&lt;/span&gt; &lt;span class="k"&gt;of&lt;/span&gt; &lt;span class="nx"&gt;text&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;split&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sr"&gt;/&lt;/span&gt;&lt;span class="se"&gt;[^\p&lt;/span&gt;&lt;span class="sr"&gt;{L}&lt;/span&gt;&lt;span class="se"&gt;\p&lt;/span&gt;&lt;span class="sr"&gt;{N}&lt;/span&gt;&lt;span class="se"&gt;]&lt;/span&gt;&lt;span class="sr"&gt;+/u&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;parts&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;word&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;split&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;CAMEL_BOUNDARY&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="k"&gt;if &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;parts&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;length&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="nx"&gt;tokens&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;push&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;word&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;toLowerCase&lt;/span&gt;&lt;span class="p"&gt;());&lt;/span&gt;
  &lt;span class="k"&gt;for &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;part&lt;/span&gt; &lt;span class="k"&gt;of&lt;/span&gt; &lt;span class="nx"&gt;parts&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="nx"&gt;tokens&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;push&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;part&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;toLowerCase&lt;/span&gt;&lt;span class="p"&gt;());&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nx"&gt;tokens&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;filter&lt;/span&gt;&lt;span class="p"&gt;((&lt;/span&gt;&lt;span class="nx"&gt;token&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nx"&gt;token&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;length&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;=&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Every run of characters that is not a Unicode letter or digit becomes a separator. A camelCase word is kept whole and also split at its case boundaries. Tokens shorter than two characters are dropped. FTS5 has its own tokenizer, but it does not split camelCase, so ctx registers this function with SQLite as &lt;code&gt;ctx_tokens()&lt;/code&gt; (in &lt;code&gt;src/database/connection.ts&lt;/code&gt;). The triggers store its output, and the same function tokenizes each query, so the index and the query always split text the same way. Running it on a few identifiers shows what it does:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Input&lt;/th&gt;
&lt;th&gt;Tokens&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;ERR_CONN_RESET&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;err&lt;/code&gt;, &lt;code&gt;conn&lt;/code&gt;, &lt;code&gt;reset&lt;/code&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;ZX-4821&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;zx&lt;/code&gt;, &lt;code&gt;4821&lt;/code&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;getUserById&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;getuserbyid&lt;/code&gt;, &lt;code&gt;get&lt;/code&gt;, &lt;code&gt;user&lt;/code&gt;, &lt;code&gt;by&lt;/code&gt;, &lt;code&gt;id&lt;/code&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;HTTPServer&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;httpserver&lt;/code&gt;, &lt;code&gt;http&lt;/code&gt;, &lt;code&gt;server&lt;/code&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;get user by id&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;get&lt;/code&gt;, &lt;code&gt;user&lt;/code&gt;, &lt;code&gt;by&lt;/code&gt;, &lt;code&gt;id&lt;/code&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Keeping both forms serves two kinds of query. A query that contains &lt;code&gt;getUserById&lt;/code&gt; verbatim still matches the whole-word token, which is rare and so carries a high IDF. That is exactly what BM25 is for. A query that says "get user by id" in plain words matches the parts. A tokenizer that kept camelCase as one token would give that second query no lexical match on the identifier at all.&lt;/p&gt;

&lt;p&gt;Other limits remain. &lt;code&gt;ZX-4821&lt;/code&gt; becomes two tokens, so a chunk containing &lt;code&gt;ZX-4812&lt;/code&gt; still matches on &lt;code&gt;zx&lt;/code&gt;, and only the numeric token distinguishes the two. The parts of a camelCase word are also common words (&lt;code&gt;get&lt;/code&gt;, &lt;code&gt;user&lt;/code&gt;, &lt;code&gt;id&lt;/code&gt;), so their IDF is low; with FTS5's formula, a part that appears in half or more of the chunks adds almost nothing, and the parts help a chunk's score rather than deciding it. It is still worth running a retriever's tokenizer on your own identifiers before assuming what "exact match" means.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What this step preserves:&lt;/strong&gt; exact rare strings (constants, error codes, function names typed verbatim) and, through the split parts, a lexical link between an identifier and the words it is made of.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What it gives up:&lt;/strong&gt; any connection between words that do not share a token, such as "authenticate" and &lt;code&gt;checkLogin&lt;/code&gt;.&lt;/p&gt;




&lt;h2&gt;
  
  
  4. Fusion: RRF, Then a Rescale So the Number Means Something
&lt;/h2&gt;

&lt;p&gt;&lt;em&gt;Reciprocal Rank Fusion solves the incompatible-scores problem. It creates a readability problem of its own.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;code&gt;FusionService.search&lt;/code&gt; in &lt;code&gt;src/search/fusion.ts&lt;/code&gt; runs the dense and BM25 searches in parallel with &lt;code&gt;Promise.all&lt;/code&gt;, then fuses the two ranked lists. The underlying function is the standard one, with &lt;code&gt;k = 60&lt;/code&gt;:&lt;/p&gt;

&lt;p&gt;$$&lt;br&gt;
\text{RRF}(d) = \sum_{r \in R} \frac{1}{60 + \text{rank}_r(d)}&lt;br&gt;
$$&lt;/p&gt;

&lt;p&gt;A chunk that is missing from one list receives zero from that list. The implementation also records each retriever's contribution, so a fused result carries a record of which list it came from and at what rank.&lt;/p&gt;

&lt;p&gt;Raw RRF scores are small. A chunk ranked first by both retrievers scores 2/61 ≈ 0.033. Shown to a user, a value near 0.03 looks like a poor match, and any &lt;code&gt;minScore&lt;/code&gt; threshold on a 0 to 1 scale would remove every result. &lt;code&gt;fusion.ts&lt;/code&gt; rescales in three lines:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="c1"&gt;// Raw RRF tops out near 0.03 (2/61), which read as a poor match and made&lt;/span&gt;
&lt;span class="c1"&gt;// any 0-1 minScore drop every result; divide by the best possible score.&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;bestPossible&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;k&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;After this division, 1.0 means "ranked first by both", and about 0.5 means "ranked first by one and absent from the other". The order of results does not change; only the scale does. Applying it to a small example:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Chunk&lt;/th&gt;
&lt;th&gt;BM25 rank&lt;/th&gt;
&lt;th&gt;Dense rank&lt;/th&gt;
&lt;th&gt;Scaled score&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;A: the &lt;code&gt;catch&lt;/code&gt; block for &lt;code&gt;ERR_CONN_RESET&lt;/code&gt;
&lt;/td&gt;
&lt;td&gt;2&lt;/td&gt;
&lt;td&gt;3&lt;/td&gt;
&lt;td&gt;0.976&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;B: a log message mentioning &lt;code&gt;ERR_CONN_RESET&lt;/code&gt;
&lt;/td&gt;
&lt;td&gt;1&lt;/td&gt;
&lt;td&gt;8&lt;/td&gt;
&lt;td&gt;0.949&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;C: a general retry helper&lt;/td&gt;
&lt;td&gt;not ranked&lt;/td&gt;
&lt;td&gt;1&lt;/td&gt;
&lt;td&gt;0.500&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Chunk A is first in neither list but first after fusion, because both retrievers placed it near the top. This is the behaviour hybrid search is designed for.&lt;/p&gt;

&lt;p&gt;There is one practical constraint on this example. Each retriever is called with the same &lt;code&gt;topK&lt;/code&gt; as the final result count. &lt;code&gt;ctx search&lt;/code&gt; defaults to 10, so a dense rank of 8 is inside the list. &lt;code&gt;ctx ask&lt;/code&gt; uses &lt;code&gt;final_k&lt;/code&gt;, which defaults to 5, so each retriever contributes at most five candidates and chunk B's dense rank of 8 would not be seen at all. In that case, B would score 1/61 ÷ 2/61 = 0.5. The candidate depth of each retriever directly bounds how much agreement fusion can detect.&lt;/p&gt;

&lt;p&gt;It is tempting to conclude that deeper lists are always better. A comment in &lt;code&gt;fusion.ts&lt;/code&gt; records a test that points the other way. Fetching 50 candidates from each retriever lost an expected file on the project's eight-question fixture, with recall falling from 0.94 to 0.88. With &lt;em&gt;k&lt;/em&gt; = 60, a chunk ranked seventh by both retrievers scores 2/67 ≈ 0.030, while a chunk ranked first by one and absent from the other scores 1/61 ≈ 0.016. When the lists are deep enough to contain most of a small corpus, middling agreement can outrank a strong single signal. The fixture is too small to settle the question for large projects, so the code keeps candidate depth equal to &lt;code&gt;topK&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;minScore&lt;/code&gt; is applied only to the fused score. The retrievers do not receive it, because their own scores are on other scales: raw cosine similarity for the dense search, and a score scaled to the best hit for BM25. Both retrievers count equally in the fusion.&lt;/p&gt;

&lt;p&gt;One adjustment is made after it. Documentation describes features in plain words, so a Markdown section about a feature often matches a question about that feature about as well as the code does, and in a mixed repository it can push the code out of the top results. &lt;code&gt;fusion.ts&lt;/code&gt; therefore multiplies the fused score of documentation chunks by &lt;code&gt;DOCS_WEIGHT&lt;/code&gt;, 0.9. Because fused scores sit close together (ranked first by one retriever: 0.5; ranked fifth: 0.47), the weight mostly decides near-ties in favour of code, and its exact value matters little. On the 56-question evaluation, every weight from 0.6 to 0.95 produced the same ranking, improving 12 questions and worsening none, the documentation questions included. A chunk of documentation that both retrievers rank highly still beats code that only one of them found, and a project that contains only documentation is unaffected, because every chunk is scaled alike.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What this step preserves:&lt;/strong&gt; agreement. A chunk supported by both kinds of evidence rises above a chunk supported by only one.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What it gives up:&lt;/strong&gt; the magnitude of the original scores. A BM25 match that is far stronger than everything else and a BM25 match that barely beats second place both count as rank 1. And in a repository of code and documentation, a documentation chunk needs slightly stronger agreement than a code chunk to rank above it.&lt;/p&gt;




&lt;h2&gt;
  
  
  5. The Optional Reranker
&lt;/h2&gt;

&lt;p&gt;&lt;em&gt;A cross-encoder is often presented as a free improvement. In ctx it is opt-in.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;ctx includes a cross-encoder reranker (&lt;code&gt;src/search/reranker.ts&lt;/code&gt;), using &lt;code&gt;Xenova/bge-reranker-base&lt;/code&gt;. When enabled, it takes up to 50 fused candidates, scores each query–document pair, and returns the top &lt;em&gt;k&lt;/em&gt;. In practice the limit is lower: each retriever contributes &lt;code&gt;topK&lt;/code&gt; results, so the reranker sees at most 20 candidates at the default of 10. If the model cannot load, the code warns once and returns the results in their fused order rather than failing the search.&lt;/p&gt;

&lt;p&gt;It is not enabled by default. It runs only with &lt;code&gt;ctx search --rerank&lt;/code&gt;; &lt;code&gt;ask&lt;/code&gt; and &lt;code&gt;chat&lt;/code&gt; do not rerank.&lt;/p&gt;

&lt;p&gt;The README gives the reason in the option's description: in testing, the reranker ranked tables and code lower. A cross-encoder trained mostly on prose judges prose well, and a code-search tool's content is largely not prose. That does not make cross-encoders a poor choice in general. It shows that a stage that improves results on one kind of content can make them worse on another, and that the way to know which applies is to measure on your own content, which section 8's evaluation makes possible.&lt;/p&gt;




&lt;h2&gt;
  
  
  6. From Results to Prompt: Deduplicate, Order, Budget
&lt;/h2&gt;

&lt;p&gt;&lt;em&gt;Retrieval ends with a ranked list. The model sees something else.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;For &lt;code&gt;ctx ask&lt;/code&gt;, retrieved chunks pass through an assembler (&lt;code&gt;src/sdk/rag/assembly/base-assembler.ts&lt;/code&gt;) before reaching the model. The steps run in a fixed order:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Keep the top &lt;code&gt;final_k&lt;/code&gt; results (default 5).&lt;/li&gt;
&lt;li&gt;Remove near-duplicates: a chunk whose word set has Jaccard similarity of 0.8 or more with an already-kept chunk is dropped.&lt;/li&gt;
&lt;li&gt;Include chunks in relevance order until the token budget (default 4,000) is used.&lt;/li&gt;
&lt;li&gt;Reorder the chunks that fit with the configured strategy (default: &lt;code&gt;sandwich&lt;/code&gt;).&lt;/li&gt;
&lt;li&gt;Format as XML, with each &lt;code&gt;&amp;lt;source&amp;gt;&lt;/code&gt; carrying its file path and line range.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;The sandwich ordering is a response to the observation that models tend to use information at the start and end of a long context more reliably than information in the middle. With &lt;em&gt;n&lt;/em&gt; results and the default start count of ⌈&lt;em&gt;n&lt;/em&gt;/2⌉, the top half goes first and the remainder goes at the end in reverse order. For five results, the order becomes 1, 2, 3, 5, 4.&lt;/p&gt;

&lt;p&gt;The order of steps 3 and 4 matters. If the budget ran &lt;em&gt;after&lt;/em&gt; ordering, the chunks it considered last would be those at the end of the sandwich, the positions the ordering reserves for the fourth- and fifth-ranked results, so a tight budget would cut those first while the least relevant chunks in the middle survived. Running the budget first, in relevance order, drops the least relevant chunks, and the sandwich is built from what remains. A test in &lt;code&gt;src/agent/__tests__/assembler.test.ts&lt;/code&gt; covers this: with room for four of five chunks, the result is 1, 2, 4, 3; budgeting after ordering would keep 1, 2, 3, 5.&lt;/p&gt;

&lt;p&gt;The budget loop still includes any chunk that still fits rather than stopping at the first that does not, so a short, lower-ranked chunk can be included after a long one is skipped. With five documentation chunks near the 1,024-token limit, a 4,000-token budget holds three of them.&lt;/p&gt;

&lt;p&gt;It is worth inspecting the final context rather than only the ranked list, because stages like these interact. ctx makes that straightforward: &lt;code&gt;ctx ask --context-only --json&lt;/code&gt; returns the assembled context without calling the model.&lt;/p&gt;




&lt;h2&gt;
  
  
  7. Which Project? Routing Without a Model, Mostly
&lt;/h2&gt;

&lt;p&gt;&lt;em&gt;Searching every indexed project is the safe default until there are a dozen of them.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;ctx can index many projects and search one or all of them. In &lt;code&gt;ctx chat&lt;/code&gt;, a question first goes through &lt;code&gt;QueryIntentClassifier&lt;/code&gt; in &lt;code&gt;src/agent/query-router.ts&lt;/code&gt;, which uses string matching and no model call. Its rules, in order:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Condition&lt;/th&gt;
&lt;th&gt;Intent&lt;/th&gt;
&lt;th&gt;Confidence&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Two or more project names mentioned&lt;/td&gt;
&lt;td&gt;multi-project&lt;/td&gt;
&lt;td&gt;0.95&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;A multi-project keyword (e.g. "compare", "across") and at least one project name&lt;/td&gt;
&lt;td&gt;multi-project&lt;/td&gt;
&lt;td&gt;0.85&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Exactly one project name mentioned&lt;/td&gt;
&lt;td&gt;single project&lt;/td&gt;
&lt;td&gt;0.9&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;No name, but a phrase like "this project" or "this repo"&lt;/td&gt;
&lt;td&gt;single project&lt;/td&gt;
&lt;td&gt;0.85&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;A multi-project keyword with no project name&lt;/td&gt;
&lt;td&gt;general&lt;/td&gt;
&lt;td&gt;0.6&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Anything else&lt;/td&gt;
&lt;td&gt;general&lt;/td&gt;
&lt;td&gt;0.5&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;A comment in the code explains the second-to-last rule: "compare error handling" with no project named is deliberately not classified as multi-project, to avoid false positives.&lt;/p&gt;

&lt;p&gt;What happens to a "general" question depends on state. If a project is focused (with &lt;code&gt;/focus&lt;/code&gt;), the question stays in that project. Only when nothing is focused and at least two projects exist does the router ask the local model, with a 5-second timeout and a confidence threshold of 0.7; if the call fails or the confidence is too low, it searches every project. The order is deliberate. A local model can easily exceed a 5-second limit, and the fallback, searching every project, grows with the number of projects; with many of them it can run past the agent's 30-second tool limit and leave an answer with no sources. Staying in the focused project avoids both.&lt;/p&gt;

&lt;p&gt;When multiple projects are searched, the multi-project service applies RRF at two levels: the dense and BM25 managers each merge results across projects, and the service then fuses the dense and BM25 lists.&lt;/p&gt;




&lt;h2&gt;
  
  
  8. Measuring Retrieval Separately from Answers
&lt;/h2&gt;

&lt;p&gt;&lt;em&gt;If the right chunk never enters the context, no prompt can recover it.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;ctx ships an evaluation command, &lt;code&gt;ctx eval&lt;/code&gt;, with metrics implemented directly in &lt;code&gt;src/eval/metrics.ts&lt;/code&gt;: reciprocal rank, precision@k, recall@k, hit rate, NDCG@k with binary relevance, and average precision. Each golden entry pairs a question with the file paths expected in the results:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"id"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"fixture-002"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"query"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"Where is the JWT token verified?"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"expectedFilePaths"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"src/auth/middleware.ts"&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"tags"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"auth"&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"source"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"manual"&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The repository holds two golden sets in &lt;code&gt;fixtures/eval/&lt;/code&gt;, and they do different jobs.&lt;/p&gt;

&lt;p&gt;The first is a small fixture project (eight source files) with eight queries. A GitHub Actions workflow runs it on pull requests that touch search, indexing, agent or eval code, and weekly on a schedule, using a mock search function; &lt;code&gt;scripts/check-eval-thresholds.js&lt;/code&gt; fails the build if MRR falls below 0.6, precision@k below 0.5, or hit rate below 0.8. It checks that the evaluation machinery works, but it says little about search quality: with the real model it scores an MRR of 0.94, close to its ceiling, so most changes leave its scores exactly where they were.&lt;/p&gt;

&lt;p&gt;The second is &lt;code&gt;ctx-source-golden.json&lt;/code&gt;: 56 questions about ctx's own repository, mixing exact identifiers ("Where is &lt;code&gt;computeRRF&lt;/code&gt; defined?"), paraphrases ("How are near-duplicate chunks removed before the context is assembled?") and documentation questions. Each expected file is stored with a pattern it must contain, the code or text that answers the question, and a test fails if a file is renamed, deleted or no longer contains its answer, so the set cannot quietly drift out of date as the code changes. &lt;code&gt;scripts/eval-source.ts&lt;/code&gt; indexes the repository (180 files, 1,529 chunks) with the real embedding model, in a temporary home folder, and scores it.&lt;/p&gt;

&lt;p&gt;It scores an MRR of 0.60, with the expected file in the top five for 86% of questions (recall 0.80, NDCG 0.63). That leaves room to show changes in either direction, and the breakdown by area of the code shows where search is still weak:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Questions about&lt;/th&gt;
&lt;th&gt;Questions&lt;/th&gt;
&lt;th&gt;MRR&lt;/th&gt;
&lt;th&gt;Hit rate (top 5)&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Database&lt;/td&gt;
&lt;td&gt;4&lt;/td&gt;
&lt;td&gt;1.00&lt;/td&gt;
&lt;td&gt;1.00&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Embeddings&lt;/td&gt;
&lt;td&gt;3&lt;/td&gt;
&lt;td&gt;1.00&lt;/td&gt;
&lt;td&gt;1.00&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Documentation&lt;/td&gt;
&lt;td&gt;8&lt;/td&gt;
&lt;td&gt;0.72&lt;/td&gt;
&lt;td&gt;0.88&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Evaluation&lt;/td&gt;
&lt;td&gt;5&lt;/td&gt;
&lt;td&gt;0.67&lt;/td&gt;
&lt;td&gt;1.00&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Search&lt;/td&gt;
&lt;td&gt;11&lt;/td&gt;
&lt;td&gt;0.64&lt;/td&gt;
&lt;td&gt;1.00&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Indexing&lt;/td&gt;
&lt;td&gt;9&lt;/td&gt;
&lt;td&gt;0.56&lt;/td&gt;
&lt;td&gt;0.67&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;CLI&lt;/td&gt;
&lt;td&gt;9&lt;/td&gt;
&lt;td&gt;0.49&lt;/td&gt;
&lt;td&gt;0.89&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Agent&lt;/td&gt;
&lt;td&gt;4&lt;/td&gt;
&lt;td&gt;0.19&lt;/td&gt;
&lt;td&gt;0.50&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;All&lt;/td&gt;
&lt;td&gt;56&lt;/td&gt;
&lt;td&gt;0.60&lt;/td&gt;
&lt;td&gt;0.86&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;A question can belong to more than one area, and some areas have only three or four questions, so the rows are indications rather than measurements. The eight questions that miss the top five share a pattern: the results usually come from the right module but the wrong file. Asked for the largest file that gets indexed, search returns the chunker's &lt;code&gt;types.ts&lt;/code&gt; rather than its &lt;code&gt;config.ts&lt;/code&gt;; asked what happens when Ollama fails mid-answer, it returns the provider's &lt;code&gt;errors.ts&lt;/code&gt; and &lt;code&gt;types.ts&lt;/code&gt; rather than &lt;code&gt;response-mapper.ts&lt;/code&gt;. Type and error definitions share their vocabulary with the code that uses them, and file-level judging counts those near misses as complete misses. None of this was visible in the eight-question fixture.&lt;/p&gt;

&lt;p&gt;Both sets judge relevance at the file level, so a result counts as relevant if it comes from the right file even if it is the wrong chunk of that file. And 56 questions are still few: a change of one or two questions, about 0.02 MRR, is within what a single reordering can cause, which is why the guide in &lt;code&gt;docs/eval-observability.md&lt;/code&gt; suggests looking at which questions changed rather than only at the totals.&lt;/p&gt;




&lt;h2&gt;
  
  
  Conclusion: The Algorithm Is the Short Part
&lt;/h2&gt;

&lt;p&gt;The core of ctx's retrieval is short. RRF is a loop over two lists. BM25 is a function SQLite already provides, over an index it keeps on disk. Cosine similarity is a function a SQLite extension provides, over vectors that are already stored. The original argument for hybrid search, that lexical and semantic retrieval preserve different evidence, is fully visible in a few hundred lines.&lt;/p&gt;

&lt;p&gt;Most of the remaining code is about everything around those lines: which units get indexed, how identifiers are tokenised, where an index lives and when it is built, what a score of 0.03 means to a person reading it, how many candidates each retriever contributes, whether a reranker helps on this kind of content, what survives a token budget, and whether an old index still matches the code that reads it. Little of it is about ranking. Much of it exists so that the right text is indexed, a score means what it appears to mean, and no stage silently does nothing.&lt;/p&gt;

&lt;p&gt;That is the practical lesson from reading this codebase. Choosing hybrid search is a decision that takes a paragraph to justify. Making it work takes attention to the steps before and after it.&lt;/p&gt;

&lt;h3&gt;
  
  
  The Practical Takeaway
&lt;/h3&gt;

&lt;p&gt;If you are building retrieval over source code, a few checks follow directly from the code above:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Check coverage before ranking.&lt;/strong&gt; Confirm that every line of a file ends up in some chunk. Constants and module-level code are easy to lose with definition-only chunking.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Run your tokenizer on your identifiers.&lt;/strong&gt; Look at what happens to camelCase, snake_case and hyphenated codes. "Exact match" means whatever the tokenizer says it means.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Look at candidate depth, and measure before changing it.&lt;/strong&gt; RRF can only reward agreement that appears inside both lists. If each retriever returns five results, a document ranked sixth by one of them gets no credit for it. Deeper is not automatically better, though: deep lists let middling agreement outrank a strong single signal.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Build indexes once, at index time, and search where the data is.&lt;/strong&gt; Anything loaded or rebuilt when each process starts costs little in a long-running server and dominates a CLI. Both halves of a hybrid search can run in the database you already have: SQLite's FTS5 provides BM25, and sqlite-vec scores stored vectors.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Read the embedding model's card.&lt;/strong&gt; Some retrieval models expect an instruction before queries and none before passages. Using the model the way it was trained is the cheapest improvement there is, but it still needs measuring.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Record what an index was built with.&lt;/strong&gt; When chunking or embedding changes, old indexes keep working and quietly get worse. A stored version number turns that into a warning.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Make scores readable.&lt;/strong&gt; If users or downstream code filter by score, rescale RRF output so its range has a meaning.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Measure optional stages on your own content.&lt;/strong&gt; A reranker, a router, an approximate index or a weight on one kind of document is a trade-off, not a guaranteed improvement.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Inspect the final context, not just the ranking.&lt;/strong&gt; Ordering and token budgets change which chunks the model actually sees.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;ctx is MIT-licensed and available at &lt;a href="https://github.com/Yoda-Man/ctx" rel="noopener noreferrer"&gt;github.com/Yoda-Man/ctx&lt;/a&gt;. The files referenced in this article are under &lt;code&gt;src/search/&lt;/code&gt;, &lt;code&gt;src/indexer/chunker/&lt;/code&gt;, &lt;code&gt;src/database/&lt;/code&gt;, &lt;code&gt;src/sdk/rag/&lt;/code&gt;, &lt;code&gt;src/eval/&lt;/code&gt; and &lt;code&gt;fixtures/eval/&lt;/code&gt;.&lt;/p&gt;




&lt;h3&gt;
  
  
  References
&lt;/h3&gt;

&lt;p&gt;Robertson, S., &amp;amp; Zaragoza, H. (2009). The Probabilistic Relevance Framework: BM25 and Beyond. &lt;em&gt;Foundations and Trends in Information Retrieval&lt;/em&gt;, 3(4), 333–389. &lt;a href="https://doi.org/10.1561/1500000019" rel="noopener noreferrer"&gt;https://doi.org/10.1561/1500000019&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Cormack, G. V., Clarke, C. L. A., &amp;amp; Büttcher, S. (2009). Reciprocal Rank Fusion outperforms Condorcet and individual rank learning methods. &lt;em&gt;Proceedings of SIGIR 2009&lt;/em&gt;, 758–759. &lt;a href="https://doi.org/10.1145/1571941.1572114" rel="noopener noreferrer"&gt;https://doi.org/10.1145/1571941.1572114&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Liu, N. F., Lin, K., Hewitt, J., Paranjape, A., Bevilacqua, M., Petroni, F., &amp;amp; Liang, P. (2024). Lost in the Middle: How Language Models Use Long Contexts. &lt;em&gt;Transactions of the Association for Computational Linguistics&lt;/em&gt;, 12, 157–173. &lt;a href="https://doi.org/10.1162/tacl_a_00638" rel="noopener noreferrer"&gt;https://doi.org/10.1162/tacl_a_00638&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Xiao, S., Liu, Z., Zhang, P., Muennighoff, N., Lian, D., &amp;amp; Nie, J.-Y. (2024). C-Pack: Packed Resources For General Chinese Embeddings. &lt;em&gt;Proceedings of SIGIR 2024&lt;/em&gt;. arXiv:2309.07597. (The paper introducing the BGE embedding models.)&lt;/p&gt;

&lt;p&gt;SQLite. SQLite FTS5 Extension, section 5.1.1, "The bm25() function". &lt;a href="https://www.sqlite.org/fts5.html" rel="noopener noreferrer"&gt;https://www.sqlite.org/fts5.html&lt;/a&gt;. The IDF formula and its 1e-6 floor are in the source, &lt;code&gt;ext/fts5/fts5_aux.c&lt;/code&gt; (function &lt;code&gt;fts5Bm25GetData&lt;/code&gt;). &lt;a href="https://github.com/sqlite/sqlite/blob/master/ext/fts5/fts5_aux.c" rel="noopener noreferrer"&gt;https://github.com/sqlite/sqlite/blob/master/ext/fts5/fts5_aux.c&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Yoda-Man. &lt;em&gt;ctx&lt;/em&gt; source code, version 1.3.3. &lt;a href="https://github.com/Yoda-Man/ctx" rel="noopener noreferrer"&gt;https://github.com/Yoda-Man/ctx&lt;/a&gt;&lt;/p&gt;

</description>
      <category>developers</category>
      <category>llm</category>
      <category>rag</category>
      <category>search</category>
    </item>
    <item>
      <title>Where Speed Gains Direction</title>
      <dc:creator>Trust Mutemasango</dc:creator>
      <pubDate>Sat, 29 Aug 2026 14:57:38 +0000</pubDate>
      <link>https://dev.to/trust_mutemasango_c24e776/where-speed-gains-direction-117m</link>
      <guid>https://dev.to/trust_mutemasango_c24e776/where-speed-gains-direction-117m</guid>
      <description>&lt;p&gt;Every developer knows the feeling: diving into a codebase, chasing a bug, or implementing a feature with furious energy, only to realize you've been working in the wrong file, against the wrong assumptions, or toward the wrong outcome. It's the digital equivalent of running at full sprint in the wrong direction.&lt;/p&gt;

&lt;p&gt;“Speed without direction is the fastest way to get to the wrong place.”&lt;/p&gt;

&lt;p&gt;This principle sits at the heart of YodaMan, a local-first AI workspace companion that fundamentally rethinks how developers interact with their code. Rather than offering yet another chatbot that answers questions in isolation, YodaMan is built around a simple but powerful idea: before you act, you must understand.&lt;/p&gt;

&lt;p&gt;Measure Twice, Cut Once&lt;/p&gt;

&lt;p&gt;The traditional development workflow often resembles a game of hide and seek. You search for a file, open it in an editor, search for another, and slowly piece together a mental model of how things connect. It's fragmented, error-prone, and relies heavily on memory and guesswork.&lt;/p&gt;

&lt;p&gt;YodaMan eliminates the guesswork through its mandatory three-tool pillar: Context Expert for semantic search, Graphify for structural knowledge graphs, and OpenSpec for architectural intent. None is optional, none runs alone. Every search, every agent interaction, and every plan draws on all three simultaneously.&lt;/p&gt;

&lt;p&gt;This isn't just a feature set, it's a philosophy. When you search for something in YodaMan, you don't just get a list of files. You get a ranking that blends semantic relevance, proximity, centrality, and spec coverage. The &lt;code&gt;Trace&lt;/code&gt; tab shows exactly why each result appears where it does, with a transparent breakdown: semantic × 0.50 + proximity × 0.20 + centrality × 0.15 + specCoverage × 0.15.&lt;/p&gt;

&lt;p&gt;Measure twice, cut once. In YodaMan, that measurement happens continuously. The &lt;code&gt;Compose&lt;/code&gt; tab cross-references any file across OpenSpec (specs), Graphify (structure), and Context Expert (relevance) in three columns, giving you a complete picture before you make a single change.&lt;/p&gt;

&lt;p&gt;If You Don’t Plan, You Are Planning to Fail&lt;/p&gt;

&lt;p&gt;Modern development is too complex for ad‑hoc approaches. The blast radius of a single change can ripple through dependency graphs, affect architectural assumptions, and break functionality in unexpected places. YodaMan's &lt;code&gt;Impact&lt;/code&gt; analyzer provides dedicated blast‑radius analysis with configurable hop depth and spec awareness.&lt;/p&gt;

&lt;p&gt;The agent workflow follows a deliberate Propose → Validate → Archive cycle. When the agent proposes a change, it doesn't just implement it. It validates against existing specifications, checks for drift, and requires explicit approval for file changes. Every task is streamed with progress updates, persisted history, and audit logs.&lt;/p&gt;

&lt;p&gt;If you don’t plan, you are planning to fail. YodaMan's &lt;code&gt;Stardust&lt;/code&gt; dashboard gives you eight real‑time views into your project's health: Board, Drift, Compose, Trust, Trace, Impact, Diagnostics, and Commands. The &lt;code&gt;Drift&lt;/code&gt; view actively detects architectural drift between your specifications and your knowledge graph, catching misalignment before it becomes a crisis.&lt;/p&gt;

&lt;p&gt;The Spec Is the Source of Truth&lt;/p&gt;

&lt;p&gt;At the core of YodaMan's architecture is a commitment to specifications as the source of truth. OpenSpec isn't just documentation, it's an active, living artifact that the agent can propose, validate, and archive through dedicated tools. The &lt;code&gt;specPropose&lt;/code&gt;, &lt;code&gt;specValidate&lt;/code&gt;, &lt;code&gt;specArchive&lt;/code&gt;, and &lt;code&gt;specDrift&lt;/code&gt; tools ensure that every change is measured against the architecture you designed.&lt;/p&gt;

&lt;p&gt;The spec is the source of truth for what the system should do. YodaMan enforces this by making specifications mandatory in its decision‑making. Every agent turn receives a &lt;code&gt;Stardust Brief&lt;/code&gt; containing graph state, spec awareness, and per‑file impact. You can't accidentally work against your architecture because the system won't let you.&lt;/p&gt;

&lt;p&gt;Tools That Drive Better Decisions&lt;/p&gt;

&lt;p&gt;Perhaps most importantly, YodaMan is designed to drive the developer to spend more time planning and give them the tools to study and examine and give them as much information as possible to make the best decision in the planning phase.&lt;/p&gt;

&lt;p&gt;This manifests in features like the &lt;code&gt;Trust&lt;/code&gt; dashboard, which provides a unified health view with per‑tool status and a &lt;code&gt;WorkspaceReadiness&lt;/code&gt; verdict. Before you start coding, you can verify that every dependency Ollama, Context Expert, Graphify, and OpenSpec is healthy and available. The &lt;code&gt;yodaman doctor&lt;/code&gt; command checks everything before you begin.&lt;/p&gt;

&lt;p&gt;The system is built for privacy and control. All indexing and model workflows run locally through Ollama. No code leaves your machine. Security settings default to the safe value, with deliberate opt‑in for capabilities like agent commands or plugin uploads. You control your environment entirely.&lt;/p&gt;

&lt;p&gt;A New Way Forward&lt;/p&gt;

&lt;p&gt;YodaMan represents a shift from reactive development to deliberate, informed decision‑making. It's not about moving faster, it's about moving with purpose. By forcing the triad of semantic search, structural understanding, and architectural intent into every interaction, it ensures that speed is always aligned with direction.&lt;/p&gt;

&lt;p&gt;Moving slower to move faster: that is the philosophy. Because in the end, the fastest way to the right place isn't about speed at all. It's about knowing where you're going before you start moving.&lt;/p&gt;

&lt;p&gt;Get The Latest Version From &lt;a href="https://www.npmjs.com/package/yodaman" rel="noopener noreferrer"&gt;https://www.npmjs.com/package/yodaman&lt;/a&gt;&lt;/p&gt;

</description>
      <category>ai</category>
      <category>developer</category>
      <category>productivity</category>
      <category>softwaredevelopment</category>
    </item>
  </channel>
</rss>
