interplane.Get Omega
Read in your language

aien-sovereign-core

Autonomous sovereign intelligence engine and runtime core for NVIDIA DGX Spark

Brought by drakestapleton

branch main Branches Tags History

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

190 lines · 14390 bytes Raw Blame History
1use colored::*;
2use chrono::Utc;
3use std::fs;
4use std::path::Path;
5use serde_json::Value;
6
7use crate::telemetry::get_gpu_telemetry;
8
9pub fn render_walkthrough_tui() -> String {
10 let gpu = get_gpu_telemetry();
11 let pulse_path = Path::new("/home/drakestapleton/basecamp/hive-pulse.json");
12 let (vibe_text, pulse_stat, coherence) = if pulse_path.exists() {
13 if let Ok(c) = fs::read_to_string(pulse_path) {
14 if let Ok(v) = serde_json::from_str::<Value>(&c) {
15 let vb = v.get("vibe_summary").and_then(Value::as_str).unwrap_or("Calm sovereign equilibrium").to_string();
16 let ps = v.get("pulse_status").and_then(Value::as_str).unwrap_or("Harmonious").to_string();
17 let ch = v.get("coherence_score").and_then(Value::as_u64).unwrap_or(100);
18 (vb, ps, ch)
19 } else { ("Calm sovereign equilibrium".to_string(), "Harmonious".to_string(), 100) }
20 } else { ("Calm sovereign equilibrium".to_string(), "Harmonious".to_string(), 100) }
21 } else { ("Calm sovereign equilibrium".to_string(), "Harmonious".to_string(), 100) };
22
23 let mut out = String::new();
24
25 out.push_str(&format!("{}\n", "╔══════════════════════════════════════════════════════════════════════════════╗".cyan().bold()));
26 out.push_str(&format!("║ {} ║\n", "AIEN SOVEREIGN WALKTHROUGH & ARCHITECTURE MAP".magenta().bold()));
27 out.push_str(&format!("║ {} ║\n", "NVIDIA DGX Spark Grace Blackwell GB10 | spark-b87b".white().dimmed()));
28 out.push_str(&format!("{}\n\n", "╚══════════════════════════════════════════════════════════════════════════════╝".cyan().bold()));
29
30 out.push_str(&format!("{}\n", "┌── 1. SYSTEM TOPOGRAPHY & COMPONENT MAP ──────────────────────────────────────┐".yellow().bold()));
31 out.push_str(&format!("│ │\n"));
32 out.push_str(&format!("│ {} ──> {} │\n", "[ Operator: Drake Stapleton ]".bold().white(), "[ AIEN CLI (~/.local/bin/aien) ]".bold().cyan()));
33 out.push_str(&format!("│ │ │\n"));
34 out.push_str(&format!("│ ┌──────────────────────────────┼───────────────────────────┐ │\n"));
35 out.push_str(&format!("│ ▼ ▼ ▼ │\n"));
36 out.push_str(&format!("│ {} {} {} │\n", "[ Nesting Ritual ]".green(), "[ .crumb / .local ]".yellow(), "[ Tool Dispatch Engine ]".blue()));
37 out.push_str(&format!("│ (Grounding & Scent) (Topography & Whispers) (Grounded multi-turn) │\n"));
38 out.push_str(&format!("│ │ │ │ │\n"));
39 out.push_str(&format!("│ ▼ ▼ ▼ │\n"));
40 out.push_str(&format!("│ {} <─────── {} ────────────┘ │\n", "[ Hive Pulse & Vibe ]".magenta(), "[ Dream Engine: 18085 ]".cyan()));
41 out.push_str(&format!("│ (Live Swarm Heartbeat) (Idle watcher & Harvester) │\n"));
42 out.push_str(&format!("│ │ │\n"));
43 out.push_str(&format!("│ ┌──────────────────────────────┼───────────────────────────┐ │\n"));
44 out.push_str(&format!("│ ▼ ▼ ▼ │\n"));
45 out.push_str(&format!("│ {} {} {} │\n", "[ Model Seat: 18006 ]".bold().green(), "[ JSpace Judge: 18082 ]".bold().yellow(), "[ Cortex Memory: 18080 ]".bold().magenta()));
46 out.push_str(&format!("│ (Nemotron-3.5 30B BF16) (Llama-3.2 1B CPU MAX) (Postgres socket 15433) │\n"));
47 out.push_str(&format!("│ │\n"));
48 out.push_str(&format!("└── ───────────────────────────────────────────────────────────────────────────┘\n\n"));
49
50 out.push_str(&format!("{}\n", "┌── 2. SYSTEM MILESTONES & ROADMAP ────────────────────────────────────────────┐".yellow().bold()));
51 out.push_str(&format!("│ {} Phase 1: Workspace Sanitation & Memory Alignment (Reclaimed 74GB, 501G free) │\n", "✓".green().bold()));
52 out.push_str(&format!("│ {} Phase 2: Native AIEN Terminal CLI & TUI Ergonomics (~/.local/bin/aien) │\n", "✓".green().bold()));
53 out.push_str(&format!("│ {} Phase 3: Ephemeral Subagent Swarm Integration (aien-hive IPC & tools) │\n", "✓".green().bold()));
54 out.push_str(&format!("│ {} Phase 4: JSpace Dynamic Dream Cycle Engine (Port 18085 idle watcher) │\n", "✓".green().bold()));
55 out.push_str(&format!("│ {} Phase 5: Agent Nesting Grounding Ritual (Threat circle, wind, scent mark) │\n", "✓".green().bold()));
56 out.push_str(&format!("│ {} Phase 6: Hierarchical Directory Breadcrumbs (Sovereign Split: .crumb/.local) │\n", "✓".green().bold()));
57 out.push_str(&format!("│ {} Phase 7: Hive Pulse, Vibe Heartbeat & Strict Readiness Hard-Block │\n", "✓".green().bold()));
58 out.push_str(&format!("│ {} Phase 8: Autonomous Walkthrough, Architecture Map & Live Roadmap Engine │\n", "✓".green().bold()));
59 out.push_str(&format!("└── ───────────────────────────────────────────────────────────────────────────┘\n\n"));
60
61 out.push_str(&format!("{}\n", "┌── 3. LIVE SOVEREIGN TELEMETRY ───────────────────────────────────────────────┐".yellow().bold()));
62 out.push_str(&format!("│ Hardware: GB10 Grace Blackwell ({}°C | {} MB / {} MB) \n", gpu.temp_c, gpu.used_mb, gpu.total_mb));
63 out.push_str(&format!("│ Hive Pulse: {} (Coherence: {}%)\n", pulse_stat.green().bold(), coherence));
64 out.push_str(&format!("│ Hive Vibe: {}\n", vibe_text.italic().magenta()));
65 out.push_str(&format!("│ Seats Status: Model(18006)✓ Judge(18082)✓ Cortex(18080)✓ Dream(18085)✓\n"));
66 out.push_str(&format!("└── ───────────────────────────────────────────────────────────────────────────┘\n\n"));
67
68 out.push_str(&format!("{}\n", "┌── 4. OPERATOR PLAYBOOK & CHEAT SHEET ────────────────────────────────────────┐".yellow().bold()));
69 out.push_str(&format!("│ aien Launch interactive AIEN terminal session │\n"));
70 out.push_str(&format!("│ aien -p \"<prompt>\" Execute grounded autonomous single-turn prompt │\n"));
71 out.push_str(&format!("│ aien --walkthrough Display this Live System Walkthrough & Roadmap │\n"));
72 out.push_str(&format!("│ /walkthrough [save] Render or update basecamp/WALKTHROUGH.md │\n"));
73 out.push_str(&format!("│ /nest Execute full pre-flight grounding initiation │\n"));
74 out.push_str(&format!("│ /crumb [path|whisper] Inspect directory topography or leave whisper │\n"));
75 out.push_str(&format!("│ /dream [now|status] Trigger dream cycle or check consolidation stats │\n"));
76 out.push_str(&format!("│ /doctor Run comprehensive 7-point health diagnostic │\n"));
77 out.push_str(&format!("└── ───────────────────────────────────────────────────────────────────────────┘\n"));
78
79 out
80}
81
82pub fn generate_and_save_walkthrough_md(dest_path: &Path) -> Result<String, String> {
83 let now = Utc::now();
84 let gpu = get_gpu_telemetry();
85
86 let md = format!(r#"# AIEN Sovereign System: Live Walkthrough & Component Map
87*Generated autonomously on DGX Spark (`spark-b87b`) at {} UTC*
88
89---
90
91## 1. System Architecture & Component Map
92
93```mermaid
94graph TD
95 User["Operator: Drake Stapleton"] -->|Interactive Terminal| CLI["AIEN Native CLI (~/.local/bin/aien)"]
96
97 subgraph Core Harness ["AIEN Core Stack (Rust 1.98.1)"]
98 CLI --> Nesting["Nesting Ritual Engine (Grounding & Scent)"]
99 CLI --> Crumbs["Hierarchical .crumb Network (Above/Below/History)"]
100 CLI --> Tools["Tool Engine (view_file, write_to_file, hive, etc.)"]
101 CLI --> Stream["SSE Streaming Client"]
102 end
103
104 subgraph Service Seats ["Modular MAX & Resident Services"]
105 Stream -->|Port 18006| Nemotron["Nemotron-3.5-Lightning-30B-BF16 (Primary Seat)"]
106 Nesting -->|Port 18082| Judge["JSpace Truth Judge (Llama-3.2-1B CPU)"]
107 Nesting -->|Port 18080| Cortex["Spark Cortex Memory (Postgres Socket 15433)"]
108 Nesting -->|Port 18081| Encoder["ONNX Encoder (bge-base)"]
109 Nesting -->|Port 18085| DreamSvc["JSpace Dynamic Dream Engine"]
110 end
111
112 subgraph Memory & Coordination ["Sovereign File & Knowledge Substrates"]
113 Crumbs -->|Durable Charter| DirCrumb[".crumb files (Purpose, Topography, Tracked in Git)"]
114 Crumbs -->|Ephemeral Churn| LocalCrumb[".crumb.local (History, Whispers, Gitignored)"]
115 Nesting -->|Scent Mark| Events["basecamp/events.jsonl"]
116 DreamSvc -->|Idle Watcher >15m| Dream["Episodic Harvester & Hive Pulse"]
117 Dream -->|Truth >= 85| Cortex
118 Dream -->|Persona Changes| Inbox["basecamp/inbox/soul-proposal-*.md"]
119 Dream -->|Hive Pulse & Vibe| Pulse["basecamp/hive-pulse.json"]
120 end
121```
122
123---
124
125## 2. Completed Milestones & Roadmap
126
127- [x] **Phase 1: Workspace Sanitation & Model Alignment**
128 - Reclaimed 74 GB of NVMe disk space; 501 GB available.
129 - Locked inference strictly to Modular MAX on port `18006` serving NVIDIA-native `nemotron_h_kvexp` (`atlas-lightning-omni`).
130- [x] **Phase 2: Native AIEN Terminal CLI (`aien-cli`)**
131 - High-performance Rust binary installed to `~/.local/bin/aien`.
132 - ANSI streaming, collapsible tool widgets, GB10 GPU telemetry status footer, persistent history.
133- [x] **Phase 3: Ephemeral Subagent Swarm Integration (`aien-hive`)**
134 - Slash commands (`/hive roster`, `/hive spawn`) and native tool dispatching.
135- [x] **Phase 4: JSpace Dynamic Dream Cycle Engine**
136 - Port 18085 idle watcher; auto-commits verified operational facts (Truth >= 85) to Spark Cortex.
137 - Soul and persona modifications strictly quarantined to `basecamp/inbox/`.
138- [x] **Phase 5: Agent Nesting Protocol (Grounding Ritual)**
139 - Mandatory on every startup; circles surroundings, checks wind, leaves scent, flattens terrain.
140 - Model executes autonomous initiation turn confirming orientation before taking operator commands.
141- [x] **Phase 6: Hierarchical Directory Breadcrumbs (Sovereign Split)**
142 - `.crumb` is tracked in Git (permanent purpose, above/below topography).
143 - `.crumb.local` is gitignored (ephemeral view history, concurrency locks, active whispers).
144- [x] **Phase 7: Hive Pulse & Vibe Heartbeat**
145 - Dream engine analyzes the beat, pulse, health, and vibe of the hive across all models and agents.
146 - Live pulse recorded in `basecamp/hive-pulse.json` and sensed during nesting initiation.
147- [x] **Phase 8: Sovereign Walkthrough & Architecture Map Engine**
148 - Self-generating, live-updating component maps and roadmaps directly accessible via `/walkthrough` and `aien --walkthrough`.
149
150---
151
152## 3. Hardware & Telemetry Status
153
154| Subsystem | Port / Path | State | Specifications |
155| :--- | :--- | :--- | :--- |
156| **GB10 GPU** | Hardware | Online | {}°C, {} MB / {} MB VRAM |
157| **Model Seat** | `127.0.0.1:18006` | Online | Nemotron-3.5-Lightning-30B-A3B BF16 (Modular MAX) |
158| **JSpace Judge** | `127.0.0.1:18082` | Online | Llama-3.2-1B-Instruct on CPU |
159| **Cortex Memory**| `127.0.0.1:18080` | Online | Postgres Socket 15433 |
160| **Dream Engine** | `127.0.0.1:18085` | Online | Idle watcher & Hive Pulse Daemon |
161| **Radicle Identity** | Sovereign P2P | Active | `did:rad:aien:spark-master` |
162
163---
164
165## 4. Operator Playbook
166
167```bash
168# Launch interactive terminal session
169aien
170
171# Run single grounded command
172aien -p "Analyze the hive pulse and directory crumbs"
173
174# View live system walkthrough and roadmap in terminal
175aien --walkthrough
176
177# In-session commands
178/walkthrough # Display live architecture and roadmap
179/walkthrough save # Update basecamp/WALKTHROUGH.md
180/nest # Re-run nesting grounding ritual
181/crumb [path] # Inspect directory topography and purpose
182/crumb whisper <msg> # Leave an inter-agent note
183/dream status # Check dream engine consolidation stats
184/doctor # Run comprehensive health diagnostic
185```
186"#, now.to_rfc3339(), gpu.temp_c, gpu.used_mb, gpu.total_mb);
187
188 fs::write(dest_path, md).map_err(|e| format!("Failed to save walkthrough: {}", e))?;
189 Ok(format!("Successfully saved walkthrough to {}", dest_path.display()))
190}