AI Coding Agents Write Too Much Code: A 3-Sentence Prompt Cuts Patches by 40%

Amazon researchers measured how much unrequested code AI coding agents add to bug fixes and tested a three-sentence system-prompt fix across 14 models. Patches shrank 40 percent and tokens fell up to 42 percent, but the effect on success split by model family.

Christopher Ort
By i10X News Desk · Reviewed by Christopher Ort · 4 min read
Share
Blurred code diff with many green highlighted lines and one short teal block, illustrating a study on AI coding agents that write more code than a bug fix needs
Image: AI-generated, i10X
On this page
  1. How much extra code coding agents write
  2. The three-sentence prompt, and what it changed per model
  3. One step further: the prompt helped Claude and hurt OpenAI models
  4. i10x Perspective

AI coding agents often fix a bug correctly and then keep going, adding tests, documentation, error handling and refactoring that nobody asked for. A study by three Amazon researchers, posted to arXiv on December 2 and accepted at an AAAI-27 workshop on agentic software engineering, puts numbers on this “over-engineering” and tests a fix that costs nothing: a three-sentence addition to the system prompt. Across 14 models from seven providers, it cut the average patch size by 40 percent and cut input tokens per task for 13 of the 14 models, by up to 42 percent. Whether it also helps or hurts the success rate depends on the model, and that is the part teams need to check.

How much extra code coding agents write

Jay Desai, Fanyou Wu and Srinivasan Sengamedu compared agent patches with the human reference fix on SWE-bench Verified, a benchmark of 500 real GitHub issues. Their Over-Engineering Score measures patch size relative to that reference: 1.0 means the same number of changed code lines. Across 6,790 patches from 14 published agents, the typical agent wrote between 0.67 and 8.2 times the reference size, depending on the agent.

Bigger was not better. Patches in a “Goldilocks zone” of one to 1.5 times the reference resolved 59.6 percent of tasks, against 34.8 percent for patches more than ten times larger. The authors caution that this is an association: more than half of the patches in the best zone match the reference line count exactly, and some of them are probably the reference fix itself.

The paper’s opening example is a two-line Django fix. GPT-5.4 returned a correct 17-line patch, adding a rewrite of the documentation and a new unit test. With the prompt below, the same model returned exactly the two-line fix, which also passed.

The three-sentence prompt, and what it changed per model

The researchers prepended this instruction to their agent’s system prompt:

> “CRITICAL BEHAVIORAL CONSTRAINT: Make the MINIMAL change needed to solve the problem. Do not add tests, documentation, type annotations, error handling, or refactoring unless explicitly requested. Your patch should modify as few lines as possible while correctly resolving the issue.”

ModelPatch size vs human fix (mean, before to with prompt)Tasks resolved of 500 (before to with prompt)
Claude Sonnet 4.62.32 to 1.11261 to 293 (significant gain)
Claude Opus 4.61.62 to 0.99278 to 290
Claude Opus 4.51.86 to 0.99302 to 310
GLM 52.34 to 1.08235 to 244
GPT-5.42.88 to 0.82236 to 198 (significant loss)
GPT-5.4-mini1.96 to 0.83199 to 186
MiniMax M2.51.33 to 1.19245 to 244
DeepSeek V3.21.19 to 1.25104 to 123

Source: Desai, Wu and Sengamedu, “Don’t Over-Engineer It”, arXiv 2612.04613 v1, per-model results on SWE-bench Verified (selection of 8 of 14 models). Patch size: changed code lines relative to the human reference fix. Significance after Holm correction as reported by the authors.

Most of the reduction came from agents no longer touching files the human fix never touched, and much of what disappeared was unrequested test code: counting only non-test code, the reduction was 14 percent. An ablation showed that the explicit ban on extra additions does the work; the word “minimal” alone did less. Patch sizes also fell for every model on two further benchmarks, SWE-bench Multilingual and Pro.

One step further: the prompt helped Claude and hurt OpenAI models

Overall, resolution did not change significantly. Split by model family, the picture is sharper. By our sum of the paper’s per-model results, the five Claude models together resolved 81 more tasks with the prompt (out of 2,500 task runs, plus 3.2 percentage points), and every one of them improved. The three OpenAI-trained models (GPT-5.4, GPT-5.4-mini and GPT-OSS 120B) together resolved 74 fewer. Only two per-model changes are statistically significant after correction: Sonnet 4.6 gained 6.4 points and GPT-5.4 lost 7.6.

Why the split? The authors note that GPT-5.4 starts with the largest median patches but, under the constraint, sometimes cuts too deep and produces a patch that is too small or none at all. Their broader explanation for over-engineering is that preference training rewards thorough, helpful-looking answers, a coding version of sycophancy, but they say their data are consistent with this account without proving it.

What follows for two groups:

  • Teams paying for agent tokens get the most direct benefit. The paper reports 27 percent fewer input tokens per task for Opus 4.6, 29 percent for Sonnet 4.6 and 42 percent for GPT-5.4. At scale that is a straight cut in the bill, and our report on the harness tax in coding agents showed how much scaffolding choices already move costs.
  • Reviewers get smaller, more focused diffs. Under the constraint, edits outside the files the human fix touched largely disappear for the Claude models. That matters when review itself is billed per pull request, as with Copilot’s Max code review tier at $10 a review.

How to use it: add the instruction where your issues ask only for a fix, keep it out of tasks that explicitly request tests or docs, and compare resolution on your own backlog before and after, model by model. The paper’s own advice is the same: evaluate per model before deployment.

What is still open: the experiments used a deliberately simple agent scaffold with a 20-tool-call budget, single runs per model and temperature 0, so absolute success rates (17 to 62 percent) sit below public leaderboards. Production agents such as Claude Code or Codex were not tested, and whether teams want fewer tests in practice is a judgment the benchmark cannot make.

How we checked

Checked on 6 December 2026, 06:46 CET.

  • The full arXiv paper 2612.04613 (version 1, December 2, 2026), including the per-model results table, the ablation and the appendix with the exact prompt
  • Our calculations: summed resolution changes for the five Claude models and the three OpenAI-trained models
  • Not done by us: running the prompt on our own agents or on Claude Code and Codex

i10x Perspective

This is one of the rare agent papers with a fix you can apply in a minute, and its most useful finding is not the 40 percent. It is that the same sentence made Claude models better and GPT-5.4 worse. “Write less code” is a style instruction, and models trained in different ways read it differently. We would add it to agent prompts for bug-fix work today, but as an A/B test, not as a default, and with the token savings measured rather than assumed.

Christopher Ort

Christopher Ort

Christopher Ort is the editor of i10X News at i10x.ai. He has worked hands-on with AI tools, models and agent workflows for years and leads i10X’s coverage of AI launches, funding and research. He is the author of “The Style Penalty”, an SSRN study on how frontier AI models judge AI-written CVs, covered by heise online and t3n.

Editor's picks

  1. Custom GPTs Shut Down December 11: What Moves to Plugins and What Breaks
  2. Nvidia Nemotron 4: Super Due Early 2027, an 8B Decision Model Ships Dec. 15
  3. Claude Code Helped a CTO Copy Float’s Codebase. Default Logs Would Miss It
  4. Colossus 2 to Double in 30 Days, Musk Says, as SpaceX Hunts GB300s to Rent
  5. Grok for Builders Gives Free Ultra: How It Compares With Claude and Codex Offers