Skip to content

Commit 4c19ea5

Browse files
author
Antigravity Agent
committed
Merge: ralph/nexus-src into main — Cycles 91-93 + Sacred Math v3.6 + Codebase Context + hex-escape fix
2 parents 699fe13 + 5f11567 commit 4c19ea5

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

67 files changed

+8685
-976
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,9 @@ zig-windows-*/
8282
# Ralph logs (keep config)
8383
.ralph/logs/
8484

85+
# Context index (generated binary, 80MB+)
86+
.trinity-nexus/.context_index
87+
8588
# Temporary scripts
8689
check_ssh.py
8790

build.zig

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1514,7 +1514,8 @@ pub fn build(b: *std.Build) void {
15141514
// v8.4: Add raygui include path and C implementation
15151515
trinity_canvas.addIncludePath(b.path("external/raygui/src"));
15161516
trinity_canvas.addCSourceFile(.{ .file = b.path("src/vsa/raygui_impl.c") });
1517-
b.installArtifact(trinity_canvas);
1517+
// TEMP: Disable install until raygui.h is available
1518+
// b.installArtifact(trinity_canvas);
15181519

15191520
const run_trinity_canvas = b.addRunArtifact(trinity_canvas);
15201521
if (b.args) |args| {
@@ -1644,7 +1645,8 @@ pub fn build(b: *std.Build) void {
16441645
});
16451646
wasm_canvas.linkSystemLibrary("raylib");
16461647
wasm_canvas.linkLibC();
1647-
b.installArtifact(wasm_canvas);
1648+
// TEMP: Disable install until raygui.h is available
1649+
// b.installArtifact(wasm_canvas);
16481650
wasm_step.dependOn(b.getInstallStep());
16491651
}
16501652
}

docsite/docs/cli/analysis.md

Lines changed: 5 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ sidebar_label: Code Analysis
77

88
Static analysis, full-text search, and dependency graph tools.
99

10+
> **Note:** These commands are currently placeholders. They display system information (same as `tri info`) instead of performing analysis. Full implementations are planned for future cycles.
11+
1012
## analyze
1113

1214
Static code analysis with pattern detection.
@@ -17,31 +19,7 @@ tri analyze src/
1719
tri analyze src/vsa.zig
1820
```
1921

20-
Reports: TODO/FIXME count, large file detection (>500 lines), function visibility (public vs private ratio), patterns found.
21-
22-
**Example output:**
23-
24-
```
25-
TRI ANALYZE
26-
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
27-
Target: src/
28-
29-
Code Metrics:
30-
Zig files scanned: 210+
31-
TODOs found: 12
32-
FIXMEs found: 3
33-
Large files (>500): 8
34-
35-
Function Visibility:
36-
Public: 347
37-
Private: 189
38-
Ratio: 64.7% public
39-
40-
Patterns:
41-
test blocks: 94
42-
error unions: 67
43-
comptime: 23
44-
```
22+
**Current status:** Displays system info. Planned to report: TODO/FIXME count, large file detection (\>500 lines), function visibility (public vs private ratio), pattern detection.
4523

4624
## search
4725

@@ -53,20 +31,7 @@ tri search "cosineSimilarity"
5331
tri search "TODO" src/vsa.zig
5432
```
5533

56-
Searches all `.zig` files and displays matching lines with file path and line number.
57-
58-
**Example output:**
59-
60-
```
61-
TRI SEARCH: "cosineSimilarity"
62-
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
63-
64-
src/vsa.zig:142: pub fn cosineSimilarity(a: []const Trit, b: []const Trit) f64 {
65-
src/sdk.zig:89: const sim = vsa.cosineSimilarity(self.data, other.data);
66-
src/tri/tri_math.zig:301: // Uses cosineSimilarity for vector comparison
67-
68-
Found: 3 matches in 3 files
69-
```
34+
**Current status:** Displays system info. Planned to search all `.zig` files and display matching lines with file path and line number.
7035

7136
## deps
7237

