use cases
How loopmath can help you
loopmath is a CLI your agent calls around each coding task. It predicts how each way of running the task will do, on success and on cost, and it learns from every run. Here are four ways that pays off.
01 / switch models
Switch to a cheaper model where it does the job as well
Most teams send every task to their strongest model at high effort, because nobody knows which tasks would do just as well on less. loopmath predicts, for each task, how likely each model and effort level is to give an accepted result, and what each will cost. Where the cheaper option is predicted to do as well, it says so. Where it is unsure, it suggests a try, priced against what the switch would save on every similar task after.
Every run that comes back updates the estimates. The kinds of task where the cheaper model holds up move over to it; the kinds where it falls short stay where they were. Your cost per task goes down, and the results you accept stay as good.
- Tasks arrive.
- loopmath predicts each model's chance of success and its cost. On the smaller model it is unsure.
- It tries the smaller model where it is unsure, and keeps the rest on the large one.
- Results come back: docs and tests pass, config does not.
- The belief updates. Docs and tests stay on the smaller model; config goes back.
- From now on those tasks run cheaper. Cost falls, quality holds.
02 / the frontier
Find the Pareto-efficient frontier across your workflows
A workflow is how the work is split between agents: code only, plan and code, plan, code and review, a second reviewer, or a cheaper model in one of the roles. Each workflow lands somewhere on cost and quality, and most are beaten on both by another one. loopmath puts every workflow you run on one success-cost curve, with ranges that narrow as runs come in, so you can see which workflows are on the frontier and which ones cost you more for nothing.
Then you choose by your own limit: the best result within a budget, or the cheapest workflow that clears your bar. Before each task, loopmath recommend shows the curve with your usual workflow on it and suggests the workflows worth a try.
- Each workflow (who plans, codes and reviews, and on which model) starts as a guess, with wide ranges.
- Runs come in. Each point moves to where it really lands, and its range shrinks.
- The frontier draws itself through the workflows nothing beats on both cost and quality.
- The others fade: for each one, something on the frontier is cheaper and at least as good.
- You pick the workflow that fits your budget: here, a small model as the reviewer.
03 / your harness
Optimize your harness at a quarter of the cost
Harness optimizers such as harness2 improve an agent's instruction file, skills and hooks: a strong model proposes edits, and the edits are tried on the task. They work, and they are expensive. We paired harness2 with loopmath: the same editors propose edits, and loopmath tests them in a small, designed set of runs and estimates which edits help. On 40 coding tasks from WorkBuddy-Bench, with Claude Haiku 5.5 doing the tasks and Claude Opus 5.5 editing, harness2 with loopmath kept about 95% of harness2's gain at about a quarter of its cost: 2.64 against 10.18 dollars per task. harness2 cut down to the same budget kept much less.
04 / check a change
Know whether a change really helps
A new skill, a rewritten prompt, a plugin: each looks better on the two tasks you tried it on. loopmath check-change runs the base and the change in pairs, the same task on both, in a balanced order. After each pair it updates its estimate of the gain, with a range, and it tells you when to stop: adopt once the range clears zero, keep the base if the evidence has not decided by your cap or budget, and in between, what the next pair is worth.
The same gate works inside optimization loops, so a prompt that scored well on three examples by luck is not kept. It plugs into DSPy's GEPA and MIPROv2, and it reads claude plugin eval results as they are.
- You change the harness: a new skill, a rewritten prompt, a plugin.
- loopmath plans paired runs: the same task on the base and on the change, in a balanced order.
- After each pair it updates the estimated gain and its range.
- While the range crosses zero, the answer is: run another pair, and here is what it is worth.
- Once the range clears zero, the verdict is adopt. If the cap or the budget comes first, the base stays.
Try it on your own runs
loopmath is open source and runs on your machine. Install it, let your agent onboard it, and it starts learning from the runs you already make.