What the Index Saved You
An index answers a question with a few lines instead of making you, or your AI assistant, open the files. Until now that was a claim. drag-lint gain counts it.
gain and the usage log are new in drag-lint 1.38.0-alpha. The output below is real output of that build, run against the Win32 platform library index (C:\Projects\.drag-lint\library-Win32.sqlite), as of 2026-10-29.
The question came out of working on Micronite, the quality and production-control software we ship to manufacturers: its code base is big enough that we kept saying the index “saves a lot of reading”, and nobody had a number. So the readers now keep one.
One line per answer
Four reader commands answer from the index: context, query --name, query --text and query find-callers. Each one now appends one best-effort line to a per-user log, %LOCALAPPDATA%\drag-lint\usage.log: what the answer cost in tokens, and how many bytes of source it stood in for (the distinct files the answer drew from). Nothing in the log is your code — only counts. Set DRAGLINT_USAGE_LOG=0 to switch it off. A log that cannot be written never changes a command’s output.
Ask, then add up
Where is TStringList, which resource string says “Cannot create file”, and what do I need to know before changing TStringList:
drag-lint query --name TStringList --db library-Win32.sqlite
drag-lint query --text "Cannot create file" --db library-Win32.sqlite --limit 3
drag-lint context --task "modify System.Classes.TStringList" --db library-Win32.sqlite --format markdown
class TStringList System.Classes.TStringList forward at line 828
1 match(es)
The text query returns three file:line hits, for example System.RTLConsts.pas:31:19 [pas/resourcestring] Cannot create file %s -> System.RTLConsts.SFCreateError. The context call returns a bundle of 7,524 estimated tokens: class surface, implementation slice and callers.
drag-lint gain
drag-lint gain
verb calls tokens_returned tokens_avoided ratio
context 1 7524 223742 29.7x
query 2 118 172365 1460.7x
TOTAL 3 7642 396108 51.8x
by day:
2026-10-29 3 7642 396108 51.8x
Three answers cost 7,642 tokens. The source files they replaced come to about 396,000 tokens (bytes divided by four). --since yyyy-mm-dd limits the report to recent days and --json gives one object with total, by_verb and by_day.
An estimate, not an invoice
- It is the upper bound. “Avoided” assumes the alternative was reading each whole source file. A careful reader opens less. Treat the ratio as an order of magnitude.
- Tokens returned are partly estimated.
contextandquery --textare measured;query --nameandfind-callersare counted at 15 tokens per result row. - Small projects give small ratios. On a two-unit scratch fixture the same three questions saved less than they cost (0.8x overall). The index pays off where the source is big, which is the case it exists for.