<?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: Samuel Cozannet</title>
    <description>The latest articles on DEV Community by Samuel Cozannet (@samnco).</description>
    <link>https://dev.to/samnco</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%2F4197421%2F654844ad-62a3-4c80-92aa-70ce5b4423b3.jpg</url>
      <title>DEV Community: Samuel Cozannet</title>
      <link>https://dev.to/samnco</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/samnco"/>
    <language>en</language>
    <item>
      <title>Your AI observability needs your agents' memory, not just their traces</title>
      <dc:creator>Samuel Cozannet</dc:creator>
      <pubDate>Thu, 05 Nov 2026 14:00:03 +0000</pubDate>
      <link>https://dev.to/cloudexmachina/your-ai-observability-needs-your-agents-memory-not-just-their-traces-4mf0</link>
      <guid>https://dev.to/cloudexmachina/your-ai-observability-needs-your-agents-memory-not-just-their-traces-4mf0</guid>
      <description>&lt;p&gt;&lt;em&gt;Originally published on the &lt;a href="https://blog.cloudexmachina.io/agent-memory-drift-token-cost?utm_source=devto&amp;amp;utm_medium=social&amp;amp;utm_campaign=agent-memory-drift-token-cost" rel="noopener noreferrer"&gt;Cloud ex Machina engineering blog&lt;/a&gt;.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;We run our AI coding agents on a fixed token budget, and we judge what it buys by outcomes, not output. A merged pull request is output. A customer problem solved, an incident closed or a question answered for good is an outcome. Spending tokens on outcomes starts with seeing where they go, so we built Tach, short for tachymeter, to measure it. Tach records our agents' traces, and it also collects their memory. Memory is where an agent keeps what it has learnt about us, our conventions, our codebase and our taste, and taste is what turns generic code into code we'd have written ourselves. But when we audited all 802 memories, 93 were workarounds for friction in our own tooling, and they were wasting tokens. They loaded into every session, a third of them pointed at problems already fixed, and the friction behind the rest kept costing retries. If you observe your agents, put their memory in your observability layer next to the traces.&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%2Fvv61fwpmnevg0xpujxvf.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%2Fvv61fwpmnevg0xpujxvf.png" alt="Workaround memories by layer: developer tooling 57 (19 fixed), data layer 14 (1 fixed), infrastructure 11 (6 fixed), product 11 (6 fixed). Side figures: 370k tokens spent loading workaround lines into one developer's sessions in 30 days, 32 of 93 workarounds outlived their problem, 97% of one guard script's 149 rejections were false alarms" width="800" height="418"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Outcomes, not pull requests
&lt;/h2&gt;

&lt;p&gt;Counting pull requests is the easy way to measure agents, and it rewards the wrong thing. An agent can open ten pull requests that move nothing and still look productive. What we want to know is what a session cost, what it delivered, and whether the same outcome could have cost less. That's what we mean by development tokenomics, a word the industry now has a &lt;a href="https://www.linuxfoundation.org/press/linux-foundation-launches-the-tokenomics-foundation-to-define-the-economics-and-roi-of-ai-value" rel="noopener noreferrer"&gt;foundation&lt;/a&gt; for, and it's the same idea as the &lt;a href="https://blog.cloudexmachina.io/ai-generated-code-cloud-cost-feedback-loop" rel="noopener noreferrer"&gt;cost feedback loop we use to steer agents in the cloud&lt;/a&gt;, turned on our own development.&lt;/p&gt;

&lt;p&gt;That accounting needs instruments, and Tach is the tachymeter for our development loops and our software factory, built on &lt;a href="https://posthog.com" rel="noopener noreferrer"&gt;PostHog&lt;/a&gt; with a custom layer on top. PostHog stores the session events: model calls, tool calls, tokens, and the work each session belongs to. Our layer stores and analyses what PostHog wasn't built for, such as memories, and runs higher-level analysis on all of it with agents we fully control.&lt;/p&gt;

&lt;h2&gt;
  
  
  Memory steers every session
&lt;/h2&gt;

&lt;p&gt;A session doesn't start empty. Before the agent reads the task, Claude Code loads its instruction files and the index of its memory, &lt;code&gt;MEMORY.md&lt;/code&gt;. Only the &lt;a href="https://code.claude.com/docs/en/memory" rel="noopener noreferrer"&gt;first 200 lines or 25 KB of that index load, whichever comes first&lt;/a&gt;, and anything past that point is left out. The memories themselves sit in topic files that the agent opens only when an index line looks relevant to the task. On my machine, the index is 108 lines and costs 7.9k tokens at the start of every session, whatever the task.&lt;/p&gt;

&lt;p&gt;Agents like Claude Code manage this memory on their own. When something surprises them, they write a note and add a line to the index, so the next session doesn't pay to learn it again. When the note is right, that's a real saving. But a memory also creates behaviour. A line that says "never run X, run Y instead" changes what every later session does, and nothing prompts anyone to review it.&lt;/p&gt;

