The Nine Layers of LVD, Explained

Open any codebase that has been alive for five years and ask which files changed last week. It is never a random sample. Login screens, prompts and pricing rules churn constantly, while the type definitions at the bottom of the repository barely move. Layered Volatility Decomposition takes that pattern seriously and turns it into nine layers, ordered from the most stable code in a system to the least.

One question, nine answers

LVD asks a single question of every piece of code: how often will this change? The answers are stacked into a ladder. Each rung is a layer, and each layer carries a volatility coefficient, written ν, that runs from 0.3 for Schema up to 1.0 for the UI. Treat the numbers as a ranking rather than a measurement. What matters is the order.

The order has a consequence, and it is the one rule that holds the whole model together. Code may depend on its own layer or on a layer beneath it, never on one above. Fast-moving code leans on slow-moving code. The reverse would force a stable foundation to be rebuilt every time somebody rewords a button label. And because every dependency points downward, the dependency graph cannot contain a cycle, however large the system grows.

L9 UIν 1.0L8 Agentsν 0.97L7 Skillsν 0.95L6 MCP + Authν 0.9L5 API + Authν 0.85L4 Toolsν 0.8L3 Resourcesν 0.6L2 Utilsν 0.4L1 Schemaν 0.3changesoftenchanges dependenciespoint down
The nine layers. Volatility rises toward the top; dependencies flow toward the bottom.

Two layers carry an extra rule of their own, Tools and the UI. We will meet both below.

The foundation: Schema and Utils (L1 and L2)

Schema holds the vocabulary of the system: types, validation rules and the contracts that layers use to talk to each other. It depends on nothing and contains definitions rather than behaviour. Changing a schema means touching every consumer, which is exactly why it sits at the bottom. You want those changes to be rare and deliberate.

// L1: a definition, nothing more
export const LoanSchema = z.object({
  loanId: z.string().uuid(),
  memberId: z.string().uuid(),
  dueDate: z.date(),
});

Utils is where pure functions live. Give one the same inputs and it returns the same output, with no network, no clock and no storage involved. Late-fee arithmetic, date handling and formatting all belong here. These functions change when a business rule changes rather than when infrastructure does, and testing them needs no setup at all.

The membrane: Resources (L3)

Everything that touches the outside world lives in Resources: databases, payment providers, search engines, legacy systems and vendor APIs. Each is wrapped so that the rest of the code sees an interface shaped like your domain instead of theirs. At ν = 0.6 this layer changes more often than the pure code below it, mostly because vendors change on their own schedule. When they do, the damage stays inside one adapter. This is also where retries, circuit breakers and caching belong, so that resilience is written once instead of scattered through the business logic. The payoff shows up on the day a vendor is replaced: you rewrite one adapter, and everything above it carries on as before.

If you want the patterns in detail, start with four patterns that keep external systems at arm's length.

Where the business lives: Tools (L4)

Tools package business logic and orchestration as self-contained operations. Each takes validated input defined in Schema, uses pure calculations from Utils, and delegates anything with side effects to Resources. Think of a tool as the unit that an API route or an agent can call: renew a loan, reserve a title, waive a fee. At ν = 0.8 this is where the product team spends its week.

The layer has one rule that no other layer shares: Axiom A5 says a tool may never depend on another tool. It looks strict until you count what sideways imports cost. They create cycles the moment two tools need each other, they spread every change across more files than it should touch, and they make a unit test drag in half the layer. When two tools seem to need one another, the shared part moves down, or the workflow is orchestrated from above. The reasoning behind this is unpacked in why tools must never depend on each other.

The doors: API and MCP (L5 and L6)

API + Auth (ν = 0.85) is the layer that adapts tools to a wire protocol. REST, GraphQL and gRPC interfaces live here, together with an authentication and authorization sublayer that decides who may call what. The layer translates; it should not decide anything about the business.

