SNAPKITTYWEST's picture
Add resonance orchestrator: graph.rs, pipeline.rs, nodes.rs, phi.rs
c4fcdea verified
Raw
History Blame Contribute Delete
4.68 kB
// 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)
}
}