TL;DR.
A paper posted to arXiv on November 9, FlowPlan (arXiv:2611.13241), ran Claude Code on 545 real repository issues and asked a simple question: can a coding agent spend fewer tokens if it plans the fix before it edits, and checks the edit against the plan instead of re-reading and re-testing?
The answer was yes, and by a lot:
- Haiku 4.5 on SWE-bench Verified used 0.32x the tokens of plain Claude Code. A third. On SWE-bench Pro, 0.47x. Sonnet 5 dropped to 0.72x to 0.74x.
- Resolution rates didn't move significantly in any of the six model-and-benchmark settings. Changes ranged from −4.6 to +4.5 points.
- The savings came after the edit. Plain Claude Code spent about two-thirds of Haiku's tokens after its first edit, over roughly 31 extra calls of re-reading, diffing and testing. FlowPlan cut that phase to 12 to 18 calls.
The paper reports tokens, not dollars. So we priced it, and found the part that matters for anyone choosing models by price per token:
- Plain Haiku 4.5 cost about twice as much per resolved issue as Sonnet 5 on SWE-bench Pro ($1.49 vs $0.75), and 2.6x on Verified ($0.96 vs $0.37). Haiku 4.5 is exactly half Sonnet 5's price on every token line. It used three to four times the tokens, and solved fewer issues.
- With FlowPlan, the gap mostly closes. Haiku drops to $0.70 and $0.31 per fix. The cheap model's problem wasn't its price. It was its loop.
Below: the results in three charts, why the loop is where the cheap model loses, a plan-first rule set you can put in CLAUDE.md today, and costfix.py, 25 lines that price an agent per resolved issue instead of per token.
Token counts, resolve rates and trajectory figures are from Sepidband, Shin, Wang and Hemmati, "FlowPlan: Reducing the Token Cost of Coding Agents with Abstraction-Guided Planning and Verification," arXiv:2611.13241v1. Dollar figures are our estimates at Anthropic list prices as of November 15, 2026, with an assumed token mix; they are not in the paper and are not Nadir customer data.
What FlowPlan does.
Most token-cutting methods for agents take something away: fewer tool calls, compressed observations, skipped test runs. FlowPlan changes what the agent reasons about. Instead of working over raw source files again and again, it works over a small graph of each function.
- Abstract. Each candidate function is turned into a control-flow graph (CFG) or a data-flow graph (DFG).
- Localize. The agent finds the likely fault on the graph, not by scrolling the file.
- Plan. It writes the fix as explicit graph changes: "add a branch on
Nonebefore the call at node 4", "route the return value through the sanitizer". - Edit. It changes the real source.
- Check. FlowPlan rebuilds the graph and compares the structural change it sees with the one that was planned.
- Verify once. A final check of the whole repair, then stop.
Everything ran on Claude Code v2.1.220, headless, low reasoning effort, one fresh session per issue. The benchmarks were sampled subsets: 158 SWE-bench Pro Python issues, 218 SWE-bench Verified issues and 169 SecBench C/C++ vulnerabilities. Sessions were capped at 80 turns, $2 and 25 minutes (40 turns and $1.50 on SecBench).
The results.
| Setting | Vanilla resolve rate | Vanilla tokens per issue | FlowPlan (CFG) | FlowPlan (DFG) |
|---|---|---|---|---|
| Haiku 4.5, SWE-bench Pro | 43.0% | 3,715K | 0.47x | 0.46x |
| Haiku 4.5, SWE-bench Verified | 61.0% | 3,414K | 0.32x | 0.35x |
| Haiku 4.5, SecBench | 29.0% | 767K | 0.68x | 0.74x |
| Sonnet 5, SWE-bench Pro | 52.5% | 1,152K | 0.72x | 0.76x |
| Sonnet 5, SWE-bench Verified | 73.9% | 803K | 0.73x | 0.74x |
| Sonnet 5, SecBench | 37.9% | 681K | 0.94x | 0.92x |
Token use fell in all six settings, and significantly in five. The paper also reproduced six earlier methods on the same harness. The strongest, skipping execution entirely ("No-execution"), landed between 0.56x and 0.81x. Others, like SHERLOC (0.85x to 1.33x) and AgentDiet (0.79x to 1.13x), sometimes used more tokens than plain Claude Code. FlowPlan was the best or tied for best in four of six settings.
Two patterns stand out.
The weaker model saves more. Haiku 4.5 dropped to a third or half of its tokens. Sonnet 5 dropped by about a quarter. That's because Haiku had much more to lose: on SWE-bench Verified it used 4.3x the tokens Sonnet 5 did for the same issues.
Short tasks save less. SecBench trajectories were only about 15 calls long, so there was no long post-edit loop to cut. The savings there came from smaller context per call (about 31K tokens instead of 51K).
Where the tokens were going.
The trajectory analysis is the most useful part of the paper. In plain Claude Code on Haiku 4.5:
- Two-thirds of the tokens came after the first edit. About 2.42M on Pro and 2.19M on Verified, over roughly 31 more calls of re-reading the file, inspecting the diff and running tests.
- 96% to 98% of all tokens were cache reads. Every one of those 31 calls re-reads the whole session so far. A long verification loop is a long series of full-context re-reads.
- FlowPlan cut the post-edit phase to 18 calls (0.96M) on Pro and 12 calls (0.48M) on Verified. That phase alone was 75% and 74% of the total reduction.
- Planning is cheap. The planning and verification steps added only 2.8 to 3.7 calls and 0.08M to 0.17M tokens per session.
The agent wasn't wasting tokens finding the bug. It was wasting them deciding whether it had fixed it. Without a written plan, "am I done?" has no crisp answer, so the agent reads the file again, runs the tests again, looks at the diff again. A plan turns that into a comparison: did the change I made match the change I meant to make?
There's a striking detail here. The plans weren't usually right. Across 1,090 sessions, the planned graph change matched the reference fix only 39% of the time, and every step agreed with the reference in just 22%. Yet resolution didn't drop. The plan's value was less as a map to the right answer and more as a stopping rule: a definition of done that the agent could check cheaply. We made the case that stopping is the expensive decision in The Stopping Problem; FlowPlan is the first result we've seen that improves the stop without capping steps.
The cheaper model cost more.
The paper stops at tokens. Here's what those tokens cost at list prices.
Haiku 4.5 is $1.25 / $0.10 / $5.00 per million for cache writes, cache reads and output. Sonnet 5 is $2.50 / $0.20 / $10.00. Every line is exactly half. So whatever the mix of reads, writes and output in a session, Haiku costs half as much per token. We assumed 97% cache reads (inside the paper's 96% to 98%), 2% cache writes and 1% output to get dollar figures, but the ratios between the two models don't depend on that assumption.
| Estimated cost | Per session | Per resolved issue |
|---|---|---|
| SWE-bench Pro | ||
| Haiku 4.5, vanilla | $0.64 | $1.49 |
| Sonnet 5, vanilla | $0.40 | $0.75 |
| Haiku 4.5 + FlowPlan | $0.30 | $0.70 |
| Sonnet 5 + FlowPlan | $0.29 | $0.54 |
| SWE-bench Verified | ||
| Haiku 4.5, vanilla | $0.59 | $0.96 |
| Sonnet 5, vanilla | $0.28 | $0.37 |
| Haiku 4.5 + FlowPlan | $0.19 | $0.31 |
| Sonnet 5 + FlowPlan | $0.20 | $0.27 |
FlowPlan rows hold each setting's baseline resolve rate, since the paper found no significant change.
Read it from the top. The model that costs half as much per token cost twice as much per fix on SWE-bench Pro, and 2.6x as much on Verified. It used 3.2x and 4.3x the tokens, and it solved fewer issues, so you pay for its failures too. On SecBench, where sessions are short, the order flips back: Haiku 4.5 used only 1.13x Sonnet's tokens and came out about a quarter cheaper per fix.
Then add FlowPlan. Haiku's cost per fix falls by more than half, below plain Sonnet 5 on both benchmarks ($0.70 vs $0.75, $0.31 vs $0.37). Sonnet with FlowPlan is still cheapest, but the gap shrinks from 2x to 1.3x on Pro and to 1.1x on Verified. The cheap model wasn't overpriced. It was under-scaffolded: it lacked a way to know when it was done, and paid for that in re-reads.
This is the same lesson we keep finding from different angles. A cheaper model that needs more turns can cost more, as in Cheaper on Paper and The Retry Tax. Agents are mostly re-reading their own context, as in Mostly Rereading. FlowPlan puts a clean number on how much of that is the verification loop, and shows that a structural change to the loop beats both a cheaper model and a step cap.
Two cautions. These are 2026's older models: Haiku 4.5 and Sonnet 5, not Haiku 5.5 or Sonnet 5.5. Haiku 5.5 is a tenth of Haiku 4.5's price below 100K tokens but bills 5x past that line (details), and long agent sessions cross that line. We don't know how much Haiku 5.5 loops. And each method ran once per issue, on one agent and one provider, so the authors are explicit that this doesn't prove generalization.
Plan first in Claude Code today.
FlowPlan builds real CFGs and DFGs, and its code isn't something you install in your agent today. But its core idea, a written plan as the definition of done, is something you can approximate with a few lines in CLAUDE.md (or AGENTS.md for Codex). This is our approximation, not the paper's method, and you should measure it on your own repository before trusting it.
## Fixing a bug or making a scoped change
Before editing:
1. Name the function(s) you will change. Read only those, plus direct callers if needed.
2. Write a PLAN of at most 5 lines, in structural terms:
- which branch, condition, call or return value changes, and how
- which test will show the fix (one test, by name)
After editing:
3. Compare `git diff` against the PLAN. Do not re-read whole files.
- If the diff matches the plan: run the one test named in the plan.
- If it doesn't: say what differs, then fix the plan or the code.
4. Stop when the diff matches the plan and the named test passes.
Run the wider suite once at the end, not after every edit.
Three things make it work:
- The plan is short and structural. "Add a
Nonecheck beforeparse()inload_config" is checkable against a diff. "Fix the config bug" isn't. - The diff replaces the re-read.
git diffon a small fix is a few hundred tokens. Re-reading the file is thousands, and re-reading it in a session that's already at 80K tokens costs the whole 80K again at the cache-read rate. - One named test, then stop. The paper's biggest loss was the agent running tests until it felt sure. A named test plus a matching diff gives it something to be sure of.
If you use subagents, this matters even more for the cheap ones. The model you delegate small fixes to is exactly the one FlowPlan helped most.
Price your agent per fix, not per token.
costfix.py turns a session's token count and a resolve rate into a cost per resolved issue. Swap in your own models, token counts and pass rates.
"""costfix.py: price a coding agent per resolved issue, not per token.
Anthropic list prices, $ per million tokens, November 15, 2026."""
RATES = { # 5-min cache write, cache read, output
"haiku-4.5": (1.25, 0.10, 5.00),
"sonnet-5": (2.50, 0.20, 10.00),
"sonnet-5.5": (2.50, 0.10, 10.00),
}
MIX = {"read": 0.97, "write": 0.02, "output": 0.01} # share of total tokens
def per_session(model, tokens):
write, read, out = RATES[model]
blended = MIX["read"] * read + MIX["write"] * write + MIX["output"] * out
return tokens * blended / 1e6
# (label, model, mean tokens per session, resolve rate)
RUNS = [
("Haiku 4.5, vanilla", "haiku-4.5", 3_715_000, 0.430),
("Sonnet 5, vanilla", "sonnet-5", 1_152_000, 0.525),
("Haiku 4.5 + FlowPlan", "haiku-4.5", 3_715_000 * 0.47, 0.430),
("Sonnet 5 + FlowPlan", "sonnet-5", 1_152_000 * 0.72, 0.525),
]
for label, model, tokens, resolved in RUNS:
cost = per_session(model, tokens)
print(f"{label:22} {tokens/1e6:5.2f}M tokens ${cost:.2f}/session ${cost/resolved:.2f}/fix")
It prints:
Haiku 4.5, vanilla 3.71M tokens $0.64/session $1.49/fix
Sonnet 5, vanilla 1.15M tokens $0.40/session $0.75/fix
Haiku 4.5 + FlowPlan 1.75M tokens $0.30/session $0.70/fix
Sonnet 5 + FlowPlan 0.83M tokens $0.29/session $0.54/fix
To get your own token counts, `npx nadir-receipt` reads your local Claude Code and Codex history, prices it at API list prices, and splits it into re-reading context, adding context and answers. If re-reading dominates and your sessions run long after the first edit, you have FlowPlan's problem. It runs locally and makes no network calls; details are on the receipt page.
What this means for choosing models.
The usual way to cut an agent bill is to pick a cheaper model. FlowPlan shows why that can backfire: price per token is a property of the model, but tokens per fix is a property of the model and the loop together. Change the loop and the cheapest model for the job can change too.
So the useful question is never "which model is cheapest?" It's "which model, with this scaffold, on this kind of task, gets it done for the least?" Short, well-scoped fixes with a clear test: a cheap model with a plan-first loop. Long investigations where the model can't tell when it's done: a stronger model may be cheaper per fix even at twice the token price.
Where Nadir fits.
That per-task choice is the one Nadir Auto makes in Claude Code and Codex. Before each turn it asks for a model, keeps the model you configured as the quality fallback and cost ceiling, and checks what a switch would cost in cache re-writes before moving you. It writes a local receipt for every turn, so you can compare what you'd spend per finished task, not per token. It works without a Nadir key on the anonymous decision quota, and inference stays on your own provider account.
For teams, Nadir Lens shows coding-agent spend by team and member, cache economics and agent loops, which is where a long post-edit verification loop shows up first.
We don't publish a savings rate. Measure your own loops first: start with How to Reduce Claude Code Costs, then try the plan-first rules above on a week of real tickets and compare the receipts.