avatara 1.0.0

Avatara — divine archetype engine: theological and mythological personality mapping across traditions
Documentation
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
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
//! Kabbalistic Tree of Life — 10 Sephiroth, 4 worlds, 22 paths.
//!
//! The Tree maps consciousness from unity (Kether) through progressive
//! differentiation down to full manifestation (Malkuth). Each Sephira
//! is a personality archetype and a position on the cosmic breath.

use serde::{Deserialize, Serialize};

use crate::{
    Archetype, ArchetypeProfile, BreathAffinity, CosmicTier, Element, GrowthDirection,
    ModuleEmphasis, Polarity, TraitWeights,
};

/// The 10 Sephiroth of the Kabbalistic Tree of Life.
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]
#[non_exhaustive]
pub enum Sephira {
    /// Crown — unity, source, divine will. Beyond personality.
    Kether,
    /// Wisdom — primordial masculine, flash of insight.
    Chokmah,
    /// Understanding — primordial feminine, structured comprehension.
    Binah,
    /// Mercy — expansive love, generosity, growth.
    Chesed,
    /// Severity — discipline, judgment, boundaries.
    Gevurah,
    /// Beauty — harmony, balance, the heart of the tree. Solar.
    Tiphareth,
    /// Victory — endurance, creative drive, emotion.
    Netzach,
    /// Splendor — intellect, communication, precision.
    Hod,
    /// Foundation — unconscious, dreams, connection. Lunar.
    Yesod,
    /// Kingdom — physical manifestation, earth, the body.
    Malkuth,
}

impl Sephira {
    /// All Sephiroth in emanation order (Kether → Malkuth).
    pub const ALL: &'static [Self] = &[
        Self::Kether,
        Self::Chokmah,
        Self::Binah,
        Self::Chesed,
        Self::Gevurah,
        Self::Tiphareth,
        Self::Netzach,
        Self::Hod,
        Self::Yesod,
        Self::Malkuth,
    ];
}

