Skip to content

Inheritance

A node’s policy applies to everything under it. Allowances can be reset lower down; prohibitions can never be escaped.

A node’s imports.allow and external add to every ancestor’s. Omitting external inherits it. The allowlist covers the node’s whole subtree, and the nearest node above a file that states one is the only allowlist rule for that file.

Set reset: true to start a narrower allowlist from scratch:

"~/server/src/":
imports:
external: [effect]
allow: ["~/server/src/**", "~/contracts/**"]
children:
"modules/{module}/domain/":
imports:
reset: true # the ancestor's allowances no longer apply
external: [effect]
allow: ["@/modules/{module}/domain/**"]

A members or surface rule on a folder covers every file under it. A descendant’s own rule adds a second rule; both apply.

A name convention is inherited by the subtree, and a descendant’s own name replaces it:

"~/database/src/":
name: { regex: "^(?:Database|[a-z0-9]+(?:-[a-z0-9]+)*)$" }
children:
"migrations/": { name: snake_case }
"**/": { name: kebab-case }

A deny applies once, over the declaring node’s subtree. reset does not drop it, and a descendant cannot escape it. Only the deny’s own except and matchNot exempt anything.

Within a node, deny is checked before allow, so a denied target reports the deny’s message even if allow would admit it.

Switch Says Leaves in force
reset: true this tier states its own allowlist from scratch all inherited prohibitions
unrestricted: true this tier has no allowlist yet all inherited prohibitions
layout: open this folder admits any file name its imports policy, its subfolders
partial: true don’t check this folder’s direct file list everything else it states

A node that states imports without allow must set unrestricted: true, so grep -c unrestricted architecture.yaml counts your adoption backlog.

partial skips checking a folder’s direct children against its children keys. Everything else it states still applies, and its child nodes still check their own contents. Use it to bring one branch of a large repository under policy without listing the files beside it.

"src/":
partial: true
imports: { external: [effect], allow: ["src/**"] } # still enforced
children:
"deep/":
message: "deep/ admits only *.ok.ts"
children: { "*.ok.ts": {} } # still enforced