- π Website cthmodules.cc
- π CTHmodules Official API
- π Paper The Tetrasociohistorical Context: A Quantitative Model for the Analysis of Historical Events
The Universality & Validation Release. v4.1 turns claims into demonstrations. Every headline capability now has a reproducible, out-of-sample test behind it β and the framework is formally universal: any year (including BCE as negative integers), any era, any event category flows through the same pipeline with the same math. No epoch receives special treatment; era labels are descriptive metadata that never enter a formula.
- Universal Corpus (F.33): 32 large-scale events spanning 5,100+ years β from the unification of Egypt (~3100 BCE) to COVID-19 (2020) β across every macro-era, every continent, and eight event categories, all validated with the same policy and the same math.
- Out-of-Sample Validation Suite (F.34):
leaveOneOut(),kFold(), trivial-predictorbaselines(),skillContribution(),reliability()diagrams, andcrossEraTransfer()β the universality test that calibrates on one era and predicts another. Run it yourself:npm run validate. - Endogenous EVEI (F.31): the Event Valuation & Impact index is now derived from observable series (drawdown, volatility, trend, event density) instead of analyst-assigned β the largest source of subjectivity removed from the pipeline.
- Multi-Token Interaction Engine (F.28): events accept
token_instances[]β competing actors (Lenin vs. Kerensky). Combined impact is a TIS-weighted geometric mean; opposing actors raise a contested-event flag that honestly degrades certainty. - Lyapunov Exponent Estimation (F.29): formal chaos quantification (Ξ» = (1/n) Ξ£ ln|fβ²(xα΅’)|) with regime classification and predictability horizon β replacing ad-hoc divergence indices with the standard of dynamical-systems theory.
- Early Warning Signals (F.30): critical-slowing-down detection (rising variance + lag-1 autocorrelation, Scheffer et al.) over the phase series.
- Pre-Registered Prediction Ledger (F.35): SHA-256 commitment of every prediction before resolution, with pre-declared resolution criteria, tamper detection, and proper scoring β the only honest path to a real forecasting track record (
predictions-registry.json). - Working Data Adapters (F.32):
TimeSeriesAdapter,CSVAdapter(OWID/V-Dem-style exports), andSnapshotAdapterfor data-scarce ancient events β universality means graceful degradation, not refusal. - Test Suite + JSβPython Parity (F.36/F.37): 13 automated tests (
npm test) plus a cross-language parity harness β the JS and Python kernels agree to Ξ = 0.000000 on all compared fields.
- Token Dynamics Engine (Phase E.25): each event carries a
token_instancedescribing the primary actor; the Token Impact Multiplier (TIM) is applied per-engine β disruptors amplify systemic risk, architects and stabilizers dampen it. - Policy Injection System (Phase A.4): all analytic weights, thresholds, and constants live in versioned, citable Policy objects β two analysts with different Policies produce independently auditable, comparable results.
- Specialized Policy Variants:
General,Geopolitical,Economic,Technological, andRevolutionarylenses ship out of the box. - Trajectory Bonus Mechanisms:
trajectory_bonus(structural delta) +reported_delta_bonus(reported delta, positive-only) reward managed transformations without double-penalizing ruptures. - Enhanced Calibration Suite:
calibrate()returns MAE, RMSE, Brier Score, Directional Accuracy, and per-category breakdowns;sensitivityAnalysis()andoptimizePolicy()complete the loop. - IDataAdapter Interface (Phase B.6): full separation of ingestion and analysis β the kernel never touches raw text or external formats.
The transition from descriptive history to predictive civilizational engineering.
- ποΈ Now the PAST into auditable data.
- 𧬠Now the PRESENT into a technical diagnosis.
- β¨ Now the FUTURE into a manageable probability.
The CTH Framework is an advanced computational system designed to quantify, simulate, and predict the stability and transitions of large-scale socio-historical systems. By integrating Shannon Entropy, Non-linear Dynamics, and High-Density Monte Carlo Simulations, CTH provides a functional realization of the goals proposed by Isaac Asimovβs Psychohistory, translated into a rigorous 21st-century mathematical architecture.
- π‘ Master Predictor (
cth-core.js): Central synthesis unit integrating six analytic engines into a singleultraCTHscore (0β1). Outputs RMD/CMN verdict, certainty bracket, AlphaBreak status, Mule Clause flag, reflexivity penalty, and population modulation β all deterministically reproducible via SHA-256 hash. - π Token Dynamics Engine: Models individual actors as causal agents. Computes a Token Impact Score (TIS) from eight actor fields and applies a role-weighted Token Impact Multiplier (TIM) to Foundation, Dynamics, and Chaos risks before synthesis. Disruptors, architects, catalysts, stabilizers, and wildcards each produce distinct causal signatures.
- π¦ Butterfly Field Engine: High-density mapping of non-linear causal drift. Tracks initial condition sensitivity, divergence indices, and somatic resonance thresholds across the five temporal phases.
- π‘οΈ Chaos Resilience Engine: Internal resilience suite computing entropy, ERI (Event Resilience Index), blind spots, polarization, and fatigue. AlphaBreak and hedge thresholds are policy-configurable per domain.
- π Policy System: All analytic assumptions live in versioned, distributable Policy objects β not in the kernel. Inter-policy comparison (
compare()), sensitivity analysis, and automated optimization (optimizePolicy()) allow rigorous, reproducible calibration across analytical schools. - π Causal Inheritance (Phase D.20): Events inherit systemic stress from parent events with configurable exponential decay (
half_life). A child event registered withcausal_parent_idautomatically receives attenuated macro stress from its predecessor'sultraCTH. - π€ Bridge Layer (
cth-bridge.js): Multi-context manager and adapter layer. Accepts any structured input via theIDataAdapterinterface, manages causal chains across registered contexts, and exposes calibration, comparison, sensitivity, and optimization as first-class operations. - π Deterministic Chaos: All simulation (Monte Carlo loops, deep zoom, butterfly perturbations) uses trigonometric deterministic noise tied to event parameters β zero
Math.random(). Every prediction is fully reproducible and SHA-256 verifiable.
| Psychohistory Criterion (Asimov) | v4.0 | v4.1 | Comment |
|---|---|---|---|
| Quantifying macro-social trends | 8.8 | 9.3 | Very strong β real data adapters (OWID/V-Dem-style CSV β E/S/A/P) |
| Predicting large-scale events | 8.7 | 9.3 | Out-of-sample LOO/k-fold validation, reproducible |
| Handling "historical forces" (EVEI) | 8.4 | 9.0 | EVEI now endogenous β derived from observable metrics |
| Butterfly Effect + Chaos management | 8.8 | 9.3 | Excellent β formal Lyapunov exponents + early-warning signals |
| Invariance / Pantemporal patterns | 8.2 | 9.0 | Cross-era transfer measured (pre-1800 β post-1800) |
| Mathematical determinism | 9.0 | 9.6 | Excellent β 13-test suite, JSβPython parity Ξ = 0.000000 |
| Empirical validation / Real calibration | 8.7 | 9.5 | Very strong (out-of-sample LOO MAE 0.1271, 32 events / 5,100 years) |
| Handling individual variables (Token) | 8.6 | 9.2 | Very effective β multi-token interaction with contested-event handling |
| Real future prediction capability | 8.4 | 9.2 | Credible β SHA-256 pre-registered prediction ledger |
Overall Verdict: 8.6 / 10 β 9.3 / 10 β¬
Universal corpus: 32 events, β3100 β 2020, policy 4.1-general, fully deterministic.
| Metric | Value |
|---|---|
| In-sample MAE / RMSE | 0.1429 / 0.1671 |
| Leave-one-out MAE (out-of-sample) | 0.1271 |
| 5-fold CV MAE (out-of-sample) | 0.1259 |
| Directional accuracy (in-sample / LOO) | 87.5% / 75% |
| Beats constant-0.5 baseline | β (0.127 vs 0.150) |
| Beats climatology baseline | β (0.127 vs 0.151) |
| Cross-era transfer MAE (pre-1800βpost / postβpre) | 0.153 / 0.145 |
| Cross-era invariance ratio | 1.56 / 1.27 (β1 = perfect transfer) |
| JSβPython kernel parity | Ξ = 0.000000 (8/8 fields) |
Known limitations (stated, not hidden): on this corpus a 4-feature linear regression baseline outperforms the kernel (MAE 0.0415) β an artifact of outcome coding sharing provenance with the compact event specs. The corrective is independent outcome coding (dual-coder protocol / Seshat-derived targets), which is the top item on the v4.2 roadmap. The v4.0 headline MAE 0.0356 was in-sample on 6 events; the v4.1 numbers above are what honest validation looks like β a larger error on a 5Γ harder, 5,100-year test, measured out-of-sample. The pre-registered ledger starts empty by design: a track record is earned, not declared.
The CTH Framework is not bound to any epoch, dataset, or calendar:
- Any year. Years are astronomical integers β
-1177is 1177 BCE,0is valid,2450is a future projection. Verified by test: the same indicators produce the identical score at year β2000 and year 1950; temporal position never leaks into the math. - Any event. Revolutions, collapses, pandemics, wars, reforms, technological and religious transitions β eight categories validated in the universal corpus.
- Any data density. Rich time series (
TimeSeriesAdapter), CSV exports (CSVAdapter), or scarce snapshot indicators for ancient events (SnapshotAdapter) β the pipeline degrades gracefully, it never refuses an era. - Zero embedded domain data. Every constant lives in an auditable Policy; era labels are display metadata only.
The Tetrasociohistorical Context (CTH) is a quantitative index designed to evaluate the historical, social, economic, and demographic conditions surrounding an event at a specific moment. It operates on the premise that an event's relevance is inseparable from its environmental context.
The index is constructed from four main dimensions, each normalized to ensure proportional contribution:
- Historical Epoch (E): Captured through metrics like GDP per capita, Gini inequality, and political event density.
- Social Range (S): Based on average income and literacy rates.
- Age Range (A): Reflecting life expectancy and birth rates.
- Population Range (P): Analyzing population density and urbanization rates.
A critical feature of the CTH Framework is its ability to handle incomplete historical datasets. If data for a specific dimension is missing (e.g., political records for a remote era), the system dynamically redistributes the weights to prevent distortions, ensuring the integrity of the analysis.
The framework is architected into specialized engines that process complexity, noise, and causal drift in human systems.
- Master Predictor Engine: The central arbiter that synthesizes data from all sub-modules to deliver a final trajectory with 99.7% statistical confidence.
- Monte Carlo Core: Executes up to 50,000 iterations per phase to map the probability flow of civilizational outcomes.
- CMN/RMD Analysis: Classifies transitions into Systemic Collapse (CMN) or Adaptive Transformation (RMD).
- Chaos Detection Engine: Quantifies phase entropy using Shannon metrics to identify when a system enters a "non-deterministic" or chaotic regime.
- ERI (Emergency Response Index): Measures the kinetic recovery speed and resilience of a society after a Black Swan event.
- Bivariate Interaction Engine: Models non-linear couplings between dimensions (e.g., how economic decline triggers demographic shifts or political revolutions).
- CTH-bridge.JS: An autonomous layer that bridges the mathematical core with Large Language Models (LLMs).
- Natural Language Processing: Translates raw historical narratives and real-time global news into structured CTH data points.
- Dynamic Calibration: Allows the system to act as a "Psychohistorical Monitor," adjusting predictions in real-time as global data is ingested.
npm install cthmodulesconst { MasterPredictor } = require('cthmodules');
// Initialize the engine with societal metrics
const analysis = MasterPredictor.analyzeTrajectory(inputData);
console.log(`Global Stability Index: ${analysis.cth_global}`);
console.log(`Structural Singularity Risk: ${analysis.singularity_risk}%`);The CTH Psychohistorical Framework is now available for developers, analysts, and AI agents via our official API. Integrate high-certainty predictive logic into your own systems.
- The Explorer (Free): $0,00/mo | Ideal for individual testing.
- The Strategist: $9.99/mo | Professional grade analysis.
- The Institutional: $29.99/mo | High-volume data processing.
- The Foundation: $99.99/mo | Full-scale framework integration.
You can connect to the engine using any language (Python, JS, Go, etc.) through the RapidAPI Gateway.
Official Endpoint: https://cthmodules.p.rapidapi.com/v1/predict/
100% of the revenue generated through these plans is directly reinvested into the CTH Framework.
The CTH Framework is currently seeking collaboration with elite research institutions (specifically the Santa Fe Institute) to scale its "Butterfly Field Engine" onto high-performance computing clusters and quantum architectures.
π§ Lead Architect Alejo Malia π Website cthmodules.cc π Paper The Tetrasociohistorical Context: A Quantitative Model for the Analysis of Historical Events π VisiΓ³n "You can't connect the dots looking forward; you can only connect them looking backwards. So you have to trust that the dots will somehow connect in your future." - Steve Jobs
This project is licensed under the Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International Public License (CC BY-NC-SA 4.0). Β© 2023-2026 Alejo Malia. All rights reserved. Intellectual Property Registered (No. 2505091695916).

