Physiological Debt Accumulation Engine
A systems-level analysis engine that models sleep as a recovery debt process rather than a nightly outcome. Using physiological traits and ecological pressure signals, it estimates predicted sleep need, quantifies sleep debt, and visualizes how stress accumulates silently before visible fatigue or failure occurs.
Install / Use
npx skills add AmirhosseinHonardoust/Physiological-Debt-Accumulation-EngineInstalls into whichever agent you are using.
README
Systems Interpretation & Visual Deep Dive
<p align="center"> <img src="https://img.shields.io/badge/System-Dynamics-blueviolet?style=for-the-badge" /> <img src="https://img.shields.io/badge/Machine%20Learning-Interpretability-important?style=for-the-badge" /> <img src="https://img.shields.io/badge/Focus-Early%20Warning-orange?style=for-the-badge" /> <img src="https://img.shields.io/badge/Domain-Physiology%20%26%20Recovery-2ea44f?style=for-the-badge" /> <img src="https://img.shields.io/badge/Built%20With-Python-blue?style=flat-square" /> <img src="https://img.shields.io/badge/UI-Streamlit-ff4b4b?style=flat-square" /> <img src="https://img.shields.io/badge/Model-Linear%20Regression-lightgrey?style=flat-square" /> <img src="https://img.shields.io/badge/Explainability-Feature%20Decomposition-success?style=flat-square" /> <img src="https://img.shields.io/badge/Philosophy-Systems%20Over%20Predictions-black?style=flat-square" /> <img src="https://img.shields.io/badge/Concept-Sleep%20Debt%20Accumulation-critical?style=flat-square" /> <img src="https://img.shields.io/badge/Status-Research%20Prototype-yellow?style=flat-square" /> </p>Physiological Debt Accumulation Engine
This section exists for readers who do not want a demo, a dashboard, or a prediction.
It is written for readers who want to understand:
- What kind of system is being modeled
- Why sleep is treated as a debt rather than a behavior
- Why failure does not appear suddenly
- Why prediction is secondary to pressure accounting
Why This Project Exists
Most sleep analytics tools ask:
“How many hours did you sleep?”
This engine asks a more dangerous question:
“How much recovery did your physiology require and did you pay for it?”
That distinction changes everything.
Sleep duration is an output variable. Sleep need is a hidden state.
This engine is built around the idea that biological systems fail due to accumulated imbalance, not discrete mistakes.
Conceptual Model: Physiological Debt
Physiological debt is defined here as:
The persistent gap between required recovery and realized recovery under structural constraints.
Key properties of physiological debt:
- It accumulates silently
- It is partially buffered
- It becomes visible only after buffers degrade
- It explains delayed collapse better than point predictions
This mirrors real-world phenomena:
- Burnout
- Immune suppression
- Cognitive fatigue
- Injury risk escalation
- Ecosystem collapse
Profile Snapshot, Defining the System’s Constraints
<img width="1309" height="459" alt="Screenshot 2025-12-19 at 15-13-34 Physiological Debt Accumulation Engine" src="https://github.com/user-attachments/assets/8228e110-57e0-45d0-9dae-a7102666ad6f" />What a “profile” actually means
A profile is not an individual. It is a closed biological system with fixed structural properties.
These properties define:
- Baseline metabolic load
- Repair complexity
- Long-term survivability
- Stress tolerance
They do not change quickly, and therefore:
- Cannot be “optimized away”
- Cannot be compensated by motivation
- Cannot be overridden by discipline
This is why the model does not treat sleep as a choice.
Why body and brain weight are log-scaled
Biological scaling laws are nonlinear.
A doubling in body mass does not double energy cost, it changes it asymmetrically.
Log transforms:
- Preserve comparative meaning
- Prevent dominance by large species
- Encode allometric relationships implicitly
This is not a modeling trick, it is a biological assumption.
Debt Summary, Turning Recovery Into an Accounting System
<img width="1078" height="648" alt="Screenshot 2025-12-19 at 15-15-01 Physiological Debt Accumulation Engine" src="https://github.com/user-attachments/assets/55347fdd-1572-4ad5-a150-871f1d6e6e6d" />Observed Sleep
Observed sleep is treated as:
- A measured outcome
- Not a control variable
- Not evidence of recovery
Sleeping less than needed can still feel normal, until it doesn’t.
Predicted Sleep Need
Predicted sleep need is the model’s estimate of:
“Minimum recovery required to maintain equilibrium under current physiological and ecological load.”
This value increases when:
- Metabolic cost rises
- Cognitive maintenance increases
- Environmental danger increases
- Sleep opportunity degrades
This is why stress increases sleep need, even when sleep duration doesn’t change.
Sleep Debt
Sleep debt is not “fatigue”.
It is unpaid recovery.
Negative sleep debt means:
- Repair processes are deferred
- Buffers are being consumed
- Future resilience is being borrowed
This is why the project treats debt as directional and cumulative.
Debt Regime Classification
The regime label is not cosmetic.
It encodes the qualitative phase of the system:
-
Stable Recovery roughly matches demand. Buffers intact.
-
Accumulating Debt exists but is not yet destabilizing.
-
Critical Buffers are depleted. Small shocks can cause failure.
This mirrors phase transitions in:
- Materials science
- Ecology
- Finance
- Human physiology
Debt Landscape, Population-Level Fragility
Why individual numbers are misleading
A sleep debt of -1.2 hours means nothing in isolation.
What matters is:
- How common it is
- Where it lies relative to others
- Whether it sits near regime boundaries
This view embeds the individual inside a population pressure field.
Reading the diagonal
The diagonal represents perfect equilibrium.
Points below it are:
- Accumulating unpaid recovery
- Increasing vulnerability
- Often asymptomatic, until collapse
The absence of sharp clusters reinforces the thesis:
There is no single “bad night” that causes failure.
Contribution Decomposition, Making Pressure Visible
<img width="1138" height="370" alt="Screenshot 2025-12-19 at 15-15-14 Physiological Debt Accumulation Engine" src="https://github.com/user-attachments/assets/5c3b0d3e-a064-4bb1-ba83-70a8c97cc9c8" />Why this decomposition matters
Without decomposition:
- The model is a black box
- Scientific reasoning stops
- Trust erodes
This view answers:
“Which forces are doing the work?”
Interpreting contribution direction
-
Positive contribution Increases predicted sleep need → more recovery required
-
Negative contribution Reduces predicted sleep need → lower baseline demand
Importantly:
- Contributions are contextual
- A factor can help in one regime and hurt in another
Why intercept dominates
The intercept represents:
- Baseline physiological maintenance
- Non-negotiable biological cost
This reinforces a core message:
You cannot optimize away being biological.
Scenario Simulator, Stress Without Forecasting
<img width="1156" height="430" alt="Screenshot 2025-12-19 at 15-16-14 Physiological Debt Accumulation Engine" src="https://github.com/user-attachments/assets/54319d38-4257-48cd-a40c-4f2ac5510c45" />What counterfactual stress testing is
This simulator asks:
“If pressure increased, would the current recovery still be sufficient?”
It does not ask:
- What will happen
- When failure occurs
- How behavior changes
Why this matters
Most failures happen because:
- Systems look stable
- Stress increases quietly
- Recovery does not scale
This tool reveals latent fragility.
Dataset Explorer, Radical Transparency
<img width="1144" height="393" alt="Screenshot 2025-12-19 at 15-16-33 Physiological Debt Accumulation Engine" src="https://github.com/user-attachments/assets/1c003cf9-52ee-458e-96a6-0d7de76bc07f" />Why exposing the dataset is non-negotiable
Any system that:
- Computes hidden states
- Assigns regimes
- Labels stability
...must allow full inspection.
This view exists to:
- Enable auditing
- Encourage skepticism
- Support reinterpretation
System Philosophy
This engine is built on five principles:
- Failure is preceded by imbalance
- Imbalance accumulates before symptoms
- Recovery is constrained, not chosen
- Prediction without pressure is misleading
- Warning systems matter more than decisions
What This Engine Is For
- Research exploration
- Systems thinking
- Leading-indicator analysis
- Educational demonstrations
- Conceptual reframing of sleep
What This Engine Is Not For
- Medical diagnosis
- Prescriptive advice
- Optimization of sleep hacks
- Performance guarantees
Final Perspective
Sleep is not rest.
Sleep is maintenance.
Maintenance deferred becomes debt. Debt ignored becomes collapse.
This engine exists to make that invisible process visible.
Related Skills
python-debugpy
385.5kDebug Python with pdb, breakpoint(), post-mortem inspection, and debugpy remote attach.
skill-creator
385.5kCreate, edit, audit, tidy, validate, or restructure AgentSkills and SKILL.md files.
claude-opus-4-5-migration
140.6kMigrate prompts and code from Claude Sonnet 4.0, Sonnet 4.5, or Opus 4.1 to Opus 4.5
automl-hyperparameter-optimization
40.5kAutoML and hyperparameter optimization rules for Python ML projects using Ray Tune, Optuna, PyCaret, and time-series AutoML libraries
Languages
Security Score
Audited on Jun 20, 2026
