<?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: Siddhartha Katiyar</title>
    <description>The latest articles on DEV Community by Siddhartha Katiyar (@siddharthakatiyar).</description>
    <link>https://dev.to/siddharthakatiyar</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%2F952409%2F92fc8e8d-e9d5-4c06-b291-87429f974a8b.jpeg</url>
      <title>DEV Community: Siddhartha Katiyar</title>
      <link>https://dev.to/siddharthakatiyar</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/siddharthakatiyar"/>
    <language>en</language>
    <item>
      <title>Why AI Coding Agents Get Lost in Large Codebases</title>
      <dc:creator>Siddhartha Katiyar</dc:creator>
      <pubDate>Tue, 04 Aug 2026 17:00:00 +0000</pubDate>
      <link>https://dev.to/siddharthakatiyar/why-ai-coding-agents-get-lost-in-large-codebases-3cn</link>
      <guid>https://dev.to/siddharthakatiyar/why-ai-coding-agents-get-lost-in-large-codebases-3cn</guid>
      <description>&lt;p&gt;Modern large language models are becoming dramatically better at reasoning about code. Context windows are expanding from a few thousand tokens to millions. Yet, developers still struggle to get consistent, accurate answers from AI coding assistants when working on large, real-world repositories.&lt;/p&gt;

&lt;p&gt;If you've ever watched an agent like Claude Desktop or Cursor try to debug a complex issue in a new repository, you've likely witnessed the "Grep Loop of Despair":&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;The agent runs &lt;code&gt;grep -r "AuthService" .&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;It gets 500 results.&lt;/li&gt;
&lt;li&gt;It runs &lt;code&gt;cat&lt;/code&gt; on three random files.&lt;/li&gt;
&lt;li&gt;It reads 40,000 tokens of irrelevant configuration and test data.&lt;/li&gt;
&lt;li&gt;It hallucinates a fix that doesn't compile.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;The prevailing assumption has been that simply feeding more files into larger context windows will solve the problem. It hasn't. &lt;/p&gt;

&lt;p&gt;This is not a model reasoning problem. It is a retrieval problem.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Flaws of "Chunk and Embed" for Code
&lt;/h2&gt;

&lt;p&gt;The standard architecture used by most AI retrieval systems today (RAG) follows a predictable pipeline: read the text, chunk it arbitrarily by character count, generate vector embeddings, and search via cosine similarity.&lt;/p&gt;

&lt;p&gt;This architecture works remarkably well for documentation and corporate wikis. However, it degrades rapidly on software repositories. &lt;/p&gt;

&lt;p&gt;When code is chunked by character count, function boundaries are destroyed. When retrieval relies solely on embeddings, deterministic symbol lookups become probabilistic guesses.&lt;/p&gt;

&lt;p&gt;If a developer asks an AI assistant: &lt;em&gt;"Where is the &lt;code&gt;AuthMiddleware&lt;/code&gt; implemented?"&lt;/em&gt; they do not want &lt;em&gt;"something related to authentication."&lt;/em&gt; They want the exact &lt;code&gt;AuthMiddleware&lt;/code&gt; class. Immediately. Deterministically.&lt;/p&gt;

&lt;h2&gt;
  
  
  Introducing ContextOS
&lt;/h2&gt;

&lt;p&gt;I built &lt;a href="https://github.com/siddharthakatiyar/ContextOS" rel="noopener noreferrer"&gt;ContextOS&lt;/a&gt; to solve this exact problem. It is a local-first context engine designed specifically to index and retrieve software structures for AI agents.&lt;/p&gt;

&lt;h3&gt;
  
  
  1. AST-Aware Extraction
&lt;/h3&gt;

&lt;p&gt;Instead of blindly chunking by characters, ContextOS parses the repository using Tree-sitter. It extracts functions, classes, interfaces, and methods as discrete, logical chunks. A 50-line function becomes a single chunk. The structural integrity of the code is preserved.&lt;/p&gt;

&lt;h3&gt;
  
  
  2. BM25 over Embeddings
&lt;/h3&gt;

&lt;p&gt;While embeddings are great at finding conceptual similarities, they struggle with exact symbol lookups. ContextOS flips the standard paradigm: it uses SQLite FTS5 (BM25) as the primary retrieval mechanism for deterministic lexical search, and falls back to a local MiniLM ONNX model for semantic matching only when necessary.&lt;/p&gt;

&lt;h3&gt;
  
  
  3. Context Compression
&lt;/h3&gt;

&lt;p&gt;Retrieving the right context is only half the problem. If you send 50 relevant chunks to an LLM, you dilute its attention. ContextOS implements a query-aware compiler that compresses context: the most important nodes are sent in full, while lower-scoring nodes are compressed into single-line stubs (e.g., &lt;code&gt;interface User — path/types.ts:12-40&lt;/code&gt;). &lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fzxfwi34brey91sokwtnz.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fzxfwi34brey91sokwtnz.gif" alt="Claude Code using ContextOS" width="720" height="412"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  The Results
&lt;/h2&gt;

&lt;p&gt;In a 100-query benchmark against the Redis 7.x C codebase, ContextOS achieved a 98% file-level recall for exact-function queries. Crucially, it did this while averaging just &lt;strong&gt;589 tokens per query&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;For modern web frameworks like React and Next.js, the context footprint drops even further—averaging just ~280 tokens per query with 100% accuracy.&lt;/p&gt;

&lt;p&gt;Token efficiency directly translates to lower latency, reduced API costs, and significantly less model confusion. A model analyzing ~300 highly relevant tokens will consistently outperform a model drowning in 40,000 tokens of noisy, full-file context.&lt;/p&gt;

&lt;p&gt;ContextOS operates as a Model Context Protocol (MCP) server, meaning you can plug it directly into Cursor, Claude Desktop, and any other MCP-compliant client today. &lt;/p&gt;

&lt;p&gt;Stop letting your AI drown in grep output. Give it the context engine it deserves. &lt;/p&gt;

&lt;p&gt;Check out the repository on &lt;a href="https://github.com/siddharthakatiyar/ContextOS" rel="noopener noreferrer"&gt;GitHub&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Cover Photo by &lt;a href="https://unsplash.com/@ffstop?utm_source=unsplash&amp;amp;utm_medium=referral&amp;amp;utm_content=creditCopyText" rel="noopener noreferrer"&gt;Fotis Fotopoulos&lt;/a&gt; on &lt;a href="https://unsplash.com/photos/black-remote-control-on-red-table-6sAl6aQ4OWI?utm_source=unsplash&amp;amp;utm_medium=referral&amp;amp;utm_content=creditCopyText" rel="noopener noreferrer"&gt;Unsplash&lt;/a&gt;&lt;/p&gt;

</description>
      <category>ai</category>
      <category>architecture</category>
      <category>softwareengineering</category>
      <category>mcp</category>
    </item>
  </channel>
</rss>
