# ⏱️ Universal Hex States (UHS)
**UHS** is the state and behavior layer of the Universal Hex (UHX) framework. It enables trait-based modeling of dynamic systems by describing:
- **System states** as UHT fingerprints
- **State transitions** using UHR-coded relationships
- **Triggers and conditions** that initiate change
This layer brings time, sequence, and logic into the trait-based UHX model.
---
## 🕐 UHS Basics
- **State = a UHT code** representing a specific configuration of an entity
- **Transition = a UHR link** between two UHT-encoded states
- **Trigger = a condition or event** that causes a transition
- **Delta = the trait difference** between states
---
## 🧰 UHS Components
### 1. **States**
Each state is defined by a UHT code, with a name and optional description.
```yaml
states:
- name: "Idle"
uht: "42F20000"
- name: "Active"
uht: "42FA3FDF"
```
### 2. **Transitions**
Transitions use UHR to define **how** and **why** the system changes state.
```yaml
transitions:
- from: "Idle"
to: "Active"
via: "C1" # Directional + Causal + Non-reciprocal
trigger: "Input received"
```
### 3. **Trait Deltas (Optional)**
You can compute what traits are gained or lost:
```yaml
Idle (42F20000) → Active (42FA3FDF):
+ Emits output (10)
+ Behavior-guiding (21)
+ Temporal (23)
```
---
## ⚖️ Why Use UHS?
- Define behavior **without bloated statecharts**
- Express **modes, conditions, and failure states** semantically
- Track **trait emergence over time**
- Integrate **inputs, events, and causality** into trait logic
---
## 📊 Simple Example: Light Switch
```yaml
entity: "Basic Light Switch"
base_uht: "42900000"
states:
- name: "Idle"
uht: "42900000"
- name: "On"
uht: "42DA3000"
- name: "Off"
uht: "42D02000"
transitions:
- from: "Idle"
to: "On"
trigger: "Toggle ON"
via: "C1"
- from: "On"
to: "Off"
trigger: "Toggle OFF"
via: "C1"
- from: "Off"
to: "Idle"
trigger: "Reset"
via: "81"
```
---
## ⚛️ Advanced Use Cases
- **Failure modeling**: Add states like "Degraded" or "Error" with constrained traits
- **Safety/Autonomy logic**: Require transitions to or from "Failsafe"
- **Symbolic behavior**: Model software or policies changing semantic states
- **Emergence tracking**: Detect new traits gained only in collective system states
---
## ✨ Summary
|Concept|Encoded As|
|---|---|
|State|UHT code|
|Transition|UHR link + trigger|
|Delta|Trait difference (gain/loss)|
|Condition|Plaintext or logic constraint|
**UHS** allows systems to be modeled not just as _what they are_, but _how they change._