<?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: Lazar Aćimović</title>
    <description>The latest articles on DEV Community by Lazar Aćimović (@lazar_aimovi_81401df3b8).</description>
    <link>https://dev.to/lazar_aimovi_81401df3b8</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%2F4209005%2F50121e03-c7d0-404d-82eb-845cd27f009f.jpg</url>
      <title>DEV Community: Lazar Aćimović</title>
      <link>https://dev.to/lazar_aimovi_81401df3b8</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/lazar_aimovi_81401df3b8"/>
    <language>en</language>
    <item>
      <title>How I Reduced Unnecessary AI Agent Context Usage by 50% (No More, No Less)</title>
      <dc:creator>Lazar Aćimović</dc:creator>
      <pubDate>Mon, 26 Oct 2026 14:55:31 +0000</pubDate>
      <link>https://dev.to/lazar_aimovi_81401df3b8/how-i-reduced-unnecessary-ai-agent-context-usage-by-50-no-more-no-less-2k32</link>
      <guid>https://dev.to/lazar_aimovi_81401df3b8/how-i-reduced-unnecessary-ai-agent-context-usage-by-50-no-more-no-less-2k32</guid>
      <description>&lt;p&gt;Let's get straight to the point - the before and after screenshots are at the end of the post.&lt;/p&gt;

&lt;p&gt;At first glance, people might think that 200k tokens of context is an impressive number. Not when simply reading documentation consumes over 60% of it before the agent even starts working on the task.&lt;/p&gt;

&lt;p&gt;A short backstory - I was refining my StudentPortal project by applying the principles of agentic engineering.&lt;/p&gt;

&lt;p&gt;Until now, it had 4 documents - PRD, Tech, UI, and DB - and the process worked by requiring every chat to read all 4 before implementing anything.&lt;/p&gt;

&lt;p&gt;As I kept adding more tasks and changes, a new agent couldn't even complete a subtask, let alone an entire task. On top of that, it would automatically trigger auto-compact, then mess everything up and forget what it had been working on. That's when I realized I had to change my approach.&lt;/p&gt;

&lt;p&gt;I solved this problem in &lt;strong&gt;2 steps&lt;/strong&gt;:&lt;/p&gt;

&lt;p&gt;I added an &lt;strong&gt;Overview.md&lt;/strong&gt; file, which every agent reads when starting (along with the AGENTS.md file). Essentially, it serves as a pointer map to specific documents. If a task involves business rules, the agent reads the PRD.md file. If a task is strictly related to the database, the agent reads the DB.md file. If it's related to architecture, it reads Tech.md. In other words, it never reads all 4 documents upfront.&lt;/p&gt;

&lt;p&gt;Using the &lt;strong&gt;grep tool&lt;/strong&gt; in combination with offset and limit. Now, you might be wondering: "Okay, the task involves creating a backend service. Does that mean the agent now has to read the entire tech.md file when it only needs the section related to backend architecture, not frontend architecture?"&lt;/p&gt;

&lt;p&gt;The answer is no - and that's exactly what grep is for. It solves this problem by finding the exact line number where the relevant section begins. Combined with offset and limit, the agent reads only that section instead of the entire file.&lt;/p&gt;

&lt;p&gt;The result - as you can see, after implementing this workflow, context usage after completing the first subtask was around 40% and a bit, which is practically half of what it was before.&lt;/p&gt;

&lt;p&gt;You can find the details of this system in the docs folder of my repository: &lt;a href="https://lnkd.in/dkumabfU" rel="noopener noreferrer"&gt;https://lnkd.in/dkumabfU&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;If you have an app idea that is fairly complex, I'd be happy to hear that my system helped someone solve the same or a similar problem. Because, generally speaking, no matter how well you plan something, if the agent consumes too much context right from the start, building the application within that same context window becomes difficult.&lt;/p&gt;

&lt;h1&gt;
  
  
  AI #ClaudeCode #SoftwareEngineering #Documentation #ContextManagement #TechnicalWriting #Backend #WebDevelopment #DeveloperProductivity #AIAgents #PromptEngineering #AgenticEngineering
&lt;/h1&gt;

</description>
      <category>webdev</category>
      <category>ai</category>
      <category>dotnet</category>
      <category>react</category>
    </item>
  </channel>
</rss>