&lt;p&gt;They're not good at the upkeep yet. They add notes freely and rarely go back to check whether one is still true. Our own harness runs a hook that sends each developer's memories to Tach on a regular schedule, which is how we could look at all of them at once. If your team uses Claude Code or any agent with persistent memory, take a look at yours.&lt;/p&gt;

&lt;h2&gt;
  
  
  93 memories were workarounds, and workarounds waste tokens
&lt;/h2&gt;

&lt;p&gt;Tach keeps the memories of every developer's agents in one place, so we can manage and maintain them like any other part of the codebase. Our audit had a model sort each memory by what it's for, with the evidence next to it, and we checked a sample of its calls by hand. Most were knowledge worth keeping, but 93 of the 802 were workarounds. In each one, an agent got past a problem and told only itself how.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Where the friction was&lt;/th&gt;
&lt;th&gt;Workaround memories&lt;/th&gt;
&lt;th&gt;Share&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Developer tooling (scripts, hooks, CLIs, local stack)&lt;/td&gt;
&lt;td&gt;57&lt;/td&gt;
&lt;td&gt;61%&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Data layer&lt;/td&gt;
&lt;td&gt;14&lt;/td&gt;
&lt;td&gt;15%&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Infrastructure&lt;/td&gt;
&lt;td&gt;11&lt;/td&gt;
&lt;td&gt;12%&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Product&lt;/td&gt;
&lt;td&gt;11&lt;/td&gt;
&lt;td&gt;12%&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Most of the friction sits in developer tooling, where agents spend their day. Our &lt;a href="https://blog.cloudexmachina.io/agents-filed-bug-reports-to-themselves" rel="noopener noreferrer"&gt;previous post&lt;/a&gt; covered seven of these, about a third-party tool. Here's one of ours. We wrote a guard script so that agents never commit with &lt;code&gt;--no-verify&lt;/code&gt;. It read flags from the whole shell line, so &lt;code&gt;git log -n 5 &amp;amp;&amp;amp; git commit -m 'fix'&lt;/code&gt; was rejected as a &lt;code&gt;--no-verify&lt;/code&gt; commit, because of the &lt;code&gt;-n&lt;/code&gt; that belonged to &lt;code&gt;git log&lt;/code&gt;. The agent's memory recorded the fix that worked for it, run the commit as its own command, and moved on.&lt;/p&gt;

&lt;p&gt;The memory told us where to look, and Tach's traces let us put a number on it. In a 30-day sample of 264,714 agent tool calls, the guard rejected a command 149 times, and 144 of those rejections were false alarms. They hit 108 sessions across five of our six developers, and 21 of those sessions hit it more than once. The failed calls and their retries cost about 147,000 output tokens. Each retry also re-reads the session's context. At the size of a fresh session on my machine, 65k tokens, we estimate another 9 million input tokens, mostly prompt-cache reads billed at a tenth of the normal price. All of it bought nothing, because the commit was fine the first time.&lt;/p&gt;

&lt;p&gt;A workaround like this gets paid for four times. The agent pays once to find the detour, and every later session pays to load it. The friction stays in place for the next person or agent without that memory. And the line takes room in an index capped at 200 lines, room a useful memory could have had. Proper engineering means finding the root cause and fixing it for good, and a workaround memory hides the root cause from everyone except the agent that wrote it.&lt;/p&gt;

&lt;p&gt;We tried to put a token figure on each workaround. Tach sees every file an agent opens, and in the same 30 days our agents opened a workaround memory file only six times. Reading them costs next to nothing, so the waste sits in the index line that loads every session, and in the friction the workaround leaves in place. On my machine, the 31 index lines that point at workarounds cost about 1,200 tokens per session, 15% of the index. My agents ran 304 sessions in the sample, so about 370,000 tokens went to loading workarounds on one machine alone. The friction is harder to price memory by memory, because only some failures leave a signature in the tool calls, the way the guard's rejection message does.&lt;/p&gt;

&lt;h2&gt;
  
  
  Context rot nobody was monitoring
&lt;/h2&gt;

&lt;p&gt;When we checked the 93 against today's code, a third of the underlying problems had already been fixed, by a person or by an agent working on something else. None of those fixes touched the memory. Tian Pan calls this the moment &lt;a href="https://tianpan.co/blog/2026/05/17/agent-memorized-bug-stale-workaround" rel="noopener noreferrer"&gt;a fix becomes a memory-invalidation event&lt;/a&gt;, and in our data nobody had invalidated anything. On my machine, seven index lines pointed at problems that no longer existed. One told every session that an environment variable breaks four tests in a pre-push hook, and to drop it before pushing. The tests had been fixed weeks before, and every session since had loaded the warning anyway.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;A stale memory is the most misleading line in the index.&lt;/strong&gt; It costs tokens in every session like any other line, but it grounds the agent in a codebase that no longer exists, steering it away from a path that now works. It takes index room from a memory that's still true, and whatever sits past the cap never loads. It also spreads, because a later agent can read it as a rule and copy it into a shared skill.&lt;/p&gt;

