Architecture7 min read

Why We Built Lumzel with Rust and Tauri v2 Instead of Electron

A technical breakdown of our headless Rust workspace crates, OS WebView rendering budget, and the real trade-offs of leaving Chromium behind.

Lumzel EngineeringCore Systems
Why We Built Lumzel with Rust and Tauri v2 Instead of Electron

Lumzel is a local-first desktop workbench built with Rust and Tauri v2 for running multiple AI coding agents in parallel across isolated Git worktrees. Rather than bundling a Chromium browser and Node.js runtime per window like Electron, Lumzel compiles agent transports, terminal hosts, and in-process MCP servers into native Rust crates paired with the system WebView, keeping cold start under 800ms and idle memory under 250MB.

1. Where Electron Hits a Ceiling in Multi-Agent Workbenches

An ordinary chat wrapper only holds one text stream at a time. A multi-agent coding workbench is closer to an IDE plus a process supervisor: four or five coding agents (Claude Code, Codex, OpenCode, Cursor CLI) emit structured JSON-RPC events concurrently, spawn child compilers and test runners in PTYs, stream Git diffs, and drive embedded browser previews.

On Electron, the baseline already carries a bundled Chromium engine, a V8 main process, and one renderer process per window. Once you add multiple node-pty children, file watchers, and unvirtualized chat DOM trees, idle memory routinely climbs past 800MB–1.5GB before your own Rust or TypeScript build toolchain even starts.

< 800ms
Cold start budget

First interactive frame on macOS before background scans run

< 250MB
Idle app + WebKit

Measured across Rust backend + system WKWebView combined

< 1%
Dropped frames

During parallel multi-agent streaming and panel switches

2. Headless Rust Crates with Strict Downward Dependencies

Choosing Tauri v2 alone does not make an app clean or fast. The structural win in Lumzel comes from keeping core subsystems completely headless—no Tauri types, no UI state, and no SQLite coupling inside core crates. Only the desktop shell (apps/desktop/src-tauri) wires them together.

Cargo.toml (workspace dependency direction)
apps/desktop/src-tauri   # Tauri v2 shell, commands (cmd/*.rs), SQLite, Loadouts
  ├── crates/lumzel-agent     # Headless AgentHost: Claude, Codex, Grok, ACP, Antigravity + in-process MCP router
  │     └── crates/lumzel-host    # MCP JSON-RPC protocol & phone projection payloads
  │           └── crates/lumzel-frame  # Encrypted framing primitives
  ├── crates/lumzel-pty-host  # Detached terminal host process (survives UI rerenders)
  ├── crates/lumzel-channels  # Headless IM/event adapters (WeChat, Feishu, DingTalk, Telegram, Slack, Discord, WhatsApp, GitHub, Webhook)
  ├── crates/lumzel-link      # Noise IK / XXpsk0 handshake (snow) & Relay client
  ├── crates/lumzel-speech    # Static sherpa-onnx + cpal on-device voice recognition
  └── crates/lumzel-log       # JSON-lines daily rolling sink, EnvFilter, Redacted<T>

Because lumzel-agent, lumzel-channels, and lumzel-link have zero Tauri dependencies, their protocol state machines and wire clients compile and run directly under cargo test without launching a window. The same lumzel-link crate is also compiled via UniFFI into our native SwiftUI iOS companion core, so Noise handshake logic exists in exactly one place.

3. Architecture Comparison: Lumzel (Rust + Tauri v2) vs Electron

Architectural differences between Lumzel's Rust + Tauri v2 stack and a typical Electron agent wrapper
LayerLumzel (Rust + Tauri v2)Typical Electron App
UI RendererOS WebView (WKWebView / WebView2 / WebKitGTK)Bundled Chromium per app install
Agent & MCP RuntimeCompiled Rust async tasks + in-process MCP routerNode.js main process + external stdio MCP servers
Terminal IsolationDetached lumzel-pty-host processnode-pty bound to Electron main process
Local Voice & CryptoStatic sherpa-onnx & Noise (snow) in RustNative N-API addons or remote cloud APIs

4. Keeping the React + Zustand Surface Bounded at Frame 0

A fast Rust backend can still feel sluggish if the React frontend re-renders entire session lists on every streamed token. We enforce four concrete rules in apps/desktop/src/:

  1. Frame-0 interruptible switches: clicking any tab, worktree, or panel paints a lightweight shell immediately and yields heavy mounts via double requestAnimationFrame, canceling pending work if the user clicks again.
  2. Narrow Zustand subscriptions: components subscribe to primitive fields or useShallow projections; streaming updates are coalesced at most once per animation frame.
  3. Viewport windowing everywhere: chat histories, file trees, Git diffs, and terminal scrollback use @tanstack/react-virtual so DOM node count stays O(viewport) regardless of session length.
  4. Zero idle work in hidden panes: background git status checks, market refreshes, and layout observers pause when a pane is not visible.

5. The Honest Trade-Offs of Tauri v2

Skipping Electron comes with real engineering costs that teams should weigh before making the same choice:

  • Three WebView engines instead of one: WKWebView on macOS, WebView2 on Windows, and WebKitGTK on Linux differ in scrollbar rendering, SVG filter clipping, and CSS :visited privacy rules. We maintain a local multi-OS build and test farm (macOS, Linux, Windows) to catch platform regressions early.
  • Rust compile times: workspace edits require disciplined crate boundaries and scoped cargo clippy / cargo test runs instead of blindly rebuilding all integration binaries on every change.