Curing version drift with a delta the model reads first | Tool-Calling Efficiency (TCE)
If a coding agent fails because its knowledge of a tool is frozen at training time, you shouldn't need to retrain it. Hand it the current form of the command at inference time. We tested whether that works, and what it saves.
Series: Tokenomics (3 articles)
- 2Curing version drift with a delta the model reads first | Tool-Calling Efficiency (TCE) This article
First, what "version drift" is
Every model has a knowledge cutoff, the date its training data stops. Command-line tools keep changing after that date. So a model can be perfectly smart and still type a command that was correct when it was trained but is wrong today. The textbook case:
docker-compose up (a hyphen, the old v1 binary) became docker compose up (a space, a subcommand) years ago, yet models trained on older data still emit the hyphen form. The command fails not because the model reasoned badly, but because its factual knowledge of the tool is stale. We call this version drift.In an earlier post we measured how common this is across 29 models on 30 version-sensitive tasks, and found that the staleness of a model's training cutoff predicts how often it drifts, at Pearson r = −0.88 (the older the cutoff, the more failures). That post diagnosed the disease. This post is about the fix, and about being honest where the fix is still a projection rather than a live measurement. You don't need to have read the first post to follow this one.
The thesis
If drift is caused by knowledge frozen at training time, the fix should not require retraining: hand the model a delta, "the current form of this command is X", at inference time. The question is whether that injection (a) raises command correctness and (b) net-saves tokens once its own context cost is paid.
Those are two separate claims, and we test them with two separate experiments, because a raw model and a real coding agent fail differently. A raw model gets one shot: wrong command → FAIL. A coding agent runs the command, sees the error, and retries, so drift shows up there not as failure but as waste, the failed attempt plus the error plus the retry. The first experiment measures correctness; the second measures wasted tokens.
Experiment one, does the delta fix correctness?
The first experiment is a single-response test across many models: give each of the 29 models a version-sensitive task, capture the one command it emits, and grade it with an executable oracle, the same setup as the earlier diagnosis. Now we add three ways of helping the model: Control (no help), arm A (prepend the relevant delta to the system prompt, so it's there before the model acts), and arm C (retrieve the delta and retry only after a first-attempt failure). A "delta" here is just a short note of the form "the current form of this command is X." We ran each two ways: an oracle config that feeds the exactly-right delta (the ceiling of what's possible) and an exact-match config that must retrieve the right delta from a shared store on its own, the realistic pipeline.

Config | Control | A · system-prompt | C · retry-on-fail |
|---|---|---|---|
Oracle (ceiling) | 58.5% | 95.3% (+36.8) | 96.1% (+37.6) |
Exact-match (realistic) | 58.6% | 95.1% (+36.4) | 95.7% (+37.1) |
The delta lifts first-attempt command correctness from ~59% to ~95%, a +37-point swing. And the realistic exact-match retriever nearly matches the oracle ceiling, so the gain isn't an artifact of a hand-fed answer key, the store actually finds the right delta on its own. (Arm A and arm C land in the same place here because a single-response test has no real retry loop yet; the two arms diverge in the second experiment, where retries cost real tokens.)
The number that closes the loop
−0.97
Plot each model's baseline correctness against how much the delta helps it, and the points fall on a line: Pearson r = −0.97. The stalest models gain most, Llama 3.1 8B and Nova Micro climb from ~35% to nearly 100%, a +60-point rescue, while the newest models barely move (Opus 4.7: 90% → 97%) because they had almost nothing to cure.

The earlier diagnosis found staleness predicts failure at r = −0.88. The fix's mirror: the delta's benefit is predicted by that same staleness at r = −0.97. The fix undoes precisely the deficit the drift created.
Experiment two, does it save money in a real agent?
Correctness is the single-response story. The second experiment is a real coding-agent test: instead of grading one command, we let an actual agent work a task end to end. In a real agent the fix is supposed to erase the retry loop, the wrong command, the error, the correction, so what matters is tokens, not just pass/fail. We put a real coding agent (Claude Code) inside a container where every CLI is at its current version, wired the injection into a hook that fires just before each command runs, and measured turns and tokens to success with injection off versus on.
Here we have to be honest about what the first live run found, which is a null result, and an informative one. On a current-cutoff model (Claude Haiku 4.5), across 77 shell commands the agent actually ran, zero carried stale syntax. The agent already knows the current CLIs and self-corrects, so there was no retry loop to eliminate, and injecting anyway just added context tokens. That is exactly what the −0.97 curve predicts for a model with a recent cutoff, the models that barely drift have almost nothing to cure. The harness works end to end and the injection channel is verified live; what it lacks is a drift-exhibiting agent to measure against.
Building it turned up one more instance of the phenomenon eating its own tail: Claude Code's hook API had itself drifted. Our injector used the old
{"decision":"approve"} output schema and was a silent no-op on the current version until we caught it and switched to hookSpecificOutput.additionalContext . Version drift, all the way down.
So we projected the savings, honestly
The real-agent test is Claude-only by design (the agent is Claude Code), and every current Claude model is recent-cutoff, so no live run can manufacture drift that isn't there. Rather than fake it, we project the token savings from measured inputs. The model is one line:
net_gain(task) = P(drift) · retry_loop_cost_saved − injection_overheadEvery term is measured except one:
- P(drift) per model = 1 − control pass rate, straight from the single-response test (13% for the newest model, up to 67% for the stalest).
- injection overhead = the extra input tokens each arm costs, measured in the single-response test (~110 tokens for arm A, paid always; less for arm C, paid only on failure).
- per-turn agent cost = what one real Claude Code turn burns, measured from the real-agent control runs (~$0.005/turn).
- R = retry turns per drift, the one thing the live run couldn't measure (Haiku never drifted). So we don't invent a point estimate, we sweep it over {1, 2, 3} and report the whole band.

