Stability Layer
The Stability Layer is MindFry’s immune system — handling resilience, crash recovery, and graceful degradation.
Components
Section titled “Components”| Component | Purpose |
|---|---|
| Exhaustion Monitor | Circuit breaker with adaptive thresholds |
| Health Pulse | Self-diagnostic monitoring |
| Shutdown Recorder | Experience-based shutdown tracking |
| Warmup Tracker | Progressive availability during resurrection |
| Recovery Analyzer | Trauma detection (shock/coma) |
Exhaustion Levels
Section titled “Exhaustion Levels”Energy-based circuit breaker protects the system under load:
| Level | Energy | Behavior |
|---|---|---|
| Normal | > 0.7 | All operations allowed |
| Elevated | 0.4-0.7 | Monitoring, slight backpressure |
| Exhausted | 0.1-0.4 | Writes rejected, reads OK |
| Emergency | < 0.1 | Read-only recovery mode |
Recovery States
Section titled “Recovery States”Detected at startup based on shutdown marker:
Graceful marker found. Clean restart, proceed normally.
No marker found. System was terminated unexpectedly (kill -9, crash, power loss).
Marker found but >1 hour old. Prolonged downtime detected.
Warmup Enforcement
Section titled “Warmup Enforcement”During resurrection (snapshot loading), the system is “cognitively unavailable”:
// These always work during warmupawait client.ping()await client.stats()
// These return ErrorCode.WARMING_UP during warmupawait client.lineage.get('mykey') // ❌ Throws WarmingUpawait client.lineage.create('mykey', 0.5) // ❌ Throws WarmingUpSystem Lineages
Section titled “System Lineages”Reserved namespace _system.* for stability tracking:
| Lineage | Purpose |
|---|---|
_system.health | Self-diagnostic pulse |
_system.state | Current exhaustion level |
_system.shutdown.* | Shutdown experience records |
_system.shock | Crash trauma marker |
_system.coma | Prolonged inactivity marker |