Your Coding Agent Is Paying to Think Twice — This Trick Cuts Its Token Bill by 88%
Watch a coding agent fix a bug and you will see something quietly wasteful. It decides what to do, runs a tool, gets the result back — then thinks the whole thing through again before the very next step, even when the first decision already settled it. Multiply that by every compile, test run, and file read, and a large share of your token bill is not intelligence. It is repetition.
A new paper attacks exactly that waste, without retraining the model. The paper is "HarnessMM: Recursive Self-Improvement for Harness Token Efficiency" by Yuhua Jiang, Chang Xu, Feifei Gao and Li Zhao (arXiv:2610.32813, submitted 23 October 2026). Its idea is simple: if a decision has already been made, resolved down to the exact action and arguments, and nothing has changed since, do not re-derive it — reuse it, under guard. Here is what the researchers did, why it matters, and how you can steal the pattern.
What the researchers did
First, some vocabulary. The "harness" is the scaffolding around a language model: the code that calls tools, feeds results back, and loops until a task is done. The "actor" is the model itself, whose weights stay fixed throughout — HarnessMM changes the harness, not the model, so it can sit on top of an existing agent setup.
The core observation is that harnesses repeatedly invoke reasoning after tool feedback, even when an earlier call already fixed the next action. Example: the agent writes a file, then needs to compile it, and if compilation succeeds, run the tests. That sequence was already decided — yet most harnesses still call the model again after the compile result, just to be told to do what it had already planned.
HarnessMM replaces that re-reasoning with guarded decision reuse. Its pieces are: Executable Decision Graphs — decisions stored with exact actions, literal arguments, causal dependencies, and public guards, checkable conditions like "compilation succeeded", not vague impressions. A controller at the model-tool boundary — when tool feedback arrives, it checks whether a stored decision can be activated from the observed receipts, and reuses it instead of calling the model again. Guarded Decision Reuse — a decision activates only when its guard is satisfied by what was actually observed; the representation restricts what feedback may change, so a tool result cannot silently rewrite the plan. Certified Callback Substitution — a reused decision runs through the native interface, and the removal of the registered slow callback, the expensive reasoning call that would otherwise have run, is recorded. Recursive self-improvement (RSI) — harness configurations are refined iteratively from training feedback, with validation selecting the deployed one. The harness learns to be cheaper; the model stays the same.
Reuse has an escape hatch: new semantic decisions, unsupported evidence, and selector abstention all send control back to the original actor. If the situation is genuinely new, or the evidence does not support the stored decision, the model reasons again. HarnessMM is a shortcut for settled decisions, not a replacement for thinking.
Why it matters
The numbers are striking because quality held steady or improved — measured on complete tasks, not just token counts. On HumanEval, HarnessMM preserved Codex success at 90.82% while reducing tokens per task from 66.72 thousand to 47.02 thousand, a 29.54% saving.
The DeepSeek Harness result is the eye-catcher: success rose from 71.43% to 85.71% while tokens per task fell from 96.28 thousand to 11.62 thousand — an 87.93% saving. Fewer tokens and better results sounds paradoxical, but every unnecessary reasoning call is also a chance for the model to second-guess a good plan or wander off track. Removing pointless calls removes those failure modes too.
A separate MBPP ablation sharpens the comparison: 26.91% lower cost than single-use graphs and 19.52% lower cost than retained callbacks. It is not just "store the plan" that wins — it is storing it, reusing it across steps, and letting the harness configuration improve through validation.
Three lessons follow. Reasoning is a cost centre: every call costs tokens, latency, and money, so calling the model only for genuinely new decisions is cheaper at the same quality. Decisions should be data, not text: a prose plan cannot be checked, but a decision with exact actions and a public guard can be verified mechanically. Guards are the whole game: without an observable condition that must hold, you replay yesterday's decision into today's changed world; with it, reuse is auditable and safe.
How YOU can use it
You probably cannot download HarnessMM as a finished product today — the paper describes a method and its evaluation, not a plug-in. But the pattern is directly usable in any agent harness you build, whether it drives code, browsers, or business tools. The code sketch below is illustrative, not code from the paper.
Step 1: Write decisions down as checkable records, not chat history. When your agent makes a plan, store each step as a small record: the exact action, its literal arguments, what it depends on, and the guard that must be true before it runs — for example, "If compile succeeds, run pytest on tests/test_api.py." The guard is observable in the tool receipt.
ILLUSTRATIVE sketch — not code from the paper:
decision = {"action": "run_tests", "arguments": {"command": "pytest tests/test_api.py"}, "depends_on": ["compile"], "guard": "compile_exit_code == 0"}
receipt = tools.compile()
if guard_holds(decision["guard"], receipt): execute(decision) # no model call needed
else: plan = actor.decide(receipt) # genuinely new situation: think again
Step 2: Put a controller between the model and the tools. Route tool results through a small controller first: does any stored decision match this receipt, with its guard satisfied? If yes, execute it and log the skipped call. If no, or if the evidence is ambiguous, call the model — that abstention is the safety valve keeping reuse honest.
Step 3: Measure complete tasks, not just tokens saved. Copy the paper's discipline: quality and cost were established on complete-task measurements. Track success rate and tokens per completed task together, before and after you add reuse. If tokens fall but success falls with them, your guards are too loose. If success rises as tokens fall, you have found what HarnessMM found — some of your model's reasoning was not just expensive, but actively harmful. Review the skipped-call log weekly: every reuse is auditable, and every abstention is a case your guards did not cover yet.
One guardrail: never let a reused decision touch an irreversible action — a payment, a deletion, a message to a real person — without a human-confirmation gate, no matter how clean the guard looks. Reuse is for settled, reversible steps.
Key takeaways
Agent harnesses waste tokens by re-reasoning decisions they have already made. HarnessMM stores those decisions as Executable Decision Graphs — exact actions, literal arguments, dependencies, and public guards — and lets a controller reuse them when observed receipts satisfy the guard, falling back to the model for anything new or unsupported. On HumanEval it preserved Codex success at 90.82% while cutting tokens per task by 29.54%; on the DeepSeek Harness it raised success from 71.43% to 85.71% while cutting tokens by 87.93%.
The practical lesson is portable: make decisions checkable records, guard every reuse with an observable condition, abstain to the model when in doubt, and measure success per completed task alongside cost. The cheapest reasoning call is the one you never needed to make — and sometimes, it is also the one that would have talked your agent out of a good plan.
Read the original paper: HarnessMM: Recursive Self-Improvement for Harness Token Efficiency (arXiv:2610.32813) by Yuhua Jiang, Chang Xu, Feifei Gao and Li Zhao. Link: https://arxiv.org/abs/2610.32813
Comments
Post a Comment