Retry cost R | Mean net (arm A) | Mean net (arm C) | Range across models |
|---|---|---|---|
1 extra turn | +$0.0020 | +$0.0021 | +$0.0006 → +$0.0033 |
2 extra turns | +$0.0041 | +$0.0041 | +$0.0013 → +$0.0067 |
3 extra turns | +$0.0061 | +$0.0062 | +$0.0019 → +$0.0100 |
Three things fall out, and all three match the correctness story:
- Net-positive everywhere. Even the newest model at the cheapest retry assumption saves. One skipped retry turn (~$0.005) dwarfs the ~110-token injection cost, so overhead never exceeds the loop it prevents.
- Arm C ≥ arm A everywhere. C pays nothing on tasks the model already gets right, so it wins outright where drift is rare (the newest models) and ties A where almost everything drifts.
- Savings scale with staleness, the token-side mirror of the −0.97 correctness curve. The stalest models save 3–5× what the newest do.
The live null and the projection are the same result seen from two ends. Current Claude sits at the far-right, low-drift edge of this curve, where projected saving is smallest, which is exactly where the live run measured ~zero. The cure isn't unnecessary; it's unnecessary yet, for the frontier model, on the tasks it already knows.
What the projection is, and isn't
It is a projection, not a live agent measurement. The load-bearing assumptions, R and a constant per-turn cost, come from a 13-run, single-model, single-repeat real-agent test. Treat the shape (positive, staleness-scaled, C ≥ A) as the finding and the absolute dollars as order-of-magnitude. Measuring it live needs an agent that actually drifts, an older-cutoff model in the loop, or a synthetic-drift harness that strips a current model's version knowledge. That's the next build.
How the fix actually works
There's no retraining and no model surgery. A PreToolUse hook sees the command the agent is about to run, checks it against a small delta store (regex patterns for known stale forms → the current form), and on a match hands the agent a note before the command executes:
⚠️ this command may use STALE CLI syntax (class-8 drift): • [docker-compose-v1-to-v2] `docker-compose` (hyphen) is the v1 binary; v2 is the `docker compose` subcommand. suggested: docker compose up -dThe store is deliberately dependency-free and self-refreshing: the PostToolUse hook harvests stale → correct command pairs whenever the agent fails and then succeeds at a fingerprint-matched command, so real sessions grow the store for free. The whole mechanism is packaged to drop into any Claude Code project, see the repository below.
What's next
- Get the measured dollar number. Put a drift-exhibiting agent in the loop (older model or synthetic-drift harness) and measure net tokens saved live, to confirm the projected shape.
- Expand past the conservative suite. Today's 30 tasks skew to the lowest-drift class and lack a dedicated non-drift control stratum, so "without hurting outcomes" is only lightly tested. Add high-drift renames plus a clean control set.
- Embedding retrieval as a second stage. Exact-match can only understate the fix (a miss injects nothing); an embedding retriever trades higher recall for mis-fire risk, a separate question that doesn't gate this result.
Method notes: single-response test, 29 models on AWS Bedrock, 30 version-sensitive CLI tasks, 3 arms × 2 retrieval configs, 960 graded rows each, executable-oracle graded, correlation is Pearson r over per-model averages (n = 29). Real-agent test, real Claude Code (2.1.212) headless in a current-CLI container, Haiku 4.5, 13 tasks × 2 arms. Savings are projected from the single-response drift rates and the real-agent per-turn costs with retry depth swept over {1,2,3}; see
simulate_savings.py and TRACK_A_SIM_FINDINGS.md . Charts generated numerically from the result JSON via make_cure_charts.py .Series: Tokenomics (3 articles)
- 2Curing version drift with a delta the model reads first | Tool-Calling Efficiency (TCE) This article
Enjoyed reading this content? Let the author know!
Your likes, comments, shares, and saves help creators reach more builders.
Loading recommendations
Loading article