Purpose of this page: describe the pure core — the state machines and
ordering rules — and the guarantees the rest of the system leans on.
Layer 6
domain/ (pure)
Entities, state machines, and zod schemas. No file system, no network, no clock, no randomness. The only runtime dependency is zod.
Components
Entities · state machines · transitions
The legal moves of every resource. A lease hierarchy with attempt accounting.
Plan format + canonical serialization
A plan document round-trips byte-identically. Serialization is canonical per the plan-format proposal.
Bytewise ordering
Document sets sort by canonical path, compared bytewise through Buffer.compare.
ULID tie-break
A topological walk breaks a tie by ULID, so task order is reproducible.
Inbound edges
| From | Meaning |
|---|---|
| commands/ | validate input and state transitions against the domain |
| queries/ | shape reads with domain schemas |
Rules
- Purity is enforced: no file system, no network, no clock, no randomness.
- A ULID is minted by a service and passed in. The domain never generates one.
- Determinism is a product guarantee: same input, same output, same order, same bytes.
- This layer imports only itself. Its only permitted runtime dependency is zod.