Context
STRATT is a 7-layer prompt engineering architecture. The CLI (stratt new, stratt validate, stratt publish) is the product surface users interact with — but it cannot exist without Layer 1, the schema package that defines what a valid prompt unit looks like.
Learning
Building the schema package first — before any CLI, before any CRDT merge logic, before any documentation site — forced every design question to be answered at the structural level. The 5 unit types (role, rule, task, chain, fragment) each have different required and forbidden blocks. Getting this right in Zod validators means the CLI can delegate all validation to a singlevalidateUnit() call rather than implementing ad-hoc checks.
The schema package also encodes business rules directly:
- CON-010 draft isolation: Stable units cannot import draft units. This prevents untested prompts from entering production chains.
- Composition forbidden on fragments: Fragments are reusable content, not orchestration. Preventing composition at the schema level eliminates a class of misuse.
- CRDT merge ordering: The lifecycle state merge resolution (
tombstoned > deprecated > tampered > stable > review > draft) is embedded in the schema package, not the CRDT package. This means any consumer of the schema can resolve merge conflicts without importing Automerge.