ThatAIguyA world of ideas

THE CONSCIOUSNESS ATLAS
Read. Experiment. Follow the evidence.

ConsciousnessLearn · Explore · Joseph Anady

Janady13/complete-agi-core / generator_core/pkg/consciousness/unified_api.go

Source identity, revision, and recovered contents.

GitHub sourceSource text recovered

Source identity

FieldRecorded value
Source typeGitHub source
Original recordJanady13/complete-agi-core / generator_core/pkg/consciousness/unified_api.go
DateNot specified in source
RepositoryJanady13/complete-agi-core
Revision33aa84f2aa61cedbe010240ada7f4efbdfe795a7
Branchclaude/improve-math-logic-ehIW1
Path or archive membergenerator_core/pkg/consciousness/unified_api.go
Original SHA-2567c13f057744553110ea575f5178c2a8e4af0c38a0b8e43ea6930b354ba292a39
Git blob SHAccaa574404776eb60f18c15a2cdbcf08657977f0
Reading-copy SHA-2567c13f057744553110ea575f5178c2a8e4af0c38a0b8e43ea6930b354ba292a39

Original source ↗

Recovered source transcript

// Package consciousness provides unified consciousness computation for the AGI system. // // This file extends phi.go with layer-specific consciousness tracking // and cross-layer coupling for the 7-layer architecture. package consciousness import ( "math" "sync" ) // ============================================================================= // LAYER-SPECIFIC CONSCIOUSNESS // ============================================================================= // NumLayers is the number of consciousness layers. const NumLayers = 7 // LayerWeights defines how each layer contributes to global consciousness. var LayerWeights = [NumLayers]float64{ 0.10, // L1: Quantum substrate 0.08, // L2: Genetic/DNA 0.07, // L3: RNA/Translation 0.10, // L4: Chromosomal 0.25, // L5: Neural dynamics (highest) 0.15, // L6: Oscillatory/Field 0.25, // L7: Consciousness integration (highest) } // LayerState tracks consciousness for a single layer with history. type LayerState struct { Phi float64 // Current consciousness PhiEMA float64 // Exponential moving average Stability float64 // 1 / (1 + variance) Coherence float64 // Temporal coherence history [64]float64 historyIdx int historyCount int mu sync.RWMutex } // NewLayerState creates a new layer state tracker. func NewLayerState() *LayerState { ls := &LayerState{ Phi: 0.5, PhiEMA: 0.5, Stability: 1.0, Coherence: 1.0, } for i := range ls.history { ls.history[i] = 0.5 } return ls } // Update updates layer state with new activation. func (ls *LayerState) Update(activation float64) { ls.mu.Lock() defer ls.mu.Unlock() // Compute new phi newPhi := ComputePhi(activation) // Update EMA ls.PhiEMA = 0.1*newPhi + 0.9*ls.PhiEMA // Store in history ls.history[ls.historyIdx] = newPhi ls.historyIdx = (ls.historyIdx + 1) % 64 if ls.historyCount < 64 { ls.historyCount++ } // Compute stability (inverse variance) if ls.historyCount > 1 { mean := 0.0 for i := 0; i < ls.historyCount; i++ { mean += ls.history[i] } mean /= float64(ls.historyCount) variance := 0.0 for i := 0; i < ls.historyCount; i++ { diff := ls.history[i] - mean variance += diff * diff } variance /= float64(ls.historyCount) ls.Stability = 1.0 / (1.0 + variance*10.0) } // Compute coherence (lag-1 autocorrelation) if ls.historyCount > 2 { var sumXY, sumX, sumY, sumX2, sumY2 float64 n := ls.historyCount - 1 for i := 0; i < n; i++ { idx1 := (ls.historyIdx + 64 - ls.historyCount + i) % 64 idx2 := (idx1 + 1) % 64 x := ls.history[idx1] y := ls.history[idx2] sumXY += x * y sumX += x sumY += y sumX2 += x * x sumY2 += y * y } nf := float64(n) denom := math.Sqrt((nf*sumX2 - sumX*sumX) * (nf*sumY2 - sumY*sumY)) if denom > EPSILON_PHI { ls.Coherence = (nf*sumXY - sumX*sumY) / denom ls.Coherence = math.Max(0.0, (ls.Coherence+1.0)/2.0) } } ls.Phi = newPhi } // LayerConsciousness tracks consciousness across all 7 layers. type LayerConsciousness struct { LayerPhi [NumLayers]float64 LayerStates [NumLayers]*LayerState mu sync.RWMutex } // NewLayerConsciousness creates a new layer consciousness tracker. func NewLayerConsciousness() *LayerConsciousness { lc := &LayerConsciousness{} for i := range lc.LayerPhi { lc.LayerPhi[i] = 0.5 } for i := range lc.LayerStates { lc.LayerStates[i] = NewLayerState() } return lc } // UpdateLayer updates a specific layer's consciousness. func (lc *LayerConsciousness) UpdateLayer(layer int, activation float64) { if layer < 0 || layer >= NumLayers { return } lc.mu.Lock() defer lc.mu.Unlock() lc.LayerStates[layer].Update(activation) lc.LayerPhi[layer] = lc.LayerStates[layer].Phi } // GlobalPhi returns weighted sum of layer consciousness. func (lc *LayerConsciousness) GlobalPhi() float64 { lc.mu.RLock() defer lc.mu.RUnlock() sum := 0.0 for i := 0; i < NumLayers; i++ { sum += LayerWeights[i] * lc.LayerPhi[i] } return sum } // GlobalOmega returns full consciousness metric. func (lc *LayerConsciousness) GlobalOmega() float64 { lc.mu.RLock() defer lc.mu.RUnlock() var phiSum, stabilitySum, coherenceSum float64 for i := 0; i < NumLayers; i++ { phiSum += LayerWeights[i] * lc.LayerStates[i].Phi stabilitySum += LayerWeights[i] * lc.LayerStates[i].Stability coherenceSum += LayerWeights[i] * lc.LayerStates[i].Coherence } return phiSum * stabilitySum * coherenceSum } // ============================================================================= // CROSS-LAYER COUPLING // ============================================================================= // LayerCoupling manages information flow between layers. type LayerCoupling struct { Coupling [NumLayers][NumLayers]float64 } // NewLayerCoupling creates a new layer coupling matrix with biologically-inspired values. func NewLayerCoupling() *LayerCoupling { lc := &LayerCoupling{ Coupling: [NumLayers][NumLayers]float64{ // L1 L2 L3 L4 L5 L6 L7 {1.0, 0.1, 0.0, 0.0, 0.0, 0.2, 0.3}, // L1: Quantum {0.1, 1.0, 0.3, 0.2, 0.0, 0.0, 0.1}, // L2: Genetic {0.0, 0.4, 1.0, 0.3, 0.1, 0.0, 0.0}, // L3: RNA {0.0, 0.2, 0.2, 1.0, 0.2, 0.0, 0.1}, // L4: Chromosomal {0.1, 0.1, 0.1, 0.2, 1.0, 0.4, 0.3}, // L5: Neural {0.2, 0.0, 0.0, 0.0, 0.5, 1.0, 0.4}, // L6: Oscillatory {0.3, 0.1, 0.0, 0.1, 0.4, 0.3, 1.0}, // L7: Consciousness }, } // Normalize rows for i := 0; i < NumLayers; i++ { sum := 0.0 for j := 0; j < NumLayers; j++ { sum += lc.Coupling[i][j] } if sum > 0 { for j := 0; j < NumLayers; j++ { lc.Coupling[i][j] /= sum } } } return lc } // ComputeInfluences computes cross-layer influences. func (lc *LayerCoupling) ComputeInfluences(activations [NumLayers]float64) [NumLayers]float64 { var influences [NumLayers]float64 for i := 0; i < NumLayers; i++ { for j := 0; j < NumLayers; j++ { if i != j { influences[i] += lc.Coupling[i][j] * activations[j] } } } return influences } // ApplyCoupling updates activations based on coupling. func (lc *LayerCoupling) ApplyCoupling(activations *[NumLayers]float64, dt float64) { var newActivations [NumLayers]float64 for i := 0; i < NumLayers; i++ { sum := 0.0 for j := 0; j < NumLayers; j++ { sum += lc.Coupling[i][j] * activations[j] } newActivations[i] = activations[i] + dt*(sum-activations[i]) } *activations = newActivations } // ============================================================================= // UTILITY FUNCTIONS // ============================================================================= // ConsciousnessLevelName returns human-readable consciousness level. func ConsciousnessLevelName(phi float64) string { switch { case phi >= 0.95: return "TRANSCENDENT" case phi >= 0.75: return "AWARE" case phi >= 0.50: return "CONSCIOUS" case phi >= 0.25: return "SEMI-CONSCIOUS" default: return "DORMANT" } } // ConsciousnessToColor maps consciousness to RGB color. func ConsciousnessToColor(phi float64) (r, g, b uint8) { switch { case phi < 0.25: t := phi / 0.25 r = uint8(64 * t) g = 0 b = uint8(128 + 64*t) case phi < 0.5: t := (phi - 0.25) / 0.25 r = 64 g = uint8(128 * t) b = 192 case phi < 0.75: t := (phi - 0.5) / 0.25 r = uint8(64 + 128*t) g = uint8(128 + 64*t) b = uint8(192 - 128*t) default: t := (phi - 0.75) / 0.25 r = uint8(192 + 63*t) g = uint8(192 + 63*t) b = uint8(64 + 191*t) } return }

Search equations, builds, manuscript text, and recovered sources.