@@ -77,23 +42,4 @@ tri deps [module]
7742
tri deps src/vsa.zig
7843
```
7944

80-
Shows import chains and reverse dependency tree.
81-
82-
**Example output:**
83-
84-
```
85-
DEPENDENCY ANALYSIS
86-
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
87-
Module: src/vsa.zig
88-
89-
Imports:
90-
└── std (stdlib)
91-
92-
Imported by:
93-
├── src/sdk.zig
94-
├── src/hybrid.zig
95-
├── src/vm.zig
96-
└── src/tri/tri_math.zig
97-
98-
Depth: 1 (leaf module)
99-
```
45+
**Current status:** Displays system info. Planned to show import chains and reverse dependency trees.

docsite/docs/cli/autonomous.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ Runs 5 independent health checks and produces a unified status report:
2121

2222
| # | Check | Command | What it verifies |
2323
|---|-------|---------|-----------------|
24-
| 1 | Doctor | `tri doctor` | System diagnostics (8 checks: Zig compiler, build.zig, main.zig, colors, binary, specs, core tests, VM tests) |
24+
| 1 | Doctor | `tri doctor` | System diagnostics (5 checks: Zig version, Compiler, Std Lib, Allocator, Build) |
2525
| 2 | Tests | `tri test` | All test suites pass (VSA, VM, integration) |
2626
| 3 | Strict | `tri strict` | VIBEE-first compliance (no manual code in protected dirs) |
2727
| 4 | Swarm | `tri swarm` | Agent health (16 agents, CRDT sync, connectivity) |

docsite/docs/cli/constants.md

Lines changed: 184 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,184 @@
1+
---
2+
sidebar_position: 15
3+
sidebar_label: Sacred Constants
4+
---
5+
6+
# Sacred Constants Reference
7+
8+
Complete catalog of mathematical, physical, and exotic constants available in TRI CLI. All constants are defined in `src/tri/tri_math.zig` and accessible via `tri constants` and `tri math` subcommands.
9+
10+
## Quick Access
11+
12+
```bash
13+
tri constants # Show core sacred constants (4 sections)
14+
tri math exotic # Exotic mathematical constants
15+
tri math physical # Physics constants
16+
tri math chaos # Chaos theory constants
17+
tri math all # Display ALL constants
18+
```
19+
20+
## `tri constants` Output (Cycle 82)
21+
22+
The `tri constants` command displays 4 sections of constants:
23+
24+
### Section 1: Golden Ratio
25+
26+
| Constant | Symbol | Value | Formula |
27+
|----------|--------|-------|---------|
28+
| Golden Ratio | $\phi$ | 1.6180339887498948482 | $(1 + \sqrt{5}) / 2$ |
29+
| Phi Squared | $\phi^2$ | 2.6180339887498948482 | $\phi^2 = \phi + 1$ |
30+
| Inverse Phi Squared | $1/\phi^2$ | 0.3819660112501051518 | $1/\phi^2 = \phi - 1$ |
31+
| Trinity Sum | $\phi^2 + 1/\phi^2$ | 3.0 | TRINITY IDENTITY — exact equality |
32+
33+
**Trinity Identity:**
34+
35+
$$\phi^2 + \frac{1}{\phi^2} = 3 = \text{TRINITY}$$
36+
37+
### Section 2: Transcendental
38+
39+
| Constant | Symbol | Value | Formula |
40+
|----------|--------|-------|---------|
41+
| Pi | $\pi$ | 3.14159265358979323846 | $C / d$ |
42+
| Euler's Number | $e$ | 2.71828182845904523536 | $\lim_{n\to\infty}(1 + 1/n)^n$ |
43+
| Transcendental Product | $\pi \times \phi \times e$ | 13.816890703380645 | $\approx$ TRYTE\_MAX (13) |
44+
45+
### Section 3: Genetic Algorithm
46+
47+
| Constant | Symbol | Value | Formula | Description |
48+
|----------|--------|-------|---------|-------------|
49+
| Mu | $\mu$ | 0.0382 | $1/\phi^2/10$ | Mutation rate |
50+
| Chi | $\chi$ | 0.0618 | $1/\phi/10$ | Crossover rate |
51+
| Sigma | $\sigma$ | 1.618 | $\phi$ | Selection pressure |
52+
| Epsilon | $\varepsilon$ | 0.333 | $1/3$ | Elitism rate |
53+
54+
### Section 4: Quantum
55+
56+
| Constant | Symbol | Value | Formula | Description |
57+
|----------|--------|-------|---------|-------------|
58+
| CHSH Inequality | CHSH | 2.8284271247461903 | $2\sqrt{2}$ | Bell inequality violation |
59+
| Fine Structure Inverse | $\alpha^{-1}$ | 137.036 | $4\pi^3 + \pi^2 + \pi$ | Fine structure constant |
60+
| Berry Phase | $\beta$ | 2.112 | $\pi(1 - 1/\phi)$ | Quantum-inspired phase |
61+
| SU3 Constant | SU3 | 0.927 | $3/(2\phi)$ | Energy harvesting constant |
62+
63+
## Exotic Mathematical Constants (Cycle 83)
64+
65+
```bash
66+
tri math exotic
67+
```
68+
69+
| Constant | Value | Description |
70+
|----------|-------|-------------|
71+
| Apery's constant $\zeta(3)$ | 1.2020569031595942 | Sum $\sum_{n=1}^{\infty} 1/n^3$, proved irrational by Apery (1978) |
72+
| Catalan's constant $G$ | 0.9159655941772190 | $\sum_{n=0}^{\infty} (-1)^n / (2n+1)^2$ |
73+
| Feigenbaum delta $\delta$ | 4.6692016091029906 | Period-doubling bifurcation ratio (chaos theory) |
74+
| Feigenbaum alpha $\alpha$ | 2.5029078750958928 | Scaling factor in bifurcation diagram |
75+
| Khinchin's constant $K$ | 2.6854520010653064 | Geometric mean of continued fraction coefficients |
76+
| Glaisher-Kinkelin $A$ | 1.2824271291006226 | Related to Barnes G-function |
77+
| Omega constant $\Omega$ | 0.5671432904097838 | $W(1)$ where $W$ is Lambert W function ($xe^x = 1$) |
78+
| Plastic number $\rho$ | 1.3247179572447460 | Real root of $x^3 = x + 1$ (cubic golden ratio) |
79+
| Landau-Ramanujan | 0.7642236535892206 | Density of sums of two squares |
80+
| Conway's constant $\lambda$ | 1.3035772690342963 | Growth rate of look-and-say sequence |
81+
82+
## Physics Constants (Cycle 83)
83+
84+
```bash
85+
tri math physical
86+
```
87+
88+
### Quantum & Electromagnetic
89+
90+
| Constant | Symbol | Value | Units |
91+
|----------|--------|-------|-------|
92+
| Fine structure | $\alpha$ | 0.0072973525693 | dimensionless |
93+
| Fine structure inverse | $1/\alpha$ | 137.036 | dimensionless |
94+
| CHSH bound | $2\sqrt{2}$ | 2.8284271247461903 | Bell test maximum |
95+
| Elementary charge | $e$ | $1.602176634 \times 10^{-19}$ | C |
96+
| Speed of light | $c$ | 299,792,458 | m/s |
97+
98+
### Planck Units
99+
100+
| Constant | Symbol | Value | Units |
101+
|----------|--------|-------|-------|
102+
| Planck constant | $h$ | $6.62607015 \times 10^{-34}$ | J·s |
103+
| Reduced Planck | $\hbar$ | $1.054571817 \times 10^{-34}$ | J·s |
104+
| Planck length | $l_P$ | $1.616255 \times 10^{-35}$ | m |
105+
| Planck time | $t_P$ | $5.391247 \times 10^{-44}$ | s |
106+
| Planck mass | $m_P$ | $2.176434 \times 10^{-8}$ | kg |
107+
108+
### Thermodynamics & Gravity
109+
110+
| Constant | Symbol | Value | Units |
111+
|----------|--------|-------|-------|
112+
| Boltzmann | $k_B$ | $1.380649 \times 10^{-23}$ | J/K |
113+
| Gravitational | $G$ | $6.67430 \times 10^{-11}$ | m$^3$/(kg·s$^2$) |
114+
| Avogadro's number | $N_A$ | $6.02214076 \times 10^{23}$ | 1/mol |
115+
116+
## Golden Function Constants (Cycle 84)
117+
118+
Based on Pellis 2025: "The Golden Function and its applications to mathematical physics."
119+
120+
```bash
121+
tri math golden-function
122+
```
123+
124+
| Constant | Value | Description |
125+
|----------|-------|-------------|
126+
| $\phi^{1/2}$ | 1.2720196495 | $\sqrt{\phi}$ |
127+
| $G(0.5)$ | 2.0581710272 | $\sqrt{\phi} + 1/\sqrt{\phi}$ |
128+
| $\phi^{\phi}$ | 2.3903891399 | Golden self-exponentiation |
129+
| $\phi^{\pi}$ | 4.5310082907 | Transcendental golden power |
130+
131+
The **Golden Function** $G(x) = \phi^x + \phi^{-x}$ is the continuous extension of Lucas numbers: $G(n) = L(n)$ for integer $n$.
132+
133+
## Nuclear Fibonacci Constants (Cycle 84)
134+
135+
```bash
136+
tri math nuclear
137+
```
138+
139+
Nuclear shell magic numbers correlate with Fibonacci/Lucas sequences:
140+
141+
| Magic number | Fibonacci/Lucas connection |
142+
|-------------|---------------------------|
143+
| 2 | $L(0) = 2$ |
144+
| 8 | $F(6) = 8$ |
145+
| 20 | $\approx F(8) - 1$ |
146+
| 28 | $= L(7) - 1$ |
147+
| 50 | $\approx F(10) - 5$ |
148+
| 82 | stable shell |
149+
| 126 | stable shell |
150+
151+
- N/Z stability ratio for heavy nuclei: $\phi / \sqrt{2} \approx 1.144$
152+
- Binding energy peak: $8.8 \text{ MeV} \approx F(6) + \phi^{-1}$
153+
154+
## Chaos Theory (Cycle 83)
155+
156+
```bash
157+
tri math chaos
158+
```
159+
160+
The **Feigenbaum constants** govern the universal behavior of chaotic systems:
161+
162+
- $\delta = 4.669...$: Ratio of successive period-doubling intervals
163+
- $\alpha = 2.502...$: Scaling factor of function values at bifurcation points
164+
165+
These constants appear in **any** system exhibiting period-doubling route to chaos — from fluid dynamics to population models.
166+
167+
## Command Summary
168+
169+
| Command | Category | Constants shown |
170+
|---------|----------|----------------|
171+
| `tri constants` | Core | 4 sections: Golden Ratio, Transcendental, Genetic Algorithm, Quantum |
172+
| `tri math exotic` | Exotic | 10 rare mathematical constants |
173+
| `tri math physical` | Physics | 12 fundamental physics constants |
174+
| `tri math chaos` | Chaos | Feigenbaum + logistic map demo |
175+
| `tri math all` | Complete | All 76+ constants in catalog |
176+
| `tri math golden-function` | Advanced | Pellis 2025 continuous Lucas |
177+
| `tri math nuclear` | Advanced | Nuclear shell magic numbers |
178+
| `tri math fractal` | Advanced | Fractal dimensions (Sierpinski, Koch, Menger) |
179+
180+
## See Also
181+
182+
- [Sacred Math](/cli/math) — Full math command reference (40+ commands)
183+
- [Mathematical Foundations](/math-foundations/) — Proofs and theory
184+
- [Concepts: Trinity Identity](/concepts/trinity-identity) — $\phi^2 + 1/\phi^2 = 3$ proof

docsite/docs/cli/core.md

Lines changed: 33 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,29 @@ Chat, code generation, and the SWE (Software Engineering) agent.
99

1010
## chat
1111

12-
Interactive chat with vision, voice, and tool support.
12+
Interactive multi-modal chat with vision, voice, and tool support (v2.1).
1313

1414
```bash
1515
tri chat [message]
1616
tri chat "Explain ternary computing"
17+
tri chat --stream "Tell me about phi"
18+
tri chat --image photo.jpg "What's in this image?"
19+
tri chat --voice recording.wav "Transcribe this"
1720
```
1821

19-
In REPL mode, type any message directly to chat.
22+
**Options:**
23+
24+
| Flag | Description |
25+
|------|-------------|
26+
| `--stream` | Enable streaming output (typing effect, token-by-token) |
27+
| `--image <path>` | Attach image file for vision analysis |
28+
| `--voice <path>` | Attach audio file for speech-to-text processing |
29+
30+
**Provider priority:** Groq (fastest) > Claude > OpenAI > local GGUF
31+
32+
The chat system integrates with the [TVC corpus](/cli/tvc) — similar queries are served from cache (threshold: $\phi^{-1} = 0.618$) without making an LLM call.
33+
34+
In REPL mode, type any message directly to chat. See [Interactive REPL](/cli/repl) for details.
2035

2136
## code
2237

@@ -28,6 +43,14 @@ tri code "Write a Fibonacci function in Zig"
2843
tri code --stream "Implement a binary search" # Typing effect
2944
```
3045

46+
**Options:**
47+
48+
| Flag | Description |
49+
|------|-------------|
50+
| `--stream` | Enable streaming (character-by-character typing effect) |
51+
52+
The output language is determined by the current language setting (default: Zig). Use `/zig`, `/python`, `/rust`, or `/js` in [REPL mode](/cli/repl) to switch.
53+
3154
## gen
3255

3356
Compile a `.vibee` specification into Zig or Verilog code.
@@ -41,7 +64,14 @@ tri gen specs/tri/my_module.vibee
4164

4265
## SWE Agent Commands
4366

44-
The SWE (Software Engineering) Agent provides AI-powered code assistance:
67+
The SWE (Software Engineering) Agent provides AI-powered code assistance. All SWE commands use the `TrinitySWEAgent` with multi-language support:
68+
69+
| Language | REPL switch | File extensions |
70+
|----------|------------|-----------------|
71+
| Zig | `/zig` | `.zig` |
72+
| Python | `/python` | `.py` |
73+
| Rust | `/rust` | `.rs` |
74+
| JavaScript | `/js` | `.js`, `.ts` |
4575

4676
### fix
4777

0 commit comments

Comments
 (0)