Five Unit Types & Nine-State Lifecycle
grace intermediate 6 min read
ELI5
Every STRATT unit is one of five Lego brick shapes — a who (role), a must/must-not (rule), a do-this (task), a recipe (chain), or a reusable part (supply). Each brick walks through nine boxes from sketch to grave; once a brick is in a stricter box, it can only move to a stricter one.
Technical Deep Dive
Source: packages/schema/src/types/{role,rule,task,chain,supply}.ts, packages/schema/src/lifecycle.ts, packages/schema/src/constants.ts.
The Five Unit Types
| Type | Body Field | Forbids composition |
|---|---|---|
role | persona (lens, tone, behaviour, output_format) | yes |
rule | rule_block (polarity: always|never, statement, scope) | yes |
task | prompt_body + contract + council | no (allowed) |
chain | composition + contract + council | no (required) |
supply | supply_body (string) | yes |
Lifecycle States & Restriction Hierarchy
tampered is an error state, not part of the linear pipeline. CRDT merge picks the lower priority number (more restrictive).
| Priority | State |
|---|---|
| -1 | tampered |
| 0 | tombstoned |
| 1 | archived |
| 2 | deprecated |
| 3 | published |
| 4 | active |
| 5 | approved |
| 6 | review |
| 7 | draft |
State Machine
stateDiagram-v2 [*] --> draft draft --> review review --> draft review --> approved : gate approved --> review approved --> published : gate published --> active published --> deprecated : gate published --> published : patch/minor/major active --> deprecated : gate active --> active deprecated --> published deprecated --> archived deprecated --> tombstoned : gate archived --> deprecated archived --> tombstoned : gate tampered --> draft tombstoned --> [*]Schema Class View
classDiagram class BaseUnit { +URI id +string domain +string slug +semver version +Fingerprint fingerprint +LifecycleStatus status +Import[] imports +Meta meta } class Role { +Persona persona } class Rule { +RuleBlock rule_block } class Task { +Contract contract; +Composition? prompt_body; +string council } class Chain { +Contract contract; +Composition composition; +string council } class Supply { +string supply_body } BaseUnit <|-- Role BaseUnit <|-- Rule BaseUnit <|-- Task BaseUnit <|-- Chain BaseUnit <|-- SupplyKey Terms
- Restriction hierarchy → CRDT-merge precedence; the more restrictive status (lower number) wins.
- Gate-required transition →
review→approved,published→deprecated,active→deprecated,deprecated→tombstoned,archived→tombstoned. - Tampered → Fingerprint mismatch; only valid forward transition is back to
draft.
Q&A
Q: Which two unit types forbid a composition block?
A: role, rule, and supply all forbid it (three, not two — composition is exclusive to task and chain). Source: validate.ts lines 97–104.
Q: Why does CRDT pick the more restrictive status?
A: Safety. If two replicas disagree on whether a unit is published or deprecated, the deprecated wins so production never accidentally re-promotes a unit someone marked for removal.
Q: Can a tombstoned unit be revived?
A: No. It is terminal. Lifecycle table has no outbound transitions from tombstoned.
Examples
A reviewer flags stratt://dev/task/boot-review@1.2.0 as obsolete:
active → deprecated— gate authority LEWIS-06 must approve (Pathfinder gate).- After 90-day grace window,
deprecated → tombstoned— gate again. - Any chain importing the deprecated unit raises FM-07 as soon as the chain is bumped to a non-deprecated version range.
neighbors on the map
- Nine Councils & Agent Roster routing a chain to the right gate authority
- Nine Failure Modes (FM-01..FM-09) interpreting a `stratt ci` failure
- Sprite Data Model & Schema creating or validating a new sprite
- Unit Schema Types authoring a new prompt unit
- Unit Lifecycle States deciding whether a unit can be imported