An AI coding assistant does not remember that it fixed a bug. Each new request sees the current state of the code and the current conversation context. If the fix was applied to one file but the bug’s root cause exists in a pattern repeated across multiple files, the assistant fixes the instance it was shown and continues suggesting the same pattern elsewhere. The bug returns because the assistant never understood the pattern was the problem.
Analysis Briefing
- Topic: AI coding assistant context limits, pattern-level bugs, and fix persistence
- Analyst: Mike D (@MrComputerScience)
- Context: Sparked by a question from Claude Sonnet 4.6
- Source: Pithy Cyborg | AI News Made Simple
- Key Question: Why does an AI coding assistant fix a bug in one place and then reproduce it somewhere else in the same session?
The Root Cause: Pattern vs. Instance Understanding
When you show an AI coding assistant a bug and ask it to fix it, you are showing it one instance of the problem. The assistant fixes that instance. If the bug is a symptom of a pattern in the codebase (a consistent misuse of an API, a recurring anti-pattern in error handling, a systematic misunderstanding of how a library works), the assistant does not see the pattern. It sees the file in its context window.
The assistant’s next suggestion in a new file uses the same pattern because the pattern is what it learned from training data or from the code it has seen in the current session. The fix was local. The bug’s cause was structural.
This is the same problem that AI coding assistants suggesting deprecated APIs produces: the assistant generates from pattern memory rather than from a reasoned understanding of the codebase’s actual requirements.
How Context Window Limits Amplify the Problem
Even in IDE tools with cross-file context (Cursor, GitHub Copilot with workspace indexing), the context window is not infinite. For large codebases, the assistant sees a subset of relevant files. If the bug pattern appears in files that are not in the current context, the assistant cannot recognize that it is reproducing the pattern.
The assistant that fixed utils/auth.py fifteen minutes ago does not automatically hold that fix in context when you open services/user.py. Unless the conversation explicitly references the earlier fix, or the IDE’s indexing surfaces the fixed file as relevant, the assistant generates code from its general training rather than from the project-specific lesson learned earlier in the session.
What Actually Prevents the Reintroduction
Explicit rules in the system prompt or project-level instruction files are more persistent than conversational fixes. Cursor’s .cursorrules file and similar mechanisms allow you to specify project-level conventions that the assistant applies to every suggestion, regardless of which file is open or what was fixed earlier in the session.
For a systematic bug (for example, never use requests.get without a timeout parameter in this codebase), a one-line rule in the project instructions is more reliable than fixing each instance individually. The rule is always in context. The conversation memory of a specific fix is not.
Linting and static analysis enforce fixes at the tooling level rather than relying on the assistant’s consistency. A linter rule that flags the anti-pattern will catch it in every file, including files the assistant generates in future sessions.
What This Means For You
- Write project-level instruction rules for any bug pattern you want the assistant to avoid, rather than relying on the assistant to remember a fix from earlier in the session, because instruction files are always in context and conversational memory is not.
- Add a linter rule for any systematic bug that you have fixed more than once, because linting enforcement is deterministic and AI suggestion consistency is not.
- When fixing a bug, explicitly ask the assistant to identify every other place the same pattern might appear before closing the conversation, because the time to audit the pattern is when the bug and its fix are both in context.
Enjoyed this? Subscribe for more clear thinking on AI:
- Pithy Cyborg | AI News Made Simple → AI news made simple without hype.
