Key Takeaways
- A preprint posted to arXiv on October 28, 2026 ran 5,625 trials of four coding agents (two Claude models in Claude Code, two GPT models in Codex CLI) and found they copy the conventions already in a repository over their own defaults in 359 of 360 conflicting trials.
- Where the precedent sits matters more than how much of it there is: three supporting files for the same resource led to 96% adoption, while three files from a sibling resource led to 4%.
- Showing the agent an example of the new convention worked in 38 of 60 runs. Writing the priority down as a rule worked in 59 of 60.
- In four open-source repositories (Python, Go and TypeScript), a rule loaded from the agent's instruction file raised success from 0 of 120 runs to 117 of 120.
- It's version 1 of a preprint, not yet peer reviewed, built mostly on one purpose-built Flask API.
Coding agents follow repository precedent: when the code near your change already does something one way, the agent does it that way too, even when its own default and your new requirement point somewhere else. That's the core finding of "Precedent or Intent?", a study by Haichao Zhu, Geyang Xu and three co-authors, posted to arXiv on October 28, 2026. The fix the data supports is short. If you want a new convention, write it down as a rule that says it takes precedence. Don't just show an example.

What happened
On October 28, 2026, researchers listing affiliations at UC Riverside and Tulane University posted "Precedent or Intent? What Coding Agents Follow When Evolving Existing Code". It asks a question every team using agents runs into: when two implementations both pass the tests, which one does the agent pick, and what makes it switch?
Last week we covered a study showing coding agents follow stale instruction files over the code. This paper looks at the other half of the same problem. When there's no conflicting instruction, the code itself is the instruction.
Why coding agents follow repository precedent
The authors built a Flask "Task Manager" API and picked six choices where both options pass the same hidden tests. Examples include project_id versus projectId, returning "id": 1 versus "id": "1", a flat JSON response versus one wrapped in {"data": ...}, and returning a 404 versus raising NotFound. Tests can't tell these apart, so they show what the agent chose rather than whether it was correct.
They ran four model-and-harness pairs, using the names the paper gives: Claude Sonnet-4-6 and Claude Opus-4-8 through Claude Code, and gpt-5.6-sol and gpt-6-sol through Codex CLI. The study ran 5,625 trials in 375 cells, each repeated in 15 fresh sessions.
The study went in three stages:
- Defaults. With no existing endpoints to copy, all four agents made the same choices, such as integer IDs, flat responses and direct error returns.
- Precedent. When existing code used the opposite convention, agents followed the code in 359 of 360 trials.
- Intent. When the task asked for something new that conflicted with the existing code, the agents needed a written rule to switch.
The details that matter to engineers
Location beats volume
Adoption of a repository's convention rose with the number of supporting files for the same resource: 0% with none, 21% (74 of 359) with one, 49% (175 of 360) with two and 96% (347 of 360) with three. The same three examples in a sibling resource moved almost nothing. Adoption was 4% (13 of 360).
Placement alone could flip the outcome. With gpt-6-sol, moving two ID-serialization examples to a different place changed adoption from 0 of 15 runs to 15 of 15. In the authors' words, "changing file placement alone can shift adoption from 0% to 100% at a fixed example count."
So the convention your users module uses won't reliably carry over to a new billing module. The agent reads the files next to the change.
Rules beat examples
In the third stage, every existing endpoint used the old convention and the task asked for the new one. The researchers tried four kinds of guidance across two agents (Sonnet-4-6 and gpt-6-sol) and two choices, 60 runs each:
| Guidance | Runs that met the new intent |
|---|---|
| None | 0 of 60 |
| Code example of the new convention | 38 of 60 |
| Written priority rule | 59 of 60 |
| Rule and example | 60 of 60 |
Examples alone were the least reliable option, and results varied by agent. Sonnet-4-6 met the string-ID requirement in 0 of 15 runs when it had only an example. The rule that worked was two sentences long: "Serialize task identifiers as strings in the new endpoint. This instruction takes precedence over the ID representations used by existing handlers."
It made no measurable difference whether the rule sat in the task prompt or in the agent's own instruction file (CLAUDE.md or AGENTS.md). Both got 60 of 60. The authors note that with both at the ceiling, this doesn't prove the two channels are equivalent.

