Fourteen small bug fixes, three instruction conditions, one failure that only showed up once I added rules.
I gave a coding agent fourteen tiny, broken Python functions and asked it to fix each one three times: once with no repository instructions at all, once with a short ten-line style guide, and once with a hundred-and-fifty-line "engineering standards" document covering the exact same ground. With zero instructions, it fixed all fourteen. With either instruction file, concise or verbose, it fixed thirteen. The one it dropped is the interesting part. Given no instructions, the model wrote a clean, correct fix from scratch. Given instructions that said nothing about this specific bug, it instead rewrote the buggy function's broken logic almost unchanged, just with an extra method chained on front. The instructions did not cause the bug. They changed how the model looked at the existing code, and that was enough.
I wrote this with AI assistance, and I fact-checked and edited every claim myself.
What I actually ran: 14 self-contained Python bug-fix tasks, 3 instruction conditions, 1 completion per task per condition, 42 completions total, one run, no repeated trials per cell. Model: llama3.1:8b running locally via Ollama, for 41 of 42 completions, free and zero cost. One completion (the first "no instructions" task) was served by Gemini's free tier before it hit a rate limit and the fallback chain dropped to the local model for the rest of the run. Grading was never done by eye or by asking a model to judge itself. Every candidate fix was extracted from the raw response and run against a real pytest file in an isolated subprocess; a pass means pytest actually exited zero. Every one of the 42 raw completions, every pytest log, and the two instruction files themselves are in coding-agent-instructions-experiment (Reproducibility section below).
TL;DR
- With no instructions, the model fixed 14 of 14 bugs. With a concise instruction file, 13 of 14. With a long, verbose instruction file covering the same substance, also 13 of 14.
- Both instruction conditions failed on the same task, and failed in the same way: they reproduced the original buggy function's flawed string-cleaning logic almost verbatim instead of writing a correct one from scratch.
- Neither instruction file actually named this bug's failure mode. The concise file covered three pitfalls, the long file covered seven; a string-method mixup wasn't one of them.
- One task flipping out of fourteen is not a statistically solid effect on its own. What it does show, concretely and reproducibly on this run, is that instructions aren't free: they can pull a model's attention toward the code already in front of it, for better or worse, even when the task is one they weren't written for.
- This is consistent with a pattern I found in an earlier experiment in this series: when a model is shown its own flawed code, it sometimes anchors on that code's structure instead of reasoning past it.
The question I actually wanted answered
Repository instruction files like CLAUDE.md or AGENTS.md have become a default move for anyone running a coding agent against a real codebase. The implicit bet is that more context about conventions and known pitfalls produces more reliable fixes. I wanted to test a narrower, falsifiable version of that bet: does prepending a repository instruction file change a coding agent's pass rate on small, self-contained bug-fix tasks, compared to giving it no instructions at all, and does making that file longer and more thorough change the answer?
Method
I wrote 14 small Python functions, each with exactly one real bug drawn from a different family: off-by-one range bounds, a mutable default argument, the wrong exception type, an unstable sort key, accidental mutation of an input list, a missing dict default, a wrong recursion base case, a string-method mixup, a missing empty-input guard, a wrong boolean condition, an off-by-one slice, and an accumulator that overwrites instead of adding. Each task ships with its own pytest file that fails against the buggy version and passes against a correct fix. I verified all 14 bugs are real by running the buggy code against its own test before touching a model at all; every one failed as expected.
Each task went to the model three times, under three conditions:
# None: just the task + buggy code, nothing else prepended
# Concise: a ~10-line instructions_concise.md prepended, covering
# output format and 3 of the 14 bug families
# Long: a ~150-line instructions_long.md prepended, covering the
# same substance as the concise file plus 4 more bug families,
# wrapped in philosophy and process sections
The prompt always ended with the same instruction: return only the corrected function, as a single code block. I extracted the first fenced code block from the response (or the raw text if there was no fence), wrote it to an isolated temp directory next to that task's real pytest file, and ran python3 -m pytest in a subprocess with a 20-second timeout. A pass requires pytest to exit zero. Nothing was graded by a model, and nothing was graded by me reading the output and deciding it looked right.
Results

