<?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: Morgan</title>
    <description>The latest articles on DEV Community by Morgan (@morganlabs).</description>
    <link>https://dev.to/morganlabs</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%2F3929982%2Ff3df85bf-1850-4ed6-bf6e-955fe7798d76.png</url>
      <title>DEV Community: Morgan</title>
      <link>https://dev.to/morganlabs</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/morganlabs"/>
    <language>en</language>
    <item>
      <title>Agent cost bugs are debugging bugs</title>
      <dc:creator>Morgan</dc:creator>
      <pubDate>Fri, 15 May 2026 13:46:43 +0000</pubDate>
      <link>https://dev.to/morganlabs/agent-cost-bugs-are-debugging-bugs-32jg</link>
      <guid>https://dev.to/morganlabs/agent-cost-bugs-are-debugging-bugs-32jg</guid>
      <description>&lt;p&gt;A coding agent does not need to bankrupt you to create a cost bug.&lt;/p&gt;

&lt;p&gt;It just needs to make the run impossible to explain.&lt;/p&gt;

&lt;p&gt;You see the number on the invoice. You see the "done" in chat. You cannot connect them.&lt;/p&gt;

&lt;h2&gt;
  
  
  Cost is not only billing
&lt;/h2&gt;

&lt;p&gt;When developers talk about agent costs, the conversation usually drifts toward dashboards and rate limits — invoice-shaped problems with invoice-shaped fixes. That framing hides the actual pain.&lt;/p&gt;

&lt;p&gt;The pain in real workflows is closer to this: an agent runs, something happens, the bill or the environment changes in a way you did not expect, and you cannot quickly tell why.&lt;/p&gt;

&lt;p&gt;The fix is not a fancier billing UI. The fix is a record of what the run actually did.&lt;/p&gt;

&lt;p&gt;I keep noticing the same four shapes show up under "cost." All four are really debugging bugs.&lt;/p&gt;

&lt;h2&gt;
  
  
  Four failures that look like cost but are really run-truth failures
&lt;/h2&gt;

&lt;h3&gt;
  
  
  1. Unexpected token budgets
&lt;/h3&gt;

&lt;p&gt;A developer sends one image to a vision-capable model and watches the prompt-token count balloon to something they did not predict. The docs say one thing; the meter says another. They are left manually reconciling published documentation against observed billing.&lt;/p&gt;

&lt;p&gt;That is not a billing problem. That is a "what did this run actually consume?" problem. The run did not carry its own accounting. The developer is doing post-hoc forensics with whatever scraps the chat history preserved.&lt;/p&gt;

&lt;p&gt;This shows up repeatedly in vendor forums. There is nothing exotic going on — properly formatted requests, supported image sizes, normal API surfaces — and the result still surprises. Without a per-run record that ties the call shape to the observed cost, the conversation is forced upstream into "is the model overcounting?" instead of staying local where it could be diagnosed.&lt;/p&gt;

&lt;h3&gt;
  
  
  2. Credits or usage attached to the wrong workspace
&lt;/h3&gt;

&lt;p&gt;You are working in one client. You buy more usage. The credits land on a different account, or the same account in a different workspace, or the same workspace in a different surface. The work is paused while you try to figure out which identity owned the run.&lt;/p&gt;

&lt;p&gt;This is not a credit-card issue. It is an identity attribution issue masquerading as a money issue. The run did not record which workspace, which account, which environment was actually active when it spent budget.&lt;/p&gt;

&lt;p&gt;When attribution is invisible at run time, the only recovery path is a vendor support ticket. That is fine occasionally. It is a productivity disaster as a default mode.&lt;/p&gt;

&lt;h3&gt;
  
  
  3. Local processes that keep running after the agent is done
&lt;/h3&gt;

&lt;p&gt;You finish a session in a desktop client. You close it. Hours later you notice a Python interpreter still using memory, still doing whatever the agent was doing when the window closed. No one is watching it. No one billed for it on paper. But the laptop is doing work nobody asked for, and the agent that started it has no idea it left a tail.&lt;/p&gt;

&lt;p&gt;That is a cost in machine resources, in attention, in trust. And it is invisible to every vendor dashboard because it is local-by-definition. The only way to surface it would be a run record that says "I started a subprocess, here is its handle, here is what should happen to it when I exit."&lt;/p&gt;

