The Nine-Layer Cheat Sheet

Some references are written to be read once. This one is written to be glanced at. Keep it open when a new file arrives and you cannot decide where it goes: the nine layers of LVD, their volatility coefficients, what each one holds, and the one thing that should never be found there.

The nine layers at a glance

The table runs from the busiest layer at the top to the calmest at the bottom, the same way the layers are usually drawn. The symbol ν is the layer's expected volatility: the higher the number, the more often the code in it is expected to change. Layer names link to their own pages.

LayerNameνWhat lives thereDoes not belong here
L9UI1.0Screens, routes, layouts, reusable components, client-side view state, and the rendering of API, tool and agent resultsBusiness decisions such as eligibility or permissions, or one feature importing another
L8Agents0.97Agent configurations, conversation management, tool selection and chaining, error-recovery strategyDrawing the screen: the agent emits events and the UI renders them
L7Skills0.95Agent-facing documents: when to use a tool, prerequisites, ordered steps, workflows, good practiceExecutable code: a skill is a versioned document
L6MCP + Auth0.9The MCP server, tool definitions and parameter schemas, registration and discovery, agent authenticationA second copy of the business rules: hand the call to a tool
L5API + Auth0.85REST routes, GraphQL resolvers, gRPC services, request validation, authentication, authorization, rate limitingBusiness rules: this layer translates protocols and decides nothing
L4Tools0.8Use cases, orchestration of business logic, workflows, domain operations, transaction boundariesAnother tool (Axiom A5), or protocol details such as HTTP verbs
L3Resources0.6Repositories, external API clients, queue publishers and consumers, third-party adapters, retries and circuit breakersVendor-shaped types leaking out to callers
L2Utils0.4Pure functions: calculations, formatting, date handling, type conversionsSide effects, I/O or hidden state
L1Schema0.3Types, validation schemas, constants, enumerations, shared domain typesBehaviour, mutable state, external dependencies, imports from above

A coefficient describes a layer, not any single file. In the book's definition it is the average of the volatilities of the components inside, so an individual component can sit a little above or below its layer's figure. What the rules rely on is the ordering. The layer chapters run from 5 to 10: Schema and Utils share Chapter 5, Resources and Tools get Chapters 6 and 7 to themselves, the API and MCP layers share Chapter 8, Skills and Agents share Chapter 9, and the UI has Chapter 10.

A feel for the rhythm

Numbers like 0.85 and 0.9 are easier to remember when they are tied to a calendar. In the author's account of how the model took shape, schemas moved rarely and utilities now and then. Vendor integrations shifted about monthly, and business tools were reworked weekly. At the top, the agent configurations were being tuned daily, while screens change whenever a designer has a fresh idea, which can be every sprint.

The protocol layers sit in between for a reason. A REST contract changes when you publish a new version of the API, which brings coordination costs such as deprecation notices and client migrations, so it moves more slowly than a screen. It still moves faster than the business rules it exposes.

The dependency rule in four lines

  • Down is allowed. A component may depend on anything in a lower layer.
  • Up is forbidden. Between two different layers, the arrow must always point strictly downward.
  • Sideways is conditional. Within one layer, components may depend on each other as long as no loop forms. Tools are the exception, under Axiom A5.
  • The UI has its own row. It can reach much less than its position suggests, under Axiom A6.

Every dependency descends or stays put, so a chain of imports can never climb back to where it began. The book proves that LVD architectures are therefore free of cycles, and that adding the ninth layer did not disturb the proof. A5 and A6 only take permissions away, which cannot create a cycle either. For the fuller statement of every rule, see the rules of LVD.

Two of the upper layers carry a footnote worth knowing. Skills reach lower layers only through documentation: they read tool names, parameter definitions and error codes, and they never import or run anything. Agents may draw on every layer from Schema through Skills, but they invoke tools by way of the MCP layer instead of calling them directly.

Placing a file in under a minute

Two bounds do most of the work. Look at everything the file imports and find the highest layer among them: the file has to live at that layer or above. Then look at everything that imports the file and find the lowest layer among those: the file has to live at that layer or below.

