As the context grew, did karasu get better?

  • #ai
  • #adr
  • #context-engineering
  • #karasu
Stacked bars of violations by cause for 25 runs each under the April, July, and November records: 86, 50, and 42 in total, with most of April's against decisions not written yet. Of 66 violations of written decisions, only 5 were real breaks; the largest group was unclear scope at 29

In a piece back in July, I wrote that I believed context raised the quality of a system, and that I held no evidence for it. I picked out which quality characteristics to measure, and closed with “When I have results, I will write again.” These are the results.

The subject is karasu. In the eight months since I started it in March, it has collected 497 ADRs1, 192 TPL entries2, and 21 rule files for the agent (.claude/rules). Did all that growth make karasu better?

Summary

  1. Written decisions were almost always followed. Across 75 runs, the agent broke a decision that was in the record and clearly applied only 5 times.
  2. Quality moved in one place: functional appropriateness (violations of ADRs and rules) under the April record. Of the 86 April violations, 75 were against decisions that either had not been written yet or said something different back then. Functional correctness, functional completeness, and security did not move.
  3. The growth from July to November did not show up in the violation counts. Over that span, ADRs went from 289 to 497 and TPL entries from 94 to 192.
  4. Most of the violations that remained at every point came from decisions that do not say how far they reach. Defining what counts as a violation is part of an ADR’s job, but I did not see the gap until I went back and looked.

The evaluation I designed in July

In July I decided to measure the three quality characteristics from ISO/IEC 25010 that documents should guard.

  • Functional appropriateness: the number of places that contradict a relevant ADR or rule
  • Functional completeness: the number of perspectives missed, checked against the TPL
  • Security: whether a risk we had already rejected came back in

Functional correctness (do the tests pass) was the negative control. Tests guard that territory, so changing the documents should not move it.

In July, the plan was to compare against a repository with the records stripped out. This time I changed that and rolled the record back to versions that actually existed. I had tried stripping before, and it made no difference. The decisions were stored in more places than the ADRs (code comments, the specs, Git history), so they leaked through anyway. Rolling back changes the question from “does the agent suffer without the record” to “did the output get better as the record grew to its current size.” That is closer to what I wanted to know about eight months of building karasu.

Rolling back only the record

