A gate without a spend ceiling is not a gate
My pipeline could tell you whether the work was good. It could not tell you that the answer had cost four hours and eight failed attempts to reach.
My pipeline had gates I was proud of. Criteria, thresholds, a reviewer that was not the author, a verdict that could say no.
Then I asked it a question it could not answer: what did this cost?
It knew the artifact was good enough. It had no idea whether reaching that verdict took forty minutes or four hours, twelve dollars or two hundred. It could not tell a clean first-pass approval from a run that limped over the line on its tenth attempt at the same unresolved issue.
Those two runs are not the same result. Only one of them is a working system.
The cap that bounds the wrong thing
I had iteration caps — ten loops per phase, maximum. That felt like control. It is not. An iteration cap bounds how many times a loop runs, not what each turn costs, and in my pipeline one review round fans out to eight verifiers running in parallel. That single step can cost more than every phase before it combined, and no cap anywhere notices.
So I shipped a ledger. A budget declared before work starts. Checked when crossing between phases and on every loop back, never mid-work. Cross an edge already over the ceiling and the run stops with an explicit verdict instead of quietly finishing and presenting you with a bill.
The part I underestimated is the route analysis. It measures the spend that did not move the run forward — everything consumed by attempts that ended in a loop back — and flags reasons that repeat. That last number is the uncomfortable one. A run that reached a pass on the tenth identical retry is a failing run wearing a passing badge, and nothing in my old reports would have shown it.
Why this is worth more than it looks
There is a study from March that made me rethink how I add anything to an agent at all.
Researchers gave a coding agent one extra thing: a map of which tests cover which code, handed over as a plain text file the agent could read. Regressions — tests that used to pass and stopped — fell from 6.08% to 1.82%. A 70% drop from one file.
The same study ran a second branch. Instead of the map, they gave the agent procedural instructions: work test-first, follow this discipline. Regressions rose to 9.94%. Worse than doing nothing at all.
Give an agent context, not procedure. Telling it how to behave made things measurably worse. Telling it what is true made things 70% better. Every instruction I am tempted to write now gets that test first.
Which is also why the budget lives in the state file rather than in a prompt asking the agent to be careful with money. An agent cannot be careful with a number it cannot see.
If you are running agents and cannot say what last week cost you, you are not running an autonomous system — you are running up a bill. I build the part that can say no. Send me the system and the deadline.