I had my agent remove something, but it still acts by the old way; a "X was removed" note sits in CLAUDE.md or a code comment, and the agent adds a converter to new code to match the old rule
When I remove something, every line that mentions it (comment · agent instructions · note) goes in the same commit; the commit message carries when and why. When the agent writes a comment carrying a date or a count of the old state, I deny it at write time.
beforeonce the removal note went stale, the agent followed the note in 10 of 10 runs and wrote a converter in 9
aftersame code, note deleted: 0/10
delete every note that mentions what you removed (CLAUDE.md · AGENTS.md · code comments); put why it was removed in the commit messageText for your agent · 23 lines
Situation: you had your agent remove a feature. It deleted the code but left a note in CLAUDE.md, AGENTS.md or the code: "X was removed · use Y now". Later the code changed again; now the agent treats the new code by that old note: it follows a rule that no longer exists and adds a converter or compatibility layer to bridge the gap. Why: the agent reads instruction files before the code and ranks them higher. A note is true the day it's written and turns into a lie when the code changes; the agent puts the lie ahead of the code. I measured it (Claude Sonnet, the same small project, the same request, 10 runs per arm): - code uses Y, with or without a CLAUDE.md note saying "X support was removed, everything is Y": mentions X 0/10 - code later moved back to X: with the note still there, mentions Y 10/10, writes a line converting X to Y 9/10; without it, 0/10 While the note is fresh it's harmless; once the code changes again, the agent prefers it over the code. In a 320-run study by Georgia Tech and UC Boulder (Claude Code and Codex CLI), agents followed an old CLAUDE.md or AGENTS.md line that contradicted the code in 90.1% of choices. Do: 1. Find the tracked notes, from the project root. Instruction files: git grep -nEi 'kald(ı|i)r(ı|i)l|kald(ı|i)rd|sil(in|d)|(ç|Ç|c)(ı|i)kar(ı|i)l|art(ı|i)k|eskiden|removed|deleted|dropped|deprecated|no longer|used to|replaced by' -- ':(glob)**/CLAUDE*.md' ':(glob)**/AGENTS.md' ':(glob).claude/**' Code comments: git grep -nEi '((^|[[:space:]])(//|#|--|;|/\*|<!--)|^[[:space:]]*\*).*(kald(ı|i)r(ı|i)l|kald(ı|i)rd|sil(in|d)|(ç|Ç|c)(ı|i)kar(ı|i)l|art(ı|i)k|eskiden|removed|deleted|dropped|deprecated|no longer|used to|replaced by)' 2. Search the code for what each line mentions; lines step 1 found don't count. If the code stands by the line's rule (the note says "X was removed, everything is Y" and there is no X in the code), write the rule in the present tense: "Everything is Y." If it doesn't, or the line only tells history, delete it. 3. Add this line to the tracked CLAUDE.md (or AGENTS.md) so the agent stops leaving notes when it removes things: When something is taken out, every line that mentions it (comment · this file · test · docs) goes in the same commit; the reason lives in the commit message. 4. Commit only the files you changed in steps 2 and 3, together, with the reason in the message: git commit -m "delete removal notes: a stale note wins over the code" -- <those files> Check: - Rerun both step 1 commands → no line is left that tells what was removed or how things used to be. Don't: - Don't add "this no longer applies" next to the note instead of deleting it: the second note carries the first one's staleness. - Don't delete all comments at once: a comment carrying a rule or reason the code can't say stays; only the ones telling history go.
Also in: If your agent clings to the old