The AI Reads Old Documents and Writes New Mistakes
This is part 4 of My First Agentic Coding: Field Notes, a series about the five months I spent growing software through instructions to Claude Code alone, without writing a line of code myself. Each part covers one topic
This is part 4 of My First Agentic Coding: Field Notes, a series about the five months I spent growing software through instructions to Claude Code alone, without writing a line of code myself. Each part covers one topic.
In short:
- Rebuilding a feature doesn't update the documents that describe it. In JSVisualizer, a rebuilt feature kept its old description for three and a half months.
- During that time, a screen description Claude newly wrote carried over the outdated wording. Stale documents become the source of mistakes in whatever the AI writes next.
- Even when you go back to fix stale text, you won't catch it all. Search for the old terms, and fix CLAUDE.md, which the AI reads every time, first.
Introduction
In part 2, I wrote about a small web app for an experiment. I switched its audio playback from the Web Audio API to the <audio> element, but CLAUDE.md said "Web Audio API" until the very end. Development on that app wrapped up in about a week.
So what happens when the same thing occurs in a project that runs for more than five months? This post is the answer.
The project is JSVisualizer, a web app that runs a JavaScript program one step at a time and visualizes what happens. (A separate series introduces it.) Besides CLAUDE.md (the project guide Claude Code reads at the start of each session) and ADRs (short records of individual design decisions), JSVisualizer has a README, a functional specification, a design document, and a user manual. Claude wrote all of them.
The quotes from my sessions below are translated from Japanese.
A rebuilt feature's description stayed outdated for three and a half months
JSVisualizer has a view called Lifetime. It's the one I described in part 1, the view I had rebuilt after asking what it was for. It started as a Gantt chart: one horizontal bar per variable, showing how long it existed. I couldn't see the point, so on June 16, I had it rebuilt as a stack of bars showing when each function call started and ended.
But the README, the functional specification, the design document, and CLAUDE.md kept calling it a Gantt chart. They weren't fixed until September 28 and 29, about three and a half months later.
During that time, I did look at the README and the on-screen descriptions now and then. But I only skimmed them, so I never noticed they were out of date.
The rebuild had no ADR. It happened in June, before writing ADRs at decision time had become a habit. And as I'll explain later, document updates were driven by ADRs. A change without an ADR never reached any of the documents.
It was finally caught while the README's list of views was being rewritten for another purpose. Partway through, Claude noticed that the README's description didn't match the implementation.
What the AI newly wrote was outdated too
This is the heart of this post.
On July 20, a little over a month after the rebuild, Claude added a short description for each view at the top of the screen. Here is what it wrote for Lifetime:
Shows when each variable is "born" and when it "disappears," as lifespans in a Gantt chart.
By then, the view had not been a Gantt chart for 34 days. Claude described the rebuilt view in the words of the old one.
Looking at the documents as they stood that day suggests why. CLAUDE.md, the README, the design document, and the functional specification all said "Gantt." The only place that got it right was the comment at the top of the source file. Claude loads CLAUDE.md at the start of every session. I think it simply carried over the outdated description from the documents.
The lesson: the harm of a stale document doesn't stop at the document being wrong. It becomes the source of mistakes in whatever the AI writes next. In part 2, I said that "It's in CLAUDE.md" is strong evidence as far as Claude is concerned. Outdated text carries the same weight.
Even fixes don't catch everything
On September 28, the README and the functional specification were fixed, and on the 29th, the design document. Both times, Claude read through the documents and made the fixes.
Even so, the outdated text in CLAUDE.md was missed both times, in three places: a note in the directory tree, a description of the data, and a table of views. It turned up during the retrospective I'd been doing since August, while I was compiling some numbers. Only a search for the word "Gantt" across the whole repository caught it. At my request, it was fixed the same day.
The most important document, the one Claude reads every session, was the last to be corrected. Reading through documents to fix them isn't enough. You need to combine it with a mechanical search for terms.
What happened as CLAUDE.md grew
In part 2, I promised to cover what happens when CLAUDE.md gets long. This is that answer.
JSVisualizer's CLAUDE.md had grown from 154 lines in May to 451 lines by then. All three places that were missed covered things the design document also described. As CLAUDE.md grew, so did the number of descriptions that duplicated other documents, and those copies went out of date.
In a long CLAUDE.md, an outdated copy is easy to miss. Yet Claude reads it every session and treats it as strong evidence.
A new screenshot, old text
The same thing happened with another view.
The Control Flow view's flowchart was rebuilt on June 4 (ADR-018, in Japanese, like the other ADRs linked here). But the functional specification kept its pre-rebuild description: "loop-backs are shown as orange dashed lines."
On September 29, Claude wrote the user manual. Here is what it said about Control Flow:
Flow that loops back is shown with an orange dashed line, and branches that weren't taken turn gray.
The manual included a fresh screenshot of the current screen. There was no orange dashed line in it. The image was new; only the text came from the old specification.
The one who noticed the outdated specification was also Claude. On October 30, while writing a post for the tool's introductory series, Claude checked how the screen actually behaved and reported:
The V-12 section of the spec still describes the old version, so it would probably be good to fix it later.
(V-12 is the Control Flow section of the functional specification.)
Prompted by that report, the specification and the manual were both fixed that day. The AI copied the mistake from an old document, and the AI also caught it by comparing against the screen. I think the difference was whether it checked the text against the real thing at that moment.
ADRs get written, but the documents that pull them together fall behind
As I described in part 3, from June on, ADRs were written on the same day as the decisions. But the revision history of the design document, which describes the overall design, had stopped on July 20.
On September 24, right after a commit with a new ADR, I had a feeling the documents weren't being kept up to date, so I asked:
Are the docs updated too?
Claude updated the README and the functional specification. As for the design document, it said the document seemed to have been dropped from updates for recent features, and asked me to confirm. So I asked:
Please update design.md too. Include everything that hasn't been reflected so far.
Only then were about two months' worth of decisions added to the design document in one go.
The lag came back anyway. Five days later, four more decisions were missing from the design document. On November 4, a large commit that bundled eight bug fixes and more left out only the design document update. (I noticed during the retrospective, and it was fixed the same day.)
Claude updated ADRs and CLAUDE.md on its own. The other documents only got updated when a human asked. In part 3, I called writing ADRs after the fact a mistake. The same mistake was repeating one level up, in the document that pulls the ADRs together.
The AI doesn't go looking for ADRs that exist
There was also the reverse problem: an ADR existed, but the AI didn't read it.
On September 24, Claude fixed a bug where the value of a variable before its declaration was displayed as Symbol(TDZ) (an internal value representing a not-yet-declared variable), and wrote ADR-038. In it, Claude described the mechanism as "not yet covered by an ADR." In fact, it was documented in detail in ADR-023, from June.
At that point, the only information Claude had about past decisions was the CLAUDE.md it had loaded at the start of the session. The relevant part of CLAUDE.md didn't link to ADR-023. The fix, the ADR, and the commit took about three minutes from my report. Working that fast, Claude didn't go looking for an ADR that wasn't in front of it.
The next day, at my request, a correction was added to ADR-038, and the relevant part of CLAUDE.md got a link to ADR-023. As the number of ADRs grows, the question is no longer just whether something was written down, but whether it can be found later. A link from CLAUDE.md to the ADR is the cheapest way to make sure it can.
Why it happened
CLAUDE.md is what Claude reads every session. It reads other documents only when it decides it needs them. When writing descriptions, Claude seems to sometimes consult documents before the code. If the documents are outdated, so is the new text.
Updating documents was a habit only for ADRs and CLAUDE.md. And a change without an ADR didn't even trigger that habit.
On top of that, I don't read the code (part 1), and I only skimmed the README and the descriptions. I had almost no chance to notice gaps between the documents and the implementation.
Most of the gaps came to light in the retrospective I'd been doing since August. A retrospective puts the ADRs, the design document, the README, CLAUDE.md, and the implementation side by side. Gaps you can't see by reading one document become visible when you line them up. For me, the retrospective became a chance to look at the documents carefully.
What I would do now
When I rebuild a feature, I'd have Claude search for the terms the old description used, and fix CLAUDE.md first, since the AI reads it every time:
I rebuilt Lifetime as a stack of function calls, so please search CLAUDE.md, the README, the spec, the design document, and the on-screen strings for the old terms "Gantt chart" and "Gantt." Fix CLAUDE.md first.
At stopping points, I'd ask the question I actually asked, "Are the docs updated too?" If Claude also reports which documents it updated, the ones it didn't update stand out.
I'd add rules like these to CLAUDE.md:
## Documentation
- When you change the implementation, fix the relevant parts of the README, functional spec, design document, and manual in the same commit, even for changes without an ADR.
- When a feature is rebuilt, search for the terms the old description used and report where they remain.
- Link each design decision described here to its ADR.
- Don't copy descriptions from the README or the design document. Write only the key points and where to find them.
- When writing descriptions or the manual, check the implementation and the actual screen rather than the documents.
- When the implementation or the actual screen differs from a document, fix the document too.
Then, at the end of a phase or before going into use, I'd have the documents reviewed in a session separate from development: whether each ADR is reflected in the design document, whether old terms remain, and whether tab names on screen match what the manual calls them. I'd open a new session and ask something like:
Compare the README, the functional spec, the design document, the manual, and CLAUDE.md against the implementation and the actual screen, and list the discrepancies. Don't fix anything until I've reviewed the list and approved it.
The search for old terms could also go into the tests or CI, so it runs automatically every time.
You might say that text goes stale because the same description lives in many places, so you should have fewer documents. But I'm not cutting the number of documents. A user manual and a developer specification have different readers. Even for the same feature, users need to know how to use it, and developers need to know how it works, so the content differs. Writing for different readers isn't duplication.
What I want to cut is the same fact written in two places for the same reader. In particular, I want CLAUDE.md to stop copying other documents and hold only key points and pointers. The README is for people visiting GitHub: what the tool is and how to use it. CLAUDE.md is for the AI doing the work: commands, rules to follow, design decisions with links to ADRs, and common pitfalls. Facts like the list of views should live in one place, with the other pointing to it.
You might worry that if something isn't copied into CLAUDE.md, the AI won't read it. In fact, ADR-023 in the previous section went unread because CLAUDE.md didn't link to it. But the fix then was to add a link, not to copy the content. For content that's needed every session, you can also import it by writing something like @README.md in CLAUDE.md. Unlike a copy, an import changes what the AI reads as soon as you fix the original.
The search and review instructions and the rules above are examples I came up with while looking back. What I've actually tried is asking "Are the docs updated too?" and searching for terms during the retrospective.
Limits
- That the July 20 description carried over the old documents' wording is my inference. The session log from that day no longer exists, so I can't confirm which documents Claude read before writing it.
- Most of the gaps were found in the retrospective. Without it, they might still be there.
- I don't know how many gaps remain. Even searching together with Claude during the retrospective, the outdated text in CLAUDE.md was missed twice. The AI doing the review misses things too.
- I haven't verified the effect of the searches and rules above. Removing copied content from CLAUDE.md is also still ahead of me.
Checklist
- [ ] When you rebuild a feature, have the AI search for the terms the old description used.
- [ ] Fix outdated text in CLAUDE.md, which the AI reads every time, first.
- [ ] Link design decisions in CLAUDE.md to their ADRs.
- [ ] Don't copy other documents' content into CLAUDE.md. For facts with the same reader, keep one source and point to it.
- [ ] At stopping points, ask "Are the docs updated too?" and have the AI list which documents it updated.
- [ ] Include the README, spec, and manual in updates, even for changes without an ADR.
- [ ] When the AI writes descriptions or a manual, check that the text matches the screenshots.
- [ ] When you notice a gap between the implementation or screen and a document, have the document fixed then and there.
- [ ] At the end of a phase or before going into use, review the documents in a session separate from development.
- [ ] Combine reading through documents with mechanical searches for terms.
Next time
Next time: "Reviewing AI-assisted development with AI: vanishing logs, lagging git, and conflicting memories." This post kept saying "it was found in the retrospective." Next, I'll cover the limits of that retrospective itself. Session logs disappear, and git records work later than it actually happened.
The work in this post used Claude Sonnet 4.6 in June and July, Claude Sonnet 5 on September 24, and Claude Opus 5.5 from September 28 on.
Originally published by Dev.to AI. Aggregated on AIWithGhost for educational purposes — full credit and traffic to the original publisher.