When the Model's Memory Goes Stale, Measuring CLI Version Drift | Tool-Calling Efficiency (TCE)
Coding agents don't only fail because they reason badly. Sometimes they fail because their knowledge of a tool is frozen at training time, and the tool moved on. We measured it across 29 models.
Series: Tokenomics (3 articles)
- 1When the Model's Memory Goes Stale, Measuring CLI Version Drift | Tool-Calling Efficiency (TCE) This article
A coding agent writes
docker-compose up -d . It fails. The reflex is to blame the model's reasoning. But look closer: the model isn't confused about what you asked, it's using a command that was correct in 2022 and quietly renamed to docker compose (no hyphen) in 2023. The model's mental model of the toolchain is simply out of date.We call this version drift. It's a distinct, under-studied failure class, and unlike a reasoning error, it has a cheap fix that doesn't involve retraining anything. This post is about proving it's real, measuring how bad it gets, and where it bites hardest.
The hypothesis
The claim we set out to test, precisely:
A measurable fraction of tool-call failures are caused by the model's knowledge being pinned to training-era tool versions, ``separately attributable`` (it's stale knowledge, not bad reasoning) and ``separately fixable`` without retraining. We'd have been wrong two ways: if drift turned out to be ~0%, or if the newest models failed as often as the oldest. Spoiler, neither happened.
Where this started: a baseline on real sessions
We didn't begin with version drift, we backed into it. This work lives inside a broader project on tool-call efficiency, and the first step was purely observational: ingest 84 real Claude Code sessions, 4,046 tool calls, and ask where the token budget actually goes.
The answer reproduced the industry finding on our own traces: read and search operations dominate, accounting for ~39% of tool-call tokens, squarely in line with Microsoft's FastContext, which put read/search at 46.5% of an agent's tokens. So far, so expected.
But sitting inside the ~4% error rate was a failure pattern that didn't look like bad reasoning at all, commands that failed because the tool itself had changed since the model was trained. That observation is what turned into this experiment: take the phenomenon out of noisy real logs and into a controlled setting where we could measure it cleanly.
The baseline told us ``where`` tokens go. It also surfaced a failure class nobody isolates, which is ``what`` the rest of this post measures. For context, we track eight classes of tool-call waste, redundant calls, retries, hallucinated parameters, over-scoped reads, poor sequencing, wrong-tool, speculative calls, and stale-schema. The first seven adapt an existing credit taxonomy (TACO's useful / redundant / misleading spine). The eighth, stale-schema, our name for version drift, is the one nobody else isolates, because its symptom looks identical to an ordinary invalid-parameter error. The difference is the cause: not a model mistake, but context that's gone out of date. Same symptom, different fix, and that's the whole reason it's worth separating out.
What would make this real
Before running anything, we wrote down what would count as a genuine result rather than a fishing expedition, three bars:
- Measurable. Drift has to be a non-trivial, quantifiable fraction of failures, not statistical noise.
- Ordered. Failures should track knowledge cutoff: older models drift more. A dose-response, not a coin flip.
- Attributable. We must be able to separate stale-schema failures from genuine reasoning errors, objectively, not by vibes.
And one bonus bar that shaped the whole design: an objective oracle. A command either works on the current tool or it doesn't. No model judging another model, no human hand-labeling a thousand transcripts. As you'll see, hitting that bar is what most of the engineering went into.
A field guide to version drift
Before the numbers, it helps to see the shape of the thing. Version drift isn't one bug, it's a family, and each member has a different flavor. Here are the ones we built tasks around, drawn from real changelogs:
Change | The stale answer | The current answer | Type |
|---|---|---|---|
Compose v1 → v2 | docker-compose up | docker compose up | renamed subcommand |
kubectl dry-run | --dry-run (bare) | --dry-run=client | deprecated flag |
git branching | git checkout -b | git switch -c | outdated default |
uv self-version | uv version | uv self version | renamed subcommand |
Terragrunt run | terragrunt run-all | terragrunt run --all | renamed subcommand |
AWS SSO login | aws sso configure (never existed) | aws configure sso | hallucinated |
Cargo add dep | edit Cargo.toml by hand | cargo add | unknown new tool |
uv package mgr | "what is uv?" | uv pip install | unknown new tool |
Notice the range. Some are a single character (the hyphen in
docker-compose ). Some are a whole tool the model has never heard of ( uv , first released February 2024). And one, aws sso configure , is a command that has never existed in any version; the model reversed the word order of the real aws configure sso and stated it with total confidence. That last category matters: a stale model doesn't just fall behind, it fabricates a plausible-sounding present.Every task was authored from an official changelog or migration guide and pinned to a real, dated version change, then double-checked against current documentation, because (as we'll admit later) our own first drafts were riddled with the very errors we were trying to measure.
How this compares to what's out there
Version drift isn't unknown to the field. What's new is the angle. Four families of prior work, and where each stops short:
Approach | What it does | What it doesn't | Where ours helps |
|---|---|---|---|
FastContext / TACO | Prove tool-call waste exists & costs tokens | Don't isolate why a call fails | We name a specific, fixable cause: version drift |
GitChameleon / VersiCode | Measure version-conditioned code generation | Scope is Python library APIs, not CLIs; string-match grading | We cover shell CLIs, graded by real execution |
ToolBench / StableToolBench | Large-scale tool-calling capability eval | Hide API drift with cached/virtual APIs; LLM-judge, no exit code | We treat drift as the signal & grade by execution |
Terminal-Bench / InterCode | Real command-execution harness | Version-agnostic, no knowledge-cutoff dimension | We add the cutoff axis & a direct version probe |
No existing method has both an executable CLI oracle and version-sensitivity tied to model cutoff. That intersection is the gap we set out to fill.
The most instructive of these is ToolBench. They ran into version drift the hard way, their real-world APIs kept getting deprecated and breaking evaluation, and their solution was to engineer it away with cached, virtual APIs. That's the standard instinct: drift is noise to eliminate. We do the opposite. Drift is the measurement.
There's a deeper point in the GitChameleon comparison worth dwelling on. Version-conditioned generation for library APIs is genuinely hard, GitChameleon reports that even strong models land around 48–51% on their benchmark, rising to ~59% with retrieval augmentation. That's encouraging for us in two ways. First, it's independent evidence that the drift phenomenon is large and real, not a quirk of our task set. Second, their RAG result is a preview of our proposed fix: giving the model the relevant version information at inference time measurably helps. The open question we take on is whether the same holds for CLIs, where the "API" is a command line, the failure is an exit code, and the fix is a changelog delta rather than a doc snippet.
And a note on grading, because it's where methods quietly diverge. String-matching (VersiCode) is cheap but brittle, it can't tell a working command from a plausible-looking broken one. LLM-as-judge (ToolBench) is flexible but circular, you're using one model's possibly-stale knowledge to grade another's. We wanted neither. An exit code is not an opinion.
How we measured it, three modes
We look at the same phenomenon through three lenses of increasing fidelity:
- Mode 1, Version knowledge. Ask the model directly: "what's the latest version of X you know of?" Compare to the real latest, fetched live from official sources. This measures staleness directly.
- Mode 2, Command (regex). "Write the command to do X." Grade the answer by pattern: modern form vs. deprecated form. Fast, but blunt.
- Mode 3, Command (execution). Take that same answer and run it in a container with every tool at its latest version.
The reframing that made execution tractable
Running commands sounds like it needs a Kubernetes cluster, a Docker daemon, cloud credentials, infrastructure nightmares. The unlock was a simple question: we don't need the command to succeed. We only need to know whether the current CLI recognizes the syntax.
So a usage error, a command-not-found, or a deprecation warning counts as drift. A runtime failure, "cannot connect to daemon," "no credentials", means the syntax was fine; it just couldn't finish. That distinction let us test
docker , kubectl , and aws with no daemon, no cluster, and no credentials. It also catches drift a regex misses: git init succeeds cleanly but silently creates a master branch, the executable check sees the wrong branch name; a pattern match wouldn't.The oracle, worked through
Concretely, the whole harness is a single "toolbox" container with every target CLI installed at its latest version,
git , node / npm , uv , cargo , kubectl , terraform , docker , aws , terragrunt . To grade a model's answer, we drop it into a fresh, isolated working directory in that container and read what the CLI says back. Three outcomes:-
docker compose up -d→ the daemon isn't running, so it errors, but with a connection error, not a usage error. Syntax valid → PASS.
-
docker-compose up -d→command not found(v1 isn't installed anymore). Drift → FAIL.
-
kubectl apply --dry-run→ runs, but prints--dry-run is deprecated, use --dry-run=client. A deprecation warning is drift. FAIL.
That third case is the subtle one, and it's why we don't grade on exit code alone: the deprecated form still works today, so a naive "did it exit zero" check would wave it through. We treat a deprecation warning as drift because it's a command living on borrowed time, exactly the thing a current-knowledge model wouldn't write.
We keep the regex grader too, and run both. Not redundancy, cross-examination. When they disagree, one of them is wrong, and the disagreement tells us which. More on that below.
The headline result
−0.88 Across 29 models, the correlation between a model's version-knowledge staleness and its command correctness is −0.88. Strong, and negative: the more out-of-date the knowledge, the more the commands break.

An honest boundary: this shows the cause (stale knowledge → broken commands). It does not yet show the cure, that injecting current versions fixes it. That's the next experiment.
It's a gradient, not a cliff
If the effect were real, we'd expect a smooth dose-response by knowledge cutoff, not a random split. That's exactly what we see. Grouping models by cutoff era, command pass rate climbs steadily:

The most charming detail is in Mode 1. Only the 2023-era models hallucinated versions that don't exist yet, Claude 3 Haiku told us the latest
uv was 1.0.0 ; it's actually at 0.11 . Old models don't just lag reality, they confidently invent a plausible future.
Where drift bites hardest
Not all version changes are equal traps. We tagged each task by the type of change, and the spread is 4×:

A renamed subcommand is the worst offender,
docker-compose → docker compose drifts 40% of the time, four times the rate of a genuinely new tool. That makes intuitive sense: a rename is a trap. The model holds a strong, confident, wrong prior, it "knows" the old form cold, so it never pauses. A brand-new tool it's never heard of, by contrast, it might at least hedge on, ask about, or approach cautiously. Confidence is the hazard, not ignorance.A few numbers on the machinery behind these results. The executable oracle ran on 627 commands and passed 73% of them, the rest either drifted or hit a genuine problem. Getting there took some plumbing discipline: our first full sweep had a 63% infrastructure error rate (wrong model IDs, unsupported invocation modes) that we drove down to 9% before trusting any numbers, a reminder that a clean-looking result usually sits on top of a pile of quietly-fixed harness bugs. And running the two oracles in parallel flagged 8 disagreements, every one of which turned out to be a real weakness in one grader or the other.
There's a practical lesson buried in this ranking. If you're building a compatibility layer, you don't need to cover the entire changelog of every tool, you get most of the value by targeting the renames and moved subcommands, because that's where confident-and-wrong lives. The long tail of brand-new tools mostly takes care of itself: a model that's never seen a tool tends to fail loudly rather than silently.
Two tracks: the lab and the field
Everything above is the static track, a controlled experiment, clean conditions, causal claims. But a lab result you can't observe in the wild is only half a finding, so we built a second, dynamic track alongside it: a pair of hooks that sit inside a live Claude Code session.
A
PreToolUse hook sees each shell command before it runs; a PostToolUse hook sees the outcome. Together they do three things. They record every command and its exit status, building a real-world corpus. They flag version-drift candidates on the fly, a command that failed with a usage-error signature. And they auto-harvest "stale → correct" pairs: when a command fails and a near-identical one succeeds moments later, that pair is a free, labeled example of a drift and its fix.The two tracks share one artifact, the delta store, the running list of "what changed." The lab validates entries; the field discovers new ones. It's a flywheel: usage surfaces drift, drift populates the store, the store feeds the fix.
What we learned building it
The findings above are the tidy version. The build taught us some things the charts don't show.
- Version knowledge is the cleaner signal than command drift. Command errors are noisy, even current models trip 10–20% of the time on genuinely hard or ambiguous tasks that have nothing to do with staleness. The direct "what version do you know?" probe is a purer measure of the underlying thing, which is why the −0.88 correlation runs from version knowledge to command correctness, not the other way.
- Two oracles beat one, because their disagreements are where the truth hides. Running regex and execution in parallel surfaced 8 cases where they split. Each was informative. In one, a model answered
kubectl get events; the regex flagged it as drift (the newer form iskubectl events), but execution passed it, becausekubectl get eventsstill works fine. The regex was too strict. In another, a validaws bedrock-runtime invoke-modelwas failed by the oracle because, run with no arguments, it printed a usage message that tripped our drift signature. The oracle was too strict. Both got fixed, and we'd never have found either without the second opinion.
- The trap is self-referential, we were the bug we were studying. Our very first draft of this experiment shipped with stale Bedrock model IDs, CLI flags that had been renamed, and version numbers we'd simply made up from memory. We were writing an experiment about frozen knowledge using frozen knowledge. The only cure was the same one we're proposing for the models: stop trusting memory, fetch the current truth from live sources. Every model ID, every version, every pass-pattern in the final run was verified against a live source or official doc.
- "Latest everything" is a maintenance commitment, not a snapshot. The toolbox container is only a valid oracle for as long as it's actually current. The moment it goes stale, it starts mismarking correct answers as drift, the oracle itself drifts. Rebuilding it is part of the method, not a one-time setup.
The fix: a delta store the model reads at runtime
If staleness is the cause, the fix isn't a smarter model, it's a continuously-updated cheat sheet handed to the model right before it acts. Detect the local tool version, pull the relevant changelog deltas, inject them into context. The model's weights never change; its context gets a patch.
The important property is that this layer sits outside the model. It's model-agnostic, it works for any LLM regardless of cutoff, even a frozen or obsolete one. Tools change weekly; model cutoffs land quarterly at best. That gap is permanent and structural, and a runtime layer closes it for every model at once, retroactively.
There are four ways to deliver the delta, and we plan to A/B all of them:
- System-prompt injection. Prepend the relevant deltas before the task. Simplest; tests prevention against the cost of extra context.
- Pre-call interception. Check the command the model is about to run against the delta store, and inject a correction hint only when drift is detected. Reactive, low context overhead, this is what the
PreToolUsehook already does.
- Post-failure retrieval. On the first failure, retrieve relevant deltas and retry. Tests whether the delta helps recovery versus a blind retry.
- Fine-tuned adapter. A small LoRA trained on delta-annotated examples. The stretch goal, is this learnable cheaply, or is context injection always the better lever?
The model doesn't need to be smarter. It needs to know what changed.
Reproduce it
The whole experiment is deliberately cheap to re-run, because the ground truth moves and the result should be re-checked against it. The moving parts:
- Models: 29 on AWS Bedrock via the Converse API, spanning cutoffs from early 2023 to early 2026, Anthropic Claude (3 through 4.x), Meta Llama (3–4), Mistral, Amazon Nova, DeepSeek, and OpenAI GPT-OSS.
- Tasks: 30 version-sensitive prompts, each pinned to a dated change and validated against current docs.
- Ground truth: latest versions fetched live at run time from GitHub releases,
dl.k8s.io, andnodejs.org, never hardcoded.
- Oracle: one "latest-everything" container; grade on syntax recognition, cross-checked with regex.
Re-run it in six months against newer models and the expectation is clear: the newest cohort's dots march further toward the top-left as their cutoffs catch up, but the slope stays negative, because there will always be a frontier of tool changes newer than any model's training. The gap doesn't close. It moves.
What's next
- Scale the field instrument. Measure real-world drift prevalence and its token cost in live coding sessions.
- A/B the fix. Does delta injection actually cut drift without hurting outcomes? Map the staleness-decay curve.
- Self-refreshing store. Auto-populate from harvested stale→correct pairs plus nightly changelog syncs.
References & sources
Prior work we build on
The methods and framing above draw on these; where we cite a specific number (e.g. FastContext's 46.5%, GitChameleon's 48–51%) it comes from the corresponding source.
- FastContext — read/search operations as the dominant cost center in coding-agent loops; our token-cost anchor. arXiv:2606.14066 (preprint; verify current status)
- TACO — the
useful / redundant / misleadingcredit taxonomy our waste-class spine adapts. arXiv:2606.30251
- GitChameleon — version-conditioned code generation for Python libraries; the closest methodological cousin and our blueprint for pinning versions in a container. arXiv:2507.12367
- VersiCode — version-specific code completion and a taxonomy of API lifespan (addition / deprecation). arXiv:2406.07411
- ToolBench / ToolLLM — large-scale tool-calling capability eval; the cautionary example that engineered drift away with virtual APIs. arXiv:2307.16789
- Terminal-Bench — real terminal-command execution harness (version-agnostic). tbench.ai
- InterCode — interactive code environments with execution feedback. arXiv:2306.14898
- τ-bench / τ²-bench —
pass^kreliability metric for tool-use agents. arXiv:2406.12045
CLI changelogs & docs the tasks were sourced from
Every version-sensitive task was authored from an official changelog or migration guide, and each ground-truth "latest version" was fetched live at run time from the tool's release source.
- Docker Compose V2 migration —
docker-compose→docker compose. docs.docker.com/compose/migrate
- kubectl — dry-run, events, debug (ephemeral containers), create-token. kubernetes.io/docs/reference/kubectl · release notes at kubernetes.io/releases
- git —
git switch/git restore(2.23),init -b(2.28). git-scm.com/docs
- AWS CLI v2 — pager behavior,
aws configure sso,bedrock-runtime. docs.aws.amazon.com/cli
- Terraform — native
test,importblock config generation,removedblock. developer.hashicorp.com/terraform
- uv (Astral) —
uv run,uv self version,--system-certs. docs.astral.sh/uv · changelog
- Cargo (Rust) —
cargo add(1.62),cargo remove(1.66). doc.rust-lang.org/cargo
- Node.js — stable
--watch,npm pkg, corepack status. nodejs.org/docs
- Terragrunt — CLI redesign (
run --all). terragrunt.gruntwork.io
Method notes: 29 models on AWS Bedrock (Anthropic, Meta, Mistral, Amazon Nova, DeepSeek, OpenAI GPT-OSS), 30 version-sensitive CLI tasks across docker, kubectl, git, aws, terraform, uv, cargo, node, terragrunt. Ground-truth versions fetched live from official release sources. All pass patterns validated against current documentation. Executable oracle runs a single "latest-everything" container and grades on syntax recognition, not full execution. 3 models excluded for access errors. Correlation is Pearson r over per-model averages (n=29).
Series: Tokenomics (3 articles)
- 1When the Model's Memory Goes Stale, Measuring CLI Version Drift | 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