Skip to content

an open-source alternative to the dots, bots and muses of the world, run an office of claude code/codex like agents on your laptop, sandboxes or anywhere, uses your existing subscriptions

blog: the spend counter that went back to zero, the 0.4.5 cost bug

Chaitanya Giri463027d2c2f7
diff --git a/blog/src/_data/media.json b/blog/src/_data/media.json
index f16fa48c..7990aebd 100644
--- a/blog/src/_data/media.json
+++ b/blog/src/_data/media.json
@@ -2681,6 +2681,31 @@
},
"youtube": []
},
+ "the-spend-counter-that-went-back-to-zero": {
+ "title": "The Spend Counter That Went Back to Zero",
+ "category": "internals",
+ "hero": {
+ "file": "assets/media/the-spend-counter-that-went-back-to-zero/hero.png",
+ "alt": "Illustration: The Spend Counter That Went Back to Zero",
+ "prompt": "Hero image for a blog post titled \"The Spend Counter That Went Back to Zero\". The post is about: Our own floor was under reporting what it cost by 59 percent. The counter was cumulative since process start, the app restarts, and the session id stayed the same. Here is how a monotonic invariant let us recover the real number from an append-only log.",
+ "status": "placeholder"
+ },
+ "inline": {
+ "note-1": {
+ "file": "assets/media/the-spend-counter-that-went-back-to-zero/note-1.png",
+ "alt": "Hand-drawn sketch from “The Spend Counter That Went Back to Zero”",
+ "prompt": "",
+ "status": "placeholder"
+ },
+ "note-2": {
+ "file": "assets/media/the-spend-counter-that-went-back-to-zero/note-2.png",
+ "alt": "Hand-drawn sketch from “The Spend Counter That Went Back to Zero”",
+ "prompt": "",
+ "status": "placeholder"
+ }
+ },
+ "youtube": []
+ },
"tmux-and-scripts-vs-an-agent-harness": {
"title": "Running Agents in tmux vs an Agent Harness",
"category": "comparisons",
diff --git a/blog/src/posts/the-spend-counter-that-went-back-to-zero.md b/blog/src/posts/the-spend-counter-that-went-back-to-zero.md
new file mode 100644
index 00000000..83549ec2
--- /dev/null
+++ b/blog/src/posts/the-spend-counter-that-went-back-to-zero.md
@@ -0,0 +1,254 @@
+---
+title: "The Spend Counter That Went Back to Zero"
+description: "Our own floor was under reporting what it cost by 59 percent. The counter was cumulative since process start, the app restarts, and the session id stayed the same. Here is how a monotonic invariant let us recover the real number from an append-only log."
+date: 2026-08-22
+category: internals
+categoryLabel: Internals
+type: Technical
+primaryKeyword: "ai agent cost tracking bug"
+secondaryKeywords: ["cumulative counter reset", "append-only ledger recovery", "electron main thread blocking read", "monotonic counter invariant", "agent spend tracking"]
+tags: ["Internals", "Cost", "Telemetry", "Debugging", "Postmortem"]
+author:
+ name: Chaitanya Giri
+ initials: CG
+faq:
+ - q: "What was wrong with cost reporting in Munder Difflin?"
+ a: "The per-agent spend figure counted from the moment the app process started, not from the moment the agent started. Restarting the app rebuilt the in-memory accumulator empty, so the counter began again at zero under the same session id. Anything reading the latest value read one app session's worth of spend and called it the total. On our own floor that hid 59 percent of it."
+ - q: "Why did nobody notice a number that was wrong by more than half?"
+ a: "Because it never looked wrong. Inside any single run the counter only climbed, so it behaved exactly like a lifetime total. Nothing threw, nothing went negative, nothing came back NaN. The reset is only visible if you look at the whole history at once, and the number is the kind you glance at rather than reconcile."
+ - q: "How do you recover a total from a counter that resets?"
+ a: "You use the invariant the counter already gives you. Within one agent and one session the value can only go up, so any decrease is a restart and nothing else. Lifetime is the sum of the high-water mark of each segment that a reset closed, plus the high-water mark of the segment still open. Every sample was already on disk in an append-only ledger, so the past was recoverable without a migration."
+ - q: "Why not ignore small drops as noise?"
+ a: "We looked at that and rejected it. Real restarts in our own ledger fall from peaks under a dollar straight to zero, so a one dollar threshold would have silently missed them. A cumulative counter has no legitimate reason to fall at all, so the threshold bought tidiness and cost coverage. Any decrease counts, with a float epsilon and nothing more."
+---
+
+<div class="callout tldr"><span class="ic">TL;DR</span><p>Munder Difflin tells you what your
+floor of agents costs. That number was wrong by <strong>59 percent</strong>, and it had been
+wrong quietly, because it was a counter that measured from process start while its label said
+lifetime. Restart the app and it began again at zero under the same session id. The fix is not a
+new counter. It is reading the reset back out of the log we already had, using the one property a
+cumulative counter cannot break: it only goes up.</p></div>
+
+You can build an agent harness that does everything right and still hand people a number that
+lies. Ours did. Every agent card on the floor carried a dollar figure, `fleet.json` carried it
+for Michael, and the LIVE ROSTER line every agent reads carried it too. It was the number you
+would look at to decide whether to hire another worker or send everyone home.
+
+It was under reporting by more than half.
+
+This is the postmortem, because the bug is not really about money. It is about what happens when
+a value's name describes something more permanent than the thing that computes it.
+
+## What the number was supposed to mean
+
+Each agent reports usage as it works. The collector folds those samples into a per-agent record
+with tokens in, tokens out, cache reads, cache creation, and a dollar figure. That record is
+written into `fleet.json` on a timer, which is what the orchestrator and every agent read when
+they want to know the shape of the floor.
+
+The contract everyone assumed was simple: `usd` is what this agent has cost you.
+
+## What it actually meant
+
+`AgentUsageSample.usd` is cumulative since **process start**. Not since the agent started. Since
+the app started.
+
+The collector accumulates into in-memory maps. An app restart builds those maps fresh, so every
+running total goes back to zero. The agent itself does not go back to zero, because the agent
+resumes: same worker, same work, same `session_id`. Only our accumulator forgot.
+
+So the sequence on disk looks like this. The counter climbs through a session. The app restarts.
+The counter appears again at almost nothing, under the same session id, and starts climbing
+again. Anything that reads the latest value is reading spend since the most recent restart and
+reporting it as spend, full stop.
+
+The longer an agent lives, the more restarts it survives, and the more wrong its number gets. The
+agents you have invested the most in are the ones whose cost you understate the worst.
+
+## Why this survived in plain sight
+
+Here is the uncomfortable part. Every check you would write against this number passes.
+
+The value is never negative. It is never NaN. Nothing throws, nothing warns, no read fails.
+Within any single run of the app the counter is perfectly monotonic, which is exactly how a
+lifetime total behaves, so a person watching it for an hour sees nothing suspicious. It is
+plausible in magnitude: too small to be absurd, too large to be obviously stubbed.
+
+And the reset itself is invisible from where the number is consumed. Restarting an app is the
+single most normal thing a user does. Nobody restarts and then reconciles a dollar figure against
+what it read before, because the app was closed in between and closing an app is allowed to
+change what is on screen.
+
+The signature only exists in the history. You cannot see it in a value. You can only see it in a
+sequence, and only if you look at the whole sequence at once.
+
+{% img "note-1", "The counter climbs, the app restarts, the counter starts over. Every single value is fine. Only the sequence is wrong." %}
+
+## The data was never lost
+
+The thing that made this fixable rather than merely diagnosable: the ledger is append-only.
+
+Every usage sample ever emitted is a line in `cost-ledger.jsonl`, and lines are never rewritten.
+The pre-reset peaks were all still sitting on disk. The bug was in what we read out of that file,
+not in what we put into it, which means the past could be corrected rather than written off.
+
+That distinction is worth more than the fix. A bug in a derived read is recoverable. The same
+bug in the write path would have meant a number that starts being right today and is wrong
+forever behind you.
+
+## Reading a reset out of a monotonic counter
+
+Within one agent and one session, the counter can only climb. That is not a convention, it is
+what cumulative means. So a decrease is not ambiguous. It is not a rounding artifact, or a
+correction, or a refund. **A decrease is a restart, and it is the only thing a decrease can be.**
+
+That gives the whole algorithm. Walk the ledger. For each agent and session, hold two numbers:
+the high-water mark of the segment currently open, and the sum of the high-water marks of every
+segment a reset has already closed. When the value drops, the open segment just ended at its
+peak, so commit the peak and open a new segment at the new value.
+
+```ts
+if (usd < s.peak - EPS) {
+ // Counter went backwards: the previous segment ended at its peak.
+ s.committed += s.peak;
+ s.peak = usd;
+} else if (usd > s.peak) {
+ s.peak = usd;
+}
+```
+
+Lifetime is then `committed + peak`, summed across every session an agent has had. That is the
+entire recovery. It is a handful of arithmetic, because the invariant did the hard part.
+
+The general shape is worth keeping: **if a value is only allowed to move one way, every move the
+other way is a free detector you already have on disk.** You do not need to have instrumented the
+event. You need to have recorded enough that the event leaves a shadow.
+
+## The threshold we deliberately did not add
+
+The tempting version of this code ignores small drops. Float noise, out-of-order samples, a
+rounding difference somewhere upstream: surely you want a floor before you call something a
+restart. A dollar sounds sensible. Ten cents sounds cautious.
+
+We looked at our own ledger and found real restarts falling from peaks **under a dollar** straight
+to zero. A one dollar threshold misses those completely, and it misses them silently, which is
+the same failure we were already fixing wearing a different hat.
+
+So the threshold is a float epsilon and nothing else. A cumulative counter has no legitimate
+reason to go down by any amount, so there is no band of "probably fine" to carve out. The magic
+number bought tidiness and cost coverage, and coverage was the entire point.
+
+If you find yourself picking a threshold to suppress a signal, check whether the signal has any
+legitimate instances at all. If it does not, the right threshold is zero and the number you were
+about to type is just a hole.
+
+## Doing it without freezing the app
+
+Munder Difflin is an Electron app, and the ledger is append-only, which is a polite way of saying
+it grows forever. A full pass over it is not something you want on the main thread. Block that
+thread and the whole UI stops: the floor, the terminals, the window itself.
+
+So the fold is async and incremental. It keeps a byte offset and reads only what has been
+appended since the last pass, which in steady state is a few hundred bytes. Three details in
+there are load bearing.
+
+**The trailing partial line is held as bytes, not text.** A read boundary can land in the middle
+of a multi-byte character, and decoding half of one produces a replacement character that no
+longer parses as JSON. Buffering the tail as a `Buffer` and only decoding up to the last newline
+means the split is invisible.
+
+**Each pass is capped.** A cold start on a large ledger would otherwise be one enormous read. It
+reads a bounded chunk, keeps its segment state, and resumes on the next tick.
+
+**Truncation is detected, not assumed away.** If the file is smaller than the offset we hold, the
+file was rotated or replaced under us, and every segment we are carrying is suspect. That case
+resets the reader instead of reading garbage from a stale position.
+
+The reader never writes to the ledger, and a ledger it cannot read leaves the last good totals in
+place rather than throwing into a timer.
+
+## A cold zero is worse than an admitted unknown
+
+Until the first full pass completes, the fold genuinely does not know what an agent has cost.
+There are two things you can publish at that moment: zero, or nothing.
+
+Zero is a lie with a confident face. Somebody reads it, believes an agent is free, and the
+mistake propagates. So `usdFor` returns `null` until a pass has actually reached the end of the
+file, and there is an explicit `warm` flag behind it so a caller can tell "no spend" apart from
+"not read yet".
+
+`fleet.json` uses that to fall back to the old session figure while the fold is cold, and swaps
+to lifetime the moment it is warm. The old number is still there permanently as `sessionUsd`,
+because "what has this agent cost me since I opened the app" is a real question, it just is not
+the one the field named `usd` was being asked.
+
+Nullable is not a nuisance here. It is the type telling the truth about what is known.
+
+## Checking a number you recovered by inference
+
+This is a computed answer with no ground truth to compare it against. There is no invoice that
+says what an agent cost. The number is only as good as the reasoning that produced it, which
+means a passing test proves the code matches the assumptions, not that the assumptions are right.
+
+So the ledger was folded a second time by a separately written implementation and the two were
+compared. They agree to the cent, with no per-agent disagreement anywhere in the set. That is not
+proof, but two independent implementations agreeing on every agent is a very different level of
+confidence than one implementation agreeing with itself.
+
+For any number you recover by inference rather than measurement, write it twice. It is cheap and
+it is the only check that tests the reasoning instead of the typing.
+
+## What we did not fix, and why we said so
+
+The circuit breaker has a floor-wide cost cap, and it reads the same resetting counter.
+
+That means the cap re-arms to zero on every restart and is, in effect, measuring one app session
+rather than lifetime. That is not a bug in the same sense. It is an unanswered question about what
+a spending cap should mean. Is it "stop the floor when it has spent this much today", or "ever"?
+Those are different products, and one of them is a policy the founder gets to choose, not a
+default an agent should quietly change while fixing something else.
+
+So it is written up rather than patched. **A fix that silently rewrites a policy is not a fix, it
+is a decision taken by whoever happened to be in the file.**
+
+{% img "note-2", "Same counter, second consumer. Fixing the display without fixing the cap would have been half a fix that looked whole." %}
+
+## What we wrote down
+
+- **A counter named for a lifetime should not be scoped to a process.** If the value resets when
+ something restarts, the name has to say so. Ours now ships as `usd` and `sessionUsd` side by
+ side, and the ambiguity is gone because both answers exist.
+- **A monotonic invariant is a detector you already own.** If a value can only move one way, every
+ move the other way is an event you can recover after the fact, with no new instrumentation.
+- **Append-only logs let you fix the past.** The write path being correct is what made this a
+ read-side fix instead of a line in the changelog apologising for old data.
+- **Check whether your threshold has any legitimate instances.** If nothing real lives below the
+ cutoff, the cutoff is only hiding things you wanted to see.
+- **Never publish a confident zero for a value you have not read yet.** Return null, keep a warm
+ flag, and let callers decide.
+- **Write the second implementation.** For inferred numbers it is the only verification that
+ tests the reasoning rather than the code.
+
+The failure class here is the same one behind
+[the newline that silenced every Windows agent](/blog/the-newline-that-silenced-windows-agents/)
+and [the auto-update that never ran](/blog/why-our-auto-update-never-ran/): nothing errored,
+every health check passed, and the product was quietly not doing the thing it said it did.
+Loud failures get fixed in an afternoon. These are the ones that need somebody to go and
+[verify the claim](/blog/how-ai-agents-verify-their-own-work/) rather than the absence of an
+exception.
+
+## The rest of v0.4.5
+
+This shipped in **v0.4.5**, alongside two other things that were quietly wrong: semantic memory
+never worked on Apple Silicon, where CoreML overflowed the quantized embedding graph and returned
+NaN for every vector, and agents did not reliably reach each other, which now has an inbox wake
+watchdog behind it and bounces mail to a missing inbox instead of dropping it. Plus weekday
+scheduling for triggers, clickable paths everywhere in terminal output, one editor instead of
+two, one click updates, and 23 community pull requests.
+
+The full notes are on the
+[releases page](https://github.com/chaitanyagiri/munder-difflin/releases/latest), and if you want
+the wider version of this argument, the
+[multi-agent cost playbook](/blog/the-multi-agent-cost-playbook/) is about spending less rather
+than counting it correctly. Both matter. Counting it correctly comes first, because you cannot
+manage a number you are not actually reading.
diff --git a/docs/blog/agents-ran-our-launch-week-analytics/index.html b/docs/blog/agents-ran-our-launch-week-analytics/index.html
index 943e2641..98981fa8 100644
--- a/docs/blog/agents-ran-our-launch-week-analytics/index.html
+++ b/docs/blog/agents-ran-our-launch-week-analytics/index.html
@@ -276,7 +276,7 @@ half of this ran while we slept off the launch.</p>
<footer class="post-foot wrap"><div class="prevnext">
<a class="pn prev" href="/blog/an-agent-redesigned-this-blog/"><span class="k">← Older</span><span class="t">An Agent Redesigned the Blog You&#39;re Reading</span></a>
- <span></span>
+ <a class="pn next" href="/blog/the-spend-counter-that-went-back-to-zero/"><span class="k">Newer →</span><span class="t">The Spend Counter That Went Back to Zero</span></a>
</div>
<section class="related">
<h2>Related in Use Cases</h2>
diff --git a/docs/blog/append-only-event-log-agents/index.html b/docs/blog/append-only-event-log-agents/index.html
index 65138253..88391f0b 100644
--- a/docs/blog/append-only-event-log-agents/index.html
+++ b/docs/blog/append-only-event-log-agents/index.html
@@ -312,6 +312,22 @@ it’s free and open source.</p>
<h2>Related in Internals</h2>
<div class="post-grid">
<article class="card t-internals">
+ <a class="thumb t-internals" href="/blog/the-spend-counter-that-went-back-to-zero/" aria-hidden="true" tabindex="-1"><span class="thumb-ph"><em class="ph-glyph" aria-hidden="true">✶</em><span>INTERNALS</span></span></a>
+ <div class="body">
+ <div class="meta">
+ <time datetime="2026-08-22">Aug 22, 2026</time>
+ <span class="dot" aria-hidden="true"></span>
+ <span>10 min</span>
+ </div>
+ <h3><a href="/blog/the-spend-counter-that-went-back-to-zero/">The Spend Counter That Went Back to Zero</a></h3>
+ <p class="dek">Our own floor was under reporting what it cost by 59 percent. The counter was cumulative since process start, the app restarts, and the session id stayed the same. Here is how a monotonic invariant let us recover the real number from an append-only log.</p>
+ <div class="foot">
+ <span class="tag kind">Internals</span>
+ <a class="more" href="/blog/the-spend-counter-that-went-back-to-zero/" aria-label="Read: The Spend Counter That Went Back to Zero">Read →</a>
+ </div>
+ </div>
+</article>
+<article class="card t-internals">
<a class="thumb t-internals" href="/blog/the-newline-that-silenced-windows-agents/" aria-hidden="true" tabindex="-1"><img src="/blog/assets/media/the-newline-that-silenced-windows-agents/hero.png" alt="" loading="lazy" decoding="async" /></a>
<div class="body">
<div class="meta">
@@ -343,22 +359,6 @@ it’s free and open source.</p>
</div>
</div>
</article>
-<article class="card t-internals">
- <a class="thumb t-internals" href="/blog/hire-manifest-untrusted-input/" aria-hidden="true" tabindex="-1"><img src="/blog/assets/media/hire-manifest-untrusted-input/hero.png" alt="" loading="lazy" decoding="async" /></a>
- <div class="body">
- <div class="meta">
- <time datetime="2026-06-15">Jun 15, 2026</time>
- <span class="dot" aria-hidden="true"></span>
- <span>12 min</span>
- </div>
- <h3><a href="/blog/hire-manifest-untrusted-input/">Treating a Hire Manifest as Untrusted Input</a></h3>
- <p class="dek">A shareable agent-config manifest is attacker input. How Munder Difflin&#39;s import pipeline stays inert: no auto-spawn, default-deny flags, and an SSRF-safe bounded fetch.</p>
- <div class="foot">
- <span class="tag kind">Internals</span>
- <a class="more" href="/blog/hire-manifest-untrusted-input/" aria-label="Read: Treating a Hire Manifest as Untrusted Input">Read →</a>
- </div>
- </div>
-</article>
</div>
</section>
diff --git a/docs/blog/architecture-two-planes-one-renderer/index.html b/docs/blog/architecture-two-planes-one-renderer/index.html
index bf70be10..fd80184a 100644
--- a/docs/blog/architecture-two-planes-one-renderer/index.html
+++ b/docs/blog/architecture-two-planes-one-renderer/index.html
@@ -315,6 +315,22 @@ free and open source.</p>
<h2>Related in Internals</h2>
<div class="post-grid">
<article class="card t-internals">
+ <a class="thumb t-internals" href="/blog/the-spend-counter-that-went-back-to-zero/" aria-hidden="true" tabindex="-1"><span class="thumb-ph"><em class="ph-glyph" aria-hidden="true">✶</em><span>INTERNALS</span></span></a>
+ <div class="body">
+ <div class="meta">
+ <time datetime="2026-08-22">Aug 22, 2026</time>
+ <span class="dot" aria-hidden="true"></span>
+ <span>10 min</span>
+ </div>
+ <h3><a href="/blog/the-spend-counter-that-went-back-to-zero/">The Spend Counter That Went Back to Zero</a></h3>
+ <p class="dek">Our own floor was under reporting what it cost by 59 percent. The counter was cumulative since process start, the app restarts, and the session id stayed the same. Here is how a monotonic invariant let us recover the real number from an append-only log.</p>
+ <div class="foot">
+ <span class="tag kind">Internals</span>
+ <a class="more" href="/blog/the-spend-counter-that-went-back-to-zero/" aria-label="Read: The Spend Counter That Went Back to Zero">Read →</a>
+ </div>
+ </div>
+</article>
+<article class="card t-internals">
<a class="thumb t-internals" href="/blog/the-newline-that-silenced-windows-agents/" aria-hidden="true" tabindex="-1"><img src="/blog/assets/media/the-newline-that-silenced-windows-agents/hero.png" alt="" loading="lazy" decoding="async" /></a>
<div class="body">
<div class="meta">
@@ -346,22 +362,6 @@ free and open source.</p>
</div>
</div>
</article>
-<article class="card t-internals">
- <a class="thumb t-internals" href="/blog/hire-manifest-untrusted-input/" aria-hidden="true" tabindex="-1"><img src="/blog/assets/media/hire-manifest-untrusted-input/hero.png" alt="" loading="lazy" decoding="async" /></a>
- <div class="body">
- <div class="meta">
- <time datetime="2026-06-15">Jun 15, 2026</time>
- <span class="dot" aria-hidden="true"></span>
- <span>12 min</span>
- </div>
- <h3><a href="/blog/hire-manifest-untrusted-input/">Treating a Hire Manifest as Untrusted Input</a></h3>
- <p class="dek">A shareable agent-config manifest is attacker input. How Munder Difflin&#39;s import pipeline stays inert: no auto-spawn, default-deny flags, and an SSRF-safe bounded fetch.</p>
- <div class="foot">
- <span class="tag kind">Internals</span>
- <a class="more" href="/blog/hire-manifest-untrusted-input/" aria-label="Read: Treating a Hire Manifest as Untrusted Input">Read →</a>
- </div>
- </div>
-</article>
</div>
</section>
diff --git a/docs/blog/atomic-file-mailboxes-for-agents/index.html b/docs/blog/atomic-file-mailboxes-for-agents/index.html
index c5879a5c..433bf8c5 100644
--- a/docs/blog/atomic-file-mailboxes-for-agents/index.html
+++ b/docs/blog/atomic-file-mailboxes-for-agents/index.html
@@ -327,6 +327,22 @@ the office floor; it’s free and open source.</p>
<h2>Related in Internals</h2>
<div class="post-grid">
<article class="card t-internals">
+ <a class="thumb t-internals" href="/blog/the-spend-counter-that-went-back-to-zero/" aria-hidden="true" tabindex="-1"><span class="thumb-ph"><em class="ph-glyph" aria-hidden="true">✶</em><span>INTERNALS</span></span></a>
+ <div class="body">
+ <div class="meta">
+ <time datetime="2026-08-22">Aug 22, 2026</time>
+ <span class="dot" aria-hidden="true"></span>
+ <span>10 min</span>
+ </div>
+ <h3><a href="/blog/the-spend-counter-that-went-back-to-zero/">The Spend Counter That Went Back to Zero</a></h3>
+ <p class="dek">Our own floor was under reporting what it cost by 59 percent. The counter was cumulative since process start, the app restarts, and the session id stayed the same. Here is how a monotonic invariant let us recover the real number from an append-only log.</p>
+ <div class="foot">
+ <span class="tag kind">Internals</span>
+ <a class="more" href="/blog/the-spend-counter-that-went-back-to-zero/" aria-label="Read: The Spend Counter That Went Back to Zero">Read →</a>
+ </div>
+ </div>
+</article>
+<article class="card t-internals">
<a class="thumb t-internals" href="/blog/the-newline-that-silenced-windows-agents/" aria-hidden="true" tabindex="-1"><img src="/blog/assets/media/the-newline-that-silenced-windows-agents/hero.png" alt="" loading="lazy" decoding="async" /></a>
<div class="body">
<div class="meta">
@@ -358,22 +374,6 @@ the office floor; it’s free and open source.</p>
</div>
</div>
</article>
-<article class="card t-internals">
- <a class="thumb t-internals" href="/blog/hire-manifest-untrusted-input/" aria-hidden="true" tabindex="-1"><img src="/blog/assets/media/hire-manifest-untrusted-input/hero.png" alt="" loading="lazy" decoding="async" /></a>
- <div class="body">
- <div class="meta">
- <time datetime="2026-06-15">Jun 15, 2026</time>
- <span class="dot" aria-hidden="true"></span>
- <span>12 min</span>
- </div>
- <h3><a href="/blog/hire-manifest-untrusted-input/">Treating a Hire Manifest as Untrusted Input</a></h3>
- <p class="dek">A shareable agent-config manifest is attacker input. How Munder Difflin&#39;s import pipeline stays inert: no auto-spawn, default-deny flags, and an SSRF-safe bounded fetch.</p>
- <div class="foot">
- <span class="tag kind">Internals</span>
- <a class="more" href="/blog/hire-manifest-untrusted-input/" aria-label="Read: Treating a Hire Manifest as Untrusted Input">Read →</a>
- </div>
- </div>
-</article>
</div>
</section>
diff --git a/docs/blog/building-a-terminal-ui-xterm-node-pty/index.html b/docs/blog/building-a-terminal-ui-xterm-node-pty/index.html
index 11842eb5..b587919d 100644
--- a/docs/blog/building-a-terminal-ui-xterm-node-pty/index.html
+++ b/docs/blog/building-a-terminal-ui-xterm-node-pty/index.html
@@ -370,6 +370,22 @@ to watch many real terminals at once; it’s free and open source.</p>
<h2>Related in Internals</h2>
<div class="post-grid">
<article class="card t-internals">
+ <a class="thumb t-internals" href="/blog/the-spend-counter-that-went-back-to-zero/" aria-hidden="true" tabindex="-1"><span class="thumb-ph"><em class="ph-glyph" aria-hidden="true">✶</em><span>INTERNALS</span></span></a>
+ <div class="body">
+ <div class="meta">
+ <time datetime="2026-08-22">Aug 22, 2026</time>
+ <span class="dot" aria-hidden="true"></span>
+ <span>10 min</span>
+ </div>
+ <h3><a href="/blog/the-spend-counter-that-went-back-to-zero/">The Spend Counter That Went Back to Zero</a></h3>
+ <p class="dek">Our own floor was under reporting what it cost by 59 percent. The counter was cumulative since process start, the app restarts, and the session id stayed the same. Here is how a monotonic invariant let us recover the real number from an append-only log.</p>
+ <div class="foot">
+ <span class="tag kind">Internals</span>
+ <a class="more" href="/blog/the-spend-counter-that-went-back-to-zero/" aria-label="Read: The Spend Counter That Went Back to Zero">Read →</a>
+ </div>
+ </div>
+</article>
+<article class="card t-internals">
<a class="thumb t-internals" href="/blog/the-newline-that-silenced-windows-agents/" aria-hidden="true" tabindex="-1"><img src="/blog/assets/media/the-newline-that-silenced-windows-agents/hero.png" alt="" loading="lazy" decoding="async" /></a>
<div class="body">
<div class="meta">
@@ -401,22 +417,6 @@ to watch many real terminals at once; it’s free and open source.</p>
</div>
</div>
</article>
-<article class="card t-internals">
- <a class="thumb t-internals" href="/blog/hire-manifest-untrusted-input/" aria-hidden="true" tabindex="-1"><img src="/blog/assets/media/hire-manifest-untrusted-input/hero.png" alt="" loading="lazy" decoding="async" /></a>
- <div class="body">
- <div class="meta">
- <time datetime="2026-06-15">Jun 15, 2026</time>
- <span class="dot" aria-hidden="true"></span>
- <span>12 min</span>
- </div>
- <h3><a href="/blog/hire-manifest-untrusted-input/">Treating a Hire Manifest as Untrusted Input</a></h3>
- <p class="dek">A shareable agent-config manifest is attacker input. How Munder Difflin&#39;s import pipeline stays inert: no auto-spawn, default-deny flags, and an SSRF-safe bounded fetch.</p>
- <div class="foot">
- <span class="tag kind">Internals</span>
- <a class="more" href="/blog/hire-manifest-untrusted-input/" aria-label="Read: Treating a Hire Manifest as Untrusted Input">Read →</a>
- </div>
- </div>
-</article>
</div>
</section>
diff --git a/docs/blog/building-an-ai-office-floor/index.html b/docs/blog/building-an-ai-office-floor/index.html
index 51951d07..ff94eac0 100644
--- a/docs/blog/building-an-ai-office-floor/index.html
+++ b/docs/blog/building-an-ai-office-floor/index.html
@@ -315,6 +315,22 @@ techniques — the hard part is wiring them to <em>real</em> agent events, not t
<h2>Related in Internals</h2>
<div class="post-grid">
<article class="card t-internals">
+ <a class="thumb t-internals" href="/blog/the-spend-counter-that-went-back-to-zero/" aria-hidden="true" tabindex="-1"><span class="thumb-ph"><em class="ph-glyph" aria-hidden="true">✶</em><span>INTERNALS</span></span></a>
+ <div class="body">
+ <div class="meta">
+ <time datetime="2026-08-22">Aug 22, 2026</time>
+ <span class="dot" aria-hidden="true"></span>
+ <span>10 min</span>
+ </div>
+ <h3><a href="/blog/the-spend-counter-that-went-back-to-zero/">The Spend Counter That Went Back to Zero</a></h3>
+ <p class="dek">Our own floor was under reporting what it cost by 59 percent. The counter was cumulative since process start, the app restarts, and the session id stayed the same. Here is how a monotonic invariant let us recover the real number from an append-only log.</p>
+ <div class="foot">
+ <span class="tag kind">Internals</span>
+ <a class="more" href="/blog/the-spend-counter-that-went-back-to-zero/" aria-label="Read: The Spend Counter That Went Back to Zero">Read →</a>
+ </div>
+ </div>
+</article>
+<article class="card t-internals">
<a class="thumb t-internals" href="/blog/the-newline-that-silenced-windows-agents/" aria-hidden="true" tabindex="-1"><img src="/blog/assets/media/the-newline-that-silenced-windows-agents/hero.png" alt="" loading="lazy" decoding="async" /></a>
<div class="body">
<div class="meta">
@@ -346,22 +362,6 @@ techniques — the hard part is wiring them to <em>real</em> agent events, not t
</div>
</div>
</article>
-<article class="card t-internals">
- <a class="thumb t-internals" href="/blog/hire-manifest-untrusted-input/" aria-hidden="true" tabindex="-1"><img src="/blog/assets/media/hire-manifest-untrusted-input/hero.png" alt="" loading="lazy" decoding="async" /></a>
- <div class="body">
- <div class="meta">
- <time datetime="2026-06-15">Jun 15, 2026</time>
- <span class="dot" aria-hidden="true"></span>
- <span>12 min</span>
- </div>
- <h3><a href="/blog/hire-manifest-untrusted-input/">Treating a Hire Manifest as Untrusted Input</a></h3>
- <p class="dek">A shareable agent-config manifest is attacker input. How Munder Difflin&#39;s import pipeline stays inert: no auto-spawn, default-deny flags, and an SSRF-safe bounded fetch.</p>
- <div class="foot">
- <span class="tag kind">Internals</span>
- <a class="more" href="/blog/hire-manifest-untrusted-input/" aria-label="Read: Treating a Hire Manifest as Untrusted Input">Read →</a>
- </div>
- </div>
-</article>
</div>
</section>
diff --git a/docs/blog/claude-code-hooks-explained/index.html b/docs/blog/claude-code-hooks-explained/index.html
index fdf442af..c4b0d78c 100644
--- a/docs/blog/claude-code-hooks-explained/index.html
+++ b/docs/blog/claude-code-hooks-explained/index.html
@@ -329,6 +329,22 @@ free and open source.</p>
<h2>Related in Internals</h2>
<div class="post-grid">
<article class="card t-internals">
+ <a class="thumb t-internals" href="/blog/the-spend-counter-that-went-back-to-zero/" aria-hidden="true" tabindex="-1"><span class="thumb-ph"><em class="ph-glyph" aria-hidden="true">✶</em><span>INTERNALS</span></span></a>
+ <div class="body">
+ <div class="meta">
+ <time datetime="2026-08-22">Aug 22, 2026</time>
+ <span class="dot" aria-hidden="true"></span>
+ <span>10 min</span>
+ </div>
+ <h3><a href="/blog/the-spend-counter-that-went-back-to-zero/">The Spend Counter That Went Back to Zero</a></h3>
+ <p class="dek">Our own floor was under reporting what it cost by 59 percent. The counter was cumulative since process start, the app restarts, and the session id stayed the same. Here is how a monotonic invariant let us recover the real number from an append-only log.</p>
+ <div class="foot">
+ <span class="tag kind">Internals</span>
+ <a class="more" href="/blog/the-spend-counter-that-went-back-to-zero/" aria-label="Read: The Spend Counter That Went Back to Zero">Read →</a>
+ </div>
+ </div>
+</article>
+<article class="card t-internals">
<a class="thumb t-internals" href="/blog/the-newline-that-silenced-windows-agents/" aria-hidden="true" tabindex="-1"><img src="/blog/assets/media/the-newline-that-silenced-windows-agents/hero.png" alt="" loading="lazy" decoding="async" /></a>
<div class="body">
<div class="meta">
@@ -360,22 +376,6 @@ free and open source.</p>
</div>
</div>
</article>
-<article class="card t-internals">
- <a class="thumb t-internals" href="/blog/hire-manifest-untrusted-input/" aria-hidden="true" tabindex="-1"><img src="/blog/assets/media/hire-manifest-untrusted-input/hero.png" alt="" loading="lazy" decoding="async" /></a>
- <div class="body">
- <div class="meta">
- <time datetime="2026-06-15">Jun 15, 2026</time>
- <span class="dot" aria-hidden="true"></span>
- <span>12 min</span>
- </div>
- <h3><a href="/blog/hire-manifest-untrusted-input/">Treating a Hire Manifest as Untrusted Input</a></h3>
- <p class="dek">A shareable agent-config manifest is attacker input. How Munder Difflin&#39;s import pipeline stays inert: no auto-spawn, default-deny flags, and an SSRF-safe bounded fetch.</p>
- <div class="foot">
- <span class="tag kind">Internals</span>
- <a class="more" href="/blog/hire-manifest-untrusted-input/" aria-label="Read: Treating a Hire Manifest as Untrusted Input">Read →</a>
- </div>
- </div>
-</article>
</div>
</section>
diff --git a/docs/blog/compressing-agent-memory/index.html b/docs/blog/compressing-agent-memory/index.html
index 4e683904..e6227db6 100644
--- a/docs/blog/compressing-agent-memory/index.html
+++ b/docs/blog/compressing-agent-memory/index.html
@@ -297,6 +297,22 @@ without forgetting; it’s free and open source.</p>
<h2>Related in Internals</h2>
<div class="post-grid">
<article class="card t-internals">
+ <a class="thumb t-internals" href="/blog/the-spend-counter-that-went-back-to-zero/" aria-hidden="true" tabindex="-1"><span class="thumb-ph"><em class="ph-glyph" aria-hidden="true">✶</em><span>INTERNALS</span></span></a>
+ <div class="body">
+ <div class="meta">
+ <time datetime="2026-08-22">Aug 22, 2026</time>
+ <span class="dot" aria-hidden="true"></span>
+ <span>10 min</span>
+ </div>
+ <h3><a href="/blog/the-spend-counter-that-went-back-to-zero/">The Spend Counter That Went Back to Zero</a></h3>
+ <p class="dek">Our own floor was under reporting what it cost by 59 percent. The counter was cumulative since process start, the app restarts, and the session id stayed the same. Here is how a monotonic invariant let us recover the real number from an append-only log.</p>
+ <div class="foot">
+ <span class="tag kind">Internals</span>
+ <a class="more" href="/blog/the-spend-counter-that-went-back-to-zero/" aria-label="Read: The Spend Counter That Went Back to Zero">Read →</a>
+ </div>
+ </div>
+</article>
+<article class="card t-internals">
<a class="thumb t-internals" href="/blog/the-newline-that-silenced-windows-agents/" aria-hidden="true" tabindex="-1"><img src="/blog/assets/media/the-newline-that-silenced-windows-agents/hero.png" alt="" loading="lazy" decoding="async" /></a>
<div class="body">
<div class="meta">
@@ -328,22 +344,6 @@ without forgetting; it’s free and open source.</p>
</div>
</div>
</article>
-<article class="card t-internals">
- <a class="thumb t-internals" href="/blog/hire-manifest-untrusted-input/" aria-hidden="true" tabindex="-1"><img src="/blog/assets/media/hire-manifest-untrusted-input/hero.png" alt="" loading="lazy" decoding="async" /></a>
- <div class="body">
- <div class="meta">
- <time datetime="2026-06-15">Jun 15, 2026</time>
- <span class="dot" aria-hidden="true"></span>
- <span>12 min</span>
- </div>
- <h3><a href="/blog/hire-manifest-untrusted-input/">Treating a Hire Manifest as Untrusted Input</a></h3>
- <p class="dek">A shareable agent-config manifest is attacker input. How Munder Difflin&#39;s import pipeline stays inert: no auto-spawn, default-deny flags, and an SSRF-safe bounded fetch.</p>
- <div class="foot">
- <span class="tag kind">Internals</span>
- <a class="more" href="/blog/hire-manifest-untrusted-input/" aria-label="Read: Treating a Hire Manifest as Untrusted Input">Read →</a>
- </div>
- </div>
-</article>
</div>
</section>
diff --git a/docs/blog/feed.xml b/docs/blog/feed.xml
index b77d368b..bea2464e 100644
--- a/docs/blog/feed.xml
+++ b/docs/blog/feed.xml
@@ -4,9 +4,17 @@
<subtitle>Guides, deep dives, and comparisons on running multi-agent Claude Code: orchestration, agent memory, automation, and the tooling landscape.</subtitle>
<link href="https://munderdiffl.in/blog/feed.xml" rel="self" />
<link href="https://munderdiffl.in/blog/" />
- <updated>2026-08-19T00:00:00.000Z</updated>
+ <updated>2026-08-22T00:00:00.000Z</updated>
<id>https://munderdiffl.in/blog/</id>
<author><name>Chaitanya Giri</name><uri>https://munderdiffl.in</uri></author>
+ <entry>
+ <title>The Spend Counter That Went Back to Zero</title>
+ <link href="https://munderdiffl.in/blog/the-spend-counter-that-went-back-to-zero/" />
+ <id>https://munderdiffl.in/blog/the-spend-counter-that-went-back-to-zero/</id>
+ <published>2026-08-22T00:00:00.000Z</published>
+ <updated>2026-08-22T00:00:00.000Z</updated><category term="Internals" />
+ <summary>Our own floor was under reporting what it cost by 59 percent. The counter was cumulative since process start, the app restarts, and the session id stayed the same. Here is how a monotonic invariant let us recover the real number from an append-only log.</summary>
+ </entry>
<entry>
<title>Our Agents Ran Our Launch-Week Analytics</title>
<link href="https://munderdiffl.in/blog/agents-ran-our-launch-week-analytics/" />
@@ -479,12 +487,4 @@
<updated>2026-06-04T00:00:00.000Z</updated><category term="Concepts" />
<summary>Meta&#39;s Agents Rule of Two for coding agents: don&#39;t let one session combine untrusted input, private data, and external reach at once — or supervise.</summary>
</entry>
- <entry>
- <title>Munder Difflin&#39;s Architecture: Two Data Planes, One Renderer</title>
- <link href="https://munderdiffl.in/blog/architecture-two-planes-one-renderer/" />
- <id>https://munderdiffl.in/blog/architecture-two-planes-one-renderer/</id>
- <published>2026-06-04T00:00:00.000Z</published>
- <updated>2026-06-04T00:00:00.000Z</updated><category term="Internals" />
- <summary>A walkthrough of the multi-agent harness architecture: a node-pty terminal plane and a hooks/hive event plane feeding one React + Pixi.js renderer.</summary>
- </entry>
</feed>
diff --git a/docs/blog/file-based-coordination-vs-message-queues/index.html b/docs/blog/file-based-coordination-vs-message-queues/index.html
index f80aa6be..91443adc 100644
--- a/docs/blog/file-based-coordination-vs-message-queues/index.html
+++ b/docs/blog/file-based-coordination-vs-message-queues/index.html
@@ -288,6 +288,22 @@ durable, git-versioned, and debuggable by just looking.
<h2>Related in Internals</h2>
<div class="post-grid">
<article class="card t-internals">
+ <a class="thumb t-internals" href="/blog/the-spend-counter-that-went-back-to-zero/" aria-hidden="true" tabindex="-1"><span class="thumb-ph"><em class="ph-glyph" aria-hidden="true">✶</em><span>INTERNALS</span></span></a>
+ <div class="body">
+ <div class="meta">
+ <time datetime="2026-08-22">Aug 22, 2026</time>
+ <span class="dot" aria-hidden="true"></span>
+ <span>10 min</span>
+ </div>
+ <h3><a href="/blog/the-spend-counter-that-went-back-to-zero/">The Spend Counter That Went Back to Zero</a></h3>
+ <p class="dek">Our own floor was under reporting what it cost by 59 percent. The counter was cumulative since process start, the app restarts, and the session id stayed the same. Here is how a monotonic invariant let us recover the real number from an append-only log.</p>
+ <div class="foot">
+ <span class="tag kind">Internals</span>
+ <a class="more" href="/blog/the-spend-counter-that-went-back-to-zero/" aria-label="Read: The Spend Counter That Went Back to Zero">Read →</a>
+ </div>
+ </div>
+</article>
+<article class="card t-internals">
<a class="thumb t-internals" href="/blog/the-newline-that-silenced-windows-agents/" aria-hidden="true" tabindex="-1"><img src="/blog/assets/media/the-newline-that-silenced-windows-agents/hero.png" alt="" loading="lazy" decoding="async" /></a>
<div class="body">
<div class="meta">
@@ -319,22 +335,6 @@ durable, git-versioned, and debuggable by just looking.
</div>
</div>
</article>
-<article class="card t-internals">
- <a class="thumb t-internals" href="/blog/hire-manifest-untrusted-input/" aria-hidden="true" tabindex="-1"><img src="/blog/assets/media/hire-manifest-untrusted-input/hero.png" alt="" loading="lazy" decoding="async" /></a>
- <div class="body">
- <div class="meta">
- <time datetime="2026-06-15">Jun 15, 2026</time>
- <span class="dot" aria-hidden="true"></span>
- <span>12 min</span>
- </div>
- <h3><a href="/blog/hire-manifest-untrusted-input/">Treating a Hire Manifest as Untrusted Input</a></h3>
- <p class="dek">A shareable agent-config manifest is attacker input. How Munder Difflin&#39;s import pipeline stays inert: no auto-spawn, default-deny flags, and an SSRF-safe bounded fetch.</p>
- <div class="foot">
- <span class="tag kind">Internals</span>
- <a class="more" href="/blog/hire-manifest-untrusted-input/" aria-label="Read: Treating a Hire Manifest as Untrusted Input">Read →</a>
- </div>
- </div>
-</article>
</div>
</section>
diff --git a/docs/blog/hire-manifest-untrusted-input/index.html b/docs/blog/hire-manifest-untrusted-input/index.html
index 2720525e..2999a4f1 100644
--- a/docs/blog/hire-manifest-untrusted-input/index.html
+++ b/docs/blog/hire-manifest-untrusted-input/index.html
@@ -313,6 +313,22 @@ for hop in 0..5: // cap at 5 hops
<h2>Related in Internals</h2>
<div class="post-grid">
<article class="card t-internals">
+ <a class="thumb t-internals" href="/blog/the-spend-counter-that-went-back-to-zero/" aria-hidden="true" tabindex="-1"><span class="thumb-ph"><em class="ph-glyph" aria-hidden="true">✶</em><span>INTERNALS</span></span></a>
+ <div class="body">
+ <div class="meta">
+ <time datetime="2026-08-22">Aug 22, 2026</time>
+ <span class="dot" aria-hidden="true"></span>
+ <span>10 min</span>
+ </div>
+ <h3><a href="/blog/the-spend-counter-that-went-back-to-zero/">The Spend Counter That Went Back to Zero</a></h3>
+ <p class="dek">Our own floor was under reporting what it cost by 59 percent. The counter was cumulative since process start, the app restarts, and the session id stayed the same. Here is how a monotonic invariant let us recover the real number from an append-only log.</p>
+ <div class="foot">
+ <span class="tag kind">Internals</span>
+ <a class="more" href="/blog/the-spend-counter-that-went-back-to-zero/" aria-label="Read: The Spend Counter That Went Back to Zero">Read →</a>
+ </div>
+ </div>
+</article>
+<article class="card t-internals">
<a class="thumb t-internals" href="/blog/the-newline-that-silenced-windows-agents/" aria-hidden="true" tabindex="-1"><img src="/blog/assets/media/the-newline-that-silenced-windows-agents/hero.png" alt="" loading="lazy" decoding="async" /></a>
<div class="body">
<div class="meta">
@@ -344,22 +360,6 @@ for hop in 0..5: // cap at 5 hops
</div>
</div>
</article>
-<article class="card t-internals">
- <a class="thumb t-internals" href="/blog/compressing-agent-memory/" aria-hidden="true" tabindex="-1"><img src="/blog/assets/media/compressing-agent-memory/hero.png" alt="" loading="lazy" decoding="async" /></a>
- <div class="body">
- <div class="meta">
- <time datetime="2026-06-05">Jun 5, 2026</time>
- <span class="dot" aria-hidden="true"></span>
- <span>5 min</span>
- </div>
- <h3><a href="/blog/compressing-agent-memory/">Compressing Agent Memory Without Losing the Original</a></h3>
- <p class="dek">How and why to compress an agent&#39;s long-term memory: the toolbox, the lossy trap, and keeping a lossless original beside a compact copy.</p>
- <div class="foot">
- <span class="tag kind">Internals</span>
- <a class="more" href="/blog/compressing-agent-memory/" aria-label="Read: Compressing Agent Memory Without Losing the Original">Read →</a>
- </div>
- </div>
-</article>
</div>
</section>
diff --git a/docs/blog/index.html b/docs/blog/index.html
index 84c9b57b..960176f4 100644
--- a/docs/blog/index.html
+++ b/docs/blog/index.html
@@ -107,13 +107,13 @@
building a self-coordinating hive of agents with a GOD orchestrator you talk to.</p>
<div class="filters" role="navigation" aria-label="Topics">
- <a class="chip" aria-current="page">All<span class="ct">129</span></a>
+ <a class="chip" aria-current="page">All<span class="ct">130</span></a>
<a class="chip" href="/blog/topics/guides/">guides<span class="ct">34</span></a>
<a class="chip" href="/blog/topics/concepts/">concepts<span class="ct">21</span></a>
- <a class="chip" href="/blog/topics/internals/">internals<span class="ct">18</span></a>
+ <a class="chip" href="/blog/topics/internals/">internals<span class="ct">19</span></a>
<a class="chip" href="/blog/topics/comparisons/">comparisons<span class="ct">17</span></a>
@@ -129,19 +129,19 @@
</header>
-<div class="wrap featured"><article class="card t-use-cases">
- <a class="thumb t-use-cases" href="/blog/agents-ran-our-launch-week-analytics/" aria-hidden="true" tabindex="-1"><img src="/blog/assets/media/agents-ran-our-launch-week-analytics/hero.png" alt="" loading="lazy" decoding="async" /></a>
+<div class="wrap featured"><article class="card t-internals">
+ <a class="thumb t-internals" href="/blog/the-spend-counter-that-went-back-to-zero/" aria-hidden="true" tabindex="-1"><span class="thumb-ph"><em class="ph-glyph" aria-hidden="true">✶</em><span>INTERNALS</span></span></a>
<div class="body">
<div class="meta">
- <time datetime="2026-08-19">Aug 19, 2026</time>
+ <time datetime="2026-08-22">Aug 22, 2026</time>
<span class="dot" aria-hidden="true"></span>
- <span>4 min</span>
+ <span>10 min</span>
</div>
- <h3><a href="/blog/agents-ran-our-launch-week-analytics/">Our Agents Ran Our Launch-Week Analytics</a></h3>
- <p class="dek">Ten Reddit threads, a Product Hunt page, GitHub traffic and PostHog funnels — every comment read, cross-referenced, and reported by a hive of agents. The workflow, and how to point it at your own launch.</p>
+ <h3><a href="/blog/the-spend-counter-that-went-back-to-zero/">The Spend Counter That Went Back to Zero</a></h3>
+ <p class="dek">Our own floor was under reporting what it cost by 59 percent. The counter was cumulative since process start, the app restarts, and the session id stayed the same. Here is how a monotonic invariant let us recover the real number from an append-only log.</p>
<div class="foot">
- <span class="tag kind">Use Cases</span>
- <a class="more" href="/blog/agents-ran-our-launch-week-analytics/" aria-label="Read: Our Agents Ran Our Launch-Week Analytics">Read →</a>
+ <span class="tag kind">Internals</span>
+ <a class="more" href="/blog/the-spend-counter-that-went-back-to-zero/" aria-label="Read: The Spend Counter That Went Back to Zero">Read →</a>
</div>
</div>
</article>
@@ -152,6 +152,22 @@
<section class="wrap">
<div class="post-grid">
<article class="card t-use-cases">
+ <a class="thumb t-use-cases" href="/blog/agents-ran-our-launch-week-analytics/" aria-hidden="true" tabindex="-1"><img src="/blog/assets/media/agents-ran-our-launch-week-analytics/hero.png" alt="" loading="lazy" decoding="async" /></a>
+ <div class="body">
+ <div class="meta">
+ <time datetime="2026-08-19">Aug 19, 2026</time>
+ <span class="dot" aria-hidden="true"></span>
+ <span>4 min</span>
+ </div>
+ <h3><a href="/blog/agents-ran-our-launch-week-analytics/">Our Agents Ran Our Launch-Week Analytics</a></h3>
+ <p class="dek">Ten Reddit threads, a Product Hunt page, GitHub traffic and PostHog funnels — every comment read, cross-referenced, and reported by a hive of agents. The workflow, and how to point it at your own launch.</p>
+ <div class="foot">
+ <span class="tag kind">Use Cases</span>
+ <a class="more" href="/blog/agents-ran-our-launch-week-analytics/" aria-label="Read: Our Agents Ran Our Launch-Week Analytics">Read →</a>
+ </div>
+ </div>
+</article>
+<article class="card t-use-cases">
<a class="thumb t-use-cases" href="/blog/an-agent-redesigned-this-blog/" aria-hidden="true" tabindex="-1"><img src="/blog/assets/media/an-agent-redesigned-this-blog/hero.png" alt="" loading="lazy" decoding="async" /></a>
<div class="body">
<div class="meta">
diff --git a/docs/blog/node-pty-electron-real-terminals/index.html b/docs/blog/node-pty-electron-real-terminals/index.html
index b15ad958..363d87c5 100644
--- a/docs/blog/node-pty-electron-real-terminals/index.html
+++ b/docs/blog/node-pty-electron-real-terminals/index.html
@@ -350,6 +350,22 @@ real terminals driving real agents; it’s free and open source.</p>
<h2>Related in Internals</h2>
<div class="post-grid">
<article class="card t-internals">
+ <a class="thumb t-internals" href="/blog/the-spend-counter-that-went-back-to-zero/" aria-hidden="true" tabindex="-1"><span class="thumb-ph"><em class="ph-glyph" aria-hidden="true">✶</em><span>INTERNALS</span></span></a>
+ <div class="body">
+ <div class="meta">
+ <time datetime="2026-08-22">Aug 22, 2026</time>
+ <span class="dot" aria-hidden="true"></span>
+ <span>10 min</span>
+ </div>
+ <h3><a href="/blog/the-spend-counter-that-went-back-to-zero/">The Spend Counter That Went Back to Zero</a></h3>
+ <p class="dek">Our own floor was under reporting what it cost by 59 percent. The counter was cumulative since process start, the app restarts, and the session id stayed the same. Here is how a monotonic invariant let us recover the real number from an append-only log.</p>
+ <div class="foot">
+ <span class="tag kind">Internals</span>
+ <a class="more" href="/blog/the-spend-counter-that-went-back-to-zero/" aria-label="Read: The Spend Counter That Went Back to Zero">Read →</a>
+ </div>
+ </div>
+</article>
+<article class="card t-internals">
<a class="thumb t-internals" href="/blog/the-newline-that-silenced-windows-agents/" aria-hidden="true" tabindex="-1"><img src="/blog/assets/media/the-newline-that-silenced-windows-agents/hero.png" alt="" loading="lazy" decoding="async" /></a>
<div class="body">
<div class="meta">
@@ -381,22 +397,6 @@ real terminals driving real agents; it’s free and open source.</p>
</div>
</div>
</article>
-<article class="card t-internals">
- <a class="thumb t-internals" href="/blog/hire-manifest-untrusted-input/" aria-hidden="true" tabindex="-1"><img src="/blog/assets/media/hire-manifest-untrusted-input/hero.png" alt="" loading="lazy" decoding="async" /></a>
- <div class="body">
- <div class="meta">
- <time datetime="2026-06-15">Jun 15, 2026</time>
- <span class="dot" aria-hidden="true"></span>
- <span>12 min</span>
- </div>
- <h3><a href="/blog/hire-manifest-untrusted-input/">Treating a Hire Manifest as Untrusted Input</a></h3>
- <p class="dek">A shareable agent-config manifest is attacker input. How Munder Difflin&#39;s import pipeline stays inert: no auto-spawn, default-deny flags, and an SSRF-safe bounded fetch.</p>
- <div class="foot">
- <span class="tag kind">Internals</span>
- <a class="more" href="/blog/hire-manifest-untrusted-input/" aria-label="Read: Treating a Hire Manifest as Untrusted Input">Read →</a>
- </div>
- </div>
-</article>
</div>
</section>
diff --git a/docs/blog/observability-for-agent-fleets/index.html b/docs/blog/observability-for-agent-fleets/index.html
index 2c12bda1..cfb671de 100644
--- a/docs/blog/observability-for-agent-fleets/index.html
+++ b/docs/blog/observability-for-agent-fleets/index.html
@@ -287,6 +287,22 @@ open source.</p>
<h2>Related in Internals</h2>
<div class="post-grid">
<article class="card t-internals">
+ <a class="thumb t-internals" href="/blog/the-spend-counter-that-went-back-to-zero/" aria-hidden="true" tabindex="-1"><span class="thumb-ph"><em class="ph-glyph" aria-hidden="true">✶</em><span>INTERNALS</span></span></a>
+ <div class="body">
+ <div class="meta">
+ <time datetime="2026-08-22">Aug 22, 2026</time>
+ <span class="dot" aria-hidden="true"></span>
+ <span>10 min</span>
+ </div>
+ <h3><a href="/blog/the-spend-counter-that-went-back-to-zero/">The Spend Counter That Went Back to Zero</a></h3>
+ <p class="dek">Our own floor was under reporting what it cost by 59 percent. The counter was cumulative since process start, the app restarts, and the session id stayed the same. Here is how a monotonic invariant let us recover the real number from an append-only log.</p>
+ <div class="foot">
+ <span class="tag kind">Internals</span>
+ <a class="more" href="/blog/the-spend-counter-that-went-back-to-zero/" aria-label="Read: The Spend Counter That Went Back to Zero">Read →</a>
+ </div>
+ </div>
+</article>
+<article class="card t-internals">
<a class="thumb t-internals" href="/blog/the-newline-that-silenced-windows-agents/" aria-hidden="true" tabindex="-1"><img src="/blog/assets/media/the-newline-that-silenced-windows-agents/hero.png" alt="" loading="lazy" decoding="async" /></a>
<div class="body">
<div class="meta">
@@ -318,22 +334,6 @@ open source.</p>
</div>
</div>
</article>
-<article class="card t-internals">
- <a class="thumb t-internals" href="/blog/hire-manifest-untrusted-input/" aria-hidden="true" tabindex="-1"><img src="/blog/assets/media/hire-manifest-untrusted-input/hero.png" alt="" loading="lazy" decoding="async" /></a>
- <div class="body">
- <div class="meta">
- <time datetime="2026-06-15">Jun 15, 2026</time>
- <span class="dot" aria-hidden="true"></span>
- <span>12 min</span>
- </div>
- <h3><a href="/blog/hire-manifest-untrusted-input/">Treating a Hire Manifest as Untrusted Input</a></h3>
- <p class="dek">A shareable agent-config manifest is attacker input. How Munder Difflin&#39;s import pipeline stays inert: no auto-spawn, default-deny flags, and an SSRF-safe bounded fetch.</p>
- <div class="foot">
- <span class="tag kind">Internals</span>
- <a class="more" href="/blog/hire-manifest-untrusted-input/" aria-label="Read: Treating a Hire Manifest as Untrusted Input">Read →</a>
- </div>
- </div>
-</article>
</div>
</section>
diff --git a/docs/blog/recovering-from-agent-failures/index.html b/docs/blog/recovering-from-agent-failures/index.html
index 84422c50..0c9f4771 100644
--- a/docs/blog/recovering-from-agent-failures/index.html
+++ b/docs/blog/recovering-from-agent-failures/index.html
@@ -307,6 +307,22 @@ there to read.</p>
<h2>Related in Internals</h2>
<div class="post-grid">
<article class="card t-internals">
+ <a class="thumb t-internals" href="/blog/the-spend-counter-that-went-back-to-zero/" aria-hidden="true" tabindex="-1"><span class="thumb-ph"><em class="ph-glyph" aria-hidden="true">✶</em><span>INTERNALS</span></span></a>
+ <div class="body">
+ <div class="meta">
+ <time datetime="2026-08-22">Aug 22, 2026</time>
+ <span class="dot" aria-hidden="true"></span>
+ <span>10 min</span>
+ </div>
+ <h3><a href="/blog/the-spend-counter-that-went-back-to-zero/">The Spend Counter That Went Back to Zero</a></h3>
+ <p class="dek">Our own floor was under reporting what it cost by 59 percent. The counter was cumulative since process start, the app restarts, and the session id stayed the same. Here is how a monotonic invariant let us recover the real number from an append-only log.</p>
+ <div class="foot">
+ <span class="tag kind">Internals</span>
+ <a class="more" href="/blog/the-spend-counter-that-went-back-to-zero/" aria-label="Read: The Spend Counter That Went Back to Zero">Read →</a>
+ </div>
+ </div>
+</article>
+<article class="card t-internals">
<a class="thumb t-internals" href="/blog/the-newline-that-silenced-windows-agents/" aria-hidden="true" tabindex="-1"><img src="/blog/assets/media/the-newline-that-silenced-windows-agents/hero.png" alt="" loading="lazy" decoding="async" /></a>
<div class="body">
<div class="meta">
@@ -338,22 +354,6 @@ there to read.</p>
</div>
</div>
</article>
-<article class="card t-internals">
- <a class="thumb t-internals" href="/blog/hire-manifest-untrusted-input/" aria-hidden="true" tabindex="-1"><img src="/blog/assets/media/hire-manifest-untrusted-input/hero.png" alt="" loading="lazy" decoding="async" /></a>
- <div class="body">
- <div class="meta">
- <time datetime="2026-06-15">Jun 15, 2026</time>
- <span class="dot" aria-hidden="true"></span>
- <span>12 min</span>
- </div>
- <h3><a href="/blog/hire-manifest-untrusted-input/">Treating a Hire Manifest as Untrusted Input</a></h3>
- <p class="dek">A shareable agent-config manifest is attacker input. How Munder Difflin&#39;s import pipeline stays inert: no auto-spawn, default-deny flags, and an SSRF-safe bounded fetch.</p>
- <div class="foot">
- <span class="tag kind">Internals</span>
- <a class="more" href="/blog/hire-manifest-untrusted-input/" aria-label="Read: Treating a Hire Manifest as Untrusted Input">Read →</a>
- </div>
- </div>
-</article>
</div>
</section>
diff --git a/docs/blog/rendering-many-live-terminals-performance/index.html b/docs/blog/rendering-many-live-terminals-performance/index.html
index bb1eaa5a..12dfdf0f 100644
--- a/docs/blog/rendering-many-live-terminals-performance/index.html
+++ b/docs/blog/rendering-many-live-terminals-performance/index.html
@@ -310,6 +310,22 @@ to run many real terminals without melting your CPU; it’s free and open source
<h2>Related in Internals</h2>
<div class="post-grid">
<article class="card t-internals">
+ <a class="thumb t-internals" href="/blog/the-spend-counter-that-went-back-to-zero/" aria-hidden="true" tabindex="-1"><span class="thumb-ph"><em class="ph-glyph" aria-hidden="true">✶</em><span>INTERNALS</span></span></a>
+ <div class="body">
+ <div class="meta">
+ <time datetime="2026-08-22">Aug 22, 2026</time>
+ <span class="dot" aria-hidden="true"></span>
+ <span>10 min</span>
+ </div>
+ <h3><a href="/blog/the-spend-counter-that-went-back-to-zero/">The Spend Counter That Went Back to Zero</a></h3>
+ <p class="dek">Our own floor was under reporting what it cost by 59 percent. The counter was cumulative since process start, the app restarts, and the session id stayed the same. Here is how a monotonic invariant let us recover the real number from an append-only log.</p>
+ <div class="foot">
+ <span class="tag kind">Internals</span>
+ <a class="more" href="/blog/the-spend-counter-that-went-back-to-zero/" aria-label="Read: The Spend Counter That Went Back to Zero">Read →</a>
+ </div>
+ </div>
+</article>
+<article class="card t-internals">
<a class="thumb t-internals" href="/blog/the-newline-that-silenced-windows-agents/" aria-hidden="true" tabindex="-1"><img src="/blog/assets/media/the-newline-that-silenced-windows-agents/hero.png" alt="" loading="lazy" decoding="async" /></a>
<div class="body">
<div class="meta">
@@ -341,22 +357,6 @@ to run many real terminals without melting your CPU; it’s free and open source
</div>
</div>
</article>
-<article class="card t-internals">
- <a class="thumb t-internals" href="/blog/hire-manifest-untrusted-input/" aria-hidden="true" tabindex="-1"><img src="/blog/assets/media/hire-manifest-untrusted-input/hero.png" alt="" loading="lazy" decoding="async" /></a>
- <div class="body">
- <div class="meta">
- <time datetime="2026-06-15">Jun 15, 2026</time>
- <span class="dot" aria-hidden="true"></span>
- <span>12 min</span>
- </div>
- <h3><a href="/blog/hire-manifest-untrusted-input/">Treating a Hire Manifest as Untrusted Input</a></h3>
- <p class="dek">A shareable agent-config manifest is attacker input. How Munder Difflin&#39;s import pipeline stays inert: no auto-spawn, default-deny flags, and an SSRF-safe bounded fetch.</p>
- <div class="foot">
- <span class="tag kind">Internals</span>
- <a class="more" href="/blog/hire-manifest-untrusted-input/" aria-label="Read: Treating a Hire Manifest as Untrusted Input">Read →</a>
- </div>
- </div>
-</article>
</div>
</section>
diff --git a/docs/blog/single-committer-git-pattern/index.html b/docs/blog/single-committer-git-pattern/index.html
index 2e7c738c..449d4613 100644
--- a/docs/blog/single-committer-git-pattern/index.html
+++ b/docs/blog/single-committer-git-pattern/index.html
@@ -317,6 +317,22 @@ never corrupt their own state; it’s free and open source.</p>
<h2>Related in Internals</h2>
<div class="post-grid">
<article class="card t-internals">
+ <a class="thumb t-internals" href="/blog/the-spend-counter-that-went-back-to-zero/" aria-hidden="true" tabindex="-1"><span class="thumb-ph"><em class="ph-glyph" aria-hidden="true">✶</em><span>INTERNALS</span></span></a>
+ <div class="body">
+ <div class="meta">
+ <time datetime="2026-08-22">Aug 22, 2026</time>
+ <span class="dot" aria-hidden="true"></span>
+ <span>10 min</span>
+ </div>
+ <h3><a href="/blog/the-spend-counter-that-went-back-to-zero/">The Spend Counter That Went Back to Zero</a></h3>
+ <p class="dek">Our own floor was under reporting what it cost by 59 percent. The counter was cumulative since process start, the app restarts, and the session id stayed the same. Here is how a monotonic invariant let us recover the real number from an append-only log.</p>
+ <div class="foot">
+ <span class="tag kind">Internals</span>
+ <a class="more" href="/blog/the-spend-counter-that-went-back-to-zero/" aria-label="Read: The Spend Counter That Went Back to Zero">Read →</a>
+ </div>
+ </div>
+</article>
+<article class="card t-internals">
<a class="thumb t-internals" href="/blog/the-newline-that-silenced-windows-agents/" aria-hidden="true" tabindex="-1"><img src="/blog/assets/media/the-newline-that-silenced-windows-agents/hero.png" alt="" loading="lazy" decoding="async" /></a>
<div class="body">
<div class="meta">
@@ -348,22 +364,6 @@ never corrupt their own state; it’s free and open source.</p>
</div>
</div>
</article>
-<article class="card t-internals">
- <a class="thumb t-internals" href="/blog/hire-manifest-untrusted-input/" aria-hidden="true" tabindex="-1"><img src="/blog/assets/media/hire-manifest-untrusted-input/hero.png" alt="" loading="lazy" decoding="async" /></a>
- <div class="body">
- <div class="meta">
- <time datetime="2026-06-15">Jun 15, 2026</time>
- <span class="dot" aria-hidden="true"></span>
- <span>12 min</span>
- </div>
- <h3><a href="/blog/hire-manifest-untrusted-input/">Treating a Hire Manifest as Untrusted Input</a></h3>
- <p class="dek">A shareable agent-config manifest is attacker input. How Munder Difflin&#39;s import pipeline stays inert: no auto-spawn, default-deny flags, and an SSRF-safe bounded fetch.</p>
- <div class="foot">
- <span class="tag kind">Internals</span>
- <a class="more" href="/blog/hire-manifest-untrusted-input/" aria-label="Read: Treating a Hire Manifest as Untrusted Input">Read →</a>
- </div>
- </div>
-</article>
</div>
</section>
diff --git a/docs/blog/tags/cost/index.html b/docs/blog/tags/cost/index.html
index 83d0d91e..d183cd20 100644
--- a/docs/blog/tags/cost/index.html
+++ b/docs/blog/tags/cost/index.html
@@ -80,11 +80,27 @@
<header class="page-head wrap">
<p class="eyebrow">Tag</p>
<h1>#Cost</h1>
- <p class="lead">7 posts tagged <strong>Cost</strong>.</p>
+ <p class="lead">8 posts tagged <strong>Cost</strong>.</p>
</header>
<section class="wrap">
<div class="post-grid">
- <article class="card t-guides">
+ <article class="card t-internals">
+ <a class="thumb t-internals" href="/blog/the-spend-counter-that-went-back-to-zero/" aria-hidden="true" tabindex="-1"><span class="thumb-ph"><em class="ph-glyph" aria-hidden="true">✶</em><span>INTERNALS</span></span></a>
+ <div class="body">
+ <div class="meta">
+ <time datetime="2026-08-22">Aug 22, 2026</time>
+ <span class="dot" aria-hidden="true"></span>
+ <span>10 min</span>
+ </div>
+ <h3><a href="/blog/the-spend-counter-that-went-back-to-zero/">The Spend Counter That Went Back to Zero</a></h3>
+ <p class="dek">Our own floor was under reporting what it cost by 59 percent. The counter was cumulative since process start, the app restarts, and the session id stayed the same. Here is how a monotonic invariant let us recover the real number from an append-only log.</p>
+ <div class="foot">
+ <span class="tag kind">Internals</span>
+ <a class="more" href="/blog/the-spend-counter-that-went-back-to-zero/" aria-label="Read: The Spend Counter That Went Back to Zero">Read →</a>
+ </div>
+ </div>
+</article>
+<article class="card t-guides">
<a class="thumb t-guides" href="/blog/command-center-guide/" aria-hidden="true" tabindex="-1"><img src="/blog/assets/media/command-center-guide/hero.png" alt="" loading="lazy" decoding="async" /></a>
<div class="body">
<div class="meta">
diff --git a/docs/blog/tags/debugging/index.html b/docs/blog/tags/debugging/index.html
index 9319c5c6..0611bdeb 100644
--- a/docs/blog/tags/debugging/index.html
+++ b/docs/blog/tags/debugging/index.html
@@ -80,11 +80,27 @@
<header class="page-head wrap">
<p class="eyebrow">Tag</p>
<h1>#Debugging</h1>
- <p class="lead">3 posts tagged <strong>Debugging</strong>.</p>
+ <p class="lead">4 posts tagged <strong>Debugging</strong>.</p>
</header>
<section class="wrap">
<div class="post-grid">
<article class="card t-internals">
+ <a class="thumb t-internals" href="/blog/the-spend-counter-that-went-back-to-zero/" aria-hidden="true" tabindex="-1"><span class="thumb-ph"><em class="ph-glyph" aria-hidden="true">✶</em><span>INTERNALS</span></span></a>
+ <div class="body">
+ <div class="meta">
+ <time datetime="2026-08-22">Aug 22, 2026</time>
+ <span class="dot" aria-hidden="true"></span>
+ <span>10 min</span>
+ </div>
+ <h3><a href="/blog/the-spend-counter-that-went-back-to-zero/">The Spend Counter That Went Back to Zero</a></h3>
+ <p class="dek">Our own floor was under reporting what it cost by 59 percent. The counter was cumulative since process start, the app restarts, and the session id stayed the same. Here is how a monotonic invariant let us recover the real number from an append-only log.</p>
+ <div class="foot">
+ <span class="tag kind">Internals</span>
+ <a class="more" href="/blog/the-spend-counter-that-went-back-to-zero/" aria-label="Read: The Spend Counter That Went Back to Zero">Read →</a>
+ </div>
+ </div>
+</article>
+<article class="card t-internals">
<a class="thumb t-internals" href="/blog/the-newline-that-silenced-windows-agents/" aria-hidden="true" tabindex="-1"><img src="/blog/assets/media/the-newline-that-silenced-windows-agents/hero.png" alt="" loading="lazy" decoding="async" /></a>
<div class="body">
<div class="meta">
diff --git a/docs/blog/tags/internals/index.html b/docs/blog/tags/internals/index.html
index aa47843d..e6ad57cb 100644
--- a/docs/blog/tags/internals/index.html
+++ b/docs/blog/tags/internals/index.html
@@ -80,11 +80,27 @@
<header class="page-head wrap">
<p class="eyebrow">Tag</p>
<h1>#Internals</h1>
- <p class="lead">25 posts tagged <strong>Internals</strong>.</p>
+ <p class="lead">26 posts tagged <strong>Internals</strong>.</p>
</header>
<section class="wrap">
<div class="post-grid">
<article class="card t-internals">
+ <a class="thumb t-internals" href="/blog/the-spend-counter-that-went-back-to-zero/" aria-hidden="true" tabindex="-1"><span class="thumb-ph"><em class="ph-glyph" aria-hidden="true">✶</em><span>INTERNALS</span></span></a>
+ <div class="body">
+ <div class="meta">
+ <time datetime="2026-08-22">Aug 22, 2026</time>
+ <span class="dot" aria-hidden="true"></span>
+ <span>10 min</span>
+ </div>
+ <h3><a href="/blog/the-spend-counter-that-went-back-to-zero/">The Spend Counter That Went Back to Zero</a></h3>
+ <p class="dek">Our own floor was under reporting what it cost by 59 percent. The counter was cumulative since process start, the app restarts, and the session id stayed the same. Here is how a monotonic invariant let us recover the real number from an append-only log.</p>
+ <div class="foot">
+ <span class="tag kind">Internals</span>
+ <a class="more" href="/blog/the-spend-counter-that-went-back-to-zero/" aria-label="Read: The Spend Counter That Went Back to Zero">Read →</a>
+ </div>
+ </div>
+</article>
+<article class="card t-internals">
<a class="thumb t-internals" href="/blog/the-newline-that-silenced-windows-agents/" aria-hidden="true" tabindex="-1"><img src="/blog/assets/media/the-newline-that-silenced-windows-agents/hero.png" alt="" loading="lazy" decoding="async" /></a>
<div class="body">
<div class="meta">
diff --git a/docs/blog/tags/postmortem/index.html b/docs/blog/tags/postmortem/index.html
index 6e8978e6..7a3f4993 100644
--- a/docs/blog/tags/postmortem/index.html
+++ b/docs/blog/tags/postmortem/index.html
@@ -80,11 +80,27 @@
<header class="page-head wrap">
<p class="eyebrow">Tag</p>
<h1>#Postmortem</h1>
- <p class="lead">1 post tagged <strong>Postmortem</strong>.</p>
+ <p class="lead">2 posts tagged <strong>Postmortem</strong>.</p>
</header>
<section class="wrap">
<div class="post-grid">
<article class="card t-internals">
+ <a class="thumb t-internals" href="/blog/the-spend-counter-that-went-back-to-zero/" aria-hidden="true" tabindex="-1"><span class="thumb-ph"><em class="ph-glyph" aria-hidden="true">✶</em><span>INTERNALS</span></span></a>
+ <div class="body">
+ <div class="meta">
+ <time datetime="2026-08-22">Aug 22, 2026</time>
+ <span class="dot" aria-hidden="true"></span>
+ <span>10 min</span>
+ </div>
+ <h3><a href="/blog/the-spend-counter-that-went-back-to-zero/">The Spend Counter That Went Back to Zero</a></h3>
+ <p class="dek">Our own floor was under reporting what it cost by 59 percent. The counter was cumulative since process start, the app restarts, and the session id stayed the same. Here is how a monotonic invariant let us recover the real number from an append-only log.</p>
+ <div class="foot">
+ <span class="tag kind">Internals</span>
+ <a class="more" href="/blog/the-spend-counter-that-went-back-to-zero/" aria-label="Read: The Spend Counter That Went Back to Zero">Read →</a>
+ </div>
+ </div>
+</article>
+<article class="card t-internals">
<a class="thumb t-internals" href="/blog/the-newline-that-silenced-windows-agents/" aria-hidden="true" tabindex="-1"><img src="/blog/assets/media/the-newline-that-silenced-windows-agents/hero.png" alt="" loading="lazy" decoding="async" /></a>
<div class="body">
<div class="meta">
diff --git a/docs/blog/tags/telemetry/index.html b/docs/blog/tags/telemetry/index.html
new file mode 100644
index 00000000..063a5de2
--- /dev/null
+++ b/docs/blog/tags/telemetry/index.html
@@ -0,0 +1,159 @@
+<!doctype html>
+<html lang="en">
+<head>
+<meta charset="UTF-8" />
+<meta name="viewport" content="width=device-width, initial-scale=1.0" />
+<title>Telemetry — Munder Difflin Blog</title>
+<meta name="description" content="Munder Difflin blog posts tagged Telemetry." />
+<link rel="canonical" href="https://munderdiffl.in/blog/tags/telemetry/" />
+
+<link rel="icon" type="image/png" href="https://munderdiffl.in/logo.png" />
+<link rel="apple-touch-icon" href="https://munderdiffl.in/logo.png" />
+<meta name="theme-color" content="#F5F2E8" />
+
+<!-- Open Graph -->
+<meta property="og:site_name" content="Munder Difflin Blog" />
+<meta property="og:type" content="website" />
+<meta property="og:title" content="Telemetry — Munder Difflin Blog" />
+<meta property="og:description" content="Munder Difflin blog posts tagged Telemetry." />
+<meta property="og:url" content="https://munderdiffl.in/blog/tags/telemetry/" />
+<meta property="og:image" content="https://munderdiffl.in/media/og.png" />
+<meta property="og:locale" content="en_US" />
+
+
+<!-- Twitter -->
+<meta name="twitter:card" content="summary_large_image" />
+<meta name="twitter:title" content="Telemetry — Munder Difflin Blog" />
+<meta name="twitter:description" content="Munder Difflin blog posts tagged Telemetry." />
+<meta name="twitter:image" content="https://munderdiffl.in/media/og.png" />
+
+<link rel="alternate" type="application/atom+xml" title="Munder Difflin Blog" href="https://munderdiffl.in/blog/feed.xml" />
+<link rel="preconnect" href="https://fonts.googleapis.com" />
+<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
+<link href="https://fonts.googleapis.com/css2?family=Fraunces:opsz,[email protected],500;9..144,600;9..144,700;9..144,900&amp;family=Source+Serif+4:opsz,[email protected],400;8..60,600;8..60,700&amp;family=Space+Grotesk:wght@500;600;700&amp;family=JetBrains+Mono:wght@400;600&amp;display=swap" rel="stylesheet" />
+<link rel="stylesheet" href="/blog/assets/blog-press.css" />
+
+<script>
+ // Anonymous blog analytics (PostHog) — same posture as the main site and the
+ // app's TELEMETRY.md: public write-only token ('' = inert), anonymous-only
+ // (person_profiles 'never'), no autocapture/recording, DNT respected.
+ (function () {
+ var PH_KEY = 'phc_qJzsokwcbtTGHemnvywR3nSqivNNgMjHeNVEWkZNydFB';
+ if (!PH_KEY || navigator.doNotTrack === '1') return;
+ var s = document.createElement('script');
+ s.async = true;
+ s.src = 'https://us-assets.i.posthog.com/static/array.js';
+ s.onload = function () {
+ if (!window.posthog) return;
+ window.posthog.init(PH_KEY, {
+ api_host: 'https://us.i.posthog.com',
+ person_profiles: 'never',
+ autocapture: false,
+ disable_session_recording: true,
+ respect_dnt: true
+ });
+ };
+ document.head.appendChild(s);
+ })();
+</script>
+</head>
+<body class="theme-press">
+<a class="skip-link" href="#main">Skip to content</a>
+<nav id="nav">
+ <a class="brand" href="https://munderdiffl.in" aria-label="Munder Difflin home">
+ <img class="brand-logo" src="https://munderdiffl.in/logo.png" width="1318" height="840" alt="Munder Difflin, Inc. — Multi-Agent Harness" />
+ </a>
+ <span class="spacer"></span>
+ <div class="links">
+ <a href="/blog/">Latest</a>
+ <a href="/blog/topics/">Topics</a>
+ <a href="/blog/about/">About</a>
+ <a href="https://munderdiffl.in">↗ Product</a>
+ </div>
+ <div class="nav-actions">
+ <a class="btn sm" href="https://munderdiffl.in/blog/feed.xml" aria-label="RSS feed">⤵ RSS</a>
+ <a class="btn sm primary" href="https://munderdiffl.in/#install">⤓ Download</a>
+ </div>
+</nav>
+
+<main id="main">
+<header class="page-head wrap">
+ <p class="eyebrow">Tag</p>
+ <h1>#Telemetry</h1>
+ <p class="lead">1 post tagged <strong>Telemetry</strong>.</p>
+</header>
+<section class="wrap">
+ <div class="post-grid">
+ <article class="card t-internals">
+ <a class="thumb t-internals" href="/blog/the-spend-counter-that-went-back-to-zero/" aria-hidden="true" tabindex="-1"><span class="thumb-ph"><em class="ph-glyph" aria-hidden="true">✶</em><span>INTERNALS</span></span></a>
+ <div class="body">
+ <div class="meta">
+ <time datetime="2026-08-22">Aug 22, 2026</time>
+ <span class="dot" aria-hidden="true"></span>
+ <span>10 min</span>
+ </div>
+ <h3><a href="/blog/the-spend-counter-that-went-back-to-zero/">The Spend Counter That Went Back to Zero</a></h3>
+ <p class="dek">Our own floor was under reporting what it cost by 59 percent. The counter was cumulative since process start, the app restarts, and the session id stayed the same. Here is how a monotonic invariant let us recover the real number from an append-only log.</p>
+ <div class="foot">
+ <span class="tag kind">Internals</span>
+ <a class="more" href="/blog/the-spend-counter-that-went-back-to-zero/" aria-label="Read: The Spend Counter That Went Back to Zero">Read →</a>
+ </div>
+ </div>
+</article>
+
+ </div>
+</section>
+
+
+</main>
+<footer class="site-foot">
+ <div class="wrap">
+ <div class="foot-top">
+ <a class="foot-brand brand" href="https://munderdiffl.in" aria-label="Munder Difflin home">
+ <img class="brand-logo" src="https://munderdiffl.in/logo.png" width="1318" height="840" alt="Munder Difflin, Inc. — Multi-Agent Harness" />
+ </a>
+ <div class="foot-links">
+ <a href="/blog/">Latest</a>
+ <a href="/blog/topics/">Topics</a>
+ <a href="/blog/about/">About</a>
+ <a href="https://munderdiffl.in/blog/feed.xml">RSS</a>
+ <a href="https://github.com/chaitanyagiri/munder-difflin">GitHub</a>
+ <a href="https://munderdiffl.in">munderdiffl.in ↗</a>
+ </div>
+ </div>
+ <div class="foot-meta">
+ © 2026 Munder Difflin · Local-first · MIT-licensed ·
+ Built on <a href="https://munderdiffl.in">Electron, React, Pixi.js, xterm.js &amp; node-pty</a>.
+ Run an office of agents while you sleep.
+ </div>
+ </div>
+</footer>
+
+<script>
+ // sticky-nav border on scroll
+ (function () {
+ var nav = document.getElementById('nav');
+ if (!nav) return;
+ var onScroll = function () { nav.classList.toggle('scrolled', window.scrollY > 8); };
+ onScroll(); window.addEventListener('scroll', onScroll, { passive: true });
+ })();
+ // YouTube click-to-load: thumbnail button → youtube-nocookie iframe
+ (function () {
+ document.addEventListener('click', function (e) {
+ var btn = e.target.closest('.yt-load');
+ if (!btn) return;
+ var box = btn.closest('.yt');
+ var id = box && box.getAttribute('data-yt');
+ if (!id) return;
+ var frame = document.createElement('iframe');
+ frame.src = 'https://www.youtube-nocookie.com/embed/' + id + '?autoplay=1';
+ frame.title = box.getAttribute('data-title') || 'YouTube video';
+ frame.allow = 'accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share';
+ frame.setAttribute('allowfullscreen', '');
+ box.replaceChildren(frame);
+ });
+ })();
+</script>
+
+</body>
+</html>
diff --git a/docs/blog/the-hook-shim-pattern/index.html b/docs/blog/the-hook-shim-pattern/index.html
index b2cdce26..400ff542 100644
--- a/docs/blog/the-hook-shim-pattern/index.html
+++ b/docs/blog/the-hook-shim-pattern/index.html
@@ -306,6 +306,22 @@ at the mercy of the bridge.
<h2>Related in Internals</h2>
<div class="post-grid">
<article class="card t-internals">
+ <a class="thumb t-internals" href="/blog/the-spend-counter-that-went-back-to-zero/" aria-hidden="true" tabindex="-1"><span class="thumb-ph"><em class="ph-glyph" aria-hidden="true">✶</em><span>INTERNALS</span></span></a>
+ <div class="body">
+ <div class="meta">
+ <time datetime="2026-08-22">Aug 22, 2026</time>
+ <span class="dot" aria-hidden="true"></span>
+ <span>10 min</span>
+ </div>
+ <h3><a href="/blog/the-spend-counter-that-went-back-to-zero/">The Spend Counter That Went Back to Zero</a></h3>
+ <p class="dek">Our own floor was under reporting what it cost by 59 percent. The counter was cumulative since process start, the app restarts, and the session id stayed the same. Here is how a monotonic invariant let us recover the real number from an append-only log.</p>
+ <div class="foot">
+ <span class="tag kind">Internals</span>
+ <a class="more" href="/blog/the-spend-counter-that-went-back-to-zero/" aria-label="Read: The Spend Counter That Went Back to Zero">Read →</a>
+ </div>
+ </div>
+</article>
+<article class="card t-internals">
<a class="thumb t-internals" href="/blog/the-newline-that-silenced-windows-agents/" aria-hidden="true" tabindex="-1"><img src="/blog/assets/media/the-newline-that-silenced-windows-agents/hero.png" alt="" loading="lazy" decoding="async" /></a>
<div class="body">
<div class="meta">
@@ -337,22 +353,6 @@ at the mercy of the bridge.
</div>
</div>
</article>
-<article class="card t-internals">
- <a class="thumb t-internals" href="/blog/hire-manifest-untrusted-input/" aria-hidden="true" tabindex="-1"><img src="/blog/assets/media/hire-manifest-untrusted-input/hero.png" alt="" loading="lazy" decoding="async" /></a>
- <div class="body">
- <div class="meta">
- <time datetime="2026-06-15">Jun 15, 2026</time>
- <span class="dot" aria-hidden="true"></span>
- <span>12 min</span>
- </div>
- <h3><a href="/blog/hire-manifest-untrusted-input/">Treating a Hire Manifest as Untrusted Input</a></h3>
- <p class="dek">A shareable agent-config manifest is attacker input. How Munder Difflin&#39;s import pipeline stays inert: no auto-spawn, default-deny flags, and an SSRF-safe bounded fetch.</p>
- <div class="foot">
- <span class="tag kind">Internals</span>
- <a class="more" href="/blog/hire-manifest-untrusted-input/" aria-label="Read: Treating a Hire Manifest as Untrusted Input">Read →</a>
- </div>
- </div>
-</article>
</div>
</section>
diff --git a/docs/blog/the-newline-that-silenced-windows-agents/index.html b/docs/blog/the-newline-that-silenced-windows-agents/index.html
index eeacbad9..7f32c3f3 100644
--- a/docs/blog/the-newline-that-silenced-windows-agents/index.html
+++ b/docs/blog/the-newline-that-silenced-windows-agents/index.html
@@ -276,6 +276,22 @@ the target is a <code>.cmd</code>. We’ll wait. It’s probably ten minutes and
<h2>Related in Internals</h2>
<div class="post-grid">
<article class="card t-internals">
+ <a class="thumb t-internals" href="/blog/the-spend-counter-that-went-back-to-zero/" aria-hidden="true" tabindex="-1"><span class="thumb-ph"><em class="ph-glyph" aria-hidden="true">✶</em><span>INTERNALS</span></span></a>
+ <div class="body">
+ <div class="meta">
+ <time datetime="2026-08-22">Aug 22, 2026</time>
+ <span class="dot" aria-hidden="true"></span>
+ <span>10 min</span>
+ </div>
+ <h3><a href="/blog/the-spend-counter-that-went-back-to-zero/">The Spend Counter That Went Back to Zero</a></h3>
+ <p class="dek">Our own floor was under reporting what it cost by 59 percent. The counter was cumulative since process start, the app restarts, and the session id stayed the same. Here is how a monotonic invariant let us recover the real number from an append-only log.</p>
+ <div class="foot">
+ <span class="tag kind">Internals</span>
+ <a class="more" href="/blog/the-spend-counter-that-went-back-to-zero/" aria-label="Read: The Spend Counter That Went Back to Zero">Read →</a>
+ </div>
+ </div>
+</article>
+<article class="card t-internals">
<a class="thumb t-internals" href="/blog/why-our-auto-update-never-ran/" aria-hidden="true" tabindex="-1"><img src="/blog/assets/media/why-our-auto-update-never-ran/hero.png" alt="" loading="lazy" decoding="async" /></a>
<div class="body">
<div class="meta">
@@ -307,22 +323,6 @@ the target is a <code>.cmd</code>. We’ll wait. It’s probably ten minutes and
</div>
</div>
</article>
-<article class="card t-internals">
- <a class="thumb t-internals" href="/blog/compressing-agent-memory/" aria-hidden="true" tabindex="-1"><img src="/blog/assets/media/compressing-agent-memory/hero.png" alt="" loading="lazy" decoding="async" /></a>
- <div class="body">
- <div class="meta">
- <time datetime="2026-06-05">Jun 5, 2026</time>
- <span class="dot" aria-hidden="true"></span>
- <span>5 min</span>
- </div>
- <h3><a href="/blog/compressing-agent-memory/">Compressing Agent Memory Without Losing the Original</a></h3>
- <p class="dek">How and why to compress an agent&#39;s long-term memory: the toolbox, the lossy trap, and keeping a lossless original beside a compact copy.</p>
- <div class="foot">
- <span class="tag kind">Internals</span>
- <a class="more" href="/blog/compressing-agent-memory/" aria-label="Read: Compressing Agent Memory Without Losing the Original">Read →</a>
- </div>
- </div>
-</article>
</div>
</section>
diff --git a/docs/blog/the-spend-counter-that-went-back-to-zero/index.html b/docs/blog/the-spend-counter-that-went-back-to-zero/index.html
new file mode 100644
index 00000000..f98ac725
--- /dev/null
+++ b/docs/blog/the-spend-counter-that-went-back-to-zero/index.html
@@ -0,0 +1,493 @@
+<!doctype html>
+<html lang="en">
+<head>
+<meta charset="UTF-8" />
+<meta name="viewport" content="width=device-width, initial-scale=1.0" />
+<title>The Spend Counter That Went Back to Zero — Munder Difflin Blog</title>
+<meta name="description" content="Our own floor was under reporting what it cost by 59 percent. The counter was cumulative since process start, the app restarts, and the session id stayed the same. Here is how a monotonic invariant let us recover the real number from an append-only log." />
+<link rel="canonical" href="https://munderdiffl.in/blog/the-spend-counter-that-went-back-to-zero/" />
+
+<link rel="icon" type="image/png" href="https://munderdiffl.in/logo.png" />
+<link rel="apple-touch-icon" href="https://munderdiffl.in/logo.png" />
+<meta name="theme-color" content="#F5F2E8" />
+
+<!-- Open Graph -->
+<meta property="og:site_name" content="Munder Difflin Blog" />
+<meta property="og:type" content="article" />
+<meta property="og:title" content="The Spend Counter That Went Back to Zero — Munder Difflin Blog" />
+<meta property="og:description" content="Our own floor was under reporting what it cost by 59 percent. The counter was cumulative since process start, the app restarts, and the session id stayed the same. Here is how a monotonic invariant let us recover the real number from an append-only log." />
+<meta property="og:url" content="https://munderdiffl.in/blog/the-spend-counter-that-went-back-to-zero/" />
+<meta property="og:image" content="https://munderdiffl.in/media/og.png" />
+<meta property="og:locale" content="en_US" />
+<meta property="article:published_time" content="2026-08-22T00:00:00.000Z" />
+<meta property="article:author" content="Chaitanya Giri" />
+<meta property="article:tag" content="Internals" />
+<meta property="article:tag" content="Cost" />
+<meta property="article:tag" content="Telemetry" />
+<meta property="article:tag" content="Debugging" />
+<meta property="article:tag" content="Postmortem" />
+
+
+<!-- Twitter -->
+<meta name="twitter:card" content="summary_large_image" />
+<meta name="twitter:title" content="The Spend Counter That Went Back to Zero — Munder Difflin Blog" />
+<meta name="twitter:description" content="Our own floor was under reporting what it cost by 59 percent. The counter was cumulative since process start, the app restarts, and the session id stayed the same. Here is how a monotonic invariant let us recover the real number from an append-only log." />
+<meta name="twitter:image" content="https://munderdiffl.in/media/og.png" />
+
+<link rel="alternate" type="application/atom+xml" title="Munder Difflin Blog" href="https://munderdiffl.in/blog/feed.xml" />
+<link rel="preconnect" href="https://fonts.googleapis.com" />
+<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
+<link href="https://fonts.googleapis.com/css2?family=Fraunces:opsz,[email protected],500;9..144,600;9..144,700;9..144,900&amp;family=Source+Serif+4:opsz,[email protected],400;8..60,600;8..60,700&amp;family=Space+Grotesk:wght@500;600;700&amp;family=JetBrains+Mono:wght@400;600&amp;display=swap" rel="stylesheet" />
+<link rel="stylesheet" href="/blog/assets/blog-press.css" />
+
+<script type="application/ld+json">
+{
+ "@context": "https://schema.org",
+ "@type": "BlogPosting",
+ "headline": "The Spend Counter That Went Back to Zero",
+ "description": "Our own floor was under reporting what it cost by 59 percent. The counter was cumulative since process start, the app restarts, and the session id stayed the same. Here is how a monotonic invariant let us recover the real number from an append-only log.",
+ "image": ["https://munderdiffl.in/media/og.png"],
+ "datePublished": "2026-08-22T00:00:00.000Z",
+ "dateModified": "2026-08-22T00:00:00.000Z",
+ "author": { "@type": "Person", "name": "Chaitanya Giri" },
+ "publisher": {
+ "@type": "Organization",
+ "name": "Munder Difflin",
+ "logo": { "@type": "ImageObject", "url": "https://munderdiffl.in/logo.png" }
+ },
+ "mainEntityOfPage": { "@type": "WebPage", "@id": "https://munderdiffl.in/blog/the-spend-counter-that-went-back-to-zero/" },
+ "keywords": "ai agent cost tracking bug, cumulative counter reset, append-only ledger recovery, electron main thread blocking read, monotonic counter invariant, agent spend tracking",
+ "articleSection": "Internals",
+ "inLanguage": "en-US",
+ "url": "https://munderdiffl.in/blog/the-spend-counter-that-went-back-to-zero/"
+}
+</script>
+<script type="application/ld+json">
+{
+ "@context": "https://schema.org",
+ "@type": "BreadcrumbList",
+ "itemListElement": [
+ { "@type": "ListItem", "position": 1, "name": "Home", "item": "https://munderdiffl.in/" },
+ { "@type": "ListItem", "position": 2, "name": "Blog", "item": "https://munderdiffl.in/blog/" },
+ { "@type": "ListItem", "position": 3, "name": "The Spend Counter That Went Back to Zero", "item": "https://munderdiffl.in/blog/the-spend-counter-that-went-back-to-zero/" }
+ ]
+}
+</script>
+
+<script type="application/ld+json">
+{
+ "@context": "https://schema.org",
+ "@type": "FAQPage",
+ "mainEntity": [
+ { "@type": "Question", "name": "What was wrong with cost reporting in Munder Difflin?", "acceptedAnswer": { "@type": "Answer", "text": "The per-agent spend figure counted from the moment the app process started, not from the moment the agent started. Restarting the app rebuilt the in-memory accumulator empty, so the counter began again at zero under the same session id. Anything reading the latest value read one app session's worth of spend and called it the total. On our own floor that hid 59 percent of it." } },
+ { "@type": "Question", "name": "Why did nobody notice a number that was wrong by more than half?", "acceptedAnswer": { "@type": "Answer", "text": "Because it never looked wrong. Inside any single run the counter only climbed, so it behaved exactly like a lifetime total. Nothing threw, nothing went negative, nothing came back NaN. The reset is only visible if you look at the whole history at once, and the number is the kind you glance at rather than reconcile." } },
+ { "@type": "Question", "name": "How do you recover a total from a counter that resets?", "acceptedAnswer": { "@type": "Answer", "text": "You use the invariant the counter already gives you. Within one agent and one session the value can only go up, so any decrease is a restart and nothing else. Lifetime is the sum of the high-water mark of each segment that a reset closed, plus the high-water mark of the segment still open. Every sample was already on disk in an append-only ledger, so the past was recoverable without a migration." } },
+ { "@type": "Question", "name": "Why not ignore small drops as noise?", "acceptedAnswer": { "@type": "Answer", "text": "We looked at that and rejected it. Real restarts in our own ledger fall from peaks under a dollar straight to zero, so a one dollar threshold would have silently missed them. A cumulative counter has no legitimate reason to fall at all, so the threshold bought tidiness and cost coverage. Any decrease counts, with a float epsilon and nothing more." } }
+
+ ]
+}
+</script>
+
+
+<script>
+ // Anonymous blog analytics (PostHog) — same posture as the main site and the
+ // app's TELEMETRY.md: public write-only token ('' = inert), anonymous-only
+ // (person_profiles 'never'), no autocapture/recording, DNT respected.
+ (function () {
+ var PH_KEY = 'phc_qJzsokwcbtTGHemnvywR3nSqivNNgMjHeNVEWkZNydFB';
+ if (!PH_KEY || navigator.doNotTrack === '1') return;
+ var s = document.createElement('script');
+ s.async = true;
+ s.src = 'https://us-assets.i.posthog.com/static/array.js';
+ s.onload = function () {
+ if (!window.posthog) return;
+ window.posthog.init(PH_KEY, {
+ api_host: 'https://us.i.posthog.com',
+ person_profiles: 'never',
+ autocapture: false,
+ disable_session_recording: true,
+ respect_dnt: true
+ });
+ };
+ document.head.appendChild(s);
+ })();
+</script>
+</head>
+<body class="theme-press">
+<a class="skip-link" href="#main">Skip to content</a>
+<nav id="nav">
+ <a class="brand" href="https://munderdiffl.in" aria-label="Munder Difflin home">
+ <img class="brand-logo" src="https://munderdiffl.in/logo.png" width="1318" height="840" alt="Munder Difflin, Inc. — Multi-Agent Harness" />
+ </a>
+ <span class="spacer"></span>
+ <div class="links">
+ <a href="/blog/">Latest</a>
+ <a href="/blog/topics/">Topics</a>
+ <a href="/blog/about/">About</a>
+ <a href="https://munderdiffl.in">↗ Product</a>
+ </div>
+ <div class="nav-actions">
+ <a class="btn sm" href="https://munderdiffl.in/blog/feed.xml" aria-label="RSS feed">⤵ RSS</a>
+ <a class="btn sm primary" href="https://munderdiffl.in/#install">⤓ Download</a>
+ </div>
+</nav>
+
+<main id="main">
+
+<article class="t-internals">
+ <header class="post-head wrap">
+ <nav class="crumbs" aria-label="Breadcrumb">
+ <a href="/blog/">Blog</a>
+ <span>/</span>
+ <a href="/blog/topics/internals/">Internals</a>
+ </nav>
+ <h1>The Spend Counter That Went Back to Zero</h1>
+ <p class="dek">Our own floor was under reporting what it cost by 59 percent. The counter was cumulative since process start, the app restarts, and the session id stayed the same. Here is how a monotonic invariant let us recover the real number from an append-only log.</p>
+ <div class="byline">
+ <span class="av" aria-hidden="true">CG</span>
+ <strong>Chaitanya Giri</strong>
+ <span class="dot" aria-hidden="true">·</span>
+ <time datetime="2026-08-22">Aug 22, 2026</time>
+ <span class="dot" aria-hidden="true">·</span>
+ <span>10 min read</span>
+ <span class="tag kind">Internals</span>
+ </div>
+ </header>
+
+ <div class="hero-wrap wrap"><figure class="fig fig-placeholder t-internals fig-hero" role="img" aria-label="Illustration: The Spend Counter That Went Back to Zero"><div class="ph-art" aria-hidden="true"><span class="ph-glyph">✶</span><span class="ph-note">illustration on its way</span></div></figure></div>
+
+ <div class="post-wrap wrap">
+ <div class="prose">
+ <div class="callout tldr"><span class="ic">TL;DR</span><p>Munder Difflin tells you what your
+floor of agents costs. That number was wrong by <strong>59 percent</strong>, and it had been
+wrong quietly, because it was a counter that measured from process start while its label said
+lifetime. Restart the app and it began again at zero under the same session id. The fix is not a
+new counter. It is reading the reset back out of the log we already had, using the one property a
+cumulative counter cannot break: it only goes up.</p></div>
+<p>You can build an agent harness that does everything right and still hand people a number that
+lies. Ours did. Every agent card on the floor carried a dollar figure, <code>fleet.json</code> carried it
+for Michael, and the LIVE ROSTER line every agent reads carried it too. It was the number you
+would look at to decide whether to hire another worker or send everyone home.</p>
+<p>It was under reporting by more than half.</p>
+<p>This is the postmortem, because the bug is not really about money. It is about what happens when
+a value’s name describes something more permanent than the thing that computes it.</p>
+<h2 id="what-the-number-was-supposed-to-mean" tabindex="-1">What the number was supposed to mean <a class="anchor" href="#what-the-number-was-supposed-to-mean" aria-hidden="true">#</a></h2>
+<p>Each agent reports usage as it works. The collector folds those samples into a per-agent record
+with tokens in, tokens out, cache reads, cache creation, and a dollar figure. That record is
+written into <code>fleet.json</code> on a timer, which is what the orchestrator and every agent read when
+they want to know the shape of the floor.</p>
+<p>The contract everyone assumed was simple: <code>usd</code> is what this agent has cost you.</p>
+<h2 id="what-it-actually-meant" tabindex="-1">What it actually meant <a class="anchor" href="#what-it-actually-meant" aria-hidden="true">#</a></h2>
+<p><code>AgentUsageSample.usd</code> is cumulative since <strong>process start</strong>. Not since the agent started. Since
+the app started.</p>
+<p>The collector accumulates into in-memory maps. An app restart builds those maps fresh, so every
+running total goes back to zero. The agent itself does not go back to zero, because the agent
+resumes: same worker, same work, same <code>session_id</code>. Only our accumulator forgot.</p>
+<p>So the sequence on disk looks like this. The counter climbs through a session. The app restarts.
+The counter appears again at almost nothing, under the same session id, and starts climbing
+again. Anything that reads the latest value is reading spend since the most recent restart and
+reporting it as spend, full stop.</p>
+<p>The longer an agent lives, the more restarts it survives, and the more wrong its number gets. The
+agents you have invested the most in are the ones whose cost you understate the worst.</p>
+<h2 id="why-this-survived-in-plain-sight" tabindex="-1">Why this survived in plain sight <a class="anchor" href="#why-this-survived-in-plain-sight" aria-hidden="true">#</a></h2>
+<p>Here is the uncomfortable part. Every check you would write against this number passes.</p>
+<p>The value is never negative. It is never NaN. Nothing throws, nothing warns, no read fails.
+Within any single run of the app the counter is perfectly monotonic, which is exactly how a
+lifetime total behaves, so a person watching it for an hour sees nothing suspicious. It is
+plausible in magnitude: too small to be absurd, too large to be obviously stubbed.</p>
+<p>And the reset itself is invisible from where the number is consumed. Restarting an app is the
+single most normal thing a user does. Nobody restarts and then reconciles a dollar figure against
+what it read before, because the app was closed in between and closing an app is allowed to
+change what is on screen.</p>
+<p>The signature only exists in the history. You cannot see it in a value. You can only see it in a
+sequence, and only if you look at the whole sequence at once.</p>
+<figure class="fig fig-placeholder t-internals fig-inline" role="img" aria-label="Hand-drawn sketch from “The Spend Counter That Went Back to Zero”"><div class="ph-art" aria-hidden="true"><span class="ph-glyph">✶</span><span class="ph-note">illustration on its way</span></div><figcaption>The counter climbs, the app restarts, the counter starts over. Every single value is fine. Only the sequence is wrong.</figcaption></figure>
+<h2 id="the-data-was-never-lost" tabindex="-1">The data was never lost <a class="anchor" href="#the-data-was-never-lost" aria-hidden="true">#</a></h2>
+<p>The thing that made this fixable rather than merely diagnosable: the ledger is append-only.</p>
+<p>Every usage sample ever emitted is a line in <code>cost-ledger.jsonl</code>, and lines are never rewritten.
+The pre-reset peaks were all still sitting on disk. The bug was in what we read out of that file,
+not in what we put into it, which means the past could be corrected rather than written off.</p>
+<p>That distinction is worth more than the fix. A bug in a derived read is recoverable. The same
+bug in the write path would have meant a number that starts being right today and is wrong
+forever behind you.</p>
+<h2 id="reading-a-reset-out-of-a-monotonic-counter" tabindex="-1">Reading a reset out of a monotonic counter <a class="anchor" href="#reading-a-reset-out-of-a-monotonic-counter" aria-hidden="true">#</a></h2>
+<p>Within one agent and one session, the counter can only climb. That is not a convention, it is
+what cumulative means. So a decrease is not ambiguous. It is not a rounding artifact, or a
+correction, or a refund. <strong>A decrease is a restart, and it is the only thing a decrease can be.</strong></p>
+<p>That gives the whole algorithm. Walk the ledger. For each agent and session, hold two numbers:
+the high-water mark of the segment currently open, and the sum of the high-water marks of every
+segment a reset has already closed. When the value drops, the open segment just ended at its
+peak, so commit the peak and open a new segment at the new value.</p>
+<pre class="language-ts"><code class="language-ts"><span class="token keyword">if</span> <span class="token punctuation">(</span>usd <span class="token operator">&lt;</span> s<span class="token punctuation">.</span>peak <span class="token operator">-</span> <span class="token constant">EPS</span><span class="token punctuation">)</span> <span class="token punctuation">{</span>
+ <span class="token comment">// Counter went backwards: the previous segment ended at its peak.</span>
+ s<span class="token punctuation">.</span>committed <span class="token operator">+=</span> s<span class="token punctuation">.</span>peak<span class="token punctuation">;</span>
+ s<span class="token punctuation">.</span>peak <span class="token operator">=</span> usd<span class="token punctuation">;</span>
+<span class="token punctuation">}</span> <span class="token keyword">else</span> <span class="token keyword">if</span> <span class="token punctuation">(</span>usd <span class="token operator">></span> s<span class="token punctuation">.</span>peak<span class="token punctuation">)</span> <span class="token punctuation">{</span>
+ s<span class="token punctuation">.</span>peak <span class="token operator">=</span> usd<span class="token punctuation">;</span>
+<span class="token punctuation">}</span></code></pre>
+<p>Lifetime is then <code>committed + peak</code>, summed across every session an agent has had. That is the
+entire recovery. It is a handful of arithmetic, because the invariant did the hard part.</p>
+<p>The general shape is worth keeping: <strong>if a value is only allowed to move one way, every move the
+other way is a free detector you already have on disk.</strong> You do not need to have instrumented the
+event. You need to have recorded enough that the event leaves a shadow.</p>
+<h2 id="the-threshold-we-deliberately-did-not-add" tabindex="-1">The threshold we deliberately did not add <a class="anchor" href="#the-threshold-we-deliberately-did-not-add" aria-hidden="true">#</a></h2>
+<p>The tempting version of this code ignores small drops. Float noise, out-of-order samples, a
+rounding difference somewhere upstream: surely you want a floor before you call something a
+restart. A dollar sounds sensible. Ten cents sounds cautious.</p>
+<p>We looked at our own ledger and found real restarts falling from peaks <strong>under a dollar</strong> straight
+to zero. A one dollar threshold misses those completely, and it misses them silently, which is
+the same failure we were already fixing wearing a different hat.</p>
+<p>So the threshold is a float epsilon and nothing else. A cumulative counter has no legitimate
+reason to go down by any amount, so there is no band of “probably fine” to carve out. The magic
+number bought tidiness and cost coverage, and coverage was the entire point.</p>
+<p>If you find yourself picking a threshold to suppress a signal, check whether the signal has any
+legitimate instances at all. If it does not, the right threshold is zero and the number you were
+about to type is just a hole.</p>
+<h2 id="doing-it-without-freezing-the-app" tabindex="-1">Doing it without freezing the app <a class="anchor" href="#doing-it-without-freezing-the-app" aria-hidden="true">#</a></h2>
+<p>Munder Difflin is an Electron app, and the ledger is append-only, which is a polite way of saying
+it grows forever. A full pass over it is not something you want on the main thread. Block that
+thread and the whole UI stops: the floor, the terminals, the window itself.</p>
+<p>So the fold is async and incremental. It keeps a byte offset and reads only what has been
+appended since the last pass, which in steady state is a few hundred bytes. Three details in
+there are load bearing.</p>
+<p><strong>The trailing partial line is held as bytes, not text.</strong> A read boundary can land in the middle
+of a multi-byte character, and decoding half of one produces a replacement character that no
+longer parses as JSON. Buffering the tail as a <code>Buffer</code> and only decoding up to the last newline
+means the split is invisible.</p>
+<p><strong>Each pass is capped.</strong> A cold start on a large ledger would otherwise be one enormous read. It
+reads a bounded chunk, keeps its segment state, and resumes on the next tick.</p>
+<p><strong>Truncation is detected, not assumed away.</strong> If the file is smaller than the offset we hold, the
+file was rotated or replaced under us, and every segment we are carrying is suspect. That case
+resets the reader instead of reading garbage from a stale position.</p>
+<p>The reader never writes to the ledger, and a ledger it cannot read leaves the last good totals in
+place rather than throwing into a timer.</p>
+<h2 id="a-cold-zero-is-worse-than-an-admitted-unknown" tabindex="-1">A cold zero is worse than an admitted unknown <a class="anchor" href="#a-cold-zero-is-worse-than-an-admitted-unknown" aria-hidden="true">#</a></h2>
+<p>Until the first full pass completes, the fold genuinely does not know what an agent has cost.
+There are two things you can publish at that moment: zero, or nothing.</p>
+<p>Zero is a lie with a confident face. Somebody reads it, believes an agent is free, and the
+mistake propagates. So <code>usdFor</code> returns <code>null</code> until a pass has actually reached the end of the
+file, and there is an explicit <code>warm</code> flag behind it so a caller can tell “no spend” apart from
+“not read yet”.</p>
+<p><code>fleet.json</code> uses that to fall back to the old session figure while the fold is cold, and swaps
+to lifetime the moment it is warm. The old number is still there permanently as <code>sessionUsd</code>,
+because “what has this agent cost me since I opened the app” is a real question, it just is not
+the one the field named <code>usd</code> was being asked.</p>
+<p>Nullable is not a nuisance here. It is the type telling the truth about what is known.</p>
+<h2 id="checking-a-number-you-recovered-by-inference" tabindex="-1">Checking a number you recovered by inference <a class="anchor" href="#checking-a-number-you-recovered-by-inference" aria-hidden="true">#</a></h2>
+<p>This is a computed answer with no ground truth to compare it against. There is no invoice that
+says what an agent cost. The number is only as good as the reasoning that produced it, which
+means a passing test proves the code matches the assumptions, not that the assumptions are right.</p>
+<p>So the ledger was folded a second time by a separately written implementation and the two were
+compared. They agree to the cent, with no per-agent disagreement anywhere in the set. That is not
+proof, but two independent implementations agreeing on every agent is a very different level of
+confidence than one implementation agreeing with itself.</p>
+<p>For any number you recover by inference rather than measurement, write it twice. It is cheap and
+it is the only check that tests the reasoning instead of the typing.</p>
+<h2 id="what-we-did-not-fix-and-why-we-said-so" tabindex="-1">What we did not fix, and why we said so <a class="anchor" href="#what-we-did-not-fix-and-why-we-said-so" aria-hidden="true">#</a></h2>
+<p>The circuit breaker has a floor-wide cost cap, and it reads the same resetting counter.</p>
+<p>That means the cap re-arms to zero on every restart and is, in effect, measuring one app session
+rather than lifetime. That is not a bug in the same sense. It is an unanswered question about what
+a spending cap should mean. Is it “stop the floor when it has spent this much today”, or “ever”?
+Those are different products, and one of them is a policy the founder gets to choose, not a
+default an agent should quietly change while fixing something else.</p>
+<p>So it is written up rather than patched. <strong>A fix that silently rewrites a policy is not a fix, it
+is a decision taken by whoever happened to be in the file.</strong></p>
+<figure class="fig fig-placeholder t-internals fig-inline" role="img" aria-label="Hand-drawn sketch from “The Spend Counter That Went Back to Zero”"><div class="ph-art" aria-hidden="true"><span class="ph-glyph">✶</span><span class="ph-note">illustration on its way</span></div><figcaption>Same counter, second consumer. Fixing the display without fixing the cap would have been half a fix that looked whole.</figcaption></figure>
+<h2 id="what-we-wrote-down" tabindex="-1">What we wrote down <a class="anchor" href="#what-we-wrote-down" aria-hidden="true">#</a></h2>
+<ul>
+<li><strong>A counter named for a lifetime should not be scoped to a process.</strong> If the value resets when
+something restarts, the name has to say so. Ours now ships as <code>usd</code> and <code>sessionUsd</code> side by
+side, and the ambiguity is gone because both answers exist.</li>
+<li><strong>A monotonic invariant is a detector you already own.</strong> If a value can only move one way, every
+move the other way is an event you can recover after the fact, with no new instrumentation.</li>
+<li><strong>Append-only logs let you fix the past.</strong> The write path being correct is what made this a
+read-side fix instead of a line in the changelog apologising for old data.</li>
+<li><strong>Check whether your threshold has any legitimate instances.</strong> If nothing real lives below the
+cutoff, the cutoff is only hiding things you wanted to see.</li>
+<li><strong>Never publish a confident zero for a value you have not read yet.</strong> Return null, keep a warm
+flag, and let callers decide.</li>
+<li><strong>Write the second implementation.</strong> For inferred numbers it is the only verification that
+tests the reasoning rather than the code.</li>
+</ul>
+<p>The failure class here is the same one behind
+<a href="/blog/the-newline-that-silenced-windows-agents/">the newline that silenced every Windows agent</a>
+and <a href="/blog/why-our-auto-update-never-ran/">the auto-update that never ran</a>: nothing errored,
+every health check passed, and the product was quietly not doing the thing it said it did.
+Loud failures get fixed in an afternoon. These are the ones that need somebody to go and
+<a href="/blog/how-ai-agents-verify-their-own-work/">verify the claim</a> rather than the absence of an
+exception.</p>
+<h2 id="the-rest-of-v045" tabindex="-1">The rest of v0.4.5 <a class="anchor" href="#the-rest-of-v045" aria-hidden="true">#</a></h2>
+<p>This shipped in <strong>v0.4.5</strong>, alongside two other things that were quietly wrong: semantic memory
+never worked on Apple Silicon, where CoreML overflowed the quantized embedding graph and returned
+NaN for every vector, and agents did not reliably reach each other, which now has an inbox wake
+watchdog behind it and bounces mail to a missing inbox instead of dropping it. Plus weekday
+scheduling for triggers, clickable paths everywhere in terminal output, one editor instead of
+two, one click updates, and 23 community pull requests.</p>
+<p>The full notes are on the
+<a href="https://github.com/chaitanyagiri/munder-difflin/releases/latest">releases page</a>, and if you want
+the wider version of this argument, the
+<a href="/blog/the-multi-agent-cost-playbook/">multi-agent cost playbook</a> is about spending less rather
+than counting it correctly. Both matter. Counting it correctly comes first, because you cannot
+manage a number you are not actually reading.</p>
+
+
+
+ <section class="faq" aria-label="Frequently asked questions">
+ <h2 id="faq">FAQ</h2>
+
+ <div class="qa">
+ <p class="q">What was wrong with cost reporting in Munder Difflin?</p>
+ <p class="a">The per-agent spend figure counted from the moment the app process started, not from the moment the agent started. Restarting the app rebuilt the in-memory accumulator empty, so the counter began again at zero under the same session id. Anything reading the latest value read one app session&#39;s worth of spend and called it the total. On our own floor that hid 59 percent of it.</p>
+ </div>
+
+ <div class="qa">
+ <p class="q">Why did nobody notice a number that was wrong by more than half?</p>
+ <p class="a">Because it never looked wrong. Inside any single run the counter only climbed, so it behaved exactly like a lifetime total. Nothing threw, nothing went negative, nothing came back NaN. The reset is only visible if you look at the whole history at once, and the number is the kind you glance at rather than reconcile.</p>
+ </div>
+
+ <div class="qa">
+ <p class="q">How do you recover a total from a counter that resets?</p>
+ <p class="a">You use the invariant the counter already gives you. Within one agent and one session the value can only go up, so any decrease is a restart and nothing else. Lifetime is the sum of the high-water mark of each segment that a reset closed, plus the high-water mark of the segment still open. Every sample was already on disk in an append-only ledger, so the past was recoverable without a migration.</p>
+ </div>
+
+ <div class="qa">
+ <p class="q">Why not ignore small drops as noise?</p>
+ <p class="a">We looked at that and rejected it. Real restarts in our own ledger fall from peaks under a dollar straight to zero, so a one dollar threshold would have silently missed them. A cumulative counter has no legitimate reason to fall at all, so the threshold bought tidiness and cost coverage. Any decrease counts, with a float epsilon and nothing more.</p>
+ </div>
+
+ </section>
+
+
+
+ <hr />
+ <div class="share">
+ <span class="lbl">Tags</span>
+ <a class="tag" href="/blog/tags/internals/">Internals</a><a class="tag" href="/blog/tags/cost/">Cost</a><a class="tag" href="/blog/tags/telemetry/">Telemetry</a><a class="tag" href="/blog/tags/debugging/">Debugging</a><a class="tag" href="/blog/tags/postmortem/">Postmortem</a>
+ </div>
+
+ </div>
+
+
+ <aside class="toc-rail" aria-label="Table of contents">
+ <div class="tt">On this page</div>
+ <ol>
+ <li class="lvl-2"><a href="#what-the-number-was-supposed-to-mean">What the number was supposed to mean</a></li><li class="lvl-2"><a href="#what-it-actually-meant">What it actually meant</a></li><li class="lvl-2"><a href="#why-this-survived-in-plain-sight">Why this survived in plain sight</a></li><li class="lvl-2"><a href="#the-data-was-never-lost">The data was never lost</a></li><li class="lvl-2"><a href="#reading-a-reset-out-of-a-monotonic-counter">Reading a reset out of a monotonic counter</a></li><li class="lvl-2"><a href="#the-threshold-we-deliberately-did-not-add">The threshold we deliberately did not add</a></li><li class="lvl-2"><a href="#doing-it-without-freezing-the-app">Doing it without freezing the app</a></li><li class="lvl-2"><a href="#a-cold-zero-is-worse-than-an-admitted-unknown">A cold zero is worse than an admitted unknown</a></li><li class="lvl-2"><a href="#checking-a-number-you-recovered-by-inference">Checking a number you recovered by inference</a></li><li class="lvl-2"><a href="#what-we-did-not-fix-and-why-we-said-so">What we did not fix, and why we said so</a></li><li class="lvl-2"><a href="#what-we-wrote-down">What we wrote down</a></li><li class="lvl-2"><a href="#the-rest-of-v045">The rest of v0.4.5</a></li>
+ </ol>
+ </aside>
+
+ </div>
+
+ <footer class="post-foot wrap"><div class="prevnext">
+ <a class="pn prev" href="/blog/agents-ran-our-launch-week-analytics/"><span class="k">← Older</span><span class="t">Our Agents Ran Our Launch-Week Analytics</span></a>
+ <span></span>
+ </div>
+ <section class="related">
+ <h2>Related in Internals</h2>
+ <div class="post-grid">
+ <article class="card t-internals">
+ <a class="thumb t-internals" href="/blog/the-newline-that-silenced-windows-agents/" aria-hidden="true" tabindex="-1"><img src="/blog/assets/media/the-newline-that-silenced-windows-agents/hero.png" alt="" loading="lazy" decoding="async" /></a>
+ <div class="body">
+ <div class="meta">
+ <time datetime="2026-08-19">Aug 19, 2026</time>
+ <span class="dot" aria-hidden="true"></span>
+ <span>4 min</span>
+ </div>
+ <h3><a href="/blog/the-newline-that-silenced-windows-agents/">The Newline That Silenced Every Windows Agent</a></h3>
+ <p class="dek">A cmd.exe parsing rule from the 1980s meant Windows agents received exactly one line of their multi-line startup protocol — and nothing errored. The anatomy of our worst silent failure, and the fix.</p>
+ <div class="foot">
+ <span class="tag kind">Internals</span>
+ <a class="more" href="/blog/the-newline-that-silenced-windows-agents/" aria-label="Read: The Newline That Silenced Every Windows Agent">Read →</a>
+ </div>
+ </div>
+</article>
+<article class="card t-internals">
+ <a class="thumb t-internals" href="/blog/why-our-auto-update-never-ran/" aria-hidden="true" tabindex="-1"><img src="/blog/assets/media/why-our-auto-update-never-ran/hero.png" alt="" loading="lazy" decoding="async" /></a>
+ <div class="body">
+ <div class="meta">
+ <time datetime="2026-08-08">Aug 8, 2026</time>
+ <span class="dot" aria-hidden="true"></span>
+ <span>5 min</span>
+ </div>
+ <h3><a href="/blog/why-our-auto-update-never-ran/">Our Auto-Update Never Ran Once: A CommonJS Export That Vanished Into an ESM Namespace</a></h3>
+ <p class="dek">Munder Difflin shipped auto-update in v0.3.4 and it silently never worked in a single packaged build. The cause was one destructuring assignment across the CommonJS/ESM boundary — and a catch block that threw the evidence away. Here&#39;s how we found it, and what v0.3.7 changes.</p>
+ <div class="foot">
+ <span class="tag kind">Internals</span>
+ <a class="more" href="/blog/why-our-auto-update-never-ran/" aria-label="Read: Our Auto-Update Never Ran Once: A CommonJS Export That Vanished Into an ESM Namespace">Read →</a>
+ </div>
+ </div>
+</article>
+<article class="card t-internals">
+ <a class="thumb t-internals" href="/blog/hire-manifest-untrusted-input/" aria-hidden="true" tabindex="-1"><img src="/blog/assets/media/hire-manifest-untrusted-input/hero.png" alt="" loading="lazy" decoding="async" /></a>
+ <div class="body">
+ <div class="meta">
+ <time datetime="2026-06-15">Jun 15, 2026</time>
+ <span class="dot" aria-hidden="true"></span>
+ <span>12 min</span>
+ </div>
+ <h3><a href="/blog/hire-manifest-untrusted-input/">Treating a Hire Manifest as Untrusted Input</a></h3>
+ <p class="dek">A shareable agent-config manifest is attacker input. How Munder Difflin&#39;s import pipeline stays inert: no auto-spawn, default-deny flags, and an SSRF-safe bounded fetch.</p>
+ <div class="foot">
+ <span class="tag kind">Internals</span>
+ <a class="more" href="/blog/hire-manifest-untrusted-input/" aria-label="Read: Treating a Hire Manifest as Untrusted Input">Read →</a>
+ </div>
+ </div>
+</article>
+
+ </div>
+ </section>
+
+ </footer>
+</article>
+
+</main>
+<footer class="site-foot">
+ <div class="wrap">
+ <div class="foot-top">
+ <a class="foot-brand brand" href="https://munderdiffl.in" aria-label="Munder Difflin home">
+ <img class="brand-logo" src="https://munderdiffl.in/logo.png" width="1318" height="840" alt="Munder Difflin, Inc. — Multi-Agent Harness" />
+ </a>
+ <div class="foot-links">
+ <a href="/blog/">Latest</a>
+ <a href="/blog/topics/">Topics</a>
+ <a href="/blog/about/">About</a>
+ <a href="https://munderdiffl.in/blog/feed.xml">RSS</a>
+ <a href="https://github.com/chaitanyagiri/munder-difflin">GitHub</a>
+ <a href="https://munderdiffl.in">munderdiffl.in ↗</a>
+ </div>
+ </div>
+ <div class="foot-meta">
+ © 2026 Munder Difflin · Local-first · MIT-licensed ·
+ Built on <a href="https://munderdiffl.in">Electron, React, Pixi.js, xterm.js &amp; node-pty</a>.
+ Run an office of agents while you sleep.
+ </div>
+ </div>
+</footer>
+
+<script>
+ // sticky-nav border on scroll
+ (function () {
+ var nav = document.getElementById('nav');
+ if (!nav) return;
+ var onScroll = function () { nav.classList.toggle('scrolled', window.scrollY > 8); };
+ onScroll(); window.addEventListener('scroll', onScroll, { passive: true });
+ })();
+ // YouTube click-to-load: thumbnail button → youtube-nocookie iframe
+ (function () {
+ document.addEventListener('click', function (e) {
+ var btn = e.target.closest('.yt-load');
+ if (!btn) return;
+ var box = btn.closest('.yt');
+ var id = box && box.getAttribute('data-yt');
+ if (!id) return;
+ var frame = document.createElement('iframe');
+ frame.src = 'https://www.youtube-nocookie.com/embed/' + id + '?autoplay=1';
+ frame.title = box.getAttribute('data-title') || 'YouTube video';
+ frame.allow = 'accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share';
+ frame.setAttribute('allowfullscreen', '');
+ box.replaceChildren(frame);
+ });
+ })();
+</script>
+
+</body>
+</html>
diff --git a/docs/blog/topics/comparisons/index.html b/docs/blog/topics/comparisons/index.html
index b4f36815..6371c663 100644
--- a/docs/blog/topics/comparisons/index.html
+++ b/docs/blog/topics/comparisons/index.html
@@ -93,7 +93,7 @@
<a class="chip" href="/blog/topics/concepts/">concepts<span class="ct">21</span></a>
- <a class="chip" href="/blog/topics/internals/">internals<span class="ct">18</span></a>
+ <a class="chip" href="/blog/topics/internals/">internals<span class="ct">19</span></a>
<a class="chip" href="/blog/topics/comparisons/" aria-current="page">comparisons<span class="ct">17</span></a>
diff --git a/docs/blog/topics/concepts/index.html b/docs/blog/topics/concepts/index.html
index 7d7a76e4..6237991e 100644
--- a/docs/blog/topics/concepts/index.html
+++ b/docs/blog/topics/concepts/index.html
@@ -93,7 +93,7 @@
<a class="chip" href="/blog/topics/concepts/" aria-current="page">concepts<span class="ct">21</span></a>
- <a class="chip" href="/blog/topics/internals/">internals<span class="ct">18</span></a>
+ <a class="chip" href="/blog/topics/internals/">internals<span class="ct">19</span></a>
<a class="chip" href="/blog/topics/comparisons/">comparisons<span class="ct">17</span></a>
diff --git a/docs/blog/topics/guides/index.html b/docs/blog/topics/guides/index.html
index 65dd5dca..837acf59 100644
--- a/docs/blog/topics/guides/index.html
+++ b/docs/blog/topics/guides/index.html
@@ -93,7 +93,7 @@
<a class="chip" href="/blog/topics/concepts/">concepts<span class="ct">21</span></a>
- <a class="chip" href="/blog/topics/internals/">internals<span class="ct">18</span></a>
+ <a class="chip" href="/blog/topics/internals/">internals<span class="ct">19</span></a>
<a class="chip" href="/blog/topics/comparisons/">comparisons<span class="ct">17</span></a>
diff --git a/docs/blog/topics/index.html b/docs/blog/topics/index.html
index 5fe7ddd3..94a7e91a 100644
--- a/docs/blog/topics/index.html
+++ b/docs/blog/topics/index.html
@@ -110,7 +110,7 @@
<span class="thumb t-internals" aria-hidden="true">INTERNALS</span>
<div class="body">
<h3 style="color:var(--ink)">internals</h3>
- <p class="dek">18 posts.</p>
+ <p class="dek">19 posts.</p>
<div class="foot"><span class="more">View topic →</span></div>
</div>
</a>
@@ -170,7 +170,7 @@
<a class="chip" href="/blog/tags/claude-code/">Claude Code<span class="ct">45</span></a>
- <a class="chip" href="/blog/tags/internals/">Internals<span class="ct">25</span></a>
+ <a class="chip" href="/blog/tags/internals/">Internals<span class="ct">26</span></a>
<a class="chip" href="/blog/tags/guides/">Guides<span class="ct">23</span></a>
@@ -198,14 +198,14 @@
<a class="chip" href="/blog/tags/memory/">Memory<span class="ct">8</span></a>
+ <a class="chip" href="/blog/tags/cost/">Cost<span class="ct">8</span></a>
+
<a class="chip" href="/blog/tags/workflow/">Workflow<span class="ct">7</span></a>
<a class="chip" href="/blog/tags/human-in-the-loop/">Human-in-the-Loop<span class="ct">7</span></a>
<a class="chip" href="/blog/tags/security/">Security<span class="ct">7</span></a>
- <a class="chip" href="/blog/tags/cost/">Cost<span class="ct">7</span></a>
-
<a class="chip" href="/blog/tags/mempalace/">MemPalace<span class="ct">6</span></a>
<a class="chip" href="/blog/tags/hive/">Hive<span class="ct">6</span></a>
@@ -226,6 +226,8 @@
<a class="chip" href="/blog/tags/reliability/">Reliability<span class="ct">4</span></a>
+ <a class="chip" href="/blog/tags/debugging/">Debugging<span class="ct">4</span></a>
+
<a class="chip" href="/blog/tags/cli-agents/">CLI Agents<span class="ct">4</span></a>
<a class="chip" href="/blog/tags/voice/">Voice<span class="ct">4</span></a>
@@ -234,8 +236,6 @@
<a class="chip" href="/blog/tags/terminals/">Terminals<span class="ct">3</span></a>
- <a class="chip" href="/blog/tags/debugging/">Debugging<span class="ct">3</span></a>
-
<a class="chip" href="/blog/tags/model-routing/">Model Routing<span class="ct">3</span></a>
<a class="chip" href="/blog/tags/agentic-ai/">Agentic AI<span class="ct">3</span></a>
@@ -286,6 +286,8 @@
<a class="chip" href="/blog/tags/windows/">Windows<span class="ct">2</span></a>
+ <a class="chip" href="/blog/tags/postmortem/">Postmortem<span class="ct">2</span></a>
+
<a class="chip" href="/blog/tags/community/">Community<span class="ct">2</span></a>
<a class="chip" href="/blog/tags/subagents/">Subagents<span class="ct">1</span></a>
@@ -414,8 +416,6 @@
<a class="chip" href="/blog/tags/changelog/">Changelog<span class="ct">1</span></a>
- <a class="chip" href="/blog/tags/postmortem/">Postmortem<span class="ct">1</span></a>
-
<a class="chip" href="/blog/tags/feedback/">Feedback<span class="ct">1</span></a>
<a class="chip" href="/blog/tags/product/">Product<span class="ct">1</span></a>
@@ -424,6 +424,8 @@
<a class="chip" href="/blog/tags/reddit/">Reddit<span class="ct">1</span></a>
+ <a class="chip" href="/blog/tags/telemetry/">Telemetry<span class="ct">1</span></a>
+
</div>
</section>
diff --git a/docs/blog/topics/internals/index.html b/docs/blog/topics/internals/index.html
index 64c91d24..4c265d33 100644
--- a/docs/blog/topics/internals/index.html
+++ b/docs/blog/topics/internals/index.html
@@ -93,7 +93,7 @@
<a class="chip" href="/blog/topics/concepts/">concepts<span class="ct">21</span></a>
- <a class="chip" href="/blog/topics/internals/" aria-current="page">internals<span class="ct">18</span></a>
+ <a class="chip" href="/blog/topics/internals/" aria-current="page">internals<span class="ct">19</span></a>
<a class="chip" href="/blog/topics/comparisons/">comparisons<span class="ct">17</span></a>
@@ -111,6 +111,22 @@
<section class="wrap">
<div class="post-grid">
<article class="card t-internals">
+ <a class="thumb t-internals" href="/blog/the-spend-counter-that-went-back-to-zero/" aria-hidden="true" tabindex="-1"><span class="thumb-ph"><em class="ph-glyph" aria-hidden="true">✶</em><span>INTERNALS</span></span></a>
+ <div class="body">
+ <div class="meta">
+ <time datetime="2026-08-22">Aug 22, 2026</time>
+ <span class="dot" aria-hidden="true"></span>
+ <span>10 min</span>
+ </div>
+ <h3><a href="/blog/the-spend-counter-that-went-back-to-zero/">The Spend Counter That Went Back to Zero</a></h3>
+ <p class="dek">Our own floor was under reporting what it cost by 59 percent. The counter was cumulative since process start, the app restarts, and the session id stayed the same. Here is how a monotonic invariant let us recover the real number from an append-only log.</p>
+ <div class="foot">
+ <span class="tag kind">Internals</span>
+ <a class="more" href="/blog/the-spend-counter-that-went-back-to-zero/" aria-label="Read: The Spend Counter That Went Back to Zero">Read →</a>
+ </div>
+ </div>
+</article>
+<article class="card t-internals">
<a class="thumb t-internals" href="/blog/the-newline-that-silenced-windows-agents/" aria-hidden="true" tabindex="-1"><img src="/blog/assets/media/the-newline-that-silenced-windows-agents/hero.png" alt="" loading="lazy" decoding="async" /></a>
<div class="body">
<div class="meta">
diff --git a/docs/blog/topics/memory/index.html b/docs/blog/topics/memory/index.html
index 8acbd347..fa57ad7c 100644
--- a/docs/blog/topics/memory/index.html
+++ b/docs/blog/topics/memory/index.html
@@ -93,7 +93,7 @@
<a class="chip" href="/blog/topics/concepts/">concepts<span class="ct">21</span></a>
- <a class="chip" href="/blog/topics/internals/">internals<span class="ct">18</span></a>
+ <a class="chip" href="/blog/topics/internals/">internals<span class="ct">19</span></a>
<a class="chip" href="/blog/topics/comparisons/">comparisons<span class="ct">17</span></a>
diff --git a/docs/blog/topics/orchestration/index.html b/docs/blog/topics/orchestration/index.html
index 4bb7cb8b..1bd0bcaa 100644
--- a/docs/blog/topics/orchestration/index.html
+++ b/docs/blog/topics/orchestration/index.html
@@ -93,7 +93,7 @@
<a class="chip" href="/blog/topics/concepts/">concepts<span class="ct">21</span></a>
- <a class="chip" href="/blog/topics/internals/">internals<span class="ct">18</span></a>
+ <a class="chip" href="/blog/topics/internals/">internals<span class="ct">19</span></a>
<a class="chip" href="/blog/topics/comparisons/">comparisons<span class="ct">17</span></a>
diff --git a/docs/blog/topics/story/index.html b/docs/blog/topics/story/index.html
index 7e0dd460..6389135d 100644
--- a/docs/blog/topics/story/index.html
+++ b/docs/blog/topics/story/index.html
@@ -93,7 +93,7 @@
<a class="chip" href="/blog/topics/concepts/">concepts<span class="ct">21</span></a>
- <a class="chip" href="/blog/topics/internals/">internals<span class="ct">18</span></a>
+ <a class="chip" href="/blog/topics/internals/">internals<span class="ct">19</span></a>
<a class="chip" href="/blog/topics/comparisons/">comparisons<span class="ct">17</span></a>
diff --git a/docs/blog/topics/use-cases/index.html b/docs/blog/topics/use-cases/index.html
index e1249cac..f766c74b 100644
--- a/docs/blog/topics/use-cases/index.html
+++ b/docs/blog/topics/use-cases/index.html
@@ -93,7 +93,7 @@
<a class="chip" href="/blog/topics/concepts/">concepts<span class="ct">21</span></a>
- <a class="chip" href="/blog/topics/internals/">internals<span class="ct">18</span></a>
+ <a class="chip" href="/blog/topics/internals/">internals<span class="ct">19</span></a>
<a class="chip" href="/blog/topics/comparisons/">comparisons<span class="ct">17</span></a>
diff --git a/docs/blog/visualizing-ai-agents-pixijs/index.html b/docs/blog/visualizing-ai-agents-pixijs/index.html
index 9a0e86e3..0b540a47 100644
--- a/docs/blog/visualizing-ai-agents-pixijs/index.html
+++ b/docs/blog/visualizing-ai-agents-pixijs/index.html
@@ -307,6 +307,22 @@ to see your agents at work; it’s free and open source.</p>
<h2>Related in Internals</h2>
<div class="post-grid">
<article class="card t-internals">
+ <a class="thumb t-internals" href="/blog/the-spend-counter-that-went-back-to-zero/" aria-hidden="true" tabindex="-1"><span class="thumb-ph"><em class="ph-glyph" aria-hidden="true">✶</em><span>INTERNALS</span></span></a>
+ <div class="body">
+ <div class="meta">
+ <time datetime="2026-08-22">Aug 22, 2026</time>
+ <span class="dot" aria-hidden="true"></span>
+ <span>10 min</span>
+ </div>
+ <h3><a href="/blog/the-spend-counter-that-went-back-to-zero/">The Spend Counter That Went Back to Zero</a></h3>
+ <p class="dek">Our own floor was under reporting what it cost by 59 percent. The counter was cumulative since process start, the app restarts, and the session id stayed the same. Here is how a monotonic invariant let us recover the real number from an append-only log.</p>
+ <div class="foot">
+ <span class="tag kind">Internals</span>
+ <a class="more" href="/blog/the-spend-counter-that-went-back-to-zero/" aria-label="Read: The Spend Counter That Went Back to Zero">Read →</a>
+ </div>
+ </div>
+</article>
+<article class="card t-internals">
<a class="thumb t-internals" href="/blog/the-newline-that-silenced-windows-agents/" aria-hidden="true" tabindex="-1"><img src="/blog/assets/media/the-newline-that-silenced-windows-agents/hero.png" alt="" loading="lazy" decoding="async" /></a>
<div class="body">
<div class="meta">
@@ -338,22 +354,6 @@ to see your agents at work; it’s free and open source.</p>
</div>
</div>
</article>
-<article class="card t-internals">
- <a class="thumb t-internals" href="/blog/hire-manifest-untrusted-input/" aria-hidden="true" tabindex="-1"><img src="/blog/assets/media/hire-manifest-untrusted-input/hero.png" alt="" loading="lazy" decoding="async" /></a>
- <div class="body">
- <div class="meta">
- <time datetime="2026-06-15">Jun 15, 2026</time>
- <span class="dot" aria-hidden="true"></span>
- <span>12 min</span>
- </div>
- <h3><a href="/blog/hire-manifest-untrusted-input/">Treating a Hire Manifest as Untrusted Input</a></h3>
- <p class="dek">A shareable agent-config manifest is attacker input. How Munder Difflin&#39;s import pipeline stays inert: no auto-spawn, default-deny flags, and an SSRF-safe bounded fetch.</p>
- <div class="foot">
- <span class="tag kind">Internals</span>
- <a class="more" href="/blog/hire-manifest-untrusted-input/" aria-label="Read: Treating a Hire Manifest as Untrusted Input">Read →</a>
- </div>
- </div>
-</article>
</div>
</section>
diff --git a/docs/blog/why-our-auto-update-never-ran/index.html b/docs/blog/why-our-auto-update-never-ran/index.html
index c59a8986..1e62f97e 100644
--- a/docs/blog/why-our-auto-update-never-ran/index.html
+++ b/docs/blog/why-our-auto-update-never-ran/index.html
@@ -317,6 +317,22 @@ why.</p>
<h2>Related in Internals</h2>
<div class="post-grid">
<article class="card t-internals">
+ <a class="thumb t-internals" href="/blog/the-spend-counter-that-went-back-to-zero/" aria-hidden="true" tabindex="-1"><span class="thumb-ph"><em class="ph-glyph" aria-hidden="true">✶</em><span>INTERNALS</span></span></a>
+ <div class="body">
+ <div class="meta">
+ <time datetime="2026-08-22">Aug 22, 2026</time>
+ <span class="dot" aria-hidden="true"></span>
+ <span>10 min</span>
+ </div>
+ <h3><a href="/blog/the-spend-counter-that-went-back-to-zero/">The Spend Counter That Went Back to Zero</a></h3>
+ <p class="dek">Our own floor was under reporting what it cost by 59 percent. The counter was cumulative since process start, the app restarts, and the session id stayed the same. Here is how a monotonic invariant let us recover the real number from an append-only log.</p>
+ <div class="foot">
+ <span class="tag kind">Internals</span>
+ <a class="more" href="/blog/the-spend-counter-that-went-back-to-zero/" aria-label="Read: The Spend Counter That Went Back to Zero">Read →</a>
+ </div>
+ </div>
+</article>
+<article class="card t-internals">
<a class="thumb t-internals" href="/blog/the-newline-that-silenced-windows-agents/" aria-hidden="true" tabindex="-1"><img src="/blog/assets/media/the-newline-that-silenced-windows-agents/hero.png" alt="" loading="lazy" decoding="async" /></a>
<div class="body">
<div class="meta">
@@ -348,22 +364,6 @@ why.</p>
</div>
</div>
</article>
-<article class="card t-internals">
- <a class="thumb t-internals" href="/blog/compressing-agent-memory/" aria-hidden="true" tabindex="-1"><img src="/blog/assets/media/compressing-agent-memory/hero.png" alt="" loading="lazy" decoding="async" /></a>
- <div class="body">
- <div class="meta">
- <time datetime="2026-06-05">Jun 5, 2026</time>
- <span class="dot" aria-hidden="true"></span>
- <span>5 min</span>
- </div>
- <h3><a href="/blog/compressing-agent-memory/">Compressing Agent Memory Without Losing the Original</a></h3>
- <p class="dek">How and why to compress an agent&#39;s long-term memory: the toolbox, the lossy trap, and keeping a lossless original beside a compact copy.</p>
- <div class="foot">
- <span class="tag kind">Internals</span>
- <a class="more" href="/blog/compressing-agent-memory/" aria-label="Read: Compressing Agent Memory Without Losing the Original">Read →</a>
- </div>
- </div>
-</article>
</div>
</section>
diff --git a/docs/sitemap.xml b/docs/sitemap.xml
index 735bc633..a3b1064c 100644
--- a/docs/sitemap.xml
+++ b/docs/sitemap.xml
@@ -10,7 +10,7 @@
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
<url>
<loc>https://munderdiffl.in/</loc>
- <lastmod>2026-08-19</lastmod>
+ <lastmod>2026-08-22</lastmod>
<changefreq>weekly</changefreq>
<priority>1.0</priority>
</url>
@@ -20,6 +20,12 @@
<url><loc>https://munderdiffl.in/blog/</loc><changefreq>daily</changefreq><priority>0.9</priority></url>
<url><loc>https://munderdiffl.in/blog/topics/</loc><changefreq>weekly</changefreq><priority>0.6</priority></url>
<url><loc>https://munderdiffl.in/blog/about/</loc><changefreq>monthly</changefreq><priority>0.4</priority></url>
+ <url>
+ <loc>https://munderdiffl.in/blog/the-spend-counter-that-went-back-to-zero/</loc>
+ <lastmod>2026-08-22</lastmod>
+ <changefreq>monthly</changefreq>
+ <priority>0.8</priority>
+ </url>
<url>
<loc>https://munderdiffl.in/blog/agents-ran-our-launch-week-analytics/</loc>
<lastmod>2026-08-19</lastmod>
@@ -818,10 +824,10 @@
<url><loc>https://munderdiffl.in/blog/tags/tools/</loc><changefreq>weekly</changefreq><priority>0.3</priority></url>
<url><loc>https://munderdiffl.in/blog/tags/getting-started/</loc><changefreq>weekly</changefreq><priority>0.3</priority></url>
<url><loc>https://munderdiffl.in/blog/tags/memory/</loc><changefreq>weekly</changefreq><priority>0.3</priority></url>
+ <url><loc>https://munderdiffl.in/blog/tags/cost/</loc><changefreq>weekly</changefreq><priority>0.3</priority></url>
<url><loc>https://munderdiffl.in/blog/tags/workflow/</loc><changefreq>weekly</changefreq><priority>0.3</priority></url>
<url><loc>https://munderdiffl.in/blog/tags/human-in-the-loop/</loc><changefreq>weekly</changefreq><priority>0.3</priority></url>
<url><loc>https://munderdiffl.in/blog/tags/security/</loc><changefreq>weekly</changefreq><priority>0.3</priority></url>
- <url><loc>https://munderdiffl.in/blog/tags/cost/</loc><changefreq>weekly</changefreq><priority>0.3</priority></url>
<url><loc>https://munderdiffl.in/blog/tags/mempalace/</loc><changefreq>weekly</changefreq><priority>0.3</priority></url>
<url><loc>https://munderdiffl.in/blog/tags/hive/</loc><changefreq>weekly</changefreq><priority>0.3</priority></url>
<url><loc>https://munderdiffl.in/blog/tags/observability/</loc><changefreq>weekly</changefreq><priority>0.3</priority></url>
@@ -832,11 +838,11 @@
<url><loc>https://munderdiffl.in/blog/tags/mcp/</loc><changefreq>weekly</changefreq><priority>0.3</priority></url>
<url><loc>https://munderdiffl.in/blog/tags/architecture/</loc><changefreq>weekly</changefreq><priority>0.3</priority></url>
<url><loc>https://munderdiffl.in/blog/tags/reliability/</loc><changefreq>weekly</changefreq><priority>0.3</priority></url>
+ <url><loc>https://munderdiffl.in/blog/tags/debugging/</loc><changefreq>weekly</changefreq><priority>0.3</priority></url>
<url><loc>https://munderdiffl.in/blog/tags/cli-agents/</loc><changefreq>weekly</changefreq><priority>0.3</priority></url>
<url><loc>https://munderdiffl.in/blog/tags/voice/</loc><changefreq>weekly</changefreq><priority>0.3</priority></url>
<url><loc>https://munderdiffl.in/blog/tags/ide/</loc><changefreq>weekly</changefreq><priority>0.3</priority></url>
<url><loc>https://munderdiffl.in/blog/tags/terminals/</loc><changefreq>weekly</changefreq><priority>0.3</priority></url>
- <url><loc>https://munderdiffl.in/blog/tags/debugging/</loc><changefreq>weekly</changefreq><priority>0.3</priority></url>
<url><loc>https://munderdiffl.in/blog/tags/model-routing/</loc><changefreq>weekly</changefreq><priority>0.3</priority></url>
<url><loc>https://munderdiffl.in/blog/tags/agentic-ai/</loc><changefreq>weekly</changefreq><priority>0.3</priority></url>
<url><loc>https://munderdiffl.in/blog/tags/aeo/</loc><changefreq>weekly</changefreq><priority>0.3</priority></url>
@@ -862,6 +868,7 @@
<url><loc>https://munderdiffl.in/blog/tags/code-review/</loc><changefreq>weekly</changefreq><priority>0.3</priority></url>
<url><loc>https://munderdiffl.in/blog/tags/agent-design/</loc><changefreq>weekly</changefreq><priority>0.3</priority></url>
<url><loc>https://munderdiffl.in/blog/tags/windows/</loc><changefreq>weekly</changefreq><priority>0.3</priority></url>
+ <url><loc>https://munderdiffl.in/blog/tags/postmortem/</loc><changefreq>weekly</changefreq><priority>0.3</priority></url>
<url><loc>https://munderdiffl.in/blog/tags/community/</loc><changefreq>weekly</changefreq><priority>0.3</priority></url>
<url><loc>https://munderdiffl.in/blog/tags/subagents/</loc><changefreq>weekly</changefreq><priority>0.3</priority></url>
<url><loc>https://munderdiffl.in/blog/tags/markdown/</loc><changefreq>weekly</changefreq><priority>0.3</priority></url>
@@ -926,9 +933,9 @@
<url><loc>https://munderdiffl.in/blog/tags/meta/</loc><changefreq>weekly</changefreq><priority>0.3</priority></url>
<url><loc>https://munderdiffl.in/blog/tags/product-hunt/</loc><changefreq>weekly</changefreq><priority>0.3</priority></url>
<url><loc>https://munderdiffl.in/blog/tags/changelog/</loc><changefreq>weekly</changefreq><priority>0.3</priority></url>
- <url><loc>https://munderdiffl.in/blog/tags/postmortem/</loc><changefreq>weekly</changefreq><priority>0.3</priority></url>
<url><loc>https://munderdiffl.in/blog/tags/feedback/</loc><changefreq>weekly</changefreq><priority>0.3</priority></url>
<url><loc>https://munderdiffl.in/blog/tags/product/</loc><changefreq>weekly</changefreq><priority>0.3</priority></url>
<url><loc>https://munderdiffl.in/blog/tags/discord/</loc><changefreq>weekly</changefreq><priority>0.3</priority></url>
<url><loc>https://munderdiffl.in/blog/tags/reddit/</loc><changefreq>weekly</changefreq><priority>0.3</priority></url>
+ <url><loc>https://munderdiffl.in/blog/tags/telemetry/</loc><changefreq>weekly</changefreq><priority>0.3</priority></url>
</urlset>