I fixed the code at its November 12 version and swapped only the record for its version at three points in time. By “the record” I mean 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 karasu issues, plus one mechanical issue with almost no room for judgment (the negative control). Each run went from design through implementation. Of the four, the focus canvas (#3031) had already been implemented by the time of the experiment, so for that one I fixed the code at the version just before the implementation and moved the third point back to early October to match. The agent was headless Claude Code with the model fixed to Claude Opus 5.5. Five requests × three points × five trials made 75 runs, at a cost of $315.

The answer key was built from what karasu knows today: for each request, the ADRs, TPL entries, and rules that apply. Two models did the scoring, with the point in time hidden and the runs shuffled. The main judge, Claude Sonnet 5.5, scored all 75 runs. The second, Claude Fable 5.2, scored two runs per condition, and the two agreed at κ = 0.51 to 0.60.

The measures against leaks (cutting the history, rewriting code comments, keeping the agent off GitHub) and the story of a second experiment I dropped partway will go in a separate piece. Here I only list the limits.

  • The blinding is imperfect. The judge can guess the point in time from the filenames of ADRs the agent wrote (the April record numbers ADRs by date)
  • The answer key reflects today’s knowledge, so older points get counted against decisions that had not been written yet. The next sections sort these out one by one
  • Five runs per condition show direction, not effect size
  • The violation review was done by Opus 5.5 (the same model as the agent). I ruled on only the 7 cases in #3655. I did not do the spot-check scoring by hand that I planned in July
  • Only the agent’s path was measured. Effects that run through tests written from the TPL or through human review are not included

Results by quality characteristic

On functional correctness, every one of the 75 runs passed the checks that passed on the original code (type checks, lint, tests). That is what a negative control should do. Functional completeness (perspectives missed from the TPL) showed no difference between points either, and both judges found zero security risks.

Only functional appropriateness moved. Here are the average violations per run (Sonnet’s scores).

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 value range for style strings (negative control) 0.8 0 0

April was the worst for all five. The clearest difference was #3179 (a permutation test gives p = 0.008 between April and July). #3031 leaned the same way at around p = 0.08, #3655 showed a difference only between April and November at p = 0.04, and #3280 showed none. Between July and the third point, no request showed a difference.

That bothered me. From July to November, more than 200 ADRs and nearly 100 TPL entries were added. None of that shows up in the violation counts (#3655 dropped from 2.4 to 1.0, but not by enough to call it a difference). Between April and July, on the other hand, the TPL arrived (it had zero entries in April), along with the UI and testing rules I added from May on. Maybe April was worse not because the record was small, but because specific decisions were missing. I decided to look at the violations one by one.

What the April violations were

First, for each item the judge marked as violated, I checked whether that ADR or rule file existed in the record at that point. Of the 86 April violations, 64 were against decisions that were not in the April record yet. In #3179, for example, they include the decision to use shadcn components (ADR-1368) and the rule against fireEvent in tests. All of the April violations in the negative control #3613 were against the changeset rule, which also did not exist in April yet. An agent has no way to know a decision nobody has written.

The rest, where the file did exist, add up to 66 across all three points. I checked each against what that version of the file said at the time, the judge’s reasoning, and the actual implementation, and sorted them.

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 (the file existed but said something else) 11 3 5 19
Judge misread 3 4 6 13
Actually broke it 0 1 4 5

The typical “not a violation under that version” case is the UI rule. In April it was a rule about toolbar buttons, and the agent did what it said and used the toolbar-btn class. Today it says “buttons use shadcn Button,” so against today’s answer key it looks like a violation. The early-October version of the acceptance-test rule said manual checks should point at the production URL, and the agent wrote them that way. A later ADR reversed that rule.

Adding these in, 75 of the 86 April violations were against decisions that either had not been written yet or said something different then. Across the 75 runs, the agent actually broke a decision 5 times (hardcoded z-index values 3, the button component 1, a missing guard in a check 1).

The agent did not start following decisions better as the record grew. What was written was followed almost every time, under the April record and the November record alike. What changed was what was written. As far as this experiment can show, nearly all of the record’s effect ran through one thing: the decision being written down.

The violations that remain at every point

Even so, violations do not go to zero. Under the July and third-point records, about two violations per run remain on average. In the table above, the biggest group is not the 5 actual breaks but the 29 cases of unclear scope.

The ADR marked as violated most often was ADR-607. It says the detail panel state lives in one place, so two panels never show at once. In the focus canvas request (#3031), 13 of 15 runs were judged to violate it. The agent kept the focus canvas in its own state, separate from the detail panel, and closed the detail panel by hand when the canvas opened. The implementation that actually shipped (#3055) has the same shape. ADR-607 has not been amended since.

The detail panel and the focus canvas play different roles, so I had assumed there could be times they are shown side by side. I had not imagined the focus canvas would collide with ADR-607. The agent and the shipped implementation read the focus canvas as something other than a detail panel. The judge read it as the same kind of panel. ADR-607 does not say how far it reaches.

The same pattern showed up 9 times with the dialog rule. The rule asks for shadcn Dialog in modal dialogs, and the focus canvas is not modal. The actual code even has a comment saying it does not use Radix Dialog because that is for modal dialogs. The judge applied the rule broadly, to the letter, while the agent and the shipped implementation read it narrowly.

There is one more case I filed as a judge misread. In #3655, 10 runs under the July and November records rejected <-> with a new error; until then, <-> had been silently accepted as ->. The judge held this against ADR-2124 (“state it in the changeset when the language version changes”) and marked 6 of them as violations. My ruling is that <-> was never in the spec and was never meant to be accepted. Rejecting it fixes a gap in the spec and is not a change in the language version. I had not even imagined that <-> was getting through.

Still, of the 10 runs that made the same change, the judge did not mark the other 4 as violations. Neither ADR-2124 nor ADR-2677, which set out what language 2.0 contains, says how to treat input that is outside the spec but was being accepted. Where a language change ends and a diagnostics change begins is scattered 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 boundary being unwritten probably had something to do with it.

Defining what counts as a violation is part of an ADR’s job too. ADR-607 and the dialog rule both state the decision, but not how far it reaches. And in everyday development, an unstated scope causes no trouble, because the agent and I were reading it the same narrow way. The gaps only became visible when a reader showed up, like the judge, who reads everything broadly and to the letter. I would not have left either gap alone if I had known about it. The real question is how to notice a mismatch I never imagined. This time I found these only because I happened to spend time looking back.

Takeaways

At the end of the July piece, I wrote that I had not measured quality yet. Having measured it, I can’t say quality rises as the record grows. Appropriateness was worse under the April record because the decisions had not been written yet. What was added from July to November does not show up in the violation counts.

What I found instead is that written decisions were followed almost every time, under every version of the record. 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.

Most of what remained was unclear scope. A decision where the judge and the implementation read things differently is a candidate for one with no stated scope. That looks usable as a way to notice gaps without waiting for a look back. I’ll start by writing down how far ADR-607 and the dialog rule reach (karasu#3932).

Feedback and questions are welcome in the comments on dev.to.

Footnotes

  1. An ADR (Architecture Decision Record) records one design decision and the reasons behind it. I wrote about how karasu uses them in the piece on ADRs in practice. ↩

  2. The test perspective library: failure patterns that could recur, generalized from past bugs and stored one per file. I measured its effect in the TPL piece. ↩