Layered Architecture L0–L6
stratt intermediate 6 min read
ELI5
STRATT is built like a kitchen brigade: each station only talks to the one above and below it. The cleaver (identity) prepares ingredients, the line cook (schema) plates them, the expediter (graph) sequences orders — nobody reaches across the pass.
Technical Deep Dive
Layer Map
flowchart TB L6["L6 MERIDIAN<br/>apps/meridian — Astro/Starlight site"] L5["L5 CLI<br/>@stratt/cli — 9 Phase 1 commands"] L4["L4 Council Registry<br/>councils/ content sets"] L35["L3.5 n8n Exporter<br/>@stratt/n8n-exporter — chain compiler"] L3["L3 Graph<br/>@stratt/graph — DAG, blast radius, CI"] L2["L2 CRDT<br/>@stratt/crdt — Yjs documents"] L1["L1 Schema<br/>@stratt/schema — Zod validators, URI parser"] L0["L0 Identity<br/>@stratt/fingerprint — Blake3 + canonicalisation"] L6 --> L5 --> L4 --> L35 --> L3 --> L2 --> L1 --> L0Layer Contracts
| Layer | Package | Owns | Does Not Own |
|---|---|---|---|
| L0 | @stratt/fingerprint | canonicalise(), fingerprintYaml(), blake3:{64hex} format | Schema validation |
| L1 | @stratt/schema | Zod types, parseUri(), URI_REGEX | Hashing |
| L2 | @stratt/crdt | PromptUnitDoc, applyEdit(), merge strategies | Dependency resolution |
| L3 | @stratt/graph | buildDag(), blastRadius(), cycle detection | Editing |
| L3.5 | @stratt/n8n-exporter | Chain → n8n workflow JSON | Generic graph ops |
| L5 | @stratt/cli | User-facing commands | UI rendering |
| L6 | apps/meridian | Documentation site rendering | Authoring |
L4 is content-only (councils/ directory), not a code package. Every upward call must pass through one layer at a time — @stratt/cli does not import @stratt/fingerprint directly; it goes via schema.
Key Terms
- Layer → a package boundary with a single responsibility and a fixed downstream dependency.
- Council → a content set of related units, registered at L4.
- MERIDIAN → the L6 documentation app that renders units from R2.
Q&A
Q: Why is @stratt/n8n-exporter numbered L3.5 instead of L4?
A: It depends on the L3 graph (chains are DAG nodes) but is optional and orthogonal to council content, so it sits between layers rather than above them.
Q: Can L1 schema code call L0 fingerprint code? A: Yes — adjacent layers may call downward. The rule forbids skipping or calling upward.
Examples
A stratt validate invocation: CLI (L5) → schema validators (L1) → URI parser (L1) → fingerprint verify (L0). The CRDT layer (L2) is bypassed because validation reads canonical YAML, not Yjs state.
neighbors on the map
- Packet Structure & Envelope Format debugging packet corruption