<?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: William Zhu</title>
    <description>The latest articles on DEV Community by William Zhu (@willzhu16).</description>
    <link>https://dev.to/willzhu16</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%2F4008794%2F2b3e132a-3f71-4cd8-ad85-efa73c64e24a.png</url>
      <title>DEV Community: William Zhu</title>
      <link>https://dev.to/willzhu16</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/willzhu16"/>
    <language>en</language>
    <item>
      <title>I measured what my AI coding assistant loads before I type</title>
      <dc:creator>William Zhu</dc:creator>
      <pubDate>Wed, 15 Jul 2026 05:00:00 +0000</pubDate>
      <link>https://dev.to/willzhu16/i-measured-what-my-ai-coding-assistant-loads-before-i-type-18ho</link>
      <guid>https://dev.to/willzhu16/i-measured-what-my-ai-coding-assistant-loads-before-i-type-18ho</guid>
      <description>&lt;p&gt;Open a project in Claude Code, Cursor, or Copilot and type your first prompt. &lt;/p&gt;

&lt;p&gt;Before your request even reaches the model, the tool may already have loaded &lt;code&gt;CLAUDE.md&lt;/code&gt;, &lt;code&gt;AGENTS.md&lt;/code&gt;, &lt;code&gt;.cursorrules&lt;/code&gt;, Copilot instructions, imported rule files, and scattered project notes.&lt;/p&gt;

&lt;p&gt;So before you tell the agent what to do, the repository has already told it how to behave. That's usually fine. It's how these tools are meant to work. &lt;/p&gt;

&lt;p&gt;...but it also makes the instruction layer easy to set and forget. That invisible context can run to thousands of tokens, and none of it shows up in the message you just typed.&lt;/p&gt;

&lt;p&gt;So when an agent ignores a rule, the obvious conclusion is that the model failed. But what if the rule is buried under a few thousand tokens of instructions? Or the same policy lives in three files for three different tools, and the copies no longer agree?&lt;/p&gt;

&lt;p&gt;I wanted to know how large that invisible layer had become in real projects. So I scanned 100 popular open-source repositories.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;72 had AI instruction files. The median adopter carried just under 2,200 tokens of always-loaded instructions across the AI tools configured in the repository. One carried nearly 24,000.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;But the most interesting number wasn't the largest file. Of the 55 repos with multiple instruction files, &lt;strong&gt;15 had rules duplicated across files&lt;/strong&gt;. &lt;/p&gt;

&lt;p&gt;The invisible prompt wasn't just growing. It was forking.&lt;/p&gt;




&lt;h2&gt;
  
  
  The layer we rarely diff
&lt;/h2&gt;

&lt;p&gt;AI instruction files are behavioral configuration. They change how an agent writes code, runs tests, structures commits, and names files. They live in Git, but we rarely give them the same discipline as the code around them. No size budget, no review that treats a rule change as a behavior change, no check that the copies agree.&lt;/p&gt;

&lt;p&gt;They grow a section at a time. Rules get copied between tools. Old guidance outlives the project decision that motivated it. And that costs you twice:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Context.&lt;/strong&gt; Always-loaded instructions occupy part of the effective context before your task, your code, or your error output even arrives.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Attention.&lt;/strong&gt; The one rule that matters has to compete with a few thousand tokens of other instructions and boilerplate.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;And the whole thing is invisible. Most people have never seen their config layer as a single number.&lt;/p&gt;




&lt;h2&gt;
  
  
  What 100 real repos look like
&lt;/h2&gt;

&lt;p&gt;I ran a linter over the AI configuration of &lt;strong&gt;100 well-known open-source projects&lt;/strong&gt;. It's a hand-picked list, deliberately skewed toward AI-native tooling (SDKs, agents, frameworks). Read this as "what popular, AI-forward projects look like," not a random sample of GitHub. The list is public if you want to reproduce it.&lt;/p&gt;

