Reading Code the Way a Compiler Does
You ask an agent why an order sometimes gets charged twice. It starts reading. One file, then another, then a third; forty thousand tokens later it hands you a paragraph about the payment module that sounds right and helps with nothing. None of what it read was false. But the pieces it got were slices, a thousand characters each, cut wherever the count ran out. One ended in the middle of a condition. The function that does the charging was split across two of them, and neither half carried any sign of the other. It never read your repository. It read fragments that happened to be the same size.
A parts book never cuts by weight
Think of the parts book a repair shop keeps behind the counter. For every appliance there is a drawing of the thing pulled apart in mid-air, each piece floating a little away from the next, and every piece carrying its own number. Nobody ever cut that machine into equal blocks. The cuts follow the seams the designer left: the pump is one piece, the door seal is one piece, the filter housing is one piece. And the drawing does more than name them. It shows what sits against what, so you can tell that the pump will not come out until two clips and a hose have come off first.
An indexer that parses your code does both of those things. It cuts along the syntax instead of along a character count, so a result arrives as a whole function with its file and its line range — a hundred and twenty-seven to a hundred and fifty, signature and body together — rather than a fragment that begins mid-argument. Then it writes down what touches what: which function calls which, what each file imports, where a route ends up. Symbols and dependencies are not a layer you add on top of a repository. They are what a repository is made of. Someone only has to record them somewhere a question can reach them.
Ordering one part beats shipping the machine
This is where the tidiness turns into money. Asking such an index for a single symbol — the body of one function, by name — comes back with sixty-seven characters. Reading the file that contains it, which is what an agent does when it has no drawing, means pulling in forty-one million. Across ninety-six real coding tasks measured both ways, the tokens held live in front of the model fell from around seventeen thousand two hundred per task to under three thousand four hundred, and the time to finish one went from a hundred and ten seconds to nineteen.
The second saving never shows up in a token count. Ask a text search who uses a class and you get every line where the name appears: comments, strings, a variable spelled the same way by coincidence. Ask a graph of calls and you get the callers, which is a different question with a different answer. That gap is the difference between an agent you watch and an agent you leave alone. Renaming a method across a large repository is a reasonable thing to hand over when the tool can enumerate what actually depends on it, and a reckless thing to hand over when the tool can only find where the word occurs.
Prose and code are not searched alike
That book has two ways in, and so should the index. You look a part up by its number when you know the number, and by description when all you know is what it does — the rubber ring under the door, the one that leaks. Code needs both, for the same reason. An identifier is exact and unforgiving, and searching it by meaning drifts you to something similar and wrong. A phrase like “save the model to disk” is the opposite: not one of its words appears in the function that does it, which is called save_pretrained. So good retrieval runs both passes and merges the rankings using hints the code gives away for free, like whether a chunk holds a definition at all.
One caution comes attached. The index describes the code as it stood when it was read, and every edit makes it slightly untrue; it has to be refreshed against the working tree, or checked against it, before anything is trusted. That aside, none of this is a smarter model. It is a parser, an index and a query, sitting outside the model and deciding what it gets to see. You never had to explain the repository to the model. You had to stop cutting it into pieces the repository does not have.