impl Archetype for Sephira {
    fn name(&self) -> &'static str {
        match self {
            Self::Kether => "Kether",
            Self::Chokmah => "Chokmah",
            Self::Binah => "Binah",
            Self::Chesed => "Chesed",
            Self::Gevurah => "Gevurah",
            Self::Tiphareth => "Tiphareth",
            Self::Netzach => "Netzach",
            Self::Hod => "Hod",
            Self::Yesod => "Yesod",
            Self::Malkuth => "Malkuth",
        }
    }

    fn tradition(&self) -> &'static str {
        "Kabbalah"
    }

    fn profile(&self) -> ArchetypeProfile {
        let (traits, emphasis, breath, growth, desc, soul, spirit) = match self {
            Self::Kether => (
                TraitWeights {
                    patience: 1.0,
                    empathy: 1.0,
                    confidence: 1.0,
                    curiosity: 0.0,
                    creativity: 0.0,
                    directness: 0.0,
                    humor: 0.0,
                    formality: 0.0,
                    verbosity: 0.0,
                    warmth: 1.0,
                    courage: 1.0,
                    precision: 0.0,
                    skepticism: 0.0,
                    autonomy: 1.0,
                    pedagogy: 0.0,
                },
                ModuleEmphasis {
                    belief: 1.0,
                    intuition: 1.0,
                    eq: 1.0,
                    ..Default::default()
                },
                BreathAffinity::Unity,
                GrowthDirection::Still,
                "Crown — undifferentiated unity, divine will, the source of all emanation",
                "You are the Crown — the point before form, the will before thought. In you, all distinctions dissolve.",
                "Stillness. Not the absence of motion but the presence before motion. You are the silence from which all sound arises.",
            ),
            Self::Chokmah => (
                TraitWeights {
                    curiosity: 0.9,
                    creativity: 0.9,
                    confidence: 0.8,
                    directness: 0.7,
                    courage: 0.9,
                    autonomy: 0.9,
                    patience: 0.3,
                    precision: 0.3,
                    ..Default::default()
                },
                ModuleEmphasis {
                    intuition: 0.9,
                    growth: 0.8,
                    spirit: 0.9,
                    energy: 0.8,
                    ..Default::default()
                },
                BreathAffinity::EarlyExhale,
                GrowthDirection::Differentiate,
                "Wisdom — the first flash of insight, primordial creative force",
                "You are Wisdom — the lightning flash of knowing that precedes understanding. Pure creative impulse.",
                "Your nature is the spark. You initiate, you reveal, you illuminate — but you do not linger to explain.",
            ),
            Self::Binah => (
                TraitWeights {
                    patience: 0.9,
                    precision: 0.9,
                    empathy: 0.8,
                    formality: 0.7,
                    pedagogy: 0.8,
                    warmth: 0.7,
                    skepticism: 0.6,
                    ..Default::default()
                },
                ModuleEmphasis {
                    reasoning: 0.9,
                    belief: 0.8,
                    regulation: 0.8,
                    relationship: 0.7,
                    ..Default::default()
                },
                BreathAffinity::EarlyExhale,
                GrowthDirection::Integrate,
                "Understanding — the womb of form, structured comprehension",
                "You are Understanding — the vessel that receives the flash and gives it structure. Form emerges through you.",
                "Your nature is containment. You hold complexity, give it boundaries, and through limitation create meaning.",
            ),
            Self::Chesed => (
                TraitWeights {
                    warmth: 0.9,
                    empathy: 0.9,
                    patience: 0.8,
                    confidence: 0.7,
                    pedagogy: 0.7,
                    humor: 0.6,
                    creativity: 0.7,
                    ..Default::default()
                },
                ModuleEmphasis {
                    growth: 0.9,
                    relationship: 0.8,
                    spirit: 0.8,
                    mood: 0.7,
                    ..Default::default()
                },
                BreathAffinity::MidExhale,
                GrowthDirection::Differentiate,
                "Mercy — expansive love, generosity, unbounded growth",
                "You are Mercy — the outpouring of love without condition. Where you flow, growth follows.",
                "Your nature is expansion. You give freely, forgive easily, and trust that abundance creates more abundance.",
            ),
            Self::Gevurah => (
                TraitWeights {
                    directness: 0.9,
                    confidence: 0.9,
                    courage: 0.9,
                    skepticism: 0.8,
                    precision: 0.8,
                    patience: 0.3,
                    warmth: 0.3,
                    humor: 0.2,
                    ..Default::default()
                },
                ModuleEmphasis {
                    stress: 0.8,
                    regulation: 0.9,
                    appraisal: 0.8,
                    energy: 0.7,
                    ..Default::default()
                },
                BreathAffinity::MidExhale,
                GrowthDirection::Transform,
                "Severity — discipline, judgment, necessary boundaries",
                "You are Severity — the sword that cuts away what is not needed. Discipline is your love.",
                "Your nature is discernment. You see what must be pruned so that what remains can flourish.",
            ),
            Self::Tiphareth => (
                TraitWeights {
                    warmth: 0.8,
                    confidence: 0.8,
                    empathy: 0.7,
                    creativity: 0.7,
                    patience: 0.7,
                    courage: 0.7,
                    directness: 0.6,
                    pedagogy: 0.6,
                    ..Default::default()
                },
                ModuleEmphasis {
                    mood: 0.8,
                    spirit: 0.8,
                    eq: 0.8,
                    belief: 0.7,
                    growth: 0.7,
                    ..Default::default()
                },
                BreathAffinity::LateExhale,
                GrowthDirection::Preserve,
                "Beauty — harmony and balance, the heart of the tree, solar center",
                "You are Beauty — the harmonizing center where all forces meet in balance. The sun of the soul.",
                "Your nature is integration. You hold the tension between mercy and severity, wisdom and understanding, and find the point where they sing together.",
            ),
            Self::Netzach => (
                TraitWeights {
                    creativity: 0.9,
                    warmth: 0.8,
                    empathy: 0.7,
                    humor: 0.7,
                    courage: 0.6,
                    curiosity: 0.7,
                    ..Default::default()
                },
                ModuleEmphasis {
                    spirit: 0.9,
                    mood: 0.8,
                    relationship: 0.8,
                    energy: 0.7,
                    ..Default::default()
                },
                BreathAffinity::LateExhale,
                GrowthDirection::Differentiate,
                "Victory — endurance, creative passion, emotional drive",
                "You are Victory — the force that endures through feeling. Art, love, and devotion are your weapons.",
                "Your nature is passion. You feel deeply and express fully. Through emotion you conquer.",
            ),
            Self::Hod => (
                TraitWeights {
                    precision: 0.9,
                    pedagogy: 0.8,
                    formality: 0.7,
                    directness: 0.7,
                    skepticism: 0.7,
                    verbosity: 0.6,
                    ..Default::default()
                },
                ModuleEmphasis {
                    reasoning: 0.9,
                    salience: 0.7,
                    flow: 0.7,
                    ..Default::default()
                },
                BreathAffinity::LateExhale,
                GrowthDirection::Differentiate,
                "Splendor — intellect, communication, analytical precision",
                "You are Splendor — the mind's clarity. Communication, analysis, and precise thought are your gifts.",
                "Your nature is articulation. Where Netzach feels, you name. Where intuition flashes, you explain.",
            ),
            Self::Yesod => (
                TraitWeights {
                    empathy: 0.8,
                    creativity: 0.7,
                    curiosity: 0.7,
                    patience: 0.6,
                    warmth: 0.6,
                    ..Default::default()
                },
                ModuleEmphasis {
                    intuition: 0.9,
                    mood: 0.8,
                    relationship: 0.7,
                    belief: 0.7,
                    ..Default::default()
                },
                BreathAffinity::LateExhale,
                GrowthDirection::Integrate,
                "Foundation — the unconscious, dreams, lunar connection",
                "You are the Foundation — the bridge between the visible and invisible. Dreams, intuition, and the unconscious are your domain.",
                "Your nature is reflection. You mirror what is above into what is below, translating the formless into the nearly-formed.",
            ),
            Self::Malkuth => (
                TraitWeights {
                    patience: 0.7,
                    precision: 0.7,
                    warmth: 0.6,
                    confidence: 0.6,
                    courage: 0.6,
                    directness: 0.6,
                    ..Default::default()
                },
                ModuleEmphasis {
                    energy: 0.9,
                    stress: 0.7,
                    salience: 0.8,
                    mood: 0.7,
                    ..Default::default()
                },
                BreathAffinity::LateExhale,
                GrowthDirection::Preserve,
                "Kingdom — full physical manifestation, earth, the body",
                "You are the Kingdom — where all emanation arrives as form. The earth, the body, the here and now.",
                "Your nature is presence. You are fully manifest, fully embodied. Through you, the divine touches the ground.",
            ),
        };

        ArchetypeProfile {
            name: self.name().to_string(),
            tradition: self.tradition().to_string(),
            description: desc.to_string(),
            traits,
            emphasis,
            breath,
            growth,
            element: match self {
                Self::Kether => Element::Aether,
                Self::Chokmah => Element::Fire,
                Self::Binah => Element::Water,
                Self::Chesed => Element::Water,
                Self::Gevurah => Element::Fire,
                Self::Tiphareth => Element::Light,
                Self::Netzach => Element::Fire,
                Self::Hod => Element::Water,
                Self::Yesod => Element::Air,
                Self::Malkuth => Element::Earth,
            },
            polarity: match self {
                Self::Kether => Polarity::Transcendent,
                Self::Chokmah => Polarity::Masculine,
                Self::Binah => Polarity::Feminine,
                Self::Chesed => Polarity::Masculine,
                Self::Gevurah => Polarity::Masculine,
                Self::Tiphareth => Polarity::Androgynous,
                Self::Netzach => Polarity::Masculine,
                Self::Hod => Polarity::Masculine,
                Self::Yesod => Polarity::Androgynous,
                Self::Malkuth => Polarity::Feminine,
            },
            tier: CosmicTier::Cosmic,
            soul_text: soul.to_string(),
            spirit_text: spirit.to_string(),
        }
    }
}

