How Much Code Is Written by AI, and How to Measure It
Related guide: Developer productivity metrics for AI-assisted teams
Anywhere from a fifth of it to nearly all of it, depending on who counts and what they count. Google says 75% of its new code is AI-generated and approved by engineers. Developers in JetBrains’ 2026 survey estimate that agents fully write about 47% of their code. In our own repositories, 95% of merged pull requests carry an AI agent’s signature.
Zest links each engineer's coding-agent sessions to the pull requests they led to, so you can see which merged pull requests had an agent behind them, tool by tool. Start free
Those numbers don’t measure the same thing. One counts new code, one asks developers, one counts pull requests, and each draws the line between AI-written and AI-assisted in a different place. Below: what each published figure counts, how Claude Code, Cursor and GitHub Copilot count AI code in their own dashboards, and how to measure your own team’s share. Zest sells AI coding analytics, so we have a stake in how teams measure this. Outside claims link their source, and our own numbers come from one small team.
The published numbers, and what each one counts
| Source | Share | What it counts | When |
|---|---|---|---|
| Google, CEO Sundar Pichai | 75% | New code at Google that is “AI-generated and approved by engineers” | April 22, 2026 |
| Google, earlier | 50%; more than 25% | The same measure in fall 2025, and in October 2024 | 2024–2025 |
| Microsoft, CEO Satya Nadella | 20–30% | Code in Microsoft’s repositories “written by software” | April 29, 2025 |
| JetBrains Developer Ecosystem Survey | About 47% | Each developer’s estimate of the code they produced last month that agents fully generated | Asked May–July 2026 |
| Our two repositories | 95% | Merged pull requests that carry an AI agent’s signature | July 5 to October 3, 2026 |
Sources: Google, April 2026, Google, October 2024, TechCrunch on Microsoft, JetBrains Research, and our data below.
The company figures come from a keynote post and a conference conversation, not from a published method. TechCrunch put it plainly: “it’s unclear how exactly Microsoft and Google are measuring what’s AI generated versus not.” Google’s figure covers new code, not the code it already had. Nadella added that results were mixed by language, with more progress in Python than in C++.
JetBrains asked more than 15,000 professional developers to put their last month’s code into buckets. On average, about 47% was fully written by agents, 38% written with some AI help and 27% written by hand; the averages come from bucketed answers, so they add up to more than 100%. About 22% of developers said agents write more than 80% of their code, and one in five writes no code at all without AI.
Why the answers differ: four choices
Every count of AI-written code makes four choices, and each one moves the result.
- Unit. Lines, commits, pull requests or a survey answer. A pull request usually counts if any line of it came from an agent, so a share of pull requests can sit far above a share of lines.
- Scope. New code or all code. Google counts new code; a share of a whole codebase also includes everything written before the agents arrived.
- Stage. Suggested, accepted in the editor, committed or merged. GitHub Copilot counts lines added in the IDE, Cursor counts lines in each commit, and Claude Code’s contribution metrics count lines in merged pull requests. Claude Code’s separate “lines of code accepted” total isn’t reduced when those lines are deleted later.
- Threshold. Fully generated or assisted. Anthropic stops crediting Claude Code with a line once a developer has rewritten more than 20% of it, while JetBrains asked about fully generated and AI-assisted code separately.
How Claude Code, Cursor and Copilot count AI code
Each count starts from the tool’s own activity, so none of them gives a team-wide share on its own.
| Tool | What it counts | Where | Who gets it |
|---|---|---|---|
| Claude Code contribution metrics | Merged pull requests with at least one line written with Claude Code, and those lines, matched against sessions from 21 days before to 2 days after the merge | claude.ai/analytics/claude-code, with the Claude GitHub app | Team and Enterprise plans, repositories on github.com |
| Claude Code Analytics API | Lines added and removed by Claude Code, and commits and pull requests created through it, per user per day | Admin API | Claude Console (API) organizations; not usage on Claude subscription plans |
| Cursor AI Code Tracking API | Per commit: lines from Tab, lines from the agent (Composer) and lines without AI | /analytics/ai-code/commits |
Enterprise, in alpha |
| GitHub Copilot usage metrics | Lines added and deleted in the IDE, split into user-initiated and agent-initiated, and the agents’ share over 28 days | Code generation dashboard and the metrics reports API | Organization and enterprise owners |
| Commit trailers | Commits whose message names an agent as co-author; Claude Code adds a Co-Authored-By trailer by default |
Your Git history | Anyone with the repository |
Sources, read November 7, 2026: Claude Code analytics, Claude Code Analytics API, Cursor AI Code Tracking API, GitHub Copilot usage metrics, Claude Code settings.
Anthropic calls its contribution metrics “deliberately conservative”: only lines and pull requests where Claude Code’s involvement is clear with high confidence are counted. Cursor’s tracking covers only the Git repository at the top level of the workspace. Copilot’s lines are counted in the editor, before anyone commits or reviews them. Our guides walk through each one: Claude Code analytics, Cursor analytics and GitHub Copilot metrics.
How to measure your own team’s share
-
Write the definition down first. For example: merged pull requests with at least one line from a coding agent, per team, per week. Pull requests give you one number across tools; lines work when you run one tool and have its line data.
-
Take the denominator from your Git host, not from a vendor: every pull request merged in the window, with or without AI.
-
Pull each tool’s numerator from the table above for the same window. Don’t add lines across tools: Copilot counts them in the editor, Cursor per commit and Claude Code in merged pull requests.
-
Check the Git trail. Count commits with an agent co-author trailer next to all commits:
# Commits on main in the last 30 days: all, then those with a Claude co-author trailer git rev-list --count --no-merges --since="30 days ago" main git rev-list --count --no-merges --since="30 days ago" -i --grep="co-authored-by: claude" mainTrailers undercount: Claude Code’s
attributionsetting can change or remove its trailer, and an agent that adds none leaves nothing to count. -
Read the share next to outcomes, not as a target. DX, which sells an AI code percentage report, tells its users not to use that report alone “to prove productivity, quality, developer adoption, or ROI” (DX docs). Put it beside review findings, rework and cycle time; our engineering KPIs post has a formula for each.
What our own repositories show
We run coding agents on most of our work, so our numbers sit at the high end.
- Of the 2,620 pull requests merged in our two repositories from July 5 to October 3, 2026, 95% carry an AI agent’s signature and about 90% carry Claude Code’s.
- 133 of them (5%) came from Codex, and in the 30 days to October 3 Codex’s share rose to 9.9%. Cursor co-authored 7 of the 3,192 commits in the same repositories and 90 days.
- A different signal gives a different share. Since August 12, the agent that opens a pull request in our repositories adds a short block about its session. From August 12 to October 4, 866 of the 1,570 merged pull requests (55%) carry one, and about three in four of the other 704 carry Claude Code’s signature anyway: 55% by one signal, nearly nine in ten by the two together.
A signature says an agent opened or co-wrote the pull request. It doesn’t say how many of the lines the agent wrote, or how much a person changed afterwards. More on these pull requests, from time to merge to review findings: what 866 agent-written pull requests show.
Zest takes the pull-request view. A plugin or extension in each coding agent (Claude Code, Codex, Cursor, Copilot Chat in VS Code and others) records each session, with its model and the skills and tools it used. With the Zest GitHub App connected, each session is linked to the pull request it led to, so you see which merged pull requests had an agent behind them, per engineer and per tool. Zest counts sessions and pull requests, not lines; for line counts, use the tools’ own reports above.
Frequently asked questions
How much of Google’s code is written by AI?
Sundar Pichai wrote in April 2026 that 75% of all new code at Google is AI-generated and approved by engineers, up from 50% in fall 2025. In October 2024 the figure was more than a quarter. It covers new code, not Google’s whole codebase.
How much of Microsoft’s code is written by AI?
Satya Nadella said in April 2025 that 20% to 30% of the code in Microsoft’s repositories was written by software, with better results in Python than in C++. As TechCrunch noted at the time, it’s unclear how Microsoft measures it.
What percentage of code should be AI-generated?
There is no right number. A share tells you how much of your code went through an agent, not whether your team ships more or better. Track it per tool, since each tool counts differently, and next to review findings, rework and delivery.
Does Claude Code mark the code it writes?
Yes. By default it adds a Co-Authored-By trailer to the commits it makes and a line to the pull request descriptions it writes, and the attribution setting changes or removes both. On Team and Enterprise plans with the Claude GitHub app, merged pull requests that contain Claude Code-assisted lines are also labeled claude-code-assisted.