&lt;p&gt;A few things stood out:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Nearly three-quarters ship AI instruction files.&lt;/strong&gt; 72% had at least one. In this AI-forward sample, that makes instruction files common rather than exceptional, and over half (55%) carried &lt;em&gt;more than one&lt;/em&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;The median adopter carried 2,198.5 tokens&lt;/strong&gt; of always-loaded instructions across the AI tools configured in the repository.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;The heavy adopters carried a lot.&lt;/strong&gt; Counting only &lt;em&gt;always-loaded&lt;/em&gt; content (the rules set to load automatically, with path-scoped and on-demand files excluded), &lt;code&gt;coder&lt;/code&gt; tops the sample at 23,870 tokens across 13 always-on files, 10 of them pulled in by &lt;code&gt;@import&lt;/code&gt;. &lt;code&gt;cline&lt;/code&gt; carries 14,673 across 9 always-loaded rule files, and bun 9,084, effectively all of it in a single &lt;code&gt;CLAUDE.md&lt;/code&gt;. That's an order of magnitude past the median.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Half carried config for two or more tools&lt;/strong&gt; side by side: &lt;code&gt;CLAUDE.md&lt;/code&gt;, &lt;code&gt;AGENTS.md&lt;/code&gt;, and Cursor rules in the same tree. Among the 55 repos with multiple instruction files, 15 had rules duplicated across files.&lt;/li&gt;
&lt;/ul&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%2Fefz9pn6d4sb1idnaywup.png" 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%2Fefz9pn6d4sb1idnaywup.png" alt="Auto-loaded token bar graph" width="800" height="387"&gt;&lt;/a&gt;&lt;/p&gt;