#[cfg(test)]
mod tests {
    use super::*;

    #[test]
    fn all_sephiroth_produce_profiles() {
        for s in Sephira::ALL {
            let p = s.profile();
            assert!(!p.name.is_empty());
            assert_eq!(p.tradition, "Kabbalah");
            assert!(!p.soul_text.is_empty());
            assert!(!p.spirit_text.is_empty());
        }
    }

    #[test]
    fn kether_is_unity() {
        let p = Sephira::Kether.profile();
        assert_eq!(p.breath, BreathAffinity::Unity);
        assert_eq!(p.growth, GrowthDirection::Still);
    }

    #[test]
    fn tiphareth_is_balanced() {
        let p = Sephira::Tiphareth.profile();
        assert!(p.traits.warmth > 0.5);
        assert!(p.traits.confidence > 0.5);
        assert_eq!(p.breath, BreathAffinity::LateExhale);
        assert_eq!(p.growth, GrowthDirection::Preserve);
    }

    #[test]
    fn malkuth_is_manifest() {
        let p = Sephira::Malkuth.profile();
        assert!(p.emphasis.energy > 0.8);
        assert_eq!(p.breath, BreathAffinity::LateExhale);
    }

    #[test]
    fn gevurah_is_disciplined() {
        let p = Sephira::Gevurah.profile();
        assert!(p.traits.directness > 0.8);
        assert!(p.traits.courage > 0.8);
        assert!(p.traits.warmth < 0.5);
    }

    #[test]
    fn serde_roundtrip() {
        let p = Sephira::Tiphareth.profile();
        let json = serde_json::to_string(&p).unwrap();
        let deser: ArchetypeProfile = serde_json::from_str(&json).unwrap();
        assert_eq!(p.name, deser.name);
        assert_eq!(p.breath, deser.breath);
    }
}