<?xml version="1.0" encoding="UTF-8"?><feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en"><title>Chemaclass - agentic-coding</title><subtitle>Tech Lead sharing practical insights on software craftsmanship, TDD, leadership, Bitcoin, and AI. Blog posts, book summaries, and conference talks.</subtitle><link rel="self" type="application/atom+xml" href="https://chemaclass.com/tags/agentic-coding/atom.xml"/><link rel="alternate" type="text/html" href="https://chemaclass.com"/><generator uri="https://www.getzola.org/">Zola</generator><updated>2026-06-26T00:00:00+00:00</updated><id>https://chemaclass.com/tags/agentic-coding/atom.xml</id><entry xml:lang="en"><title>Cut the Token Bill on Both Ends</title><subtitle>Two leaks, two patches</subtitle><category term="ai" scheme="https://chemaclass.com/tags/ai/" label="Ai"/><category term="productivity" scheme="https://chemaclass.com/tags/productivity/" label="Productivity"/><category term="developer-tools" scheme="https://chemaclass.com/tags/developer-tools/" label="Developer Tools"/><category term="agentic-coding" scheme="https://chemaclass.com/tags/agentic-coding/" label="Agentic Coding"/><published>2026-06-26T00:00:00+00:00</published><updated>2026-06-26T00:00:00+00:00</updated><author><name>
Chemaclass</name></author><link rel="alternate" type="text/html" href="https://chemaclass.com/blog/cut-the-token-bill-on-both-ends/"/><id>https://chemaclass.com/blog/cut-the-token-bill-on-both-ends/</id><summary type="html">Two small tools that compound: Caveman shrinks what the agent says back, RTK shrinks what your terminal pipes in. More room in the same context window, same model, same prompts.</summary><content type="html">&lt;p>Every agentic session burns tokens in two directions at once. The agent talks back to you, and the terminal pipes its output in. Both flow through the same context window, and both of them leak.&lt;/p>
&lt;p>Run a session long enough and you hit the wall. The answers get worse and the bill climbs.&lt;/p>
&lt;span id="continue-reading">&lt;/span>
&lt;blockquote>
&lt;p>Same model. Same prompts. Lighter bill.&lt;/p>
&lt;/blockquote>
&lt;p>Open any session transcript and the biggest blocks aren’t your prompts:&lt;/p>
&lt;ul>
&lt;li>Agent responses: small talk, hedging, repetition, “Sure! Happy to help…”.&lt;/li>
&lt;li>Tool output: &lt;code>npm install&lt;/code> logs, &lt;code>git status&lt;/code> walls of text, &lt;code>grep&lt;/code> dumps with full file paths.&lt;/li>
&lt;/ul>
&lt;p>The two tools below each go after one of those. Caveman handles what the agent says back. RTK handles what the shell sends in.&lt;/p>
&lt;h2 id="caveman-trims-the-output">Caveman trims the output
&lt;a class="heading-anchor" href="#caveman-trims-the-output" title="Copy link" aria-label="Link to this section">#&lt;/a>
&lt;/h2>
&lt;p>&lt;strong>&lt;a rel="external" href="https://github.com/JuliusBrussee/caveman">Caveman&lt;/a>&lt;/strong> is an Agent Skill. Run &lt;code>/caveman full&lt;/code> once and the agent stops padding its replies: no articles, no filler, no small talk. Fragments are fine, and the technical terms stay exact.&lt;/p>
&lt;p>Install:&lt;/p>
&lt;pre class="giallo" style="color-scheme: light dark; color: light-dark(#24292E, #E1E4E8); background-color: light-dark(#FFFFFF, #24292E);">&lt;code data-lang="shellscript">&lt;span class="giallo-l">&lt;span style="color: light-dark(#6F42C1, #B392F0);">curl&lt;/span>&lt;span style="color: light-dark(#005CC5, #79B8FF);"> -&lt;/span>&lt;span style="color: light-dark(#005CC5, #79B8FF);">fsSL&lt;/span>&lt;span style="color: light-dark(#032F62, #9ECBFF);"> https://raw.githubusercontent.com/JuliusBrussee/caveman/main/install.sh&lt;/span>&lt;span style="color: light-dark(#D73A49, #F97583);"> |&lt;/span>&lt;span style="color: light-dark(#6F42C1, #B392F0);"> bash&lt;/span>&lt;/span>&lt;/code>&lt;/pre>
&lt;p>What dies:&lt;/p>
&lt;ul>
&lt;li>Articles: a, an, the.&lt;/li>
&lt;li>Fillers: just, really, basically, actually, simply.&lt;/li>
&lt;li>Small talk: sure, of course, happy to.&lt;/li>
&lt;li>Hedging: might, perhaps, it depends.&lt;/li>
&lt;/ul>
&lt;p>What stays:&lt;/p>
&lt;ul>
&lt;li>Code blocks, exact errors, file paths, commands.&lt;/li>
&lt;li>Security warnings and destructive ops (skill auto-clarifies).&lt;/li>
&lt;/ul>
&lt;details class="deep-dive">
&lt;summary class="deep-dive__header">
&lt;span class="deep-dive__icon">&lt;/span>
&lt;span class="deep-dive__title">Deep Dive: Before and after&lt;/span>
&lt;/summary>
&lt;div class="deep-dive__content">
&lt;p>Normal mode:&lt;/p>
&lt;blockquote>
&lt;p>Sure! I’d be happy to help you with that. The issue you’re experiencing is likely caused by an off-by-one error in your token expiry check. The middleware compares the current time using &lt;code>&amp;lt;&lt;/code> when it should really be using &lt;code>&amp;lt;=&lt;/code>. Here’s the fix:&lt;/p>
&lt;/blockquote>
&lt;p>Caveman mode:&lt;/p>
&lt;blockquote>
&lt;p>Bug in auth middleware. Token expiry check use &lt;code>&amp;lt;&lt;/code> not &lt;code>&amp;lt;=&lt;/code>. Fix:&lt;/p>
&lt;/blockquote>
&lt;p>Same fix, and the code block that follows is identical. All that shrank is the prose around it, down to about a quarter.&lt;/p>
&lt;/div>
&lt;/details>
&lt;p>There are three levels: &lt;code>lite&lt;/code>, &lt;code>full&lt;/code>, and &lt;code>ultra&lt;/code>. Start at &lt;code>full&lt;/code>, since &lt;code>ultra&lt;/code> reads like a telegram. If an answer ever lands too terse for you, type &lt;code>normal mode&lt;/code> and it backs off.&lt;/p>
&lt;blockquote>
&lt;p>The agent doesn’t lose intelligence when you take away its small talk.&lt;/p>
&lt;/blockquote>
&lt;h2 id="rtk-trims-the-input">RTK trims the input
&lt;a class="heading-anchor" href="#rtk-trims-the-input" title="Copy link" aria-label="Link to this section">#&lt;/a>
&lt;/h2>
&lt;p>&lt;strong>&lt;a rel="external" href="https://github.com/rtk-ai/rtk">RTK&lt;/a>&lt;/strong> (Rust Token Killer) wraps the commands your agent runs. A hook rewrites &lt;code>git status&lt;/code> into &lt;code>rtk git status&lt;/code> behind the scenes, so there’s nothing extra to type and no overhead to notice.&lt;/p>
&lt;p>Install:&lt;/p>
&lt;pre class="giallo" style="color-scheme: light dark; color: light-dark(#24292E, #E1E4E8); background-color: light-dark(#FFFFFF, #24292E);">&lt;code data-lang="shellscript">&lt;span class="giallo-l">&lt;span style="color: light-dark(#6F42C1, #B392F0);">brew&lt;/span>&lt;span style="color: light-dark(#032F62, #9ECBFF);"> install&lt;/span>&lt;span style="color: light-dark(#032F62, #9ECBFF);"> rtk&lt;/span>&lt;/span>
&lt;span class="giallo-l">&lt;span style="color: light-dark(#6F42C1, #B392F0);">rtk&lt;/span>&lt;span style="color: light-dark(#032F62, #9ECBFF);"> init&lt;/span>&lt;span style="color: light-dark(#005CC5, #79B8FF);"> -&lt;/span>&lt;span style="color: light-dark(#005CC5, #79B8FF);">g&lt;/span>&lt;span style="color: light-dark(#6A737D, #6A737D);"> #&lt;/span>&lt;span style="color: light-dark(#6A737D, #6A737D);"> install the hook that auto-rewrites commands&lt;/span>&lt;/span>&lt;/code>&lt;/pre>
&lt;p>If &lt;code>rtk gain&lt;/code> later errors, a different tool with the same name slipped in; install from the &lt;a rel="external" href="https://github.com/rtk-ai/rtk">repo&lt;/a> instead.&lt;/p>
&lt;p>The wrapped version strips the noise before it ever reaches the agent: color codes, repeated separators, &lt;code>npm&lt;/code> install banners, verbose timestamps.&lt;/p>
&lt;p>Here’s the same &lt;code>git status&lt;/code>, raw and then wrapped:&lt;/p>
&lt;pre class="giallo" style="color-scheme: light dark; color: light-dark(#24292E, #E1E4E8); background-color: light-dark(#FFFFFF, #24292E);">&lt;code data-lang="plain">&lt;span class="giallo-l">&lt;span>$ rtk proxy git status&lt;/span>&lt;/span>
&lt;span class="giallo-l">&lt;span>On branch main&lt;/span>&lt;/span>
&lt;span class="giallo-l">&lt;span>Your branch is up to date with &amp;#39;origin/main&amp;#39;.&lt;/span>&lt;/span>
&lt;span class="giallo-l">&lt;/span>
&lt;span class="giallo-l">&lt;span>Untracked files:&lt;/span>&lt;/span>
&lt;span class="giallo-l">&lt;span> (use &amp;quot;git add &amp;lt;file&amp;gt;...&amp;quot; to include in what will be committed)&lt;/span>&lt;/span>
&lt;span class="giallo-l">&lt;span> content/blog/new-draft.md&lt;/span>&lt;/span>
&lt;span class="giallo-l">&lt;/span>
&lt;span class="giallo-l">&lt;span>nothing added to commit but untracked files present (use &amp;quot;git add&amp;quot; to track)&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;pre class="giallo" style="color-scheme: light dark; color: light-dark(#24292E, #E1E4E8); background-color: light-dark(#FFFFFF, #24292E);">&lt;code data-lang="plain">&lt;span class="giallo-l">&lt;span>$ rtk git status&lt;/span>&lt;/span>
&lt;span class="giallo-l">&lt;span>* main...origin/main&lt;/span>&lt;/span>
&lt;span class="giallo-l">&lt;span>? Untracked: 1 file&lt;/span>&lt;/span>
&lt;span class="giallo-l">&lt;span> content/blog/new-draft.md&lt;/span>&lt;/span>&lt;/code>&lt;/pre>
&lt;p>Same information in half the lines. On a busy repo the gap only grows, as dozens of untracked files, branch hints, and instruction lines all collapse into one small block.&lt;/p>
&lt;pre class="giallo" style="color-scheme: light dark; color: light-dark(#24292E, #E1E4E8); background-color: light-dark(#FFFFFF, #24292E);">&lt;code data-lang="shellscript">&lt;span class="giallo-l">&lt;span style="color: light-dark(#6F42C1, #B392F0);">rtk&lt;/span>&lt;span style="color: light-dark(#032F62, #9ECBFF);"> gain&lt;/span>&lt;span style="color: light-dark(#6A737D, #6A737D);"> #&lt;/span>&lt;span style="color: light-dark(#6A737D, #6A737D);"> see how many tokens it saved you&lt;/span>&lt;/span>
&lt;span class="giallo-l">&lt;span style="color: light-dark(#6F42C1, #B392F0);">rtk&lt;/span>&lt;span style="color: light-dark(#032F62, #9ECBFF);"> gain&lt;/span>&lt;span style="color: light-dark(#005CC5, #79B8FF);"> -&lt;/span>&lt;span style="color: light-dark(#005CC5, #79B8FF);">-history&lt;/span>&lt;span style="color: light-dark(#6A737D, #6A737D);"> #&lt;/span>&lt;span style="color: light-dark(#6A737D, #6A737D);"> per-command breakdown&lt;/span>&lt;/span>
&lt;span class="giallo-l">&lt;span style="color: light-dark(#6F42C1, #B392F0);">rtk&lt;/span>&lt;span style="color: light-dark(#032F62, #9ECBFF);"> discover&lt;/span>&lt;span style="color: light-dark(#6A737D, #6A737D);"> #&lt;/span>&lt;span style="color: light-dark(#6A737D, #6A737D);"> scan your agent history for missed wins&lt;/span>&lt;/span>&lt;/code>&lt;/pre>
&lt;p>RTK reports &lt;a rel="external" href="https://github.com/rtk-ai/rtk">60-90% fewer tokens&lt;/a> on common dev commands. Run &lt;code>rtk gain&lt;/code> after some real use to see your own number.&lt;/p>
&lt;p>It never touches the payload, only the noise around it, so errors and stack traces come through exactly as they are. If a filter ever eats something you actually need, bypass it for that one call with &lt;code>rtk proxy &amp;lt;cmd&amp;gt;&lt;/code>.&lt;/p>
&lt;blockquote>
&lt;p>Output you never read is still output the model has to read.&lt;/p>
&lt;/blockquote>
&lt;h2 id="why-the-combo-compounds">Why the combo compounds
&lt;a class="heading-anchor" href="#why-the-combo-compounds" title="Copy link" aria-label="Link to this section">#&lt;/a>
&lt;/h2>
&lt;p>On their own, each tool helps a little. Run them together and the effect compounds, because they hit different halves of the same loop. A turn goes like this: you prompt, the agent thinks, it runs a command, the terminal answers, the agent reads that, then it replies to you. RTK shrinks the terminal half and Caveman shrinks the reply, so every turn gets cheaper and you fit more of them in one window.&lt;/p>
&lt;p>Here’s the real check, on a $100/month plan. Before I added these, I hit the weekly usage cap all the time, sometimes from a single project. Now I run several projects in parallel and the cap rarely shows up. The plan didn’t get bigger; the sessions got smaller.&lt;/p>
&lt;h2 id="set-it-once-then-forget-it">Set it once, then forget it
&lt;a class="heading-anchor" href="#set-it-once-then-forget-it" title="Copy link" aria-label="Link to this section">#&lt;/a>
&lt;/h2>
&lt;p>Both installs are global, and you do them once. After that you keep typing &lt;code>git status&lt;/code>, &lt;code>grep&lt;/code>, and &lt;code>npm install&lt;/code> exactly as before. The hook rewrites them for you and Caveman kicks in on its own, so there are no new habits to learn.&lt;/p>
&lt;p>Not sure where to start? Pick whichever leak hurts more right now. If long replies on every little fix are the problem, start with Caveman. If it’s floods of &lt;code>grep&lt;/code> and &lt;code>npm install&lt;/code> output, start with RTK. Add the other one whenever you feel like it, since they don’t get in each other’s way.&lt;/p>
&lt;blockquote>
&lt;p>You didn’t upgrade the model. You stopped wasting its attention.&lt;/p>
&lt;/blockquote>
&lt;p>&lt;img src="/images/blog/2026-06-26/footer.webp" alt="blog-footer" />&lt;/p></content></entry></feed>