DEV Community

Cover image for Why Coding Agent Commits Are 3x Larger and How to Keep PRs Reviewable
Sean Kwon
Sean Kwon

Posted on Edited on

Why Coding Agent Commits Are 3x Larger and How to Keep PRs Reviewable

A 2026 empirical study of 128,018 GitHub repositories (arXiv:2601.18341) measured how autonomous coding agents like Cursor, Claude Code, and Codex change real version control histories. Adoption across active repositories already sits between 22.20% and 28.66%, yet the sharpest operational shift appears at code review time.

Commits assisted by coding agents add a median of 31 lines of code, triple the 11-line median of human-authored commits and nearly eight times the 4-line median of automated dependency bots. At the 75th percentile, agent-assisted additions reach 114 lines compared to 41 lines for humans.

When an agent bundles import cleanup, type renames, and core business logic into one large patch, human reviewers start skimming. Here is what the repository data shows and how to enforce small, single-intent commits locally before opening a pull request.

What the 128,018-repository dataset shows

The size gap widens at the tails of the commit distribution:

  1. Small surgical commits (1 to 5 added lines) drop by 36% when a coding agent assists with the change.
  2. Massive commits adding more than 1,000 lines occur almost twice as frequently in agent-assisted histories.
  3. Single-file commits drop by roughly 15%, while commits touching more than 20 files jump by 30%.
  4. Median deletions also climb from 5 lines in human commits to 7 lines in agent-assisted commits, increasing cross-file code churn.

Agents optimize for task completion inside a single prompt loop. Ask an agent to fix a pagination bug, and it will often reformat untouched helpers, rename local variables, and update test fixtures in the same working tree. Staging everything at once turns a 15-line bug fix into a 14-file review bottleneck.

Inspecting staged churn before you commit

Before running git commit after an agent session, inspect file-level churn across the index with --numstat and --shortstat:

git diff --cached --numstat
git diff --cached --shortstat
Enter fullscreen mode Exit fullscreen mode

A mixed agent session typically produces an uneven spread like this:

4   4   src/api/client.ts
2   2   src/utils/date.ts
68  59  src/components/table.tsx
19  3   src/services/pagination.ts
34  0   tests/pagination.test.ts
 5 files changed, 127 insertions(+), 68 deletions(-)
Enter fullscreen mode Exit fullscreen mode

Only src/services/pagination.ts and tests/pagination.test.ts implement the actual fix. The remaining 139 modified lines in table.tsx, client.ts, and date.ts are formatting and cleanup noise that obscure the behavioral change.

Step 1: Separate mechanical edits from behavior changes

Reset the index and stage hunks selectively so mechanical cleanup never shares a commit hash with behavioral logic:

# Unstage all agent edits while keeping working tree changes intact
git reset

# Commit 1: stage mechanical formatting or renames only
git add src/api/client.ts src/utils/date.ts src/components/table.tsx
git commit -m "refactor: normalize table formatting and imports"

# Commit 2: interactively verify and stage logic hunks plus tests
git add --patch src/services/pagination.ts tests/pagination.test.ts
git commit -m "fix: handle empty cursor boundary in pagination"
Enter fullscreen mode Exit fullscreen mode

Reviewers can now verify the 22-line pagination fix: commit in seconds and inspect the mechanical cleanup commit separately without hunting for hidden logic mutations.

Step 2: Add a local pre-commit diff budget hook

Prompt rules alone drift during long coding sessions. A lightweight .git/hooks/pre-commit script enforces a hard ceiling on file count and line churn before a commit is recorded:

#!/usr/bin/env bash
set -euo pipefail

max_files=10
max_lines=300

files_changed=$(git diff --cached --numstat | wc -l | tr -d ' ')
lines_changed=$(git diff --cached --numstat | awk '{ sum += $1 + $2 } END { print sum + 0 }')

if [ "$files_changed" -gt "$max_files" ] || [ "$lines_changed" -gt "$max_lines" ]; then
  echo "Commit blocked: $files_changed files and $lines_changed changed lines exceed budget ($max_files files / $max_lines lines)." >&2
  echo "Split mechanical cleanup from feat: or fix: logic using git reset and git add --patch." >&2
  exit 1
fi
Enter fullscreen mode Exit fullscreen mode

Make the hook executable in your repository:

chmod +x .git/hooks/pre-commit
Enter fullscreen mode Exit fullscreen mode

When an unbounded agent run attempts to bundle 14 files and 418 changed lines into one commit, Git stops the commit immediately:

Commit blocked: 14 files and 418 changed lines exceed budget (10 files / 300 lines).
Split mechanical cleanup from feat: or fix: logic using git reset and git add --patch.
Enter fullscreen mode Exit fullscreen mode

Splitting the working tree into a cleanup commit and a focused logic commit brings both diffs well below the threshold and keeps git bisect reliable when tracking down regressions later.

Summary checklist

  1. Check staged file spread with git diff --cached --numstat after every autonomous agent run.
  2. Keep formatting, file moves, and import cleanup in a standalone preparatory commit.
  3. Stage behavioral feat: and fix: changes alongside their tests using git add --patch.
  4. Enforce a local .git/hooks/pre-commit line and file budget so oversized multi-intent diffs never reach pull request review.

Top comments (5)

Collapse
 
gautamtalksdev profile image
Gautam K •

Larger commits from agents make sense, they don't feel the pain of a messy diff the way a reviewer does. Asking the agent to commit after each passing test, and keeping refactors in their own commits, seems to help reviewers the most.

Collapse
 
seanjhkwon profile image
Sean Kwon •

Explicit file staging helps there too, since agents still tuck unrelated helper renames into a passing-test commit when staging the whole tree at once. Scoping git add by path keeps each checkpoint focused on the actual behavior change.

Collapse
 
gautamtalksdev profile image
Gautam K •

Good point, scoping git add per file is the simplest fix for that. A passing test can hide an unrelated rename in the same commit, and explicit staging makes the agent say what it meant to change.

Collapse
 
sansakamoto profile image
San •

The 31 vs 11 lines number stuck with me because it's exactly what I've been seeing — the actual fix is maybe 20 lines and then there's a pile of import cleanup and formatting around it that makes the diff look scary for no reason. The pre-commit budget is the part I'll actually try, 10 files / 300 lines feels strict enough to force a split without me just turning it off after a day. My only worry is a legit big refactor tripping it all the time, do you just bump the numbers for those or split anyway?

Collapse
 
seanjhkwon profile image
Sean Kwon •

Most large refactors still split cleanly into two phases without raising the 10-file limit: move shared types or module renames first, then migrate callers a slice at a time. Each checkpoint stays fast to verify and leaves automated formatting noise outside the behavioral change.

For single-shot changes that truly cannot be sliced, like a database migration or generated schema update, gating the hook with a one-off skip environment variable beats raising the budget globally. Once people raise the threshold past 300 lines, they rarely turn it back down.