yakmesh 2.8.2 → 3.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (232) hide show
  1. package/CHANGELOG.md +637 -0
  2. package/CONTRIBUTING.md +42 -0
  3. package/Caddyfile +77 -0
  4. package/README.md +119 -29
  5. package/adapters/adapter-mlv-bible/README.md +124 -0
  6. package/adapters/adapter-mlv-bible/index.js +400 -0
  7. package/adapters/chat-mod-adapter.js +532 -0
  8. package/adapters/content-adapter.js +273 -0
  9. package/content/api.js +50 -41
  10. package/content/index.js +2 -2
  11. package/content/store.js +355 -173
  12. package/dashboard/index.html +19 -3
  13. package/database/replication.js +117 -37
  14. package/docs/CRYPTO-AGILITY.md +204 -0
  15. package/docs/MTLS-RESEARCH.md +367 -0
  16. package/docs/NAMCHE-SPEC.md +681 -0
  17. package/docs/PEERQUANTA-YAKMESH-INTEGRATION.md +407 -0
  18. package/docs/PRECISION-DISCLOSURE.md +96 -0
  19. package/docs/README.md +76 -0
  20. package/docs/ROADMAP-2.4.0.md +447 -0
  21. package/docs/ROADMAP-2.5.0.md +244 -0
  22. package/docs/SECURITY-AUDIT-REPORT.md +306 -0
  23. package/docs/SST-INTEGRATION.md +712 -0
  24. package/docs/STEADYWATCH-IMPLEMENTATION.md +303 -0
  25. package/docs/TERNARY-AUDIT-REPORT.md +247 -0
  26. package/docs/TME-FAQ.md +221 -0
  27. package/docs/WHITEPAPER.md +623 -0
  28. package/docs/adapters.html +1001 -0
  29. package/docs/advanced-systems.html +1045 -0
  30. package/docs/annex.html +1046 -0
  31. package/docs/api.html +970 -0
  32. package/docs/business/response-templates.md +160 -0
  33. package/docs/c2c.html +1225 -0
  34. package/docs/cli.html +1332 -0
  35. package/docs/configuration.html +1248 -0
  36. package/docs/darshan.html +1085 -0
  37. package/docs/dharma.html +966 -0
  38. package/docs/docs-bundle.html +1075 -0
  39. package/docs/docs.css +3120 -0
  40. package/docs/docs.js +556 -0
  41. package/docs/doko.html +969 -0
  42. package/docs/geo-proof.html +858 -0
  43. package/docs/getting-started.html +840 -0
  44. package/docs/gumba-tutorial.html +1144 -0
  45. package/docs/gumba.html +1098 -0
  46. package/docs/index.html +914 -0
  47. package/docs/jhilke.html +1312 -0
  48. package/docs/karma.html +1100 -0
  49. package/docs/katha.html +1037 -0
  50. package/docs/lama.html +978 -0
  51. package/docs/mandala.html +1067 -0
  52. package/docs/mani.html +964 -0
  53. package/docs/mantra.html +967 -0
  54. package/docs/mesh.html +1409 -0
  55. package/docs/nakpak.html +869 -0
  56. package/docs/namche.html +928 -0
  57. package/docs/nav-order.json +53 -0
  58. package/docs/prahari.html +1043 -0
  59. package/docs/prism-bash.min.js +1 -0
  60. package/docs/prism-javascript.min.js +1 -0
  61. package/docs/prism-json.min.js +1 -0
  62. package/docs/prism-tomorrow.min.css +1 -0
  63. package/docs/prism.min.js +1 -0
  64. package/docs/privacy.html +699 -0
  65. package/docs/quick-reference.html +1181 -0
  66. package/docs/sakshi.html +1402 -0
  67. package/docs/sandboxing.md +386 -0
  68. package/docs/seva.html +911 -0
  69. package/docs/sherpa.html +871 -0
  70. package/docs/studio.html +860 -0
  71. package/docs/stupa.html +995 -0
  72. package/docs/tailwind.min.css +2 -0
  73. package/docs/tattva.html +1332 -0
  74. package/docs/terms.html +686 -0
  75. package/docs/time-server-deployment.md +166 -0
  76. package/docs/time-sources.html +1392 -0
  77. package/docs/tivra.html +1127 -0
  78. package/docs/trademark-policy.html +686 -0
  79. package/docs/tribhuj.html +1183 -0
  80. package/docs/trust-security.html +1029 -0
  81. package/docs/tutorials/backup-recovery.html +654 -0
  82. package/docs/tutorials/dashboard.html +604 -0
  83. package/docs/tutorials/domain-setup.html +605 -0
  84. package/docs/tutorials/host-website.html +456 -0
  85. package/docs/tutorials/mesh-network.html +505 -0
  86. package/docs/tutorials/mobile-access.html +445 -0
  87. package/docs/tutorials/privacy.html +467 -0
  88. package/docs/tutorials/raspberry-pi.html +600 -0
  89. package/docs/tutorials/security-basics.html +539 -0
  90. package/docs/tutorials/share-files.html +431 -0
  91. package/docs/tutorials/troubleshooting.html +637 -0
  92. package/docs/tutorials/trust-karma.html +419 -0
  93. package/docs/tutorials/yak-protocol.html +456 -0
  94. package/docs/tutorials.html +1034 -0
  95. package/docs/vani.html +1270 -0
  96. package/docs/webserver.html +809 -0
  97. package/docs/yak-protocol.html +940 -0
  98. package/docs/yak-timeserver-design.md +475 -0
  99. package/docs/yakapp.html +1015 -0
  100. package/docs/ypc27.html +1069 -0
  101. package/docs/yurt.html +1344 -0
  102. package/embedded-docs/bundle.js +334 -74
  103. package/gossip/protocol.js +247 -27
  104. package/identity/key-resolver.js +262 -0
  105. package/identity/machine-seed.js +632 -0
  106. package/identity/node-key.js +669 -368
  107. package/identity/tribhuj-ratchet.js +506 -0
  108. package/knowledge-base.js +37 -8
  109. package/launcher/yakmesh.bat +62 -0
  110. package/launcher/yakmesh.sh +70 -0
  111. package/mesh/annex.js +462 -108
  112. package/mesh/beacon-broadcast.js +113 -1
  113. package/mesh/darshan.js +1718 -0
  114. package/mesh/gumba.js +1567 -0
  115. package/mesh/jhilke.js +651 -0
  116. package/mesh/katha.js +1012 -0
  117. package/mesh/nakpak-routing.js +8 -5
  118. package/mesh/network.js +724 -34
  119. package/mesh/pulse-sync.js +4 -1
  120. package/mesh/rate-limiter.js +127 -15
  121. package/mesh/seva.js +526 -0
  122. package/mesh/sherpa-discovery.js +89 -8
  123. package/mesh/sybil-defense.js +19 -5
  124. package/mesh/temporal-encoder.js +4 -3
  125. package/mesh/vani.js +1364 -0
  126. package/mesh/yurt.js +1340 -0
  127. package/models/entropy-sentinel.onnx +0 -0
  128. package/models/karma-trust.onnx +0 -0
  129. package/models/manifest.json +43 -0
  130. package/models/sakshi-anomaly.onnx +0 -0
  131. package/oracle/code-proof-protocol.js +7 -6
  132. package/oracle/codebase-lock.js +257 -28
  133. package/oracle/index.js +74 -15
  134. package/oracle/ma902-snmp.js +678 -0
  135. package/oracle/module-sealer.js +5 -3
  136. package/oracle/network-identity.js +16 -0
  137. package/oracle/packet-checksum.js +201 -0
  138. package/oracle/sst.js +579 -0
  139. package/oracle/ternary-144t.js +714 -0
  140. package/oracle/ternary-ml.js +481 -0
  141. package/oracle/time-api.js +239 -0
  142. package/oracle/time-source.js +137 -47
  143. package/oracle/validation-oracle-hardened.js +1111 -1071
  144. package/oracle/validation-oracle.js +4 -2
  145. package/oracle/ypc27.js +211 -0
  146. package/package.json +20 -3
  147. package/protocol/yak-handler.js +35 -9
  148. package/protocol/yak-protocol.js +28 -13
  149. package/reference/cpp/yakmesh_mceliece_shard.cpp +168 -0
  150. package/reference/cpp/yakmesh_ypc27.cpp +179 -0
  151. package/sbom.json +87 -0
  152. package/scripts/security-audit.mjs +264 -0
  153. package/scripts/update-docs-nav.js +194 -0
  154. package/scripts/update-docs-sidebar.cjs +164 -0
  155. package/security/crypto-config.js +4 -3
  156. package/security/dharma-moderation.js +517 -0
  157. package/security/doko-identity.js +193 -143
  158. package/security/domain-consensus.js +86 -85
  159. package/security/fs-hardening.js +620 -0
  160. package/security/hardware-attestation.js +5 -3
  161. package/security/hybrid-trust.js +227 -87
  162. package/security/karma-rate-limiter.js +692 -0
  163. package/security/khata-protocol.js +22 -21
  164. package/security/khata-trust-integration.js +277 -150
  165. package/security/memory-safety.js +635 -0
  166. package/security/mesh-auth.js +11 -10
  167. package/security/mesh-revocation.js +373 -5
  168. package/security/namche-gateway.js +298 -69
  169. package/security/sakshi.js +460 -3
  170. package/security/sangha.js +770 -0
  171. package/security/secure-config.js +473 -0
  172. package/security/silicon-parity.js +13 -10
  173. package/security/steadywatch.js +1142 -0
  174. package/security/strike-system.js +32 -3
  175. package/security/temporal-signing.js +488 -0
  176. package/security/trit-commitment.js +464 -0
  177. package/server/crypto/annex.js +247 -0
  178. package/server/darshan-api.js +343 -0
  179. package/server/index.js +3259 -362
  180. package/server/komm-api.js +668 -0
  181. package/utils/accel.js +2273 -0
  182. package/utils/ternary-id.js +79 -0
  183. package/utils/verify-worker.js +57 -0
  184. package/webserver/index.js +95 -5
  185. package/assets/yakmesh-logo.png +0 -0
  186. package/assets/yakmesh-logo.svg +0 -80
  187. package/assets/yakmesh-logo2.png +0 -0
  188. package/assets/yakmesh-logo2sm.png +0 -0
  189. package/assets/ymsm.png +0 -0
  190. package/website/assets/silhouettes/adapters.svg +0 -107
  191. package/website/assets/silhouettes/api-endpoints.svg +0 -115
  192. package/website/assets/silhouettes/atomic-clock.svg +0 -83
  193. package/website/assets/silhouettes/base-camp.svg +0 -81
  194. package/website/assets/silhouettes/bridge.svg +0 -69
  195. package/website/assets/silhouettes/docs-bundle.svg +0 -113
  196. package/website/assets/silhouettes/doko-basket.svg +0 -70
  197. package/website/assets/silhouettes/fortress.svg +0 -93
  198. package/website/assets/silhouettes/gateway.svg +0 -54
  199. package/website/assets/silhouettes/gears.svg +0 -93
  200. package/website/assets/silhouettes/globe-satellite.svg +0 -67
  201. package/website/assets/silhouettes/karma-wheel.svg +0 -137
  202. package/website/assets/silhouettes/lama-council.svg +0 -141
  203. package/website/assets/silhouettes/mandala-network.svg +0 -169
  204. package/website/assets/silhouettes/mani-stones.svg +0 -149
  205. package/website/assets/silhouettes/mantra-wheel.svg +0 -116
  206. package/website/assets/silhouettes/mesh-nodes.svg +0 -113
  207. package/website/assets/silhouettes/nakpak.svg +0 -56
  208. package/website/assets/silhouettes/peak-lightning.svg +0 -73
  209. package/website/assets/silhouettes/sherpa.svg +0 -69
  210. package/website/assets/silhouettes/stupa-tower.svg +0 -119
  211. package/website/assets/silhouettes/tattva-eye.svg +0 -78
  212. package/website/assets/silhouettes/terminal.svg +0 -74
  213. package/website/assets/silhouettes/webserver.svg +0 -145
  214. package/website/assets/silhouettes/yak.svg +0 -78
  215. package/website/assets/yakmesh-logo.png +0 -0
  216. package/website/assets/yakmesh-logo.webp +0 -0
  217. package/website/assets/yakmesh-logo128x140.webp +0 -0
  218. package/website/assets/yakmesh-logo2.png +0 -0
  219. package/website/assets/yakmesh-logo2.svg +0 -51
  220. package/website/assets/yakmesh-logo40x44.webp +0 -0
  221. package/website/assets/yakmesh.gif +0 -0
  222. package/website/assets/yakmesh.ico +0 -0
  223. package/website/assets/yakmesh.jpg +0 -0
  224. package/website/assets/yakmesh.pdf +0 -0
  225. package/website/assets/yakmesh.png +0 -0
  226. package/website/assets/yakmesh.svg +0 -70
  227. package/website/assets/yakmesh128.webp +0 -0
  228. package/website/assets/yakmesh32.png +0 -0
  229. package/website/assets/yakmesh32.svg +0 -65
  230. package/website/assets/yakmesh32o.ico +0 -2
  231. package/website/assets/yakmesh32o.svg +0 -65
  232. package/website/assets/yakmesh32o.svgz +0 -0
