The four canonical layers
Imports only flow downward.
never upward · never sideways · never cyclic — SAMA v2 §1.2 the Law
Layer 3 · Entry
outermost shell — main · CLI handler · HTTP route · UI mount · job entry
POST /checkout
↓ uses
Layer 2 · Adapter
the boundary — DB · network · filesystem · framework bindings · external input parsed here
Stripe.charges.create()
↓ uses
Layer 1 · Core
domain decisions — business logic · policies · pure render — no network, disk, clock, framework
applyPaymentRules()
↓ uses
Layer 0 · Pure
deterministic primitives — types · constants · pure functions — no I/O, no side effects
Money(amount, currency)
Worked example, threaded through a checkout flow — each italic line shows what that layer would actually do.