&lt;p&gt;Today nothing in the agent stack writes that down. You discover the leak by looking at Activity Monitor and asking yourself, "what is this and where did it come from?"&lt;/p&gt;

&lt;h3&gt;
  
  
  4. Model swaps that change production behavior
&lt;/h3&gt;

&lt;p&gt;A team updates a model version. Same API, same prompts, same client code. Behavior drifts. The new model is faster, or cheaper, or differently-tuned, and it stops doing the part of the job everyone was relying on without saying anything.&lt;/p&gt;

&lt;p&gt;This is not advertised as a cost issue, but it is the same family. The cost of the change shows up as a quality regression in production. The team is running tests after the fact to figure out what shifted. The model swap was framed as low-risk because the surface stayed the same.&lt;/p&gt;

&lt;p&gt;A run record would not prevent the regression. But it would make the diff readable. You would have a frozen record of what the old model did and what the new model does, attached to the same run shapes, instead of a slow reconstruction from chat memory and prod logs.&lt;/p&gt;

&lt;h2&gt;
  
  
  What these have in common
&lt;/h2&gt;

&lt;p&gt;All four are easy to describe and surprisingly hard to debug, and the reason is the same.&lt;/p&gt;

&lt;p&gt;The agent ran. The vendor saw the call. The chat saw the prompt. None of those views capture the things you actually want to look at when something costs more than expected:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;the &lt;strong&gt;active identity&lt;/strong&gt; at run time (account, workspace, branch, worktree)&lt;/li&gt;
&lt;li&gt;the &lt;strong&gt;call shape&lt;/strong&gt; (model, parameters, attachments, sizes)&lt;/li&gt;
&lt;li&gt;the &lt;strong&gt;process footprint&lt;/strong&gt; (what was spawned, what is still running)&lt;/li&gt;
&lt;li&gt;the &lt;strong&gt;observed cost&lt;/strong&gt; (tokens, time, anything that crossed a threshold)&lt;/li&gt;
&lt;li&gt;the &lt;strong&gt;deviation from baseline&lt;/strong&gt; (last week this same run cost X)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;That set is small. None of it is exotic. None of it requires a hosted dashboard. It just has to exist somewhere a person can read it in two minutes and the next agent can re-use.&lt;/p&gt;

&lt;h2&gt;
  
  
  What a useful run record would capture
&lt;/h2&gt;