&lt;p&gt;Anthropic's &lt;code&gt;consolidate-memory&lt;/code&gt; skill, available in the Claude app, merges duplicates, prunes stale entries and tightens the index, so we ran it once on my memories. It retired or merged 6 of 192 files, edited 9 and repaired 23 broken links. It checked notes about finished projects against the repo and Linear, and it retired one workaround after checking that its bugs were gone from the code. The other six workarounds for problems already fixed stayed, including the pre-push warning. In that run, the skill verified the notes that describe work, and kept the notes that tell the agent how to behave as rules. Some tools already go further: &lt;a href="https://docs.github.com/en/copilot/concepts/agents/copilot-memory" rel="noopener noreferrer"&gt;GitHub Copilot Memory&lt;/a&gt; stores a citation with each memory and checks it against the current branch before using it.&lt;/p&gt;

&lt;p&gt;It also only runs when someone remembers to run it, on one machine at a time, and it can't see the rest of the team. Our most common lesson was saved on its own by the agents of four of our six developers. A lesson that four machines load belongs on all six, and private memory is the wrong place for it. Once a memory is shared knowledge, it should move into the project's context, the instruction files every agent loads, and leave the private memories it came from.&lt;/p&gt;

&lt;h2&gt;
  
  
  Monitoring the steering
&lt;/h2&gt;

&lt;p&gt;Tach has collected agent memories from the start, but we built that feature to answer a positive question: which memories should a developer share with the rest of the team? Making local memories converge into a team memory is still the right goal, and the audit showed it isn't enough, because memory creates behaviour, good or bad, and that behaviour is what we have to monitor. So that's the loop we're building into Tach. Every new or changed memory gets checked against the code and Linear. A workaround points to a root cause, and the root cause gets a ticket. Knowledge that several people's agents reached on their own becomes a shared rule or an automated check, and a person approves each change. When a fix merges, the memories that worked around it change with it. Traces show what your agents did. Memory shows what they've been told to do next time. If you observe one, observe the other.&lt;/p&gt;

</description>
      <category>ai</category>
      <category>claude</category>
      <category>devops</category>
      <category>productivity</category>
    </item>
    <item>
      <title>Our agents filed seven bug reports. They sent them to themselves.</title>
      <dc:creator>Samuel Cozannet</dc:creator>
      <pubDate>Thu, 29 Oct 2026 07:00:02 +0000</pubDate>
      <link>https://dev.to/cloudexmachina/our-agents-filed-seven-bug-reports-they-sent-them-to-themselves-1c4f</link>
      <guid>https://dev.to/cloudexmachina/our-agents-filed-seven-bug-reports-they-sent-them-to-themselves-1c4f</guid>
      <description>&lt;p&gt;&lt;em&gt;Originally published on the &lt;a href="https://blog.cloudexmachina.io/agents-filed-bug-reports-to-themselves?utm_source=devto&amp;amp;utm_medium=social&amp;amp;utm_campaign=agents-filed-bug-reports-to-themselves" rel="noopener noreferrer"&gt;Cloud ex Machina engineering blog&lt;/a&gt;.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://www.rtk-ai.app/" rel="noopener noreferrer"&gt;rtk&lt;/a&gt; is one of the tools we'd least like to give up. It sits between our coding agents and the shell and trims command output before the agent reads it, and on one laptop alone it has kept 6.7 million tokens out of agent context. This week we read every note our agents had saved for themselves, all 802 of them, and seven described rtk quietly mangling their output. Every one ended with the same workaround, and none of them had reached a person. By the time we read them, the fix had been public for 47 days. We upgraded the next morning.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why we run rtk on every shell command
&lt;/h2&gt;

&lt;p&gt;AI coding agents live in the shell, ours included, and every line of output they read lands in the model's context and stays there until the session ends or gets compacted. Most of it is noise, like the hundreds of lines a passing test suite prints when the agent needs one.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://github.com/rtk-ai/rtk" rel="noopener noreferrer"&gt;rtk&lt;/a&gt; is an open-source proxy, written in Rust, that cuts that noise. A Claude Code hook rewrites &lt;code&gt;git diff&lt;/code&gt; into &lt;code&gt;rtk git diff&lt;/code&gt;, and rtk runs the real command and returns a version filtered for that tool, so test runs come back as their failures and git output comes back compacted, with nothing extra for the agent to do.&lt;/p&gt;

&lt;p&gt;On the author's laptop alone, rtk has kept 6.7 million tokens out of agent context, 13.8% of everything the commands it handled printed. We'd install it again tomorrow.&lt;/p&gt;

&lt;p&gt;So this isn't a post about a bad tool. Compressing output is the right trade when the agent only reads it, and it goes wrong when the output feeds something else, like a patch file, a count, or another agent, which is where our story starts.&lt;/p&gt;

&lt;h2&gt;
  
  
  Seven agent memories, one workaround
&lt;/h2&gt;

