<?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: Darshan K</title>
    <description>The latest articles on DEV Community by Darshan K (@darshan_k).</description>
    <link>https://dev.to/darshan_k</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F3764990%2F72e0cbf5-30da-47e7-a5c3-0c58bb39e6ad.png</url>
      <title>DEV Community: Darshan K</title>
      <link>https://dev.to/darshan_k</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/darshan_k"/>
    <language>en</language>
    <item>
      <title>I Built a CLI That Caught 33,531 Tokens of Startup Bloat in My Agent Project</title>
      <dc:creator>Darshan K</dc:creator>
      <pubDate>Sat, 11 Apr 2026 17:57:27 +0000</pubDate>
      <link>https://dev.to/darshan_k/i-built-a-cli-that-caught-33531-tokens-of-startup-bloat-in-my-agent-project-2co6</link>
      <guid>https://dev.to/darshan_k/i-built-a-cli-that-caught-33531-tokens-of-startup-bloat-in-my-agent-project-2co6</guid>
      <description>&lt;p&gt;One afternoon I looked at my Claude Code agent and realized: I have no idea how many tokens load on startup. Skills scattered across &lt;code&gt;.agents/skills/&lt;/code&gt;, global instructions in &lt;code&gt;CLAUDE.md&lt;/code&gt;, reference files nobody asked for — it all adds up invisibly.&lt;/p&gt;

&lt;p&gt;So I built &lt;strong&gt;trimr&lt;/strong&gt; — a CLI that tells you exactly how much token bloat you have at startup, and automatically migrates your skills to a progressive-disclosure architecture.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Problem
&lt;/h2&gt;

&lt;p&gt;Your Claude Code agent loads every skill file on startup. All of them. Whether you need them or not.&lt;/p&gt;

&lt;p&gt;Even a "lean" project can burn 30K+ tokens before you type a single message. But you can't &lt;em&gt;see&lt;/em&gt; it, so you optimize in the dark.&lt;/p&gt;

&lt;h2&gt;
  
  
  What I Found in My Own Project
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;$ &lt;/span&gt;trimr audit ./my-agent
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight console"&gt;&lt;code&gt;&lt;span class="go"&gt;📊 trimr audit — ./my-agent
──────────────────────────────────────────────────
Skill files (21 found)
  Ungated (globally loaded):   21 skills    ~33,531 tokens at startup
  Vaultable:                   21 skills    eligible for migration

Startup token cost
  Current:                     ~33,531 tokens
  After migration:             ~2,100 tokens
  Reduction:                   93.7%

Violations (31)
  [WARN]  .agents\skills\adapt\SKILL.md       | Ungated skill eligible for migration
  [WARN]  .agents\skills\animate\SKILL.md     | Ungated skill eligible for migration
  [WARN]  .agents\skills\critique\SKILL.md    | Ungated skill eligible for migration
  [WARN]  .agents\skills\frontend-design\SKILL.md | Ungated skill eligible for migration
  ... 17 more

Run `trimr migrate ./my-agent` to auto-fix.
──────────────────────────────────────────────────
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;33,531 tokens. Gone before my agent processed a single word.&lt;/p&gt;

&lt;h2&gt;
  
  
  How It Works
&lt;/h2&gt;

&lt;p&gt;The fix is &lt;strong&gt;progressive disclosure&lt;/strong&gt;: instead of loading every skill at startup, you load a 100-token metadata stub (name + description). The full skill body only loads when the agent actually needs it.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Before migration:
  Agent starts → loads all 21 skills (33,531 tokens)

After migration:
  Agent starts → loads 21 metadata stubs (2,100 tokens)
  Agent needs "critique" skill → loads it on demand (2,468 tokens)
  Everything else: never loaded
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;&lt;code&gt;trimr audit&lt;/code&gt;&lt;/strong&gt; finds the bloat:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Ungated skills loaded globally&lt;/li&gt;
&lt;li&gt;Oversized global instruction files (CLAUDE.md, AGENTS.md, .cursorrules)&lt;/li&gt;
&lt;li&gt;Hidden system prompts in JSON/YAML/TOML configs&lt;/li&gt;
&lt;li&gt;Malformed YAML frontmatter that breaks skill routing silently&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;&lt;code&gt;trimr migrate&lt;/code&gt;&lt;/strong&gt; auto-fixes it:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Moves ungated skills to &lt;code&gt;.vault/skills/&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Generates pointer files so the agent knows where to find things&lt;/li&gt;
&lt;li&gt;Truncates bloated global files while preserving frontmatter&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;--dry-run&lt;/code&gt; shows exactly what will change before touching anything&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Installation
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;pip &lt;span class="nb"&gt;install &lt;/span&gt;trimr
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Try It
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# See what you've got&lt;/span&gt;
trimr audit ./your-agent

&lt;span class="c"&gt;# Preview the fix&lt;/span&gt;
trimr migrate ./your-agent &lt;span class="nt"&gt;--dry-run&lt;/span&gt;

&lt;span class="c"&gt;# Apply it&lt;/span&gt;
trimr migrate ./your-agent

&lt;span class="c"&gt;# Verify&lt;/span&gt;
trimr audit ./your-agent
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Who It's For
&lt;/h2&gt;

&lt;p&gt;Optimized for &lt;strong&gt;Claude Code and Cursor IDE&lt;/strong&gt; projects using markdown-based SKILL.md files.&lt;/p&gt;

&lt;p&gt;Not for Langchain/OpenAI/Anthropic Workbench — different architecture, different problem.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Numbers
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Before&lt;/strong&gt;: 33,531 tokens at startup&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;After&lt;/strong&gt;: ~2,100 tokens (21 skills × 100 token L1 metadata)&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Reduction&lt;/strong&gt;: 93.7%&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;These are real numbers from a real audit on my own project. Your mileage will vary depending on skill size and count — run the audit to find out what you're actually burning.&lt;/p&gt;




&lt;p&gt;&lt;strong&gt;GitHub&lt;/strong&gt;: &lt;a href="https://github.com/rushdarshan/trimr" rel="noopener noreferrer"&gt;https://github.com/rushdarshan/trimr&lt;/a&gt;&lt;br&gt;&lt;br&gt;
&lt;strong&gt;PyPI&lt;/strong&gt;: &lt;a href="https://pypi.org/project/trimr/" rel="noopener noreferrer"&gt;https://pypi.org/project/trimr/&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Built because token budgets matter and most people have no idea what they're spending at startup.&lt;/p&gt;

</description>
      <category>ai</category>
      <category>devops</category>
      <category>cli</category>
      <category>python</category>
    </item>
  </channel>
</rss>
