Data and identity
A Template describes a kind of persisted Item. This chapter defines what a Runtime guarantees about Items: identity and scope, Property interpretation, hierarchy and keys, state machines, Relations and archiving.
Identity and scope
Section titled “Identity and scope”- Every Item belongs to exactly one Workspace and has exactly one Template, identified by the Template’s PRN.
- Every Item has an Identifier that is unique within its Workspace and stable for the Item’s lifetime. A Runtime must never assign an Identifier to a second Item.
- Every Item has a version. A Runtime must assign a new version on every successful write to the Item, including Property, state, key, parent and archive changes.
- An execution reads and writes Items in its own Workspace only. A lookup by Identifier from another Workspace returns nothing.
- Every Workspace has exactly one Workspace Item, an Item of the Workspace Template. It is the root of the Workspace’s hierarchy, and
ctx.getWorkspaceItem()returns it.
Properties
Section titled “Properties”- A Property declaration defines how a stored value is interpreted. It is not a guarantee that a value is present.
propertiesexposes each declared Property as its interpreted value, orundefinedwhen the stored value is absent or does not fit the declared type.propertyValuesexposes each stored value with its type tag.- A Property type change does not rewrite stored values. Existing Items keep what was stored; interpretation applies at read time.
- Parsing an operation or Event input, interpreting a stored value and checking that an Item is suitable for an operation are three distinct steps. A Runtime performs the first two. Application code performs the third.
- A Property key is a Definition key and is never
idorstate. - Items of an extensible Template may carry Property extensions declared per parent. Extension Properties are readable by every principal that can see the Item.
Hierarchy and keys
Section titled “Hierarchy and keys”- Every Item except the Workspace Item has a parent. Every parent chain ends at the Workspace Item. A Runtime must reject a parent assignment that would create a cycle.
- A child may carry a key: a string of at most 256 characters, unique among the children of one parent.
- Creating a child with a key a sibling already holds moves the key to the new child. The previous holder keeps its Identifier and loses its key.
getChildByKeyreturns the current holder. upsertChildByKeyupdates the child that holds the key when one exists and creates it otherwise, as one atomic operation.- A key path addresses an Item from the Workspace Item down the hierarchy:
ctx.getItemByKeyPath('leave', 'policy')resolves each segment against the children of the Item resolved so far.
State machines
Section titled “State machines”- A Template may declare states. Exactly one state is the default; states marked with
setInitialare also valid starting states. - A new Item starts in the default state unless its creator names an initial state. Naming a state that is not initial is an error. An Item of a Template with no states has no state.
- A transition names a source state and a target state on the same Template. Executing it is an atomic operation; Unit of Work defines the source-state check and the conflict.
- An Item exposes its state as
item.state?.value.
Relations
Section titled “Relations”- A Relation is declared on a Template or Union with a fixed cardinality and a direction. A Runtime must reject a target whose Template the Relation does not permit.
- A one-side Relation holds at most one target;
setreplaces it andclearremoves it. A many-side Relation holds a set of targets;addinserts,removedeletes, and adding a target that is already linked changes nothing. setIfNotExistsandaddIfNotExistsreturntruewhen they wrote a link andfalsewhen a link already existed. Unit of Work defines their atomicity under concurrent writes.- Removing a Relation removes the link, not the Items. Archiving an Item does not cascade to related Items; an application declares any propagation it needs.
Archiving
Section titled “Archiving”archivemarks an Item excluded from default selection and retains it.unarchivereverses the mark.- A selector excludes archived Items unless it asks for them.
Permissions
Section titled “Permissions”Item visibility and Property access follow the active auth context and the Template’s Grants. Authorization defines those rules.
Terminology
Section titled “Terminology”The specification uses Template, Item, Property and Relation. A parent-child link in the hierarchy is not a Relation; a Relation links independently managed Items.
Related
Section titled “Related”- Data model explains Templates, Items, Properties, the hierarchy and Relations.
- Define data declares Templates, Properties and keys.
- Relate items applies Relation cardinalities and conditional writes.
- Handle incomplete data reads Items whose values are absent.
WriteItemexposes the write operations these rules govern.

