Measuring AI Coding ROI
Velocity metrics, code quality signals, and cost tracking frameworks for AI coding tool investment
title: "Measuring AI Coding ROI" description: "Velocity metrics, code quality signals, and cost tracking frameworks for AI coding tool investment" section: "Adoption" readTime: "10 min"
Measuring AI Coding ROI
"We feel more productive" is not a metric your CFO will accept at renewal time. This guide gives you concrete, measurable signals to track AI coding tool ROI — and honesty about vanity metrics to avoid.
The ROI Formula
ROI = (Value Delivered - Cost) / Cost × 100%
Value = Time Saved × Engineer Hourly Rate
Cost = Licensing + Setup Time + Training Time + Overhead
Illustrative example for a 10-engineer team (every number is an assumption to replace with your own):
- Claude Code usage: official guidance is roughly $13 per developer per active day and $150–250 per developer per month on average, with 90% of users under $30 per active day. Take
10 × $200 = $2,000/monthas a planning figure, then replace it with your own pilot baseline. - Seat cost on top, if applicable (Claude Team standard seat: $20/seat/month billed annually or $25 monthly; premium seat $100 annual or $125 monthly; check claude.com/pricing, as prices change).
- If each engineer saves 30 minutes/day (an assumption, not a benchmark): 10 × 0.5h × $120/h × 22 days = $13,200/month
- ROI: (13,200 - 2,200) / 2,200 × 100 = 500%
Run the same arithmetic at 10 and 15 minutes/day to see how sensitive the result is. Time-saved inputs are the weakest part of any ROI model, so prefer the measured signals below over self-reported savings.
Key Metrics to Track
1. Suggestion Acceptance Rate
Both vendors report an acceptance metric, but they are not comparable with each other.
- Claude Code: the analytics dashboard at
claude.ai/analytics/claude-code(Team/Enterprise, Admin or Owner role) shows suggestion accept rate (how often users accept Edit, Write, and NotebookEdit changes), lines of code accepted, daily active users, and sessions. API customers get a similar dashboard atplatform.claude.com/claude-code, which adds spend per member. - Copilot: use GitHub's organization-level Copilot usage metrics (dashboard or metrics API) rather than per-editor telemetry.
Treat the rate as a trend and a friction signal, not a target. A sudden drop usually means poor instructions (CLAUDE.md or copilot-instructions.md) or a model or config change; there is no universally "good" percentage.
2. PR Cycle Time
Measure time from PR open to merge, averaged across the team.
# Using GitHub CLI + jq
gh pr list --state merged --limit 100 --json createdAt,mergedAt | \
jq '[.[] | {
hours: (((.mergedAt | fromdateiso8601) - (.createdAt | fromdateiso8601)) / 3600)
}] | add.hours / length'Compare monthly against your own pre-rollout baseline. Cycle time is also affected by review load, so watch it alongside review time. For Claude Code on Team/Enterprise, the dashboard's contribution metrics (GitHub integration, public beta) compare PRs with and without Claude Code assistance and show PRs per user over time. Merged PRs containing Claude Code-assisted lines are labeled claude-code-assisted in GitHub, so you can filter for them:
gh pr list --state merged --label claude-code-assisted --limit 100 --json createdAt,mergedAtThese metrics are deliberately conservative (an underestimate) and are not available for organizations with Zero Data Retention or for usage through the Console API or third-party providers.
3. AI-Generated Code Churn Rate
What percentage of AI-written lines are modified within 7 days? High churn means low-quality output.
# Mark AI commits with a convention
git commit -m "feat: add auth middleware [ai-assisted]"
# Then measure churn for those commits
git log --grep="\[ai-assisted\]" --format="%H" | \
xargs -I {} git diff {}~1 {} --stat | \
# Compare with follow-up commits to those files within 7 daysCompare against your human-written baseline measured the same way; there is no standard industry target. Tags like [ai-assisted] depend on developer discipline. Claude Code adds a Co-Authored-By trailer to its commits by default (configurable through the attribution setting), which is a more reliable marker.
4. Test Coverage Trend
AI should help increase test coverage since writing tests is one of the highest-value AI coding tasks.
# Monthly baseline
npx jest --coverage --coverageReporters="json-summary" 2>/dev/null | \
jq '.total | {lines: .lines.pct, branches: .branches.pct}'Track monthly against your own baseline. Coverage is a weak proxy on its own; pair it with defect escape rate or mutation testing.
5. Lines of Code per Engineer-Hour (Weak Proxy)
Use with caution: it rewards verbosity, and AI makes verbose code cheap. Prefer PRs merged per engineer and cycle time. If you track it at all, treat it as a directional signal only.
# Git log for last 30 days — lines added by team
git log --since="30 days ago" --numstat --format="" | \
awk '{add += $1} END {print add}'Divide by engineer-hours worked. Compare pre- and post-rollout baselines.
6. Engineer Satisfaction Score
A quarterly survey question:
"On a scale of 1–5, how much does [AI tool] help you do your job better?"
Track the average over time and read the free-text comments. As a rough heuristic, a score trending below 3 suggests adoption friction.
What NOT to Measure
| Vanity Metric | Why It's Misleading |
|---|---|
| "AI wrote X% of our code" | Doesn't measure code quality or value delivered |
| Raw lines of code output | Incentivizes verbose, low-quality code |
| Chat message count | Doesn't correlate to value |
| Time spent on AI tool | Irrelevant without outcome correlation |
| "AI saved us X hours" (self-reported) | Heavily subject to social desirability bias |
Cost Tracking Template
## Monthly AI Tools Cost Analysis
### Licensing
- GitHub Copilot Business: $N × (current per-seat price) = $XX
- Claude Team/Enterprise seats: $N × (current seat price; see claude.com/pricing) = $XX
- Cursor Teams seats: $N × (current per-seat price) = $XX
- Total: $XXX/month
### Claude Code usage cost
- Seat-based (Team/Enterprise): usage inside the seat allowance is not metered in dollars; track usage-credit spend in the admin spend report
- API / Console / Bedrock / Vertex / Foundry: per-token billing; pull spend from the Console dashboard, your cloud bill, or OpenTelemetry (claude_code.cost.usage)
- Planning baseline (official): ~$13 per developer per active day, $150–250 per developer per month
- Monthly actual: $XXX
### Overhead
- Training time (one-time): XX engineer-hours × $120 = $XXX
- Ongoing admin: XX hours/month × $120 = $XXX
### Total Monthly Cost: $XXX
---
### Value Delivered
#### Time Savings (Survey + Telemetry Triangulated)
- Avg minutes saved per engineer per day: XX min
- Team size: N engineers
- Working days: 22/month
- Hourly rate blended: $120/hr
- Monthly time value: N × (XX/60) × $120 × 22 = $XXXX
#### PR Cycle Time Improvement
- Pre-rollout average: XX hours
- Post-rollout average: XX hours
- Time saved per PR: XX hours × $120 = $XXX
- PRs per month: XX
- Monthly value: $XXXX
### ROI: (value - cost) / cost × 100% = XXX%Stakeholder Reporting
For engineering leadership (monthly):
- PR cycle time trend
- Completion acceptance rate
- Tool satisfaction score
- Notable wins (one specific story)
For executive leadership (quarterly):
- ROI summary (use the formula above)
- Security incidents (should be zero)
- Headcount equivalent (time saved ÷ 160 hours ≈ N FTE-equivalent productivity gain)
- Your own before/after baselines (avoid quoting vendor or third-party benchmarks as your results)
Collecting Usage and Cost Data
| Source | What you get |
|---|---|
| Claude analytics dashboard (Team/Enterprise) | Daily active users, sessions, suggestion accept rate, lines accepted, contribution metrics, leaderboard, CSV export |
| Spend report (Team/Enterprise admin) | Estimated spend per user and per model (usage credits), CSV export |
| Enterprise Analytics API (Enterprise only) | Per-user engagement, usage, and cost reports; key with the read:analytics scope |
| Console dashboard / Claude Code Analytics API (API customers) | Per-member spend and accepted lines |
| OpenTelemetry | Real-time metrics to your own stack, on every setup including Bedrock/Vertex/Foundry, which the Anthropic dashboards do not cover |
To enable OpenTelemetry, set CLAUDE_CODE_ENABLE_TELEMETRY=1, OTEL_METRICS_EXPORTER=otlp, OTEL_EXPORTER_OTLP_PROTOCOL and OTEL_EXPORTER_OTLP_ENDPOINT in the env block of managed settings so they apply to everyone. Useful metrics include claude_code.session.count, claude_code.cost.usage, claude_code.token.usage, claude_code.lines_of_code.count, claude_code.pull_request.count, and claude_code.commit.count. Prompt text is redacted unless you set OTEL_LOG_USER_PROMPTS=1; leave it off unless your privacy review approves it.
A Note on Published Benchmarks
Published productivity figures vary widely and are not directly comparable to your codebase:
- GitHub's often-cited "55% faster" comes from a 2022 controlled experiment on one small, well-scoped task (writing an HTTP server in JavaScript). It does not describe typical feature work.
- Consultancy estimates (for example McKinsey's 2023 analysis) report time reductions on specific task types, not end-to-end delivery.
- A 2025 randomized controlled trial by METR found experienced open-source developers working in their own mature repositories took about 19% longer with AI tools, while believing they were faster.
The takeaway: measure your own baseline before rollout, compare after, and be skeptical of self-reported savings.