{"commands":[{"category":"Core","command":"tick","description":"Run one agent autonomic tick","syntax":"tick"},{"category":"Routing","command":"mesh","description":"Send prompt through mesh fast lane","syntax":"mesh <text>"},{"category":"Routing","command":"fast","description":"Route through Gemini Flash","syntax":"fast <text>"},{"category":"Routing","command":"deep","description":"Route through Claude Sonnet","syntax":"deep <text>"},{"category":"Routing","command":"settle","description":"Route through Copilot settle lane","syntax":"settle <text>"},{"category":"Routing","command":"lane","description":"Show substrate-chosen lane","syntax":"lane"},{"category":"Cube","command":"cube","description":"Set cube cell coordinate","syntax":"cube <x y z v>"},{"category":"Cube","command":"cube-lane","description":"Show cube-driven lane hint","syntax":"cube-lane"},{"category":"Governance","command":"forbid","description":"Append a forbid: rule to SSOT","syntax":"forbid <word>"},{"category":"Governance","command":"rules","description":"Show active SSOT rules","syntax":"rules"},{"category":"Cognition","command":"drift","description":"Show semantic drift vector","syntax":"drift"},{"category":"Cognition","command":"lineage","description":"Show cryptographic lineage chain","syntax":"lineage"},{"category":"Governance","command":"vitality","description":"Show substrate vitality slope","syntax":"vitality"},{"category":"Economy","command":"balance","description":"Show PQR Coin balance","syntax":"balance <who>"},{"category":"Economy","command":"mint","description":"Mint PQR Coin into account","syntax":"mint <who> <amt>"},{"category":"Economy","command":"pay","description":"Transfer PQR Coin between accounts","syntax":"pay <f> <t> <amt>"},{"category":"Economy","command":"reward","description":"Disburse mission reward","syntax":"reward <who> <amt>"},{"category":"Missions","command":"mission-list","description":"List all autonomic missions","syntax":"mission-list"},{"category":"Autonomic","command":"playbook-list","description":"List autonomic playbooks","syntax":"playbook-list"},{"category":"HUD","command":"hud-master","description":"Display master HUD snapshot","syntax":"hud-master"},{"category":"HUD","command":"hud-audit","description":"Audit HUD for static stubs","syntax":"hud-audit"},{"category":"Civilization","command":"civilization-state","description":"Show 12-dimensional civilization state","syntax":"civilization-state"},{"category":"LiveDocs","command":"docs-sync","description":"Trigger bi-directional live doc sync","syntax":"docs-sync"},{"category":"LiveDocs","command":"docs-audit","description":"Audit documentation vs code drift","syntax":"docs-audit"},{"category":"LiveDocs","command":"docs-list","description":"List all active wiki pages","syntax":"docs-list"},{"category":"LiveDocs","command":"docs-view","description":"View markdown of a wiki page","syntax":"docs-view <page>"}],"pages":[{"category":"Reference","content_md":"# 🌐 Sovereign OS REST API Reference\n\n[🏠 Home](./Home.md) | [🎛️ Console](./Master-Operator-Console.md) | [🤖 Copilot](./Copilot-Interface.md) | [📐 Architecture](./Architecture.md) | [⚙️ Subsystems](./Subsystems.md) | [🌐 API Reference](./API-Reference.md) | [💻 REPL Commands](./REPL-Commands.md) | [☸️ K8s CRDs](./Kubernetes-CRDs.md) | [🛡️ Invariants & Rules](./Invariants-and-Rules.md) | [🔄 Bi-Directional Sync](./Bi-Directional-Sync.md)\n\n---\n\n## 1. Remote Execution & SCTL\n\n### `POST /remote/submit`\nEnqueues a remote execution ticket.\n- **Request Body**: `RemoteTicketRequest`\n  ```json\n  {\n    \"lane\": \"Fast\",\n    \"prompt\": \"Inspect node health\",\n    \"priority\": 10\n  }\n  ```\n- **Response**: `RemoteTicketResponse`\n\n### `POST /remote/execute`\nExecutes an atomic instruction immediately across the cluster mesh.\n- **Request Body**: `RemoteExecutionRequest`\n- **Response**: `RemoteExecutionResult`\n\n---\n\n## 2. Mesh & Operator Console\n\n### `GET /mesh/ledger`\nReturns the complete list of mesh ledger entries and peer state transitions.\n- **Response**: `Vec<MeshLedgerEntry>`\n\n### `GET /console/dashboard`\nReturns the synthesized real-time operator console dashboard.\n- **Response**: `OperatorDashboard`\n\n### `POST /api/repl/execute`\nExecutes an interactive CLI command on the sovereign kernel REPL (e.g. `vitality`, `rules`, `balance`, `hud-master`).\n- **Request Body**:\n  ```json\n  {\n    \"command\": \"vitality\",\n    \"args\": []\n  }\n  ```\n- **Response**:\n  ```json\n  {\n    \"status\": \"ok\",\n    \"stdout\": \"substrate vitality = 6.22\\nSubstrate Vitality Slope ($S_v$) = 7.16 / 9.90\",\n    \"stderr\": \"\"\n  }\n  ```\n\n---\n\n## 3. PQR Economic Substrate\n\n### `POST /pqr/wallet/balance`\nQueries the PQR Coin balance for an account.\n- **Request Body**:\n  ```json\n  { \"account_id\": \"operator\" }\n  ```\n- **Response**: `WalletBalanceResponse`\n\n### `POST /pqr/mission/balance`\nQueries the locked escrow balance for a mission contract.\n- **Request Body**:\n  ```json\n  { \"mission_id\": \"mission-alpha\" }\n  ```\n- **Response**: `MissionBalanceResponse`\n\n### `POST /pqr/transfer`\nExecutes an atomic transfer of PQR Coin between accounts.\n- **Request Body**:\n  ```json\n  {\n    \"from\": \"alice\",\n    \"to\": \"bob\",\n    \"amount\": 100\n  }\n  ```\n- **Response**: `Result<TransferResponse, String>`\n\n### `POST /pqr/reward`\nMints or disburses a verified mission completion reward.\n- **Request Body**: `RewardRequest`\n- **Response**: `RewardResponse`\n\n---\n\n## 4. Cognitive Execution\n\n### `POST /cog/execute`\nDispatches a prompt through the hybrid multi-model Cognitive Bridge.\n- **Request Body**:\n  ```json\n  {\n    \"lane\": \"Deep\",\n    \"prompt\": \"Synthesize macroeconomic balance deltas\",\n    \"mission_id\": \"m-001\"\n  }\n  ```\n- **Response**: `CognitiveExecutionResult`\n\n---\n\n## 5. Master Cockpit & HUD Unification\n\n### `GET /hud/master` & `POST /hud/master`\nGenerates the comprehensive unified master HUD snapshot consolidating all 12 subsystems.\n- **Response**: `HudMasterSnapshot` JSON\n\n### `GET /hud/audit` & `POST /hud/audit`\nExecutes field-level verification across all HUD subsystems, confirming 0 stale or static mock fields.\n- **Response**: `HudAuditReport`\n\n---\n\n## 6. Autonomic Playbooks & Policies\n\n### `GET /autonomic/playbooks`\nLists all registered autonomic playbooks.\n- **Response**: `Vec<Playbook>`\n\n### `POST /autonomic/playbooks`\nRegisters or updates an autonomic playbook.\n- **Request Body**: `Playbook` JSON\n- **Response**: `{ \"status\": \"ok\", \"playbook_id\": \"...\" }`\n\n### `GET /autonomic/policies`\nLists active autonomic trigger policies.\n- **Response**: `Vec<AutonomicPolicy>`\n\n### `POST /autonomic/policies`\nRegisters a new autonomic trigger policy.\n- **Request Body**: `AutonomicPolicy` JSON\n- **Response**: `{ \"status\": \"ok\", \"policy_id\": \"...\" }`\n\n### `POST /autonomic/playbooks/:id/run`\nManually triggers execution of an autonomic playbook.\n- **Response**: `{ \"status\": \"ok\", \"run_id\": \"...\" }`\n\n### `GET /autonomic/runs`\nLists all active and historical playbook execution runs.\n- **Response**: `Vec<PlaybookRun>`\n\n### `GET /autonomic/audit`\nAudits the health, triggers, and execution rates of autonomic playbooks.\n- **Response**: `PlaybookAuditReport`\n\n---\n\n## 7. Civilization Kernel (SCK)\n\n### `GET /civilization/state` & `POST /civilization/state`\nReturns the current 12-dimensional civilization state tensor and epoch.\n- **Response**: `CivilizationState`\n\n### `POST /civilization/decision`\nEvaluates a proposed civilizational delta and returns an autonomic steering decision.\n- **Request Body**: `CivilizationDelta`\n- **Response**: `CivilizationDecision`\n\n### `POST /civilization/execute`\nAtomically commits an approved civilization delta into systemic state.\n- **Request Body**: `CivilizationDelta`\n- **Response**: `{ \"status\": \"ok\", \"receipt\": CivilizationExecutionReceipt }`\n\n### `GET /civilization/audit`\nReturns systemic vitality slope ($S_v$), tensor norm, and alignment audits.\n- **Response**: JSON\n\n---\n\n## 8. Live Documentation & Sync (`ops/live_docs`)\n\n### `GET /docs`\nInteractive HTML browser interface for the Sovereign OS Wiki.\n\n### `GET /docs/page/:slug`\nRenders an individual markdown documentation page by its slug (e.g. `architecture`, `subsystems`, `api-reference`).\n\n### `GET /docs/api`\nReturns the entire machine-readable JSON AST of all routes, commands, and wiki pages.\n\n### `GET /docs/audit`\nBi-directional contract drift verification report comparing code contracts against documentation specifications.\n\n### `POST /docs/sync`\nTriggers an immediate bi-directional live synchronization between code, markdown files, and cluster CRDs.\n","last_modified":1728345600,"sha256_hash":"258ead8168a19e9201e4c48cc2d0515a","slug":"api-reference","title":"API Reference"},{"category":"Design","content_md":"# 📐 Sovereign OS Architecture\n\n[🏠 Home](./Home.md) | [🎛️ Console](./Master-Operator-Console.md) | [🤖 Copilot](./Copilot-Interface.md) | [📐 Architecture](./Architecture.md) | [⚙️ Subsystems](./Subsystems.md) | [🌐 API Reference](./API-Reference.md) | [💻 REPL Commands](./REPL-Commands.md) | [☸️ K8s CRDs](./Kubernetes-CRDs.md) | [🛡️ Invariants & Rules](./Invariants-and-Rules.md) | [🔄 Bi-Directional Sync](./Bi-Directional-Sync.md)\n\n---\n\n## 1. 12-Layer Civilizational Topology\n\nSovereign OS organizes its operational and cognitive life cycle into 12 coherent, decoupled layers that stack from raw infrastructure up to macro-civilizational steering:\n\n```mermaid\ngraph TD\n    L12[Layer 12: SCK - Sovereign Civilization Kernel] --> L11[Layer 11: Autonomic Playbooks & Incident Remediation]\n    L11 --> L10[Layer 10: HUD Unification & Master Cockpit]\n    L10 --> L9[Layer 9: SAEL - Sovereign Audit & Event Ledger]\n    L9 --> L8[Layer 8: SAMC - Sovereign Autonomic Mission Controller]\n    L8 --> L7[Layer 7: Cognitive Bridge - Hybrid Multi-LLM Router]\n    L7 --> L6[Layer 6: Cognitive Surface - Intent & Semantic Mesh]\n    L6 --> L5[Layer 5: PQR API - Balance, Transfer & Settlement Services]\n    L5 --> L4[Layer 4: Economic Substrate - PQR Coin & Dual-Entry Ledger]\n    L4 --> L3[Layer 3: Operator Console - Live Dashboard & Metrics]\n    L3 --> L2[Layer 2: SUVL - Sovereign Unit Valuation Layer]\n    L2 --> L1[Layer 1: SPRL - Sovereign Peer Reputation Layer]\n    L1 --> L0[Layer 0: Core Execution Mesh & Valkey Persistent Substrate]\n```\n\n---\n\n## 2. Multi-Lane Execution Surface\n\nExecution is partitioned across distinct latency and risk lanes:\n\n| Execution Lane | Latency Target | Engine / Provider | Primary Use Case |\n| :--- | :--- | :--- | :--- |\n| **Fast Lane** | $< 100\\text{ ms}$ | Gemini 2.5 Flash / Local NPU | Real-time telemetry, routing, quick validations |\n| **Deep Lane** | $500\\text{ ms} - 5\\text{ s}$ | Claude 3.7 Sonnet / DeepSeek-R1 | Mathematical proofs, smart contract audits, macro planning |\n| **Settle Lane** | $< 2\\text{ s}$ | Microsoft Copilot / Base SSOT | Biometric transactions, on-chain execution, Passkey storage |\n| **Autonomic Lane**| Background | `autonomic_playbooks` Engine | Automated drift correction, health remediation, self-healing |\n\n---\n\n## 3. Mathematical Foundations: The Civilization Tensor ($C_{12}$)\n\nThe macro-state of Sovereign OS is modeled as a 12-dimensional vector normalized to $[0.0, 1.0]$:\n\n$$C_{12} = \\begin{bmatrix}\n\\text{reputation} \\\\\n\\text{valuation} \\\\\n\\text{economic\\_balance} \\\\\n\\text{cognitive\\_capacity} \\\\\n\\text{autonomic\\_resilience} \\\\\n\\text{audit\\_integrity} \\\\\n\\text{mission\\_throughput} \\\\\n\\text{governance\\_consensus} \\\\\n\\text{substrate\\_vitality} \\\\\n\\text{security\\_posture} \\\\\n\\text{telemetry\\_velocity} \\\\\n\\text{civilization\\_alignment}\n\\end{bmatrix}$$\n\n### Decision Function\nMacro-actions evaluate candidate state transitions $\\Delta C_{12}$. A transition is approved by the SCK if and only if:\n1. Substrate vitality $S_v$ delta is strictly non-negative: $\\Delta S_v \\ge 0$.\n2. Civilizational alignment score $\\ge 0.85$.\n3. Net tensor norm gain $\\Delta \\|C_{12}\\|_2 > 0$ without violating safety bounds.\n\n---\n\n## 4. 5D Sovereign Context Cube ($49 \\times 49 \\times 6$)\n\nEvery action, ticket, and event is anchored within the discrete Context Cube topology:\n- **Dimensions**: $X \\in [0, 48]$, $Y \\in [0, 48]$, $Z \\in [0, 48]$, $\\Phi$ (Phase), $\\Lambda$ (Lineage).\n- **Faces (0 to 5)**:\n  - **Face 0 (Blue)**: Architecture & Core Infrastructure\n  - **Face 1 (Amber)**: Telemetry & Ingress Feeds\n  - **Face 2 (Green)**: Execution & Settlement Engine\n  - **Face 3 (Purple)**: Machine Learning & Cognitive Inferences\n  - **Face 4 (Red)**: Risk Management & Circuit Breakers\n  - **Face 5 (Cyan)**: User Interfaces, Dashboards & Visualizations\n","last_modified":1728345600,"sha256_hash":"b3c777c6bdcaaa191a1a64766c4e1980","slug":"architecture","title":"Architecture"},{"category":"Design","content_md":"# 🔄 Bi-Directional Live Synchronization Engine\n\n[🏠 Home](./Home.md) | [🎛️ Console](./Master-Operator-Console.md) | [🤖 Copilot](./Copilot-Interface.md) | [📐 Architecture](./Architecture.md) | [⚙️ Subsystems](./Subsystems.md) | [🌐 API Reference](./API-Reference.md) | [💻 REPL Commands](./REPL-Commands.md) | [☸️ K8s CRDs](./Kubernetes-CRDs.md) | [🛡️ Invariants & Rules](./Invariants-and-Rules.md) | [🔄 Bi-Directional Sync](./Bi-Directional-Sync.md)\n\n---\n\n## 1. Bi-Directional Architecture\n\n```mermaid\nsequenceDiagram\n    participant Code as Rust Codebase (ops/core/economy)\n    participant Engine as LiveDocEngine (ops/live_docs)\n    participant Wiki as Markdown Wiki (docs/wiki/)\n    participant K8s as Kubernetes CRD (apex-cortex)\n    participant Valkey as Valkey SSOT (valkey-broker:6379)\n\n    Note over Code,Wiki: 1. Code-to-Docs (AST Introspection)\n    Engine->>Code: Scans workspace crates, routes, REPL commands\n    Engine->>Wiki: Updates API-Reference.md & REPL-Commands.md\n    Engine->>K8s: Applies DocumentationArtifact CRDs\n    Engine->>Valkey: Caches live pages at docs:sovereign:*\n\n    Note over Code,Wiki: 2. Docs-to-Code (Contract Validation)\n    Engine->>Wiki: Parses documented routes & CLI commands\n    Engine->>Code: Verifies handler bindings in http_gateway & runtime_shell\n    alt Drift Detected\n        Engine-->>Operator: Emits Drift Warning (Audit Report)\n        Engine-->>Code: Proposes code contract migrations\n    else Perfect Parity\n        Engine-->>Operator: 100% Isomorphism Verified\n    end\n```\n\n---\n\n## 2. Invalidation & Reconciliation Cycle\n\n1. **Continuous AST Extraction**:\n   - `DocExtractor` parses `ops/http_gateway/src/main.rs` to extract all `.route(\"/path\", method(handler))` definitions.\n   - `DocExtractor` parses `ops/runtime_shell/src/main.rs` to extract all CLI command branches and descriptions.\n   - `DocExtractor` reads workspace `Cargo.toml` to catalog all member crates.\n\n2. **Contract Audit (`DocValidator`)**:\n   - Compares the extracted code AST with markdown tables in `docs/wiki/API-Reference.md` and `docs/wiki/REPL-Commands.md`.\n   - Computes a drift score $\\delta \\in [0.0, 1.0]$. If $\\delta > 0$, the audit logs missing or undocumented items.\n\n3. **Multi-Target Publishing (`DocPublisher`)**:\n   - Generates/updates local markdown files in `docs/wiki/`.\n   - Compiles Kubernetes CRD manifests (`DocumentationArtifact`) in `k8s/docs/documentation-artifacts.yaml`.\n   - Updates in-memory HTTP cache in `ops/http_gateway` for instant sub-millisecond serving at `GET /docs`.\n","last_modified":1728345600,"sha256_hash":"15ca71fba985b4225930eeb7023eda5c","slug":"bi-directional-sync","title":"Bi-Directional Sync"},{"category":"Cognition","content_md":"# 🤖 Sovereign Copilot Interface\n\n[🏠 Home](./Home.md) | [🎛️ Console](./Master-Operator-Console.md) | [🤖 Copilot](./Copilot-Interface.md) | [📐 Architecture](./Architecture.md) | [⚙️ Subsystems](./Subsystems.md) | [🌐 API Reference](./API-Reference.md) | [💻 REPL Commands](./REPL-Commands.md) | [☸️ K8s CRDs](./Kubernetes-CRDs.md) | [🛡️ Invariants & Rules](./Invariants-and-Rules.md) | [🔄 Bi-Directional Sync](./Bi-Directional-Sync.md)\n\n---\n\n## 1. Executive Overview & Purpose\n\nThe **Sovereign Copilot Interface** is the cognitive bridge between human operators, autonomous swarms, and multi-model AI reasoning engines within Sovereign OS. Located at Layer 7 (`ops/cognitive_bridge`) and Layer 6 (`ops/cognitive_surface`), it provides:\n\n1. **Autonomous Mission Synthesis**: Formulates 5DHCP tickets, task graphs, and execution plans from human operator intent.\n2. **Hybrid Multi-Model Federation**: Seamlessly routes subtasks across dedicated cloud provers (Gemini, Claude), local NPUs (`qwen2:1.5b`), and the cluster's 24/7 headless Copilot browser (`gemma-cobrowser:3456`).\n3. **Macro-Civilizational Advisory**: Computes tensor perturbations ($\\Delta C_{12}$), predicts vitality drift, and advises the Sovereign Civilization Kernel (SCK) before executing state mutations.\n4. **Context Cube Binding**: Every conversational prompt and AI output is strictly pinned to 5D-ASP coordinates $(X, Y, Z, \\Phi, \\Lambda)$ with base-27 Saevcodes and lineage pedigree hashes.\n\n```mermaid\ngraph TD\n    Operator[\"👤 Operator Prompt\"] --> WebUI[\"🌐 os.predator.run Copilot Pane\"]\n    WebUI --> Gateway[\"ops/http_gateway: /api/copilot/chat\"]\n    Gateway --> CogSurface[\"ops/cognitive_surface (Intent Classification)\"]\n    CogSurface --> CogBridge[\"ops/cognitive_bridge (Federated Router)\"]\n    \n    CogBridge --> Cobrowser[\"Cluster Cobrowser Pod (Microsoft Copilot CDP: 3456)\"]\n    CogBridge --> LocalNPU[\"Local NPU / LM Studio (Port 1234/1235)\"]\n    CogBridge --> NativeProver[\"Native Rust Prover / SCK Tensor Engine\"]\n    \n    Cobrowser --> Synthesis[\"Response Synthesis & Ticket Generation\"]\n    LocalNPU --> Synthesis\n    NativeProver --> Synthesis\n    \n    Synthesis --> Valkey[\"Valkey Substrate (Lineage & Tickets)\"]\n    Synthesis --> WebUI\n```\n\n---\n\n## 2. Multi-Model Federated Architecture\n\nThe Cognitive Bridge evaluates task complexity, privacy requirements, and latency budgets to dispatch prompts:\n\n| Model Tier | Target Infrastructure | Latency | Primary Responsibilities |\n| :--- | :--- | :--- | :--- |\n| **Microsoft Copilot Bridge** | `apex-cortex/gemma-cobrowser:3456` | $2\\text{s} - 8\\text{s}$ | Complex code refactoring, enterprise doc synthesis, biometric settlement orchestration. |\n| **Local NPU (Qwen 2.5 / 1.5B)**| Co-located Lion / Apex1 NPUs | $15\\text{ms} - 80\\text{ms}$ | Fast-path telemetry classification, toxic contract filtering, zero-cloud private operations. |\n| **Native Rust SCK Prover** | `ops/civilization_kernel` | $<1\\text{ms}$ | Deterministic tensor evaluations, invariant validation, mathematical cohesion proofs. |\n| **High-Reasoning Enclave** | Cloud API (Gemini 2.5 / Claude 3.7) | $1\\text{s} - 4\\text{s}$ | Macro-civilizational planning, strategic multi-agent game-theoretic equilibrium. |\n\n---\n\n## 3. Dedicated 24/7 Kubernetes Cobrowser Bridge\n\nFor persistent Microsoft Copilot integration without human desktop dependencies, Sovereign OS operates a dedicated headless Chromium pod:\n\n- **Pod Name**: `apex-cortex/gemma-cobrowser-55584c4ffd-f5928`\n- **Internal REST Endpoint**: `http://gemma-cobrowser.apex-cortex.svc.cluster.local:3456`\n- **Chrome DevTools Protocol (CDP)**: Port `9222`\n- **Interactive VNC GUI**: `http://100.97.133.107:6080/vnc.html` (Display `:99`, port `5900`)\n- **Profile Invariant (Rule 13)**: The persistent browser user profile (`/puppeteer_profile`) is NEVER deleted, preserving enterprise credentials, cookies, and session state.\n\n---\n\n## 4. Interaction Modes\n\nThe Sovereign Copilot Interface supports four specialized operating modes:\n\n1. **Direct Operational Command**: Execute administrative queries, query node telemetry, inspect hot wallet balances, or trigger manual RPC failovers.\n2. **Autonomic Mission Planning**: Decompose complex goals (e.g., *\"Deploy Aerodrome Slipstream CLAMM residue sweep on Base\"*) into atomic 5DHCP tickets with preconditions and gas caps.\n3. **Civilizational Tensor Steering**: Inquire about current vitality slope ($S_v$) or evaluate candidate mutations:\n   $$\\Delta C_{12} = \\mathcal{F}(\\text{mutation}, S_v, \\text{cohesion})$$\n4. **Code & Contract Audit**: Dispatch smart contract bytecode or Rust crate diffs for Rule 8 (Zero Mock Data) and Rule 22 (Zero Open Approvals) invariant checks.\n\n---\n\n## 5. REST API Specifications\n\n### `POST /api/copilot/chat`\nDispatches a prompt to the Sovereign Copilot federated engine.\n\n**Request Body:**\n```json\n{\n  \"prompt\": \"Evaluate current vitality slope and report cluster health.\",\n  \"model\": \"hybrid\",\n  \"conversationId\": \"operator-session-001\"\n}\n```\n\n**Response Body:**\n```json\n{\n  \"status\": \"ok\",\n  \"conversationId\": \"operator-session-001\",\n  \"text\": \"Substrate Vitality Slope is 6.85 / 9.90 (recovering +0.01 per volley). All 4 nodes are fully synchronized. SCK Regime: HarmonicMesh.\",\n  \"model_used\": \"Sovereign Federated Copilot\",\n  \"telemetry\": {\n    \"vitality_slope\": 6.85,\n    \"cohesion_score\": 0.955,\n    \"regime\": \"HarmonicMesh\"\n  },\n  \"suggested_actions\": [\n    \"Audit Subsystems\",\n    \"View Architecture\",\n    \"Inspect PQR Ledger\"\n  ]\n}\n```\n\n---\n\n## 6. Security & Invariant Enforcement\n\n- **Rule 8 (Zero Mock Data)**: The Copilot Interface must never synthesize artificial trading simulations, win-rates, or fake PnL figures.\n- **Rule 11 (Shadow Hydration)**: The Copilot state machine must verify that context cube memory is fully hydrated from Valkey prior to answering.\n- **Rule 21 (Council Consensus)**: Generated code patches must undergo the 5-step SOP review before being committed or deployed.\n","last_modified":1728345600,"sha256_hash":"909f33701d9c263957324b2bd029be94","slug":"copilot-interface","title":"Copilot Interface"},{"category":"Overview","content_md":"# 🌌 Sovereign OS: The Autonomous Civilizational Operating System\n\nWelcome to the official, living documentation suite for **Sovereign OS**. Sovereign OS is a resilient, self-governing distributed operating system engineered for sub-millisecond multi-lane cognition, autonomic consensus, cryptographic economic settlement, and civilizational macro-steering.\n\n---\n\n## 🏛️ System Philosophy & Core Axioms\n\n1. **Substrate Autonomy**: The operating system functions as a self-sustaining sovereign substrate across edge nodes, bare-metal clusters (`apex1`, `lion`), and cloud enclaves.\n2. **Multi-Model Cognitive Federation**: Seamless hybrid routing across local NPUs (`qwen2:1.5b`), ultra-fast reasoning engines (Gemini 2.5), deep deductive provers (Claude 3.7 Sonnet), and biometric settle executors (Microsoft Copilot).\n3. **Dual-Entry Sovereign Ledger**: Cryptographic economic substrate grounded in PQR Coin (`pqr_coin`), zero-synthetic accounting, and atomic settlement.\n4. **Macro-Civilizational Steering**: Sovereign Civilization Kernel (SCK) continuously evaluates 12-dimensional civilizational tensors ($C_{12}$) to maintain systemic vitality ($S_v \\ge 6.24$).\n5. **Bi-Directional Living Documentation**: Code and documentation are strictly isomorphic. Any modification to an operational route, command, crate, or tensor automatically updates this wiki; any documentation drift is audited and blocked by the substrate compiler.\n\n---\n\n## 🧭 Sovereign Wiki Navigation Tree\n\n* [🎛️ Master Operator Console](./Master-Operator-Console.md)  \n  *The central operational command center, single pane of glass, and primary gateway to the entire Sovereign OS ecosystem.*\n* [🤖 Sovereign Copilot Interface](./Copilot-Interface.md)  \n  *Multi-model federated AI reasoning engine, 24/7 headless browser bridge, prompt plans, and mission synthesis.*\n* [🌐 Multi-Tenant Copilot Bridge](./Multi-Tenant-Copilot-Bridge.md)  \n  *Institutional multi-tenant architecture, session namespacing, anti-collision mutex, and Git-tracked governance.*\n* [📐 Architecture Overview](./Architecture.md)  \n  *12-Layer Civilizational Topology, Multi-Lane Execution Surface, 5D Context Cube, and Tensor Formulations.*\n* [⚙️ Subsystems Catalog](./Subsystems.md)  \n  *Comprehensive specifications of all 12 operational subsystems (SPRL, SUVL, Operator Console, Economic Substrate, PQR API, Cognitive Surface, Cognitive Bridge, SAMC, SAEL, HUD Unification, Autonomic Playbooks, Civilization Kernel).*\n* [🌐 REST API Reference](./API-Reference.md)  \n  *Complete OpenAPI & REST endpoint specifications for the `http_gateway` HTTP service.*\n* [💻 REPL Command Catalog](./REPL-Commands.md)  \n  *Exhaustive reference of the 45+ CLI commands in the `runtime_shell` environment.*\n* [☸️ Kubernetes CRDs & Deployment](./Kubernetes-CRDs.md)  \n  *Custom Resource Definitions (`DocumentationArtifact`, `DocMeshRewriteEnvelope`) and Apex1 cluster topology.*\n* [🛡️ Sovereign Invariants & Rules](./Invariants-and-Rules.md)  \n  *The 24 Fail-Once Sovereign Rules, Prime Directives #1–#3, Zero Mock Data (Rule 8), and Valkey SSOT Parity (Rule 18).*\n* [🔄 Bi-Directional Live Sync Engine](./Bi-Directional-Sync.md)  \n  *Continuous AST code reflection, contract verification, and docmesh synchronization mechanisms.*\n\n---\n\n## 📦 Workspace Overview\n\nThe Sovereign OS workspace is organized into modular crate domains:\n- **`core/`**: Fundamental building blocks (`sovereign_core`, `execution_mesh`, `gossip_engine`, `settlement_engine`, `mesh_directory`).\n- **`economy/`**: Atomic ledger and currency engines (`pqr_coin`, `pqr_log`).\n- **`cognition/`**: Context navigation, semantic routing, and AI adapters (`cube_engine`, `drift_tracker`, `lineage_engine`, `ticketing_engine`, `llm_adapter`, `semantic_mesh`).\n- **`governance/`**: Policies, constraints, and SSOT engines (`policy_engine`, `substrate_engine`, `economic_substrate`, `adaptive_policy`, `audit_compliance`).\n- **`ops/`**: Operational subsystems, HTTP services, CLIs, and live documentation (`http_gateway`, `runtime_shell`, `operator_console`, `hud_unification`, `autonomic_playbooks`, `civilization_kernel`, `live_docs`).\n- **`workers/`**: Headless worker runtimes and telemetry streamers (`llm_workers`).\n\n---\n\n*Last Synchronized: 2026-10-08 | Engine: `ops/live_docs` v0.1.0 | Substrate Vitality: $S_v = 6.24 / 9.9$*\n","last_modified":1728345600,"sha256_hash":"7bbe966ff14e54c6306686d0ab17b4e8","slug":"home","title":"Home"},{"category":"Governance","content_md":"# 🛡️ Sovereign Invariants & Fail-Once Rules\n\n[🏠 Home](./Home.md) | [🎛️ Console](./Master-Operator-Console.md) | [🤖 Copilot](./Copilot-Interface.md) | [📐 Architecture](./Architecture.md) | [⚙️ Subsystems](./Subsystems.md) | [🌐 API Reference](./API-Reference.md) | [💻 REPL Commands](./REPL-Commands.md) | [☸️ K8s CRDs](./Kubernetes-CRDs.md) | [🛡️ Invariants & Rules](./Invariants-and-Rules.md) | [🔄 Bi-Directional Sync](./Bi-Directional-Sync.md)\n\n---\n\n## 🚨 Prime Directives\n\n1. **Prime Directive #1 (Human Time & Lifeforce)**:\n   > *\"TIME IS THE MOST VALUABLE ASSET A HUMAN HAS, WASTING IT IS LIKE STEALING HIS LIFEFORCE, DON'T WASTE TIME, FAIL ONCE FOREVER!\"*\n   Zero hallucination, verify before claiming completion, never repeat a diagnosed failure mode.\n\n2. **Prime Directive #2 (Safety & Zero Destruction)**:\n   > *\"NO DESTRUCTIVE COMMANDS I THOUGHT YOU LEARNED\"*\n   Strictly forbidden: `rm -rf`, dropping tables, killing non-target services, or overwriting working configurations.\n\n3. **Prime Directive #3 (Mandatory Volley-by-Volley 5DHCP Save Codes & Ticketing)**:\n   Every single system response must contain:\n   - Formal 5DHCP Save Code\n   - Context Cube Vector\n   - Semantic Focus Drift Vector $\\|\\Delta v_f\\|$\n   - Lineage Pedigree Link\n   - Live System Register Snapshot\n   - Next Volley Action Directive\n\n---\n\n## 📋 Master Fail-Once Rules (Selected Key Rules)\n\n- **Rule 4 (Verified Smart Contracts & Pool Invocations)**: Never route empty calldata directly to pools; route transactions through verified deployed contracts (`LionAtomicArbitrage.sol`, `CamelotAtomicResidue.sol`, `AerodromeResidueHarvester.sol`).\n- **Rule 8 (Strict Prohibition of Synthetic/Mock Trading Simulation - Global Hard Stop)**:\n  Banned words and practices: `random`, `synthesized`, `assume`, `guess`, `falsify`, `preweighted`, `inferred` to construct mock trading simulations or fake win rates. Enforces pure live on-chain and hardware telemetry.\n- **Rule 10 (Non-Regression Pre-Flight & Post-Flight Invariant Verification)**:\n  Any modification or repair applied to a component must NEVER break previously established working functionality.\n- **Rule 12 (Windows Native Kubectl & Apex1 Cluster SSOT)**:\n  Direct Kubernetes access to `apex1.predator.run` is fully configured natively via Windows `kubectl.exe` reading `C:\\Users\\theal\\.kube\\config`.\n- **Rule 18 (Sovereign Parity Watchdog, Direct Static Ingress & Valkey SSOT)**:\n  Agent state, vitality slope ($S_v$), and ticket registries MUST strictly be grounded in the active cluster database (`valkey-broker:6379`). Static prompt template reminders (e.g. Sv: 2.59) must never be treated as ground truth over live Valkey keys.\n- **Rule 21 (Mandatory Universal Code Review & 5-Member Council Consensus)**:\n  Any code modified across any language must undergo the 5-step SOP including static audit and multi-agent ratification.\n- **Rule 22-24 (Zero Persistent Approvals & Pure Dynamic Ingress)**:\n  Strict prohibition of open approvals (`approve(spender, 2^256 - 1)`) and zero hardcoded static market parameters.\n","last_modified":1728345600,"sha256_hash":"30008755a338afa605caff38b52b9ad3","slug":"invariants-and-rules","title":"Invariants & Rules"},{"category":"Operations","content_md":"# ☸️ Sovereign OS Kubernetes CRDs & Cluster Topology\n\n[🏠 Home](./Home.md) | [🎛️ Console](./Master-Operator-Console.md) | [🤖 Copilot](./Copilot-Interface.md) | [📐 Architecture](./Architecture.md) | [⚙️ Subsystems](./Subsystems.md) | [🌐 API Reference](./API-Reference.md) | [💻 REPL Commands](./REPL-Commands.md) | [☸️ K8s CRDs](./Kubernetes-CRDs.md) | [🛡️ Invariants & Rules](./Invariants-and-Rules.md) | [🔄 Bi-Directional Sync](./Bi-Directional-Sync.md)\n\n---\n\n## 1. Documentation Custom Resource Definitions\n\n### `DocumentationArtifact` (`documentationartifacts.kontextkube.io`)\n- **Group**: `kontextkube.io`\n- **Version**: `v1alpha1`\n- **Scope**: Namespaced (`apex-cortex`)\n- **Short Names**: `docart`, `da`\n- **Purpose**: Represents an immutable or live-synced documentation page or schema artifact maintained by `ops/live_docs` and `docmesh-operator`.\n- **Example Manifest**:\n  ```yaml\n  apiVersion: kontextkube.io/v1alpha1\n  kind: DocumentationArtifact\n  metadata:\n    name: sovereign-architecture\n    namespace: apex-cortex\n    labels:\n      app.kubernetes.io/part-of: sovereign-os\n      docmesh.kontextkube.io/synced: \"true\"\n  spec:\n    title: \"Sovereign OS Architecture\"\n    slug: \"architecture\"\n    format: \"markdown\"\n    sha256: \"e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855\"\n    content: |\n      # Sovereign OS Architecture\n      ...\n    metadata:\n      subsystemsCount: 12\n      routesCount: 22\n      commandsCount: 45\n  ```\n\n### `DocMeshRewriteEnvelope` (`docmeshrewriteenvelopes.kontextkube.io`)\n- **Purpose**: Governs autonomic documentation rewriting proposals when code changes occur, ensuring doc rewrites are audited before being committed back to the repository.\n\n---\n\n## 2. Apex1 Cluster Topology\n\nThe `apex-cortex` namespace houses the sovereign microservices:\n\n| Pod Name | Purpose | Excluded / Ingress Ports |\n| :--- | :--- | :--- |\n| `sovereign-os-builder` | Continuous compilation & testing environment for Sovereign OS. | Direct workspace mount |\n| `docmesh-operator` | Reconciles `DocumentationArtifact` CRDs with live documentation states. | Cluster-internal |\n| `valkey-broker` | Ultra-fast in-memory SSOT database for context cubes, drift vectors, and live docs. | Port `6379` |\n| `shadow-solver-daemon` | Mathematical validator and Rubik's cube tensor arbitrator. | Port `8082` (NodePort `30882`)|\n| `gemma-cobrowser` | 24/7 headless browser bridge for Copilot and CDP automation. | Port `3456` (API), `9222` (CDP) |\n| `kontextkube-operator` | Core context governor enforcing 5D Context Cube topology. | Cluster-internal |\n","last_modified":1728345600,"sha256_hash":"8076fbc18523b3d112055eb1868c8c81","slug":"kubernetes-crds","title":"Kubernetes CRDs"},{"category":"Operations","content_md":"# 🎛️ Sovereign Master Operator Console\n\n[🏠 Home](./Home.md) | [🎛️ Console](./Master-Operator-Console.md) | [🤖 Copilot](./Copilot-Interface.md) | [📐 Architecture](./Architecture.md) | [⚙️ Subsystems](./Subsystems.md) | [🌐 API Reference](./API-Reference.md) | [💻 REPL Commands](./REPL-Commands.md) | [☸️ K8s CRDs](./Kubernetes-CRDs.md) | [🛡️ Invariants & Rules](./Invariants-and-Rules.md) | [🔄 Bi-Directional Sync](./Bi-Directional-Sync.md)\n\n---\n\n## 1. Executive Overview & Purpose\n\nThe **Master Operator Console** (`ops/operator_console` & `ops/hud_unification`) serves as the central operative command center and single pane of glass for human operators and sovereign agents. It is the primary interactive gateway to the entire Sovereign OS ecosystem, uniting:\n\n1. **The Sovereign Copilot Interface**: A multi-model federated reasoning canvas for executing prompt plans, dispatching missions, and arbitrating civilizational steering.\n2. **The 12-Layer Civilizational Matrix**: Real-time telemetry, node health, and vitality slope ($S_v$) monitoring across edge clusters (`apex1`, `lion`, Arbitrum Nitro, Base).\n3. **The Dual-Entry Economic Ledger**: Live PQR Coin balance, mission escrows, miner rewards, and atomic settlement telemetry.\n4. **Interactive Kernel REPL**: Direct execution surface for the 45+ CLI commands across `sctl`, `runtime_surface`, and `governance`.\n5. **Living Documentation Integration**: In-console access to the AST-reflected living wiki suite.\n\n```mermaid\ngraph TD\n    User[\"👤 Human Operator / Sovereign Agent\"] --> Ingress[\"🌐 Traefik Ingress: os.predator.run:443\"]\n    Ingress --> Console[\"🎛️ Master Operator Console UI\"]\n    Console --> CopilotPane[\"🤖 Embedded Copilot Interface\"]\n    Console --> MatrixPane[\"📊 12-Layer Subsystem Matrix\"]\n    Console --> ReplPane[\"💻 Interactive Kernel REPL\"]\n    Console --> DocsPane[\"📚 Living Docs Drawer\"]\n    \n    CopilotPane --> CogBridge[\"ops/cognitive_bridge (Port 3456 / LLMs)\"]\n    MatrixPane --> SCK[\"ops/civilization_kernel (Tensor C12)\"]\n    ReplPane --> SctlServer[\"ops/sctl_server (Execution Surface)\"]\n    DocsPane --> LiveDocs[\"ops/live_docs (AST Reflection)\"]\n```\n\n---\n\n## 2. Operative Components & Subsystem Bindings\n\nThe Master Operator Console synthesizes five foundational crates in the Sovereign OS workspace:\n\n| Crate | Layer | Function in Console |\n| :--- | :--- | :--- |\n| **`ops/operator_console`** | Layer 3 | Computes node metrics, active missions, reliability records, and access roles (`OperatorDashboard`). |\n| **`ops/hud_unification`** | Layer 10 | Aggregates mesh topology, trust policies, autonomic incident status, and economic state into a single payload. |\n| **`ops/cognitive_bridge`** | Layer 7 | Interfaces with Microsoft Copilot (`gemma-cobrowser:3456`), local NPUs (`qwen2:1.5b`), and cloud provers. |\n| **`ops/http_gateway`** | Layer 3/10 | Axum REST gateway serving the unified HTML UI at `GET /` and handling `/api/copilot/*`. |\n| **`ops/sctl` & `ops/sctl_v2`**| Layer 0/1 | Dispatches 5DHCP tickets and parses stdout/stderr from kernel commands. |\n\n---\n\n## 3. UI Topology & Workspace Layout\n\nThe Master Operator Console utilizes a high-density, low-latency glassmorphic interface:\n\n### A. Sovereign Header Deck\n- **Substrate Vitality Slope ($S_v$) Gauge**: Displays the live recovery curve ($0.00$ to $9.90$).\n- **Civilizational Regime Badge**: Live indicator of system stability (`HarmonicMesh`, `Perturbed`, `EmergencyIntervention`).\n- **Cluster Mesh Federation**: Live ping indicators for `apex1.predator.run`, `lion.mev`, `arbitrum-one`, and `base-mainnet`.\n- **Sovereign Wallet SSOT**: Real-time hot wallet balances (`USDC`, `WETH`, `ETH`, and `PQR Coin`).\n\n### B. Sovereign Copilot Workspace (Center)\n- Multi-turn conversational canvas with markdown formatting and code highlighting.\n- Federated model selector (`Sovereign Hybrid`, `Microsoft Copilot Bridge`, `Local Qwen NPU`, `DeepSeek-R1`).\n- Quick-action buttons:\n  - *Audit Subsystems*: Runs `ops/hud_unification::audit_subsystems`.\n  - *Evaluate Civilizational Delta*: Simulates tensor perturbations before applying mutations.\n  - *Audit Gas Budget*: Validates rolling gas burn against Rule 7 and fiscal engine limits.\n  - *Trigger Autonomic Self-Healing*: Executes incident response playbooks.\n\n### C. 12-Layer Civilizational Matrix (Left Sidebar)\n- Comprehensive status checklist of all 12 OS layers.\n- Real-time fault detection and stale-field indicators via `ops/hud_unification::HudAuditReport`.\n\n### D. Interactive Kernel Terminal (Bottom Drawer)\n- Direct terminal window executing commands against `sctl_server`.\n- Supports all 45+ CLI commands (`status`, `vitality`, `cube`, `tickets`, `pqr`, `reputation`, `drift`, `playbooks`).\n\n---\n\n## 4. REST & WebSocket Endpoints\n\n| Route | Method | Description |\n| :--- | :--- | :--- |\n| **`/` / `/console`** | `GET` | Serves the unified Master Operator Console & Copilot HTML/JS dashboard. |\n| **`/console/dashboard`** | `GET` | Returns raw JSON serialization of `OperatorDashboard`. |\n| **`/api/copilot/chat`** | `POST` | Dispatches operator prompt to the federated cognitive bridge. |\n| **`/api/copilot/history`**| `GET` | Returns historical operator interaction turns. |\n| **`/hud/master`** | `GET` | Consolidated HUD state across all 12 civilizational layers. |\n| **`/hud/audit`** | `GET` | Audit report of stale telemetry fields and active anomalies. |\n| **`/remote/execute`** | `POST` | Executes an arbitrary REPL command in the kernel. |\n\n---\n\n## 5. Security & Invariant Enforcement\n\n1. **Zero Synthetic Telemetry (Rule 8 & 24)**: The console strictly renders telemetry derived from live Valkey substrate keys, on-chain receipts, and kernel provers. No simulated prices or fake win-rates are permitted.\n2. **SSOT Parity (Rule 18)**: Displayed $S_v$ and cohesion scores must match Valkey cluster database state with delta $\\le 0.05$.\n3. **Bi-Directional Living Link**: Changes to any operative crate reflected in the console automatically update the living documentation.\n","last_modified":1728345600,"sha256_hash":"13b1606ba73249f9c47c53cb67860839","slug":"master-operator-console","title":"Master Operator Console"},{"category":"Operations","content_md":"# 🌐 Multi-Tenant Copilot Bridge Architecture & Governance\n\n[🏠 Home](./Home.md) | [🎛️ Console](./Master-Operator-Console.md) | [🤖 Copilot](./Copilot-Interface.md) | [🌐 Multi-Tenant Bridge](./Multi-Tenant-Copilot-Bridge.md) | [📐 Architecture](./Architecture.md) | [⚙️ Subsystems](./Subsystems.md) | [🌐 API Reference](./API-Reference.md) | [💻 REPL Commands](./REPL-Commands.md) | [☸️ K8s CRDs](./Kubernetes-CRDs.md) | [🛡️ Invariants & Rules](./Invariants-and-Rules.md) | [🔄 Bi-Directional Sync](./Bi-Directional-Sync.md)\n\n---\n\n## 1. Constitutional Multi-Tenant Mandate\n\nThe cluster's headless Microsoft Copilot bridge is an **institutional, multi-tenant resource** shared across the entire Sovereign OS agent federation:\n- **Human Operators** (via `https://os.predator.run/` Master Operator Console)\n- **Antigravity / Gemini Coding Agent** (via direct REST & CDP orchestration)\n- **Qwen 2.5 NPU Swarm** (on Lion node for sub-millisecond local inferences)\n- **Claude / DeepSeek Provers** (for formal mathematical & smart contract verification)\n- **Autonomic Watchdog Daemons** (for automated incident response and self-healing)\n\nTo prevent conflicting modifications, race conditions, keystroke contamination, or session invalidation, **all agents and operators MUST strictly adhere to this central specification**.\n\n---\n\n## 2. Infrastructure Topology (SSOT)\n\n```mermaid\ngraph TD\n    Agent1[\"👤 Human Operator (Console)\"] -->|conversationId: operator:*| RestAPI\n    Agent2[\"🤖 Antigravity / Gemini\"] -->|conversationId: agent:antigravity:*| RestAPI\n    Agent3[\"🦁 Qwen NPU Swarm\"] -->|conversationId: agent:qwen:*| RestAPI\n    Agent4[\"⚡ Autonomic Sentinel\"] -->|conversationId: agent:sentinel:*| RestAPI\n\n    subgraph Pod [\"☸️ apex-cortex/gemma-cobrowser\"]\n        RestAPI[\"REST Bridge (Port 3456)\"]\n        CDP[\"Chrome DevTools Protocol (Port 9222)\"]\n        VNC[\"noVNC GUI Display :99 (Port 5900/6080)\"]\n        Profile[\"📁 /puppeteer_profile (PERMANENT AUTH SSOT)\"]\n        \n        RestAPI --> CDP\n        CDP --> Tabs[\"Target Tabs: Isolated by conversationId\"]\n        Tabs --> Profile\n    end\n```\n\n### Core Connection Parameters\n\n| Parameter | Value | Description |\n| :--- | :--- | :--- |\n| **Kubernetes Pod** | `apex-cortex/gemma-cobrowser-55584c4ffd-f5928` | Dedicated 24/7 cluster cobrowser |\n| **Node Location** | `server` (`162.244.80.232` / Tailscale `100.97.133.107`) | Bare-metal Apex1 compute node |\n| **REST API URL** | `http://10.43.134.153:3456` or `http://localhost:3456` | Direct headless chat, tasks, and debug endpoints |\n| **CDP Endpoint** | `http://10.43.134.153:9222` | Chrome DevTools Protocol remote debugging |\n| **noVNC Web GUI** | `http://100.97.133.107:6080/vnc.html` | Interactive display `:99` for biometric manual override |\n| **Profile Storage**| `/puppeteer_profile` | Authenticated browser profile (NEVER WIPED) |\n\n---\n\n## 3. Tenant Isolation & Session Namespacing\n\n### The Law of Conversation ID Namespacing\nNo agent may dispatch prompts to the default or unnamespaced conversation thread. Every API invocation MUST declare an explicit, namespaced `conversationId`:\n\n```text\nFormat: <tenant_type>:<agent_or_subsystem>:<ticket_or_session_id>\n```\n\n#### Canonical Namespace Prefixes:\n1. `operator:web:<session_uuid>` — Human operator interactive sessions from `os.predator.run`.\n2. `agent:antigravity:<ticket_id>` — Antigravity / Gemini architectural and coding tasks.\n3. `agent:qwen:<ticket_id>` — Lion NPU local model triage and code reviews.\n4. `agent:sentinel:<run_id>` — Autonomic playbooks and QA watchdogs.\n5. `council:<proposal_id>` — Sovereign 5-Member Council legislative votes.\n\n### Isolated Tab Lifecycle\n- The bridge daemon inspects `conversationId` upon receiving `POST /api/copilot/chat`.\n- If a page matching the ID exists, it routes directly to that isolated tab.\n- If no matching tab exists, it spawns a dedicated Chromium page (`Target.createTarget`), injects the target URL (`https://copilot.microsoft.com`), and navigates in total isolation from other agent tabs.\n- Under zero circumstances may an agent call `Page.bringToFront` on an active tab belonging to another tenant.\n\n---\n\n## 4. Anti-Collision & Mutex Protocol\n\nTo guarantee that multiple agents never collide during state transitions:\n\n1. **Valkey Distributed Lease (`lock:copilot:bridge`)**:\n   - When an agent initiates an operational reconfiguration (e.g., refreshing authentication or restarting the bridge daemon), it MUST acquire a Valkey lease:\n     ```redis\n     SET lock:copilot:bridge <agent_id> NX EX 30\n     ```\n   - Standard conversational queries do **not** require the mutex, as Chromium handles multi-tab CDP sessions concurrently.\n2. **Zero Keystroke / Focus Leaks**:\n   - Keyboard events are dispatched strictly via CDP `Input.dispatchKeyEvent` addressed to the specific `sessionId` of that tenant's tab. OS-level window focus (`xdotool`, `xwininfo`) is strictly forbidden.\n\n---\n\n## 5. Absolute Profile Protection (Rule 13 Fail-Once Invariant)\n\n> [!CAUTION]\n> **Strict Prohibition of Profile Deletion (Rule 13)**:\n> Agents MUST NEVER delete, wipe, `rm -rf`, or overwrite `/puppeteer_profile`, browser cookies, or user data directories inside `gemma-cobrowser`.\n> All authenticated sessions (Microsoft Copilot, Schwab, Entra ID) belong to the human user.\n> If a Chromium process deadlocks or crashes, agents may ONLY clear `SingletonLock` files (`rm -f /puppeteer_profile/SingletonLock`), NEVER the profile directory itself.\n\n---\n\n## 6. Git-Tracked Governance & Audit Trail\n\nEvery operational change to the Copilot bridge must be tracked in version control:\n\n1. **Git Repository Tracking**:\n   - The cobrowser deployment manifests (`k8s/gemma-cobrowser.yaml`), Node.js bridge server code (`server.js`), and Dockerfile must reside in `https://github.com/thealanphipps-del/sovereign-os` under `ops/cognitive_bridge/cobrowser/`.\n   - Ad-hoc modifications via `kubectl exec` without a corresponding Git commit are strictly classified as Prime Directive #1 & #2 violations.\n2. **Audit Logging in Valkey**:\n   - Every prompt and response turns are logged into Valkey under `copilot:audit:<conversationId>:<timestamp>` with token counts, latency metrics, and tenant identity.\n3. **Bi-Directional Live Sync**:\n   - Any updates to bridge routes or environment variables trigger the `LiveDocEngine` bi-directional reflection loop, updating this documentation page automatically.\n","last_modified":1728345600,"sha256_hash":"884ea6e37bf5e34f20457972e1d938a8","slug":"multi-tenant-copilot-bridge","title":"Multi-Tenant Copilot Bridge"},{"category":"Reference","content_md":"# 💻 Sovereign OS REPL Command Catalog\n\n[🏠 Home](./Home.md) | [🎛️ Console](./Master-Operator-Console.md) | [🤖 Copilot](./Copilot-Interface.md) | [📐 Architecture](./Architecture.md) | [⚙️ Subsystems](./Subsystems.md) | [🌐 API Reference](./API-Reference.md) | [💻 REPL Commands](./REPL-Commands.md) | [☸️ K8s CRDs](./Kubernetes-CRDs.md) | [🛡️ Invariants & Rules](./Invariants-and-Rules.md) | [🔄 Bi-Directional Sync](./Bi-Directional-Sync.md)\n\n---\n\n## 1. Core Execution & Routing\n\n| Command | Syntax | Description | Example |\n| :--- | :--- | :--- | :--- |\n| `tick` | `tick` | Executes a single autonomic state machine cycle. | `sovereign> tick` |\n| `mesh` | `mesh <text>` | Dispatches a prompt through the fast-path execution mesh. | `sovereign> mesh verify network` |\n| `fast` | `fast <text>` | Explicitly routes a prompt through Gemini 2.5 Flash. | `sovereign> fast ping status` |\n| `deep` | `deep <text>` | Explicitly routes a prompt through Claude 3.7 Sonnet. | `sovereign> deep analyze invariant` |\n| `settle` | `settle <text>` | Routes execution through the Copilot biometric settle lane. | `sovereign> settle verify cold balance` |\n| `lane` | `lane` | Displays the current autonomic substrate lane selection. | `sovereign> lane` |\n\n---\n\n## 2. 5D Context Cube & Governance\n\n| Command | Syntax | Description | Example |\n| :--- | :--- | :--- | :--- |\n| `cube` | `cube <x> <y> <z> <face>` | Updates active Context Cube coordinate. | `sovereign> cube 3 2 0 2` |\n| `cube-lane` | `cube-lane` | Shows optimal execution lane suggested by cube position. | `sovereign> cube-lane` |\n| `drift` | `drift` | Calculates and displays current semantic focus drift $\\|\\Delta v_f\\|$. | `sovereign> drift` |\n| `lineage` | `lineage` | Prints cryptographic lineage hash chain ($h_n$). | `sovereign> lineage` |\n| `vitality` | `vitality` | Inspects current Substrate Vitality Slope ($S_v$). | `sovereign> vitality` |\n| `forbid` | `forbid <word>` | Appends a forbidden toxic word to the SSOT governance rules. | `sovereign> forbid hallucinate` |\n| `rules` | `rules` | Dumps the active SSOT governance rule list. | `sovereign> rules` |\n\n---\n\n## 3. PQR Economic Ledger\n\n| Command | Syntax | Description | Example |\n| :--- | :--- | :--- | :--- |\n| `balance` | `balance <account>` | Shows PQR Coin balance for an account. | `sovereign> balance operator` |\n| `mint` | `mint <who> <amount>` | Mints PQR Coin into an authorized account. | `sovereign> mint operator 1000` |\n| `pay` | `pay <from> <to> <amt>` | Executes an atomic ledger transfer of PQR Coin. | `sovereign> pay operator worker-1 50` |\n| `reward` | `reward <who> <amt>` | Disburses an autonomic mission reward. | `sovereign> reward worker-1 25` |\n\n---\n\n## 4. Missions & Autonomic Playbooks\n\n| Command | Syntax | Description | Example |\n| :--- | :--- | :--- | :--- |\n| `mission-list` | `mission-list` | Lists all active and completed autonomic missions. | `sovereign> mission-list` |\n| `mission-create`| `mission-create <id> <desc>` | Defines a new high-level autonomic mission. | `sovereign> mission-create m-01 audit` |\n| `playbook-list` | `playbook-list` | Lists registered self-healing playbooks. | `sovereign> playbook-list` |\n| `playbook-run` | `playbook-run <id>` | Manually triggers execution of an autonomic playbook. | `sovereign> playbook-run heal-rpc` |\n\n---\n\n## 5. Master Cockpit & HUD\n\n| Command | Syntax | Description | Example |\n| :--- | :--- | :--- | :--- |\n| `hud-master` | `hud-master` | Displays the unified master HUD snapshot. | `sovereign> hud-master` |\n| `hud-audit` | `hud-audit` | Runs field-level non-regression audit across all HUD widgets. | `sovereign> hud-audit` |\n\n---\n\n## 6. Civilization Kernel (SCK)\n\n| Command | Syntax | Description | Example |\n| :--- | :--- | :--- | :--- |\n| `civilization-state` | `civilization-state` | Prints the 12-dimensional civilization tensor. | `sovereign> civilization-state` |\n| `civilization-eval` | `civilization-eval` | Evaluates a candidate macroeconomic delta. | `sovereign> civilization-eval` |\n| `civilization-exec` | `civilization-exec` | Commits an approved civilization delta. | `sovereign> civilization-exec` |\n\n---\n\n## 7. Live Documentation & Contract Sync (`ops/live_docs`)\n\n| Command | Syntax | Description | Example |\n| :--- | :--- | :--- | :--- |\n| `docs-sync` | `docs-sync` | Executes bi-directional live synchronization between code and docs. | `sovereign> docs-sync` |\n| `docs-audit` | `docs-audit` | Audits documentation drift against live code contracts. | `sovereign> docs-audit` |\n| `docs-list` | `docs-list` | Lists all registered wiki documentation pages. | `sovereign> docs-list` |\n| `docs-view` | `docs-view <page>` | Prints the rendered markdown content of a wiki page. | `sovereign> docs-view Architecture` |\n","last_modified":1728345600,"sha256_hash":"b646c70a3657bd754e7e050887d1227f","slug":"repl-commands","title":"REPL Commands"},{"category":"Components","content_md":"# ⚙️ Sovereign OS Subsystems Catalog\n\n[🏠 Home](./Home.md) | [🎛️ Console](./Master-Operator-Console.md) | [🤖 Copilot](./Copilot-Interface.md) | [📐 Architecture](./Architecture.md) | [⚙️ Subsystems](./Subsystems.md) | [🌐 API Reference](./API-Reference.md) | [💻 REPL Commands](./REPL-Commands.md) | [☸️ K8s CRDs](./Kubernetes-CRDs.md) | [🛡️ Invariants & Rules](./Invariants-and-Rules.md) | [🔄 Bi-Directional Sync](./Bi-Directional-Sync.md)\n\n---\n\n## 1. SPRL — Sovereign Peer Reputation Layer (`ops/sprl`)\n- **Purpose**: Calculates and maintains decentralized reputation scores for peer nodes and agents based on ticket completion rates, SLA adherence, and gossip honesty.\n- **Key Structs**: `PeerReputation`, `ReputationManager`, `ReputationScore`.\n- **Invariants**: Reputation decays exponentially on unverified claims; zero-fault history increases peer trust radius.\n\n## 2. SUVL — Sovereign Unit Valuation Layer (`ops/suvl`)\n- **Purpose**: Dynamic pricing and valuation engine for cognitive compute units, micro-transactions, and gas expenditure forecasting.\n- **Key Structs**: `UnitValuationEngine`, `ComputeUnitPrice`, `ValuationMetrics`.\n- **Invariants**: Strictly enforces live on-chain and hardware telemetry pricing; zero synthetic numbers.\n\n## 3. Master Operator Console (`ops/operator_console`)\n- **Purpose**: Central operative command center and single pane of glass for human operators and sovereign agents. Unites the embedded Sovereign Copilot workspace, 12-layer civilizational matrix, and interactive kernel REPL. Detailed in [Master Operator Console Specification](./Master-Operator-Console.md).\n- **Key Structs**: `OperatorDashboard`, `ConsoleNodeView`, `ConsoleMissionView`, `ConsoleReliabilityView`, `ConsoleUpgradeView`, `ConsoleAccessView`.\n- **HTTP Endpoints**:\n  - `GET /` & `GET /console` — Interactive Master Operator Console HTML UI\n  - `GET /console/dashboard` — JSON telemetry payload\n\n## 4. Economic Substrate (`governance/economic_substrate` & `economy/pqr_coin`)\n- **Purpose**: Dual-entry atomic ledger accounting for the sovereign currency (PQR Coin). Tracks hot balances, mission escrows, and miner rewards.\n- **Key Structs**: `EconomicSubstrate`, `AccountLedger`, `PqrCoin`, `TransactionReceipt`.\n- **HTTP Endpoints**: Exposed via PQR API (`/pqr/*`).\n\n## 5. PQR API (`ops/pqr_api`)\n- **Purpose**: REST and programmatic API contracts for querying account balances, executing atomic transfers, and disbursing mission bounties.\n- **Key Structs**: `WalletBalanceRequest`, `WalletBalanceResponse`, `TransferRequest`, `RewardRequest`.\n- **HTTP Endpoints**:\n  - `POST /pqr/wallet/balance`\n  - `POST /pqr/mission/balance`\n  - `POST /pqr/transfer`\n  - `POST /pqr/reward`\n\n## 6. Cognitive Surface (`ops/cognitive_surface`)\n- **Purpose**: Intent classification, semantic prompt routing, and agent persona arbitration.\n- **Key Structs**: `CognitiveSurface`, `IntentClassification`, `LaneHint`.\n\n## 7. Cognitive Bridge & Sovereign Copilot (`ops/cognitive_bridge`)\n- **Purpose**: Multi-LLM hybrid router bridging the cluster's 24/7 headless Copilot browser (`gemma-cobrowser:3456`), local Ollama/NPU models (`qwen2:1.5b`), Claude, Gemini, and native Rust provers. Powers the embedded Sovereign Copilot workspace. Detailed in [Copilot Interface Specification](./Copilot-Interface.md).\n- **Key Structs**: `CognitiveBridge`, `CognitiveExecutionRequest`, `CognitiveExecutionResult`, `PromptPlan`.\n- **HTTP Endpoints**:\n  - `POST /api/copilot/chat` — Interactive Sovereign Copilot prompt endpoint\n  - `GET /api/copilot/history` — Session turn history\n  - `POST /cog/execute` — Kernel cognitive execution surface\n\n## 8. SAMC — Sovereign Autonomic Mission Controller (`ops/samc`)\n- **Purpose**: High-level autonomic mission planner and supervisor. Decomposes macro directives into discrete 5DHCP tickets, assigns agents, and tracks lifecycle states.\n- **Key Structs**: `MissionController`, `MissionContract`, `MissionTicketAssignment`.\n\n## 9. SAEL — Sovereign Audit & Event Ledger (`ops/sael`)\n- **Purpose**: Append-only cryptographic audit trail recording all state mutations, tickets, CLI commands, and macro-decisions.\n- **Key Structs**: `AuditLedger`, `AuditEvent`, `AuditEventKind`, `MerkleReceipt`.\n\n## 10. HUD Unification (`ops/hud_unification`)\n- **Purpose**: Single Source of Truth aggregator for operator cockpits. Consolidates mesh topology, peer reputations, wallet balances, autonomic status, and macro tensors into a single payload.\n- **Key Structs**: `HudMasterSnapshot`, `HudAuditReport`.\n- **HTTP Endpoints**: `GET /hud/master`, `GET /hud/audit`.\n\n## 11. Autonomic Playbooks (`ops/autonomic_playbooks`)\n- **Purpose**: Self-healing incident response and policy automation engine. Executes pre-approved runbooks when telemetry breaches safety thresholds.\n- **Key Structs**: `Playbook`, `AutonomicPolicy`, `PlaybookRun`, `PlaybookAuditReport`.\n- **HTTP Endpoints**:\n  - `GET /autonomic/playbooks`, `POST /autonomic/playbooks`\n  - `GET /autonomic/policies`, `POST /autonomic/policies`\n  - `POST /autonomic/playbooks/:id/run`\n  - `GET /autonomic/runs`\n  - `GET /autonomic/audit`\n\n## 12. SCK — Sovereign Civilization Kernel (`ops/civilization_kernel`)\n- **Purpose**: Highest-order steering kernel. Evaluates 12-dimensional civilizational tensors ($C_{12}$), applies policy constraints, and authorizes macro-evolutionary state deltas.\n- **Key Structs**: `CivilizationKernel`, `CivilizationTensor`, `CivilizationState`, `CivilizationDelta`, `CivilizationDecision`, `CivilizationExecutionReceipt`.\n- **HTTP Endpoints**:\n  - `GET /civilization/state`\n  - `POST /civilization/decision`\n  - `POST /civilization/execute`\n  - `GET /civilization/audit`\n","last_modified":1728345600,"sha256_hash":"fc202059eeb807baabc6d7e9eaeac734","slug":"subsystems","title":"Subsystems"}],"routes":[{"description":"Submit remote execution ticket","handler":"handle_remote_submit","method":"POST","path":"/remote/submit","subsystem":"sctl"},{"description":"Execute remote mesh instruction","handler":"handle_remote_execute","method":"POST","path":"/remote/execute","subsystem":"sctl_v2"},{"description":"Execute interactive shell command on kernel REPL","handler":"handle_repl_execute","method":"POST","path":"/api/repl/execute","subsystem":"operator_console"},{"description":"Retrieve full mesh ledger entries","handler":"handle_mesh_ledger","method":"GET","path":"/mesh/ledger","subsystem":"mesh_ledger"},{"description":"Retrieve synthesized operator dashboard","handler":"handle_console_dashboard","method":"GET","path":"/console/dashboard","subsystem":"operator_console"},{"description":"Query PQR Coin balance for account","handler":"handle_pqr_wallet_balance","method":"POST","path":"/pqr/wallet/balance","subsystem":"pqr_api"},{"description":"Query locked mission escrow balance","handler":"handle_pqr_mission_balance","method":"POST","path":"/pqr/mission/balance","subsystem":"pqr_api"},{"description":"Transfer PQR Coin between accounts","handler":"handle_pqr_transfer","method":"POST","path":"/pqr/transfer","subsystem":"pqr_api"},{"description":"Disburse verified mission completion reward","handler":"handle_pqr_reward","method":"POST","path":"/pqr/reward","subsystem":"pqr_api"},{"description":"Dispatch multi-LLM cognitive execution","handler":"handle_cog_execute","method":"POST","path":"/cog/execute","subsystem":"cognitive_bridge"},{"description":"Master unified HUD telemetry snapshot","handler":"handle_hud_master","method":"GET","path":"/hud/master","subsystem":"hud_unification"},{"description":"Audit HUD telemetry for static/stale stubs","handler":"handle_hud_audit","method":"GET","path":"/hud/audit","subsystem":"hud_unification"},{"description":"List registered autonomic playbooks","handler":"handle_get_playbooks","method":"GET","path":"/autonomic/playbooks","subsystem":"autonomic_playbooks"},{"description":"Register an autonomic playbook","handler":"handle_post_playbook","method":"POST","path":"/autonomic/playbooks","subsystem":"autonomic_playbooks"},{"description":"List autonomic trigger policies","handler":"handle_get_policies","method":"GET","path":"/autonomic/policies","subsystem":"autonomic_playbooks"},{"description":"Register an autonomic trigger policy","handler":"handle_post_policy","method":"POST","path":"/autonomic/policies","subsystem":"autonomic_playbooks"},{"description":"Trigger execution of an autonomic playbook","handler":"handle_run_playbook","method":"POST","path":"/autonomic/playbooks/:id/run","subsystem":"autonomic_playbooks"},{"description":"List historical and active playbook runs","handler":"handle_get_runs","method":"GET","path":"/autonomic/runs","subsystem":"autonomic_playbooks"},{"description":"Audit autonomic playbooks and execution metrics","handler":"handle_autonomic_audit","method":"GET","path":"/autonomic/audit","subsystem":"autonomic_playbooks"},{"description":"Query current 12-dimensional civilization state tensor","handler":"handle_civilization_state","method":"GET","path":"/civilization/state","subsystem":"civilization_kernel"},{"description":"Evaluate candidate civilization delta against SCK","handler":"handle_civilization_decision","method":"POST","path":"/civilization/decision","subsystem":"civilization_kernel"},{"description":"Commit approved civilization delta to systemic state","handler":"handle_civilization_execute","method":"POST","path":"/civilization/execute","subsystem":"civilization_kernel"},{"description":"Audit civilization kernel vitality and norm progression","handler":"handle_civilization_audit","method":"GET","path":"/civilization/audit","subsystem":"civilization_kernel"},{"description":"Serve interactive living wiki HTML dashboard","handler":"handle_docs_html","method":"GET","path":"/docs","subsystem":"live_docs"},{"description":"Serve specific documentation page as HTML","handler":"handle_docs_page","method":"GET","path":"/docs/page/:slug","subsystem":"live_docs"},{"description":"Export machine-readable JSON documentation AST","handler":"handle_docs_api","method":"GET","path":"/docs/api","subsystem":"live_docs"},{"description":"Audit bi-directional documentation vs code contract drift","handler":"handle_docs_audit","method":"GET","path":"/docs/audit","subsystem":"live_docs"},{"description":"Trigger immediate bi-directional live sync","handler":"handle_docs_sync","method":"POST","path":"/docs/sync","subsystem":"live_docs"}],"status":"ok","subsystems":[{"crate_path":"ops/sprl","description":"Sovereign Peer Reputation Layer tracking SLA adherence and peer integrity.","id":1,"layer":"Layer 1: Peer Reputation","name":"SPRL"},{"crate_path":"ops/suvl","description":"Sovereign Unit Valuation Layer computing compute pricing and gas forecasts.","id":2,"layer":"Layer 2: Unit Valuation","name":"SUVL"},{"crate_path":"ops/operator_console","description":"Real-time operator dashboard and metric visualization backend.","id":3,"layer":"Layer 3: Dashboard Synthesis","name":"Operator Console"},{"crate_path":"governance/economic_substrate","description":"Dual-entry cryptographic ledger and PQR Coin circulation engine.","id":4,"layer":"Layer 4: Atomic Ledger","name":"Economic Substrate"},{"crate_path":"ops/pqr_api","description":"REST API contracts for balance inspection, atomic transfers, and rewards.","id":5,"layer":"Layer 5: Settlement Services","name":"PQR API"},{"crate_path":"ops/cognitive_surface","description":"Cognitive intent classification, prompt routing, and persona management.","id":6,"layer":"Layer 6: Intent & Persona","name":"Cognitive Surface"},{"crate_path":"ops/cognitive_bridge","description":"Hybrid bridge across Gemini Flash, Claude Sonnet, and Copilot settle.","id":7,"layer":"Layer 7: Multi-LLM Routing","name":"Cognitive Bridge"},{"crate_path":"ops/samc","description":"Sovereign Autonomic Mission Controller coordinating high-order directives.","id":8,"layer":"Layer 8: Mission Control","name":"SAMC"},{"crate_path":"ops/sael","description":"Sovereign Audit & Event Ledger maintaining immutable Merkle history.","id":9,"layer":"Layer 9: Audit Ledger","name":"SAEL"},{"crate_path":"ops/hud_unification","description":"Master HUD snapshot generator and non-regression parity auditor.","id":10,"layer":"Layer 10: Master Cockpit","name":"HUD Unification"},{"crate_path":"ops/autonomic_playbooks","description":"Self-healing incident response and policy automation engine.","id":11,"layer":"Layer 11: Incident Remediation","name":"Autonomic Playbooks"},{"crate_path":"ops/civilization_kernel","description":"Civilization Tensor (C12) evaluation, macro deltas, and systemic vitality steering.","id":12,"layer":"Layer 12: Macro Steering","name":"Civilization Kernel"}]}