Phase
Get LUCID
Browse documentation
Docs / Protocols & Architecture

Workspace architecture, crates and Plasm

The repository is a Cargo workspace (edition = "2021", rust-version = "1.89") cleanly layered into an Apache-2.0 Phase substrate powering three workload flagships—LUCID (AGPL-3.0-or-later), LUMEN (active qualification / preview), and PLASM (Apache-2.0)—plus the cross-platform Tauri v2 Desktop app.

Phase substrate and three flagships#

Every flagship inherits the same workload-neutral Phase core (persistent Ed25519 identity, canonical signed manifests, streaming SHA-256 commitments, signed execution receipts, encrypted libp2p networking, and content-addressed artifact transfer):

Layer / Flagship Location License Status Role
Phase substrate crates/phase-* (6 crates) Apache-2.0 Shipping Workload-agnostic identity, manifests, receipts, Worker / JobSpec protocol, libp2p transport, and artifact server.
LUCID crates/lucidd, apps/lucid-desktop AGPL-3.0-or-later Shipping (v0.2.0-rc42) Decentralized GPU text & vision inference (llama.cpp b12977, Apple Silicon MLX), Ollama & OpenAI /v1 APIs, Tier-1 Discrete Slice Quorum, and Tauri v2 Desktop app with MCP 2026-07-28.
LUMEN crates/lumend (embedded in lucidd + standalone CLI) Qualification preview Merged on main (7e3547a); not in default v0.2.0-rc42 public installers Decentralized image generation and PNG reference-image editing (JobSpec::ImageGen, stable-diffusion.cpp sd-cli, /phase/shard-rpc/leased/1.0.0, SlotQueue::try_acquire_exclusive; physical two-Mac qualification passed). See LUMEN.
PLASM crates/plasm (embedded local-only in lucidd + standalone plasmd) Apache-2.0 Shipping in workspace (7e3547a adds plasmd compute & local wasm_engine) Sandboxed, verifiable WebAssembly compute (plasmd, WasmtimeWorker on Wasmtime 36 LTS, default-deny admission & verify_strict receipts) plus Phase Boot utilities (boot/ renewal track). See PLASM.

Workspace crates (9 crates)#

