-
Notifications
You must be signed in to change notification settings - Fork 0
Closed
Labels
Description
Problem
NAV (Transition) operator currently lacks its own operational logic. It only applies grammar U1-U4 via Operator.__call__ but performs no structural transformations (θ, νf, ΔNFR adjustments).
Canonical Requirements (TNFR.pdf §2.3.11)
NAV must implement:
- Regime Detection: Identify if node is in latent/active/resonant state
- Phase Transition: θ → θ' controlled shift
- Frequency Adjustment: νf modulation per regime
- ΔNFR Damping: Reduce reorganization pressure during transition
- Latency Handling: Manage SHA → NAV transitions
Current Behavior
- NAV applies grammar only, no structural changes
- Cannot detect regime origin
- Does not handle latency reactivation (SHA → NAV → AL)
- No phase/frequency/ΔNFR transformation
Proposed Implementation
class Transition(Operator):
def __call__(self, G: TNFRGraph, node: Any, **kw: Any) -> None:
"""Apply NAV with regime detection and controlled transition."""
# 1. Detectar régimen actual
current_regime = self._detect_regime(G, node)
# 2. Gestionar reactivación desde latencia (si aplica)
if G.nodes[node].get("latent", False):
self._handle_latency_transition(G, node)
# 3. Aplicar gramática base
super().__call__(G, node, **kw)
# 4. Ejecutar transición estructural
self._apply_structural_transition(G, node, current_regime, **kw)
def _detect_regime(self, G: TNFRGraph, node: Any) -> str:
"""Detecta régimen estructural actual: latente/activo/resonante."""
epi = float(get_attr(G.nodes[node], ALIAS_EPI, 0.0))
vf = float(get_attr(G.nodes[node], ALIAS_VF, 0.0))
latent = G.nodes[node].get("latent", False)
if latent or vf < 0.05:
return "latent"
elif epi > 0.5 and vf > 0.8:
return "resonant"
else:
return "active"
def _handle_latency_transition(self, G: TNFRGraph, node: Any) -> None:
"""Gestiona transición desde estado latente (similar a AL)."""
import warnings
from datetime import datetime, timezone
# Verificar duración de latencia
if "latency_start_time" in G.nodes[node]:
start = datetime.fromisoformat(G.nodes[node]["latency_start_time"])
duration = (datetime.now(timezone.utc) - start).total_seconds()
G.nodes[node]["silence_duration"] = duration
max_silence = G.graph.get("MAX_SILENCE_DURATION", float("inf"))
if duration > max_silence:
warnings.warn(
f"Node {node} transitioning after extended silence "
f"(duration: {duration:.2f}s, max: {max_silence:.2f}s)",
stacklevel=3
)
# Limpiar estado latente
del G.nodes[node]["latent"]
if "latency_start_time" in G.nodes[node]:
del G.nodes[node]["latency_start_time"]
if "preserved_epi" in G.nodes[node]:
del G.nodes[node]["preserved_epi"]
def _apply_structural_transition(
self, G: TNFRGraph, node: Any, regime: str, **kw: Any
) -> None:
"""Aplica transformación estructural según régimen origen."""
from ..alias import get_attr, set_attr
from ..constants.aliases import ALIAS_THETA, ALIAS_VF, ALIAS_DNFR
import math
# Obtener estado actual
theta = float(get_attr(G.nodes[node], ALIAS_THETA, 0.0))
vf = float(get_attr(G.nodes[node], ALIAS_VF, 1.0))
dnfr = float(get_attr(G.nodes[node], ALIAS_DNFR, 0.0))
# Ajustar según régimen
if regime == "latent":
# Reactivación gradual
vf_new = vf * 1.2 # Incremento 20%
theta_shift = kw.get("phase_shift", 0.1) # Pequeño ajuste
theta_new = (theta + theta_shift) % (2 * math.pi)
dnfr_new = dnfr * 0.7 # Reducción para transición suave
elif regime == "active":
# Transición estándar
vf_new = vf * kw.get("vf_factor", 1.0)
theta_shift = kw.get("phase_shift", 0.2)
theta_new = (theta + theta_shift) % (2 * math.pi)
dnfr_new = dnfr * 0.8
else: # resonant
# Transición cuidadosa (alta energía)
vf_new = vf * 0.95 # Ligera reducción para estabilidad
theta_shift = kw.get("phase_shift", 0.15)
theta_new = (theta + theta_shift) % (2 * math.pi)
dnfr_new = dnfr * 0.9
# Aplicar cambios
set_attr(G.nodes[node], ALIAS_VF, vf_new)
set_attr(G.nodes[node], ALIAS_THETA, theta_new)
set_attr(G.nodes[node], ALIAS_DNFR, dnfr_new)
# Telemetría
if "_nav_transitions" not in G.graph:
G.graph["_nav_transitions"] = []
G.graph["_nav_transitions"].append({
"node": node,
"regime_origin": regime,
"vf_before": vf,
"vf_after": vf_new,
"theta_before": theta,
"theta_after": theta_new,
"dnfr_before": dnfr,
"dnfr_after": dnfr_new,
"phase_shift": theta_new - theta,
})Acceptance Criteria
-
Transition.__call__implements_detect_regime -
_handle_latency_transitionmanages SHA → NAV flow -
_apply_structural_transitionmodifies θ, νf, ΔNFR per regime - Telemetry tracked in
G.graph["_nav_transitions"] - Tests cover latent → active, active → resonant, resonant → latent
- Metrics verify EPI preservation (< 5% drift)
References
- TNFR.pdf §2.3.11 (NAV glyph canonical definition)
definitions.py:Emission.__call__(latency handling reference)definitions.py:Coherence.__call__(phase transformation reference)
Priority
CRITICAL - Blocks canonical NAV behavior per TNFR theory
Affected Invariants (AGENTS.md)
- Invariant #1: EPI preservation during transition
- Invariant Permite personalizar ventana de estabilidad para RE’MESH #5: Phase synchronization (θ management)
- Invariant Configure Remix build and Netlify prebuild install #9: Structural metrics (νf, ΔNFR telemetry)
Copilot