interplane.Get Omega
Read in your language

aien-sovereign-core-mv

AienOS host runtime: inference scheduling, paged KV state, the aien CLI and Spark verification tooling. Its inference engine is in alpha testing (DGX Spark GB10); Omega is the implementation destination.

Brought by drakestapleton

branch main Branches Tags History

aien-sovereign-core-mv / crates / aien-cli / src / walkthrough.rs

416 lines · 18910 bytes Raw Blame History
1// SPDX-License-Identifier: Apache-2.0
2// Copyright 2026 Drake Stapleton (AIEN / aien-dev)
3//
4// Licensed under the Apache License, Version 2.0 (the "License");
5// you may not use this file except in compliance with the License.
6// You may obtain a copy of the License at
7//
8// http://www.apache.org/licenses/LICENSE-2.0
9//
10// Unless required by applicable law or agreed to in writing, software
11// distributed under the License is distributed on an "AS IS" BASIS,
12// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13// See the License for the specific language governing permissions and
14// limitations under the License.
15
16use chrono::Utc;
17use colored::*;
18use serde_json::Value;
19use std::fs;
20use std::path::Path;
21
22use crate::telemetry::get_gpu_telemetry;
23
24pub fn render_walkthrough_tui() -> String {
25 let gpu = get_gpu_telemetry();
26 let platform = crate::platform::PlatformContext::detect();
27 let pulse_path = platform.home_dir.join("basecamp/hive-pulse.json");
28 let (vibe_text, pulse_stat, coherence) = if pulse_path.exists() {
29 if let Ok(c) = fs::read_to_string(pulse_path) {
30 if let Ok(v) = serde_json::from_str::<Value>(&c) {
31 let vb = v
32 .get("vibe_summary")
33 .and_then(Value::as_str)
34 .unwrap_or("Calm sovereign equilibrium")
35 .to_string();
36 let ps = v
37 .get("pulse_status")
38 .and_then(Value::as_str)
39 .unwrap_or("Harmonious")
40 .to_string();
41 let ch = v
42 .get("coherence_score")
43 .and_then(Value::as_u64)
44 .unwrap_or(100);
45 (vb, ps, ch)
46 } else {
47 (
48 "Calm sovereign equilibrium".to_string(),
49 "Harmonious".to_string(),
50 100,
51 )
52 }
53 } else {
54 (
55 "Calm sovereign equilibrium".to_string(),
56 "Harmonious".to_string(),
57 100,
58 )
59 }
60 } else {
61 (
62 "Calm sovereign equilibrium".to_string(),
63 "Harmonious".to_string(),
64 100,
65 )
66 };
67
68 let mut out = String::new();
69
70 out.push_str(&format!(
71 "{}\n",
72 "╔══════════════════════════════════════════════════════════════════════════════╗"
73 .cyan()
74 .bold()
75 ));
76 out.push_str(&format!(
77 "║ {} ║\n",
78 "AIEN SOVEREIGN WALKTHROUGH & ARCHITECTURE MAP"
79 .magenta()
80 .bold()
81 ));
82 out.push_str(&format!(
83 "║ {} ║\n",
84 "NVIDIA DGX Spark Grace Blackwell GB10 | sm_121 GPU"
85 .white()
86 .dimmed()
87 ));
88 out.push_str(&format!(
89 "{}\n\n",
90 "╚══════════════════════════════════════════════════════════════════════════════╝"
91 .cyan()
92 .bold()
93 ));
94
95 out.push_str(&format!(
96 "{}\n",
97 "┌── 1. SYSTEM TOPOGRAPHY & COMPONENT MAP ──────────────────────────────────────┐"
98 .yellow()
99 .bold()
100 ));
101 out.push_str(
102 "│ │\n",
103 );
104 out.push_str(&format!(
105 "│ {} ──> {} │\n",
106 "[ Sovereign Operator ]".bold().white(),
107 "[ AIEN CLI (~/.local/bin/aien) ]".bold().cyan()
108 ));
109 out.push_str(
110 "│ │ │\n",
111 );
112 out.push_str(
113 "│ ┌──────────────────────────────┼───────────────────────────┐ │\n",
114 );
115 out.push_str(
116 "│ ▼ ▼ ▼ │\n",
117 );
118 out.push_str(&format!(
119 "│ {} {} {} │\n",
120 "[ Nesting Ritual ]".green(),
121 "[ .crumb / .local ]".yellow(),
122 "[ Tool Dispatch Engine ]".blue()
123 ));
124 out.push_str("│ (Grounding & Scent) (Topography & Whispers) (Grounded multi-turn) │\n");
125 out.push_str(
126 "│ │ │ │ │\n",
127 );
128 out.push_str(
129 "│ ▼ ▼ ▼ │\n",
130 );
131 out.push_str(&format!(
132 "│ {} <─────── {} ────────────┘ │\n",
133 "[ Hive Pulse & Vibe ]".magenta(),
134 "[ Dream Engine: 18085 ]".cyan()
135 ));
136 out.push_str("│ (Live Swarm Heartbeat) (Idle watcher & Harvester) │\n");
137 out.push_str(
138 "│ │ │\n",
139 );
140 out.push_str(
141 "│ ┌──────────────────────────────┼───────────────────────────┐ │\n",
142 );
143 out.push_str(
144 "│ ▼ ▼ ▼ │\n",
145 );
146 out.push_str(&format!(
147 "│ {} {} {} │\n",
148 "[ Model Seat: 18006 ]".bold().green(),
149 "[ JSpace Judge: 18082 ]".bold().yellow(),
150 "[ Cortex Memory: 18080 ]".bold().magenta()
151 ));
152 out.push_str("│ (Nemotron-3.5 30B BF16) (Llama-3.2 1B CPU) (Postgres socket 15433) │\n");
153 out.push_str(
154 "│ │\n",
155 );
156 out.push_str(
157 "└── ───────────────────────────────────────────────────────────────────────────┘\n\n",
158 );
159
160 out.push_str(&format!(
161 "{}\n",
162 "┌── 2. SYSTEM MILESTONES & ROADMAP ────────────────────────────────────────────┐"
163 .yellow()
164 .bold()
165 ));
166 out.push_str(&format!(
167 "│ {} Phase 1: Workspace Sanitation & Memory Alignment (Reclaimed 74GB, 501G free) │\n",
168 "✓".green().bold()
169 ));
170 out.push_str(&format!(
171 "│ {} Phase 2: Native AIEN Terminal CLI & TUI Ergonomics (~/.local/bin/aien) │\n",
172 "✓".green().bold()
173 ));
174 out.push_str(&format!(
175 "│ {} Phase 3: Ephemeral Subagent Swarm Integration (aien-hive IPC & tools) │\n",
176 "✓".green().bold()
177 ));
178 out.push_str(&format!(
179 "│ {} Phase 4: JSpace Dynamic Dream Cycle Engine (Port 18085 idle watcher) │\n",
180 "✓".green().bold()
181 ));
182 out.push_str(&format!(
183 "│ {} Phase 5: Agent Nesting Grounding Ritual (Threat circle, wind, scent mark) │\n",
184 "✓".green().bold()
185 ));
186 out.push_str(&format!(
187 "│ {} Phase 6: Hierarchical Directory Breadcrumbs (Sovereign Split: .crumb/.local) │\n",
188 "✓".green().bold()
189 ));
190 out.push_str(&format!(
191 "│ {} Phase 7: Hive Pulse, Vibe Heartbeat & Strict Readiness Hard-Block │\n",
192 "✓".green().bold()
193 ));
194 out.push_str(&format!(
195 "│ {} Phase 8: Autonomous Walkthrough, Architecture Map & Live Roadmap Engine │\n",
196 "✓".green().bold()
197 ));
198 out.push_str(&format!(
199 "│ {} Phase 9: Antigravity Customizations & Local Model Pair-Programming Parity │\n",
200 "✓".green().bold()
201 ));
202 out.push_str(&format!(
203 "│ {} Phase 10: Mathematical Verification Oracles & Marketing Voice Elimination │\n",
204 "✓".green().bold()
205 ));
206 out.push_str(
207 "└── ───────────────────────────────────────────────────────────────────────────┘\n\n",
208 );
209
210 out.push_str(&format!(
211 "{}\n",
212 "┌── 3. LIVE SOVEREIGN TELEMETRY ───────────────────────────────────────────────┐"
213 .yellow()
214 .bold()
215 ));
216 let hw_info = if gpu.available {
217 let temp = gpu.display_temp();
218 let vram = gpu.display_vram();
219 let name = gpu.display_name();
220 format!("{} ({} | {})", name, temp, vram)
221 } else {
222 "Hardware Telemetry Unavailable / Sensor Offline".to_string()
223 };
224 out.push_str(&format!("│ Hardware: {}\n", hw_info));
225 out.push_str(&format!(
226 "│ Hive Pulse: {} (Coherence: {}%)\n",
227 pulse_stat.green().bold(),
228 coherence
229 ));
230 out.push_str(&format!(
231 "│ Hive Vibe: {}\n",
232 vibe_text.italic().magenta()
233 ));
234 out.push_str("│ Seats Status: Model(18006)✓ Judge(18082)✓ Cortex(18080)✓ Dream(18085)✓\n");
235 out.push_str(
236 "└── ───────────────────────────────────────────────────────────────────────────┘\n\n",
237 );
238
239 out.push_str(&format!(
240 "{}\n",
241 "┌── 4. OPERATOR PLAYBOOK & CHEAT SHEET ────────────────────────────────────────┐"
242 .yellow()
243 .bold()
244 ));
245 out.push_str(
246 "│ aien Launch interactive AIEN terminal session │\n",
247 );
248 out.push_str(
249 "│ aien -p \"<prompt>\" Execute grounded autonomous single-turn prompt │\n",
250 );
251 out.push_str(
252 "│ aien --walkthrough Display this Live System Walkthrough & Roadmap │\n",
253 );
254 out.push_str(
255 "│ /walkthrough [save] Render or update basecamp/WALKTHROUGH.md │\n",
256 );
257 out.push_str(
258 "│ /nest Execute full pre-flight grounding initiation │\n",
259 );
260 out.push_str(
261 "│ /crumb [path|whisper] Inspect directory topography or leave whisper │\n",
262 );
263 out.push_str(
264 "│ /dream [now|status] Trigger dream cycle or check consolidation stats │\n",
265 );
266 out.push_str(
267 "│ /doctor Run comprehensive 7-point health diagnostic │\n",
268 );
269 out.push_str(
270 "└── ───────────────────────────────────────────────────────────────────────────┘\n",
271 );
272
273 out
274}
275
276pub fn generate_and_save_walkthrough_md(dest_path: &Path) -> Result<String, String> {
277 let now = Utc::now();
278 let gpu = get_gpu_telemetry();
279
280 let md = format!(
281 r#"# AIEN Sovereign System: Live Walkthrough & Component Map
282*Generated autonomously on the DGX Spark at {} UTC*
283
284---
285
286## 1. System Architecture & Component Map
287
288```mermaid
289graph TD
290 User["Sovereign Operator"] -->|Interactive Terminal| CLI["AIEN Native CLI (~/.local/bin/aien)"]
291
292 subgraph Core Harness ["AIEN Core Stack (Rust 1.98.1)"]
293 CLI --> Nesting["Nesting Ritual Engine (Grounding & Scent)"]
294 CLI --> Crumbs["Hierarchical .crumb Network (Above/Below/History)"]
295 CLI --> Tools["Tool Engine (view_file, write_to_file, hive, etc.)"]
296 CLI --> Stream["SSE Streaming Client"]
297 end
298
299 subgraph Service Seats ["Resident Services"]
300 Stream -->|Port 18006| Nemotron["Nemotron-3.5-Lightning-30B-BF16 (Primary Seat)"]
301 Nesting -->|Port 18082| Judge["JSpace Truth Judge (Llama-3.2-1B CPU)"]
302 Nesting -->|Port 18080| Cortex["Spark Cortex Memory (Postgres Socket 15433)"]
303 Nesting -->|Port 18081| Encoder["ONNX Encoder (bge-base)"]
304 Nesting -->|Port 18085| DreamSvc["JSpace Dynamic Dream Engine"]
305 end
306
307 subgraph Memory & Coordination ["Sovereign File & Knowledge Substrates"]
308 Crumbs -->|Durable Charter| DirCrumb[".crumb files (Purpose, Topography, Tracked in Git)"]
309 Crumbs -->|Ephemeral Churn| LocalCrumb[".crumb.local (History, Whispers, Gitignored)"]
310 Nesting -->|Scent Mark| Events["basecamp/events.jsonl"]
311 DreamSvc -->|Idle Watcher >15m| Dream["Episodic Harvester & Hive Pulse"]
312 Dream -->|Truth >= 85| Cortex
313 Dream -->|Persona Changes| Inbox["basecamp/inbox/soul-proposal-*.md"]
314 Dream -->|Hive Pulse & Vibe| Pulse["basecamp/hive-pulse.json"]
315 end
316```
317
318---
319
320## 2. Completed Milestones & Roadmap
321
322- [x] **Phase 1: Workspace Sanitation & Model Alignment**
323 - Reclaimed 74 GB of NVMe disk space; 501 GB available.
324 - Locked inference strictly to Modular MAX on port `18006` serving NVIDIA-native `nemotron_h_kvexp` (`atlas-lightning-omni`; historical, Modular MAX and its adapter were removed on 2026-10-15).
325- [x] **Phase 2: Native AIEN Terminal CLI (`aien-cli`)**
326 - High-performance Rust binary installed to `~/.local/bin/aien`.
327 - ANSI streaming, collapsible tool widgets, GB10 GPU telemetry status footer, persistent history.
328- [x] **Phase 3: Ephemeral Subagent Swarm Integration (`aien-hive`)**
329 - Slash commands (`/hive roster`, `/hive spawn`) and native tool dispatching.
330- [x] **Phase 4: JSpace Dynamic Dream Cycle Engine**
331 - Port 18085 idle watcher; auto-commits verified operational facts (Truth >= 85) to Spark Cortex.
332 - Soul and persona modifications strictly quarantined to `basecamp/inbox/`.
333- [x] **Phase 5: Agent Nesting Protocol (Grounding Ritual)**
334 - Mandatory on every startup; circles surroundings, checks wind, leaves scent, flattens terrain.
335 - Model executes autonomous initiation turn confirming orientation before taking operator commands.
336- [x] **Phase 6: Hierarchical Directory Breadcrumbs (Sovereign Split)**
337 - `.crumb` is tracked in Git (permanent purpose, above/below topography).
338 - `.crumb.local` is gitignored (ephemeral view history, concurrency locks, active whispers).
339 - `.crumb.local` is single-machine scratch state; coordination between agents goes through tracked claims and draft pull requests.
340- [x] **Phase 7: Hive Pulse & Vibe Heartbeat**
341 - Dream engine analyzes the beat, pulse, health, and vibe of the hive across all models and agents.
342 - Live pulse recorded in `basecamp/hive-pulse.json` and sensed during nesting initiation.
343- [x] **Phase 8: Sovereign Walkthrough & Architecture Map Engine**
344 - Self-generating, live-updating component maps and roadmaps directly accessible via `/walkthrough` and `aien --walkthrough`.
345- [x] **Phase 9: Antigravity Customizations & Local Model Pair-Programming Parity**
346 - Progressive skill disclosure parsing YAML frontmatter across `~/skills`, `~/.agents/skills`, and `~/.gemini/config/skills`.
347 - Hierarchical rule discovery (`AGENTS.md`, `GEMINI.md`, `.agents/rules/*.md`) walking directory tree with `/rules` inspection.
348 - Real-time streaming reasoning tokens (`[Thinking] ...`) from Modular MAX port 18006 (`atlas-lightning-omni`).
349 - Antigravity tool schema aliases (PascalCase and snake_case) across core agent capabilities.
350 - Dual interfaces: compiled native Rust CLI (`~/.local/bin/aien`) and Python SDK runner (`~/.local/bin/aien-ag`).
351- [x] **Phase 10: Mathematical Verification Oracles & Marketing Voice Elimination**
352 - Replaced corrupted quadratic approximations with exact Shannon entropy (-p * ln(p)) in Mojo SIMD and Rust fallback.
353 - Built standalone Python verification oracle (`verify_simd_math.py`) generating verified analytical fixtures.
354 - Scrubbed promotional marketing language across all active repositories (`aegis-runtime`, `spark-inquisitor`, `crumb-spec`, `spark-crumbs-publish`, `org-profile`, `aien-dev`).
355 - Completed autonomous PR lifecycles with public branches, verification proof, and squash merges.
356 - Verified 143/143 tests in `spark-rsi`, 49/49 tests in `aien-inference-abi`, 52/52 tests in `aegis-runtime`, and 22/22 tests in `aien-cli`.
357
358---
359
360## 3. Hardware & Telemetry Status
361
362| Subsystem | Port / Path | State | Specifications |
363| :--- | :--- | :--- | :--- |
364| **GB10 GPU** | Hardware | {} | {} |
365| **Model Seat** | `127.0.0.1:18006` | Online | Nemotron-3.5-Lightning-30B-A3B BF16 |
366| **JSpace Judge** | `127.0.0.1:18082` | Online | Llama-3.2-1B-Instruct on CPU |
367| **Cortex Memory**| `127.0.0.1:18080` | Online | Postgres Socket 15433 |
368| **Dream Engine** | `127.0.0.1:18085` | Online | Idle watcher & Hive Pulse Daemon |
369| **Radicle Identity** | Sovereign P2P | Active | `did:rad:aien:spark-master` |
370
371---
372
373## 4. Operator Playbook
374
375```bash
376# Launch interactive terminal session
377aien
378
379# Run single grounded command
380aien -p "Analyze the hive pulse and directory crumbs"
381
382# View live system walkthrough and roadmap in terminal
383aien --walkthrough
384
385# In-session commands
386/walkthrough # Display live architecture and roadmap
387/walkthrough save # Update basecamp/WALKTHROUGH.md
388/nest # Re-run nesting grounding ritual
389/crumb [path] # Inspect directory topography and purpose
390/crumb whisper <msg> # Leave an inter-agent note
391/dream status # Check dream engine consolidation stats
392/doctor # Run comprehensive health diagnostic
393```
394"#,
395 now.to_rfc3339(),
396 if gpu.available {
397 "Online"
398 } else {
399 "Offline / Sensor Unavailable"
400 },
401 if gpu.available {
402 let name = gpu.display_name();
403 let temp = gpu.display_temp();
404 let vram = gpu.display_vram();
405 format!("{} ({}, {} VRAM)", name, temp, vram)
406 } else {
407 "Telemetry Unavailable / Sensor Offline".to_string()
408 }
409 );
410
411 fs::write(dest_path, md).map_err(|e| format!("Failed to save walkthrough: {}", e))?;
412 Ok(format!(
413 "Successfully saved walkthrough to {}",
414 dest_path.display()
415 ))
416}