Crate Version License #![deny(unsafe_code)] Role
phase-identity 0.1.0 Apache-2.0 Yes Persistent Ed25519 NodeIdentity with atomic 0600 storage.
phase-manifest 0.1.0 Apache-2.0 Yes Generic SignedManifest<T>, canonical JSON signing, verify_strict + weak-key rejection, remote replay-window policy.
phase-receipt 0.1.0 Apache-2.0 Yes Generic SignedReceipt<T> with canonical JSON signing and verify_strict + weak-key rejection.
phase-protocol 0.1.0 Apache-2.0 Yes Workload-agnostic Worker/DynWorker traits, JobSpec (Wasm, Inference, Embedding, ImageGen), JobEvent, JobHandle, and CommitmentAccumulator.
phase-net 0.1.0 Apache-2.0 Yes Workload-neutral libp2p 0.57 transport, Kademlia, mDNS, Relay v2, DCUtR, Identify, AutoNAT v2, Rendezvous, and all bounded /phase/* stream codecs (including /phase/shard-rpc/2.0.0 wire-dedup and /phase/shard-rpc/leased/1.0.0).
phase-artifact-server 0.1.0 Apache-2.0 Yes Content-addressed HTTP/Range server (blobs/<aa>/<sha256>.bin) and atomic ArtifactStore.
plasm 0.1.0 Apache-2.0 Yes (lib) Reference WASM compute node (plasmd with compute + WasmtimeWorker on Wasmtime 36 LTS 36.0.24, default-deny config/admission) + Phase Boot utilities (phase-discover, phase-verify, phase-fetch).
lumend 0.1.0 Qualification preview Yes Independent LUMEN diffusion-worker crate & CLI (devices, generate, verify, trusted-peer RPC serving/forwarding for SD 1.5, FLUX.3 Klein, Qwen-Image 2.1 Turbo).
lucidd 0.2.0 AGPL-3.0-or-later Yes (lib) Primary managed engine: LUCID GPU inference (llama.cpp b12977 + MLX + echo), embedded LUMEN image_engine (default share_images = false), local-only default-disabled PLASM wasm_engine, Ollama/OpenAI /v1/control HTTP APIs, DHT registry, P2P content plane, Tier-1 Discrete Slice Quorum, and policy engine.

Zero unsafe blocks exist anywhere inside crates/ or apps/lucid-desktop/src-tauri/src/ (third-party dependencies are checked in CI with cargo audit and cargo deny).

Dependency graph#

phase-artifact-server  (standalone leaf)
phase-identity         (leaf)
  ├── phase-net
  ├── phase-manifest
  └── phase-receipt
          └── phase-protocol
                  ├── plasm   (also uses phase-artifact-server)
                  ├── lumend  (also uses phase-artifact-server)
                  └── lucidd  (embeds plasm & lumend; also uses phase-artifact-server)

No upward references exist; phase-net contains zero inference, diffusion, or LLM logic.

Plasm, Lumen, and Phase Boot#

  • PLASM (crates/plasm, Apache-2.0): Proves the Phase substrate is genuinely workload-neutral by executing deterministic, sandboxed WebAssembly modules (WasmtimeWorker on Wasmtime 36 LTS) with default-deny submitter authorization, fuel/memory/timeout clamping, and Ed25519 verify_strict receipts (plasmd compute + local-only default-disabled wasm_engine inside lucidd). crates/plasm also ships the Phase Boot utilities (phase-discover, phase-verify, phase-fetch), with boot/ preserved as a dedicated portable privacy-focused OS renewal track. See PLASM.
  • LUMEN (crates/lumend, merged on main 7e3547a in active qualification): Extends the Phase substrate to decentralized image generation and PNG reference-image editing (SD 1.5, FLUX.3 Klein, Qwen-Image 2.1 Turbo) with SlotQueue::try_acquire_exclusive GPU arbitration and /phase/shard-rpc/leased/1.0.0, embedded in lucidd while retaining the standalone lumend executable. See LUMEN.

LUCID Desktop (apps/lucid-desktop)#

Cross-platform Tauri v2 + Svelte 5 app (net.phasebased.lucid, #![deny(unsafe_code)]) shipping for macOS Apple Silicon (.dmg), Linux x86_64 & aarch64 (.deb), and Windows x86_64 (per-user NSIS -setup.exe), bundling lucidd via Tauri externalBin (apps/lucid-desktop/stage-sidecar.sh):

  • Strict WebView boundary: Strict CSP (default-src 'self'; script-src 'self'; connect-src ipc: http://ipc.localhost https://ipc.localhost; object-src 'none'; frame-ancestors 'none'), minimal capabilities (capabilities/default.json for main window controls, folder picker, and validated URL opening; capabilities/monitor.json scoped strictly to the compact, resizable floating Activity Monitor window with Pin / always-on-top toggle and zero dialog/opener/filesystem permissions).
  • Token isolation & metadata-only Activity Monitor: Per-session Bearer token (control-<uuid>.token, mode 0600) stays exclusively inside Rust; Svelte calls typed Tauri commands. The floating Activity Monitor (Metrics | Flow) reads GET /api/lucid/telemetry, exporting strictly metadata-only counters, slice hydration / wire-dedup stats, and anonymized Helper 1..N labels (zero prompts, replies, PeerIds, or IPs).
  • MCP 2026-07-28 host & managed portable Node.js LTS: Built-in dual-era MCP client (server/discover + automatic fallback to legacy 2025-11-25..2024-11-05, persistent stdio + Streamable HTTP) and Web Browser auto-launcher (Chrome, Edge, Brave, Vivaldi, Chromium). Optional portable Node.js v24.23.0 LTS runtime downloads are pinned at compile time in apps/lucid-desktop/src-tauri/managed-runtimes.json (zero runtime index.json TOFU, https://nodejs.org only, SHA-256 verified, atomic swap with rollback, disabled in Tor / TailsOS mode).
  • Verified Software Updates: Checks GitHub Releases via Rust and verifies SHA-256 plus OS code signatures before installing (macOS Developer ID + Gatekeeper spctl; Windows Authenticode + RFC 3161 + build-time LUCID_WINDOWS_PUBLISHER_SUBJECT pinning; Linux .deb download). Unsigned dev builds cannot launch auto-updates.
  • Sidecar lifecycle: Refuses root (uid == 0), launches lucidd with env_clear() (no console window on Windows), supports live --llama-ctx-size (8K–256K) and cluster-helper restarts with stepped boot progress and crash fail-fast, hashes the sidecar binary at launch, integrates with the system tray (Open LUCID, Quit LUCID), and on exit sends SIGTERM (3-second grace window so lucidd reaps llama-server / mlx_lm.server / ggml-rpc-server cleanly) before falling back to SIGKILL and deleting the session token.
  • Deep links: Handles lucid://join/... URLs and .lucidinvite files directly into the Join Invite modal on macOS, Linux, and Windows.

Validation and release signing scripts (scripts/)#

Script Purpose
scripts/phase-validate.sh Fingerprinted local/CI validation harness (phase-net, lucid, artifact, adversarial, linux, release, security, workspace, qualification).
scripts/install-lucid.sh / install-lucid.ps1 Fail-closed SHA-256-verified end-user installers for macOS, Linux, and Windows.
scripts/check-managed-runtimes.py Verifies and updates compile-time SHA-256 pins for managed portable Node.js LTS (managed-runtimes.json).
scripts/setup-cloud-relay.sh One-command hardened Linux Cloud Relay installer (User=lucid, port 443 or 4001).
scripts/sign-macos-release.sh Local Mac Keychain Developer ID signing, Apple notarization, stapling, spctl verification, and optional GitHub Release republish + SHA256SUMS.txt refresh (zero Apple secrets in CI).
scripts/sign-windows-binary.ps1 Shared CI + local Windows VM Azure Artifact Signing script using SHA-256-pinned NuGet SDK tools, RFC 3161 timestamping, and signtool verify /pa.
scripts/build_site.py Builds this GitHub Pages site from site/ + pandoc, failing closed on broken links, missing anchors, or non-documentation IPv4s.

Written directly from the Phase, LUCID, LUMEN & PLASM source code. Raw Markdown · Edit or report an inaccuracy on GitHub.