Skip to main content

AI Lines of Code

Lines of code (additions + deletions) contributed through AI-assisted PRs, plus AI vs non-AI PR-size comparison.

Updated today

AI Lines of Code measures the total lines changed (additions + deletions) contributed through AI-assisted PRs in the period, alongside the average lines-per-PR comparison between AI-assisted and non-AI PRs. It's the volume signal of AI Governance.

What it measures

  • Total AI Lines of Code: sum of additions and deletions across all AI-assisted PRs merged in the period.

  • Avg Lines per PR (AI-assisted): total AI lines divided by the count of AI-assisted PRs.

  • Avg Lines per PR (non-AI): same calculation for non-AI PRs.

How Leanmote calculates it

ai_lines_of_code = sum(additions(pr) + deletions(pr)) for AI-assisted PRs merged in period
avg_lines_ai     = ai_lines_of_code / count(ai_assisted_prs)
avg_lines_non_ai = sum(additions + deletions) / count(non_ai_prs)

  • Generated files (lockfiles, package-lock, build artifacts) are typically excluded from line counts via the repo's .gitattributes or Leanmote's exclusion config.

  • Test code can be optionally excluded for a "production-only" view.

How to interpret it

  • AI PRs larger than non-AI PRs — AI is being used to draft larger changes. Watch review latency carefully; large PRs are slower to review.

  • AI PRs about the same size as non-AI — AI is augmenting, not replacing, normal sizing decisions.

  • AI PRs smaller than non-AI — unusual; often indicates AI is used for surgical fixes or boilerplate.

  • Use trend over weeks rather than absolute numbers. Single-week PR-size variance is high.

What to do about it

  • If AI PRs are systematically larger, coach authors to slice AI-drafted changes into smaller PRs.

  • Pair this metric with AI Lead Time Comparison: if AI PRs are bigger AND slower, you've found a workflow to fix.

Related metrics

  • AI-assisted PRs

  • AI Lead Time Comparison

  • AI Intensity

Did this answer your question?