Feed it the docs: why AI writes code for a library version that stopped existing
I build Settl, an expense-splitting app, solo with Claude, and I once lost an afternoon arguing with it about a router API that had been renamed a year earlier. It apologised every time and wrote the same dead code back. It was not being stubborn. It had never seen the new API.
Why the model is stuck in the past
The weights froze at training time: no index behind them, no lookup, no clock. Everything the model knows about your dependencies was compressed into parameters months before you opened the chat. Add the months to release, plus the months you have been using it, and eighteen months of unseen releases is ordinary.
Density matters more than recency. It saw the old API in ten thousand tutorials and answers. The new one, if it made the cutoff at all, sits in a handful of docs pages and one migration guide. So even when it names the current major version in prose, the old call stays the higher-probability continuation in the code.
Why arguing never works
You say "that is deprecated". It apologises, agrees, and writes the same thing back with a different variable name.
- Correcting assumes the answer is in there. It is not. You are asking it to recall something it never saw, and insisting does not put it in the weights.
- Agreement is cheap. "You are right, sorry" is the highest-probability response to a correction. It changes nothing; the next generation samples the same distribution.
- Nothing marks a fact as old. There is no timestamp on a weight. A stale pattern and a current pattern are both just patterns, so the confidence reads the same either way.
Correction moves the conversation. Information moves the output.
The signs it is a cutoff problem
- It names a version in prose and then writes an API that version does not have.
- The failure is
x is not a function,has no exported member, or a deprecation warning, not a logic error. - It calls your import path wrong when the path matches what is installed.
- It apologises, agrees, and repeats. Twice is a pattern.
Spot one and stop typing corrections. Send this instead:
Do not rewrite it yet. Which version of react-router are you assuming, and
which release introduced the API you just used? If you are not sure, say so
and tell me which file to paste for you.
What to paste, in order of value
- A working example from your own repo. The strongest document you own: current, installed, and idiomatic all at once. One real file beats a docs site.
- The migration guide or changelog between the version it assumes and yours. A diff is denser than reference docs: it says what changed instead of what exists.
- The type definitions.
node_modules/<pkg>/dist/index.d.tsis the API surface itself, not a description of it. Same for an installed.pyi. - The one docs page for the function in question, when nothing above exists.
Worth nothing: "use the latest version", or a link it cannot open.
# what is installed, not what the model remembers
npm ls react-router zod
ls node_modules/react-router/dist/*.d.ts
The version briefing
Paste this at the top of any session where a library matters:
Before writing any code, state which version of each library you are assuming
and where that assumption came from. Then check it against these facts.
INSTALLED VERSIONS (from the lock file, authoritative):
react-router 7.4.1
zod 4.0.2
WHAT CHANGED SINCE YOUR TRAINING DATA:
[paste the migration guide or changelog here]
A WORKING EXAMPLE FROM THIS REPO:
[paste src/routes/root.tsx here]
If anything you were about to write conflicts with the above, the above wins.
Name the assumption that got contradicted, then write the code. Do not write
code for a version that is not listed here.
The first line earns its place alone: it catches the stale belief in one sentence instead of one
file. Park the pinned versions in CLAUDE.md so you stop retyping them
(settl.fyi/social/tip-claude-md).
When to let it search instead
Search repairs retrieval, not judgement. The model still picks which result is authoritative, and the open web is full of the same aging tutorials that trained it.
- Search when the library moves fast and you do not know what changed.
- Paste when you know the version and it is installed. Faster, cheaper, and it cannot pull up the wrong version's page.
- Prefer the lock file to any search result. Search says what the newest release does; the lock file says what your code runs.
Then let the compiler referee it. Types and tests catch a stale API in seconds.
Run this on your codebase
Audit this repo for library-version risk. Do not change any code yet.
1. Read package.json and the lock file (or pyproject, go.mod, Gemfile.lock)
and list every direct dependency with its installed version.
2. For each one, say which major version you would have written code for by
default, and whether that matches what is installed. Mark every row MATCH,
BEHIND, or UNSURE. UNSURE beats a confident guess.
3. For every BEHIND or UNSURE row, name one file in this repo that already
uses that library correctly, so I can paste it back as the reference.
4. Output a block for CLAUDE.md: the pinned versions, plus one line per
BEHIND library naming the old API to avoid.
Finish by naming the one dependency to hand you the migration guide for
first, and why.