&lt;h3&gt;
  
  
  What the numbers do (and don't) mean
&lt;/h3&gt;

&lt;p&gt;The footprint counts only always-loaded rules. I excluded files a tool attaches only for certain paths or pulls in on demand. That's why &lt;code&gt;microsoft/vscode&lt;/code&gt;, with 34 instruction files, contributes only ~2,600 always-on tokens rather than the 30,000+ you'd get by adding every file it ships.&lt;/p&gt;

&lt;p&gt;The combined footprint also sums the configurations for the different AI tools detected in the repository. Claude Code loads Claude's applicable instructions; Cursor loads Cursor's. The total shows how much always-on AI policy the repository is maintaining across its tools. The obvious objection: no single assistant reads all of it.&lt;/p&gt;

&lt;p&gt;Well, more than half the time it does. In 58% of the repos with instruction files, one tool loads every single token of that combined number. Across 8 in 10, one assistant reads at least 70% of it. For about one in six, a single assistant reads only half to two-thirds.&lt;/p&gt;

&lt;p&gt;Which puts that median back where it started. Roughly 2,200 tokens isn't an accounting total spread across a toolchain. More often than not, it's one assistant, reading all of it, before your first word.&lt;/p&gt;

&lt;p&gt;Multiple instruction files are not automatically a problem, but they create opportunities for the same guidance to be copied between tools. A real example: &lt;strong&gt;documenso&lt;/strong&gt; keeps a block of coding rules in both &lt;code&gt;.cursorrules&lt;/code&gt; and &lt;code&gt;AGENTS.md&lt;/code&gt;: four exact duplicates and one near-match. One identical rule in both files says: "never use 1 line if statements." Today that's harmless. But the policy now has two sources of truth. The day someone refines the rule in one file and forgets the other, the copies can diverge without anyone noticing. Multiply that across a 250-line file maintained in parallel for three tools, and drift stops being hypothetical.&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%2Fh86p7z43wb11wk7acub7.png" 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%2Fh86p7z43wb11wk7acub7.png" alt="documenso's .cursorrules and AGENTS.md share four identical rules and a near-duplicate. Two sources of truth for the same policy." width="781" height="621"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;About that duplication count: ContextGuard originally flagged 18 repos. The three beyond the manually verified 15 are borderline by design: a vendored skill copied at two paths, a line shared by two project templates, a deliberate boilerplate header. &lt;/p&gt;

&lt;p&gt;I also excluded MCP overhead because the meaningful context cost comes from runtime tool schemas, not the static config file itself.&lt;/p&gt;




&lt;h2&gt;
  
  
  What I built
&lt;/h2&gt;

&lt;p&gt;I turned the linter into a small VS Code extension, &lt;strong&gt;ContextGuard&lt;/strong&gt;, that gives this layer the visibility we already expect from code:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;A &lt;strong&gt;status-bar counter&lt;/strong&gt; for your combined instruction footprint (the always-loaded tokens summed across your tools), with an estimated monthly cost on hover.&lt;/li&gt;
&lt;li&gt;A &lt;strong&gt;preview&lt;/strong&gt; of the detected instruction context, in load order, with imports expanded, always-loaded rules separated from scoped/on-demand ones, and secrets redacted.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Warnings&lt;/strong&gt; for oversized files, repeated rules within a file, broken &lt;code&gt;@import&lt;/code&gt; references, and secret-like values that need review.&lt;/li&gt;
&lt;/ul&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%2Fi3izo002tlukb65uf68b.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%2Fi3izo002tlukb65uf68b.gif" alt="Workplace Scan - ContextGuard" width="600" height="853"&gt;&lt;/a&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%2Fjlc3orod3mjqnwczmc8o.png" 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%2Fjlc3orod3mjqnwczmc8o.png" alt="Status bar - ContextGuard" width="282" height="90"&gt;&lt;/a&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%2Fywm61o3gdwp1zp9gohyq.png" 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%2Fywm61o3gdwp1zp9gohyq.png" alt="Preview injected context - ContextGuard" width="800" height="458"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;A per-assistant view, showing what each tool actually loads in a single request, is on the roadmap.&lt;/p&gt;

&lt;p&gt;It's &lt;strong&gt;local-first and deterministic.&lt;/strong&gt; Every finding is tied to a file and line, there are no AI calls, and no telemetry. On the free tier it makes no network calls at all.&lt;/p&gt;

&lt;p&gt;Sometimes the model really does ignore a perfectly clear instruction. But sometimes we've handed it a few thousand tokens of accumulated policy, copied the important rule into three places, and then expected it to know which sentence mattered most.&lt;/p&gt;

&lt;p&gt;If instruction files can change an agent's behavior, they are part of the software. I think we should start treating them that way: review them, keep an eye on their size, and avoid maintaining three slightly different copies of the same rule.&lt;/p&gt;

&lt;p&gt;Before blaming the agent, inspect the prompt you didn't type.&lt;/p&gt;

&lt;p&gt;→ &lt;strong&gt;&lt;a href="https://marketplace.visualstudio.com/items?itemName=bearinblue.contextguard" rel="noopener noreferrer"&gt;ContextGuard on the VS Code Marketplace&lt;/a&gt;&lt;/strong&gt; · &lt;strong&gt;&lt;a href="https://open-vsx.org/extension/bearinblue/contextguard" rel="noopener noreferrer"&gt;ContextGuard on the Open VSX Registry&lt;/a&gt;&lt;/strong&gt; · &lt;a href="https://github.com/BearInBlue/contextguard/blob/main/scripts/repos.txt" rel="noopener noreferrer"&gt;the repo list I scanned&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;How many AI instruction files are sitting in your main repo, and when did anyone last review them together?&lt;/p&gt;

</description>
      <category>ai</category>
      <category>vscode</category>
      <category>productivity</category>
      <category>tooling</category>
    </item>
    <item>
      <title>GitHub Copilot went usage-based, so I built a linter for AI context files</title>
      <dc:creator>William Zhu</dc:creator>
      <pubDate>Tue, 30 Jun 2026 15:00:00 +0000</pubDate>
      <link>https://dev.to/willzhu16/github-copilot-went-usage-based-so-i-built-a-linter-for-ai-context-files-2i3k</link>
      <guid>https://dev.to/willzhu16/github-copilot-went-usage-based-so-i-built-a-linter-for-ai-context-files-2i3k</guid>
      <description>&lt;p&gt;As I'm sure a lot of you saw, GitHub Copilot recently moved from request-based billing to usage-based billing :(&lt;/p&gt;

&lt;p&gt;Copilot is the main AI coding tool I use day-to-day, so the change made me look a lot harder at how much context I was actually feeding these tools. No more casually attaching half the repo and saying "loop until done" without wondering what that costs.&lt;/p&gt;

&lt;p&gt;...not that I ever did that...&lt;/p&gt;

&lt;p&gt;But the more I looked into it, the more I realized the token count was only part of the problem.&lt;/p&gt;




&lt;h2&gt;
  
  
  The part I didn't expect
&lt;/h2&gt;

&lt;p&gt;The weirder issue was that I didn't really have visibility into what gets loaded into the AI assistant's context.&lt;/p&gt;

&lt;p&gt;For me, that meant Copilot instruction files. But depending on your stack, it might be &lt;code&gt;CLAUDE.md&lt;/code&gt;, &lt;code&gt;AGENTS.md&lt;/code&gt;, MCP configs, old AI notes nobody cleaned up, or other agent-related config sitting around the repo.&lt;/p&gt;

&lt;p&gt;When I pointed my extension at a real public project, the open-source Cline repo, it found around &lt;strong&gt;29k tokens&lt;/strong&gt; spread across its AI instruction and configuration files.&lt;/p&gt;

&lt;p&gt;That doesn't mean Cline loads all 29,000 tokens into every request. It's a combined footprint across different tools, each of which may use a different subset of those files.&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%2Fuj1panyce5w17olzdvmz.png" 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%2Fuj1panyce5w17olzdvmz.png" alt="ContextGuard Status Bar - Cline" width="624" height="91"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;And honestly, I couldn't have told you what half of it was.&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%2Fb6i8y9zru9xeosnvq27y.png" 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%2Fb6i8y9zru9xeosnvq27y.png" alt="ContextGuard Injected Preview - Cline Repo" width="800" height="972"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;That layer can quietly become messy: stale notes, broken references, files you forgot existed, or even secrets that really should not be sitting in AI-visible config.&lt;/p&gt;




&lt;h2&gt;
  
  
  So I built ContextGuard
&lt;/h2&gt;

&lt;p&gt;ContextGuard is a VS Code extension for inspecting and linting the AI config/instruction layer in your workspace.&lt;/p&gt;

&lt;p&gt;It's more than a token counter. It's built to answer:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;What is my assistant already seeing, and is any of it weird?&lt;/p&gt;
&lt;/blockquote&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%2F9p9djze9rj60mr3cyt7d.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%2F9p9djze9rj60mr3cyt7d.gif" alt="ContextGuard scanning Cline repo" width="600" height="853"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;What it does:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Shows your auto-loaded token baseline in the status bar&lt;/li&gt;
&lt;li&gt;Previews what config/instruction files are being loaded, in order&lt;/li&gt;
&lt;li&gt;Flags broken import references and stale instruction files&lt;/li&gt;
&lt;li&gt;Flags likely secrets in AI-visible files, with exact line numbers&lt;/li&gt;
&lt;li&gt;Lets you bundle selected files/context for web agents&lt;/li&gt;
&lt;li&gt;Optionally estimates monthly cost from that baseline, with configurable usage assumptions&lt;/li&gt;
&lt;/ul&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%2Fbhnepyrbko7blh9vg98h.png" 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%2Fbhnepyrbko7blh9vg98h.png" alt="ContextGuard flagging a fake secret in a test repo" width="543" height="96"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;It's free, runs fully local, and makes no network calls.&lt;/p&gt;




&lt;h2&gt;
  
  
  The honest caveats
&lt;/h2&gt;

&lt;p&gt;Big disclaimer: the secret detection is heuristic, so it's a safety net, not a guarantee. It'll catch some obvious "oh no, that's a key in my &lt;code&gt;CLAUDE.md&lt;/code&gt;" cases, but please do not treat it as airtight secret scanning.&lt;/p&gt;

&lt;p&gt;It's also brand new and my first real VS Code extension, so I'd genuinely love feedback. If the UX is confusing, if it misflags something, or if it doesn't match how your AI setup works, please tell me and I'll patch what I can.&lt;/p&gt;

&lt;p&gt;I'm sharing it here partly because I'm curious whether other people's AI context baselines look as weird as mine did.&lt;/p&gt;




&lt;h2&gt;
  
  
  Try it
&lt;/h2&gt;

&lt;p&gt;If you do try it, I'm honestly curious what your baseline comes out to. I have a feeling some of these are bigger than people expect.&lt;/p&gt;

&lt;p&gt;Marketplace: &lt;a href="https://marketplace.visualstudio.com/items?itemName=bearinblue.contextguard" rel="noopener noreferrer"&gt;https://marketplace.visualstudio.com/items?itemName=bearinblue.contextguard&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Website: &lt;a href="https://bearinblue.github.io/contextguard/" rel="noopener noreferrer"&gt;https://bearinblue.github.io/contextguard/&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The GIF is from the open-source Cline repo, which I used because it's a public project people can inspect. The secret example is from a test repo I made with fake keys. Not a real leak, thankfully.&lt;/p&gt;

&lt;p&gt;Thanks for reading, and happy Fourth to everyone celebrating!&lt;/p&gt;

</description>
      <category>showdev</category>
      <category>vscode</category>
      <category>ai</category>
      <category>githubcopilot</category>
    </item>
  </channel>
</rss>
