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
*.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: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
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
Related metrics
- AI lines of code: lines from AI tool telemetry, git attribution notes, and AI co-authored commits, not this page’s human, AI, and codegen split
- AI output percentage: AI share of code output, not raw LOC
- AI output attribution: how Weave decides which lines are AI vs human
Technical details
What counts as codegen?
What counts as codegen?
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)
.gitattributes (via Linguist) and organization-specific ignore patterns are also excluded.How is this different from AI lines of code?
How is this different from AI lines of code?
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.
Why exclude codegen from AI percentage?
Why exclude codegen from AI percentage?
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.
