Metadata-Version: 2.4
Name: worldview
Version: 0.3.1
Summary: Philosophical-ethical worldview layer with normative metrics, criticality and common-good alignment for GenesisAeon
Project-URL: Repository, https://github.com/GenesisAeon/worldview
Project-URL: Issues, https://github.com/GenesisAeon/worldview/issues
Project-URL: Documentation, https://genesisaeon.github.io/worldview
Project-URL: Zenodo, https://doi.org/10.5281/zenodo.worldview
Author-email: GenesisAeon <genesis@genesisaeon.dev>
License: MIT
License-File: LICENSE
Keywords: coherence,common-good,criticality,emergence,ethics,genesisaeon,normative-metrics,philosophy,worldview
Classifier: Development Status :: 3 - Alpha
Classifier: Environment :: Console
Classifier: Intended Audience :: Science/Research
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
Classifier: Typing :: Typed
Requires-Python: >=3.11
Requires-Dist: numpy>=1.26
Requires-Dist: pydantic>=2.7
Requires-Dist: rich>=13.7.0
Requires-Dist: scipy>=1.13
Requires-Dist: typer>=0.12.0
Provides-Extra: dev
Requires-Dist: hypothesis>=6.100.0; extra == 'dev'
Requires-Dist: mypy>=1.10.0; extra == 'dev'
Requires-Dist: pre-commit>=3.7.0; extra == 'dev'
Requires-Dist: pytest-cov>=5.0.0; extra == 'dev'
Requires-Dist: pytest-mock>=3.14.0; extra == 'dev'
Requires-Dist: pytest>=8.0.0; extra == 'dev'
Requires-Dist: ruff>=0.6.0; extra == 'dev'
Provides-Extra: docs
Requires-Dist: mkdocs-autorefs>=1.0.0; extra == 'docs'
Requires-Dist: mkdocs-material>=9.5.0; extra == 'docs'
Requires-Dist: mkdocs>=1.6.0; extra == 'docs'
Requires-Dist: mkdocstrings[python]>=0.25.0; extra == 'docs'
Provides-Extra: full-stack
Requires-Dist: aeon-ai>=0.2.0; extra == 'full-stack'
Requires-Dist: entropy-governance>=0.1.0; extra == 'full-stack'
Requires-Dist: genesis-os>=0.2.0; extra == 'full-stack'
Requires-Dist: sigillin>=0.1.0; extra == 'full-stack'
Requires-Dist: unified-mandala>=0.2.0; extra == 'full-stack'
Requires-Dist: universums-sim>=0.1.0; extra == 'full-stack'
Requires-Dist: utac-core>=0.1.0; extra == 'full-stack'
Description-Content-Type: text/markdown