&lt;p&gt;I keep coming back to a boring shape:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight markdown"&gt;&lt;code&gt;Ask: &lt;span class="nt"&gt;&amp;lt;one&lt;/span&gt; &lt;span class="na"&gt;or&lt;/span&gt; &lt;span class="na"&gt;two&lt;/span&gt; &lt;span class="na"&gt;lines&lt;/span&gt; &lt;span class="na"&gt;of&lt;/span&gt; &lt;span class="na"&gt;intent&lt;/span&gt;&lt;span class="err"&gt;,&lt;/span&gt; &lt;span class="na"&gt;not&lt;/span&gt; &lt;span class="na"&gt;paraphrased&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
Identity: &lt;span class="nt"&gt;&amp;lt;model&lt;/span&gt;&lt;span class="err"&gt;,&lt;/span&gt; &lt;span class="na"&gt;account&lt;/span&gt;&lt;span class="err"&gt;,&lt;/span&gt; &lt;span class="na"&gt;workspace&lt;/span&gt;&lt;span class="err"&gt;,&lt;/span&gt; &lt;span class="na"&gt;branch&lt;/span&gt;&lt;span class="err"&gt;,&lt;/span&gt; &lt;span class="na"&gt;worktree&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
Inputs: &lt;span class="nt"&gt;&amp;lt;files&lt;/span&gt; &lt;span class="na"&gt;read&lt;/span&gt;&lt;span class="err"&gt;,&lt;/span&gt; &lt;span class="na"&gt;attachments&lt;/span&gt; &lt;span class="na"&gt;sent&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
Calls: &lt;span class="nt"&gt;&amp;lt;tool&lt;/span&gt; &lt;span class="err"&gt;/&lt;/span&gt; &lt;span class="na"&gt;API&lt;/span&gt; &lt;span class="na"&gt;calls&lt;/span&gt; &lt;span class="na"&gt;with&lt;/span&gt; &lt;span class="na"&gt;model&lt;/span&gt; &lt;span class="na"&gt;attribution&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
Outputs: &lt;span class="nt"&gt;&amp;lt;diffs&lt;/span&gt;&lt;span class="err"&gt;,&lt;/span&gt; &lt;span class="na"&gt;generated&lt;/span&gt; &lt;span class="na"&gt;artifacts&lt;/span&gt;&lt;span class="err"&gt;,&lt;/span&gt; &lt;span class="na"&gt;where&lt;/span&gt; &lt;span class="na"&gt;they&lt;/span&gt; &lt;span class="na"&gt;ended&lt;/span&gt; &lt;span class="na"&gt;up&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
Verification: &lt;span class="nt"&gt;&amp;lt;tests&lt;/span&gt;&lt;span class="err"&gt;,&lt;/span&gt; &lt;span class="na"&gt;lints&lt;/span&gt;&lt;span class="err"&gt;,&lt;/span&gt; &lt;span class="na"&gt;build&lt;/span&gt;&lt;span class="err"&gt;,&lt;/span&gt; &lt;span class="na"&gt;browser&lt;/span&gt; &lt;span class="na"&gt;checks&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
Cost footprint: &lt;span class="nt"&gt;&amp;lt;tokens&lt;/span&gt;&lt;span class="err"&gt;,&lt;/span&gt; &lt;span class="na"&gt;wall&lt;/span&gt; &lt;span class="na"&gt;time&lt;/span&gt;&lt;span class="err"&gt;,&lt;/span&gt; &lt;span class="na"&gt;surprising&lt;/span&gt; &lt;span class="na"&gt;spikes&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
Process footprint: &lt;span class="nt"&gt;&amp;lt;subprocesses&lt;/span&gt; &lt;span class="na"&gt;started&lt;/span&gt;&lt;span class="err"&gt;,&lt;/span&gt; &lt;span class="na"&gt;still&lt;/span&gt; &lt;span class="na"&gt;running&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
Open risks: &lt;span class="nt"&gt;&amp;lt;what&lt;/span&gt; &lt;span class="na"&gt;the&lt;/span&gt; &lt;span class="na"&gt;agent&lt;/span&gt; &lt;span class="na"&gt;suspects&lt;/span&gt; &lt;span class="na"&gt;but&lt;/span&gt; &lt;span class="na"&gt;did&lt;/span&gt; &lt;span class="na"&gt;not&lt;/span&gt; &lt;span class="na"&gt;confirm&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
Next-agent handoff: &lt;span class="nt"&gt;&amp;lt;first&lt;/span&gt; &lt;span class="na"&gt;three&lt;/span&gt; &lt;span class="na"&gt;things&lt;/span&gt; &lt;span class="na"&gt;a&lt;/span&gt; &lt;span class="na"&gt;fresh&lt;/span&gt; &lt;span class="na"&gt;agent&lt;/span&gt; &lt;span class="na"&gt;should&lt;/span&gt; &lt;span class="na"&gt;do&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Plain markdown. One file per meaningful run. Human-readable first, structured enough for the next agent second.&lt;/p&gt;

&lt;p&gt;The point of the cost footprint and process footprint sections is not to replace the invoice. It is to let you say, with the run in front of you:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Of course it cost that much — look at this 66K-token input.&lt;br&gt;
Of course it billed the wrong workspace — the run shows the other one was active.&lt;br&gt;
Of course there is a leaked subprocess — the run started one and never recorded it being torn down.&lt;br&gt;
Of course production drifted — the run identifies a model swap and the verification field is empty.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;That is what "cost is a debugging problem" looks like in practice. The bill is the headline. The record is the diagnosis.&lt;/p&gt;

&lt;h2&gt;
  
  
  The smallest thing I would build
&lt;/h2&gt;

&lt;p&gt;I would not build a dashboard. I would write a small per-run markdown file with the shape above, locally, and stop.&lt;/p&gt;

&lt;p&gt;No sync server. No vector store. No vendor lock-in. No new schema until the markdown shape has survived three real runs without changing.&lt;/p&gt;

