---
title: "What “percent written by AI” can and cannot tell you"
description: "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."
url: https://inlinr.com/guides/measuring-ai-written-code
lang: en
---

# 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 usage 5 min read Published 5 Aug 2026 By [Thibault Fayard](https://inlinr.com/authors/thibault-fayard)

Updated 30 Oct 2026: 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](https://inlinr.com/marketing/ai.jpg)

"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:

| Source                | What counts as an AI line                                        | Read from                                       |
| --------------------- | ---------------------------------------------------------------- | ----------------------------------------------- |
| Claude Code           | The lines of each edit the assistant made                        | The patch each edit records in the session file |
| Codex                 | The added lines of a patch, once it applied                      | Its apply\_patch calls                          |
| Gemini CLI            | The lines the model added, not those you changed in its proposal | The diff statistics of write\_file and replace  |
| VS Code and its forks | One insert of 2 lines or 80 characters at least, not pasted      | Each 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](https://inlinr.com/integrations/claude-code), [Codex](https://inlinr.com/integrations/codex), [Gemini CLI](https://inlinr.com/integrations/gemini-cli), [Cursor](https://inlinr.com/integrations/cursor).

## Sources

- [The inlinr extension for VS Code](https://github.com/inlinrhq/inlinr-vscode), its source: the rule that classifies an edit (`edit-attribution.ts`). Checked on 29 October 2026.
- [The inlinr plugin for Claude Code](https://github.com/inlinrhq/inlinr-claude-code), its source: how Claude Code, Codex and Gemini CLI session files are read (`src/transcript.ts`, `src/agents/`). Checked on 29 October 2026.

## What changed

- 30 Oct 2026: How each source counts its lines: Codex, Gemini CLI and the editor extension's rule, and its sources.
- 5 Aug 2026: 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](https://inlinr.com/ai-coding-analytics)

Free for solo use · no source code leaves your machine

## Read also

- [AI usage Reading a token bill: four prices, and the cache that is most of it Four counts, four prices, and a cache that re-reads the whole conversation every turn. How to read them without being off several times over. 7 min read](https://inlinr.com/guides/ai-token-costs)
- [Freelance Invoicing a French public client through Chorus Pro A public client does not take an invoice by email. One account, three references, and the status that starts the 30 days. 6 min read](https://inlinr.com/guides/invoice-public-sector-chorus-pro)
- [Integration Time tracking for Cursor Track coding time in Cursor automatically, with how much of your code Cursor's assistant wrote, per project and per week. Open](https://inlinr.com/integrations/cursor)