If the two bounds leave a gap, let expected change decide. Put the code in the layer whose pace it resembles. If the bounds cross, something is wrong, and either an import reaches too high or the file is doing a job that belongs in another layer. One tiny exception applies: a file that imports a tool cannot itself be a tool.

Three files, placed

Take a library-lending codebase and try the two bounds on three files.

  • lateFee imports only a Loan type and is imported by the renewal operation. Its floor is Schema and its ceiling is Tools. It is arithmetic with no side effects, so it belongs in Utils.
  • renewLoan imports a repository, a date helper and the loan type, and both a REST route and an MCP handler import it. The floor is Resources, the ceiling is API. It carries the business rule, so it is a tool.
  • LoanCard imports the loan type, a formatter and a generated client, and only a page imports it. Nothing below needs it, and its job is presentation, so it lives in the UI.

In each case the answer falls out of the bounds plus a single question about what the file does. Hunting for the right layer starts to feel more like arithmetic than debate.

Six smells that mean a file is in the wrong layer

  1. A type definition that fetches, mutates or remembers anything (Schema).
  2. A formatter or calculator that reads the clock, a file or the network (Utils).
  3. An adapter whose return type is simply the vendor's response (Resources).
  4. A tool that imports another tool (Tools).
  5. A route handler or MCP handler that does arithmetic or applies eligibility rules (API and MCP).
  6. A component that computes totals or permissions, or calls the network directly instead of going through a client layer (UI).

None of these needs a tool to spot. A reviewer who has the table in mind will catch most of them in a pull request.

Axiom A5: tools stand alone

A tool may use Schema, Utils and Resources. It may not use another tool. The restriction is local to Tools; the other layers are free to use their siblings.

When two tools seem to need each other, one of two moves usually dissolves the knot. Either the shared piece sinks into a lower layer, typically Utils for a calculation or Resources for something that touches the outside world, or the work is sequenced by whoever calls the tools. An agent that chains a lookup and an action is the textbook example. The idea echoes upward, too: in the UI layer, feature folders do not import one another, which mirrors the same discipline for the same reason.

The reasoning, with a worked example, is in why tools must never depend on each other.

Axiom A6: the UI boundary

New in the second edition, A6 says what the UI layer may import. The allowed list is short and the forbidden list is just as short.

  • Allowed: Schema, Utils, and the published contracts of the API, MCP, Skills and Agents layers.
  • Forbidden: Resources, Tools, and the implementation of any layer from API up to Agents.

A published contract is something generated from a lower layer for its consumers: a typed client derived from an API description, a tool descriptor, the event types of an agent. In a library-lending system the difference looks like this:

// Allowed in the UI layer
import type { Loan } from "@schema/loans";               // L1 type
import { formatDueDate } from "@utils/dates";            // L2 pure function
import { loansClient } from "../services/loansClient";   // generated from the API contract

// Forbidden in the UI layer
import { LoanRepository } from "@resources/loans";       // L3
import { renewLoan } from "@tools/renew-loan";           // L4

The reason is the environment. A browser or phone is a device the system does not control, so database clients, secrets and business rules must not ship to it. A6 turns that from a review comment into a structural rule. One consequence follows for the lower layers: whatever the UI imports from Schema and Utils travels to the client, so those files have to stay free of secrets and server-only APIs.

Keep going

For the reasoning behind each row of the table, start with the full walkthrough of the nine layers. For how the UI's reach is enforced in practice, the API boundary article picks up where A6 leaves off. The book gives every layer a chapter of definitions, patterns and anti-patterns, and ends the layer chapters with exercises you can try on your own code.

What the book covers

  • Formal definitions of each layer, with its responsibilities and characteristics
  • Anti-patterns for every layer, shown alongside the code that avoids them
  • The full dependency matrix and the proof that LVD graphs stay acyclic
  • How lvd-lint checks the layer rules automatically
  • Testing strategies that match each layer's level of volatility