&lt;p&gt;Our agents keep private notes between sessions, so that a lesson learned on Monday is still there on Tuesday. When we triaged all 802 of them, seven came from the agents of two developers and described rtk failures.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Date&lt;/th&gt;
&lt;th&gt;What the agent recorded&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Aug 12&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;gh pr edit&lt;/code&gt; and &lt;code&gt;gh pr comment&lt;/code&gt; lose their subcommand, so gh prints its usage instead&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Aug 28&lt;/td&gt;
&lt;td&gt;Search flags get mangled, and a commit reports success but creates nothing&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Sep 18&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;git diff &amp;gt; patch.diff&lt;/code&gt; writes a summary instead of a patch, so &lt;code&gt;git apply&lt;/code&gt; refuses it&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Sep 23&lt;/td&gt;
&lt;td&gt;A search returns zero hits for a pattern that matches&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Sep 28&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;git log --format='%s' &amp;gt; file&lt;/code&gt; drops most of the subjects&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Sep 28&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;gh pr diff N &amp;gt; file&lt;/code&gt; drops about half of the diff&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Sep 29&lt;/td&gt;
&lt;td&gt;A lint run reports exit 2 although the lint passed&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Each memory ends by telling the agent to run the command through &lt;code&gt;rtk proxy&lt;/code&gt;, which skips the filter, so each agent found the bug, found a way around it, and wrote both down in a memory file that only that developer's agents load, where none of us would think to look.&lt;/p&gt;

&lt;p&gt;One of these failures reached a release note. Our deployment agent writes the note from the commit subjects of the release. For the October 7 release, the first version of the note listed fewer than half of the pull requests that shipped, and a person spotted the gap and fixed it 44 minutes after the deploy. The code that shipped was right, and only its internal description was wrong. Still, no command had failed, and nothing had warned anyone.&lt;/p&gt;

&lt;p&gt;Our reviews held up better. The review skill fetches each pull request's diff inside a script, and the hook only rewrites commands an agent types itself. The truncated diff in the September 28 memory came from an agent that fetched one by hand.&lt;/p&gt;

&lt;p&gt;The workaround also turned into a habit, and a busy one. In a sample of 206,965 shell commands we pulled for this post, 7,128 went through &lt;code&gt;rtk proxy&lt;/code&gt;. Agents of five of our six developers do it, and in the same sample only 33 of 5,952 failed shell commands mention rtk, because a failure that doesn't look like an error doesn't get looked at.&lt;/p&gt;

&lt;p&gt;In other words, our agents had built a workflow around the bug.&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%2Feyezwwxjl6r421rbn859.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%2Feyezwwxjl6r421rbn859.png" alt="xkcd 1172, Workflow: an update fixes the CPU heating up when the space bar is held, and a user complains that this was their workflow" width="278" height="386"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;&lt;a href="https://xkcd.com/1172/" rel="noopener noreferrer"&gt;xkcd 1172: Workflow&lt;/a&gt; by Randall Munroe, &lt;a href="https://creativecommons.org/licenses/by-nc/2.5/" rel="noopener noreferrer"&gt;CC BY-NC 2.5&lt;/a&gt;.&lt;/em&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Reproducing it
&lt;/h2&gt;

&lt;p&gt;A memory is only the agent's own account, so on October 28 we re-ran the commands on the setup the agents had, rtk 0.37.2 and our hook script.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Command, output written to a file&lt;/th&gt;
&lt;th&gt;Through the hook&lt;/th&gt;
&lt;th&gt;Unfiltered&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;
&lt;code&gt;gh pr diff&lt;/code&gt; on a 25-file PR&lt;/td&gt;
&lt;td&gt;23,379 chars, 0 file headers&lt;/td&gt;
&lt;td&gt;58,840 chars, 25 file headers&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
&lt;code&gt;git log --format='%s'&lt;/code&gt; over a long commit range&lt;/td&gt;
&lt;td&gt;1% of the subjects&lt;/td&gt;
&lt;td&gt;All of them&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
&lt;code&gt;git diff&lt;/code&gt; over 20 commits&lt;/td&gt;
&lt;td&gt;580 lines, 0 file headers&lt;/td&gt;
&lt;td&gt;2,485 lines, 62 file headers&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Two memories didn't reproduce, the empty searches and a push failure whose cause went missing, so we left them out.&lt;/p&gt;

&lt;h2&gt;
  
  
  Upstream had already fixed it
&lt;/h2&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%2Fqb4mv6ietug09c6qhxn3.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%2Fqb4mv6ietug09c6qhxn3.png" alt="Timeline: upstream rtk fixed redirected output on September 11, five of seven agent memories came after that, and we upgraded on October 28" width="800" height="418"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;We were on rtk 0.37.2, released April 20, and the latest release when we checked was 1.1.0, from October 25. Our hook was older still, installed in February when rtk's hook was a shell script that did its own command matching. Current rtk ships a &lt;code&gt;rtk rewrite&lt;/code&gt; command that decides which commands are safe to rewrite, but upgrading the binary doesn't replace a hook that's already installed, so our old script never called it. Neither side noticed. &lt;code&gt;rtk init --show&lt;/code&gt; printed &lt;code&gt;[ok] Hook: rtk hook claude (native binary command)&lt;/code&gt; while our settings still ran the February script.&lt;/p&gt;