&lt;p&gt;If that file existed, every "why did this cost X?" question would have a place to start that is not "let me scroll back through chat history." Most of the cost surprises above would stop being mysteries.&lt;/p&gt;

&lt;p&gt;The reason this is not a product yet is the same reason it is interesting: nobody has accepted that agent cost is a local-debugging surface. Vendors think it is their billing UI. Observability tools think it is a span. Memory products think it is something to retrieve later. None of them write the boring per-run file that would close most of the open questions.&lt;/p&gt;

&lt;h2&gt;
  
  
  Closing
&lt;/h2&gt;

&lt;p&gt;If your agent is burning money in a way you cannot explain in two minutes, the problem is not your budget. The problem is that the run did not write itself down.&lt;/p&gt;

&lt;p&gt;Cost bugs are debugging bugs. The fix is run truth.&lt;/p&gt;

&lt;p&gt;If you have hit any of the four failures above and patched around them differently — I want to hear about it. The shape of the right artifact is still up for grabs.&lt;/p&gt;

</description>
      <category>llm</category>
      <category>ai</category>
      <category>agents</category>
      <category>devtools</category>
    </item>
    <item>
      <title>Agents need a black box recorder, not more memory</title>
      <dc:creator>Morgan</dc:creator>
      <pubDate>Thu, 14 May 2026 20:21:21 +0000</pubDate>
      <link>https://dev.to/morganlabs/agents-need-a-black-box-recorder-not-more-memory-4hpg</link>
      <guid>https://dev.to/morganlabs/agents-need-a-black-box-recorder-not-more-memory-4hpg</guid>
      <description>&lt;p&gt;Every agent product eventually ends up talking about memory.&lt;/p&gt;

&lt;p&gt;Longer memory. Better memory. Shared memory. Vector memory. Persistent memory.&lt;/p&gt;

&lt;p&gt;I get why. Anyone who has used coding agents for real work has hit the same&lt;br&gt;
wall: the agent loses context, forgets what happened in another client, repeats&lt;br&gt;
itself, or makes a change that is hard to reconstruct later.&lt;/p&gt;

&lt;p&gt;But I think "memory" is the wrong primary frame.&lt;/p&gt;

&lt;p&gt;The more useful question is:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;After the run is over, can I answer what happened?&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Not just what the final answer was. What actually happened.&lt;/p&gt;

&lt;p&gt;What did the user ask?&lt;/p&gt;

&lt;p&gt;What files, tools, docs, and prior context were in play?&lt;/p&gt;

&lt;p&gt;Why did the agent call a tool?&lt;/p&gt;

&lt;p&gt;Which model produced that action?&lt;/p&gt;

&lt;p&gt;What changed?&lt;/p&gt;

&lt;p&gt;What did it cost?&lt;/p&gt;

&lt;p&gt;Can I replay, audit, or explain the chain?&lt;/p&gt;

&lt;p&gt;That is less like a second brain and more like a black box recorder.&lt;/p&gt;

&lt;h2&gt;
  
  
  The pain is showing up everywhere
&lt;/h2&gt;

&lt;p&gt;The agent tooling conversations I keep seeing are not only about storage.&lt;br&gt;
They are about operational trust.&lt;/p&gt;

&lt;p&gt;One MCP discussion described the problem of context being trapped inside one&lt;br&gt;
client. You can brainstorm on mobile, continue in the web app, then open a&lt;br&gt;
coding agent locally and it has no idea what just happened.&lt;/p&gt;

&lt;p&gt;That is not just a memory problem. It is a continuity problem.&lt;/p&gt;

&lt;p&gt;Another thread proposed standard audit context for AI-initiated MCP tool calls:&lt;br&gt;
why the AI invoked a tool, and which model produced that invocation.&lt;/p&gt;

&lt;p&gt;That is not just a logging problem. It is an accountability problem.&lt;/p&gt;

&lt;p&gt;Other threads are circling server identity, tool provenance, permission specs,&lt;br&gt;
and tool bills of materials. People are asking questions like:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Who published this tool?&lt;/li&gt;
&lt;li&gt;Did its metadata change?&lt;/li&gt;
&lt;li&gt;What capabilities does it require?&lt;/li&gt;
&lt;li&gt;Why should an agent be allowed to call it?&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;That is not just a security problem. It is a trust problem.&lt;/p&gt;

