What is Jarvis?
Jarvis is a GPU-accelerated desktop environment that combines terminal emulation, AI chat assistants, retro arcade games, live social chat, and a configurable visual effects system into a single tiled window. Built entirely in Rust, it leverages modern GPU rendering, WebView embedding, and cross-platform abstractions to deliver a sci-fi inspired computing experience.Terminal Emulation
Embedded xterm.js with native PTY processes
AI Assistants
Claude and Gemini streaming APIs with tool calling
Tiling Manager
Binary split tree with split/zoom/resize/swap
GPU Rendering
wgpu-powered hex grid backgrounds and visual effects
Core Features
- Tiling window management with split/zoom/resize/swap operations
- Embedded terminal emulation via xterm.js connected to native PTY processes
- AI assistant panels backed by Claude and Gemini streaming APIs
- Live social presence with WebSocket-based real-time user tracking
- E2E encrypted chat with ECDSA identity, ECDH key exchange, and AES-256-GCM
- Mobile pairing via a WebSocket relay server with QR code provisioning
- Plugin system for custom HTML/JS/CSS panels served via the
jarvis://protocol - TOML-based configuration with live reload, theme support, and validation
Repository Structure
The repository contains both the legacy Python/Swift stack and the modern Rust rewrite:High-Level System Architecture
Dependency Graph
The workspace is organized withjarvis-common as the foundation:
The dependency hierarchy ensures clean separation: domain-specific crates depend only on
jarvis-common, while higher-level crates integrate multiple subsystems.Application Lifecycle
Startup Sequence
- Load environment - Parse
.envfile and install panic hook - Parse CLI arguments - Handle
--execute,--directory,--config,--log-level - Initialize logging - Set up tracing subscriber with filters
- Load configuration - Load TOML, apply theme, discover plugins, validate
- Ensure directories - Create platform-specific directories
- Build keybind registry - Parse keybind config into lookup table
- Create event loop - Initialize winit event loop
- Construct app state - Create
JarvisAppwith all subsystems - Enter event loop - Begin processing window events
Event Loop
The event loop is driven by winit’sApplicationHandler trait:
Event Loop Details
Event Loop Details
Shutdown Sequence
Shutdown is triggered byAction::Quit or WindowEvent::CloseRequested:
- Kill all PTY child processes
- Destroy all WebView panels
- Disconnect presence client
- Shut down mobile relay bridge
- Shut down tokio runtime (cancels background tasks)
- Release GPU resources
Key Design Patterns
Action Dispatch
All user interactions resolve to anAction enum variant. The dispatch() method routes actions to subsystem calls:
Action::NewPane can be triggered by:
- Keybind
- Command palette selection
- IPC message from WebView
- CLI argument
Event Bus (Broadcast)
TheEventBus uses tokio::sync::broadcast for pub/sub event distribution:
IPC Bridge (Rust ↔ JavaScript)
Bidirectional communication between Rust and WebView JavaScript:Custom Protocol (jarvis://)
The ContentProvider registers a custom protocol with wry:
- Bundled assets
- In-memory content overrides
- Plugin directory resolution
- Security containment (canonicalization-based traversal prevention)
Sync/Async Bridge
The main event loop runs synchronously on the main thread (required by winit). Async operations run on a dedicatedtokio::runtime::Runtime:
Communication uses channels polled at ~120Hz by the main thread.
Data Flow: Keyboard Input to Action Dispatch
Configuration Architecture
The configuration system is layered:- Schema - 25+ strongly-typed config sections with defaults
- TOML Loading - Reads from platform config directory
- Theme Application - Selectively overrides config fields
- Plugin Discovery - Scans for local plugin directories
- Validation - Checks formats, ranges, constraints
- Live Reload - File watcher triggers config reload
Legacy Stack vs Rust Rewrite
Legacy Stack (Python + Swift)
- Platform: macOS only (Metal, AppKit)
- Runtime: Python 3.10+, Swift 5.9+
- Components:
main.py- Python entry point, mic capture, event loopmetal-app/- Swift/Metal 3D orb rendererskills/- Python AI skill systemvoice/- Audio capture and Whisper transcriptionconnectors/- Service integrations
Rust Rewrite
- Platform: Cross-platform (Windows, macOS, Linux)
- Runtime: Single native binary
- Components: 10 Rust crates with clear responsibilities
| Legacy Component | Rust Replacement |
|---|---|
metal-app/ (Swift/Metal) | jarvis-renderer (wgpu) |
main.py event loop | jarvis-app (winit) |
| Metal 3D orb | wgpu hex grid shader |
| Swift chat panels | jarvis-webview (wry WebViews) |
skills/router.py | jarvis-ai::router::SkillRouter |
skills/claude_code.py | jarvis-ai::claude::ClaudeClient |
voice/audio.py | jarvis-ai::whisper::WhisperClient |
| None (new) | jarvis-tiling (binary split tree) |
| None (new) | jarvis-config (TOML + validation) |
| None (new) | jarvis-platform::CryptoService |
| None (new) | jarvis-social (presence + chat) |
| None (new) | jarvis-relay (mobile bridge) |