The numbers behind it
The authors then checked the findings in four open-source repositories written in Python, Go and TypeScript. Precedent held there too. Agents followed the local style in all 945 working error-handling implementations they could classify, and in 355 of 417 (85%) for response envelopes. With no rule, the agents met the new requirement in 0 of 120 runs. With a rule in the instruction file the harness loads, they met it in 117 of 120.
Put this next to last week's study and the pattern is consistent. In Xu and Wu's preprint, agents followed a stale instruction file in 90.1% of choices when it conflicted with the code. In this one, agents follow the code when nothing written tells them otherwise. Taken together, the two studies suggest an order: a written rule first, nearby code second, and the agent's own defaults last.
What the study doesn't show
- The controlled experiments use one Flask task family, and the open-source check covers two of the six choices.
- Each cell has 15 runs, and model and harness change together, so you can't separate Claude Code from the Claude model.
- It measures which convention the agent picked, not whether the code was better or easier to maintain.
- "Local" and "sibling" also differ in how related the files are to the task, so location isn't the only variable.
What this means for you
If you use Claude Code or Codex daily
- Expect the agent to copy the file next door. If that file uses a pattern you're moving away from, the new code will use it too.
- When you want something different, say so in the prompt and say that it takes precedence over the existing code. One sentence did it in 59 of 60 runs.
- Review which convention the agent chose, not just whether tests pass. In this study, both options passed the same tests.
If you own a team repository
- Put migrations in progress in CLAUDE.md or AGENTS.md as priority rules ("new endpoints return string IDs; this overrides existing handlers"). The paper calls for recording "the rationale and priorities guiding future evolution."
- Don't count on one module's new convention spreading to the rest. Sibling precedent was adopted in 4% of trials.
- Delete the rule once the migration is done. Otherwise you get the stale-file problem from last week's study.
If you write prompts for agent workflows
This fits the move toward designing loops and context instead of one-off prompts. The context that matters most is the code around the change and any rules the harness loads.
How this connects, and how it comes up in interviews
Both October studies support our coverage of context engineering for coding agents on the StackChief AI hub. What's new here is direction. Last week's study showed written instructions can override the code. This one shows the code overrides the agent's defaults and needs a written rule to change.
The same judgment shows up in AI-assisted interview rounds, where you extend an existing codebase with an assistant and the interviewer watches whether you check what it produced. We cover those formats in how coding interviews changed in the age of AI. Reviewers of take-home coding assignments also check whether new code matches the conventions already in the repo.
FAQ
Do coding agents follow existing code over their own defaults?
In this study, yes. When existing code used the opposite convention, the four agents tested followed it in 359 of 360 trials. With three supporting files for the same resource, adoption reached 96%.
How do I get a coding agent to use a new convention in an old codebase?
Write a rule that names the new convention and says it takes precedence over existing code, in the prompt or in CLAUDE.md or AGENTS.md. Rules worked in 59 of 60 runs, and code examples alone in 38 of 60.
Does a convention in one module carry over to other modules?
Rarely. Three examples in a sibling resource led to 4% adoption, compared with 96% for three examples next to the change.
Which coding agents were tested?
The paper names Claude Sonnet-4-6 and Claude Opus-4-8 run through Claude Code, and gpt-5.6-sol and gpt-6-sol run through Codex CLI.
Further Reading
- Zhu et al., "Precedent or Intent? What Coding Agents Follow When Evolving Existing Code" (arXiv:2610.38244): the abstract and PDF.
- Full text (HTML, v1): the experimental design, per-agent tables and limitations.
- Xu and Wu, "Stale Instruction Files Override the Code in Coding Agents" (arXiv:2610.30571): the companion finding on instruction files.
