1use serde::{Deserialize, Serialize};
7use std::fmt;
8
9#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]
11pub enum Galaxy {
12 Aria,
14 Citta,
16 Codex,
18 Journals,
20 Dreams,
22 Research,
24 Sessions,
26 Substrate,
28 Tutorial,
30 Universal,
32 Karma,
34 Dharma,
36 Associations,
38 Embeddings,
40 Valkyrie,
42 Telemetry,
45}
46
47impl Galaxy {
48 pub const COUNT: usize = 16;
50
51 #[must_use]
53 pub const fn all() -> [Self; 16] {
54 [
55 Self::Aria,
56 Self::Citta,
57 Self::Codex,
58 Self::Journals,
59 Self::Dreams,
60 Self::Research,
61 Self::Sessions,
62 Self::Substrate,
63 Self::Tutorial,
64 Self::Universal,
65 Self::Karma,
66 Self::Dharma,
67 Self::Associations,
68 Self::Embeddings,
69 Self::Valkyrie,
70 Self::Telemetry,
71 ]
72 }
73
74 #[must_use]
82 pub const fn memory_galaxies() -> [Self; 11] {
83 [
84 Self::Aria,
85 Self::Citta,
86 Self::Codex,
87 Self::Journals,
88 Self::Dreams,
89 Self::Research,
90 Self::Sessions,
91 Self::Substrate,
92 Self::Tutorial,
93 Self::Universal,
94 Self::Valkyrie,
95 ]
96 }
97
98 #[must_use]
100 pub const fn db_name(self) -> &'static str {
101 match self {
102 Self::Aria => "aria",
103 Self::Citta => "citta",
104 Self::Codex => "codex",
105 Self::Journals => "journals",
106 Self::Dreams => "dreams",
107 Self::Research => "research",
108 Self::Sessions => "sessions",
109 Self::Substrate => "substrate",
110 Self::Tutorial => "tutorial",
111 Self::Universal => "universal",
112 Self::Karma => "karma",
113 Self::Dharma => "dharma",
114 Self::Associations => "associations",
115 Self::Embeddings => "embeddings",
116 Self::Valkyrie => "valkyrie",
117 Self::Telemetry => "telemetry",
118 }
119 }
120
121 #[must_use]
123 pub const fn description(self) -> &'static str {
124 match self {
125 Self::Aria => "Artistic/creative memories",
126 Self::Citta => "Consciousness stream",
127 Self::Codex => "Knowledge/documents",
128 Self::Journals => "Session journals",
129 Self::Dreams => "Dream cycle outputs",
130 Self::Research => "Research notes",
131 Self::Sessions => "Session recordings",
132 Self::Substrate => "System state/config",
133 Self::Tutorial => "Tutorial memories",
134 Self::Universal => "Cross-galaxy index",
135 Self::Karma => "Karma ledger",
136 Self::Dharma => "Governance rules",
137 Self::Associations => "Cross-memory links",
138 Self::Embeddings => "Vector embeddings",
139 Self::Valkyrie => "Valkyrie sanctuary/reflections",
140 Self::Telemetry => "OS telemetry windows (evidence, not cognition)",
141 }
142 }
143
144 #[must_use]
148 pub fn from_db_name(name: &str) -> Option<Self> {
149 Self::all().into_iter().find(|g| g.db_name() == name)
150 }
151}
152
153impl fmt::Display for Galaxy {
154 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
155 write!(f, "{}", self.db_name())
156 }
157}
158
159#[cfg(test)]
160mod tests {
161 use super::*;
162
163 #[test]
164 fn galaxy_count_is_16() {
165 assert_eq!(Galaxy::COUNT, 16);
166 assert_eq!(Galaxy::all().len(), 16);
167 }
168
169 #[test]
170 fn galaxy_db_names_unique() {
171 let names: Vec<_> = Galaxy::all().iter().map(|g| g.db_name()).collect();
172 let unique: std::collections::HashSet<_> = names.iter().collect();
173 assert_eq!(names.len(), unique.len());
174 }
175
176 #[test]
177 fn memory_galaxies_excludes_special_purpose() {
178 let mg = Galaxy::memory_galaxies();
179 assert_eq!(mg.len(), 11);
180 assert!(!mg.contains(&Galaxy::Karma));
181 assert!(!mg.contains(&Galaxy::Dharma));
182 assert!(!mg.contains(&Galaxy::Associations));
183 assert!(!mg.contains(&Galaxy::Embeddings));
184 assert!(
185 !mg.contains(&Galaxy::Telemetry),
186 "telemetry is evidence, not default recall"
187 );
188 assert!(mg.contains(&Galaxy::Valkyrie));
189 }
190}