


Debate the source of truth for design systems, and you’ll notice that engineers answer fast. The codebase. To them, it was settled years ago: The system is whatever the code says, because the code is what runs.
We designers are still arguing, and now with AI in the mix, the debate has really intensified. Figma? A docs site? Other tools?
I side with the engineer, then spend the rest of the meeting explaining why "the source of truth is code" didn’t mean what they thought it did. The source of truth lives as code, but that doesn’t mean whatever's implemented is automatically the source of truth. There’s a nuance: code can mean two different things.
One is the running implementation: the compiled components, the app in front of a user. That’s a claim about what the system does, and it can be wrong. The other is the files in your repo. More on that in a second.
A Product Requirements Document (PRD) is never complete. It answers the questions someone thought to ask. The engineer building it hits those unanswered ones — the edge cases, the states, the naming — all while racing a sprint deadline. So they decide. Quietly, locally, in the moment.
The system drifts from gaps filled in the moment, just to keep things moving.
A decision is either recorded or implicit, and that’s a property of the decision. The debate had been a fight over real estate when the thing that actually mattered was state and access.

So when I say the source of truth lives in code, I mean raw folders and files under version control. Files earn that role through what they let you do: diff them, review them before they land, trace who changed what, and expose them in whatever shape the reader needs: a docs page for a designer, an endpoint for an agent, a schema for a linter. The repo is plumbing. What matters is what you run through it.
Decisions, and their contracts.
For decisions, I adopted the ADR — the Architecture Decision Record — borrowed from the engineers who’ve used them for over a decade. The rule is simple and severe. A decision, once accepted, becomes a law. You don’t edit it. You supersede it with a new one, or you deprecate it.

This severity buys traceability. You can read why the system is shaped the way it is by walking the chain, including any laws you’ve repealed.
I have a record in my current system that recommends keeping the upstream library's prefix and never renaming it. We then decided the opposite. We forked it and renamed the whole surface. The record that argued against the fork is still there, marked superseded and linked to the one that overruled it. Anyone wondering why we carry a fork can read the exact moment it flipped and the cost analysis that flipped it. None of that reasoning is lost, because nothing was overwritten.
The law has a maturity gate, too. Before a first release, there’s nothing downstream to protect, so decisions stay molten and I edit them in place. Immutability switches on when consumers depend on stability, the same way an API version does.

An ADR drags a decision you’d otherwise make silently out into the open, before any implementation exists. A private, scattered choice becomes a public, central, traceable one. That’s the mechanism. The rest is bookkeeping.
Decisions shape what, how, and why we build on the design system. To enforce a decision, you need an artifact. I call these contracts: anything you can validate against and audit with.
Contracts differ along two axes: how much they leave to interpretation, and who enforces them and when.
A structural contract defines the shape everything else gets measured against. It defines what good looks like. I keep a schema every component's metadata file has to match, field for field, checked by a validator that fails the build on drift.
A generative contract (like an agent skill) written from design and engineering needs owns the moment code gets written. A scaffold routine an agent runs emits a component that already conforms: arrow functions, named exports, token-based CSS modules, metadata in the required shape, tests colocated. Nothing has drifted because no version ever did. A slightly looser generative contract can enforce more than a strict rule that only fires after the violation ships, because it prevents the mistake instead of detecting it.
A detective contract catches what slipped through. A token auditor skill scans CSS for hardcoded values and reports each one against the token it should have used. The mistake still gets written. It just doesn’t get to pass.
An advisory contract guides a judgment a machine shouldn’t make alone: a CONTRIBUTING file with the release ritual, a composer skill that reads metadata and suggests which components to reach for. These live as prose or an agent skill because a person or a model still has to interpret them.
Determinism is only half the instruction. It decides how much a machine can check instead of a human having to trust it. The other half is home: a schema and a script for a linter, a skill for an agent, a README and a CONTRIBUTING for a person. One of my records decides that component lifecycle status has to be machine-readable data instead of a note on a docs site. So a lint rule, a CI gate, and an agent all read the same field. Written as prose, that decision is worth little. Written as a value something can enforce, it’s worth a lot.

The record and the contract stay separate on purpose. The ADR states the decision and links its contracts. It doesn’t inline them. The decision "one brand-agnostic primitive palette is the source of truth" is stable. The palette, the per-brand deltas, and the build script that generates them all move constantly and live with the code as linked contracts. Keeping them apart is what lets an accepted decision hold still while its implementation churns underneath it. Until the decision needs to evolve.
Figma renders half-truths, some quick examples; margin doesn’t exist, and while we can set line height as percentage values, variables don’t support it. Raise the complexity, and it gets worse: lots of super important props can live just as code.
Code Connect tries to solve this, but we can have a simpler setup: I keep a JSON map between token files and Figma variables, where the token files are canonical, and any Figma variable with no matching token reads as drift. The design tool holds what it can. The same approach also works for components. We match by existence, with code as source.
A documentation site holds prose, a soft contract. It doesn’t break stuff as it drifts. In my system, the CI pipeline (re)generates documentation automatically, so at least the prose can’t fall too far behind.
The engineer's answer, the codebase (as in what’s implemented or what renders on the browser), gets closer than either It’s version-controlled, diffable, reviewable. But it still points at the wrong layer: Implementation is downstream. The record and the contract are what it should answer to.
All of this got more urgent when agents started consuming the system.
An agent reading an implementation full of silent decisions just reproduces the silence. It can’t tell which choices in the code were deliberate and which were a guess. Give it encoded decisions and deterministic contracts instead, and you can hold it to them.

One of my records exists only because an agent reading a component registry will happily reach for a deprecated component if nothing in the data tells it not to. The fix was to make reliability a field the agent reads, not a convention it was meant to absorb.
AI raised the price of an implicit decision and the payoff of an encoded one, both at once. A human inheriting your gaps will at least ask around.
The real question is whether you write your decisions down in a way that can be enforced, or leave them scattered through an implementation, waiting to be rediscovered.
A design system is its contracts. Contracts are the artifacts of decisions. Put the decisions and their contracts in a repo, give each one a law and a shape, and let the implementation answer to them.

For me, that’s what "code is the source of truth" was always supposed to mean. It’s the opposite of "the codebase is always right."
If you want to see an example of how this all fits together, check out this public template. It has all the systems in place. It’s not very stable yet and still evolving, but it’s a good starting point for you to dig into contract-driven design systems.