&lt;p&gt;On 1.1.0, &lt;code&gt;rtk rewrite&lt;/code&gt; leaves alone every command we tested whose output goes to a file or into &lt;code&gt;wc&lt;/code&gt; or &lt;code&gt;head&lt;/code&gt;. The changelog puts that work in 0.49.0, on September 11, and five of the seven memories are from after that date.&lt;/p&gt;

&lt;p&gt;One rough edge remained in 1.1.0 when we checked. When an agent reads &lt;code&gt;gh pr diff&lt;/code&gt; directly, it sees 14 of the 25 files, and the output ends with &lt;code&gt;... (more changes truncated)&lt;/code&gt; and a hint to run &lt;code&gt;rtk git diff --no-compact&lt;/code&gt;. That hint names the wrong command. In a clean checkout it prints nothing, so an agent that follows it decides there's nothing else to see, while &lt;code&gt;rtk gh pr diff --no-compact&lt;/code&gt; prints all 25 files. The same wrong hint on &lt;code&gt;git show&lt;/code&gt; is open as &lt;a href="https://github.com/rtk-ai/rtk/issues/4817" rel="noopener noreferrer"&gt;rtk#4817&lt;/a&gt;, and both commands share the code that prints it. Related open issues cover &lt;a href="https://github.com/rtk-ai/rtk/issues/3257" rel="noopener noreferrer"&gt;silent loss on large diffs&lt;/a&gt;, &lt;a href="https://github.com/rtk-ai/rtk/issues/3492" rel="noopener noreferrer"&gt;swallowed exit codes&lt;/a&gt; and &lt;a href="https://github.com/rtk-ai/rtk/issues/4364" rel="noopener noreferrer"&gt;rewritten pipe producers&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why coding agents don't report bugs
&lt;/h2&gt;

&lt;p&gt;rtk had bugs, and its maintainers fixed most of them while we weren't looking. For 47 days the fix was public and our agents held the evidence that we needed it, and the two never met.&lt;/p&gt;

&lt;p&gt;A developer who hits the same tool failure twice gets annoyed, and annoyance is what makes people check for an update or file an issue. An agent doesn't get annoyed. Its job ends with the task, so it writes down the workaround and moves on, and since the workaround works, nobody looks again. Seven agent sessions knew about the bug and none of us did, until we sat down and read what they had written. That reading is the part we're keeping.&lt;/p&gt;

&lt;h2&gt;
  
  
  What we're changing
&lt;/h2&gt;

&lt;p&gt;Anything a machine reads, like a patch or a diff we hand to a review agent, now goes through &lt;code&gt;rtk proxy&lt;/code&gt; or a script the hook can't reach.&lt;/p&gt;

&lt;p&gt;We upgraded to rtk 1.1.0 and regenerated the hook with &lt;code&gt;rtk init -g&lt;/code&gt;, and the &lt;code&gt;git log&lt;/code&gt; that kept 1% of the subjects now keeps all of them. We also pinned rtk, so it now gets updated with our other dependencies, hook included. It sees every shell command our agents run, which is reason enough to give it the same care as anything in our lockfile. We'd been treating it as part of the furniture.&lt;/p&gt;

&lt;p&gt;The bigger change is that a workaround in a memory now counts as a bug report, and the weekly memory review we're building will send each one to a ticket rather than to an instruction file. rtk was the easy case, because its maintainers had already done the fixing and all we had to do was upgrade. Across all 802 memories, 93 (12%) record a workaround for a defect, and most of those defects live in our own code and tools, where nobody upstream is going to fix anything for us. Those are the subject of our next post.&lt;/p&gt;

</description>
      <category>ai</category>
      <category>claude</category>
      <category>devops</category>
      <category>productivity</category>
    </item>
    <item>
      <title>Your AI writes code blind to cloud cost. Here's how to close the loop.</title>
      <dc:creator>Samuel Cozannet</dc:creator>
      <pubDate>Thu, 22 Oct 2026 07:00:02 +0000</pubDate>
      <link>https://dev.to/cloudexmachina/your-ai-writes-code-blind-to-cloud-cost-heres-how-to-close-the-loop-4di1</link>
      <guid>https://dev.to/cloudexmachina/your-ai-writes-code-blind-to-cloud-cost-heres-how-to-close-the-loop-4di1</guid>
      <description>&lt;p&gt;&lt;em&gt;Originally published on the &lt;a href="https://blog.cloudexmachina.io/ai-generated-code-cloud-cost-feedback-loop?utm_source=devto&amp;amp;utm_medium=crosspost&amp;amp;utm_campaign=blog-b1" rel="noopener noreferrer"&gt;Cloud ex Machina blog&lt;/a&gt;.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Most teams I talk to are shipping more code than ever, and a growing share of it is written by AI coding agents like Claude. A human reviews it, it gets merged, and it goes to production. It works, and it passes the tests.&lt;/p&gt;

