Skip to content

Sounio-lang/sounio-psychiatry

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

sounio-psychiatry

Computational Psychiatry through Second-Order Cybernetics

A clinical application library for the Sounio programming language that formalizes psychiatric phenomena as computable properties of cybernetic systems.

Why This Exists

Current computational psychiatry (active inference, RL models, Bayesian brain) is first-order: the model observes the patient but never models itself observing. The therapist is invisible. Treatment resistance is a hidden parameter. Metacognitive dysfunction is hand-waved.

This library is second-order: the therapist IS an observer whose drift IS part of the clinical system. Treatment resistance isn't mysterious — it's drift / trust, computable from session dynamics.

Core Formalizations

Psychiatric Phenomenon Cybernetic Principle Module
Mental health Organizational closure (autopoiesis) core/closure.sio
Anxiety disorders Insufficient variety (Ashby's Law) models/anxiety.sio
Depression / rumination Metacognitive budget exhaustion models/depression.sio
Dissociation Self-model process deactivation models/dissociation.sio
Psychotic break Loss of cognitive closure models/psychosis.sio
Double bind Contradictory injunctions (Bateson) models/double_bind.sio
Schismogenesis Relational escalation / collapse models/schismogenesis.sio
Treatment resistance Observer drift / trust ratio models/resistance.sio
Therapeutic alliance Pask conversation with adaptive trust models/alliance.sio
Homeostatic symptoms Symptoms as system regulators models/homeostasis.sio
Treatment outcome Reliable Change Index (Jacobson & Truax) validation/rci.sio
Crisis prediction Sedenion zero-divisor proximity models/crisis.sio

Architecture

sounio-psychiatry/
├── src/
│   ├── core/           # Cognitive process graph, closure detection
│   │   ├── clinical_state.sio    # ClinicalState struct + constructors
│   │   ├── closure.sio           # DFS cycle detection on cognitive graph
│   │   └── metacognition.sio     # Observer-based self-monitoring model
│   ├── models/         # Specific disorder formalizations
│   │   ├── anxiety.sio           # Ashby variety deficit
│   │   ├── depression.sio        # Rumination as budget exhaustion
│   │   ├── dissociation.sio      # Process deactivation
│   │   ├── psychosis.sio         # Closure loss
│   │   ├── double_bind.sio       # Bateson 1956
│   │   ├── schismogenesis.sio    # Bateson 1936
│   │   ├── alliance.sio          # Therapeutic alliance (Pask)
│   │   ├── resistance.sio        # Treatment resistance
│   │   ├── homeostasis.sio       # Symptom-as-regulator
│   │   └── crisis.sio            # Sedenion encoding + ZDP
│   ├── bridges/        # Connections to sounio-cybernetics
│   │   ├── observer_bridge.sio   # Observer → ClinicalState
│   │   ├── eigenform_bridge.sio  # Self-model as eigenform
│   │   └── variety_bridge.sio    # Ashby's Law integration
│   └── validation/     # Clinical outcome measurement
│       ├── rci.sio               # Reliable Change Index
│       ├── assessment.sio        # Epistemic assessment fusion
│       └── trajectory.sio        # Treatment trajectory tracking
├── tests/
│   ├── unit/           # Per-function invariant tests
│   ├── integration/    # Cross-module scenario tests
│   └── clinical/       # Tests against published meta-analyses
├── examples/
│   ├── healthy_baseline.sio
│   ├── anxiety_treatment.sio
│   ├── therapy_session.sio
│   ├── double_bind_family.sio
│   └── full_trajectory.sio
├── data/               # Clinical dataset interfaces (NOT raw data)
│   ├── abide/          # ABIDE-I phenotypic data loader
│   ├── adhd200/        # ADHD-200 loader
│   └── ukbiobank/      # UK Biobank mental health loader
├── paper/              # Computational Psychiatry journal submission
├── docs/               # Clinical user guide
└── scripts/            # Dataset download + preprocessing

Dependencies

  • sounio >= 1.0.0-beta.4 (the language)
  • sounio-cybernetics (9 foundational modules: distinction, eigenform, observer, autopoiesis, coupling, conversation, variety, bateson, languaging)

Quick Start

# Clone
git clone https://github.com/sounio-lang/sounio-psychiatry
cd sounio-psychiatry

# Set stdlib path to include cybernetics
export SOUNIO_STDLIB_PATH=/path/to/sounio/stdlib

# Run the healthy baseline example
souc run examples/healthy_baseline.sio

# Run the full treatment trajectory
souc run examples/full_trajectory.sio

# Run clinical validation tests
souc run tests/clinical/meta_analysis_h1.sio

Falsifiable Predictions

The model makes structural predictions testable against published evidence:

Hypothesis Prediction Evidence Status
H1 Anxiety preserves cognitive closure; psychosis breaks it Snyder 2015 (Psych Bull): anxiety = rigid but intact EF; schizophrenia = fragmented Supported
H2 Alliance ruptures (model divergence) predict dropout Safran 2011 (Psychotherapy): rupture-repair predicts outcome Supported
H3 Rumination depletes metacognitive precision Wells 2009 (MCT): rumination = metacognitive resource depletion Supported
H4 Symptom removal without replacement causes instability Tryon 2008 (CPR): ~25% substitution rate Partially supported
H5 Sedenion zero-divisor proximity predicts crisis Novel — no prior work Untested

Validation Roadmap

Phase 1: Retrospective (weeks 1-4)

  • ABIDE-I: Map phenotypic data → cognitive process graph → test closure/anxiety predictions
  • ADHD-200: Test executive function disruption → closure loss prediction

Phase 2: Prospective (months 2-6)

  • Partner with clinical site for therapy session data
  • Code sessions as (therapist_observation, patient_response) pairs
  • Compare model alliance trajectory with Working Alliance Inventory

Phase 3: Calibration (months 6-12)

  • Calibrate quantitative outputs against clinical scales (GAD-7, PHQ-9, WAI)
  • Establish normative ranges for anxiety_deficit, treatment_resistance, metacognitive_capacity
  • Pre-register replication study

Ethical Considerations

This library formalizes theories, not diagnoses. It is a research tool, not a clinical decision support system.

  • No individual clinical decisions should be based on model outputs
  • All clinical validation requires IRB approval
  • Raw clinical data is never stored in this repository
  • The data/ directory contains only loader scripts and phenotypic metadata schemas
  • Model predictions are structural (qualitative pattern) not quantitative (specific scores)

Citation

If you use this library in research, please cite:

@software{sounio_psychiatry_2026,
  title = {sounio-psychiatry: Computational Psychiatry through Second-Order Cybernetics},
  url = {https://github.com/sounio-lang/sounio-psychiatry},
  year = {2026},
  note = {Requires sounio >= 1.0.0-beta.4 and sounio-cybernetics}
}

Contributing

We welcome contributions from:

  • Psychiatrists / clinical psychologists — clinical validation, hypothesis refinement
  • Systems theorists — model extensions, new disorder formalizations
  • Data scientists — dataset integration, statistical validation
  • Sounio developers — core library improvements

See CONTRIBUTING.md for guidelines.

License

MIT. See LICENSE.

About

Computational Psychiatry through Second-Order Cybernetics — clinical application of sounio-cybernetics

Resources

License

Contributing

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages