What “percent written by AI” can and cannot tell you
How AI line attribution is actually measured, what it silently excludes, and why the number is useful for noticing a change in how you work rather than for judging anybody.
5 min read
“Percent of code written by AI” is easy to produce and easy to misuse. It is worth knowing exactly how it is measured before quoting it to anybody.
Where the number comes from
For Claude Code, each edit reports a structured patch: how many lines the hunk added and removed. Summing those gives lines attributed to the assistant. The denominator is every line the editor saw added, whoever typed it. So the figure is assistant-added lines ÷ all added lines, over a period.
Four things it silently excludes
- Code you deleted because the assistant wrote it badly. Deletions count as deletions, not as failed AI output.
- Anything an assistant helped you think through. A conversation that led you to write ten good lines yourself scores zero.
- Editors that do not count lines. If nothing reports counts, the honest answer is “unknown”, not “0%”. A tool showing you 0% when it simply cannot measure is telling you something false.
- Difficulty. Generated boilerplate and a subtle concurrency fix are one line each.
What it is genuinely good for
Noticing a change in how you work. A month where the share jumps is worth a minute of thought — did the work change shape, or did your habits? That is a question for you, not a score for anybody else, and it is the reason this number should never appear in a performance review. A developer measured on it will produce whatever the metric rewards, and the metric does not know what good code is.
Inlinr reports the AI share only when a plugin actually counted lines, and shows nothing rather than zero when none did — which is the distinction most tools quietly skip.
More guides
- Why your assistant re-reads everything, and what it costs
Most of a Claude Code turn is context you have already paid to send once. Here is how to tell whether you are paying twice.
- Reading a token bill without overstating it by 10×
Four numbers, four prices. Adding them up is how people end up off by an order of magnitude.