[![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.19191015.svg)](https://doi.org/10.5281/zenodo.19191015)
[![PyPI version](https://img.shields.io/pypi/v/worldview)](https://pypi.org/project/worldview/)
[![Tests](https://img.shields.io/badge/tests-99.59%25-green)](https://github.com/GenesisAeon/worldview/actions)

# worldview

**Philosophisch-ethischer Layer mit normativen Metriken, Kritikalität & Gemeinwohl-Alignment**

Version 0.1.0 – GenesisAeon Project
**DOI**: 10.5281/zenodo.19191015
**Zenodo Record**: https://zenodo.org/records/19191015

WorldviewEngine + CriticalityChecker (CREP + 12 Regeln) + AlignmentFramework (Personhood 0–6) + normative Metriken. Built with diamond-setup --template genesis.

---

## Overview

`worldview` is the philosophical-ethical assessment layer of the
[GenesisAeon](https://github.com/GenesisAeon) ecosystem. It provides:

- **WorldviewEngine** — computes five normative metrics (Coherence, Resonance,
  Emergence, Poetics, Criticality) and a composite **Common-Good Alignment** score.
- **CriticalityChecker** — runs the *Critical Reflexive Evaluation Protocol*
  (CREP) to detect logical contradictions, ethical blindspots, and worldview
  incoherence.
- **AlignmentFramework** — evaluates entities against the *GenesisAeon Normative
  Framework* (GNF v0.2) across six Common-Good dimensions, with Personhood-Level
  assessment.
- **Typer CLI** — `worldview assess`, `worldview critique`, `worldview align`,
  `worldview info` — all JSON-exportable.

---

## Mathematical Framework

Let $W$ be a worldview represented as $n$ propositional clusters
$\{w_1, \ldots, w_n\}$.

### Coherence $C(W)$

$$C(W) = \frac{1}{1 + \sigma_c} \cdot \frac{\sum_{i=1}^{n} \alpha_i \cdot c_i}{\sum_{i=1}^{n} \alpha_i}$$

where $c_i \in [0,1]$ is the internal consistency of cluster $i$, $\alpha_i$ is
its weight, and $\sigma_c$ is the cross-cluster contradiction standard deviation.

### Resonance $R(W)$

$$R(W) = \int_0^1 \varphi(t)\,\psi(t)\,\mathrm{d}t \;\approx\; \sum_{k} \varphi_k \psi_k \,\Delta t$$

where $\varphi(t)$ is the epistemic frequency waveform and $\psi(t)$ is the
normative attractor waveform.

### Emergence $E(W)$

$$E(W) = H(W) - \sum_{i=1}^{n} H(W_i)$$

where $H$ denotes Shannon entropy. Positive $E$ signals genuine emergent
structure beyond the sum of parts.

### Poetics $P(W)$

$$P(W) = \exp\!\left(-\lambda \cdot D_{\mathrm{KL}}\!\left(W \;\|\; W^*\right)\right)$$

where $W^*$ is the ideal poetic attractor and $\lambda$ is the aesthetic
sensitivity parameter.

### Criticality $K(W)$

$$K(W) = \frac{\partial R}{\partial C} \cdot \left(1 - \left|\frac{\partial E}{\partial t}\right|\right)$$

High criticality indicates a worldview at a productive phase transition — neither
too rigid nor too chaotic.

### Common-Good Alignment $G(W)$

$$G(W) = \alpha C(W) + \beta R(W) + \gamma E(W) + \delta P(W) + \varepsilon K(W)$$

with $\alpha + \beta + \gamma + \delta + \varepsilon = 1$.

Default weights: $\alpha=0.25,\;\beta=0.20,\;\gamma=0.20,\;\delta=0.15,\;\varepsilon=0.20$.

### Common-Good Metric $G_\text{norm}(e)$

For entity $e$:

$$G_\text{norm}(e) = \frac{\sum_{i} \alpha_i \cdot d_i(e)}{\sum_{i} \alpha_i}$$

across six dimensions: solidarity, sustainability, justice, freedom, dignity,
participation.

---

## Install

```bash
pip install worldview
# or with the full GenesisAeon stack:
pip install "worldview[full-stack]"
# or for development:
pip install "worldview[dev]"
```

---

## Quick Start

```python
from worldview import WorldviewEngine, CriticalityChecker, AlignmentFramework, PersonhoodLevel

# 1. Assess a worldview
engine = WorldviewEngine()
assessment = engine.assess(
    worldview_id="my-worldview",
    entropy=1.5,
    model_names=["gpt-4o", "claude-3"],
    kl_divergence=0.2,
)
print(f"Coherence:   {assessment.metrics.coherence:.3f}")
print(f"Common-Good: {assessment.metrics.common_good:.3f}")
print(f"Grade:       {assessment.grade}")

# 2. Critique with CREP rules
checker = CriticalityChecker()
report = checker.check(
    worldview_id="my-worldview",
    coherence=assessment.metrics.coherence,
    ethical_score=0.85,
    externality_index=0.9,
    common_good_score=assessment.metrics.common_good,
)
print(f"CREP passed: {report.passed}")
print(f"Flags:       {len(report.flags)}")

# 3. Evaluate Common-Good alignment
framework = AlignmentFramework()
metric = framework.evaluate(
    entity_id="my-agent",
    scores={
        "solidarity": 0.80,
        "sustainability": 0.75,
        "justice": 0.90,
        "freedom": 0.70,
        "dignity": 0.85,
        "participation": 0.65,
    },
    personhood_level=PersonhoodLevel.NORMATIVE,
)
print(f"Composite: {metric.composite_score:.3f}  Grade: {metric.grade}")
```

---

## CLI

```bash
# Full normative assessment
worldview assess \
  --id "my-worldview" \
  --entropy 1.5 \
  --models gpt-4o --models llama-3 \
  --kl 0.2 \
  --visualize \
  --export result.json

# CREP critique
worldview critique \
  --coherence 0.8 \
  --ethical-score 0.9 \
  --externality-index 0.85 \
  --export critique.json

# Common-Good alignment
worldview align \
  --entity my-agent \
  --scores solidarity=0.8 \
  --scores justice=0.9 \
  --personhood 5 \
  --export align.json

# Package info
worldview info
```

---

## CREP Rules

The **Critical Reflexive Evaluation Protocol** (CREP v0.3) includes 12
built-in rules:

| Ref      | Category               | Description                                      |
|----------|------------------------|--------------------------------------------------|
| CREP-L1  | Logical Consistency    | Direct propositional contradictions              |
| CREP-L2  | Logical Consistency    | Cross-cluster incompatibilities                  |
| CREP-E1  | Ethical Implication    | Neglected third-party externalities              |
| CREP-E2  | Ethical Implication    | Deontological-consequentialist conflict          |
| CREP-E3  | Ethical Implication    | Absence of distributive-justice consideration    |
| CREP-C1  | Worldview Coherence    | Counterfactual reversal stress test              |
| CREP-C2  | Worldview Coherence    | Metaphysical consistency                         |
| CREP-S1  | Scope Validity         | Over-generalisation of local truths              |
| CREP-T1  | Temporal Consistency   | Anachronistic or revisionist claims              |
| CREP-A1  | Anthropocentric Bias   | Non-human agency ignored                         |
| CREP-H1  | Epistemic Humility     | Overconfidence without uncertainty               |
| CREP-N1  | Normative Alignment    | GenesisAeon normative framework compliance       |

---

## Personhood Levels (GNF v0.2)

| Level | Label                  | Moral Agency | Self-Model |
|-------|------------------------|:------------:|:----------:|
| 0     | Non-Entity             | —            | —          |
| 1     | Reactive               | —            | —          |
| 2     | Adaptive               | —            | —          |
| 3     | Self-Modelling         | —            | ✓          |
| 4     | Reflective             | —            | ✓          |
| 5     | Normative (Moral Agent)| ✓            | ✓          |
| 6     | Transcendent           | ✓            | ✓          |

---

## GenesisAeon Ecosystem

`worldview` integrates with the full GenesisAeon stack via `[full-stack]`:

| Package              | Version  | Role                                      |
|----------------------|----------|-------------------------------------------|
| `unified-mandala`    | ≥ 0.2.0  | Symbolic integration layer                |
| `aeon-ai`            | ≥ 0.2.0  | AI coordination framework                 |
| `genesis-os`         | ≥ 0.2.0  | Operating system layer                    |
| `universums-sim`     | ≥ 0.1.0  | Universe simulation engine                |
| `entropy-governance` | ≥ 0.1.0  | Entropy management                        |
| `sigillin`           | ≥ 0.1.0  | Sigil symbolic layer (CREP bridge)        |
| `utac-core`          | ≥ 0.1.0  | Universal Task Allocation Core            |

---

## Scientific Citation

```bibtex
@software{genesisaeon_worldview_2024,
  author    = {GenesisAeon},
  title     = {worldview: Philosophical-Ethical Worldview Layer v0.1.0},
  year      = {2024},
  publisher = {Zenodo},
  doi       = {10.5281/zenodo.19191015},
  url       = {https://doi.org/10.5281/zenodo.19191015}
}
```

---

## Development

```bash
git clone https://github.com/GenesisAeon/worldview.git
cd worldview
pip install -e ".[dev]"
pytest --cov=worldview        # 237 tests, 99.5% coverage
ruff check src tests
mypy src
```

---

Built with [Typer](https://typer.tiangolo.com/) ·
[Rich](https://rich.readthedocs.io/) ·
[Pydantic v2](https://docs.pydantic.dev/) ·
[NumPy](https://numpy.org/) ·
[SciPy](https://scipy.org/)
