Blog / Other resources

Is cost per merged pull request a good metric for AI coding agents?

Is cost per merged pull request a good metric for AI coding agents? What it shows, where it fails, and the better unit: cost per delivery point.

Why do teams use cost per merged pull request?

AI coding agents such as Claude Code, Codex and Copilot coding agent bill by tokens, seats or both. When agents do more work, the bill grows fast, and finance asks what it bought. Cost per merged pull request is the first answer that most teams find:

  • It is easy to calculate: agent spend ÷ merged pull requests.
  • It counts only work that shipped, not prompts or suggestions.
  • It goes up when agents produce work that nobody merges.

Larridin, for example, calls cost per merged PR "the KPI for AI coding agent spend", because agent spend can rise while shipped work falls. That point is correct. The question is whether one pull request is a good unit of work.

Where does cost per merged pull request fail?

Problem What happens Effect on the metric
All pull requests count the same A 1-line fix and a new feature are 1 unit each Small changes make the agent look cheap
Easy to game Splitting work into small pull requests lowers the cost per pull request Better number, same work
No quality A merged pull request can come back as rework or a revert Rework is invisible
Review time left out Engineers review and fix agent pull requests The real cost is higher
No comparison with people Engineers and agents do different sizes of work A fair comparison is not possible

Research also shows that speed and output are hard to read. In a randomized trial in early 2025, METR found that experienced open-source developers took 19% longer on their own repositories when they used AI tools, while they expected to be faster. In February 2026, METR changed the design of its next study, because wider AI use made the groups hard to compare. The lesson for buyers: count finished work with a careful unit, and do not trust a single simple ratio.

What is a better metric?

A better metric keeps the strong part of cost per merged pull request, work that shipped, and fixes the weak parts:

  1. Weight each merged pull request by its size and complexity. Pensero scores each one in delivery points (magnitude × complexity).
  2. Put the full cost in the numerator. Tokens, seats, tools, and the engineer time to review and fix the agent work.
  3. Put quality beside the number. Rework, reverts and defects of the same work.
  4. Use the same unit for people and agents. Then you can decide which work goes to which.

Cost per merged pull request vs cost per delivery point

Measure Cost per merged pull request Cost per delivery point (Pensero)
Unit 1 merged pull request Magnitude × complexity of the merged work
Follows the size of the work No Yes
Can be gamed by small pull requests Yes No, small work gets fewer points
Quality Not included Beside each point
Review cost of engineers Often left out Included in the full cost
Compares agents and engineers Not fairly Yes, on one scale

Example: 2 agents, 1 month

A team runs 2 AI coding agents on the same code base. Example numbers for 1 month:

Measure Agent A Agent B
Agent spend $6,000 $9,000
Merged pull requests 300 150
Cost per merged pull request $20 $60
Engineer review time, at cost $9,000 $3,000
Full cost $15,000 $12,000
Delivery points 150 240
Full cost per delivery point $100 $50
Rework 14% 5%

By cost per merged pull request, agent A looks 3 times cheaper. With the full cost and delivery points, agent B costs half as much per unit of finished work, with less rework. Agent A produced many small pull requests that needed a lot of review.

The decision changes: give more of the work to agent B, and use agent A only for small, well-tested changes.

What do finance leaders and clients need to see?

A finance leader does not ask how many pull requests an agent merged. The questions are about money and risk:

  • What did the AI spend buy? The finished work, in one unit, for each month.
  • Is the cost per unit going down? The trend of the full cost per delivery point, with agents and people together.
  • Did quality hold? Rework, reverts and defects next to the output.
  • Where do we put the next dollar? The agents, teams and vendors with the lowest cost per point at the same quality.

An IT services firm gets the same questions from its clients. When AI agents do part of the work, the client wants to see what changed: more finished work for the same fee, or the same work for a lower fee. A cost per merged pull request cannot answer this, because the client does not buy pull requests. A unit of finished work, with the evidence behind each unit, gives the client and the firm the same number to discuss.

This is also why the unit must cover people and agents together. Most work in 2026 is mixed: an engineer writes the plan, an agent writes the code, and an engineer reviews it. A metric for agents only splits one piece of work into 2 numbers that nobody can add.

How to move from cost per merged pull request to cost per delivery point

  1. Keep the metric you have. Cost per merged pull request stays a useful early warning.
  2. Score 3 months of merged work in delivery points, for agents and for engineers.
  3. Add the review time of engineers on agent pull requests to the agent cost.
  4. Read the cost per delivery point next to rework, per agent, team and vendor.
  5. Review every month, and move work to the agent, team or vendor with the lowest cost per point at the same quality.

When is cost per merged pull request enough?

  • Early pilots with 1 agent and a few pull requests per week, where you only need to see if spend and output move together.
  • Spend alerts, to see quickly when an agent burns tokens on work that nobody merges.
  • The same type of task, for example only dependency updates, where pull requests have about the same size.

For budget decisions, vendor comparisons, quotes to clients and the split of work between people and agents, use a weighted unit.

Common mistakes

  • Reading the metric without the review cost. The agent looks cheaper than it is.
  • Rewarding small pull requests. The number goes down, and the finished work stays the same.
  • Ignoring reverts. A merged pull request that is reverted the next week is not finished work.
  • Comparing agents across different code bases. The work is not the same, so the cost is not comparable.
  • Using the metric to rank engineers. Measure agents, teams, vendors and work, not individuals.

How Pensero helps

Sources

Frequently asked questions

Is cost per merged pull request a good metric for AI coding agents?

It is a good start, but not enough. It links AI spend to shipped work, but it counts a 1-line fix and a new feature as the same unit, and it does not show rework.

What is a better metric than cost per merged pull request?

Cost per delivery point. Pensero scores each merged pull request by magnitude × complexity, so the cost follows the size of the work, with quality beside it.

How do I calculate cost per merged pull request?

Divide the AI agent spend of a period (tokens, seats and tools) by the number of pull requests that the agent produced and that were merged in the same period.

Can AI agents game cost per merged pull request?

Yes. Smaller pull requests lower the cost per pull request without more finished work. A unit weighted by size and complexity removes this effect.

Should I compare AI agents and engineers with cost per merged pull request?

No. Agents and engineers do different sizes of work. Compare them with the same weighted unit, such as delivery points, and add the review time of the engineers to the agent cost.