Key Lookup versus File Search for a Coding Agent: Retrieval Cost and Reliability of a Curated Plain-Text Index

Authors
Vasili Gavrilov
Date
2026-06-19
PDF
compress_the_access.pdf
Deposit
doi:10.5281/zenodo.20764255 (Zenodo, all versions)
Sources, figures and data
github.com/Anode1/articles/ais
Code
github.com/Anode1/ais

Abstract

How many tokens does a coding agent spend to find an answer by searching the files, against recalling it from a curated key index? The cost of search grows with the store and with the vagueness of the question, and the cost of a key lookup is the size of what the key returns: the mechanism says so, and one store is measured here. We measure both on one project of about 100k lines of code: an agent loop answers the same questions twice in fresh conversations, once with grep and read, once with recall by exact keys over the author's own index, five repeats each. The ratio depends on what the key returns and who consumes it. When the index holds a note or a reference that the person then opens, the model reads nothing but the note: the retrieval payload is 69 times smaller than search's at the mean and the total bill four times smaller at the median, the index answering every question and search three in four. When the index holds a path that the model is then made to read, both arms pay for the reading and the advantage shrinks to about three and a half times; where a file name already carries the question's words, grep finds it on the first call and the index saves nothing. Run on the command line, the same lookup costs zero model tokens. The limits are stated: the baseline is lexical search, similarity search is not measured, the index carries one user's vocabulary, and the grading favours a curated note by construction.