# Oshun Sovereign Stack Proposal

## Executive Summary

This document outlines a comprehensive plan to build a fully sovereign
technology stack for Oshun, replacing external dependencies with custom-built
alternatives where feasible. The goal is to own the entire stack from operating
systems and browsers to game engines, creative tools, and AI infrastructure.

**Scope**: Replace ~47 major external dependencies across 12 technology layers
**Timeline**: 7-10 years for complete stack sovereignty **Team Size**: 50-150
engineers at peak (phased hiring) **Investment**: $50-150M over the full program

---

## Table of Contents

1. [Current External Dependencies Audit](#1-current-external-dependencies-audit)
2. [Architecture Overview](#2-architecture-overview)
3. [Technology Choices & Rationale](#3-technology-choices--rationale)
4. [Phased Implementation Plan](#4-phased-implementation-plan)
5. [Team & Resource Estimates](#5-team--resource-estimates)
6. [Risk Analysis](#6-risk-analysis)
7. [Build vs Fork vs Wrap Decisions](#7-build-vs-fork-vs-wrap-decisions)

---

## 1. Current External Dependencies Audit

### 1.1 Complete Dependency Inventory

#### Game Engines & 3D Authoring (CRITICAL)

| Dependency          | Usage in Oshun                                    | Replacement Priority |
| ------------------- | ------------------------------------------------- | -------------------- |
| **Unreal Engine 5** | Maya domain, Project Obsidian, virtual production | P0 - Critical        |
| **Unity**           | XR apps, mobile games, asset pipeline             | P0 - Critical        |
| **Godot**           | Indie games, rapid prototyping                    | P1 - High            |
| **Blender**         | 3D modeling, animation, rendering                 | P0 - Critical        |
| **Houdini**         | Procedural generation, VFX                        | P1 - High            |
| **Autodesk Maya**   | Animation, rigging (referenced)                   | P2 - Medium          |

#### Audio/Video Production (HIGH)

| Dependency          | Usage in Oshun               | Replacement Priority |
| ------------------- | ---------------------------- | -------------------- |
| **DaVinci Resolve** | Video editing, color grading | P1 - High            |
| **Ardour**          | DAW, audio production        | P1 - High            |
| **Wwise**           | Game audio middleware        | P1 - High            |
| **FMOD**            | Game audio middleware        | P1 - High            |
| **FFmpeg**          | Media transcoding            | P2 - Wrap            |

#### AI/ML Infrastructure (HIGH)

| Dependency             | Usage in Oshun             | Replacement Priority         |
| ---------------------- | -------------------------- | ---------------------------- |
| **PyTorch**            | ML training & inference    | P2 - Wrap                    |
| **TensorFlow/TF Lite** | Mobile inference           | P2 - Wrap                    |
| **ComfyUI**            | Image generation workflows | P1 - High                    |
| **OpenAI API**         | LLM, embeddings            | P2 - Wrap (multi-provider)   |
| **Anthropic API**      | LLM, Claude                | P2 - Wrap (multi-provider)   |
| **ElevenLabs**         | Voice synthesis            | P1 - High (train own models) |
| **Runway/Sora/Kling**  | Video generation           | P2 - Wrap                    |
| **HuggingFace**        | Model hub                  | P2 - Self-host registry      |

#### Graphics APIs (WRAP)

| Dependency     | Usage in Oshun          | Replacement Priority |
| -------------- | ----------------------- | -------------------- |
| **Vulkan**     | Cross-platform graphics | P3 - Use via wgpu    |
| **Metal**      | Apple graphics          | P3 - Use via wgpu    |
| **DirectX 12** | Windows graphics        | P3 - Use via wgpu    |
| **WebGPU**     | Web graphics            | P3 - Native target   |

#### Physics Engines (BUILD/WRAP)

| Dependency | Usage in Oshun      | Replacement Priority            |
| ---------- | ------------------- | ------------------------------- |
| **PhysX**  | NVIDIA physics      | P1 - Replace with Rapier/custom |
| **Havok**  | AAA physics         | P1 - Replace with Rapier/custom |
| **Jolt**   | Open-source physics | P2 - Fork/extend                |

#### Cloud Infrastructure (OPTIMIZE)

| Dependency             | Usage in Oshun          | Replacement Priority      |
| ---------------------- | ----------------------- | ------------------------- |
| **AWS ECS**            | Container orchestration | P3 - Keep (cost optimize) |
| **AWS S3**             | Object storage          | P2 - Add MinIO fallback   |
| **AWS RDS/PostgreSQL** | Database                | P3 - Keep                 |
| **Redis**              | Caching, queues         | P3 - Keep                 |
| **Kafka**              | Event streaming         | P3 - Keep                 |

#### Frontend Frameworks (EVALUATE)

| Dependency        | Usage in Oshun | Replacement Priority           |
| ----------------- | -------------- | ------------------------------ |
| **React/Next.js** | Web apps       | P3 - Keep or migrate to custom |
| **React Native**  | Mobile apps    | P2 - Consider Flutter/custom   |
| **Electron**      | Desktop apps   | P1 - Replace with Tauri        |
| **Tauri**         | Desktop apps   | P3 - Keep (Rust-based)         |

#### Operating Systems & Platforms (AMBITIOUS)

| Dependency         | Usage in Oshun   | Replacement Priority                  |
| ------------------ | ---------------- | ------------------------------------- |
| **Linux**          | Server & desktop | P1 - Custom distro                    |
| **Android**        | Mobile           | P1 - AOSP fork                        |
| **iOS**            | Mobile           | P4 - Cannot replace (hardware locked) |
| **Windows**        | Desktop          | P4 - Cannot replace (focus on Linux)  |
| **macOS**          | Desktop          | P4 - Cannot replace (hardware locked) |
| **Meta Quest OS**  | VR               | P2 - Custom OpenXR runtime            |
| **Chrome/Firefox** | Browser          | P1 - Servo fork                       |

#### Payments & Blockchain (WRAP)

| Dependency   | Usage in Oshun        | Replacement Priority |
| ------------ | --------------------- | -------------------- |
| **Stripe**   | Payment processing    | P3 - Keep            |
| **Ethereum** | Blockchain            | P3 - Keep            |
| **Solana**   | Blockchain            | P3 - Keep            |
| **IPFS**     | Decentralized storage | P3 - Keep            |
| **MetaMask** | Wallet                | P3 - Keep            |

#### Document & Office (BUILD)

| Dependency         | Usage in Oshun      | Replacement Priority     |
| ------------------ | ------------------- | ------------------------ |
| **PDF processing** | Document ingestion  | P2 - Build custom parser |
| **Office formats** | Document conversion | P2 - Build/wrap          |

#### External APIs (WRAP WITH ABSTRACTION)

| Dependency       | Usage in Oshun | Replacement Priority |
| ---------------- | -------------- | -------------------- |
| **Google Fit**   | Health data    | P3 - Wrap            |
| **Apple Health** | Health data    | P3 - Wrap            |
| **Twilio**       | SMS/Voice      | P3 - Wrap            |
| **SendGrid**     | Email          | P3 - Wrap            |

### 1.2 Unserved Areas Identified

After thorough analysis, the following areas lack coverage and need custom
solutions:

| Gap Area                 | Description                    | Priority |
| ------------------------ | ------------------------------ | -------- |
| **Font Rendering**       | Custom typography engine       | P2       |
| **PDF Generation**       | Native PDF creation            | P2       |
| **Print Pipeline**       | Professional print output      | P3       |
| **Geolocation Services** | Offline-capable maps           | P2       |
| **Sensor Fusion**        | IMU, camera, depth integration | P1       |
| **Hardware Abstraction** | Unified device interface       | P1       |
| **Network Protocol**     | Custom UDP for realtime        | P1       |
| **Compression**          | Custom codecs for assets       | P2       |
| **Encryption**           | Sovereign crypto library       | P1       |
| **Identity**             | Decentralized identity         | P1       |

---

## 2. Architecture Overview

### 2.1 Full Stack Architecture Diagram

```
┌─────────────────────────────────────────────────────────────────────────────┐
│                           OSHUN SOVEREIGN STACK                              │
├─────────────────────────────────────────────────────────────────────────────┤
│                                                                              │
│  ┌─────────────────────────────────────────────────────────────────────┐   │
│  │                    LAYER 7: APPLICATIONS                             │   │
│  │  ┌──────────┐ ┌──────────┐ ┌──────────┐ ┌──────────┐ ┌──────────┐  │   │
│  │  │  Lilith  │ │  Yemaya  │ │   Maya   │ │   Nyx    │ │  Metis   │  │   │
│  │  │Conscious-│ │ Creative │ │  Game/   │ │ Cosmic   │ │Education │  │   │
│  │  │   ness   │ │  Studio  │ │Metaverse │ │   Obs    │ │ Platform │  │   │
│  │  └──────────┘ └──────────┘ └──────────┘ └──────────┘ └──────────┘  │   │
│  │  ┌──────────┐ ┌──────────┐ ┌──────────┐ ┌──────────┐ ┌──────────┐  │   │
│  │  │  Shakti  │ │  Hestia  │ │ Demeter  │ │  Arete   │ │   Oya    │  │   │
│  │  │ Fitness  │ │ Culinary │ │ Garden   │ │ Personal │ │  Drone   │  │   │
│  │  │   App    │ │   App    │ │   App    │ │   Dev    │ │ Swarms   │  │   │
│  │  └──────────┘ └──────────┘ └──────────┘ └──────────┘ └──────────┘  │   │
│  │  + Aglaea, Airmid, Seshat, Tara, Psyche, Veritas, Kuan Yin, etc.   │   │
│  └─────────────────────────────────────────────────────────────────────┘   │
│                                    │                                        │
│  ┌─────────────────────────────────▼───────────────────────────────────┐   │
│  │                    LAYER 6: DOMAIN SERVICES                          │   │
│  │  ┌──────────┐ ┌──────────┐ ┌──────────┐ ┌──────────┐ ┌──────────┐  │   │
│  │  │   Isis   │ │  Sophia  │ │  Hathor  │ │ Bellona  │ │Aphrodite │  │   │
│  │  │Generative│ │ Research │ │  World-  │ │ Engine & │ │   Live   │  │   │
│  │  │ Factory  │ │Knowledge │ │ building │ │  Build   │ │ Streaming│  │   │
│  │  └──────────┘ └──────────┘ └──────────┘ └──────────┘ └──────────┘  │   │
│  └─────────────────────────────────────────────────────────────────────┘   │
│                                    │                                        │
│  ┌─────────────────────────────────▼───────────────────────────────────┐   │
│  │                    LAYER 5: CREATIVE TOOLS                           │   │
│  │  ┌─────────────────────────────────────────────────────────────┐    │   │
│  │  │                    NEITH STUDIO SUITE                          │    │   │
│  │  │  ┌─────────┐ ┌─────────┐ ┌─────────┐ ┌─────────┐            │    │   │
│  │  │  │Sculptor │ │Animator │ │Composer │ │ Cutter  │            │    │   │
│  │  │  │   3D    │ │ Motion  │ │  Audio  │ │  Video  │            │    │   │
│  │  │  │Modeling │ │ & Rig   │ │   DAW   │ │ Editor  │            │    │   │
│  │  │  └─────────┘ └─────────┘ └─────────┘ └─────────┘            │    │   │
│  │  │  ┌─────────┐ ┌─────────┐ ┌─────────┐ ┌─────────┐            │    │   │
│  │  │  │ Weaver  │ │ Painter │ │ Scribe  │ │ Forge   │            │    │   │
│  │  │  │Procedur-│ │ Texture │ │  Code   │ │ Build & │            │    │   │
│  │  │  │   al    │ │& Material│ │ Editor  │ │ Package │            │    │   │
│  │  │  └─────────┘ └─────────┘ └─────────┘ └─────────┘            │    │   │
│  │  └─────────────────────────────────────────────────────────────┘    │   │
│  └─────────────────────────────────────────────────────────────────────┘   │
│                                    │                                        │
│  ┌─────────────────────────────────▼───────────────────────────────────┐   │
│  │                    LAYER 4: ENGINE CORE                              │   │
│  │  ┌─────────────────────────────────────────────────────────────┐    │   │
│  │  │                    NEITH ENGINE (Rust)                         │    │   │
│  │  │  ┌────────────┐ ┌────────────┐ ┌────────────┐               │    │   │
│  │  │  │   Render   │ │  Physics   │ │   Audio    │               │    │   │
│  │  │  │   (wgpu)   │ │  (Rapier)  │ │   (cpal)   │               │    │   │
│  │  │  │ Vulkan/MTL │ │ Rigid/Soft │ │ HRTF/Room  │               │    │   │
│  │  │  │ DX12/WebGPU│ │ Fluid/Destr│ │ Acoustics  │               │    │   │
│  │  │  └────────────┘ └────────────┘ └────────────┘               │    │   │
│  │  │  ┌────────────┐ ┌────────────┐ ┌────────────┐               │    │   │
│  │  │  │    ECS     │ │  Network   │ │    XR      │               │    │   │
│  │  │  │  (custom)  │ │  (custom   │ │  (OpenXR)  │               │    │   │
│  │  │  │ Job System │ │   UDP)     │ │ VR/AR/MR   │               │    │   │
│  │  │  └────────────┘ └────────────┘ └────────────┘               │    │   │
│  │  │  ┌────────────┐ ┌────────────┐ ┌────────────┐               │    │   │
│  │  │  │  Scripting │ │   Asset    │ │    AI      │               │    │   │
│  │  │  │  (WASM +   │ │  Pipeline  │ │  Runtime   │               │    │   │
│  │  │  │   Lua)     │ │ glTF/USD   │ │ ONNX/custom│               │    │   │
│  │  │  └────────────┘ └────────────┘ └────────────┘               │    │   │
│  │  └─────────────────────────────────────────────────────────────┘    │   │
│  └─────────────────────────────────────────────────────────────────────┘   │
│                                    │                                        │
│  ┌─────────────────────────────────▼───────────────────────────────────┐   │
│  │                    LAYER 3: AI INFRASTRUCTURE                        │   │
│  │  ┌──────────────────────────────────────────────────────────────┐   │   │
│  │  │                    NOUS (AI Platform)                         │   │   │
│  │  │  ┌───────────┐ ┌───────────┐ ┌───────────┐ ┌───────────┐    │   │   │
│  │  │  │  Model    │ │ Inference │ │  Training │ │   Voice   │    │   │   │
│  │  │  │ Registry  │ │  Engine   │ │  Pipeline │ │  Synth    │    │   │   │
│  │  │  │ (custom)  │ │(ONNX/cust)│ │ (MLX/cust)│ │ (custom)  │    │   │   │
│  │  │  └───────────┘ └───────────┘ └───────────┘ └───────────┘    │   │   │
│  │  │  ┌───────────┐ ┌───────────┐ ┌───────────┐ ┌───────────┐    │   │   │
│  │  │  │  Vision   │ │   LLM     │ │  Image    │ │   Video   │    │   │   │
│  │  │  │  Models   │ │ Orchestr. │ │   Gen     │ │    Gen    │    │   │   │
│  │  │  │ (custom)  │ │ (multi)   │ │ (SD/flux) │ │ (custom)  │    │   │   │
│  │  │  └───────────┘ └───────────┘ └───────────┘ └───────────┘    │   │   │
│  │  └──────────────────────────────────────────────────────────────┘   │   │
│  └─────────────────────────────────────────────────────────────────────┘   │
│                                    │                                        │
│  ┌─────────────────────────────────▼───────────────────────────────────┐   │
│  │                    LAYER 2: PLATFORM RUNTIME                         │   │
│  │  ┌───────────────────────────────────────────────────────────────┐  │   │
│  │  │                    NEITH RUNTIME (Rust)                          │  │   │
│  │  │  ┌─────────┐ ┌─────────┐ ┌─────────┐ ┌─────────┐ ┌─────────┐ │  │   │
│  │  │  │  Core   │ │   UI    │ │   Net   │ │ Storage │ │ Crypto  │ │  │   │
│  │  │  │ Runtime │ │Toolkit  │ │ Stack   │ │  Layer  │ │ & Auth  │ │  │   │
│  │  │  │(async,io)│ │ (GPU)   │ │(QUIC)   │ │ (async) │ │         │ │  │   │
│  │  │  └─────────┘ └─────────┘ └─────────┘ └─────────┘ └─────────┘ │  │   │
│  │  └───────────────────────────────────────────────────────────────┘  │   │
│  │  ┌───────────────────────────────────────────────────────────────┐  │   │
│  │  │                    NEITH BROWSER (Servo Fork)                    │  │   │
│  │  │  ┌─────────┐ ┌─────────┐ ┌─────────┐ ┌─────────┐ ┌─────────┐ │  │   │
│  │  │  │  WebGPU │ │  WASM   │ │   DOM   │ │   JS    │ │ WebXR   │ │  │   │
│  │  │  │ Renderer│ │ Runtime │ │  Engine │ │ Engine  │ │ Support │ │  │   │
│  │  │  └─────────┘ └─────────┘ └─────────┘ └─────────┘ └─────────┘ │  │   │
│  │  └───────────────────────────────────────────────────────────────┘  │   │
│  └─────────────────────────────────────────────────────────────────────┘   │
│                                    │                                        │
│  ┌─────────────────────────────────▼───────────────────────────────────┐   │
│  │                    LAYER 1: OPERATING SYSTEMS                        │   │
│  │  ┌─────────────┐ ┌─────────────┐ ┌─────────────┐ ┌─────────────┐   │   │
│  │  │  NEITH LINUX  │ │ NEITH ANDROID │ │  NEITH VR OS  │ │  NEITH EMBED  │   │   │
│  │  │  (NixOS     │ │ (AOSP fork  │ │ (OpenXR +   │ │ (Zephyr/    │   │   │
│  │  │   based)    │ │  + custom)  │ │  custom)    │ │  custom)    │   │   │
│  │  │  Desktop &  │ │  Phone &    │ │  Quest-like │ │  Drone/IoT  │   │   │
│  │  │  Server     │ │  Tablet     │ │  Headsets   │ │  Devices    │   │   │
│  │  └─────────────┘ └─────────────┘ └─────────────┘ └─────────────┘   │   │
│  └─────────────────────────────────────────────────────────────────────┘   │
│                                    │                                        │
│  ┌─────────────────────────────────▼───────────────────────────────────┐   │
│  │                    LAYER 0: HARDWARE ABSTRACTION                     │   │
│  │  ┌───────────────────────────────────────────────────────────────┐  │   │
│  │  │                    NEITH HAL (Hardware Abstraction)              │  │   │
│  │  │  ┌─────────┐ ┌─────────┐ ┌─────────┐ ┌─────────┐ ┌─────────┐ │  │   │
│  │  │  │   GPU   │ │  Audio  │ │  Input  │ │ Sensors │ │ Network │ │  │   │
│  │  │  │ Abstrac │ │ Abstrac │ │ Abstrac │ │ Abstrac │ │ Abstrac │ │  │   │
│  │  │  └─────────┘ └─────────┘ └─────────┘ └─────────┘ └─────────┘ │  │   │
│  │  └───────────────────────────────────────────────────────────────┘  │   │
│  └─────────────────────────────────────────────────────────────────────┘   │
│                                                                              │
└─────────────────────────────────────────────────────────────────────────────┘
```

### 2.2 Component Interaction Diagram

```
┌─────────────────────────────────────────────────────────────────────────────┐
│                         DATA & CONTROL FLOW                                  │
├─────────────────────────────────────────────────────────────────────────────┤
│                                                                              │
│   ┌─────────────┐                                    ┌─────────────┐        │
│   │   USER      │                                    │   CLOUD     │        │
│   │  DEVICES    │                                    │  SERVICES   │        │
│   └──────┬──────┘                                    └──────┬──────┘        │
│          │                                                  │               │
│          ▼                                                  ▼               │
│   ┌──────────────────────────────────────────────────────────────────┐     │
│   │                     NEITH RUNTIME LAYER                             │     │
│   │  ┌────────────────┐  ┌────────────────┐  ┌────────────────┐     │     │
│   │  │    Desktop     │  │     Mobile     │  │      VR        │     │     │
│   │  │   (Neith Linux)  │  │  (Neith Android) │  │   (Neith VROS)   │     │     │
│   │  └───────┬────────┘  └───────┬────────┘  └───────┬────────┘     │     │
│   │          │                   │                   │              │     │
│   │          └───────────────────┼───────────────────┘              │     │
│   │                              ▼                                  │     │
│   │  ┌──────────────────────────────────────────────────────────┐  │     │
│   │  │              UNIFIED APPLICATION RUNTIME                  │  │     │
│   │  │  • WASM for portable code    • GPU compute (wgpu)        │  │     │
│   │  │  • Native Rust for perf      • Unified asset format      │  │     │
│   │  │  • Scripting (Lua/WASM)      • Cross-platform UI         │  │     │
│   │  └──────────────────────────────────────────────────────────┘  │     │
│   └──────────────────────────────────────────────────────────────────┘     │
│                              │                                              │
│                              ▼                                              │
│   ┌──────────────────────────────────────────────────────────────────┐     │
│   │                      OSHUN DOMAIN LAYER                           │     │
│   │                                                                   │     │
│   │    ┌─────┐   ┌────────┐   ┌────────┐   ┌─────────┐   ┌───────┐ │     │
│   │    │Isis │◄──┤ Sophia │◄──┤ Hathor │◄──┤ Bellona │◄──┤Yemaya │ │     │
│   │    │ Gen │   │Research│   │  World │   │  Build  │   │Orchest│ │     │
│   │    └──┬──┘   └───┬────┘   └───┬────┘   └────┬────┘   └───┬───┘ │     │
│   │       │          │            │             │             │     │     │
│   │       └──────────┴────────────┴─────────────┴─────────────┘     │     │
│   │                              │                                   │     │
│   │                              ▼                                   │     │
│   │    ┌────────────────────────────────────────────────────────┐   │     │
│   │    │              EVENT BUS (@oshun/event-bus)              │   │     │
│   │    │  • Async message passing   • Event sourcing            │   │     │
│   │    │  • Cross-domain events     • Audit logging             │   │     │
│   │    └────────────────────────────────────────────────────────┘   │     │
│   └──────────────────────────────────────────────────────────────────┘     │
│                              │                                              │
│                              ▼                                              │
│   ┌──────────────────────────────────────────────────────────────────┐     │
│   │                      STORAGE & STATE LAYER                        │     │
│   │  ┌────────────┐  ┌────────────┐  ┌────────────┐  ┌────────────┐ │     │
│   │  │ PostgreSQL │  │   Redis    │  │    S3/     │  │   Vector   │ │     │
│   │  │  (Relat.)  │  │  (Cache)   │  │   MinIO    │  │    DB      │ │     │
│   │  └────────────┘  └────────────┘  └────────────┘  └────────────┘ │     │
│   └──────────────────────────────────────────────────────────────────┘     │
│                                                                              │
└─────────────────────────────────────────────────────────────────────────────┘
```

### 2.3 Creative Tools Architecture

```
┌─────────────────────────────────────────────────────────────────────────────┐
│                         NEITH STUDIO SUITE ARCHITECTURE                        │
├─────────────────────────────────────────────────────────────────────────────┤
│                                                                              │
│  ┌───────────────────────────────────────────────────────────────────────┐ │
│  │                         UNIFIED WORKSPACE                              │ │
│  │  ┌─────────────────────────────────────────────────────────────────┐ │ │
│  │  │                      PROJECT MANAGER                             │ │ │
│  │  │  • Cross-tool asset references   • Version control (Git-like)   │ │ │
│  │  │  • Collaboration (CRDT sync)     • Asset dependency tracking    │ │ │
│  │  └─────────────────────────────────────────────────────────────────┘ │ │
│  └───────────────────────────────────────────────────────────────────────┘ │
│                                       │                                     │
│       ┌───────────────┬───────────────┼───────────────┬───────────────┐    │
│       ▼               ▼               ▼               ▼               ▼    │
│  ┌─────────┐    ┌─────────┐    ┌─────────┐    ┌─────────┐    ┌─────────┐  │
│  │SCULPTOR │    │ANIMATOR │    │COMPOSER │    │ CUTTER  │    │ WEAVER  │  │
│  │  (3D)   │    │(Motion) │    │ (Audio) │    │ (Video) │    │(Proced) │  │
│  ├─────────┤    ├─────────┤    ├─────────┤    ├─────────┤    ├─────────┤  │
│  │•Modeling│    │•Timeline│    │•Multitrk│    │•Timeline│    │•Node    │  │
│  │•Sculpt  │    │•IK/FK   │    │•MIDI    │    │•Effects │    │ Graph   │  │
│  │•UV      │    │•Blend   │    │•VST(?)  │    │•Color   │    │•Params  │  │
│  │•Material│    │•MoCap   │    │•Spatial │    │•Transc. │    │•Preview │  │
│  │•Render  │    │•Physics │    │•Mix/Mstr│    │•AI Edit │    │•Bake    │  │
│  └────┬────┘    └────┬────┘    └────┬────┘    └────┬────┘    └────┬────┘  │
│       │              │              │              │              │        │
│       └──────────────┴──────────────┼──────────────┴──────────────┘        │
│                                     ▼                                       │
│  ┌───────────────────────────────────────────────────────────────────────┐ │
│  │                      SHARED SUBSYSTEMS                                 │ │
│  │  ┌─────────────┐ ┌─────────────┐ ┌─────────────┐ ┌─────────────┐     │ │
│  │  │   RENDER    │ │    ASSET    │ │     UI      │ │   PLUGIN    │     │ │
│  │  │   ENGINE    │ │   PIPELINE  │ │   TOOLKIT   │ │   SYSTEM    │     │ │
│  │  │  (Neith Eng)  │ │(glTF/USD/+) │ │ (GPU-accel) │ │  (WASM/Lua) │     │ │
│  │  └─────────────┘ └─────────────┘ └─────────────┘ └─────────────┘     │ │
│  └───────────────────────────────────────────────────────────────────────┘ │
│                                                                              │
│  ┌───────────────────────────────────────────────────────────────────────┐ │
│  │                      FILE FORMATS                                      │ │
│  │  ┌───────────┐ ┌───────────┐ ┌───────────┐ ┌───────────┐             │ │
│  │  │  .neithscn  │ │  .neithmat  │ │  .neithanim │ │  .neithproc │             │ │
│  │  │  (Scene)  │ │ (Material)│ │(Animation)│ │(Procedur) │             │ │
│  │  └───────────┘ └───────────┘ └───────────┘ └───────────┘             │ │
│  │  • All formats based on efficient binary + JSON metadata              │ │
│  │  • Import/Export: glTF, USD, FBX, OBJ, Alembic, etc.                 │ │
│  └───────────────────────────────────────────────────────────────────────┘ │
│                                                                              │
└─────────────────────────────────────────────────────────────────────────────┘
```

---

## 3. Technology Choices & Rationale

### 3.1 Core Language: Rust

| Aspect               | Choice                   | Rationale                                                                              |
| -------------------- | ------------------------ | -------------------------------------------------------------------------------------- |
| **Primary Language** | Rust                     | Memory safety, zero-cost abstractions, WASM compilation, excellent GPU/systems support |
| **Scripting**        | Lua + WASM               | Lua for fast iteration, WASM for portable plugins                                      |
| **Web Frontend**     | TypeScript               | Necessary for browser compatibility; minimize usage                                    |
| **Mobile Native**    | Rust + platform bindings | Kotlin/Swift only for platform-specific APIs                                           |
| **GPU Shaders**      | WGSL + SPIR-V            | WebGPU native, cross-compiles to all backends                                          |

### 3.2 Graphics & Rendering

| Component                | Choice                             | Rationale                                     |
| ------------------------ | ---------------------------------- | --------------------------------------------- |
| **Graphics Abstraction** | wgpu                               | Rust-native, WebGPU/Vulkan/Metal/DX12 support |
| **Shader Language**      | WGSL                               | WebGPU native, naga for cross-compilation     |
| **Rendering Approach**   | Hybrid deferred + forward          | Best balance for varied content               |
| **GI Solution**          | Custom screen-space + probe hybrid | Achievable without Lumen-scale R&D            |
| **Geometry**             | Mesh LOD + instancing              | Nanite-lite achievable incrementally          |

### 3.3 Physics & Simulation

| Component           | Choice                    | Rationale                                      |
| ------------------- | ------------------------- | ---------------------------------------------- |
| **Rigid Body**      | Rapier (Rust)             | High quality, actively maintained, Rust-native |
| **Soft Body/Cloth** | Custom + Rapier           | Start with Rapier, extend as needed            |
| **Fluid**           | Custom SPH (GPU)          | Specialized; build incrementally               |
| **Destruction**     | Voronoi fracture (custom) | Well-understood algorithms                     |

### 3.4 Audio

| Component          | Choice             | Rationale                                    |
| ------------------ | ------------------ | -------------------------------------------- |
| **Core Audio**     | cpal (Rust)        | Cross-platform, low-level control            |
| **Spatial Audio**  | Custom HRTF engine | Critical for VR; libraries exist to build on |
| **DSP**            | dasp + custom      | Rust ecosystem growing                       |
| **Room Acoustics** | Custom ray-traced  | Specialized; build to spec                   |
| **Format Support** | symphonia (Rust)   | Decode most formats natively                 |

### 3.5 Networking

| Component        | Choice                 | Rationale                                |
| ---------------- | ---------------------- | ---------------------------------------- |
| **Transport**    | QUIC (quinn crate)     | Modern, multiplexed, built-in encryption |
| **Game Netcode** | Custom ECS replication | Game-specific requirements               |
| **WebRTC**       | webrtc-rs              | Rust native for real-time communication  |
| **HTTP**         | axum/tower             | Excellent Rust web stack                 |

### 3.6 AI/ML Runtime

| Component             | Choice                     | Rationale                                 |
| --------------------- | -------------------------- | ----------------------------------------- |
| **Inference**         | ONNX Runtime + custom      | Wide model support, add custom ops        |
| **Training**          | Fork/wrap existing         | Training is commodity; focus on inference |
| **Voice Synthesis**   | Custom (train models)      | Long-term sovereignty goal                |
| **LLM Orchestration** | Multi-provider abstraction | Keep flexibility, reduce vendor lock-in   |

### 3.7 Operating Systems

| Component         | Choice                | Rationale                                  |
| ----------------- | --------------------- | ------------------------------------------ |
| **Desktop Linux** | NixOS-based           | Reproducible, declarative, Rust-friendly   |
| **Mobile**        | AOSP fork             | Only viable option for Android sovereignty |
| **VR**            | Custom OpenXR runtime | Open standard; build runtime layer         |
| **Embedded/IoT**  | Zephyr RTOS           | Open source, well-supported                |

### 3.8 Browser

| Component     | Choice                   | Rationale                                 |
| ------------- | ------------------------ | ----------------------------------------- |
| **Engine**    | Servo fork               | Rust-native, WebGPU support, parallelized |
| **JS Engine** | SpiderMonkey (via Servo) | Well-integrated with Servo                |
| **WebGPU**    | Native wgpu              | Already used by Servo                     |

---

## 4. Phased Implementation Plan

### 4.1 Phase Overview

```
┌─────────────────────────────────────────────────────────────────────────────┐
│                         IMPLEMENTATION TIMELINE                              │
├─────────────────────────────────────────────────────────────────────────────┤
│                                                                              │
│  YEAR 1          YEAR 2          YEAR 3          YEAR 4          YEAR 5+   │
│  ──────          ──────          ──────          ──────          ───────   │
│                                                                              │
│  ┌──────────┐   ┌──────────┐   ┌──────────┐   ┌──────────┐   ┌──────────┐ │
│  │ PHASE 1  │   │ PHASE 2  │   │ PHASE 3  │   │ PHASE 4  │   │ PHASE 5  │ │
│  │Foundation│──▶│  Engine  │──▶│  Tools   │──▶│ Platform │──▶│ Optimize │ │
│  │ & Core   │   │  Build   │   │  Build   │   │  Build   │   │ & Scale  │ │
│  └──────────┘   └──────────┘   └──────────┘   └──────────┘   └──────────┘ │
│                                                                              │
│  Deliverables:  Deliverables:  Deliverables:  Deliverables:  Deliverables: │
│  • Runtime      • Renderer     • Sculptor     • Neith Linux    • Performance │
│  • HAL          • Physics      • Animator     • Neith Android  • Features    │
│  • Asset fmt    • Audio        • Composer     • Neith Browser  • Polish      │
│  • Basic UI     • ECS          • Cutter       • Neith VR OS    • Ecosystem   │
│  • Network      • Scripting    • Weaver       •              •             │
│                                                                              │
│  Team: 15-20    Team: 30-40    Team: 50-70    Team: 70-100   Team: 50-80  │
│  Cost: $5-8M    Cost: $15-20M  Cost: $25-35M  Cost: $35-45M  Cost: $20-30M│
│                                                                              │
└─────────────────────────────────────────────────────────────────────────────┘
```

### 4.2 Phase 1: Foundation & Core Runtime (Year 1)

**Goal**: Build the foundational layer that all other components depend on.

#### 4.2.1 Neith Runtime Core (Q1-Q2)

| Task                                   | Duration | Team  | Priority |
| -------------------------------------- | -------- | ----- | -------- |
| Async runtime (tokio-based)            | 4 weeks  | 2 eng | P0       |
| Memory allocators (arena, pool, stack) | 6 weeks  | 2 eng | P0       |
| Job system (work-stealing)             | 6 weeks  | 2 eng | P0       |
| Serialization (binary + JSON)          | 4 weeks  | 1 eng | P0       |
| Reflection system                      | 6 weeks  | 2 eng | P1       |
| Event bus (typed, async)               | 4 weeks  | 1 eng | P0       |

#### 4.2.2 Hardware Abstraction Layer (Q1-Q2)

| Task                                                | Duration | Team  | Priority |
| --------------------------------------------------- | -------- | ----- | -------- |
| GPU abstraction (wgpu wrapper)                      | 6 weeks  | 2 eng | P0       |
| Audio device abstraction (cpal wrapper)             | 4 weeks  | 1 eng | P0       |
| Input abstraction (keyboard, mouse, gamepad, touch) | 6 weeks  | 2 eng | P0       |
| Sensor abstraction (IMU, GPS, camera)               | 6 weeks  | 2 eng | P1       |
| Network abstraction (sockets, QUIC)                 | 4 weeks  | 1 eng | P0       |
| File system abstraction                             | 3 weeks  | 1 eng | P0       |

#### 4.2.3 Asset Pipeline Foundation (Q2-Q3)

| Task                                        | Duration | Team  | Priority |
| ------------------------------------------- | -------- | ----- | -------- |
| Asset manifest format (.neithasset)         | 4 weeks  | 1 eng | P0       |
| glTF importer                               | 6 weeks  | 2 eng | P0       |
| USD importer (basic)                        | 8 weeks  | 2 eng | P1       |
| FBX importer                                | 8 weeks  | 2 eng | P1       |
| Image format support (PNG, JPEG, EXR, KTX2) | 4 weeks  | 1 eng | P0       |
| Asset compression (LZ4, Zstd)               | 3 weeks  | 1 eng | P0       |
| Asset streaming system                      | 6 weeks  | 2 eng | P0       |

#### 4.2.4 UI Toolkit Foundation (Q3-Q4)

| Task                                       | Duration | Team  | Priority |
| ------------------------------------------ | -------- | ----- | -------- |
| GPU-accelerated 2D renderer                | 8 weeks  | 2 eng | P0       |
| Layout engine (flexbox-like)               | 6 weeks  | 2 eng | P0       |
| Text rendering (font rasterization)        | 8 weeks  | 2 eng | P0       |
| Basic widgets (button, slider, text input) | 6 weeks  | 2 eng | P0       |
| Theming system                             | 4 weeks  | 1 eng | P1       |
| Accessibility foundation                   | 6 weeks  | 1 eng | P1       |

#### 4.2.5 Networking Foundation (Q3-Q4)

| Task                           | Duration | Team  | Priority |
| ------------------------------ | -------- | ----- | -------- |
| QUIC implementation (quinn)    | 4 weeks  | 1 eng | P0       |
| WebRTC integration (webrtc-rs) | 6 weeks  | 2 eng | P1       |
| Custom game protocol design    | 4 weeks  | 1 eng | P0       |
| Reliable UDP implementation    | 6 weeks  | 2 eng | P0       |
| State replication framework    | 8 weeks  | 2 eng | P0       |

**Phase 1 Milestones**:

- [ ] Runtime boots on Linux, Windows, macOS, Web
- [ ] Can load and display a 3D model
- [ ] Basic UI toolkit renders
- [ ] Network: can connect two clients

### 4.3 Phase 2: Engine Build (Year 2)

**Goal**: Build a complete game/application engine comparable to Godot.

#### 4.3.1 Render Engine (Q1-Q2)

| Task                      | Duration | Team  | Priority |
| ------------------------- | -------- | ----- | -------- |
| Render graph system       | 8 weeks  | 3 eng | P0       |
| PBR material system       | 8 weeks  | 3 eng | P0       |
| Shadow mapping (VSM, CSM) | 6 weeks  | 2 eng | P0       |
| Screen-space GI           | 8 weeks  | 3 eng | P1       |
| Probe-based GI            | 8 weeks  | 3 eng | P1       |
| Post-processing stack     | 6 weeks  | 2 eng | P0       |
| Particle system (GPU)     | 6 weeks  | 2 eng | P1       |
| Mesh LOD system           | 6 weeks  | 2 eng | P0       |
| Instanced rendering       | 4 weeks  | 1 eng | P0       |
| Virtual texturing         | 8 weeks  | 3 eng | P2       |

#### 4.3.2 Physics Engine (Q1-Q2)

| Task                         | Duration | Team  | Priority |
| ---------------------------- | -------- | ----- | -------- |
| Rapier integration           | 4 weeks  | 1 eng | P0       |
| Collision layers & filtering | 3 weeks  | 1 eng | P0       |
| Character controller         | 6 weeks  | 2 eng | P0       |
| Vehicle physics              | 8 weeks  | 2 eng | P1       |
| Ragdoll system               | 6 weeks  | 2 eng | P1       |
| Cloth simulation (basic)     | 8 weeks  | 2 eng | P2       |
| Fluid simulation (basic SPH) | 12 weeks | 3 eng | P2       |
| Destruction system           | 10 weeks | 3 eng | P2       |

#### 4.3.3 Audio Engine (Q2-Q3)

| Task                    | Duration | Team  | Priority |
| ----------------------- | -------- | ----- | -------- |
| Audio mixer & routing   | 6 weeks  | 2 eng | P0       |
| 3D spatial audio (HRTF) | 8 weeks  | 2 eng | P0       |
| Room acoustics (reverb) | 8 weeks  | 2 eng | P1       |
| Occlusion & portals     | 6 weeks  | 2 eng | P1       |
| Procedural audio        | 8 weeks  | 2 eng | P2       |
| Music system (adaptive) | 6 weeks  | 2 eng | P1       |
| Voice chat integration  | 6 weeks  | 2 eng | P0       |

#### 4.3.4 ECS & Scripting (Q2-Q3)

| Task                       | Duration | Team  | Priority |
| -------------------------- | -------- | ----- | -------- |
| ECS core (archetypes)      | 8 weeks  | 3 eng | P0       |
| Query system               | 6 weeks  | 2 eng | P0       |
| System scheduling          | 6 weeks  | 2 eng | P0       |
| Lua scripting integration  | 6 weeks  | 2 eng | P0       |
| WASM scripting integration | 8 weeks  | 2 eng | P1       |
| Hot reload for scripts     | 6 weeks  | 2 eng | P1       |
| Visual scripting (basic)   | 12 weeks | 3 eng | P2       |

#### 4.3.5 AI Runtime (Q3-Q4)

| Task                               | Duration | Team  | Priority |
| ---------------------------------- | -------- | ----- | -------- |
| ONNX runtime integration           | 4 weeks  | 1 eng | P0       |
| Navigation mesh generation         | 8 weeks  | 2 eng | P0       |
| Pathfinding (A\*, flow field)      | 6 weeks  | 2 eng | P0       |
| Behavior tree runtime              | 6 weeks  | 2 eng | P0       |
| State machine runtime              | 4 weeks  | 1 eng | P0       |
| Perception system (sight, hearing) | 6 weeks  | 2 eng | P1       |
| Crowd simulation                   | 8 weeks  | 2 eng | P2       |

#### 4.3.6 Animation System (Q3-Q4)

| Task                        | Duration | Team  | Priority |
| --------------------------- | -------- | ----- | -------- |
| Skeletal animation playback | 6 weeks  | 2 eng | P0       |
| Animation blending          | 6 weeks  | 2 eng | P0       |
| State machine               | 6 weeks  | 2 eng | P0       |
| IK solvers (FABRIK, CCD)    | 8 weeks  | 2 eng | P0       |
| Blend spaces                | 6 weeks  | 2 eng | P1       |
| Root motion                 | 4 weeks  | 1 eng | P0       |
| Animation retargeting       | 8 weeks  | 2 eng | P1       |
| Procedural animation        | 10 weeks | 3 eng | P2       |

**Phase 2 Milestones**:

- [ ] Can render a lit scene with shadows and basic GI
- [ ] Physics works for rigid bodies and characters
- [ ] Audio plays spatially in 3D
- [ ] Lua scripts can control game logic
- [ ] AI agents navigate and behave
- [ ] Characters animate with blending

### 4.4 Phase 3: Creative Tools Build (Year 3)

**Goal**: Build professional-grade creative tools.

#### 4.4.1 Neith Sculptor (3D Modeling) (Q1-Q2)

| Task                                  | Duration | Team  | Priority |
| ------------------------------------- | -------- | ----- | -------- |
| Mesh editing (vertices, edges, faces) | 12 weeks | 3 eng | P0       |
| Subdivision surfaces                  | 8 weeks  | 2 eng | P0       |
| Boolean operations                    | 8 weeks  | 2 eng | P1       |
| Sculpting (brushes, dynamic topology) | 16 weeks | 4 eng | P1       |
| UV mapping tools                      | 10 weeks | 2 eng | P0       |
| Material editor                       | 8 weeks  | 2 eng | P0       |
| Retopology tools                      | 10 weeks | 2 eng | P2       |
| Asset browser                         | 6 weeks  | 2 eng | P0       |

#### 4.4.2 Neith Animator (Animation) (Q1-Q3)

| Task                       | Duration | Team  | Priority |
| -------------------------- | -------- | ----- | -------- |
| Timeline editor            | 10 weeks | 3 eng | P0       |
| Curve editor               | 8 weeks  | 2 eng | P0       |
| Rigging tools              | 12 weeks | 3 eng | P0       |
| IK/FK controls             | 8 weeks  | 2 eng | P0       |
| MoCap import/cleanup       | 10 weeks | 3 eng | P1       |
| NLA (non-linear animation) | 8 weeks  | 2 eng | P1       |
| Pose library               | 6 weeks  | 2 eng | P1       |
| Animation layers           | 6 weeks  | 2 eng | P1       |

#### 4.4.3 Neith Composer (Audio DAW) (Q2-Q3)

| Task                                | Duration | Team  | Priority |
| ----------------------------------- | -------- | ----- | -------- |
| Multi-track timeline                | 12 weeks | 3 eng | P0       |
| Audio clip editing                  | 8 weeks  | 2 eng | P0       |
| Mixing console                      | 10 weeks | 3 eng | P0       |
| Built-in effects (EQ, comp, reverb) | 12 weeks | 3 eng | P0       |
| MIDI support                        | 8 weeks  | 2 eng | P1       |
| Plugin hosting (VST3?)              | 12 weeks | 3 eng | P2       |
| Spatial audio authoring             | 10 weeks | 3 eng | P1       |
| Export formats                      | 6 weeks  | 2 eng | P0       |

#### 4.4.4 Neith Cutter (Video Editor) (Q3-Q4)

| Task                          | Duration | Team  | Priority |
| ----------------------------- | -------- | ----- | -------- |
| Video timeline                | 12 weeks | 3 eng | P0       |
| Cut, trim, split              | 6 weeks  | 2 eng | P0       |
| Transitions                   | 6 weeks  | 2 eng | P0       |
| Color grading (basic)         | 10 weeks | 3 eng | P1       |
| Text/titles                   | 6 weeks  | 2 eng | P0       |
| Audio sync                    | 4 weeks  | 1 eng | P0       |
| Export (H.264, H.265, ProRes) | 8 weeks  | 2 eng | P0       |
| GPU acceleration              | 10 weeks | 3 eng | P1       |

#### 4.4.5 Neith Weaver (Procedural) (Q3-Q4)

| Task              | Duration | Team  | Priority |
| ----------------- | -------- | ----- | -------- |
| Node graph editor | 10 weeks | 3 eng | P0       |
| Geometry nodes    | 12 weeks | 3 eng | P0       |
| Texture generator | 10 weeks | 3 eng | P1       |
| Terrain generator | 12 weeks | 3 eng | P1       |
| City generator    | 16 weeks | 4 eng | P2       |
| Parameter system  | 6 weeks  | 2 eng | P0       |
| Baking/export     | 8 weeks  | 2 eng | P0       |

**Phase 3 Milestones**:

- [ ] Can model a character in Sculptor
- [ ] Can rig and animate in Animator
- [ ] Can create a music track in Composer
- [ ] Can edit a video in Cutter
- [ ] Can generate procedural content in Weaver

### 4.5 Phase 4: Platform Build (Year 4)

**Goal**: Build sovereign operating systems and browser.

#### 4.5.1 Neith Linux (Q1-Q2)

| Task                                      | Duration | Team  | Priority |
| ----------------------------------------- | -------- | ----- | -------- |
| NixOS-based distro setup                  | 8 weeks  | 2 eng | P0       |
| Custom desktop environment                | 16 weeks | 4 eng | P0       |
| Neith app runtime integration             | 8 weeks  | 2 eng | P0       |
| Hardware driver packaging                 | 8 weeks  | 2 eng | P0       |
| Installer                                 | 6 weeks  | 2 eng | P0       |
| Update system                             | 6 weeks  | 2 eng | P0       |
| Gaming optimizations (scheduler, drivers) | 8 weeks  | 2 eng | P1       |

#### 4.5.2 Neith Android (Q2-Q3)

| Task                            | Duration | Team  | Priority |
| ------------------------------- | -------- | ----- | -------- |
| AOSP fork setup                 | 8 weeks  | 3 eng | P0       |
| Custom launcher                 | 12 weeks | 3 eng | P0       |
| Neith app runtime integration   | 10 weeks | 3 eng | P0       |
| Privacy enhancements            | 8 weeks  | 2 eng | P1       |
| De-Googling                     | 10 weeks | 3 eng | P1       |
| OTA updates                     | 8 weeks  | 2 eng | P0       |
| Device support (Pixel, Samsung) | 12 weeks | 3 eng | P0       |

#### 4.5.3 Neith Browser (Q2-Q4)

| Task                       | Duration | Team  | Priority |
| -------------------------- | -------- | ----- | -------- |
| Servo fork setup           | 8 weeks  | 3 eng | P0       |
| WebGPU finalization        | 12 weeks | 3 eng | P0       |
| UI shell (tabs, bookmarks) | 12 weeks | 3 eng | P0       |
| Extension support          | 12 weeks | 3 eng | P1       |
| Privacy features           | 8 weeks  | 2 eng | P1       |
| Performance optimization   | 12 weeks | 3 eng | P0       |
| Mobile version             | 16 weeks | 4 eng | P1       |

#### 4.5.4 Neith VR OS (Q3-Q4)

| Task                          | Duration | Team  | Priority |
| ----------------------------- | -------- | ----- | -------- |
| OpenXR runtime                | 12 weeks | 3 eng | P0       |
| VR shell (home, app launcher) | 12 weeks | 3 eng | P0       |
| Hand tracking integration     | 10 weeks | 3 eng | P0       |
| Passthrough AR                | 10 weeks | 3 eng | P1       |
| Spatial audio integration     | 6 weeks  | 2 eng | P0       |
| Performance optimization      | 12 weeks | 3 eng | P0       |
| Android XR integration        | 12 weeks | 3 eng | P1       |

**Phase 4 Milestones**:

- [ ] Neith Linux boots and runs Neith apps
- [ ] Neith Android runs on Pixel device
- [ ] Neith Browser can browse web with WebGPU
- [ ] VR runtime works with Quest-like headsets

### 4.6 Phase 5: Optimization & Ecosystem (Year 5+)

**Goal**: Polish, optimize, and build ecosystem.

#### 4.6.1 Performance Optimization

| Task                               | Duration | Team  | Priority |
| ---------------------------------- | -------- | ----- | -------- |
| Renderer optimization (GPU-driven) | 16 weeks | 4 eng | P0       |
| Asset streaming optimization       | 12 weeks | 3 eng | P0       |
| Memory optimization                | 10 weeks | 2 eng | P0       |
| Network optimization               | 8 weeks  | 2 eng | P0       |
| Mobile optimization                | 12 weeks | 3 eng | P0       |
| VR optimization (90fps+)           | 12 weeks | 3 eng | P0       |

#### 4.6.2 Advanced Features

| Task                      | Duration | Team  | Priority |
| ------------------------- | -------- | ----- | -------- |
| Ray-traced GI (hardware)  | 16 weeks | 4 eng | P1       |
| Advanced destruction      | 12 weeks | 3 eng | P2       |
| Advanced fluid simulation | 16 weeks | 4 eng | P2       |
| Neural rendering          | 20 weeks | 5 eng | P2       |
| Volumetric effects        | 12 weeks | 3 eng | P1       |

#### 4.6.3 Ecosystem Building

| Task                 | Duration | Team  | Priority |
| -------------------- | -------- | ----- | -------- |
| Asset store platform | 16 weeks | 4 eng | P1       |
| Plugin SDK           | 12 weeks | 3 eng | P0       |
| Documentation site   | 8 weeks  | 2 eng | P0       |
| Tutorial content     | 16 weeks | 4 eng | P0       |
| Community tools      | 12 weeks | 3 eng | P1       |

---

## 5. Team & Resource Estimates

### 5.1 Team Structure

```
┌─────────────────────────────────────────────────────────────────────────────┐
│                           ORGANIZATION STRUCTURE                             │
├─────────────────────────────────────────────────────────────────────────────┤
│                                                                              │
│                              ┌─────────────┐                                │
│                              │     CTO     │                                │
│                              │  (Tech Lead)│                                │
│                              └──────┬──────┘                                │
│                                     │                                        │
│         ┌───────────────────────────┼───────────────────────────┐           │
│         │                           │                           │           │
│         ▼                           ▼                           ▼           │
│  ┌─────────────┐            ┌─────────────┐            ┌─────────────┐     │
│  │   Engine    │            │   Tools     │            │  Platform   │     │
│  │  Division   │            │  Division   │            │  Division   │     │
│  │  (25-40)    │            │  (20-35)    │            │  (15-25)    │     │
│  └──────┬──────┘            └──────┬──────┘            └──────┬──────┘     │
│         │                          │                          │            │
│    ┌────┼────┐               ┌─────┼─────┐              ┌─────┼─────┐      │
│    ▼    ▼    ▼               ▼     ▼     ▼              ▼     ▼     ▼      │
│  ┌───┐┌───┐┌───┐          ┌───┐ ┌───┐ ┌───┐         ┌───┐ ┌───┐ ┌───┐    │
│  │Rnd││Phy││Aud│          │3D │ │A/V │ │Pro│         │Lin│ │And│ │Bro│    │
│  │er ││sic││io │          │Mod│ │Edit│ │ced│         │ux │ │roi│ │wse│    │
│  └───┘└───┘└───┘          └───┘ └───┘ └───┘         └───┘ └───┘ └───┘    │
│  ┌───┐┌───┐┌───┐          ┌───┐ ┌───┐               ┌───┐                 │
│  │Net││AI ││Anm│          │UI │ │Doc│               │VR │                 │
│  │wrk││Run││  │          │UX │ │s  │               │OS │                 │
│  └───┘└───┘└───┘          └───┘ └───┘               └───┘                 │
│                                                                              │
└─────────────────────────────────────────────────────────────────────────────┘
```

### 5.2 Team Size by Phase

| Phase       | Year | Core Engineers | Specialists | Total | Key Roles                                                                     |
| ----------- | ---- | -------------- | ----------- | ----- | ----------------------------------------------------------------------------- |
| **Phase 1** | Y1   | 12             | 6           | 18    | Graphics (3), Systems (4), Network (2), UI (3), Audio (2), DevOps (2), PM (2) |
| **Phase 2** | Y2   | 25             | 12          | 37    | +Physics (3), +AI (3), +Animation (3), +Tools (3)                             |
| **Phase 3** | Y3   | 35             | 25          | 60    | +3D Tools (8), +Audio Tools (5), +Video Tools (5), +Procedural (5), +QA (5)   |
| **Phase 4** | Y4   | 40             | 35          | 75    | +OS (10), +Browser (8), +Mobile (8), +VR (6)                                  |
| **Phase 5** | Y5+  | 35             | 25          | 60    | Optimization, Ecosystem, Support                                              |

### 5.3 Budget Breakdown

| Category                             | Year 1    | Year 2     | Year 3     | Year 4     | Year 5     | Total      |
| ------------------------------------ | --------- | ---------- | ---------- | ---------- | ---------- | ---------- |
| **Engineering Salaries**             | $3.6M     | $7.4M      | $12.0M     | $15.0M     | $12.0M     | $50.0M     |
| **Infrastructure**                   | $0.5M     | $1.0M      | $2.0M      | $3.0M      | $2.5M      | $9.0M      |
| **Hardware (dev machines, devices)** | $0.4M     | $0.6M      | $0.8M      | $1.0M      | $0.5M      | $3.3M      |
| **Contractors/Consultants**          | $0.3M     | $0.5M      | $1.0M      | $1.5M      | $1.0M      | $4.3M      |
| **Licenses & Tools**                 | $0.2M     | $0.3M      | $0.4M      | $0.5M      | $0.5M      | $1.9M      |
| **Office & Operations**              | $0.5M     | $1.0M      | $1.5M      | $2.0M      | $1.5M      | $6.5M      |
| **Contingency (15%)**                | $0.8M     | $1.6M      | $2.7M      | $3.5M      | $2.7M      | $11.3M     |
| **Annual Total**                     | **$6.3M** | **$12.4M** | **$20.4M** | **$26.5M** | **$20.7M** | **$86.3M** |

### 5.4 Hiring Timeline

```
┌─────────────────────────────────────────────────────────────────────────────┐
│                            HIRING RAMP                                       │
├─────────────────────────────────────────────────────────────────────────────┤
│                                                                              │
│  Headcount                                                                   │
│     80 │                                          ┌───────────────          │
│        │                                     ┌────┘                          │
│     70 │                                ┌────┘                               │
│        │                           ┌────┘                                    │
│     60 │                      ┌────┘                                         │
│        │                 ┌────┘                                              │
│     50 │            ┌────┘                                                   │
│        │       ┌────┘                                                        │
│     40 │  ┌────┘                                                             │
│        │──┘                                                                  │
│     30 │                                                                     │
│        │                                                                     │
│     20 │                                                                     │
│        │                                                                     │
│     10 │                                                                     │
│        └─────────┬─────────┬─────────┬─────────┬─────────┬─────────         │
│               Q1 Y1     Q1 Y2     Q1 Y3     Q1 Y4     Q1 Y5                 │
│                                                                              │
│  Key Hiring Milestones:                                                      │
│  • Q1 Y1: Core team (12 eng) - Runtime, Graphics, Systems                   │
│  • Q3 Y1: Expansion (18 eng) - Network, UI, Audio                           │
│  • Q1 Y2: Engine build (30 eng) - Physics, AI, Animation                    │
│  • Q1 Y3: Tools build (50 eng) - 3D, Audio, Video specialists               │
│  • Q1 Y4: Platform build (70 eng) - OS, Browser, Mobile                     │
│  • Q1 Y5: Steady state (60 eng) - Optimize, reduce contractor reliance      │
│                                                                              │
└─────────────────────────────────────────────────────────────────────────────┘
```

### 5.5 Key Roles to Hire First

| Role                      | Count | When      | Why Critical                |
| ------------------------- | ----- | --------- | --------------------------- |
| **Graphics Lead**         | 1     | Month 1   | Sets rendering architecture |
| **Systems Architect**     | 1     | Month 1   | Designs runtime & memory    |
| **Senior Rust Engineers** | 4     | Month 1-2 | Core implementation         |
| **Build/DevOps Engineer** | 1     | Month 1   | CI/CD from day one          |
| **Technical PM**          | 1     | Month 1   | Coordination                |
| **Physics Engineer**      | 1     | Month 3   | Start physics early         |
| **Audio Engineer**        | 1     | Month 3   | Start audio early           |
| **Network Engineer**      | 1     | Month 3   | Critical for multiplayer    |

---

## 6. Risk Analysis

### 6.1 Technical Risks

| Risk                                | Probability | Impact | Mitigation                                    |
| ----------------------------------- | ----------- | ------ | --------------------------------------------- |
| Rendering quality doesn't match UE5 | High        | High   | Focus on "good enough"; incrementally improve |
| Physics performance issues          | Medium      | Medium | Use proven Rapier; optimize hot paths         |
| Browser (Servo) too complex         | High        | Medium | Start minimal; add features incrementally     |
| Mobile performance insufficient     | Medium      | High   | Optimize early; test on low-end devices       |
| AI inference too slow               | Medium      | Medium | Use specialized hardware; quantization        |
| Tool UX doesn't match industry      | High        | High   | Hire UX specialists; user testing             |

### 6.2 Business Risks

| Risk                              | Probability | Impact   | Mitigation                                            |
| --------------------------------- | ----------- | -------- | ----------------------------------------------------- |
| Can't hire enough Rust engineers  | Medium      | High     | Train existing devs; competitive compensation         |
| Project scope creep               | High        | High     | Strict phase gates; MVP focus                         |
| Funding insufficient              | Medium      | Critical | Modular architecture; can deploy phases independently |
| Third-party tools improve faster  | High        | Medium   | Focus on integration; don't NIH everything            |
| Market doesn't adopt custom tools | Medium      | Medium   | Maintain compatibility; gradual migration             |

### 6.3 Operational Risks

| Risk                         | Probability | Impact | Mitigation                              |
| ---------------------------- | ----------- | ------ | --------------------------------------- |
| Key person dependency        | High        | High   | Document everything; pair programming   |
| Burnout from ambitious scope | High        | High   | Realistic timelines; hire adequately    |
| Compatibility breaks         | Medium      | Medium | Semantic versioning; LTS branches       |
| Security vulnerabilities     | Medium      | High   | Security audits; fuzzing; Rust's safety |

---

## 7. Build vs Fork vs Wrap Decisions

### 7.1 Decision Matrix

| Component          | Decision              | Rationale                                 |
| ------------------ | --------------------- | ----------------------------------------- |
| **Render Engine**  | BUILD                 | Core differentiator; must own             |
| **Physics**        | WRAP (Rapier)         | Excellent Rust option exists              |
| **Audio Core**     | BUILD                 | Need deep integration; cpal as base       |
| **ECS**            | BUILD                 | Core to engine; must own architecture     |
| **Asset Pipeline** | BUILD                 | Critical for tooling; no good Rust option |
| **UI Toolkit**     | BUILD                 | Need deep integration                     |
| **Networking**     | BUILD                 | Game-specific requirements                |
| **Browser**        | FORK (Servo)          | Too complex to build; Servo is Rust       |
| **Linux Distro**   | FORK (NixOS)          | Leverage existing; customize              |
| **Android**        | FORK (AOSP)           | Only viable path                          |
| **VR Runtime**     | BUILD                 | OpenXR standard; implementation needed    |
| **3D Editor**      | BUILD                 | Core product; must own                    |
| **Video Editor**   | BUILD + WRAP (FFmpeg) | UI custom; codecs wrapped                 |
| **Audio DAW**      | BUILD                 | Core product; must own                    |
| **AI Inference**   | WRAP (ONNX) + BUILD   | Standard formats; custom ops              |
| **LLM APIs**       | WRAP                  | Multi-provider abstraction                |
| **Cloud Infra**    | USE                   | Not core; AWS/GCP commodity               |
| **Payments**       | WRAP                  | Regulatory complexity; use Stripe etc.    |
| **Blockchain**     | USE                   | Not core; use existing chains             |

### 7.2 Detailed Build Decisions

#### 7.2.1 Must Build (No Alternative)

| Component          | Reason                                 |
| ------------------ | -------------------------------------- |
| Neith Engine Core  | Foundational; defines all capabilities |
| Neith Renderer     | Core visual quality differentiator     |
| Neith ECS          | Architecture defines game patterns     |
| Neith Asset Format | Must own the format for tools          |
| Neith UI Toolkit   | Deep engine integration required       |
| Neith Studio Tools | Core product offering                  |
| Neith VR Runtime   | OpenXR implementation needed           |

#### 7.2.2 Should Fork (Good Starting Point)

| Component | Fork From      | Customization Level         |
| --------- | -------------- | --------------------------- |
| Browser   | Servo          | High - new UI, integrations |
| Linux     | NixOS          | Medium - packages, DE       |
| Android   | AOSP           | High - de-Google, launcher  |
| Audio DSP | dasp/symphonia | Medium - custom effects     |

#### 7.2.3 Should Wrap (Complexity Not Worth Rewriting)

| Component    | Wrap What        | Why                           |
| ------------ | ---------------- | ----------------------------- |
| Video Codecs | FFmpeg           | Decades of optimization       |
| Physics      | Rapier           | Excellent Rust implementation |
| AI Inference | ONNX Runtime     | Wide model support            |
| Image Codecs | image-rs         | Well-maintained               |
| Fonts        | fontdue/rusttype | Adequate implementations      |
| Compression  | lz4/zstd         | Optimized C libraries         |

---

## Appendix A: Glossary

| Term       | Definition                                                  |
| ---------- | ----------------------------------------------------------- |
| **Neith**  | Codename for the sovereign runtime/engine (Yoruba: "heart") |
| **ECS**    | Entity Component System - data-oriented game architecture   |
| **wgpu**   | Rust graphics library abstracting Vulkan/Metal/DX12/WebGPU  |
| **Rapier** | Rust physics engine                                         |
| **HRTF**   | Head-Related Transfer Function - 3D audio technique         |
| **WASM**   | WebAssembly - portable bytecode format                      |
| **AOSP**   | Android Open Source Project                                 |
| **OpenXR** | Open standard for VR/AR runtimes                            |
| **Servo**  | Mozilla's experimental Rust-based browser engine            |
| **NixOS**  | Declarative, reproducible Linux distribution                |

---

## Appendix B: External Dependencies Final Checklist

### Unserved Areas Requiring Custom Solutions

| Area                        | Current Gap        | Solution                                 |
| --------------------------- | ------------------ | ---------------------------------------- |
| **Font Engine**             | Using system fonts | Custom GPU font rasterizer               |
| **PDF Generation**          | No native solution | Custom PDF writer                        |
| **Print Pipeline**          | Using system print | Custom print compositor                  |
| **Offline Maps**            | Google/Apple Maps  | Custom tile renderer + OSM data          |
| **Sensor Fusion**           | Platform-specific  | Unified HAL + Kalman filter              |
| **Custom Network Protocol** | Using TCP/UDP      | Custom reliable UDP for games            |
| **Asset Compression**       | Generic codecs     | Custom mesh/texture compression          |
| **Identity System**         | OAuth providers    | DID-based decentralized identity         |
| **Encryption Library**      | OpenSSL            | Pure Rust crypto (ring/rustls)           |
| **Localization**            | i18next            | Custom ICU-compatible system             |
| **Accessibility**           | Platform APIs      | Custom a11y tree + screen reader support |

### Dependencies That Cannot Be Replaced

| Dependency           | Reason                 | Mitigation                        |
| -------------------- | ---------------------- | --------------------------------- |
| **iOS/macOS**        | Apple hardware lock-in | Build apps, not OS                |
| **Windows**          | Market dominance       | Support via wgpu/cross-compile    |
| **GPU Drivers**      | Vendor-specific        | Use Vulkan/Metal/DX12 abstraction |
| **CUDA (NVIDIA)**    | Proprietary            | Support ROCm (AMD), Metal (Apple) |
| **Hardware Sensors** | Device-specific        | HAL abstraction                   |
| **App Stores**       | Distribution monopoly  | Side-loading, web apps, own store |

---

## Appendix C: Success Metrics

### Phase 1 Success Criteria

- [ ] Runtime boots on 4 platforms (Linux, Windows, macOS, Web)
- [ ] 60 FPS rendering of 100K triangle scene
- [ ] Network latency < 50ms for game state sync
- [ ] UI renders at 120 FPS

### Phase 2 Success Criteria

- [ ] Comparable visual quality to Godot 4
- [ ] Physics stability for 1000 rigid bodies
- [ ] Spatial audio with < 10ms latency
- [ ] Scripting hot-reload in < 1 second

### Phase 3 Success Criteria

- [ ] Artist can model, rig, animate character in suite
- [ ] Music producer can create track in Composer
- [ ] Video editor can cut 4K video smoothly
- [ ] Procedural city generates in < 5 minutes

### Phase 4 Success Criteria

- [ ] Neith Linux boots in < 30 seconds
- [ ] Neith Android passes Android CTS
- [ ] Neith Browser scores 90+ on Speedometer
- [ ] VR runtime maintains 90 FPS

### Phase 5 Success Criteria

- [ ] 10+ third-party plugins in marketplace
- [ ] 1000+ active developers using tools
- [ ] Performance within 20% of UE5 for comparable scenes
- [ ] Full documentation coverage

---

_Document Version: 1.0_ _Last Updated: 2026-01-20_ _Authors: Claude Opus 4.5
(with human direction)_
