karasu weekly: routing lines to other domains, and measuring what the record is worth

  • #karasu
  • #ai
  • #claude-code
  • #architecture
The entity view before and after the change to lines to ghosts. Before, the line from Coupon in Marketing to Cart cuts diagonally through the Billing frame and the Refund card. After, the same line goes around the frames in horizontal and vertical runs, with hop marks at crossings. Order, Cart and Line item stay in the same place

karasu is a text modeling language for system architecture, inspired by the C4 model. You describe your system in .krs files and karasu draws the views: system, deployment, and team structure. I haven’t written its code by hand; everything goes through Claude Code.

This is the eighth weekly update. It covers changes merged from November 21 to 27. The change that groups ghosts into a frame per domain merged just after midnight on the 21st, but I covered it in last week’s highlight, so it is not counted here.

This week in numbers: 27 PRs merged (14 of them Dependabot) and 2 decisions recorded as ADRs. Both came in ADR-only PRs: one records the design for laying out ghosts, the other records a Dependabot triage. No monthly release this week.

Highlight: routing lines to other domains without moving the diagram’s own lines

karasu’s entity view draws the entities of one domain, plus the entities of other domains they have relations with. The ones from other domains are drawn faded; karasu calls them ghosts. Last week I grouped ghosts into a frame per domain and placed those frames above and below the domain’s own frame. At the time I wrote that “the lines to ghosts are still straight.” This is the follow-up.

Left straight, a line runs through cards, domain frames, and frame titles. Here is the view before the change.

The entity view before the change. Four domain frames sit above and below the Ordering frame. The lines to ghosts are still straight and cut diagonally through other cards and frames

This week, lines to ghosts are routed by the same machinery as the rest of the diagram. The routing runs in two phases, though. First, the domain’s own lines are routed exactly as they would be with no ghosts. Then the lines to ghosts take the ports and corridors that are left. The second phase does not move any line the first phase placed. The same view now looks like this.

The entity view after the change. Lines to ghosts bend horizontally and vertically around frames and cards, with hop marks where they cross other lines. The cards and lines inside the Ordering frame sit where they did before

Because of the two phases, adding ghosts leaves the domain’s own cards and lines where they would be without them. I picked this approach from the design options.

I measured the 82 entity views with ghosts in the reverse-engineered models of Dify, Twenty, and WordPress.

Before After
Ghost line segments crossing a card 5,588 30
Lines crossing a ghost frame that holds neither end 2,182 10
Views outside an aspect ratio of 16:9 to 9:16 0 0

Views without ghosts render byte-for-byte the same as before.

Deciding that later lines may not move earlier ones pushes the cost onto the later lines. That cost turned into three issues the same week. All three came out of this change, and none of them reached a released version.

  • A two-way pair split back into two lines. karasu draws the two lines running back and forth between two cards as one line, split near the middle. The split point has to stay 14px away from any crossing. When a ghost line crossed near the middle, no point 14px clear could be found, and the pair went back to two lines. Now, only when the 14px search finds nothing, it searches again with the clearance from ghost lines alone reduced to the radius of a hop mark.
  • Ghost lines ran through the text of edge labels. In the “after” view above, the “ships to” line from Order to Address still runs through the “has” label. Once the ghost lines are routed, a stretch that runs through a label now moves to the next lane over. Across the 82 views, stretches through a label went from 518 to 408. Of those left, 71 are on straight lines, which have no stretch to move.
  • The acceptance test said “routed orthogonally,” but diagonal straight lines remained. I built a throwaway branch that always routes orthogonally and compared the two. The service view gained crossings and hops, so I kept the current rule and fixed the acceptance test’s wording instead. The current rule: a line stays straight if nothing is in its way, and a routed line runs only horizontally and vertically. The diagram’s own lines follow the same rule. An automated test now guards it.

The ghost layout design was promoted to an ADR, together with the decision to route in two phases. That ADR lists these three as limits that remained at the time of promotion.

Building with agents this week

Every week, this update counts the decisions recorded as ADRs. Since I started karasu in March, it has collected 497 ADRs and 192 TPL entries1. Did that growing record make the changes the agent produces any better? I wrote up the results in As the context grew, did karasu get better?

I held the code fixed and swapped only the record for its versions from April, July, and November. I gave Claude Code the same 5 issues 5 times at each point, 75 runs in total, and had two models grade the output. It cost $315.

I found four things.

  • 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.
  • Quality moved in one place only: 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.
  • 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.
  • Most of the violations that remained at every point came from decisions that do not say how far they reach.

I can’t say that quality rises as the record grows. What mattered was whether the decisions a new change touches are written down, and whether they say how far they reach. Two decisions turned out not to say so: ADR-607, which keeps the detail panel from showing two at once, and the dialog rule. I’m starting by writing down how far those two reach (karasu#3932).

Other changes this week

Pages Functions are now a security boundary. In karasu, the paths a PR touches decide its risk tier. Permalinks and image export on karasu.kompiro.dev are served by Cloudflare Pages Functions. Until now those functions were outside the boundary, so a change to them was classified Medium. It started when a change that lets an untrusted value reach the SVG came out as Medium, and I raised it to High by hand. I added functions/** and the modules they call to the boundary, plus a test that fails when a function directly imports a module outside it. That test rebuilt its import resolution three times. With a regular expression, review kept finding forms it misread. madge could not follow imports built at runtime. With a hand-written resolver, review kept finding differences from esbuild, the bundler used in production. In the end, resolution is left to esbuild itself. Local review raised 47 findings, and CodeRabbit went 6 rounds.

The share URL limit is now exposed only as a judgement, not a number. A model carried in a share URL is limited to 8,000 characters. The module no longer exports that number; it exports only a check for whether a model fits, and an error message that names the limit. This keeps code elsewhere from taking the number and comparing against it on its own. A test checks that the module exports no number at all. Along with this, the permalink error messages moved into the i18n catalog. The Pages Function bundle grew from 415 KB to 542 KB.

--auto is gone from the Low PR procedure. This is the first step of the last stage I mentioned in last week’s “Coming next”: moving Low PR merges to a workflow. Opening a PR with risk: low is now the request to merge it. The session only waits for the merge; if the workflow does not merge, it reports to me instead of falling back to --auto. Review of the PR that rewrote the procedure found a bug: --jq prints null as an empty line, so the procedure read auto-merge as “enabled” even when it was off. Turning off the repository’s auto-merge waits on a change in hane.

I triaged 17 Dependabot updates and took 16. Two could not go in as they were. For dompurify, an override in pnpm-workspace.yaml replaced the app’s declaration. With only Dependabot’s PR, the effective range still overlapped an upstream vulnerability (below 3.4.18). karasu doesn’t use the option that vulnerability needs, but I raised the declaration and the override’s floor together. @babel/parser 8 changed the shape of the syntax tree that the Pages Functions test above reads, so I fixed the test before taking it. Separately, between analysis and merge, Dependabot’s rebases moved three PRs past the versions I had analysed. Each was analysed again before it went in. The one I didn’t take is @types/vscode, which would go past the highest Visual Studio Code version the extension’s E2E tests support.

Coming next

  • On November 29, I plan to ship the monthly release train with staged publishing for the first time.
  • Turn off the repository’s auto-merge and finish moving Low PR merges to the workflow.
  • Write down how far ADR-607 and the dialog rule reach (karasu#3932).
  • Write a separate post on how I measured what the record is worth (keeping knowledge from leaking in, and an experiment I abandoned).

Footnotes

  1. The test perspective library: failure patterns that could recur, generalized from past bugs and stored one per file. ↩