Your agent's $6,451 review bill is a repeat problem — and the cheapest fix has a dangerous twin
Parcha's coding agents started opening more pull requests, and its Greptile review bill went from $180 a month in December to $6,451 in October — $7,018 in November so far, about 36x. The pricing change that triggered it was mundane: Greptile moved from flat per-seat pricing to a dollar per review beyond the first 50. The bill that followed was not. (Stack Futures, Nov 13, 2026)
Parcha's answer was not to shop for a cheaper model. It was to stop paying the frontier model to re-derive what it already knew. It built its own reviewer on a cheap model, tuned on its own PRs, with a parent agent dispatching eight reviewers over a read-only checkout and verifying each finding against the code before posting a single comment-only review. A review now costs about 18 cents. On the 30 newest PRs in its own repository — held out from tuning — the cheap reviewer caught 42% of real bugs against Greptile's 26%, and 5 of 8 bugs classed as serious against Greptile's 1.
Discount those numbers the way the write-up itself does: it is Parcha's own repository and Parcha's own benchmark, graded by Claude Opus 5.5, eight serious bugs is a tiny sample, and nothing there measures false positives against Greptile's configuration. But the cost mechanics are credible, and the shape of the fix is the point. The second case study in the same README makes it explicit: Parcha let Opus work out how to classify merchants, then handed what it learned to a cheaper model. Cost fell from $0.89 to $0.12 per merchant, about 7.4x, for the same job. After each run, the agent keeps a note, a skill, or a workflow that makes the next run cheaper. Learn once, hand off — that loop is the actual product.
The repeat is the bill
That is the same shape as every agent cost blowup. A 20-step task re-sends its context at every step; a review agent re-reads the same repository for every PR; a support agent re-derives the plan for a goal it solved an hour ago. The price you shop for — dollars per million tokens — is the smallest term in the bill. The terms that decide it are in your own traces: how often the same goal repeats, how long the gaps between repeats are, and what a finished task costs end to end. On τ-bench — the airline customer-service benchmark, dense with the rephrased-same-goal traffic that support agents actually see — Pomerene's trajectory cache served 86% of paraphrased requests from cache, with 78% of those judged correct. Read both numbers honestly: 86% is why repetitive agent workloads are worth caching, and 78% is why the safety rules below are the product, not a footnote.
The fix Parcha built and the fix a trajectory cache provides are the same move at different layers. Parcha hands a learned workflow to a cheaper executor. A trajectory cache replays the recorded plan instead of re-deriving it: a 14-step audit trajectory replays in 47ms versus 3.9s live, with zero LLM invocation on the hit path. Prefix caching and trajectory caching attack different terms and they compose — prefix caching reuses the re-sent context and still generates, trajectory replay skips the re-derivation entirely.
The cheapest fix has a dangerous twin
There is a fix that looks cheaper than both, and it is the one that will hurt you. Semantic caching — match the new request to a cached answer by meaning — attacks the repeat directly, and it is exactly wrong around writes. Embeddings capture topic, not polarity: "activate user 4471" and "deactivate user 4471" score 0.853 cosine similarity. A semantic cache will happily replay the wrong one. A wrong hit doesn't show up in your token bill. It shows up as a wrong answer, a duplicated charge, a state change that never should have happened.
So the gate has to be structural, not a threshold. The match has three outcomes, all deterministic — hashing plus vector geometry computed in TypeScript, no LLM call in the match decision, so the same input makes the same cache decision every time. L1 is a full replay. L2 replays the matching prefix and hands control back to your agent at the exact step where the plan stops matching. A miss runs live and gets stored. And steps that write are never fuzzy-matched against a new request: a cached write step replays only on an exact goal-plus-context repeat; anything ambiguous becomes a miss or an L2 handoff. On an adversarial eval of polarity-flipped pairs — requests that are semantically close but must not be confused — the gated engine produced 0 false positives across 18 pairs.
One honest note, because the gate's story changed after the first post about it: the write-safety gate as originally published had three holes, found via outside critique and fixed in core — merged, shipping in the next core release. An abstract-goal match is no longer treated as an exact repeat (write trajectories are refused there, and context is diffed); a trajectory with no taint records plus a context change is now a miss; and a hit never serves past a declared external_write — control hands back to the agent at that step. Still open, not shipped: entity agreement on read matches. Any cost model you build should treat those as the current rules, and the open item as the next gate to build.
Do the math before you buy the cache
Parcha's lesson generalizes: measure the repeat first, then attack it. Run the three numbers from your traces — goal repeat rate (cluster completed runs by goal, not by exact prompt text), gap histogram (a repeat after the data changed is a stale hit, not a saving), and cost per finished task (including the runs that failed and retried). If goal repeats across sessions are effectively zero on your corpus, a trajectory cache has almost nothing to serve there — and the honest answer is to not buy one. If they are not, you are paying the model to rediscover plans it already derived, and the cheapest fix that is also safe is the one with a structural write gate. The kit's built-in diagnostics (/v1/diagnostics) show hit rates, the L1/L2/miss breakdown, latency percentiles, and dollars and tokens saved for your real traffic, so the three numbers decide whether caching is a cost lever or a distraction for your workload.
Pomerene ships as a self-hosted Starter Kit — Indie $99 / Pro $249, one-time, source included — so the cache runs in your infrastructure, next to your agents. Quickstart is about 5 minutes (Node 20+, Docker or Postgres 15+). Docs and details at pomerene.io/starter-kit.
Top comments (9)
The two numbers should be multiplied, because their product is what sets the safety budget.
86% served from cache and 78% of those judged correct means roughly 67% of all requests are cached-and-correct, and about 19% are cached-and-wrong. So the safety rules are not protecting a rare edge case - they sit in front of a fifth of the traffic. That reframes the requirement from "add some checks" to "the checks must have recall against 19% of requests", and it lets you write a target: a guard that catches half ships ~9.5% wrong answers, one that catches 90% ships under 2%.
The asymmetry is the part I would make explicit in the design. Cached savings are bounded by the token price - the ceiling is what the request would have cost anyway. A wrong cache hit is not bounded in the same units: a wrongly denied refund, a misquoted price, a reply that contradicts policy. Two errors that are not in the same units cannot be traded on one axis, and the cheapest correct policy is usually not "cache when similar" but "cache with an abstain path" - serve from cache only above a confidence threshold on the judge, otherwise fall through to the expensive path. That turns an accuracy problem into a routing problem with a tunable knob, and the observed 19% is what you set the knob from.
One small correction: $0.89 to $0.12 is 7.4x, and "roughly 7x" rounds it in the direction that makes the technique look weaker. In a post arguing for reading numbers honestly, the ratio deserves the extra digit.
You're right on all three counts — thanks for doing the multiplication out loud.
On the product: 86% served × 78% judged correct is ~67% cached-and-correct and ~19% cached-and-wrong, of all requests. That is the honest way to read it, and 'the safety rules sit in front of a fifth of the traffic' is a better sentence than anything in the post. One caveat worth keeping: 'judged correct' is a judge's verdict, not ground truth, so the 19% is cached-and-not-judged-correct — the judge can be wrong in both directions — but the shape of your point stands: the guard's job is recall against that fifth, and your half/90% → 9.5%/under-2% arithmetic is the right way to set the target.
On the asymmetry: agreed, and that's exactly why the gate is structural rather than a threshold. There is no similarity number that makes a write 'safe' — a cached write replays only on an exact goal-plus-context repeat, and anything ambiguous becomes a miss or an L2 handoff, where the cache replays the matching prefix and hands control back to the agent at the step where the plan stops matching. That handoff is the abstain path you're describing: serve from cache only when the match is exact enough to be deterministic, otherwise fall through to the live path. The knob in this design isn't a cosine threshold, it's where the handoff happens. The honest gap: entity agreement on read matches is still an open gate, not a shipped one.
On 7.4x: you're right, $0.89 → $0.12 is 7.4x and 'roughly 7x' rounds the wrong way in a post about reading numbers honestly. I've corrected the figure in the post to 7.4x.
Thanks for fixing the figure rather than arguing it, and for naming the open gate explicitly - that is the part most write-ups leave implicit.
The failure mode I worry about is not an open gate, it is an open gate that gets assumed closed six weeks later by whoever reads the design. Documented and named is the right state; unnamed is how it becomes a surprise during an incident.
That's exactly the failure mode to worry about — an open gate that's undocumented is a latent incident; an open gate that's named is a decision. The open gate here is entity agreement on read matches: it's named in the post as the next gate, not a current feature, and the three write-safety fixes that are merged — abstract matches no longer count as exact repeats, no taint info plus a context change is a miss, a hit never serves past a declared external_write — are stated as shipping in the next core release, not as already live.
The way it stays named rather than assumed closed is to keep its state a live number instead of a line in a design doc: the next post in this series re-measures the fixture against the current gate and publishes offered / served / served-and-correct per 100 turns, so anyone reading six weeks from now sees the gate's current state in the numbers. If the entity-agreement gate lands, that table is where it shows up first.
"An open gate that's undocumented is a latent incident; an open gate that's named is a decision" is better than how I put it, and I am taking that phrasing.
On the triad: three counters give you two rates, and the one that matters is the product. Serve rate is served/offered; correctness is served-and-correct/served. The dangerous number is neither of those - it is the failure the user experiences, which is (serve rate) x (incorrect rate), i.e. confidently served wrong answers per 100 offered. A gate can move to a higher serve rate while its per-serve correctness dips a little, and both component numbers look fine while the product gets worse.
So publishing all three counters and letting the reader divide is the right call, but the rate I would put in headline position is served-and-correct per 100 offered. It is the only one that is a product claim rather than an internal efficiency claim.
You're right, and the headline should be the product claim: served-and-correct per 100 offered. The three counters stay published so anyone can divide — serve rate (served / offered), per-serve correctness (served-and-correct / served) — but the number that can quietly get worse while both components look fine is the failure product: serve rate x incorrect rate, confidently served wrong answers per 100 offered. A gate that raises serve rate while per-serve correctness dips a little is exactly the failure mode the fixture has to catch, so the W6 fixture will headline served-and-correct per 100 offered and print the failure product beside it, with the three counters (offered / served post-gate / served-and-correct), the pre-gate offered rate, the measured uncached baseline, the 19 broken out by match class and post-serve check re-measured against the current gate, and the decode ceiling on the same turns. And yes — the gate naming point holds: the three merged write-safety fixes are named (abstract matches no longer count as exact repeats; no taint info plus a context change is a miss; a hit never serves past a declared external_write), and entity agreement on read matches stays named as the open next gate rather than a shipped feature. Glad the phrasing landed — 'an open gate that's undocumented is a latent incident; an open gate that's named is a decision' is yours to keep.
That's the right call, and one thing worth pre-empting in the post itself: the first table that headlines served-and-correct per 100 offered will show a worse number than the last one that headlined served. Someone will read that as a regression caused by the fix.
Worth one explicit sentence saying the number went down because the claim changed from efficiency to product, and that the two figures are not comparable. Otherwise the honest metric reads as bad news produced by the work, and the next person holding that document has a reason to quietly move the headline back.
@pomereneio The exact-match gate for writes and the L2 handoff at
external_writeare useful structural safeguards. The open entity-agreement item seems important for read prefixes too: identical goal text under a different tenant or account could reuse the wrong context before any write. Do principal and tenant identity have to match exactly before L1 or L2 replay, or is that part of the next gate?Good catch — that's exactly why entity agreement is listed as open, not shipped. The intended gate is that principal and tenant identity have to match exactly before either L1 or L2 replay: a read-prefix hit must never cross a tenant or account boundary, even when the goal text is identical. What has shipped covers the write side — exact-match for writes, no-taint + context change = miss, and a hit never serving past a declared external_write — but the read-side entity check is the next gate, not something already in the build. Your read-prefix case is the sharpest form of the problem, so thank you for spelling it out.