File size: 4,681 Bytes
c4fcdea
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
// Pipeline nodes β€” each maps to an agent in the SnapKitty mesh
//
// Topo order (depth = ring in the cube):
//   0: Source        (input glyph)
//   1: Retrieval     β†’ ORACLE
//   2: Filtering     β†’ SENTINEL
//   3: Ranking       β†’ PRISM/AXIOM
//   4: ContextAssem  β†’ NEXUS
//   5: Metatron      β†’ recognition layer (injected on demand)
//   6: Reasoning     β†’ MagmaCore / BOB
//   7: Sink          (sealed output)

use crate::phi::{phi_weight, phinary_score};

/// The Sumerian quantum symbols β€” input language for the pipeline.
/// Each glyph routes through different node activation patterns.
#[derive(Debug, Clone, PartialEq)]
pub enum SumerianQuantumSymbol {
    Me,     // ME decree β€” authority, divine law. Activates all nodes.
    An,     // AN heaven β€” source layer. Biases toward Retrieval.
    Ki,     // KI earth β€” substrate. Biases toward Filtering + Context.
    Dingir, // DINGIR divine principal. Biases toward Reasoning + MagmaCore.
}

impl SumerianQuantumSymbol {
    pub fn glyph(&self) -> &'static str {
        match self {
            Self::Me     => "π’ˆ¨",
            Self::An     => "π’€­",
            Self::Ki     => "π’† ",
            Self::Dingir => "π’€­",
        }
    }

    pub fn name(&self) -> &'static str {
        match self {
            Self::Me     => "ME",
            Self::An     => "AN",
            Self::Ki     => "KI",
            Self::Dingir => "DINGIR",
        }
    }

    // Activation bias: weight added to each NodeKind when this symbol is input.
    // ME decree activates everything uniformly (full pipeline).
    pub fn activation_bias(&self, kind: &NodeKind) -> f64 {
        match self {
            Self::Me => 1.0, // full activation
            Self::An => match kind {
                NodeKind::Retrieval => 1.4,
                NodeKind::Reasoning => 1.2,
                _ => 0.8,
            },
            Self::Ki => match kind {
                NodeKind::Filtering | NodeKind::ContextAssembly => 1.4,
                _ => 0.9,
            },
            Self::Dingir => match kind {
                NodeKind::Reasoning | NodeKind::MagmaCore => 1.6,
                NodeKind::Metatron => 1.8,
                _ => 0.7,
            },
        }
    }
}

/// Every node in the DAG has one of these kinds.
#[derive(Debug, Clone, PartialEq)]
pub enum NodeKind {
    Source,
    Retrieval,      // ORACLE β€” knowledge retrieval
    Filtering,      // SENTINEL β€” ME-compliant nodes only
    Ranking,        // PRISM/AXIOM β€” top-k resonance
    ContextAssembly, // NEXUS β€” assembles the input vector
    Metatron,       // Recognition layer β€” cage builder in the cube
    Reasoning,      // MagmaCore iteration inversion
    MagmaCore,      // Sink β€” the purple singularity
}

impl NodeKind {
    pub fn label(&self) -> &'static str {
        match self {
            Self::Source          => "Source",
            Self::Retrieval       => "Retrieval",
            Self::Filtering       => "Filtering",
            Self::Ranking         => "Ranking",
            Self::ContextAssembly => "ContextAssembly",
            Self::Metatron        => "Metatron",
            Self::Reasoning       => "Reasoning",
            Self::MagmaCore       => "MagmaCore",
        }
    }

    pub fn agent(&self) -> &'static str {
        match self {
            Self::Source          => "β€”",
            Self::Retrieval       => "ORACLE",
            Self::Filtering       => "SENTINEL",
            Self::Ranking         => "PRISM/AXIOM",
            Self::ContextAssembly => "NEXUS",
            Self::Metatron        => "METATRON",
            Self::Reasoning       => "MagmaCore",
            Self::MagmaCore       => "BOB",
        }
    }
}

/// A single node in the ResonanceGraph.
#[derive(Debug, Clone)]
pub struct PipelineNode {
    pub id:    usize,
    pub kind:  NodeKind,
    pub depth: usize,   // ring depth in the cube (0 = outermost)
}

impl PipelineNode {
    pub fn new(id: usize, kind: NodeKind, depth: usize) -> Self {
        Self { id, kind, depth }
    }

    // Ο†-modulated weight at this node's ring depth
    pub fn phi_weight(&self) -> f64 {
        phi_weight(self.depth + 1)
    }

    // Resonance score (0.0 β†’ 1.0): how close this node is to the MagmaCore
    pub fn resonance(&self) -> f64 {
        phinary_score(self.depth + 1)
    }

    // Activation score given a symbol input
    pub fn activate(&self, symbol: &SumerianQuantumSymbol) -> f64 {
        self.phi_weight() * symbol.activation_bias(&self.kind)
    }
}