@@ -0,0 +1,712 @@
1
+ # Synergy Sequence Theory (SST) Integration for YAKMESH
2
+
3
+ **Version:** 2.9.0-spec
4
+ **Date:** 2026-02-07
5
+ **Author:** YAKMESH Research Team
6
+ **Inspired by:** Wesley Long's Synergy Sequence Theory
7
+
8
+ ---
9
+
10
+ ## Executive Summary
11
+
12
+ Synergy Sequence Theory (SST) provides a mathematical framework centered on the numbers 3, 6, and 9 that aligns remarkably well with YAKMESH's balanced ternary architecture. This document proposes four integration paths:
13
+
14
+ 1. **Digital Root Trit Encoding** - Map any number to SST family groups, then to balanced ternary
15
+ 2. **YPC-27 Cycle Enhancement** - Use SST's 24-digit Fibonacci cycle for checksum rotation
16
+ 3. **KARMA Trust Geometry** - Model reputation flow using the 30-60-90 Synergy Triangle
17
+ 4. **PRAMAAN Hexagonal Tessellation** - Geographic proof zones based on hexagonal lattices
18
+
19
+ ---
20
+
21
+ ## 1. Digital Root Trit Encoding
22
+
23
+ ### SST Foundation
24
+
25
+ SST identifies three "Family Number Groups" based on digital roots:
26
+
27
+ | Family | Members | SST Polarity | Proposed Trit |
28
+ |--------|---------|--------------|---------------|
29
+ | Family A | 1, 4, 7 | Physical (−) | **-1** (NEGATIVE) |
30
+ | Family B | 2, 5, 8 | Physical (+) | **+1** (POSITIVE) |
31
+ | Family C | 3, 6, 9 | Governing/Source | **0** (NEUTRAL) |
32
+
33
+ The 3-6-9 family acts as the "singularity" in SST - a governing force that doesn't oscillate like the physical families.
34
+
35
+ ### Implementation: `oracle/sst.js`
36
+
37
+ ```javascript
38
+ /**
39
+ * SST - Synergy Sequence Theory Integration
40
+ *
41
+ * Maps any number to its SST family group, then to balanced ternary.
42
+ * Based on Wesley Long's Synergy Sequence Theory.
43
+ *
44
+ * @module oracle/sst
45
+ */
46
+
47
+ import { Trit, POSITIVE, NEUTRAL, NEGATIVE } from './tribhuj.js';
48
+
49
+ // =============================================================================
50
+ // DIGITAL ROOT & FAMILY MAPPING
51
+ // =============================================================================
52
+
53
+ /**
54
+ * Calculate the digital root of a number (sum digits until single digit).
55
+ * @param {number | bigint} n - Any integer
56
+ * @returns {number} - A value 1-9
57
+ */
58
+ export function digitalRoot(n) {
59
+ if (n === 0) return 9; // Special case: 9 → 9, multiples of 9 → 9
60
+ const abs = n < 0 ? -n : n;
61
+ const root = abs % 9;
62
+ return root === 0 ? 9 : root;
63
+ }
64
+
65
+ /**
66
+ * Family identifiers based on SST.
67
+ */
68
+ export const SSTFamily = {
69
+ A: 'A', // 1, 4, 7 - Physical Negative
70
+ B: 'B', // 2, 5, 8 - Physical Positive
71
+ C: 'C', // 3, 6, 9 - Governing/Source
72
+ };
73
+
74
+ /**
75
+ * Get the SST family for a digital root.
76
+ * @param {number} root - Digital root 1-9
77
+ * @returns {'A' | 'B' | 'C'}
78
+ */
79
+ export function getFamily(root) {
80
+ if ([1, 4, 7].includes(root)) return SSTFamily.A;
81
+ if ([2, 5, 8].includes(root)) return SSTFamily.B;
82
+ return SSTFamily.C; // 3, 6, 9
83
+ }
84
+
85
+ /**
86
+ * Map any number to a Trit via its SST family.
87
+ *
88
+ * Family A (1,4,7) → -1 (NEGATIVE) - Physical descending
89
+ * Family B (2,5,8) → +1 (POSITIVE) - Physical ascending
90
+ * Family C (3,6,9) → 0 (NEUTRAL) - Governing singularity
91
+ *
92
+ * @param {number | bigint} n
93
+ * @returns {Trit}
94
+ */
95
+ export function toFamilyTrit(n) {
96
+ const root = digitalRoot(n);
97
+ const family = getFamily(root);
98
+
99
+ switch (family) {
100
+ case SSTFamily.A: return new Trit(NEGATIVE);
101
+ case SSTFamily.B: return new Trit(POSITIVE);
102
+ case SSTFamily.C: return new Trit(NEUTRAL);
103
+ }
104
+ }
105
+
106
+ /**
107
+ * Convert a byte array to family trits.
108
+ * Each byte maps to its SST family trit.
109
+ * @param {Uint8Array} bytes
110
+ * @returns {Int8Array} - Array of trit values
111
+ */
112
+ export function bytesToFamilyTrits(bytes) {
113
+ const trits = new Int8Array(bytes.length);
114
+ for (let i = 0; i < bytes.length; i++) {
115
+ trits[i] = toFamilyTrit(bytes[i]).value;
116
+ }
117
+ return trits;
118
+ }
119
+
120
+ // =============================================================================
121
+ // FIBONACCI DIGITAL ROOT SEQUENCES
122
+ // =============================================================================
123
+
124
+ /**
125
+ * The 24-digit repeating Fibonacci digital root sequence.
126
+ * This is the fundamental SST cycle.
127
+ */
128
+ export const FIBONACCI_CYCLE_24 = Object.freeze([
129
+ 1, 1, 2, 3, 5, 8, 4, 3, 7, 1, 8, 9,
130
+ 8, 8, 7, 6, 4, 1, 5, 6, 2, 8, 1, 9
131
+ ]);
132
+
133
+ /**
134
+ * Get the digital root Fibonacci number at position n.
135
+ * Cycles every 24 positions.
136
+ * @param {number} n - Position (0-indexed)
137
+ * @returns {number} - Digital root 1-9
138
+ */
139
+ export function fibonacciRoot(n) {
140
+ return FIBONACCI_CYCLE_24[n % 24];
141
+ }
142
+
143
+ /**
144
+ * Get the family trit for Fibonacci position n.
145
+ * @param {number} n
146
+ * @returns {Trit}
147
+ */
148
+ export function fibonacciFamilyTrit(n) {
149
+ return toFamilyTrit(fibonacciRoot(n));
150
+ }
151
+
152
+ // =============================================================================
153
+ // SYNERGY MATRIX PATTERNS
154
+ // =============================================================================
155
+
156
+ /**
157
+ * Generate the Synergy Matrix - 9 Fibonacci-style sequences.
158
+ * Each row starts with its digit (1-9) repeated, then follows Fib-addition.
159
+ * All values reduced to digital roots.
160
+ * @param {number} length - How many columns
161
+ * @returns {number[][]} - 9 rows of digital roots
162
+ */
163
+ export function generateSynergyMatrix(length = 24) {
164
+ const matrix = [];
165
+
166
+ for (let seed = 1; seed <= 9; seed++) {
167
+ const row = [seed, seed]; // Start with seed, seed
168
+
169
+ for (let i = 2; i < length; i++) {
170
+ const sum = row[i - 1] + row[i - 2];
171
+ row.push(digitalRoot(sum));
172
+ }
173
+
174
+ matrix.push(row);
175
+ }
176
+
177
+ return matrix;
178
+ }
179
+
180
+ /**
181
+ * Get the family pattern for a Synergy Matrix row.
182
+ * @param {number[]} row - Digital root sequence
183
+ * @returns {Int8Array} - Trit pattern
184
+ */
185
+ export function rowToFamilyPattern(row) {
186
+ const trits = new Int8Array(row.length);
187
+ for (let i = 0; i < row.length; i++) {
188
+ trits[i] = toFamilyTrit(row[i]).value;
189
+ }
190
+ return trits;
191
+ }
192
+ ```
193
+
194
+ ### Use Cases
195
+
196
+ 1. **Node ID Classification** - Quickly categorize nodes into three groups based on ID digital root
197
+ 2. **Channel Assignment** - Divide communication into 3 channels based on SST family
198
+ 3. **Shard Distribution** - Natural 3-way data partitioning
199
+
200
+ ---
201
+
202
+ ## 2. YPC-27 Cycle Enhancement
203
+
204
+ ### Current State
205
+
206
+ YPC-27 uses a fixed 27-trit seed polynomial. The checksum rotates through this seed during computation.
207
+
208
+ ### SST Enhancement: 24-Cycle Rotation
209
+
210
+ SST reveals that Fibonacci digital roots repeat every 24 positions. We can use this to create a **dynamic seed rotation schedule**:
211
+
212
+ ```javascript
213
+ // In oracle/ypc27.js
214
+
215
+ import { FIBONACCI_CYCLE_24, getFamily, SSTFamily } from './sst.js';
216
+
217
+ /**
218
+ * YPC-27 with SST-based seed rotation.
219
+ *
220
+ * The seed polynomial rotates based on the 24-cycle:
221
+ * - Family A (1,4,7): Rotate seed LEFT (negative direction)
222
+ * - Family B (2,5,8): Rotate seed RIGHT (positive direction)
223
+ * - Family C (3,6,9): No rotation (singularity/stable)
224
+ */
225
+ export class YPC27_SST extends YPC27Checksum {
226
+ #cyclePosition = 0;
227
+ #baseSeed;
228
+
229
+ constructor(seed = DEFAULT_SEED) {
230
+ super(seed);
231
+ this.#baseSeed = Array.from(seed);
232
+ }
233
+
234
+ /**
235
+ * Get rotated seed based on current cycle position.
236
+ */
237
+ #getRotatedSeed() {
238
+ const fibRoot = FIBONACCI_CYCLE_24[this.#cyclePosition % 24];
239
+ const family = getFamily(fibRoot);
240
+
241
+ // Rotation amount based on the actual Fibonacci root (1-9)
242
+ const rotateAmount = fibRoot % 27;
243
+
244
+ switch (family) {
245
+ case SSTFamily.A:
246
+ return this.#rotateLeft(rotateAmount);
247
+ case SSTFamily.B:
248
+ return this.#rotateRight(rotateAmount);
249
+ case SSTFamily.C:
250
+ return this.#baseSeed; // Singularity - no rotation
251
+ }
252
+ }
253
+
254
+ #rotateLeft(n) {
255
+ const arr = [...this.#baseSeed];
256
+ return [...arr.slice(n), ...arr.slice(0, n)];
257
+ }
258
+
259
+ #rotateRight(n) {
260
+ const arr = [...this.#baseSeed];
261
+ return [...arr.slice(-n), ...arr.slice(0, -n)];
262
+ }
263
+
264
+ /**
265
+ * Override update to advance cycle position.
266
+ */
267
+ update(data) {
268
+ // Use rotated seed for this chunk
269
+ const rotatedSeed = new Poly27(this.#getRotatedSeed());
270
+ // ... update logic with rotated seed
271
+ this.#cyclePosition++;
272
+ }
273
+ }
274
+ ```
275
+
276
+ ### Benefits
277
+
278
+ 1. **Increased Entropy** - Seed rotation prevents pattern analysis attacks
279
+ 2. **Self-Synchronizing** - The 24-cycle is deterministic, all nodes compute same rotation
280
+ 3. **Mathematical Elegance** - Leverages natural Fibonacci periodicity
281
+
282
+ ### The 27-24 Relationship
283
+
284
+ ```
285
+ 27 = 3³ (YPC-27 polynomial degree)
286
+ 24 = 3 × 8 (SST Fibonacci cycle)
287
+
288
+ LCM(27, 24) = 216 = 6³
289
+
290
+ The full hypercycle repeats every 216 chunks!
291
+ ```
292
+
293
+ ---
294
+
295
+ ## 3. KARMA Trust Geometry
296
+
297
+ ### SST Synergy Triangle
298
+
299
+ SST proposes the 30-60-90 triangle as the fundamental geometric unit, superior to Phi-based spirals for describing natural growth.
300
+
301
+ ```
302
+ 90°
303
+ /|
304
+ / |
305
+ / | (height = 9)
306
+ / |
307
+ /60° |
308
+ /_____|
309
+ 30° (base = 3)
310
+
311
+ Ratios: 1 : √3 : 2 (normalized to 3 : 5.196 : 6)
312
+ ```
313
+
314
+ ### Application to KARMA Trust Levels
315
+
316
+ Current KARMA has trust tiers. We can reorganize using SST geometry:
317
+
318
+ ```javascript
319
+ /**
320
+ * KARMA Trust Geometry based on SST Synergy Triangle.
321
+ *
322
+ * The 30-60-90 triangle defines trust flow patterns:
323
+ *
324
+ * - 30° (shallow): Light trust, many connections
325
+ * - 60° (balanced): Moderate trust, balanced connections
326
+ * - 90° (deep): High trust, few but strong connections
327
+ */
328
+
329
+ export const TrustAngles = {
330
+ SHALLOW: 30, // Fast, wide, low commitment
331
+ BALANCED: 60, // Medium speed, medium width
332
+ DEEP: 90, // Slow, narrow, high commitment
333
+ };
334
+
335
+ /**
336
+ * Calculate trust decay based on SST triangle.
337
+ *
338
+ * Shallow (30°) trust decays quickly: halfLife = 24 hours
339
+ * Balanced (60°) trust decays moderately: halfLife = 7 days
340
+ * Deep (90°) trust decays slowly: halfLife = 90 days
341
+ *
342
+ * These map to the 3-6-9 pattern:
343
+ * 30 → 3 → Family C (base)
344
+ * 60 → 6 → Family C (medium)
345
+ * 90 → 9 → Family C (apex)
346
+ */
347
+ export function trustHalfLife(angle) {
348
+ const HOUR = 3600 * 1000;
349
+ const DAY = 24 * HOUR;
350
+
351
+ switch (angle) {
352
+ case TrustAngles.SHALLOW:
353
+ return 1 * DAY; // 24 hours (digital root = 6 → Family C)
354
+ case TrustAngles.BALANCED:
355
+ return 7 * DAY; // 168 hours (1+6+8 = 15 → 6 → Family C)
356
+ case TrustAngles.DEEP:
357
+ return 90 * DAY; // 2160 hours (2+1+6+0 = 9 → Family C)
358
+ default:
359
+ return 7 * DAY;
360
+ }
361
+ }
362
+
363
+ /**
364
+ * Trust propagation based on Synergy Triangle ratios.
365
+ *
366
+ * When trust flows from node A to B:
367
+ * - Direct connection: 100% of A's endorsement
368
+ * - One hop away: 57.7% (1/√3, the 30-60-90 ratio)
369
+ * - Two hops away: 33.3% (1/3)
370
+ * - Three hops away: 19.2% (1/√27)
371
+ */
372
+ export const TRUST_PROPAGATION = {
373
+ DIRECT: 1.0,
374
+ ONE_HOP: 0.577, // 1 / √3
375
+ TWO_HOPS: 0.333, // 1 / 3
376
+ THREE_HOPS: 0.192, // 1 / √27
377
+ };
378
+
379
+ /**
380
+ * Apply SST trust propagation.
381
+ * @param {number} baseTrust - Original trust score (0-1)
382
+ * @param {number} hops - Distance from source
383
+ * @returns {number} - Propagated trust score
384
+ */
385
+ export function propagateTrust(baseTrust, hops) {
386
+ switch (hops) {
387
+ case 0: return baseTrust * TRUST_PROPAGATION.DIRECT;
388
+ case 1: return baseTrust * TRUST_PROPAGATION.ONE_HOP;
389
+ case 2: return baseTrust * TRUST_PROPAGATION.TWO_HOPS;
390
+ case 3: return baseTrust * TRUST_PROPAGATION.THREE_HOPS;
391
+ default:
392
+ // Beyond 3 hops: 1 / √(3^n) = 3^(-n/2)
393
+ return baseTrust * Math.pow(3, -hops / 2);
394
+ }
395
+ }
396
+ ```
397
+
398
+ ### Trust Triangle Visualization
399
+
400
+ ```
401
+ HIGH TRUST (apex)
402
+ /\
403
+ / \
404
+ / 9 \ 90° zone: Validators, longtime members
405
+ /______\
406
+ / 6 \ 60° zone: Regular participants
407
+ /__________\
408
+ / 3 \ 30° zone: New nodes, observers
409
+ /______________\
410
+ LOT TRUST (base)
411
+ ```
412
+
413
+ ---
414
+
415
+ ## 4. PRAMAAN Hexagonal Tessellation
416
+
417
+ ### SST Natural Geometry
418
+
419
+ SST argues that hexagons are nature's "easiest path" - seen in beehives, Saturn's polar storm, and bubble formations. The 30-60-90 triangle tiles naturally into hexagonal patterns.
420
+
421
+ ### Hexagonal Geographic Zones
422
+
423
+ Instead of circular exclusion zones, use hexagonal tessellation:
424
+
425
+ ```javascript
426
+ /**
427
+ * PRAMAAN Hexagonal Tessellation
428
+ *
429
+ * Geographic proof zones as hexagonal cells.
430
+ * Each cell is defined by:
431
+ * - Center landmark coordinates
432
+ * - Radius in km (minimum exclusion distance)
433
+ * - 6 neighbor cells (hexagonal adjacency)
434
+ */
435
+
436
+ // Hexagonal grid constants based on SST
437
+ export const HEX_CONSTANTS = {
438
+ // The 30-60-90 ratios scaled to standard hex cell
439
+ INNER_RADIUS: 1, // Apothem (center to edge midpoint)
440
+ OUTER_RADIUS: 1.1547, // 2/√3 (center to vertex)
441
+ EDGE_LENGTH: 1.1547, // Same as outer radius
442
+
443
+ // SST-inspired cell sizes (km)
444
+ CELL_SIZES: {
445
+ MICRO: 9, // 9 km - City district
446
+ SMALL: 27, // 27 km - Metro area (3³)
447
+ MEDIUM: 81, // 81 km - Regional (3⁴)
448
+ LARGE: 243, // 243 km - National (3⁵)
449
+ MEGA: 729, // 729 km - Continental (3⁶)
450
+ }
451
+ };
452
+
453
+ /**
454
+ * Axial coordinates for hexagonal grid (cube coordinates simplified).
455
+ * Uses the "pointy-top" orientation aligned with 30-60-90 triangles.
456
+ */
457
+ export class HexCoord {
458
+ constructor(q, r) {
459
+ this.q = q; // Column
460
+ this.r = r; // Row
461
+ }
462
+
463
+ /** Get the 6 neighbor cells */
464
+ neighbors() {
465
+ return [
466
+ new HexCoord(this.q + 1, this.r), // E
467
+ new HexCoord(this.q + 1, this.r - 1), // NE
468
+ new HexCoord(this.q, this.r - 1), // NW
469
+ new HexCoord(this.q - 1, this.r), // W
470
+ new HexCoord(this.q - 1, this.r + 1), // SW
471
+ new HexCoord(this.q, this.r + 1), // SE
472
+ ];
473
+ }
474
+
475
+ /** Distance to another hex cell */
476
+ distanceTo(other) {
477
+ const s1 = -this.q - this.r;
478
+ const s2 = -other.q - other.r;
479
+ return Math.max(
480
+ Math.abs(this.q - other.q),
481
+ Math.abs(this.r - other.r),
482
+ Math.abs(s1 - s2)
483
+ );
484
+ }
485
+
486
+ /** Convert to lat/lon given cell size and reference point */
487
+ toLatLon(cellSizeKm, refLat, refLon) {
488
+ const EARTH_RADIUS_KM = 6371;
489
+
490
+ // Hex to cartesian (pointy-top)
491
+ const x = cellSizeKm * (Math.sqrt(3) * this.q + Math.sqrt(3) / 2 * this.r);
492
+ const y = cellSizeKm * (3 / 2 * this.r);
493
+
494
+ // To lat/lon offset
495
+ const latOffset = (y / EARTH_RADIUS_KM) * (180 / Math.PI);
496
+ const lonOffset = (x / (EARTH_RADIUS_KM * Math.cos(refLat * Math.PI / 180))) * (180 / Math.PI);
497
+
498
+ return {
499
+ lat: refLat + latOffset,
500
+ lon: refLon + lonOffset
501
+ };
502
+ }
503
+
504
+ /** Get hex cell from lat/lon */
505
+ static fromLatLon(lat, lon, cellSizeKm, refLat, refLon) {
506
+ const EARTH_RADIUS_KM = 6371;
507
+
508
+ // Lat/lon to cartesian offset
509
+ const y = (lat - refLat) * (Math.PI / 180) * EARTH_RADIUS_KM;
510
+ const x = (lon - refLon) * (Math.PI / 180) * EARTH_RADIUS_KM * Math.cos(refLat * Math.PI / 180);
511
+
512
+ // Cartesian to hex (pointy-top, inverse)
513
+ const q = (Math.sqrt(3) / 3 * x - 1 / 3 * y) / cellSizeKm;
514
+ const r = (2 / 3 * y) / cellSizeKm;
515
+
516
+ // Round to nearest hex
517
+ return HexCoord.round(q, r);
518
+ }
519
+
520
+ /** Round fractional hex coordinates to nearest integer hex */
521
+ static round(q, r) {
522
+ const s = -q - r;
523
+
524
+ let rq = Math.round(q);
525
+ let rr = Math.round(r);
526
+ let rs = Math.round(s);
527
+
528
+ const qDiff = Math.abs(rq - q);
529
+ const rDiff = Math.abs(rr - r);
530
+ const sDiff = Math.abs(rs - s);
531
+
532
+ if (qDiff > rDiff && qDiff > sDiff) {
533
+ rq = -rr - rs;
534
+ } else if (rDiff > sDiff) {
535
+ rr = -rq - rs;
536
+ }
537
+
538
+ return new HexCoord(rq, rr);
539
+ }
540
+ }
541
+
542
+ /**
543
+ * Geographic proof using hexagonal zones.
544
+ *
545
+ * A node proves it's NOT in a hex cell by having RTT too low
546
+ * to be at that distance from the landmark.
547
+ */
548
+ export function proveHexExclusion(landmarkHex, nodeRtt, cellSizeKm) {
549
+ const FIBER_SPEED_KM_PER_MS = 199.861;
550
+
551
+ // Minimum distance from RTT
552
+ const minDistanceKm = (nodeRtt / 2) * FIBER_SPEED_KM_PER_MS;
553
+
554
+ // Number of hex cells that can be excluded
555
+ const cellsExcluded = Math.floor(minDistanceKm / cellSizeKm);
556
+
557
+ // Generate ring of excluded cells
558
+ const excludedCells = [];
559
+ for (let ring = 0; ring <= cellsExcluded; ring++) {
560
+ excludedCells.push(...hexRing(landmarkHex, ring));
561
+ }
562
+
563
+ return {
564
+ minDistanceKm,
565
+ cellsExcluded: cellsExcluded + 1, // +1 for center cell
566
+ excludedHexes: excludedCells
567
+ };
568
+ }
569
+
570
+ /**
571
+ * Get all hex cells in a ring around a center.
572
+ * Ring 0 = just the center, Ring 1 = 6 cells, Ring 2 = 12 cells, etc.
573
+ */
574
+ function hexRing(center, radius) {
575
+ if (radius === 0) return [center];
576
+
577
+ const results = [];
578
+ let hex = new HexCoord(center.q + radius, center.r - radius);
579
+
580
+ // 6 directions, radius steps each
581
+ const directions = [
582
+ [0, 1], [-1, 1], [-1, 0], [0, -1], [1, -1], [1, 0]
583
+ ];
584
+
585
+ for (const [dq, dr] of directions) {
586
+ for (let i = 0; i < radius; i++) {
587
+ results.push(hex);
588
+ hex = new HexCoord(hex.q + dq, hex.r + dr);
589
+ }
590
+ }
591
+
592
+ return results;
593
+ }
594
+ ```
595
+
596
+ ### Hexagonal Network Topology
597
+
598
+ The MANDALA mesh topology can also use hexagonal structure:
599
+
600
+ ```
601
+ Node─────Node
602
+ / ╲ / ╲
603
+ Node Node Node
604
+ ╲ / ╲ /
605
+ Node─────Node
606
+ / ╲ / ╲
607
+ Node Node Node
608
+ ╲ / ╲ /
609
+ Node─────Node
610
+ ```
611
+
612
+ Each node has exactly **6 preferred peers**, matching the hexagonal geometry.
613
+
614
+ ---
615
+
616
+ ## 5. Implementation Roadmap
617
+
618
+ ### Phase 1: Foundation (v2.9.0)
619
+ - [ ] Create `oracle/sst.js` with digital root and family mapping
620
+ - [ ] Add SST utility functions to TRIBHUJ
621
+ - [ ] Unit tests for all SST primitives
622
+
623
+ ### Phase 2: YPC-27 Enhancement (v2.9.1)
624
+ - [ ] Implement YPC-27-SST with 24-cycle rotation
625
+ - [ ] Benchmark performance vs. static seed
626
+ - [ ] Document the 216-hypercycle relationship
627
+
628
+ ### Phase 3: KARMA Geometry (v2.10.0)
629
+ - [ ] Implement trust propagation with √3 ratios
630
+ - [ ] Add trust angle classification
631
+ - [ ] Create trust triangle visualization
632
+
633
+ ### Phase 4: PRAMAAN Hexagons (v2.11.0)
634
+ - [ ] Implement HexCoord class
635
+ - [ ] Add hexagonal zone exclusion to geo-proof
636
+ - [ ] Create hexagonal MANDALA topology option
637
+
638
+ ---
639
+
640
+ ## 6. Mathematical Foundations
641
+
642
+ ### Why 27?
643
+
644
+ ```
645
+ 27 = 3³
646
+
647
+ In SST terms:
648
+ - 3 is the base of the Synergy Triangle (30° angle)
649
+ - 3³ represents three levels of triangular nesting
650
+ - 27 trits can express 7.6 trillion unique states (3^27)
651
+
652
+ In YAKMESH:
653
+ - YPC-27 checksum degree
654
+ - 27 trits = ~42.7 bits (vs 40-bit CRC)
655
+ - Maps to NTRU lattice parameter n=27
656
+ ```
657
+
658
+ ### Why 24?
659
+
660
+ ```
661
+ 24 = 3 × 8 = 3 × 2³
662
+
663
+ In SST terms:
664
+ - Fibonacci digital roots repeat every 24 positions
665
+ - 24 = 2 full cycles of the 3-6-9 governing pattern
666
+ - The "heartbeat" of SST mathematics
667
+
668
+ In YAKMESH:
669
+ - Potential epoch length for seed rotation
670
+ - 24 hours = 1 day (natural time unit)
671
+ - 24 × 27 = 648 trits full hypercycle
672
+ ```
673
+
674
+ ### The 3-6-9 Pattern in YAKMESH
675
+
676
+ | Concept | Value | Digital Root | Family |
677
+ |---------|-------|--------------|--------|
678
+ | Trit values | -1, 0, +1 | 8, 9, 1 | B, C, A |
679
+ | YPC degree | 27 | 9 | C (Governing) |
680
+ | Fibonacci cycle | 24 | 6 | C (Governing) |
681
+ | LCM(27,24) | 216 | 9 | C (Governing) |
682
+ | 216 ÷ 27 | 8 | 8 | B (Physical+) |
683
+ | 216 ÷ 24 | 9 | 9 | C (Governing) |
684
+
685
+ The governing 3-6-9 family appears consistently in YAKMESH's core constants!
686
+
687
+ ---
688
+
689
+ ## 7. Conclusion
690
+
691
+ SST provides a compelling mathematical framework that validates and extends YAKMESH's ternary architecture. The proposed integrations:
692
+
693
+ 1. **Unify** existing systems under a coherent mathematical philosophy
694
+ 2. **Enhance** security through dynamic rotation schedules
695
+ 3. **Optimize** trust propagation using natural geometric ratios
696
+ 4. **Enable** geographic proofs with efficient hexagonal tessellation
697
+
698
+ The philosophical connection is striking: YAKMESH chose balanced ternary for practical reasons (radix economy, NTRU compatibility), but SST suggests this aligns with fundamental patterns in nature and mathematics.
699
+
700
+ ---
701
+
702
+ ## References
703
+
704
+ 1. Long, Wesley. "Synergy Sequence Theory Explained" (2024)
705
+ 2. Hayes, Brian. "Third Base" American Scientist (2001)
706
+ 3. YAKMESH TRIBHUJ Specification v2.8.2
707
+ 4. YAKMESH YPC-27 Specification v2.8.2
708
+ 5. Tesla, Nikola. "If you knew the magnificence of 3, 6, and 9..." (attributed)
709
+
710
+ ---
711
+
712
+ *"The universe is built on ternary logic: positive, negative, and neutral. SST reveals why."*