An assistant that gives an answer contradicting code elsewhere in your project has not made a mistake about that code. It has not seen it. Almost every confusing result comes down to what was actually in the input, which is rarely what people assume.
What does completion see?
The current file around the cursor, usually a limited amount of it, plus sometimes other open tabs and recently edited files. It is a small window, chosen automatically, and it does not include your repository.
This explains the most common complaint, which is a suggestion that ignores a helper function defined two files away.
The distinction worth holding is between what a tool can access and what it chose to send. Access is broad; what was actually included in a given request is usually a small selection, and the answer reflects only the second.
What does chat see?
The current file, anything you explicitly reference, and in some tools a retrieved selection from an index of the project. The retrieved part is the variable one: it is chosen by relevance search, and relevance search misses things.
Whether an index exists at all varies by product, and some rely entirely on open files. That difference explains why the same question produces a useful answer in one tool and a generic one in another.
How does repository indexing work?
The project is broken into pieces, converted into vectors and searched by similarity when you ask something. The matching pieces are inserted into the prompt.
It works well when your question uses similar vocabulary to the code and poorly when it does not, which is why asking about a concept by a different name frequently returns nothing useful.
What does that mean practically?
Naming files explicitly beats hoping. Most tools support referencing a file directly, and doing so removes the retrieval step and its failure mode entirely.
Look at these specific files rather than searching: [names]. Do not use anything else from the project.
Referencing a file by name is supported in nearly every tool and remains the single most reliable control available over what gets included in a request.
Does a bigger context window fix it?
It removes the hard limit and not the selection problem. Tools do not send an entire repository even when they could, because it is slow and expensive, and material in the middle of a very long input is attended to least reliably.
Selection is therefore permanent rather than a temporary limitation.
Selection also varies between requests in the same session, so an answer that was well informed once may not be the next time even with the same question, which is a common source of apparent inconsistency.
What is usually missing?
- Files you have not opened. Which is most of the project.
- Anything outside the workspace. Shared libraries in another repository.
- Non-code context. Tickets, documentation, decisions made in conversation.
- Runtime behaviour. What the data actually looks like.
How do you tell what it used?
Ask directly. Most tools will report which files were consulted, and the answer is frequently shorter than the confidence of the response implies. Where a tool shows this in the interface, it is worth looking at rather than trusting.
Why does a long conversation degrade?
Because the whole exchange is resent with each message, so an hour of discussion competes with the current question for attention. Answers become slower, more expensive and more inclined to refer back to approaches you abandoned.
The fix is the same as everywhere else: a fresh conversation per task, carrying forward a short summary of what was established. People resist this in an editor because the panel feels like a persistent workspace rather than a conversation, and it degrades in exactly the same way.
What is the practical habit?
Open the relevant files before asking, and reference them by name in the request. Both are seconds of effort, and together they eliminate the largest single cause of answers that are confidently about the wrong code.