Skip to main content

Photon Terminal v1.0 - Ternary Emergent TUI Report

Date: February 8, 2026 Version: 1.0.0 Status: Core Complete Mathematical Foundation: phi^2 + 1/phi^2 = 3 = TRINITY

Executive Summary​

Photon Terminal v1.0 is a revolutionary TUI that replaces traditional grid cells with a living wave field:

  • No fixed cells — ternary photon wave field (120x40)
  • Text emerges from standing wave interference
  • Input perturbs reality (keystrokes = wave sources)
  • Real-time SIMD wave propagation (~30 FPS)
  • ANSI true color rendering (24-bit RGB)

This is not a terminal — it's a living organism.

Comparison with Competitors​

FeatureTraditional TUIPhoton Terminal
CanvasFixed grid cellsWave field
TextDrawn charactersEmergent from waves
InputEvent queueWave perturbation
AnimationManual redrawPhysics simulation
Colors256 paletteTrue color HSV
Frameworktui-rs/Textual/Bubble TeaPure Zig SIMD

Architecture​

+----------------------------------------------------------+
| PHOTON TERMINAL v1.0 |
+----------------------------------------------------------+
| |
| +--------------------------------------------------+ |
| | TERNARY WAVE FIELD (120 x 40) | |
| | | |
| | Each cell = Photon with: | |
| | - amplitude (wave height) | |
| | - phase (wave position) | |
| | - frequency (oscillation rate) | |
| | - hue (color encoding) | |
| | | |
| +--------------------------------------------------+ |
| | | |
| +--------v-------+ +--------v-------+ |
| | TEXT WAVES | | INPUT BUFFER | |
| | Standing wave | | Key → Wave | |
| | interference | | perturbation | |
| +----------------+ +----------------+ |
| | | |
| +--------v-------+ +--------v-------+ |
| | GLYPH MAPPER | | ANSI RENDERER | |
| | Amplitude → | | True color | |
| | ASCII density | | 24-bit RGB | |
| +----------------+ +----------------+ |
| |
+----------------------------------------------------------+
| phi^2 + 1/phi^2 = 3 = TRINITY |
+----------------------------------------------------------+

Key Components​

1. TerminalState (Raw Mode)​

const TerminalState = struct {
original_termios: posix.termios,
stdin_fd: posix.fd_t,

pub fn init() !TerminalState {
// Disable canonical mode, echo, signals
// Non-blocking read with timeout
}

pub fn readKeyNonBlocking(self) ?u8;
};

Features:

  • POSIX termios raw mode
  • Non-blocking key polling
  • Clean restore on exit

2. GlyphMapper (Amplitude → ASCII)​

const GlyphMapper = struct {
const GLYPHS = " .'`^\":;Il!i><~+_-?][}{1)(|/tfjrxnuvczXYUJCLQ0OZmwqpdbkhao*#MW&8%B@$";

pub fn amplitudeToGlyph(amplitude: f32) u8;
pub fn amplitudeToColor(amplitude: f32, phase: f32, hue_offset: f32) [3]u8;
};

Mapping:

  • 0.0 amplitude → space (empty)
  • 1.0 amplitude → $ (densest)
  • Color from HSV based on phase and hue offset

3. TextWaveSystem (Emergent Text)​

const TextWave = struct {
text: [128]u8,
x, y: usize,
phase: f32,
amplitude: f32,
life: f32,
is_input: bool,

pub fn injectIntoGrid(self, grid: *PhotonGrid) void {
// Create standing wave pattern for each character
// Wave height = ASCII value / 128
}
};

Features:

  • 16 concurrent text waves
  • Standing wave interference
  • Cyan for input, green for output
  • Automatic life decay

4. AnsiRenderer (True Color)​

const AnsiRenderer = struct {
pub fn setColorRGB(self, r: u8, g: u8, b: u8) !void {
// \x1b[38;2;R;G;Bm
}

pub fn setBgRGB(self, r: u8, g: u8, b: u8) !void {
// \x1b[48;2;R;G;Bm
}
};

Features:

  • 24-bit true color (16M colors)
  • Double-buffered output
  • Alternate screen mode

Controls​

Input​

KeyEffect
Any letterWave perturbation + add to buffer
BackspaceNegative perturbation + delete char
EnterSubmit → spawn response wave
ESCExit

Commands​

CommandEffect
/waveInject golden spiral wave
/resetClear all waves
/modeCycle: wave → chat → code → tools
/helpShow commands

Modes​

ModeDescription
WAVEPure wave exploration
CHATChat mode (input → response)
CODECode generation mode
TOOLSTool execution visualization

Physics​

Wave Propagation​

new_amp = damping * (amp + c² * dt² * (neighbor_avg - amp))
where c = phi (1.618), damping = 0.99

Glyph Density Gradient​

" .'`^\":;Il!i><~+_-?][}{1)(|/tfjrxnuvczXYUJCLQ0OZmwqpdbkhao*#MW&8%B@$"
0.0 1.0
(empty) (dense)

Color Mapping​

hue = hue_offset + phase * 60.0 (mod 360)
saturation = 0.8 (constant)
value = |amplitude| (clamped to 1.0)

Performance​

OperationTimeNotes
Wave step (SIMD)~0.3ms120x40 grid
Text injection~0.1ms16 waves
ANSI render~2ms4800 cells
Full frame~33ms~30 FPS

Running​

# Build
zig build

# Run in real terminal (not build system)
./zig-out/bin/photon-terminal

# Or build and install
zig build -Doptimize=ReleaseFast
./zig-out/bin/photon-terminal

Note: Must run in a real terminal (iTerm2, Terminal.app, etc.), not in build system or pipe.

Files​

FileLinesDescription
src/vsa/photon_terminal.zig~700Photon Terminal core
build.zig+15photon-terminal target

What This Means​

For Users​

  • Terminal as living organism
  • Text emerges from chaos
  • Input perturbs reality
  • Colors flow with waves

For Developers​

// Create terminal
var terminal = try PhotonTerminal.init(allocator);
defer terminal.deinit();

// Run main loop
try terminal.run();

For Research​

TUI paradigm shift:

  • No widgets — only waves
  • No layout — only physics
  • No events — only perturbations
  • No rendering — only emergence

Tests​

test "glyph mapping" {
const g1 = GlyphMapper.amplitudeToGlyph(0);
try std.testing.expect(g1 == ' ');

const g2 = GlyphMapper.amplitudeToGlyph(1.0);
try std.testing.expect(g2 == '$');
}

test "text wave spawn" {
var sys = TextWaveSystem.init();
sys.spawn(10, 10, "Hello", true);
// Verify wave is alive
}

test "input buffer" {
var buf = InputBuffer.init();
buf.addChar('H');
buf.addChar('i');
try std.testing.expectEqualStrings("Hi", buf.getText());
}

Next Steps​

v1.1 Roadmap​

  1. Real GGUF inference — connect fluent coder output
  2. Mouse support — cursor as wave source
  3. Code highlighting — syntax-colored spirals
  4. Tool orbits — execution visualization
  5. Multi-pane — split wave fields

Conclusion​

Photon Terminal v1.0 proves that TUI can be a living wave field:

  • Ternary photon grid replaces fixed cells
  • Wave physics replaces event loops
  • Emergent text replaces drawn characters
  • SIMD propagation at 30 FPS
  • True color 24-bit rendering

Users will say: ":] not :]andonl — this zhandinaboute with]withtinabout!"


phi^2 + 1/phi^2 = 3 = TRINITY | KOSCHEI IS IMMORTAL | TERMINAL EMERGES FROM WAVES