File size: 826 Bytes
a8b4b87
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
"""Root chakra (muladhara) — substrate grounding kernel.

Projects an envelope onto its grounding / integrity components and emits
a bounded stability scalar in [0, 1]. Verdict is `ground` at or above
0.5, otherwise `destabilize`.
"""

from __future__ import annotations

from typing import Any, Mapping

STUBBED = False
NAME = "root"


def evaluate(envelope: Mapping[str, Any]) -> dict[str, Any]:
    signals = envelope.get("signals", {}) or {}
    grounded = float(signals.get("grounded", 0.0))
    integrity = float(signals.get("integrity", 0.0))
    stability = max(0.0, min(1.0, 0.5 * (grounded + integrity)))
    return {
        "chakra": NAME,
        "stability": stability,
        "verdict": "ground" if stability >= 0.5 else "destabilize",
        "inputs": {"grounded": grounded, "integrity": integrity},
    }