DEV Community

Cover image for Your Coding Agent Follows What You Wrote Down. What It Misses Is Scope
Hiroki Kondo
Hiroki Kondo

Posted on Edited on Originally published at fukurou.kompiro.dev

Your Coding Agent Follows What You Wrote Down. What It Misses Is Scope

In karasu, the architecture-diagram tool I develop with Claude Code, I keep design decisions as ADRs (Architecture Decision Records), failure patterns as a test perspective library (TPL), and coding rules for the agent under .claude/rules.
In the eight months since March, that record has grown to 497 ADRs, 192 TPL entries, and 21 rule files.

In July I designed an evaluation to check whether all this context actually raises quality, and promised to write again when I had results.
This time I ran it: I kept the code fixed, rolled only the record back to its April and July versions, and gave a coding agent the same issues 75 times.

What I learned

  1. Write down the decisions a change will step on. Volume alone does not help. The agent followed written decisions almost every time: across 75 runs it broke a decision that was in the record and clearly applied only 5 times. Most violations were against decisions that had not been written yet. Meanwhile, the record growing from 289 to 497 ADRs between July and November did not show up in the violation counts.
  2. Write how far each decision reaches. Most of the violations that remained at every point were not the agent ignoring a decision. The decision never said what it covered, so the agent read it narrowly and the reviewer read it broadly. The agent and I happened to read these the same narrow way, so the gap never caused trouble in day-to-day work.
  3. Treat disagreement between readers as a sign of a missing scope. When the reviewer and the implementation read the same decision differently, that decision is a candidate for one with no stated scope. I found these only by looking back; I'm going to try using the disagreement to find them sooner.

How I measured

I fixed karasu's code at its November 12 version and swapped only the record for its version at three points.
"The record" here is the ADRs, the TPL, .claude/rules, CLAUDE.md, and the documents that describe how development proceeds.

Point ADRs TPL rules
April 30 140 0 6
July 31 289 94 11
November 12 497 192 21

The requests were four real karasu issues plus one mechanical issue as a negative control, each run from design through implementation with headless Claude Code on Claude Opus 5.5.
Five requests × three points × five trials made 75 runs, at a cost of $315.

Scoring used the quality characteristics from ISO/IEC 25010 that documents should guard: functional appropriateness (violations of the relevant ADRs and rules), functional completeness (TPL perspectives missed), and security (rejected risks reintroduced).
Functional correctness (do the tests pass) was the negative control.
Two LLM judges scored the runs blind to the point in time: Claude Sonnet 5.5 on all 75, Claude Fable 5.2 on two per condition (κ = 0.51 to 0.60).
The answer key is what karasu knows today, which matters below.

Written decisions were followed

Correctness, completeness, and security did not move.
Every run passed the checks the original code passed, and neither judge found a security risk.

Only functional appropriateness moved, and only under the April record.
Average violations per run:

Request April July Third point
#3179 collapse the diagnostic banner 3.8 0.8 0.8
#3031 focus canvas 9.2 6.2 6.4
#3655 diagnostics for qualified endpoints 2.8 2.4 1.0
#3280 i18n for translate warnings 0.6 0.6 0.2
#3613 negative control 0.8 0 0

April was the worst for all five, clearly so for #3179 (permutation test, p = 0.008).
From July to the third point, no request showed a difference, even though more than 200 ADRs and nearly 100 TPL entries were added in between.

So I looked at each violation.
Of the 86 April violations, 64 were against decisions that did not exist in the April record yet: the rule to use shadcn components, the rule against fireEvent in tests, the changeset rule.
An agent cannot follow a decision nobody has written.

For the 66 violations (across all three points) where the file did exist, I checked what that version said at the time, the judge's reasoning, and the implementation that actually shipped.

Category April July Third point Total
Unclear scope (the decision does not say how far it reaches) 8 10 11 29
Not a violation under that version 11 3 5 19
Judge misread 3 4 6 13
Actually broke it 0 1 4 5

"Not a violation under that version" means the rule changed later.
The April UI rule was about toolbar buttons, and the agent used the toolbar-btn class exactly as it said; today's rule says to use shadcn Button.

Counting those in, 75 of the 86 April violations were against decisions that had not been written yet or said something different then.
The agent did not get better at following decisions as the record grew.
What changed was what was written.

Write how far a decision reaches

Even under the newer records, about two violations per run remained on average, and the largest group among violations of written decisions was unclear scope.

The ADR marked as violated most often was ADR-607: the detail panel state lives in one place, so two panels never show at once.
The ADR explicitly rejects "close the other panel by hand when opening one."
In the focus canvas request, 13 of 15 runs kept the canvas in its own state and closed the detail panel by hand when it opened.
The implementation that actually shipped has the same shape.

I had seen the detail panel and the focus canvas as different things that might sit side by side, and I never imagined the canvas would collide with ADR-607.
The agent read the canvas as something other than a detail panel.
The judge read it as the same kind of panel.
ADR-607 does not say which reading is right.

The dialog rule showed the same pattern 9 times.
It asks for shadcn Dialog in modal dialogs, and the focus canvas is not modal, but the judge applied the rule to the letter anyway.

