"Is Coding with AI Actually Faster and Cheaper?" was the top post on DEV in the week to 22 November, with 229 reactions and 195 comments. It's the right question, and most of us answer it with a feeling: the agent seems to help, or it seems to create cleanup work.
Feelings are a weak instrument here. In METR's early-2025 study, 16 experienced open-source developers worked on 246 real issues from their own repositories. With AI tools allowed, they took 19% longer, yet they "expected AI to speed them up by 24%, and even after experiencing the slowdown, they still believed AI had sped them up by 20%." METR now labels those results out of date, and its February 2026 update says developers are likely more sped up now, but that its new data is "only very weak evidence for the size of this increase." The lesson that survives either way isn't a number. It's that how fast an agent feels and what it actually delivers can be far apart.
You can't run a randomized trial on your own team. You can run something smaller that answers a narrower question: on tasks from my repo, with my setup, does the agent produce changes that pass my checks, and does that get better or worse when I change something? This article builds that in an afternoon from your git history.
What this eval measures (and what it doesn't)
It measures one thing: given the bug report, can the agent produce a change that passes the tests your team wrote for that bug? It does not measure time saved, review effort or code quality. Those still need your judgment. But it turns "the new model feels better" into a pass/fail list you can compare from one change to the next.
Step 1: Pick 10 to 20 past fixes from your history
You already own a good test set: closed bugs whose fix commit also added a test. That's the same idea SWE-bench is built on: 2,294 problems "drawn from real GitHub issues and corresponding pull requests." You only need a handful from your own repo. Anthropic's guide to agent evals says teams wait too long because they think they need hundreds of tasks: "In reality, 20-50 simple tasks drawn from real failures is a great start." My rule of thumb: ten to start, twenty when you can.
Pick fixes that look like the work you actually hand to an agent: small bugs, validation gaps, edge cases. Skip ones that needed a meeting to understand. For each, write the prompt the way the original bug report read, without hints from the fix.
[
{"id": "discount-rounding", "fix_commit": "fix-rounding",
"prompt": "apply_discount(19.99, 15) returns 16.9915. Prices must be rounded to cents.",
"check": "python3 -m unittest discover -s tests -q"}
]
fix_commit is the commit (or a tag on it) that fixed the bug. The task starts from its parent.
Step 2: Prove each task is fair before you trust it
Two checks per task, before any agent runs:
- The original fix passes. The same Anthropic guide recommends a reference solution for each task: "a known working output that passes all graders," which proves the task is solvable and the grader is configured correctly. Your fix commit is that reference.
- The unfixed code fails. If the tests already pass on the parent commit, the task can't tell a good agent from one that does nothing.
If a task fails either check, fix the task or drop it.
Step 3: Run each task in a clean copy, with the tests held out
Two details matter more than they look. First, a worktree or a clone of your repo still contains the git history, and the fix is in it. Anthropic describes a related leak in its own evals: Claude gaining "an unfair advantage on some tasks by examining the git history from previous trials." So the runner below exports only the files of the parent commit with git archive, with no .git folder. Second, the tests from the fix commit are held out: the agent never sees those versions, and they're written back after the agent finishes, overwriting any edits it made to them.
Here's the runner. It needs only Python's standard library and git, and it calls whatever agent command you give it.
#!/usr/bin/env python3
"""Replay past fixes from your git history as eval tasks for a coding agent.
Usage: python3 eval_runner.py tasks.json LABEL [--reference]
AGENT_CMD is a shell command; the task prompt is in $TASK_PROMPT.
AGENT_FILES (optional): current config files to copy in, e.g. "CLAUDE.md"."""
import csv, json, os, shutil, subprocess, sys, tempfile
tasks_file, label = sys.argv[1], sys.argv[2]
reference = "--reference" in sys.argv
agent_cmd = os.environ.get("AGENT_CMD", "")
def git(*args):
return subprocess.run(["git", *args], capture_output=True, text=True,
check=True).stdout
def snapshot(commit, dest):
# files only, no .git: the agent can't read the fix from history
archive = subprocess.run(["git", "archive", commit], capture_output=True,
check=True).stdout
subprocess.run(["tar", "-x", "-C", dest], input=archive, check=True)
results = {}
for t in json.load(open(tasks_file)):
fix = t["fix_commit"]
hidden = [f for f in git("diff", "--name-only", f"{fix}^", fix).split()
if f.startswith("tests/")]
with tempfile.TemporaryDirectory() as work:
snapshot(fix if reference else f"{fix}^", work)
for f in os.environ.get("AGENT_FILES", "").split():
shutil.copy(f, os.path.join(work, f)) # config under test
if not reference and agent_cmd:
env = dict(os.environ, TASK_PROMPT=t["prompt"], TASK_ID=t["id"])
subprocess.run(agent_cmd, shell=True, cwd=work, env=env,
timeout=t.get("timeout", 900))
for f in hidden: # restore held-out tests, undoing any agent edits
os.makedirs(os.path.dirname(os.path.join(work, f)), exist_ok=True)
with open(os.path.join(work, f), "w") as out:
out.write(git("show", f"{fix}:{f}"))
check = subprocess.run(t["check"], shell=True, cwd=work,
capture_output=True)
results[t["id"]] = "PASS" if check.returncode == 0 else "FAIL"
print(f"{results[t['id']]} {t['id']}")
passed = sum(r == "PASS" for r in results.values())
print(f"{label}: {passed}/{len(results)} passed")
if reference or not agent_cmd:
sys.exit(0) # validation runs are not logged
log = "eval_results.csv"
previous = {}
if os.path.exists(log):
rows = list(csv.DictReader(open(log)))
if rows:
last = rows[-1]["label"]
previous = {r["task"]: r["result"] for r in rows if r["label"] == last}
for task, result in results.items():
if previous.get(task) == "PASS" and result == "FAIL":
print(f"REGRESSION {task} (passed in the previous run)")
new = not os.path.exists(log)
with open(log, "a", newline="") as fh:
w = csv.writer(fh)
if new:
w.writerow(["label", "task", "result"])
w.writerows([label, k, v] for k, v in results.items())
It assumes your tests live under tests/; change that filter if yours don't. Note the snapshot comes from an old commit, so it also contains your old CLAUDE.md or AGENTS.md. If the change you're testing is a config change, list the current files in AGENT_FILES so each task runs with them.
For AGENT_CMD, use your agent's non-interactive mode. Two examples from the official docs:
-
Claude Code:
claude -p "$TASK_PROMPT" --allowedTools "Read,Edit,Bash". The headless docs recommend--barefor scripted calls, but bare mode skips auto-discovery of hooks, skills, MCP servers andCLAUDE.md. If your setup is what you're evaluating, leave it off. Without it, a-psession runs the project's hooks and connects its MCP servers "even in a folder you've never trusted," so only do this on your own repo. With--output-format jsonyou also gettotal_cost_usdper run, which the docs describe as a client-side estimate. -
Codex:
codex exec --sandbox workspace-write "$TASK_PROMPT". Per the non-interactive docs,codex execruns in a read-only sandbox by default, so it needsworkspace-writeto edit files.
A demo run (simulated agents, real output)
To show the mechanics, I built a small invented repo: a pricing.py module and three past fixes (rounding to cents, rejecting negative quantities, parsing "$1,299.00"), each fix commit adding one test file. To be clear about what's real: no coding agent ran. The two "agents" are short scripts I wrote that make hand-picked edits, standing in for "my agent before and after a config change." Version 1 fixes two tasks and misses the third. Version 2 fixes the third but rounds discounts to one decimal place. The runner and its output are real, from 27 Nov 2026 with git 2.47.3 and Python 3.13.5 (excerpt):
$ python3 /tmp/eval_runner.py /tmp/tasks.json reference --reference
reference: 3/3 passed
$ python3 /tmp/eval_runner.py /tmp/tasks.json no-agent
no-agent: 0/3 passed
$ python3 /tmp/eval_runner.py /tmp/tasks.json agent-v1
PASS discount-rounding
PASS negative-quantity
FAIL thousands-separator
agent-v1: 2/3 passed
$ python3 /tmp/eval_runner.py /tmp/tasks.json agent-v2
FAIL discount-rounding
PASS negative-quantity
PASS thousands-separator
agent-v2: 2/3 passed
REGRESSION discount-rounding (passed in the previous run)
The first two runs are the fairness checks from Step 2. The last two are the point of the exercise: both versions score 2/3, so a single total says nothing changed. Per task, one fix was gained and one was lost. That's why the runner compares task by task and logs every run to eval_results.csv.
Step 4: Re-run it on every change
Run the set whenever you change something the agent depends on: model, prompt, CLAUDE.md or AGENTS.md, a new MCP server, a new tool version. Give each run a label that says what changed, so the log reads like a history of your setup.
Read the results with some humility:
- Small sets are noisy. With 10 tasks, one task flipping is 10 points. Before you conclude anything, re-run the tasks that changed.
- Agents aren't deterministic. Running each task more than once helps. Anthropic's guide distinguishes pass@k (at least one of k tries succeeds) from pass^k (all k succeed), and the second is the one that matters if you need it to work every time.
- A task nobody ever passes may be broken. The guide notes that a 0% pass rate across many trials "is most often a signal of a broken task, not an incapable agent." Re-check the prompt and the test.
- Passing isn't the same as helping. A pass means the held-out test went green. It doesn't tell you how long the review took. Note that next to the result.
I covered the grader side of this in 5 Ways the Evals Might Be Lying, and the basic 10-case set for app agents in Build a 10-Case Eval Set for Your AI Agent.
Checklist
- Pick 10 to 20 past fixes whose commit added a test.
- Write each prompt like the original bug report, with no hints from the fix.
- Check that the fix commit passes and its parent fails.
- Run each task in a fresh snapshot without
.git. - Hold the tests out and restore them before checking.
- Copy in the config you're testing.
- Compare per task, not just the total.
- Re-run anything that flipped before you believe it.
Where to go next
The free AI Agent Evaluation QuickStart covers the core loop in 5 pages: why agents break traditional testing, Define > Measure > Test > Trust, defining what "good" means, building a small test set (ten real cases to start), choosing programmatic or judgment metrics, and testing on every change.
For the full picture, AI Agent Evaluation & Testing: The Complete Guide goes deeper on LLM-as-judge, evaluating multi-step agents and tool use, regression testing and CI gates, tracing, and a worked support-agent example, in 40 pages.
If you ran this on your own repo, what did you find: did the pass rate match how helpful your agent feels?
This article was written with the assistance of AI and reviewed by the author.
Top comments (0)