&lt;p&gt;Then nobody looks at what it costs to run: in the cloud, and in all the dev tooling around it.&lt;/p&gt;

&lt;p&gt;Engineers care about this. Nothing in the workflow tells them, though. The agent that wrote the change never finds out it doubled the reads on a database, or that a config it touched now gets polled a million times an hour. So the next change gets written the same way, just as blind.&lt;/p&gt;

&lt;p&gt;That gap is what this post is about, the cloud cost of AI-generated code: it ships, and nothing about how it behaves in production makes it back to whoever writes the next change, human or agent.&lt;/p&gt;

&lt;p&gt;And the cloud bill is only part of it. The same code also drives the bill for the tooling around it: CI minutes on every push, APM and observability priced per host, per span or per gigabyte ingested, log pipelines, error tracking. For many teams, that tooling is a very significant share of what it costs to operate software, and it's even less visible to whoever writes the code.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why cloud cost never reaches the code
&lt;/h2&gt;

&lt;p&gt;Think about how every other quality signal reaches the people writing code. A test fails, and the PR is blocked. Latency spikes, and someone gets paged with a trace pointing at the guilty endpoint. The signal arrives fast, and it arrives where the code lives.&lt;/p&gt;

&lt;p&gt;Cost doesn't work like that. It shows up weeks later as a few numbers on a few invoices, from the cloud provider, the CI platform and the APM vendor, each rolled up its own way. By the time anyone asks why the database bill or the observability bill went up, the change that caused it is three sprints old. If a person wrote it, they've moved on. If an agent wrote it, it has no memory of it at all.&lt;/p&gt;

&lt;p&gt;So the loop that should exist stops halfway. We write, we ship, we run, we even measure. We just never feed what we measured back into the next round of writing.&lt;/p&gt;

&lt;h2&gt;
  
  
  Coding agents see the code, cost tools see the bill
&lt;/h2&gt;

&lt;p&gt;The odd part is that the information already exists. It just lives in two places that never talk to each other.&lt;/p&gt;

&lt;p&gt;Your coding agent sees the code. It can read the whole repo, follow a call graph and explain why a function exists. What it can't see is that this function runs forty million times a day, and that every call hits a paid API.&lt;/p&gt;

&lt;p&gt;Your FinOps and cost tools see the bill. They can tell you that a service's Secrets Manager line tripled last quarter, or that one Aurora cluster is now your third-largest line item. What they can't tell you is which line of code is responsible, or what the fix looks like.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;The bill without the code is a report. The code without the bill is a guess.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Neither side fixes the problem alone. A cost report hands engineers a ticket with no idea where to start. A coding agent asked to "reduce costs" optimizes whatever looks expensive to read, which is rarely what's expensive to run.&lt;/p&gt;

&lt;h2&gt;
  
  
  Real examples: Secrets Manager, AppConfig and Aurora
&lt;/h2&gt;

&lt;p&gt;The patterns we keep finding are almost boring, which is exactly why they survive. They're small and everywhere, and they only show up when you put the code and the bill side by side. Every figure below comes from the accounts' own AWS billing data.&lt;/p&gt;

&lt;h3&gt;
  
  
  Secrets Manager called on every request
&lt;/h3&gt;

&lt;p&gt;A Lambda handler or a request path calls Secrets Manager each time it needs a credential, instead of once. &lt;a href="https://aws.amazon.com/secrets-manager/pricing/" rel="noopener noreferrer"&gt;Secrets Manager charges per API call&lt;/a&gt;, so the cost follows traffic one for one. Across the teams we work with it's usually a five-figure line per year, and about five lines to fix.&lt;/p&gt;

&lt;p&gt;Before:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;json&lt;/span&gt;
&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;boto3&lt;/span&gt;

&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;handler&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;event&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;context&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
    &lt;span class="n"&gt;client&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;boto3&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;client&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;secretsmanager&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="n"&gt;secret&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;client&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get_secret_value&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;SecretId&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;prod/db&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="n"&gt;creds&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;json&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;loads&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;secret&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;SecretString&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;])&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nf"&gt;run_query&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;creds&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;event&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;After:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;json&lt;/span&gt;
&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;boto3&lt;/span&gt;

&lt;span class="n"&gt;_client&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;boto3&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;client&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;secretsmanager&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="n"&gt;_creds&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="bp"&gt;None&lt;/span&gt;

&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;get_creds&lt;/span&gt;&lt;span class="p"&gt;():&lt;/span&gt;
    &lt;span class="k"&gt;global&lt;/span&gt; &lt;span class="n"&gt;_creds&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;_creds&lt;/span&gt; &lt;span class="ow"&gt;is&lt;/span&gt; &lt;span class="bp"&gt;None&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="n"&gt;secret&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;_client&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get_secret_value&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;SecretId&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;prod/db&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="n"&gt;_creds&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;json&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;loads&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;secret&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;SecretString&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;])&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;_creds&lt;/span&gt;