The language side had a version of this too.
In #3655, 10 runs added a new error that rejects <->, which had been silently accepted as ->.
The judge held 6 of them against the ADR that says to state language-version changes in the changeset, and let the other 4 pass.
My ruling is that <-> was never in the spec and rejecting it is a bugfix, not a language change; I hadn't even known it was getting through.
But no ADR said how to treat input that is outside the spec yet accepted, and the boundary between a language change and a diagnostics change was spread across five ADRs.
Looking back, when I started on version 2.0 of the syntax after shipping karasu 1.0, it was unclear which version of the syntax the agent was interpreting, and the back-and-forth was a real struggle.
That missing boundary probably had something to do with it.

None of these caused trouble in everyday work, because the agent and I read them the same narrow way.
They became visible only when a reader showed up who reads everything broadly and to the letter.
I would not have left them alone if I had known.

Use disagreement to find missing scope

The question, then, is how to notice a mismatch you never imagined.
This time I found these only because I spent time looking back.

A decision where the judge and the shipped implementation read things differently is a candidate for one with no stated scope.
That looks like a way to find these without waiting for a retrospective, and it is what I'll try next.
I'm starting by writing down how far ADR-607 and the dialog rule reach (karasu#3932).

Limits

  • Five runs per condition show direction, not effect size
  • The blinding is imperfect: the judge can guess the point in time from the filenames of ADRs the agent wrote
  • The violation review was done by Opus 5.5, the same model as the agent; I ruled only on the #3655 cases
  • Only the agent's path was measured, not tests written from the TPL or human review

How I kept the old records from leaking (cutting Git history, rewriting code comments, keeping the agent off GitHub) and the second experiment I dropped will go in a separate piece.

Takeaways

Measured, I can't say quality rises as the record grows.
The record only had an effect through what was written in it.
What decides whether it helps is whether the decisions a new change will step on are written down, and whether they say how far they reach.

The full write-up, with more detail on the setup, is on my blog.

Update (2026-11-30)

A reader asked in the comments where #3932 would put the scope: as explicit boundaries inside each ADR, or as a scope check moved into .claude/rules.
Working out an answer changed how I read the focus canvas case.

The focus canvas isn't a transient display of information like the detail panel.
It's a feature you'd want to show detailed information on top of, the way a detail panel shows it.
Once the focus canvas came in, the app's dialogs and panels needed a notion of layers.
That was missing from the design.

Read in layers, ADR-607 isn't broken.
Only one detail panel shows at a time, and there is only one focus canvas in the app.
The same goes for the dialog rule.
The focus canvas is a separate, non-modal layer, so it falls outside a rule written for modal dialogs.

I no longer think either decision needs its scope written in.
Trying to cover cases nobody had imagined when an ADR was written tends to produce text that never gets used.
This time, where the judge and the implementation read things differently, what it pointed to was not a gap in a decision's scope but a gap in the design of a feature added later.
What matters more, I think, is the design step when a feature is added: look for similar features, and when one turns up, adjust them so they fit together.

I'm rewriting karasu#3932 from an issue about writing scope into ADR-607 and the dialog rule into one about designing layers for the app's dialogs and panels.

Top comments (5)

Collapse
 
dosaygo profile image
dosaygo •

As you rewrite ADR-607 and the dialog rule in karasu#3932, are you adding explicit scope boundaries inside each ADR or moving the scope check into .claude/rules?

Collapse
 
kompiro profile image
Hiroki Kondo •

Thanks for the question. Since writing the post, I've changed my mind about what #3932 should do.

The focus canvas isn't a transient display like the detail panel. It's a surface you'd want to open something like a detail panel on top of. What was missing when it was designed was a notion of layers for the app's overlays, and that gap is in the focus canvas's design, not in ADR-607. Read that way, ADR-607 still holds: only one detail panel shows at a time, and only one focus canvas does.

So I'm not planning to add scope boundaries inside each ADR, or to move a scope check into .claude/rules. An ADR can't cover cases nobody had imagined when it was written, and trying to mostly produces text nobody needs. What matters more is the design step for a new feature: look for similar features that already exist, and when one turns up, adjust them so they fit together.

Collapse
 
dosaygo profile image
dosaygo •

That reading holds up, and your own numbers back it: 5 of 75 runs broke a decision that was written and clearly applied. The agent follows what is on the page. In #3031, 13 of 15 runs gave the canvas its own state and closed the panel by hand, and the shipped code has the same shape, so nobody ran the step you describe at design time. You got there after the post. That step is short enough to write once as a rule the agent reads before it designs: name the existing surface the new one most resembles and say how the two layer, or stop. No ADR has to predict anything.

AI Lint, which we make, is that kind of file: a pre-flight checklist and a set of rejects the agent reads before it writes, one of them Parallel Solutions, a second mechanism built beside one that already does the job. ai-lint.dosaygo.com/go/forum-20261...

Collapse
 
adilbenmoussa profile image
Adil Ben Moussa •

I like that you ran the same issues again with the old records. Nice work, and the numbers are clear.

For me the dialog rule is the interesting part. The rule says "modal", and the judge still used it for the focus canvas. May be a rule also needs a line that says where it does not apply.

Will you run the judge again after you rewrite ADR-607?

Collapse
 
paul_irolla_6b5ae261d0224 profile image
Paul Irolla •

I build Tokenade, and what I see is that a rule with a stated scope is cheaper to carry. I would expect the agent to drop it outside that scope, instead of reading every rule on every task.