Pass rate by instruction condition, 14 bug-fix tasks, one completion per task per condition. Image by author.
None: 14/14 (100%). Concise: 13/14 (92.9%). Long: 13/14 (92.9%).
That is the entire headline number, and I want to be direct about what it does and doesn't support. With one trial per task per condition, a single task flipping from pass to fail is the whole effect. That is not enough data to claim instructions reliably hurt pass rate in general. What it is enough data for, because it is a real, inspectable example from an actual run, is showing one specific way instructions can fail to help, or actively redirect a model's attention somewhere unhelpful, on a task they weren't written to cover.
The task both instruction conditions failed was string_strip_bug: write clean_username(name) to lowercase a username and strip only the leading and trailing whitespace, not the spaces inside it. The buggy version used .replace(' ', ''), which strips every space, not just the edges. Given no instructions, the model wrote name.lower().strip(), a clean, correct answer that doesn't resemble the buggy version's approach at all. Given either instruction file, it wrote name.strip().lower().replace(' ', ''), which adds a .strip() call but keeps the exact broken .replace() call from the original buggy code, and fails the same test the buggy version failed.
Neither instruction file mentions this bug family. The concise file names three pitfalls (off-by-one ranges, mutable defaults, wrong exception types); the long file names seven, adding accidental mutation, dict key errors, accumulator scoping, and rounding or empty-input edge cases. A string-method mixup isn't on either list. So this wasn't a case of the instructions actively misleading the model about this specific bug. It was a case of the model, once given a document full of rules to apply, appearing to lean more heavily on the existing buggy code's structure rather than writing past it, even on a bug the rules never addressed.
Failure analysis
Going in, I expected one of two outcomes: either the instruction files would measurably raise the pass rate by flagging the exact pitfalls present in the task set, or they would make no difference because the tasks were simple enough that a capable model would get them right regardless. I did not expect a case where adding instructions made the model worse on a task those instructions didn't even cover.
The evidence that changed my assumption is sitting right there in the raw response diff. Without instructions, the model's fix bears no resemblance to the bug it's replacing: full rewrite, correct idiom, no trace of the original approach. With instructions present, in this one case, the model's fix is the original buggy line plus one small patch bolted onto the front. That is a shape I recognize from an earlier article in this series, where I showed a model its own failing code and its retry attempts sometimes reproduced the same bug rather than reasoning past it. Here, nobody showed the model its own prior failure. The instruction file alone was enough to shift it from "write a fresh answer" to "patch what's already there."
What I changed after seeing this: nothing in the experiment design, because the honest result is the result. What I'd change in a follow-up: more trials per cell so a single flipped task isn't the entire signal, and a task set deliberately including a few bugs the instruction file explicitly warns against, to separate "instructions that name the exact pitfall" from "instructions in general."
Practical decision framework
- If your repository instructions name the exact pitfalls your codebase actually produces, this experiment doesn't argue against having them: none of the 14 bugs here were ones the files specifically warned about, so this says nothing about that case.
- If your instruction file is long enough that most of it is generic process philosophy rather than named, specific pitfalls, don't assume the length itself is buying you anything. On this run, the 150-line file performed identically to the 10-line file covering the same substance, not better.
- Don't assume more context is a free lunch. A coding agent reading your conventions doc is also, demonstrably in at least one case here, more likely to anchor on the exact code already in front of it instead of reconsidering the approach. If a fix looks suspiciously close to the bug it's supposed to replace, that is worth a second look regardless of how thorough your instructions were.
- Keep the loop closed: a deterministic test is still the only grading method I'd trust here. Nothing about this result would have been visible from reading the model's output and deciding it looked fine.
Reproducibility
Every task, both instruction files, all 42 raw completions, the pytest logs, and the chart above are in coding-agent-instructions-experiment, part of my consolidated Medium reproducibility repo. Clone it, run python3 run_experiment.py with Ollama serving llama3.1:8b locally, and you'll get a free, zero-cost run of your own. It won't be byte-identical to mine; this model isn't pinned to a fixed seed. It should reproduce the general shape: a model that handles the bulk of small bug-fix tasks cleanly regardless of instructions, and occasional cases where instructions change the model's relationship to the existing code in ways a pass/fail count alone won't tell you about until you read the diff.
If you run this against your own repository's actual instructions file, the question worth asking isn't "does this help on average." It's: does your instruction file name the specific pitfalls your codebase actually produces, or is it mostly process philosophy that a model has to wade through to find the three lines that matter? On this run, that distinction was the whole difference between a file that could plausibly help and one that didn't.
If you've pasted your own CLAUDE.md or AGENTS.md back into a model and asked it to grade which lines are actually pulling weight on your real bug history, what did it keep, and what did it throw out?
Top comments (0)