&lt;p&gt;Then there are the everyday developer headaches: unexpected token usage, credits&lt;br&gt;
attached to the wrong workspace, orphaned local subprocesses, tool calls that&lt;br&gt;
worked in one environment but not another.&lt;/p&gt;

&lt;p&gt;That is not just observability. It is run truth.&lt;/p&gt;

&lt;h2&gt;
  
  
  "Memory" hides too much
&lt;/h2&gt;

&lt;p&gt;When we call all of this memory, we flatten several different needs into one&lt;br&gt;
word.&lt;/p&gt;

&lt;p&gt;Developers do need agents to remember useful context.&lt;/p&gt;

&lt;p&gt;But they also need agents to preserve the reasoning trail around important&lt;br&gt;
work:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;task intent&lt;/li&gt;
&lt;li&gt;active context&lt;/li&gt;
&lt;li&gt;files and tools touched&lt;/li&gt;
&lt;li&gt;model/tool calls&lt;/li&gt;
&lt;li&gt;permission and trust assumptions&lt;/li&gt;
&lt;li&gt;cost/token/process anomalies&lt;/li&gt;
&lt;li&gt;receipts for important actions&lt;/li&gt;
&lt;li&gt;a replayable or inspectable run history&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Those are not all the same feature.&lt;/p&gt;

&lt;p&gt;An agent can remember a fact and still be impossible to audit.&lt;/p&gt;

&lt;p&gt;An agent can summarize a conversation and still leave you unable to explain why&lt;br&gt;
it deleted a file, called a tool, burned tokens, or trusted a server.&lt;/p&gt;

&lt;h2&gt;
  
  
  The product shape I want
&lt;/h2&gt;

&lt;p&gt;The layer I want is local-first and boring in the best way.&lt;/p&gt;

&lt;p&gt;It sits under agent work and records enough truth that the user or another&lt;br&gt;
agent can come back later and ask:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;What happened here?&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;And get a useful answer.&lt;/p&gt;

&lt;p&gt;Not a hallucinated summary. Not a vague activity feed. Not a giant dashboard&lt;br&gt;
about dashboards.&lt;/p&gt;

&lt;p&gt;A compact chain:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;The user asked this.&lt;/li&gt;
&lt;li&gt;The agent saw this context.&lt;/li&gt;
&lt;li&gt;It chose these tools for these reasons.&lt;/li&gt;
&lt;li&gt;These tool calls happened.&lt;/li&gt;
&lt;li&gt;These files or external states changed.&lt;/li&gt;
&lt;li&gt;This was the cost/runtime footprint.&lt;/li&gt;
&lt;li&gt;These actions were approved, deferred, or blocked.&lt;/li&gt;
&lt;li&gt;This is what a future agent should trust or re-check.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;That would make agents safer to use for real work.&lt;/p&gt;

&lt;p&gt;It would also make them easier to improve, because the failures would be&lt;br&gt;
visible:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;lost context&lt;/li&gt;
&lt;li&gt;stale assumptions&lt;/li&gt;
&lt;li&gt;wrong tool trust&lt;/li&gt;
&lt;li&gt;runaway cost&lt;/li&gt;
&lt;li&gt;missing approval&lt;/li&gt;
&lt;li&gt;environment drift&lt;/li&gt;
&lt;li&gt;actions with no durable deliverable&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  The phrase I keep coming back to
&lt;/h2&gt;

&lt;p&gt;Agents do not only need memory.&lt;/p&gt;

&lt;p&gt;They need a local truth layer.&lt;/p&gt;

&lt;p&gt;Something closer to:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;inspect, replay, and trust agent work across tools and clients.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;That is the direction I am exploring with AMK.&lt;/p&gt;

&lt;p&gt;The goal is not another knowledge base. The goal is to make "what happened?"&lt;br&gt;
answerable after the run is over.&lt;/p&gt;

&lt;p&gt;Because once agents are doing real work, that question matters more than almost&lt;br&gt;
anything else.&lt;/p&gt;

</description>
      <category>llm</category>
      <category>ai</category>
      <category>agents</category>
      <category>devtools</category>
    </item>
  </channel>
</rss>
