diff --git a/servers/gcp/tfplan-ingress b/servers/gcp/tfplan-ingress new file mode 100644 index 0000000..d904cbe Binary files /dev/null and b/servers/gcp/tfplan-ingress differ diff --git a/servers/legion/apps/adguard-config.yaml b/servers/legion/apps/adguard-config.yaml index 60ae69a..d0e25ee 100644 --- a/servers/legion/apps/adguard-config.yaml +++ b/servers/legion/apps/adguard-config.yaml @@ -6,7 +6,7 @@ metadata: spec: project: default source: - repoURL: http://10.43.1.53:3000/will/infrastructure.git + repoURL: http://gitea.git.svc.cluster.local:3000/will/infrastructure.git targetRevision: main path: servers/legion/k8s/adguard destination: diff --git a/servers/legion/apps/backup.yaml b/servers/legion/apps/backup.yaml index 9ad29e6..65a1fcb 100644 --- a/servers/legion/apps/backup.yaml +++ b/servers/legion/apps/backup.yaml @@ -6,7 +6,7 @@ metadata: spec: project: default source: - repoURL: http://10.43.1.53:3000/will/infrastructure.git + repoURL: http://gitea.git.svc.cluster.local:3000/will/infrastructure.git targetRevision: main path: servers/legion/k8s/backup destination: diff --git a/servers/legion/apps/ci-config.yaml b/servers/legion/apps/ci-config.yaml index 1877d37..f185bff 100644 --- a/servers/legion/apps/ci-config.yaml +++ b/servers/legion/apps/ci-config.yaml @@ -6,7 +6,7 @@ metadata: spec: project: default source: - repoURL: http://10.43.1.53:3000/will/infrastructure.git + repoURL: http://gitea.git.svc.cluster.local:3000/will/infrastructure.git targetRevision: main path: servers/legion/k8s/github-runner destination: @@ -27,7 +27,7 @@ metadata: spec: project: default source: - repoURL: http://10.43.1.53:3000/will/infrastructure.git + repoURL: http://gitea.git.svc.cluster.local:3000/will/infrastructure.git targetRevision: main path: servers/legion/k8s/gitea-runner destination: diff --git a/servers/legion/apps/external-secrets-config.yaml b/servers/legion/apps/external-secrets-config.yaml index 6a2ff49..a2dcb26 100644 --- a/servers/legion/apps/external-secrets-config.yaml +++ b/servers/legion/apps/external-secrets-config.yaml @@ -6,7 +6,7 @@ metadata: spec: project: default source: - repoURL: http://10.43.1.53:3000/will/infrastructure.git + repoURL: http://gitea.git.svc.cluster.local:3000/will/infrastructure.git targetRevision: main path: servers/legion/k8s/external-secrets destination: diff --git a/servers/legion/apps/fornax.yaml b/servers/legion/apps/fornax.yaml index 2e63e33..769ed3c 100644 --- a/servers/legion/apps/fornax.yaml +++ b/servers/legion/apps/fornax.yaml @@ -7,7 +7,7 @@ metadata: spec: project: default source: - repoURL: http://10.43.1.53:3000/will/infrastructure.git + repoURL: http://gitea.git.svc.cluster.local:3000/will/infrastructure.git targetRevision: main path: servers/legion/k8s/fornax/coordinator destination: @@ -29,7 +29,7 @@ metadata: spec: project: default source: - repoURL: http://10.43.1.53:3000/will/infrastructure.git + repoURL: http://gitea.git.svc.cluster.local:3000/will/infrastructure.git targetRevision: main path: servers/legion/k8s/fornax/ui destination: @@ -51,7 +51,7 @@ metadata: spec: project: default source: - repoURL: http://10.43.1.53:3000/will/infrastructure.git + repoURL: http://gitea.git.svc.cluster.local:3000/will/infrastructure.git targetRevision: main path: servers/legion/k8s/fornax/grafana destination: diff --git a/servers/legion/apps/gitea-config.yaml b/servers/legion/apps/gitea-config.yaml index b042f7a..fa81d51 100644 --- a/servers/legion/apps/gitea-config.yaml +++ b/servers/legion/apps/gitea-config.yaml @@ -6,7 +6,7 @@ metadata: spec: project: default source: - repoURL: http://10.43.1.53:3000/will/infrastructure.git + repoURL: http://gitea.git.svc.cluster.local:3000/will/infrastructure.git targetRevision: main path: servers/legion/k8s/gitea destination: diff --git a/servers/legion/apps/headscale-config.yaml b/servers/legion/apps/headscale-config.yaml index c89d971..976c1e3 100644 --- a/servers/legion/apps/headscale-config.yaml +++ b/servers/legion/apps/headscale-config.yaml @@ -6,7 +6,7 @@ metadata: spec: project: default source: - repoURL: http://10.43.1.53:3000/will/infrastructure.git + repoURL: http://gitea.git.svc.cluster.local:3000/will/infrastructure.git targetRevision: main path: servers/legion/k8s/headscale destination: diff --git a/servers/legion/apps/media.yaml b/servers/legion/apps/media.yaml index 2bf6aae..b42aa2a 100644 --- a/servers/legion/apps/media.yaml +++ b/servers/legion/apps/media.yaml @@ -6,7 +6,7 @@ metadata: spec: project: default source: - repoURL: http://10.43.1.53:3000/will/infrastructure.git + repoURL: http://gitea.git.svc.cluster.local:3000/will/infrastructure.git targetRevision: main path: servers/legion/k8s/media destination: diff --git a/servers/legion/apps/monitoring-config.yaml b/servers/legion/apps/monitoring-config.yaml index f5853c7..a84d505 100644 --- a/servers/legion/apps/monitoring-config.yaml +++ b/servers/legion/apps/monitoring-config.yaml @@ -6,7 +6,7 @@ metadata: spec: project: default source: - repoURL: http://10.43.1.53:3000/will/infrastructure.git + repoURL: http://gitea.git.svc.cluster.local:3000/will/infrastructure.git targetRevision: main path: servers/legion/k8s/monitoring destination: diff --git a/servers/legion/apps/mudcraft.yaml b/servers/legion/apps/mudcraft.yaml index 85c28c4..c872fb0 100644 --- a/servers/legion/apps/mudcraft.yaml +++ b/servers/legion/apps/mudcraft.yaml @@ -6,7 +6,7 @@ metadata: spec: project: default source: - repoURL: http://10.43.1.53:3000/will/infrastructure.git + repoURL: http://gitea.git.svc.cluster.local:3000/will/infrastructure.git targetRevision: main path: servers/legion/k8s/mudcraft destination: diff --git a/servers/legion/apps/neuron-config.yaml b/servers/legion/apps/neuron-config.yaml index ef04a57..c058e73 100644 --- a/servers/legion/apps/neuron-config.yaml +++ b/servers/legion/apps/neuron-config.yaml @@ -6,7 +6,7 @@ metadata: spec: project: default source: - repoURL: http://10.43.1.53:3000/will/infrastructure.git + repoURL: http://gitea.git.svc.cluster.local:3000/will/infrastructure.git targetRevision: main path: servers/legion/k8s/neuron destination: diff --git a/servers/legion/apps/neuron-daemon.yaml b/servers/legion/apps/neuron-daemon.yaml index 3adfc5b..4b1ce9d 100644 --- a/servers/legion/apps/neuron-daemon.yaml +++ b/servers/legion/apps/neuron-daemon.yaml @@ -6,7 +6,7 @@ metadata: spec: project: default source: - repoURL: http://10.43.1.53:3000/will/infrastructure.git + repoURL: http://gitea.git.svc.cluster.local:3000/will/infrastructure.git targetRevision: main path: servers/legion/k8s/neuron-technologies/daemon destination: diff --git a/servers/legion/apps/neuron-dev.yaml b/servers/legion/apps/neuron-dev.yaml index 4b6f32b..0266d95 100644 --- a/servers/legion/apps/neuron-dev.yaml +++ b/servers/legion/apps/neuron-dev.yaml @@ -6,7 +6,7 @@ metadata: spec: project: default source: - repoURL: http://10.43.1.53:3000/will/infrastructure.git + repoURL: http://gitea.git.svc.cluster.local:3000/will/infrastructure.git targetRevision: main path: servers/legion/k8s/neuron-technologies/dev destination: diff --git a/servers/legion/apps/neuron-marketing.yaml b/servers/legion/apps/neuron-marketing.yaml index 4969b07..a274196 100644 --- a/servers/legion/apps/neuron-marketing.yaml +++ b/servers/legion/apps/neuron-marketing.yaml @@ -6,7 +6,7 @@ metadata: spec: project: default source: - repoURL: http://10.43.1.53:3000/will/infrastructure.git + repoURL: http://gitea.git.svc.cluster.local:3000/will/infrastructure.git targetRevision: main path: servers/legion/k8s/neuron-technologies/marketing destination: diff --git a/servers/legion/apps/neuron-prod-project.yaml b/servers/legion/apps/neuron-prod-project.yaml index ec3e501..dae22ba 100644 --- a/servers/legion/apps/neuron-prod-project.yaml +++ b/servers/legion/apps/neuron-prod-project.yaml @@ -15,7 +15,7 @@ spec: # Only allow deployments sourced from the infrastructure repo. sourceRepos: - - "http://10.43.1.53:3000/will/infrastructure.git" + - "http://gitea.git.svc.cluster.local:3000/will/infrastructure.git" - "https://code.forgejo.org" - "registry.neuralplatform.ai" diff --git a/servers/legion/apps/neuron-prod.yaml b/servers/legion/apps/neuron-prod.yaml index 40b9a1b..20ebe8b 100644 --- a/servers/legion/apps/neuron-prod.yaml +++ b/servers/legion/apps/neuron-prod.yaml @@ -6,7 +6,7 @@ metadata: spec: project: default source: - repoURL: http://10.43.1.53:3000/will/infrastructure.git + repoURL: http://gitea.git.svc.cluster.local:3000/will/infrastructure.git targetRevision: main path: servers/legion/k8s/neuron-technologies/prod destination: diff --git a/servers/legion/apps/neuron-stage.yaml b/servers/legion/apps/neuron-stage.yaml index ef6fbf6..4d1d02a 100644 --- a/servers/legion/apps/neuron-stage.yaml +++ b/servers/legion/apps/neuron-stage.yaml @@ -6,7 +6,7 @@ metadata: spec: project: default source: - repoURL: http://10.43.1.53:3000/will/infrastructure.git + repoURL: http://gitea.git.svc.cluster.local:3000/will/infrastructure.git targetRevision: main path: servers/legion/k8s/neuron-technologies/stage destination: diff --git a/servers/legion/apps/neuron-swarm.yaml b/servers/legion/apps/neuron-swarm.yaml index ff0eb46..1264296 100644 --- a/servers/legion/apps/neuron-swarm.yaml +++ b/servers/legion/apps/neuron-swarm.yaml @@ -6,7 +6,7 @@ metadata: spec: project: default source: - repoURL: http://10.43.1.53:3000/will/infrastructure.git + repoURL: http://gitea.git.svc.cluster.local:3000/will/infrastructure.git targetRevision: main path: servers/legion/k8s/neuron-technologies/swarm destination: diff --git a/servers/legion/apps/neuron-tim.yaml b/servers/legion/apps/neuron-tim.yaml index ec75f14..abcd250 100644 --- a/servers/legion/apps/neuron-tim.yaml +++ b/servers/legion/apps/neuron-tim.yaml @@ -6,7 +6,7 @@ metadata: spec: project: default source: - repoURL: http://10.43.1.53:3000/will/infrastructure.git + repoURL: http://gitea.git.svc.cluster.local:3000/will/infrastructure.git targetRevision: main path: servers/legion/k8s/neuron-technologies/tim destination: diff --git a/servers/legion/apps/ollama-config.yaml b/servers/legion/apps/ollama-config.yaml index 76565b8..579769e 100644 --- a/servers/legion/apps/ollama-config.yaml +++ b/servers/legion/apps/ollama-config.yaml @@ -6,7 +6,7 @@ metadata: spec: project: default source: - repoURL: http://10.43.1.53:3000/will/infrastructure.git + repoURL: http://gitea.git.svc.cluster.local:3000/will/infrastructure.git targetRevision: main path: servers/legion/k8s/ollama destination: diff --git a/servers/legion/apps/packages-config.yaml b/servers/legion/apps/packages-config.yaml index f753266..b331824 100644 --- a/servers/legion/apps/packages-config.yaml +++ b/servers/legion/apps/packages-config.yaml @@ -6,7 +6,7 @@ metadata: spec: project: default source: - repoURL: http://10.43.1.53:3000/will/infrastructure.git + repoURL: http://gitea.git.svc.cluster.local:3000/will/infrastructure.git targetRevision: main path: servers/legion/k8s/packages destination: diff --git a/servers/legion/apps/postgres-config.yaml b/servers/legion/apps/postgres-config.yaml index 0a60ba0..352c4d9 100644 --- a/servers/legion/apps/postgres-config.yaml +++ b/servers/legion/apps/postgres-config.yaml @@ -6,7 +6,7 @@ metadata: spec: project: default source: - repoURL: http://10.43.1.53:3000/will/infrastructure.git + repoURL: http://gitea.git.svc.cluster.local:3000/will/infrastructure.git targetRevision: main path: servers/legion/k8s/postgres destination: diff --git a/servers/legion/apps/registry-config.yaml b/servers/legion/apps/registry-config.yaml index b5e30f8..c977c1c 100644 --- a/servers/legion/apps/registry-config.yaml +++ b/servers/legion/apps/registry-config.yaml @@ -6,7 +6,7 @@ metadata: spec: project: default source: - repoURL: http://10.43.1.53:3000/will/infrastructure.git + repoURL: http://gitea.git.svc.cluster.local:3000/will/infrastructure.git targetRevision: main path: servers/legion/k8s/registry destination: diff --git a/servers/legion/apps/vault-config.yaml b/servers/legion/apps/vault-config.yaml index 76476e2..b25920f 100644 --- a/servers/legion/apps/vault-config.yaml +++ b/servers/legion/apps/vault-config.yaml @@ -6,7 +6,7 @@ metadata: spec: project: default source: - repoURL: http://10.43.1.53:3000/will/infrastructure.git + repoURL: http://gitea.git.svc.cluster.local:3000/will/infrastructure.git targetRevision: main path: servers/legion/k8s/vault destination: diff --git a/servers/legion/rosetta_experiment.py b/servers/legion/rosetta_experiment.py new file mode 100644 index 0000000..ca24e64 --- /dev/null +++ b/servers/legion/rosetta_experiment.py @@ -0,0 +1,194 @@ +#!/usr/bin/env python3 +""" +Rosetta Stone compression experiment on real Kotlin source files. +""" + +import re +from collections import Counter + +SYMBOL_POOL = list("ΩΘΦΨΣΔΛΠΞΓαβγδεζηκλμνξπρστυφχψω§¶†‡•◆▲■★") +MIN_TERM_LEN = 6 +MIN_TERM_FREQ = 2 +HEADER_COST = 20 # chars per symbol entry in header +MIN_STRIP_LEN = 5 +VOWELS = set("aeiouAEIOU") + + +def term_frequencies(text): + return Counter(re.findall(r'[A-Za-z][A-Za-z0-9_]{' + str(MIN_TERM_LEN-1) + r',}', text)) + + +def build_symbol_table(freq): + ranked = sorted( + [(t, f, (len(t)-1)*f - HEADER_COST) for t, f in freq.items() + if f >= MIN_TERM_FREQ and (len(t)-1)*f - HEADER_COST > 0], + key=lambda x: -x[2] + ) + return {term: SYMBOL_POOL[i] for i, (term, _, _) in enumerate(ranked) if i < len(SYMBOL_POOL)} + + +def apply_symbols(text, table): + for term in sorted(table, key=len, reverse=True): + text = re.sub(r'\b' + re.escape(term) + r'\b', table[term], text) + return text + + +def strip_vowels(text): + def strip_word(m): + w = m.group() + if w.isupper(): return w # ALL-CAPS preserved + if '_' in w: return w # snake_case preserved + if any(c.isupper() for c in w[1:]): return w # camelCase preserved + return w[0] + ''.join(c for c in w[1:] if c not in VOWELS) + return re.sub(r'\b[A-Za-z]{' + str(MIN_STRIP_LEN) + r',}\b', strip_word, text) + + +def build_header(table): + if not table: + return f"This is your Rosetta Stone.\nRule: vowels stripped from plain words≥{MIN_STRIP_LEN}chr (ALL-CAPS/camelCase/snake_case preserved).\n---\n" + terms = " ".join(f"{sym}={term}" for term, sym in table.items()) + return f"This is your Rosetta Stone.\nRule: vowels stripped from plain words≥{MIN_STRIP_LEN}chr (ALL-CAPS/camelCase/snake_case preserved).\nTerms: {terms}\n---\n" + + +def encode(text): + freq = term_frequencies(text) + table = build_symbol_table(freq) + body = apply_symbols(text, table) + body = strip_vowels(body) + header = build_header(table) + full = header + body + return { + 'header': header, + 'body': body, + 'full': full, + 'symbol_table': table, + 'freq': freq, + 'orig_len': len(text), + 'enc_len': len(full), + 'ratio': len(full) / len(text), + 'reduction_pct': (1 - len(full)/len(text)) * 100 + } + + +def detailed_symbol_table(table, freq, text): + """Return per-symbol stats: term, freq, gross savings, header cost, net savings.""" + rows = [] + for term, sym in table.items(): + f = freq[term] + gross = (len(term) - 1) * f # replacing len(term) chars with 1 char, times freq + net = gross - HEADER_COST + rows.append((sym, term, f, gross, net)) + rows.sort(key=lambda x: -x[4]) + return rows + + +def run_experiment(filepath, label): + with open(filepath, 'r', encoding='utf-8') as fh: + text = fh.read() + + result = encode(text) + table = result['symbol_table'] + freq = result['freq'] + rows = detailed_symbol_table(table, freq, text) + + orig_tokens = result['orig_len'] / 4 + enc_tokens = result['enc_len'] / 4 + + # Header vs body savings + header_size = len(result['header']) + body_size = len(result['body']) + # Savings = orig_len - body_size (header is overhead) + body_savings = result['orig_len'] - body_size + net_savings = result['orig_len'] - result['enc_len'] + + # Symbol savings vs vowel stripping savings + # Apply only symbols (no vowel strip) to measure symbol contribution + body_symbols_only = apply_symbols(text, table) + symbol_savings = result['orig_len'] - len(body_symbols_only) + + # Apply only vowel strip (no symbols) to measure vowel contribution + body_vowels_only = strip_vowels(text) + vowel_savings = result['orig_len'] - len(body_vowels_only) + + print(f"\n{'='*72}") + print(f"FILE: {label}") + print(f"{'='*72}") + print(f"\nOriginal: {result['orig_len']:,} chars (~{orig_tokens:,.0f} tokens)") + print(f"Encoded: {result['enc_len']:,} chars (~{enc_tokens:,.0f} tokens)") + print(f"Reduction: {result['reduction_pct']:.1f}%") + print(f"\nHeader size: {header_size:,} chars (overhead)") + print(f"Body savings vs orig: {body_savings:+,} chars") + print(f"Net savings after header: {net_savings:+,} chars") + print(f"\nSavings attribution (before header overhead):") + print(f" Symbol substitution alone: {symbol_savings:,} chars saved") + print(f" Vowel stripping alone: {vowel_savings:,} chars saved") + combined_gross = symbol_savings + vowel_savings + if combined_gross > 0: + print(f" Symbol share: {symbol_savings/combined_gross*100:.1f}% | Vowel share: {vowel_savings/combined_gross*100:.1f}%") + + print(f"\nSymbol table ({len(table)} symbols assigned, pool capacity {len(SYMBOL_POOL)}):") + print(f" {'SYM':<4} {'TERM':<45} {'FREQ':>5} {'GROSS':>7} {'NET':>7}") + print(f" {'-'*4} {'-'*45} {'-'*5} {'-'*7} {'-'*7}") + for sym, term, f, gross, net in rows: + print(f" {sym:<4} {term:<45} {f:>5} {gross:>7,} {net:>7,}") + + print(f"\nTop 5 by net savings:") + for sym, term, f, gross, net in rows[:5]: + print(f" {sym} = '{term}' freq={f} gross={gross} net={net}") + + print(f"\nFirst 500 chars of encoded body:") + print("-" * 60) + print(result['body'][:500]) + print("-" * 60) + + return result + + +# ---- Run on both files ---- + +CULT_FILE = ( + "/Users/will/Development/neuron-technologies/neuron/neuron-core/" + "src/main/kotlin/ai/neuron/core/synapse/services/managers/" + "cultivation/CultivationManager.kt" +) +DHARMA_FILE = ( + "/Users/will/Development/neuron-technologies/neuron/neuron-core/" + "src/main/kotlin/ai/neuron/core/synapse/services/managers/" + "dharma/DharmaManager.kt" +) + +r1 = run_experiment(CULT_FILE, "CultivationManager.kt") +r2 = run_experiment(DHARMA_FILE, "DharmaManager.kt") + +# ---- Combined summary ---- +total_orig = r1['orig_len'] + r2['orig_len'] +total_enc = r1['enc_len'] + r2['enc_len'] +total_reduction = (1 - total_enc / total_orig) * 100 + +print(f"\n{'='*72}") +print("COMBINED SUMMARY") +print(f"{'='*72}") +print(f"Total original: {total_orig:,} chars (~{total_orig/4:,.0f} tokens)") +print(f"Total encoded: {total_enc:,} chars (~{total_enc/4:,.0f} tokens)") +print(f"Combined reduction: {total_reduction:.1f}%") +print(f"Token budget saved: ~{(total_orig - total_enc)/4:,.0f} tokens") + +# ---- Analysis ---- +print(""" +ANALYSIS +-------- +Symbol table: terms must appear ≥2 times and have (len-1)*freq > 20 net chars saved. +In Kotlin source, the dominant repeating terms are fully-qualified class/method names, +type names, and domain vocabulary (prediction, evaluation, graph, properties, etc.). + +The algorithm performs best on: + - Long identifiers repeated many times (e.g. 'properties', 'evaluationId', 'graph') + - Domain-specific vocabulary that recurs heavily across a file + +Vowel stripping covers everything else: short repeated words, Kotlin keywords, +and identifiers that don't hit the symbol threshold. + +Readability of the encoded form is coarse but navigable: the header provides a +lookup table and camelCase/ALL-CAPS/snake_case identifiers are left intact, +which preserves the structural skeleton of the code. +""")