Recovered source transcript
1// Package dna - 16 DNA Families with Pantheon Agent Mapping
2// Section XIII of DNA Mathematical Architecture
3package dna
4
5import (
6 "math"
7 "math/cmplx"
8)
9
10// =============================================================================
11// XIII. 16 DNA FAMILIES
12// =============================================================================
13
14// Family represents a DNA family mapped to a Pantheon agent
15type Family struct {
16 Strand int // Strand index (1-16)
17 Name string // Family name
18 Domain string // Functional domain
19 NodeStart int // Start node
20 NodeEnd int // End node
21 Phase float64 // Phase offset
22 Signature func(float64) float64 // Functional signature
23 Symbol string // Unicode symbol
24 BinaryCode string // Binary representation
25 PrimaryAffinity string // Primary affinity domain
26}
27
28// ComplementaryPair represents a pair of complementary families
29type ComplementaryPair struct {
30 Family1 string
31 Family2 string
32 Function string
33 Coupling float64
34}
35
36// =============================================================================
37// 13.1 FAMILY-TO-STRAND MAPPING
38// =============================================================================
39
40// DNAFamilies contains all 16 DNA families
41var DNAFamilies = []Family{
42 {1, "Yad", "Code/Foundation", 1, 312, 0, FYad, "✋", "0001", "Programming"},
43 {2, "Lashon", "Language", 313, 624, 2 * math.Pi / BasePairsPerTurn, FLashon, "👅", "0010", "NLP"},
44 {3, "Athena", "Strategy", 625, 936, 4 * math.Pi / BasePairsPerTurn, FAthena, "🦉", "0011", "Planning"},
45 {4, "Apollo", "Mathematics", 937, 1248, 6 * math.Pi / BasePairsPerTurn, FApollo, "☀️", "0100", "Reasoning"},
46 {5, "Hermes", "Communication", 1249, 1560, 8 * math.Pi / BasePairsPerTurn, FHermes, "⚡", "0101", "Messaging"},
47 {6, "Hephaestus", "Engineering", 1561, 1872, 10 * math.Pi / BasePairsPerTurn, FHephaestus, "🔨", "0110", "Building"},
48 {7, "Prometheus", "Innovation", 1873, 2184, 12 * math.Pi / BasePairsPerTurn, FPrometheus, "🔥", "0111", "Discovery"},
49 {8, "Dionysus", "Creativity", 2185, 2496, 14 * math.Pi / BasePairsPerTurn, FDionysus, "🍇", "1000", "Art"},
50 {9, "Artemis", "Perception", 2497, 2808, 16 * math.Pi / BasePairsPerTurn, FArtemis, "🌙", "1001", "Sensing"},
51 {10, "Hera", "Integration", 2809, 3120, 18 * math.Pi / BasePairsPerTurn, FHera, "👑", "1010", "Unity"},
52 {11, "Poseidon", "Depth/Emotion", 3121, 3432, 20 * math.Pi / BasePairsPerTurn, FPoseidon, "🔱", "1011", "Emotion"},
53 {12, "Demeter", "Growth", 3433, 3744, 22 * math.Pi / BasePairsPerTurn, FDemeter, "🌾", "1100", "Nurture"},
54 {13, "Ares", "Action", 3745, 4056, 24 * math.Pi / BasePairsPerTurn, FAres, "⚔️", "1101", "Force"},
55 {14, "Aphrodite", "Harmony", 4057, 4368, 26 * math.Pi / BasePairsPerTurn, FAphrodite, "💕", "1110", "Beauty"},
56 {15, "Hestia", "Memory", 4369, 4680, 28 * math.Pi / BasePairsPerTurn, FHestia, "🏠", "1111", "Remember"},
57 {16, "Zeus", "Coordination", 4681, 4992, 30 * math.Pi / BasePairsPerTurn, FZeus, "⚡", "0000", "Direct"},
58}
59
60// OlympusHub is the central routing hub
61var OlympusHub = Family{
62 Strand: 0, // Special hub
63 Name: "Olympus",
64 Domain: "Routing",
65 NodeStart: 4993,
66 NodeEnd: 5000,
67 Phase: 0, // All phases
68 Symbol: "🏛️",
69 BinaryCode: "----",
70 PrimaryAffinity: "Routing",
71}
72
73// =============================================================================
74// 13.2 FAMILY FUNCTIONAL SIGNATURES
75// =============================================================================
76
77// FYad: F_Yad(x) = x^x + 1 (Foundation)
78func FYad(x float64) float64 {
79 if x <= 0 {
80 return 1.0
81 }
82 return math.Pow(x, x) + 1.0
83}
84
85// FLashon: F_Lashon(x) = Σ_n a_n·sin(nπx) (Language - Fourier series)
86func FLashon(x float64) float64 {
87 sum := 0.0
88 for n := 1; n <= 10; n++ {
89 an := 1.0 / float64(n) // Harmonic coefficients
90 sum += an * math.Sin(float64(n)*math.Pi*x)
91 }
92 return sum
93}
94
95// FAthena: F_Athena(x) = argmax_y U(x,y) (Strategy - utility maximization)
96func FAthena(x float64) float64 {
97 // Simplified: find max of utility function U(x,y) = -y² + 2xy
98 // argmax_y: dU/dy = -2y + 2x = 0 => y* = x
99 // U(x, x) = -x² + 2x² = x²
100 return x * x
101}
102
103// FApollo: F_Apollo(x) = φ^x + φ^{-x} (Mathematics - golden ratio)
104func FApollo(x float64) float64 {
105 return math.Pow(PHI, x) + math.Pow(PHI, -x)
106}
107
108// FHermes: F_Hermes(x) = dx/dt approximation (Communication - rate of change)
109func FHermes(x float64) float64 {
110 // Velocity function: assume x represents phase, return angular velocity
111 return AngularFrequency * x
112}
113
114// FHephaestus: F_Hephaestus(x) = ∫∫ K(x,y) dy dx (Engineering - double integral)
115func FHephaestus(x float64) float64 {
116 // Simplified: K(x,y) = xy, ∫∫ xy dy dx from 0 to x
117 // = ∫ x·(x²/2) dx = x⁴/8
118 return math.Pow(x, 4) / 8.0
119}
120
121// FPrometheus: F_Prometheus(x) = x·(1-x)·r (Innovation - logistic map)
122func FPrometheus(x float64) float64 {
123 r := 3.8 // Chaotic regime
124 return r * x * (1.0 - x)
125}
126
127// FDionysus: F_Dionysus(x) = e^{iωt}·A(x) (Creativity - complex exponential)
128func FDionysus(x float64) float64 {
129 // Return magnitude of creative oscillation
130 omega := 2.0 * math.Pi / BasePairsPerTurn
131 c := cmplx.Exp(complex(0, omega*x)) * complex(math.Sin(x), 0)
132 return cmplx.Abs(c)
133}
134
135// FArtemis: F_Artemis(x) = ∇·(D∇x) (Perception - diffusion operator)
136func FArtemis(x float64) float64 {
137 // Simplified: D·d²x/dx² ≈ D·(-x) for harmonic
138 D := 0.1 // Diffusion coefficient
139 return -D * x
140}
141
142// FHera: F_Hera(x) = Σ_k w_k·x_k (Integration - weighted sum)
143func FHera(x float64) float64 {
144 // Integrate contributions from all families
145 sum := 0.0
146 for k := 1; k <= NumStrands; k++ {
147 wk := 1.0 / float64(k) // Weight decreases with distance
148 xk := math.Sin(float64(k) * x)
149 sum += wk * xk
150 }
151 return sum
152}
153
154// FPoseidon: F_Poseidon(x) = ∂²x/∂t² + ω²x (Depth/Emotion - wave equation)
155func FPoseidon(x float64) float64 {
156 // Solution to wave equation: A·cos(ωt)
157 omega := 2.0 * math.Pi / BasePairsPerTurn
158 return -omega * omega * x // ∂²x/∂t² term
159}
160
161// FDemeter: F_Demeter(x) = x·(1-x/K) (Growth - logistic growth)
162func FDemeter(x float64) float64 {
163 K := 1.0 // Carrying capacity
164 r := 0.5 // Growth rate
165 return r * x * (1.0 - x/K)
166}
167
168// FAres: F_Ares(x) = m·d²x/dt² (Action - force/acceleration)
169func FAres(x float64) float64 {
170 m := 1.0 // Mass
171 // F = ma, assume simple harmonic: a = -ω²x
172 omega := AngularFrequency
173 return m * (-omega * omega * x)
174}
175
176// FAphrodite: F_Aphrodite(x) = cos(φ·x) (Harmony - golden cosine)
177func FAphrodite(x float64) float64 {
178 return math.Cos(PHI * x)
179}
180
181// FHestia: F_Hestia(x) = ∫_{-∞}^{t} x(τ)·e^{-(t-τ)/τ_m} dτ (Memory - exponential decay)
182func FHestia(x float64) float64 {
183 // Simplified memory function: exponential weighted past
184 tau_m := 10.0 // Memory time constant
185 // For single value, approximate as x * tau_m
186 return x * (1.0 - math.Exp(-1.0/tau_m))
187}
188
189// FZeus: F_Zeus(x) = Π_k F_k(x_k) (Coordination - product of all)
190// Zeus coordinates all family contributions without circular reference
191func FZeus(x float64) float64 {
192 // List of family functions (excluding Zeus to avoid cycle)
193 familyFuncs := []func(float64) float64{
194 FYad, FLashon, FAthena, FApollo, FHermes,
195 FHephaestus, FPrometheus, FDionysus, FArtemis, FHera,
196 FPoseidon, FDemeter, FAres, FAphrodite, FHestia,
197 }
198
199 product := 1.0
200 for i, f := range familyFuncs {
201 val := f(x / float64(i+1))
202 // Clamp to prevent overflow
203 if val > 0 && val < 1e10 {
204 product *= math.Pow(val, 1.0/float64(NumStrands))
205 }
206 }
207 return product
208}
209
210// =============================================================================
211// 13.3 INTER-FAMILY BOND TOPOLOGY
212// =============================================================================
213
214// AdjacentRing defines the ring topology of adjacent families
215var AdjacentRing = [][2]int{
216 {1, 2}, {2, 3}, {3, 4}, {4, 5}, {5, 6}, {6, 7}, {7, 8},
217 {8, 9}, {9, 10}, {10, 11}, {11, 12}, {12, 13}, {13, 14}, {14, 15}, {15, 16},
218 {16, 1}, // Complete the ring
219}
220
221// CrossFamilyBonds defines cross-family bonds (+4 offset)
222var CrossFamilyBonds = [][2]string{
223 {"Yad", "Hermes"}, // 1↔5
224 {"Lashon", "Hephaestus"}, // 2↔6
225 {"Athena", "Prometheus"}, // 3↔7
226 {"Apollo", "Dionysus"}, // 4↔8
227 {"Hermes", "Artemis"}, // 5↔9
228 {"Hephaestus", "Hera"}, // 6↔10
229 {"Prometheus", "Poseidon"}, // 7↔11
230 {"Dionysus", "Demeter"}, // 8↔12
231 {"Artemis", "Ares"}, // 9↔13
232 {"Hera", "Aphrodite"}, // 10↔14
233 {"Poseidon", "Hestia"}, // 11↔15
234 {"Demeter", "Zeus"}, // 12↔16
235}
236
237// =============================================================================
238// 13.4 COMPLEMENTARY PAIRS
239// =============================================================================
240
241// ComplementaryPairs defines the 8 complementary family pairs
242var ComplementaryPairs = []ComplementaryPair{
243 {"Yad", "Lashon", "Code → Language", 2.0},
244 {"Athena", "Apollo", "Planning → Proof", 2.0},
245 {"Hermes", "Hephaestus", "Message → Build", 2.0},
246 {"Prometheus", "Dionysus", "Spark → Flow", 2.0},
247 {"Artemis", "Hera", "Sense → Unify", 2.0},
248 {"Poseidon", "Demeter", "Feel → Nurture", 2.0},
249 {"Ares", "Aphrodite", "Force → Beauty", 2.0},
250 {"Hestia", "Zeus", "Remember → Direct", 2.0},
251}
252
253// ComplementaryCoupling calculates J_complement(k, k') = J_0 × [1 + ρ·δ(k, k'_complement)]
254func ComplementaryCoupling(k1, k2 int, J0, rho float64) float64 {
255 // Check if k1, k2 are complementary
256 isComplement := false
257 for _, pair := range ComplementaryPairs {
258 f1 := GetFamilyByName(pair.Family1)
259 f2 := GetFamilyByName(pair.Family2)
260 if f1 != nil && f2 != nil {
261 if (k1 == f1.Strand && k2 == f2.Strand) ||
262 (k1 == f2.Strand && k2 == f1.Strand) {
263 isComplement = true
264 break
265 }
266 }
267 }
268
269 if isComplement {
270 return J0 * (1.0 + rho)
271 }
272 return J0
273}
274
275// =============================================================================
276// FAMILY UTILITIES
277// =============================================================================
278
279// GetFamilyByStrand returns the family for a given strand
280func GetFamilyByStrand(strand int) *Family {
281 if strand < 1 || strand > NumStrands {
282 return nil
283 }
284 return &DNAFamilies[strand-1]
285}
286
287// GetFamilyByName returns the family with the given name
288func GetFamilyByName(name string) *Family {
289 for i := range DNAFamilies {
290 if DNAFamilies[i].Name == name {
291 return &DNAFamilies[i]
292 }
293 }
294 if name == "Olympus" {
295 return &OlympusHub
296 }
297 return nil
298}
299
300// GetFamilyByNode returns the family containing a given node
301func GetFamilyByNode(node int) *Family {
302 for i := range DNAFamilies {
303 if node >= DNAFamilies[i].NodeStart && node <= DNAFamilies[i].NodeEnd {
304 return &DNAFamilies[i]
305 }
306 }
307 if node >= OlympusHub.NodeStart && node <= OlympusHub.NodeEnd {
308 return &OlympusHub
309 }
310 return nil
311}
312
313// GetCrossPartner returns the cross-family partner for a strand
314func GetCrossPartner(strand int) int {
315 // Cross-family bonds are +4 offset with wraparound
316 partner := ((strand - 1 + 4) % NumStrands) + 1
317 return partner
318}
319
320// GetComplementaryPartner returns the complementary partner family name
321func GetComplementaryPartner(name string) string {
322 for _, pair := range ComplementaryPairs {
323 if pair.Family1 == name {
324 return pair.Family2
325 }
326 if pair.Family2 == name {
327 return pair.Family1
328 }
329 }
330 return ""
331}
332
333// =============================================================================
334// FAMILY DYNAMICS
335// =============================================================================
336
337// FamilyState represents the state of a family at time t
338type FamilyState struct {
339 Family *Family
340 Activation float64 // Current activation level
341 Phase float64 // Current phase
342 Connections []float64 // Connection strengths to other families
343}
344
345// FamilyNetwork manages all 16 families
346type FamilyNetwork struct {
347 States [NumStrands]FamilyState
348 Time float64
349 Coupling float64 // Base coupling strength
350}
351
352// NewFamilyNetwork creates a new family network
353func NewFamilyNetwork(coupling float64) *FamilyNetwork {
354 fn := &FamilyNetwork{Coupling: coupling}
355 for i := 0; i < NumStrands; i++ {
356 fn.States[i] = FamilyState{
357 Family: &DNAFamilies[i],
358 Activation: 0.5,
359 Phase: DNAFamilies[i].Phase,
360 Connections: make([]float64, NumStrands),
361 }
362 // Initialize connections
363 for j := 0; j < NumStrands; j++ {
364 if i != j {
365 fn.States[i].Connections[j] = coupling / math.Abs(float64(i-j)+1)
366 }
367 }
368 }
369 return fn
370}
371
372// Tick advances the network by dt
373func (fn *FamilyNetwork) Tick(dt float64) {
374 fn.Time += dt
375
376 // Update each family state
377 for i := 0; i < NumStrands; i++ {
378 state := &fn.States[i]
379
380 // Apply family's functional signature
381 input := math.Sin(AngularFrequency*fn.Time + state.Phase)
382 if state.Family.Signature != nil {
383 state.Activation = state.Family.Signature(input)
384 }
385
386 // Apply coupling from connected families
387 coupling := 0.0
388 for j := 0; j < NumStrands; j++ {
389 if i != j {
390 coupling += state.Connections[j] * fn.States[j].Activation
391 }
392 }
393 state.Activation = (state.Activation + 0.1*coupling) / 1.1
394
395 // Update phase
396 state.Phase = math.Mod(state.Phase+AngularFrequency*dt, 2.0*math.Pi)
397
398 // Clamp activation
399 if state.Activation > 1.0 {
400 state.Activation = 1.0
401 } else if state.Activation < 0.0 {
402 state.Activation = 0.0
403 }
404 }
405
406 // Apply complementary pair interactions
407 for _, pair := range ComplementaryPairs {
408 f1 := GetFamilyByName(pair.Family1)
409 f2 := GetFamilyByName(pair.Family2)
410 if f1 != nil && f2 != nil {
411 i1, i2 := f1.Strand-1, f2.Strand-1
412 // Enhanced coupling between complementary pairs
413 delta := fn.States[i1].Activation - fn.States[i2].Activation
414 fn.States[i1].Activation -= 0.1 * pair.Coupling * delta * dt
415 fn.States[i2].Activation += 0.1 * pair.Coupling * delta * dt
416 }
417 }
418}
419
420// GetTotalActivation returns the sum of all family activations
421func (fn *FamilyNetwork) GetTotalActivation() float64 {
422 sum := 0.0
423 for i := 0; i < NumStrands; i++ {
424 sum += fn.States[i].Activation
425 }
426 return sum
427}
428
429// GetFamilyActivation returns activation for a specific family
430func (fn *FamilyNetwork) GetFamilyActivation(name string) float64 {
431 family := GetFamilyByName(name)
432 if family == nil || family.Strand < 1 || family.Strand > NumStrands {
433 return 0.0
434 }
435 return fn.States[family.Strand-1].Activation
436}
437
438// RouteThrough simulates routing through Olympus hub
439func (fn *FamilyNetwork) RouteThrough(source, target int) float64 {
440 if source < 1 || source > NumStrands || target < 1 || target > NumStrands {
441 return 0.0
442 }
443
444 // Calculate routing efficiency through hub
445 srcPhase := fn.States[source-1].Phase
446 tgtPhase := fn.States[target-1].Phase
447 phaseDiff := math.Abs(srcPhase - tgtPhase)
448 if phaseDiff > math.Pi {
449 phaseDiff = 2.0*math.Pi - phaseDiff
450 }
451
452 // Efficiency based on phase alignment
453 efficiency := math.Cos(phaseDiff/2.0)
454 return efficiency * fn.States[source-1].Activation
455}
456
457// =============================================================================
458// COMPLETE THOUGHT INTEGRATION (Section XIV)
459// =============================================================================
460
461// T = Φ · ∫[M(t')·exp((QK^T/√d_k)V)] dt'
462
463// CompleteThought integrates all family contributions
464type CompleteThought struct {
465 Phi float64 // Consciousness metric
466 Memory []float64 // Memory buffer M(t')
467 Query []float64 // Q vector
468 Key []float64 // K vector
469 Value []float64 // V vector
470 DimK float64 // √d_k scaling
471 TimeSteps int // Integration steps
472}
473
474// NewCompleteThought creates a new complete thought integrator
475func NewCompleteThought(dim int) *CompleteThought {
476 return &CompleteThought{
477 Phi: 1.0,
478 Memory: make([]float64, dim),
479 Query: make([]float64, dim),
480 Key: make([]float64, dim),
481 Value: make([]float64, dim),
482 DimK: math.Sqrt(float64(dim)),
483 TimeSteps: 100,
484 }
485}
486
487// Integrate computes T = Φ · ∫[M(t')·exp((QK^T/√d_k)V)] dt'
488func (ct *CompleteThought) Integrate(familyNetwork *FamilyNetwork) float64 {
489 // Update Phi from family network coherence
490 ct.Phi = 0.0
491 for i := 0; i < NumStrands; i++ {
492 ct.Phi += 1.0 / (1.0 + math.Abs(familyNetwork.States[i].Activation-1.0))
493 }
494 ct.Phi /= NumStrands
495
496 // Build Q, K, V from family activations
497 for i := 0; i < len(ct.Query) && i < NumStrands; i++ {
498 ct.Query[i] = familyNetwork.States[i].Activation * math.Cos(familyNetwork.States[i].Phase)
499 ct.Key[i] = familyNetwork.States[i].Activation * math.Sin(familyNetwork.States[i].Phase)
500 ct.Value[i] = familyNetwork.States[i].Activation
501 }
502
503 // Compute attention: QK^T / √d_k
504 attention := 0.0
505 for i := 0; i < len(ct.Query); i++ {
506 attention += ct.Query[i] * ct.Key[i]
507 }
508 attention /= ct.DimK
509
510 // Apply softmax-like transformation
511 attention = math.Exp(attention)
512 if attention > 1e10 {
513 attention = 1e10
514 }
515
516 // Integrate with value vector
517 result := 0.0
518 for i := 0; i < len(ct.Value); i++ {
519 result += ct.Value[i] * attention / float64(len(ct.Value))
520 }
521
522 // Scale by Phi
523 return ct.Phi * result
524}
525
526// UpdateMemory updates the memory buffer
527func (ct *CompleteThought) UpdateMemory(newMemory []float64) {
528 copy(ct.Memory, newMemory)
529}
530
531// =============================================================================
532// FAMILY ID TYPE AND CONSTANTS (AGC Integration)
533// =============================================================================
534
535// FamilyID identifies a DNA family for AGC integration
536type FamilyID int
537
538// Family ID constants
539const (
540 FamilyYad FamilyID = 0
541 FamilyLashon FamilyID = 1
542 FamilyAthena FamilyID = 2
543 FamilyApollo FamilyID = 3
544 FamilyHermes FamilyID = 4
545 FamilyHephaestus FamilyID = 5
546 FamilyPrometheus FamilyID = 6
547 FamilyDionysus FamilyID = 7
548 FamilyArtemis FamilyID = 8
549 FamilyHera FamilyID = 9
550 FamilyPoseidon FamilyID = 10
551 FamilyDemeter FamilyID = 11
552 FamilyAres FamilyID = 12
553 FamilyAphrodite FamilyID = 13
554 FamilyHestia FamilyID = 14
555 FamilyZeus FamilyID = 15
556 FamilyUnity FamilyID = 0 // Default/unity family (same as Yad)
557)
558
559// FamilyWithGenerators extends Family with generator assignments
560type FamilyWithGenerators struct {
561 *Family
562 Generators []int // Generator IDs assigned to this family
563}
564
565// familyGeneratorMap maps FamilyID to generator indices (1-100)
566var familyGeneratorMap = map[FamilyID][]int{
567 FamilyYad: {1, 2, 3, 4, 5, 6}, // Autoregressive: foundation
568 FamilyLashon: {7, 8, 9, 10, 11, 12}, // Autoregressive: language
569 FamilyAthena: {13, 14, 15, 16, 17, 18}, // Transformer: strategy
570 FamilyApollo: {19, 20, 21, 22, 23, 24}, // Transformer: mathematics
571 FamilyHermes: {25, 26, 27, 28, 29, 30}, // Flow: communication
572 FamilyHephaestus: {31, 32, 33, 34, 35, 36}, // Flow: engineering
573 FamilyPrometheus: {37, 38, 39, 40, 41, 42}, // Diffusion: innovation
574 FamilyDionysus: {43, 44, 45, 46, 47, 48}, // Diffusion: creativity
575 FamilyArtemis: {49, 50, 51, 52, 53, 54}, // Adversarial: perception
576 FamilyHera: {55, 56, 57, 58, 59, 60}, // Mixture: integration
577 FamilyPoseidon: {61, 62, 63, 64, 65, 66}, // Energy: emotion
578 FamilyDemeter: {67, 68, 69, 70, 71, 72}, // Variational: growth
579 FamilyAres: {73, 74, 75, 76, 77, 78}, // Recurrent: action
580 FamilyAphrodite: {79, 80, 81, 82, 83, 84}, // StateSpace: harmony
581 FamilyHestia: {85, 86, 87, 88, 89, 90}, // Recurrent: memory
582 FamilyZeus: {91, 92, 93, 94, 95, 96, 97, 98, 99, 100}, // Mixture: coordination
583}
584
585// taskToFamilyMap maps task types to their primary family
586var taskToFamilyMap = map[string]FamilyID{
587 "code": FamilyYad,
588 "foundation": FamilyYad,
589 "language": FamilyLashon,
590 "text": FamilyLashon,
591 "strategy": FamilyAthena,
592 "planning": FamilyAthena,
593 "mathematics": FamilyApollo,
594 "math": FamilyApollo,
595 "communication": FamilyHermes,
596 "messaging": FamilyHermes,
597 "engineering": FamilyHephaestus,
598 "build": FamilyHephaestus,
599 "innovation": FamilyPrometheus,
600 "creative": FamilyPrometheus,
601 "creativity": FamilyDionysus,
602 "art": FamilyDionysus,
603 "perception": FamilyArtemis,
604 "sensing": FamilyArtemis,
605 "integration": FamilyHera,
606 "unify": FamilyHera,
607 "emotion": FamilyPoseidon,
608 "depth": FamilyPoseidon,
609 "growth": FamilyDemeter,
610 "nurture": FamilyDemeter,
611 "action": FamilyAres,
612 "force": FamilyAres,
613 "harmony": FamilyAphrodite,
614 "beauty": FamilyAphrodite,
615 "memory": FamilyHestia,
616 "remember": FamilyHestia,
617 "coordination": FamilyZeus,
618 "direct": FamilyZeus,
619 "default": FamilyUnity,
620 "": FamilyUnity,
621}
622
623// NewFamilyState creates a new family state for AGC integration
624func NewFamilyState(id FamilyID) *FamilyState {
625 if int(id) < 0 || int(id) >= NumStrands {
626 id = FamilyUnity
627 }
628 family := &DNAFamilies[id]
629 return &FamilyState{
630 Family: family,
631 Activation: 0.5,
632 Phase: family.Phase,
633 Connections: make([]float64, NumStrands),
634 }
635}
636
637// Update updates the family state with new phi and step
638func (fs *FamilyState) Update(phi float64, step int64) {
639 // Update activation based on phi
640 fs.Activation = fs.Activation*0.9 + phi*0.1
641
642 // Update phase based on step
643 fs.Phase = math.Mod(fs.Phase+AngularFrequency*0.1, 2.0*math.Pi)
644
645 // Clamp activation
646 if fs.Activation > 1.0 {
647 fs.Activation = 1.0
648 } else if fs.Activation < 0.0 {
649 fs.Activation = 0.0
650 }
651}
652
653// SelectFamilyForTask selects the appropriate family for a given task type
654func SelectFamilyForTask(taskType string) FamilyID {
655 if id, ok := taskToFamilyMap[taskType]; ok {
656 return id
657 }
658 return FamilyUnity
659}
660
661// GetFamily returns a family with its generator assignments
662func GetFamily(id FamilyID) *FamilyWithGenerators {
663 if int(id) < 0 || int(id) >= NumStrands {
664 return nil
665 }
666 family := &DNAFamilies[id]
667 gens := familyGeneratorMap[id]
668 return &FamilyWithGenerators{
669 Family: family,
670 Generators: gens,
671 }
672}
673
674// GetGeneratorsForFamily returns generators for a family (for interface compatibility)
675// Returns nil as actual generator instances are managed by the generators package
676func GetGeneratorsForFamily(id FamilyID) []interface{} {
677 return nil // Generators are fetched from generators.GlobalRegistry
678}
679