&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;handler&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;event&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;context&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nf"&gt;run_query&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nf"&gt;get_creds&lt;/span&gt;&lt;span class="p"&gt;(),&lt;/span&gt; &lt;span class="n"&gt;event&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In production you'd add a TTL so rotated secrets get picked up, or use &lt;a href="https://github.com/aws/aws-secretsmanager-caching-python" rel="noopener noreferrer"&gt;AWS's caching library for Python&lt;/a&gt;. Either way, the cost curve stops tracking your traffic.&lt;/p&gt;

&lt;h3&gt;
  
  
  AppConfig costs: every poll billed as a full delivery
&lt;/h3&gt;

&lt;p&gt;AppConfig bills two things at very different rates. Asking "has anything changed?" costs &lt;a href="https://aws.amazon.com/systems-manager/pricing/" rel="noopener noreferrer"&gt;$0.0000002 per request&lt;/a&gt;. Receiving the configuration itself costs $0.0008, about 4,000 times more. The intended pattern is that every call to &lt;a href="https://docs.aws.amazon.com/appconfig/2019-10-09/APIReference/API_appconfigdata_GetLatestConfiguration.html" rel="noopener noreferrer"&gt;&lt;code&gt;GetLatestConfiguration&lt;/code&gt;&lt;/a&gt; returns a fresh &lt;code&gt;NextPollConfigurationToken&lt;/code&gt;, and the client sends it back on the next poll. AppConfig then answers "nothing new" for almost nothing, and only bills a delivery when the configuration actually changes.&lt;/p&gt;

&lt;p&gt;At a US fintech, a few services didn't carry that token forward. So AppConfig delivered, and billed, the full configuration on every single poll. Two million polls a month became two million paid deliveries, for configurations that changed a handful of times. Other services in the same accounts handled the token correctly and cost almost nothing.&lt;/p&gt;

&lt;p&gt;The fix was six lines of code: keep the token and send it back. The AppConfig bill dropped by over 99%, about $20k a year. If changing the client isn't practical, the &lt;a href="https://docs.aws.amazon.com/appconfig/latest/userguide/appconfig-integration-containers-agent.html" rel="noopener noreferrer"&gt;AppConfig Agent&lt;/a&gt; manages the token for you.&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%2F7wm98tetrtjkllr7uhjh.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%2F7wm98tetrtjkllr7uhjh.png" alt="Monthly Systems Manager spend at a US fintech, from about $1,600 to under $10 after the AppConfig fix" width="790" height="457"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Monthly Systems Manager spend, where AppConfig is billed. The fix rolled out over two weeks at the end of August; October is a partial month.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Cost tools read all of this as normal usage. The only tell is a ratio, deliveries against polls, and it only means something once you know what the code was supposed to do.&lt;/p&gt;

&lt;h3&gt;
  
  
  Aurora I/O-Optimized: the storage setting nobody revisited
&lt;/h3&gt;

&lt;p&gt;At a global consumer-goods company, an Aurora database's cost had been climbing for months, to about $3,900 a month. Its per-request I/O charges were running at roughly ten times its compute and storage combined, which is exactly the case &lt;a href="https://aws.amazon.com/rds/aurora/pricing/" rel="noopener noreferrer"&gt;Aurora I/O-Optimized storage&lt;/a&gt; is built for. Switching is one line of configuration, and the cluster dropped to about $500 a month. We've seen the same pattern at several companies since, worth six figures a year in total, one line each time.&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%2Fxl0caf70j9eobtoi481r.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%2Fxl0caf70j9eobtoi481r.png" alt="Weekly Amazon RDS spend in that account, falling from around $1,400 a week to around $630 in late November after the Aurora storage switch" width="566" height="400"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Weekly RDS spend for the whole account. The drop at week 48 is the storage switch; the account's other databases make up the rest.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;These three don't need the same context, and it's worth being precise about that, because a good coding agent will catch some of this on its own.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Case&lt;/th&gt;
&lt;th&gt;What it takes to spot&lt;/th&gt;
&lt;th&gt;What execution data adds&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Secrets Manager on every call&lt;/td&gt;
&lt;td&gt;Code alone. Knowing it runs as a Lambda makes it obvious, since every invocation can re-run the handler.&lt;/td&gt;
&lt;td&gt;How much it's worth: pennies at ten calls a day, five figures at forty million.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;AppConfig token not carried forward&lt;/td&gt;
&lt;td&gt;Code plus the API's billing contract, if the agent ever opens the client library.&lt;/td&gt;
&lt;td&gt;The proof: deliveries at 100% of polls where they should be under 1%, and the $20k a year that adds up to.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Aurora I/O-Optimized&lt;/td&gt;
&lt;td&gt;Billing. The config line looks the same whether switching saves money or adds it.&lt;/td&gt;
&lt;td&gt;The answer itself. At the same company, the same switch on another cluster would have added about $4,100 a year.&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;So the agent that wrote the code had no reason to suspect any of it, and an agent asked to review it would likely catch the first one, maybe the second, and never the third. Even then, only execution data tells you which fixes are worth making, and whether a change saves money or costs more.&lt;/p&gt;

