Skip to content

Stability Layer

The Stability Layer is MindFry’s immune system — handling resilience, crash recovery, and graceful degradation.

ComponentPurpose
Exhaustion MonitorCircuit breaker with adaptive thresholds
Health PulseSelf-diagnostic monitoring
Shutdown RecorderExperience-based shutdown tracking
Warmup TrackerProgressive availability during resurrection
Recovery AnalyzerTrauma detection (shock/coma)

Energy-based circuit breaker protects the system under load:

LevelEnergyBehavior
Normal> 0.7All operations allowed
Elevated0.4-0.7Monitoring, slight backpressure
Exhausted0.1-0.4Writes rejected, reads OK
Emergency< 0.1Read-only recovery mode

Detected at startup based on shutdown marker:

Graceful marker found. Clean restart, proceed normally.

During resurrection (snapshot loading), the system is “cognitively unavailable”:

// These always work during warmup
await client.ping()
await client.stats()
// These return ErrorCode.WARMING_UP during warmup
await client.lineage.get('mykey') // ❌ Throws WarmingUp
await client.lineage.create('mykey', 0.5) // ❌ Throws WarmingUp

Reserved namespace _system.* for stability tracking:

LineagePurpose
_system.healthSelf-diagnostic pulse
_system.stateCurrent exhaustion level
_system.shutdown.*Shutdown experience records
_system.shockCrash trauma marker
_system.comaProlonged inactivity marker