Skip to main content

How it works

The Lines of code chart (grouped by LOC type) shows how many lines changed in merged pull requests, split into three buckets: This chart counts raw line changes in merged PRs. It is separate from code output, which measures the estimated effort of a change. Codegen is tracked separately so large generated-file PRs (protobuf, GraphQL/SQLC codegen, lock files, etc.) do not inflate human or AI numbers.

Calculation

For each merged PR, Weave counts lines added and deleted across all changed files.

Step 1: Raw vs filtered LOC

  • Raw LOC — total lines added and deleted in the PR
  • Filtered LOC — lines in files Weave treats as meaningful source code
Files excluded from filtered LOC include generated outputs (for example *.pb.go, *.sql.go, *.generated.ts), lock files, minified assets, and paths under vendor/, node_modules/, dist/, and similar directories. Your organization can also configure custom ignore patterns. Formula:

Step 2: Split filtered LOC into human and AI

The remaining filtered LOC is split between human and AI using the same attribution strategies as AI output attribution — git notes, API telemetry, co-authorship metadata, or time-matched AI activity — but weighted by each commit’s filtered line count instead of output estimates. Formulas:
AI and human shares sum to 100% of filtered LOC. Codegen is excluded from this split.

Example

A merged PR changes 10,000 lines total:
  • 7,000 lines are in generated protobuf files → codegen
  • 3,000 lines remain as filtered LOC
  • Attribution finds 80% AI, 20% human on those 3,000 lines → 2,400 AI, 600 human
Total chart breakdown: 7,000 codegen + 2,400 AI + 600 human = 10,000 raw LOC.

Where you’ll see this

  • Overview and AI usage dashboards — Lines of code, grouped by LOC type
  • PR LOC AI percentage — AI / (AI + human), excluding codegen

Technical details

Codegen is any line change in a file Weave filters out before attribution. Common examples:
  • Protobuf and gRPC outputs (*.pb.go, *_pb2.py)
  • SQLC and GraphQL codegen (*.sql.go, *.generated.ts)
  • Lock files and dependency vendoring (package-lock.json, go.sum, *.lock, vendor/)
  • Minified files and image assets (.min.js, .svg)
  • Documentation and config files (.md, .json, .yaml)
Files marked as generated in .gitattributes (via Linguist) and organization-specific ignore patterns are also excluded.
AI lines of code comes from connected AI tool telemetry (how much each assistant reports a developer used it day to day), plus git attribution notes and commits co-authored by AI tools. For each person, day, and tool, Weave keeps one source: git attribution first, then telemetry, then co-authored commits.PR lines of code (by LOC type) comes from git diffs in merged PRs. We attribute those diffs to human, AI, or codegen. The two metrics answer different questions and may not match exactly.
Codegen lines come from generated, dependency, documentation, and config files rather than source code you write. Excluding them from PR LOC AI percentage keeps the metric focused on how much of your meaningful code changes came from AI assistants.
Last modified on October 17, 2026