&lt;h2&gt;
  
  
  Closing the feedback loop between code and production
&lt;/h2&gt;

&lt;p&gt;Now picture the same workflow with the missing half plugged in. Billing, inventory and metrics flow back to where code gets written. The agent drafting a change can see that the endpoint it's touching runs at a few thousand requests a second, and what each of those requests costs. The reviewer sees the expected cost change next to the test results. And once the change lands, the next one gets written knowing what the last one actually did.&lt;/p&gt;

&lt;p&gt;This is where it starts to compound. Every fix teaches the system something about where the money goes, so the next round of code starts from better numbers. Efficiency stops being a quarterly FinOps cleanup and becomes part of how the team ships.&lt;/p&gt;

&lt;p&gt;Teams running agentic software factories already think this way about security and compliance. They put policies and scanners in the loop, so whatever the agents generate converges toward code that passes them, without a human checking every line. Cost deserves the same treatment. Give the factory a north star for efficiency, measured against real execution data, and every agent in it converges toward efficient code the same way it converges toward secure, compliant code.&lt;/p&gt;

&lt;p&gt;This is what we're building at Cloud ex Machina. &lt;a href="https://docs.cloudexmachina.io/dex/overview" rel="noopener noreferrer"&gt;Dex&lt;/a&gt; connects code with live billing, inventory and metrics data, finds the issues that only show up when you see both, and ships the fix as a pull request. &lt;a href="https://docs.cloudexmachina.io/coding-agent/install" rel="noopener noreferrer"&gt;Our plugin for Claude&lt;/a&gt; brings that cost context into the coding agent while it writes. The first version of a change won't always be efficient, but each round is informed by what the last one cost in production, so the code converges toward efficiency over time. Engineers don't change how they work, and the bill improves anyway. Together, Dex and the plugin create the loop this post is about, a feedback loop from code to its execution context and back.&lt;/p&gt;

&lt;p&gt;We're now extending that loop beyond the cloud bill, starting to bring CI, APM and observability costs into the same platform. For many teams they're a large part of what it costs to run software, and they follow the code just as directly: a test suite that runs on every push, a log line in a hot path, traces sampled at 100%.&lt;/p&gt;

&lt;h2&gt;
  
  
  How do you make AI-generated code cost-efficient?
&lt;/h2&gt;

&lt;p&gt;You can start closing the loop with what you already have:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Put cost next to latency.&lt;/strong&gt; Wherever your team checks service health, add cost per service and per request, including the CI and observability spend each service drives. If it isn't on the dashboard engineers actually open, it doesn't exist.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Review metered calls in code review.&lt;/strong&gt; Flag any new call to a paid API on a hot path, whether it's secrets, config, queues or a third-party service, and ask how often it runs. The same goes for logs, metrics and traces that your observability tool bills by volume.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Give your agents the numbers.&lt;/strong&gt; A coding agent that can read usage and billing data can reason about cost the way it reasons about tests. Even a read-only export it can query is a start.&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  FAQ: AI-generated code and cloud costs
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Does AI-generated code cost more to run?
&lt;/h3&gt;

&lt;p&gt;No, not by nature. It costs whatever it costs, but nobody checks. Agents optimize for code that works and passes tests, and nothing tells them what it does to the bill, so small inefficiencies ship at the speed agents write code.&lt;/p&gt;

&lt;h3&gt;
  
  
  Can a coding agent reduce cloud costs on its own?
&lt;/h3&gt;

&lt;p&gt;Only with data. An agent reading the repo has no idea which function is the hot one. Give it billing, inventory and metrics, and it can find and fix cost issues the way it fixes failing tests.&lt;/p&gt;

&lt;h3&gt;
  
  
  How is this different from FinOps?
&lt;/h3&gt;

&lt;p&gt;FinOps tools manage the bill, things like budgets and commitments, and they're good at telling you where the money goes. Closing the loop takes that information one step further, into the code that spends it.&lt;/p&gt;

&lt;h3&gt;
  
  
  When should you switch Aurora to I/O-Optimized?
&lt;/h3&gt;

&lt;p&gt;When per-request I/O is a large share of the cluster's bill. &lt;a href="https://docs.aws.amazon.com/AmazonRDS/latest/AuroraUserGuide/Aurora.Overview.StorageReliability.html" rel="noopener noreferrer"&gt;AWS's own rule of thumb&lt;/a&gt; is about 25% of total Aurora spend. Below that, the higher compute and storage rates cost more than the I/O you save. Size it on a few months of billing, not a short snapshot: a single I/O spike can make a switch look like a saving when it would actually add cost.&lt;/p&gt;

&lt;p&gt;I'd love to hear how other teams handle this, especially if you've already wired production data back into your agents. And if you want to see what the loop turns up on your own stack, we run free three-week proofs of value. We agree on a savings target upfront, and you only pay if we hit it.&lt;/p&gt;

</description>
      <category>aws</category>
      <category>finops</category>
      <category>ai</category>
      <category>devops</category>
    </item>
  </channel>
</rss>