MCP + Auth (ν = 0.9) does a similar job for AI models. The Model Context Protocol gives models a standard way to discover and call tools, and this layer is where a system exposes them, with its own answer to the question of who is asking. Both layers sit above Tools because protocols and AI capabilities evolve faster than the business rules underneath them.

The AI-facing layers: Skills and Agents (L7 and L8)

Once agents enter a system, a new kind of knowledge appears: how and when to use the tools. Skills (ν = 0.95) capture it as documentation that agents consume, and LVD treats that documentation as code: versioned, reviewed and testable, rather than a pile of prompts nobody owns.

Agents (ν = 0.97) sit above skills. An agent decides which tools to call, in what order, to reach a goal. Its instructions and configuration are tuned constantly, which is why it ranks among the most volatile code you own. The second edition places the coefficient at 0.97 rather than 1.0, to leave room for one more layer above it.

The newest layer: the UI (L9)

That extra room is for the screen. The first edition drew the model's boundary just below the interface and treated it as an outside customer of the system. Real projects rarely work that way. The front end sits in the same repository, imports the same type definitions and is edited by the same developers, so the model said nothing about where the fastest-changing code of all should go.

Why above Agents? Follow the dependency rule. A screen that shows an agent's conversation has to understand what the agent emits: its stream of events, the questions it asks before acting, the shapes of the results its tools return. Whatever is built on that contract inherits its churn, and the interface adds its own redesigns and experiments on top. Nothing below has any reason to import a screen.

Axiom A6 then limits what the UI itself may reach. It may use Schema and Utils, plus the published contracts of the API, MCP, Skills and Agents layers: a typed client generated from an OpenAPI description, an MCP tool descriptor, an agent's event types. It may not touch Resources or Tools, and it may not import anyone's implementation. A browser is a device you do not control, so database clients, secrets and business rules have no business shipping to it, and A6 turns that from a review comment into a structural rule.

Three changes, traced through the stack

The easiest way to feel why the order matters is to follow a few changes through an imaginary library-lending system and watch how far each one travels.

A designer wants a friendlier empty state on the loans page. That is a UI change. It touches one folder in the top layer, and nothing beneath it can notice, because nothing beneath it is allowed to know the screen exists. It can ship on a Tuesday afternoon without a second thought.

The payment provider retires an old API version. The pain lands in Resources, in the one adapter that talks to that provider. The tools that charge late fees keep calling the same domain-shaped interface and never learn that anything happened. The change is annoying, but it has a fence around it.

The library introduces a new loan period for DVDs. Now the change reaches Schema, because the definition of a loan itself has moved. Every layer that uses loans has to be revisited, so this is the one to plan carefully, review slowly and roll out with a migration. That is not a flaw. It is the reason Schema is the slowest-moving layer: its changes are the expensive ones, so the architecture arranges for there to be few of them.

Notice the pattern. The further down a change lands, the wider its blast radius, and the further up a layer sits, the more freely it can be changed. LVD simply makes that trade-off explicit and gives every file an address on the scale.

Putting the stack to work

When you are unsure where a piece of code belongs, ask what it depends on and what depends on it. If placing it forces an upward import, either the code is in the wrong layer or it is leaning on the wrong thing. That single check catches most architectural drift long before it turns into a tangle.

The model also asks for the layers to be visible. Give each layer its own top-level folder and the rule becomes something a linter can check on every commit, which is the idea behind the folder-as-layer principle. If you would like the whole ladder on one page to pin beside your monitor, the nine-layer cheat sheet is the short version, and the rules of LVD state the dependency axioms precisely.

The book gives each of these layers a full chapter or more, with formal definitions, patterns and worked examples. This article is the map.

What the book covers

  • Formal definitions of each layer, with its responsibilities and characteristics
  • The anti-patterns to avoid in every layer
  • The full dependency matrix and the proof that it stays acyclic
  • Worked examples of each layer in e-commerce, healthcare and trading systems
  • How LVD maps onto Clean, Hexagonal and Domain-Driven designs