An interactive explainer

The agent never edits your file.

It writes out a block of text it believes is already in the file, plus what should replace it. Then a plain program on your machine looks for that text, character for character. So the agent is only ever as good as its memory of a file it is not looking at. That is why it reads before it writes, why one invisible character can refuse the whole edit, and why a refused edit is the good outcome.

AI coding agents · File edits · Exact string matching

Developer Tools · Intermediate · 12 min · Why the agent's edit failed on a file it read correctly — an interactive explainer on ViLearn, with a simulation and a knowledge check. All explainers.

Related: Why a coding agent forgets everything between steps · How Git actually stores your work · Why sending the model more can make the answer worse