What “percent written by AI” can and cannot tell you

How AI line attribution is measured for Claude Code, Codex, Gemini CLI and the editor extension, what it leaves out, and why the number is useful for noticing a change in how you work rather than for judging anybody.

AI usage5 min readBy

: How each source counts its lines: Codex, Gemini CLI and the editor extension's rule, and its sources.

Lines written per week, split between you and the assistants, with the share written with AI
In this guide

"Percent of code written by AI" is easy to produce and easy to misuse. Each assistant reports its edits in its own way, an editor sees only part of what you type, and the number says nothing about how hard the lines were. Here is how it is measured, source by source, what it leaves out, and the question it answers.

Where the number comes from

The figure is lines an assistant added ÷ all lines added, over a period. The numerator comes from the assistants' own records of their edits; the denominator from every line a plugin saw added, whoever typed it. Each source counts its lines differently:

SourceWhat counts as an AI lineRead from
Claude CodeThe lines of each edit the assistant madeThe patch each edit records in the session file
CodexThe added lines of a patch, once it appliedIts apply_patch calls
Gemini CLIThe lines the model added, not those you changed in its proposalThe diff statistics of write_file and replace
VS Code and its forksOne insert of 2 lines or 80 characters at least, not pastedEach change to a document, as it happens
How each source decides that a line was written by an assistant.

The three terminal assistants know what they wrote: their session files record each edit. An editor does not. The inlinr extension for VS Code, Cursor and Windsurf sees changes to a document, not who made them, so it classifies each one: a single insert of at least two lines or 80 characters that did not come from the clipboard counts as generated; typing, deleting, multi-cursor edits, formatting on save and undo count as yours. The rule is conservative on purpose. It misses a one-line completion you accepted, because over-counting would flatter the headline number.

It also names an assistant only once it has seen such an edit. Copilot starts with the editor whether you use it or not, so a tool installed and active is not evidence that it wrote anything.

What it leaves out

  • Lines you typed where nothing counted. If you write code in an editor without the extension, those lines are missing from the denominator, and the share rises. Someone working only in Claude Code sees close to 100%.
  • 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.
  • Difficulty. Generated boilerplate and a subtle concurrency fix are one line each.

When no plugin counted lines over a period, the honest answer is "unknown", not "0%". A tool that shows 0% when it cannot measure is telling you something false.

What it is 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 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.

What inlinr does

The Claude Code plugin reads the session files of Claude Code, Codex and Gemini CLI and sends the lines of each edit, never the code itself. The editor extension applies the rule above and sends only line counts with the file's path. The dashboard shows the AI share per project and per assistant, and the share of time an assistant was active, with nothing in place of a figure when no plugin counted lines. Each assistant has its setup page: Claude Code, Codex, Gemini CLI, Cursor.

Sources

What changed

  • : How each source counts its lines: Codex, Gemini CLI and the editor extension's rule, and its sources.
  • : first published.

See it on your own sessions

inlinr reports the AI share only when a plugin counted lines, and shows nothing rather than zero when none did.

AI coding analytics

Free for solo use · no source code leaves your machine

Read also