Lesson 6 · 9 min
Continuous cost regression in CI
A prompt change can quietly 2× the cost per call. Without a CI gate you find out from the monthly bill. The pattern that catches it at PR time.
What to gate
Any change that touches a prompt, system message, tool definition, or context-assembly logic. The pattern:
- Run your eval set with token counters enabled.
- Sum input + output tokens per case.
- Diff the per-case spend against the prior commit (stored as a baseline).
- Fail the build if total spend goes up by more than X% (typical: 15%) without a quality justification.