David HatleyAI product engineer

selfheal

When does a hardcoded value earn a design token? Tested on 15 design systems.

Design systems drift. Someone types 48px by hand where a spacing token belongs. Sometimes that is a slip. Sometimes it is a desire path: people keep typing a value the system does not have yet. In Carbon, 48px was typed by hand 14 times across 10 files before $spacing-3xl was added in January 2018. selfheal tests whether a tool can tell a slip from a desire path before the design system team does.

I mined drift fixes and repeated off-scale values from the git history of Carbon, then 14 more design systems. Of 798 drift fixes, 695 typed a value that was already a token's value. For the 103 values genuinely off the scale, the nearest token was the one the human picked 84 times. Nearby code in the same file did not improve that.

The harder question stays open. Of 230 repeated values, 73 became tokens, and 50 of those arrived in batches when a team built or rebuilt its scale. How common a value is ranks future tokens above faded values with an AUC of 0.71 on a design system the model never saw. Git history, such as bursts, authors and survival, adds almost nothing.

On a synthetic version of the whole task, the best coding agents already beat my purpose-built model: 96.9% and 91.4% against 89.7%. I wrote both the benchmark and the model, so the benchmark flatters the model. The mined history is the headline, not this.

Every number in the film is listed with its source and recomputed by a script in the repo. A hand check of 20 mined Carbon labels found 4 wrong, all of a type the drift-fix counts leave out.