Companion Scan turns AR captures and uploaded media into a private, structured record of a Place.
Documentation · Device targets · Get started · License · Systems map
Companion Scan captures with 8th Wall or WebXR in a browser, or with the phone's own ARKit or ARCore session in the apps. An engine-agnostic vision layer detects objects, and Three.js renders the Companion Scan Spatial Editor at /editor. Several scans combine in one Place, are assigned to Areas such as rooms or floors, and remain independently traceable through layers and Things. Inference defaults to local Ollama; bundled ONNX and deterministic mock CV engines are alternatives selected via INFERENCE_MODE.
The current product contract is Place-First Product Design. WorldProject remains the internal ENU scene format during the compatibility migration; it is not the primary user-facing noun.
Each target has a page under docs/targets/: what it is, what has run on a device and what has not, its entry points and files, and how to build, run and test it. A result counts as verified only when someone ran it on the hardware and read the output back.
| Target | Status | Page |
|---|---|---|
| Web, 8th Wall: iPhone and iPad Safari | In code. The iPhone 15 and desktop Safari Playwright profiles pass on npm run test:box's servers (TEST_BOX_PROJECTS). No run on an iPhone or iPad is recorded. |
web-8thwall.md |
| Web, WebXR: Android Chrome with ARCore, Meta Quest Browser | In code. On Android one session start was seen, and tracking was not reached. Quest support is documented, not verified. | web-webxr.md |
Android app, ARCore: the Capacitor shell with ScanAR, native first, then 8th Wall, then WebXR |
Built at 9872ccb on 2026-11-25, with its 19 JVM unit tests; Mobile Build last ran on main at bd80f58 (run 45330560945). It starts on an Android 16 emulator, which has no ARCore. Not run on a device: Checklist E. |
android-arcore.md |
Android app, 8th Wall: the same shell built with VITE_AR_RUNTIME=8thwall |
Built at 9872ccb on 2026-11-25, and by Mobile Build's 8th Wall job on main at bd80f58 (run 45330560945); npm run build:8thwall in mobile/ makes it. No device run is recorded. It shares the app id, so it replaces the ARCore build on a device. |
|
Android app, WebXR only: the same shell built with VITE_AR_RUNTIME=webxr, for XREAL Aura and PICO |
Built at 9872ccb on 2026-11-25, with no 8th Wall engine. Installed on one XREAL Aura, whose WebView has no WebXR, so it cannot capture there. It shares the app id too. |
android-webxr.md |
Meta Quest app: a native headset app on the Meta Spatial SDK (meta/) |
Built locally at 81e437c, and by the Quest Build workflow on main after wave 14 (run 45327834865), whose 108 JVM unit tests pass. It signs in with shell=quest. Not run on a headset. |
meta-quest.md |
iOS app: the Capacitor shell with ARKit through ScanAR |
In code, drawn in RealityKit's ARView (ADR 0012), with a geo view on ARKit geo tracking (ADR 0017). Built for a device and the Simulator at 9872ccb on 2026-11-25; Mobile Build's Simulator job last ran on main at bd80f58. Installed on one iPhone; no row of Checklist D has run on it. |
ios.md |
| Desktop app: the editor and viewer, for Windows, macOS and Linux | In code. It cannot capture. On a Mac with Apple silicon it can train a splat of a captured scan itself (Solve on this Mac), tried only on a synthetic capture. The universal macOS app built at 9872ccb on 2026-11-25 and has not been opened on a Mac. Sign-in has not run against a real Portal. |
desktop/README.md |
The desktop and Android apps are published only as GitHub pre-releases, and no app is in an app store. How they are built and released: docs/targets/README.md.
The product does not show one name everywhere. This is what each surface shows today, read from
the file that sets it. tests/unit/node/wp-surface-names.test.ts holds each row this repository
sets to its file.
| Surface | Shows | Set in |
|---|---|---|
| iOS app, home screen | Scan | CFBundleDisplayName in mobile/ios/App/App/Info.plist |
| Android app, launcher | Scan | app_name and title_activity_main in mobile/android/app/src/main/res/values/strings.xml |
| Meta Quest app, launcher | Scan for Quest | android:label in meta/app/src/main/AndroidManifest.xml |
| Desktop app, app name and window title | Companion Scan | productName and the window's title in desktop/src-tauri/tauri.conf.json |
| Web app, browser tab | Companion Scan: capture a 3D map of a room | <title> in index.html |
| Web app, installed from the browser | Companion Scan | name and short_name in public/manifest.json |
| Start screen, in the browser and the phone apps | Spatial Memory | #start-title in index.html, under the line "Companion Intelligence" |
| Editor, browser tab | Spatial Editor | <title> in viewer.html; src/viewer/viewer.ts puts the Place's name in front |
| Product video, title card | CI-Spatial | app.name and the title scene's title in video/storyboard.json |
| Unity Scan app, home screen | Companion Scan | companion-unity's build (Assets/Build/Editor/PlayerConfigurator.cs); its ProjectSettings.asset says Companion between builds |
| This repository | Companion-Scan | GitHub, which still redirects links that use the repository's earlier name |
Which name each surface should show is the owners' decision (X-02 of the 2026-12-02 iOS review), so
none is renamed here. The package names, the glTF generator tag, the geocoder's User-Agent and the
public site's Cloudflare project still say ci-spatial, after the repository's earlier name, and the
gimbal subsystem's backend still reads CI_SPATIAL_URL;
foundation-updates/0011 records that choice
for the web package, the tag and the User-Agent. They are identifiers rather than names the apps
show, so they keep their values unless the owners decide to migrate them.
Every target talks to one Scan server. The phone and desktop apps have none of their own: each is
pointed at the person's own server by its https address. The server is a Node 26 API
(node server/main.ts, :8000) behind Vite (:5173, HTTPS). It:
- stores scans, sessions and Places, and sends the editor its live updates;
- runs every background job through one
WorldJobqueue: theoptimize-scanGLB optimizer on every upload, and the slower reconstruction chain (LingBot-Map or COLMAP poses, Brush or Spirula splat training, splat detection and compression); - runs object detection through the engine
INFERENCE_MODEnames:ollama(the default),onnxormock; - signs people in with a Companion Account when
PORTAL_OIDC_ENABLEDis on.
Its status, files, and how to run and test it: docs/targets/server.md. Its settings and sign-in are below, with the API and inference.
The web app and its server, on one machine:
git clone https://github.com/companionintelligence/Companion-Scan.git
cd Companion-Scan
export ONNXRUNTIME_NODE_INSTALL_CUDA=skip # onnxruntime-node's CUDA download answers 404
npm ci # not `npm install` — an in-place install has corrupted this tree before;
# the symptom is a phantom Playwright "two different versions" error
npm start # API server (:8000) + Vite dev server (:5173, self-signed HTTPS), togetherIt needs Node 26 (see Requirements). npm start uses concurrently to run the
API server on :8000 (npm run server, which is node server/main.ts) and the Vite dev server
on :5173 with HTTPS (npm run dev).
Then open https://localhost:5173 (accept the self-signed cert warning, or run
tailscale cert <your-machine>.<tailnet>.ts.net first and restart — see vite.config.ts for how
it picks that up automatically). The server admits a page on localhost only when it runs with
ALLOW_DEV_ORIGINS=1 (server/origin.ts); without it the editor's live-update socket (/events)
is refused there, so use ALLOW_DEV_ORIGINS=1 npm start on a dev machine. A page on your tailnet
address needs no flag. Point a phone at the same URL over Tailscale to scan for real;
npm run qr prints a scannable link.
A phone browser opens the camera only over HTTPS. For trusted HTTPS on every device, phones use
the Tailscale address and its tailscale cert certificate. Vite finds the
host name at startup: the TAILSCALE_HOSTNAME env var, then
tailscale status --json, then a <hostname>.ts.net.crt file in the repo root. Set
TAILSCALE_HOSTNAME explicitly only if detection picks the wrong name (see .env.example for all
configuration knobs).
Key routes, on https://<host>:5173:
- Scanner / uploader, to scan or upload content from a Place:
/?project=default - Spatial Editor, on desktop:
/editor?project=default - WebXR scanner:
/webxr.html
Vision models. The default ollama mode needs no bundled model: install
Ollama, then run npm run setup:models to see the recommended vision models
and pull the ones you want. Only for INFERENCE_MODE=onnx, download the ONNX model (2.2 GB):
python3 download_models.pyThis downloads LiquidAI/LFM2.5-VL-1.6B-ONNX into public/models/LiquidAI/LFM2.5-VL-1.6B-ONNX/.
Plus the gimbal-driven capture subsystem (subsystems/osmo-ble/,
full details in docs/operations/GIMBAL_INTEGRATION.md) — controls a DJI Osmo
Mobile 6 over Bluetooth for automated pan/tilt capture sweeps:
cd subsystems/osmo-ble
npm install
npm run backend # must run in a real terminal — macOS Bluetooth permission can't be scriptedThe osmo-gimbal MCP server is already registered in this repo's .mcp.json —
Claude Code picks it up automatically once the backend above is running.
Next. For persistent serving from a Linux box (systemd units, GPU inference, cert renewal) or a Mac (LaunchAgents) see docs/operations/DEPLOY.md. For each phone, headset and app, see the device targets. For the on-device test protocol, including driving an Android device's UI directly through android-remote-control-mcp as a Claude Code connector, see docs/testing/DEVICE_TESTING.md.
New here? docs/product/UX_FLOW.md walks the whole happy path as a user story — install and onboarding on the phone, scanning a room, structuring scans into the 4D world in the desktop editor, queuing reconstruction jobs, and sharing a world — plus the mental model for the four capture modes (manual tap, auto-capture, keyframe streaming, and WebRTC live). For the full documentation index see docs/README.md.
![]() Companion Scan start screen |
![]() Mobile capture HUD |
![]() Spatial editor overview |
Mobile capture creates a Place/Area/Scan record; selected inference and reconstruction services process the data, and the editor exports a portable scene.
flowchart LR
Capture[Mobile AR capture] --> Scan[Place, Area and Scan model]
Scan --> Inference[Ollama, ONNX or mock inference]
Inference --> Rebuild[Async reconstruction]
Rebuild --> Scene[Spatial editor and GLB export]
Scan --> Queue[Offline write queue]
The client coordinates AR tracking (8th Wall, WebXR, or the native ARKit or ARCore session in the apps), on-device or server VLM inference, IndexedDB state caching, and live WebRTC streaming to the desktop editor, backed by the API server (Node) and Vite.
flowchart TB
subgraph UI ["User Interfaces"]
ScannerMobile["Mobile AR HUD & Start Screen"]
EditorDesktop["Desktop 3D Editor / Viewer (Three.js)"]
end
subgraph ClientCore ["Client Core Runtimes"]
ARProvider["AR Provider Layer (8th Wall / WebXR / native ScanAR)"]
InferenceRouter["Inference Router (WebGPU Worker / Server)"]
Broadcaster["WebRTC Broadcaster (broadcaster.ts)"]
PWA["PWA Service Worker & Offline Sync Queue"]
end
subgraph LocalStorage ["Local Browser Storage"]
IDB_Client[(IndexedDB Store)]
LStore[(Local Storage settings)]
end
subgraph ServerBackend ["API Server Backend (Node, :8000)"]
HTTPGateway["HTTP Server (server/main.ts, Hono on Node)"]
JobRunner["WorldJob Queue (single-flight pump - server/world/world_job_pump.ts)"]
OptimizationPipeline["Scan Optimization (Draco/LODs - server/pipeline.ts)"]
end
subgraph ServerStorage ["Server Storage"]
ScansStore[("scans/ (.glb, .ply, .json)")]
WorldsStore[("worlds/ (.json manifests, patches)")]
end
subgraph HeavyWorkers ["Heavy CV / Reconstruction Workers"]
LingBotMap["LingBot-Map Python reconstructor"]
SplatTrainer["3D Gaussian Splat Trainer (Brush or Spirula)"]
SplatDetector["3D Spatial Object Detector"]
end
%% Wiring
ScannerMobile --> ARProvider
ScannerMobile --> MenuBtn["Menu button / Verdict UI"]
ARProvider --> InferenceRouter
ARProvider --> Broadcaster
ARProvider --> PWA
PWA --> IDB_Client
InferenceRouter --> LStore
Broadcaster -.->|WebRTC live feed| EditorDesktop
EditorDesktop --> IDB_Client
PWA -->|HTTP Proxy / Vite| HTTPGateway
EditorDesktop -->|HTTP / WebSocket / worlds| HTTPGateway
HTTPGateway --> JobRunner
HTTPGateway --> OptimizationPipeline
HTTPGateway --> ScansStore
HTTPGateway --> WorldsStore
JobRunner --> HeavyWorkers
JobRunner -->|optimize-scan job| OptimizationPipeline
HeavyWorkers --> ScansStore
HeavyWorkers --> WorldsStore
OptimizationPipeline --> ScansStore
The onboarding overlay guides new users through camera and motion permission and walking speed. Its second step also lists this install's setup status (see First-run setup status and settings). Real-time verdict updates indicate scan quality.
graph TD
A[Start: Open HTTPS link / PWA] --> B[Onboarding Overlay: 2 Steps]
B --> C[Allow Camera & Motion Access]
C --> D[Choose Capture Method start-screen]
D --> D1[📡 Live AR scanning]
D --> D2[🎞️ Upload Walkthrough Video]
D1 --> E[Initialise SLAM tracking]
E --> F[Accumulate Point Cloud & Poses]
F --> G{Scanning Mode}
G --> G1[🔘 Manual Capture: Tap Shutter]
G --> G2[📷 Auto-Capture: Snap as you walk]
G --> G3[☁️ Keyframe Stream: Send RGB+poses to server]
G --> G4[📡 WebRTC Live: Stream feed to desktop]
G1 & G2 --> H[Quality Monitor: evaluate light/drift/reflection]
H --> I[HUD Verdict Chip: Ready / Review / Sparse]
I --> J[Tapping Done: Open side panel & scroll to export]
J --> K{Quality Gate Check}
K -- needs-rescan --> K1[Confirm warning prompt]
K -- ready / needs-review --> L[Export GLB & Server Sync]
L --> M[Reveal View in 3D link]
M --> N[Open Desktop Editor: inspect, transform, edit category/tags/notes]
N --> O[Queue Async Server Jobs: reconstruct, splat, align, floor-plan]
O --> P[Generate Shareable Links: redacting token capability]
Posed video keyframes and voxelized points feed into local spatial stores and remote reconstruction pipelines.
graph TD
subgraph Client ["Client Device (PWA / Mobile / Desktop)"]
SLAM["8th Wall, WebXR or native ARKit / ARCore tracking"] -->|Raw Points & Poses| PC["Local PointCloud (Voxel Grid)"]
Camera["Camera Video Stream"] -->|Frames| Cap["Capture Module"]
Cap -->|Frame JPEG + Pose| VLM_Local["In-Browser WebGPU Inference"]
PC & Dets_Local["Detections"] -->|Saved state| IDB[(IndexedDB Session Store)]
end
subgraph Transport ["Network Transports"]
Cap -->|Multipart POST /infer| Server_Infer["Inference (API server)"]
Cap -->|Posed Keyframes /upload-scan| Server_Storage["Scan Storage (API server)"]
PC & Cap -->|Live JSON & video streams| WebRTC["WebRTC Broadcaster"]
IDB -->|Sync GLB /upload-scan| Server_Storage
IDB -->|Sync EditPatch logs| Server_Storage
end
subgraph Server ["API Server Backend (Node)"]
Server_Infer -->|Forward JPEG| Ollama["Ollama Vision API (qwen3-vl)"]
Server_Infer -->|Local ONNX| LFM["LiquidAI ONNX Runtime (LFM-2.5)"]
Server_Storage -->|Write GLB & sidecars| ScansDir["/scans/ directory"]
Server_Storage -->|World Manifests & Patches| WorldsDir["/worlds/ directory"]
Server_Storage -->|Create WorldJob| WorldJobs["WorldJob Queue (single-flight)"]
WorldJobs -->|optimize-scan| Optimize["server/pipeline.ts (Draco/LODs)"]
WorldJobs -->|Run Reconstruction| LingBot["LingBot-Map (PLY + poses)"]
WorldJobs -->|Run Splat Training| Brush["3DGS trainer: Brush or Spirula (splat.ply)"]
WorldJobs -->|Run 3D Object Detection| SplatDetect["Splat-Detect (boxes)"]
end
Ollama & LFM -->|Bounding Box JSON| Server_Infer
Server_Infer -->|RawDetections| Cap
WebRTC -->|Live Geometry & Detections| DesktopEditor["Companion Scan Spatial Editor"]
| Feature | What it provides |
|---|---|
| Place-first capture | Group scans into Places and Areas while retaining each scan's provenance. |
| Replaceable vision | Select Ollama, ONNX or deterministic mock inference through one boundary. |
| Offline recovery | Queue writes when disconnected and export scene geometry as GLB. |
- AR scanning — the 8th Wall XR Engine's SLAM tracks the environment, and the scanner accumulates a point cloud in real time. Each live point is a position (x, y, z) with no camera colour (
tests/unit/node/frame_epoch_eighthwall.test.ts); the colour in an exported GLB comes from each point's height, blue at the lowest to red at the highest (tests/unit/node/glb_provenance.test.ts). The engine is Niantic Spatial's proprietary binary (public/xr.js), free to use but not open source; see NOTICE.md. WebXR (/webxr.html) and, in the phone apps, the native ARKit or ARCore session (ScanAR) are the other runtimes; see Device targets. - Engine-agnostic inference — object detection runs through the local API server, whose engine is chosen by
INFERENCE_MODE:ollama(default, runs whateverOLLAMA_MODELnames —qwen3-vl:4bby default, with the context window pinned byOLLAMA_NUM_CTX),onnx(bundledLiquidAI/LFM2.5-VL-1.6B-ONNXviaonnxruntime-node), ormock(deterministic colour-blob CV engine for CI/tests). An on-device WebGPU path also exists in the web app — opt-in, offered wherever the browser exposesnavigator.gpu; the Android, iOS and desktop apps leave it out (see Inference below).npm run eval:cv/npm run bench:modelsscore/inferoutput against ground truth from a corpus selected byCV_CORPUS:real(default,test-data/real/) is human-verified photographs — the only fixture that can tell a working vision model from a fabricating one, so it's whatbench:modelsuses to rank candidates;synthetic(test-data/cv/) is the generated colour-rectangle corpus, a regression fixture for the mock engine only — scoring a real model against it warns loudly instead of reporting a silent 0%. As of this writing the real corpus is scaffolded but has 0 photographs (a manual/physical step, not yet done — seedocs/factory/06-detection-ground-truth/), sobench:modelscannot rank models until it is populated. - 3D object pins — detected objects are placed at their SLAM-resolved world positions as live 3D labels tracking the scene.
- Onboarding Overlay — 2-step interactive overlay guiding users through permission prompts and walking speed. Its second step lists this install's setup status (see First-run setup status and settings). Bypasses automatically on CI/mocks and replays on help button click.
- HUD Quality Verdict — Real-time rendering of
qualityMonitor.summary()status directly on the phone HUD as a colorized verdict chip (✓ Ready,⚠ Review,❌ Sparse) next to the status row. - Capture bar — Objects, Tag, the shutter, More and Stop in one row along the bottom of the camera view (
tests/unit/node/wp-ui-rail-and-footer.test.ts). Stop asks first, saves the scan, sends it to the server and ends it; the start screen then says what was saved (tests/mock-native-ar.spec.ts). Auto-capture is on when a scan starts, until you turn it off. - Accidental Leave Guards — Intercepts navigation buttons and window unload requests if active point cloud data or poses are in memory to prevent accidental scan losses.
- Quality-gated export — Gating manual exports behind a confirmation prompt when scan quality is poor (
needs-rescan). Displays a "View in 3D →" quick redirect link in the HUD status line on successful export. - More, and the scan sheet — More holds the toggles used while scanning (Auto, Stream, Person, Gimbal) and the ways to the scan (History, 3D, Export, Switch). Objects and Export open one bottom sheet with Objects, Export and Settings tabs; History is a sheet like it.
- Session persistence — every scan is saved to IndexedDB; browse, reload, edit, or delete past sessions from the History sheet.
- GLTF export — exports the full scan (point cloud + camera path + labelled boxes) as a
.glbfile, saved locally and uploaded to the server. - Role-scoped Place links — view, comment, edit, scanner, and owner links carry capability tokens; regular project manifests redact stored tokens, and sign-in,
WORLD_STRICT_AUTH=1orSCAN_REQUIRE_AUTH=1turns on strict world authorisation on the/worlds/<slug>routes. - Processing queue foundation — world jobs cover ingest, layer extraction, alignment, point merging, semantic passes, depth reconstruction, splat training, and world export; the local coordinator validates inputs and records artifacts while heavier Open3D/CV/splat workers remain pluggable.
- Automatic scan optimization — every upload is queued as an
optimize-scanWorldJob (single-flight, crash-recovering): quantization + Draco + point-cloud LODs (.opt.glb,.lodN.glb,.manifest.json), roughly halving file size. - Keyframe streaming — once you have allowed camera frames, each scan streams pose+intrinsics-tagged keyframes to the server while you walk (☁ Stream under More turns it off): reconstruction-ready
FrameObservationsidecars underscans/sessions/. The native iOS app also locks exposure, sends its measured lens, holds back blurred frames and takes them more densely (mobile/README.md). - Live geometry to desktop — the WebRTC live stream also carries point-cloud deltas, detections, and camera pose; the desktop editor shows the scan growing in real time.
- Companion Scan Spatial Editor —
/editorplaces scans in a shared ENU Place frame with transform gizmos, semantic tagging, layer toggles, guided processing, and progressive LOD-first loading (Draco-aware). - PWA — installable on iOS/Android with app-shell caching and an offline write queue for uploads, keyframes, patches, jobs, summaries, and project writes.
This is the single biggest difference between a scan that reconstructs and one that does not, and it is not a tuning problem.
Monocular structure-from-motion locates a 3D point by intersecting the rays to it from two camera centres that are in different places. Rotate on the spot and there is no second place: the rays are collinear, the intersection is undefined at any noise level, and the two-view geometry collapses to a homography. COLMAP has a name for this exact condition — it reports such pairs as PLANAR_OR_PANORAMIC. No amount of extra frames, better exposure, or matcher tuning changes it.
Three captures from this repo, ordered by how much the camera actually moved:
| Capture | Frames | Camera motion | COLMAP result |
|---|---|---|---|
Walkthrough video, sess-video-20260830-033839 |
32 | translating through the space | 32 / 32 registered, 9362 points, 27.6 s — trained to a usable splat |
Handheld phone, sess-a7e2f642-… |
17 | near-in-place; rotation dominated translation | 3 / 17 registered, 1 triangulated point |
| Gimbal dome, one station | 9 | effectively none — lens offset from the pan/tilt axes only | 4 / 9 registered; 29 of 36 pairs PLANAR_OR_PANORAMIC |
(Row 1 is scans/sessions/sess-video-20260830-033839/colmap-poses.manifest.json, still on disk. Row 2's session is on disk but its solve manifest is not — those numbers, and the re-runs that showed the ratio is reproducible on a bad capture while the point count is not, are recorded at server/colmap/colmap_poses.ts:204-236. Row 3 is from ADR 0007, sourced from docs/operations/GIMBAL_INTEGRATION.md.)
So, when you capture:
- Walk. Move through the room and keep moving while recording — down a hallway, around a table, along a wall. Sideways steps buy you more than sweeps do.
- Orbit things, don't pan across them. To capture an object, circle it. Standing in one spot and turning to face it is the failure case above.
- Give the shot a baseline comparable to the depth of what you're looking at. Baselines measured for the two rows above (ADR 0007): the 32/32 run reached ~13.6 units against a 2.2–2.5 unit scene depth — several times the depth it was looking at; the 3/17 run reached 0.88 m over a 3.62 m path while rotating 90.4°.
- Keep overlap while you move, so features survive between viewpoints — translate steadily rather than jumping between disconnected vantage points.
- A rotation-only sweep is a panorama, not a reconstruction capture. It is the ideal input for a 360° projection and a useless one for SfM; those are the same property seen from two sides. Don't run a dome and expect a 3D model.
Check the verdict, don't assume it. A solve that ran, exited 0, and wrote real files still reports status: "ok" — the 3-of-17 capture above did exactly that. The usable signal is the quality block a colmap-poses job now writes into colmap-poses.manifest.json: quality.registrationRatio, quality.degenerate, and quality.status (a ScanReviewStatus — ready / needs-rescan), with quality.reasons saying which gate tripped and quality.thresholds recording what it was judged against. The defaults are a 0.6 registration ratio and a 100-point floor, both overridable (COLMAP_MIN_REGISTRATION_RATIO, COLMAP_MIN_POINTS3D). Treat degenerate: true as "go back and walk the room again", not as something to tune around.
| Tool | Version | Purpose |
|---|---|---|
| Node.js | ≥ 26.13.0 | The API server (node server/main.ts, run by type stripping), the Vite dev server and build, every script |
| Python 3 | ≥ 3.8 | Model downloader |
ffmpeg (with ffprobe) |
any | /ingest-video — scripts/ingest-video.mjs shells out to it. Missing, an Upload Content video fails with spawnSync ffmpeg ENOENT inside an HTTP 500. /ingest-photos does not need it: scripts/ingest-photos.mjs reads and scales photos in Node, with sharp or jimp |
AR scanning needs a phone or tablet with a camera, or a headset with WebXR; see Device targets. The 3D viewer and inference server work on desktop. The Upload Content path — a walkthrough video or photos, no phone, tailnet, cert or AR engine involved — needs only ffmpeg on the server.
Everything downstream of a capture — poses, points, splat, segmentation — is an external program the server shells out to. None of them is a deployment requirement: an absent tool makes its job complete as skipped carrying a remediation string, never fail, so a box with none of these installed still runs the whole queue green.
| Tool | Used by | How it is found |
|---|---|---|
| COLMAP | colmap-poses, and the automatic pose solve inside splat-train |
COLMAP_BIN if set (taken at its word), else PATH, else ~/.local/micromamba/envs/colmap/bin/colmap |
| Brush (default splat backend) | splat-train |
BRUSH_BIN, else ~/brush/target/release/brush-cli |
Spirula Studio (alternative splat backend, SPLAT_BACKEND=spirula) |
splat-train |
SPIRULA_BIN, else ~/opt/spirula/spirula, ~/.local/bin/spirula, /usr/local/bin/spirula |
| LingBot-Map / SenseNova / panoptic segmenter | their own job types | a venv interpreter named by env var — see the sections below and .env.example |
which colmap finding nothing does not mean COLMAP is missing. The supported install is a micromamba environment (~/.local/micromamba/envs/colmap/bin/colmap), which is not on a normal login PATH — so command -v colmap reports nothing on a box where COLMAP is installed and working. That is why resolveColmapBin() (server/colmap/colmap_poses.ts:177) probes that path after PATH, and why the manifest records the absolute binary it actually ran. Check params.colmapBin in a session's colmap-poses.manifest.json before concluding anything from which. The same shape applies to Brush and Spirula, neither of which is normally on PATH either.
The opposite trap for ffmpeg: it is on PATH here, but the server resolves it from the PATH it was started with. Installing ffmpeg without restarting the server leaves /ingest-video failing while a fresh shell says everything is fine (scripts/ingest-video.mjs:102-113).
Rather than checking any of this by hand, ask the box — server/capabilities.ts probes every external tool the pipelines shell out to, the same way the runners resolve them:
node server/capabilities.ts # --json for the report as JSON, --no-versions to skip the version probesSee docs/operations/PLATFORM_SUPPORT.md for what it reports, and docs/operations/COLMAP_SETUP.md for the COLMAP install itself.
The 8th Wall SLAM engine is committed to this repo at public/xr.js — nothing to download.
It is Niantic Spatial's XR Engine and carries its own licence agreement, reproduced in that
file's header and separate from this repo's licence.
The four Android remote-control MCP servers are defined in the tracked
.mcp.json. It uses ${ANDROID_MCP_TOKEN_*} expansion, so keep bearer tokens
out of .mcp.json, README.md, and source control — set persistent
environment variables instead (a .mcp.local.json file is gitignored, but
Claude Code does not automatically merge it with .mcp.json, so it is not a
working alternative today). On Windows, set the four user environment
variables:
[Environment]::SetEnvironmentVariable("ANDROID_MCP_TOKEN_TAB_S8_ULTRA", "<tab-s8 token>", "User")
[Environment]::SetEnvironmentVariable("ANDROID_MCP_TOKEN_TAB_S9_ULTRA", "<tab-s9 token>", "User")
[Environment]::SetEnvironmentVariable("ANDROID_MCP_TOKEN_BEAM_PRO_1", "<beam-pro-1 token>", "User")
[Environment]::SetEnvironmentVariable("ANDROID_MCP_TOKEN_BEAM_PRO", "<beam-pro token>", "User")Close and reopen the terminal after setting them. The URLs must remain the
plain HTTP endpoints ending in /mcp.
Then start Claude Code from this repository, accept the workspace trust prompt, and approve the project MCP servers when prompted:
cd C:\devel\ci\Companion-Scan # your clone's folder; CI-Spatial if you cloned it before the rename
claudeVerify the result in a second terminal:
claude mcp listAn entry shown as Pending approval is configured but not enabled for this
project. If the project choices are stale, run claude mcp reset-project-choices,
restart Claude Code in the repository, and approve the servers again. MCP
configuration is loaded when the Claude Code session starts.
C:\Users\<user>\AppData\Roaming\Claude\claude_desktop_config.json is the
Claude Desktop configuration and is not the project configuration used by
Claude Code. Claude Code's user-level registry is C:\Users\<user>\.claude.json;
the simplest portable setup for this project is the tracked .mcp.json, the
four user environment variables, and one-time project approval.
For the full device table, token-variable alternative, adb fallback, and server health troubleshooting, see docs/testing/DEVICE_TESTING.md.
These are the server's settings, and they apply whichever target is in use. Running and testing the server: docs/targets/server.md.
The second step of the first-run overlay lists three things about this install. Each row comes from an endpoint on the scanner's own origin (in the apps, on the Scan server set on the device; see below). The status rows contact no third-party host and show no address or key. The one exception is the apps' Server row, which names the host the person typed.
| Row | Read from | What it says |
|---|---|---|
| Companion Memory | GET /memory/status |
Connected, set up but not reachable, or not connected. Not connected points to Companion Hub. |
| Model | GET /health (model, engineLoadState) |
The model in use, and whether it loaded. If it did not load, scans run in server-only mode and get no object labels. |
| Sign-in | GET /authenticate/status |
"Sign in with Companion Account" when sign-in is on, or "Off on this install." In the native shell, "Signed in." once the shell holds a session. |
A row reads "Status unavailable." when its endpoint does not answer. When none of the three answers, as on the static public site, one Server row replaces them: "None answered. Sign-in, saved projects and object labels need one." Reading the Companion Memory row makes the server probe the configured Companion Memory once: an empty-batch POST with a five-second timeout.
engineLoadState: ready means Ollama answered and a model was resolved. It does not mean a capture has run. The engine loads once, when the server starts, and is not retried, so start Ollama before the server, or restart the server after you start Ollama.
The apps have no server of their own. They talk to the person's own Scan server, such as the one on their Companion Hub, and its address is set on the device. In the Android and iOS apps a Server row comes first on the second step: "None set" with an Add server control, the server's host with a Change control, or the host followed by "did not answer". The control opens a form that tests the address (GET /health) and saves it. The editor has the same form under Navigate, Scan server, and asks for an address when none is set. The phone apps also end the list with Legal notices (and the editor's Navigate menu has it too), which shows Companion Scan's licence, the Niantic Spatial XR Engine notice in the apps that bundle the engine, Google's ARCore notice in the Android app, and the licences of the other third-party software in the app (src/ui/legal-notices.ts). The desktop app opens the editor and never shows the first-run screen, so its Navigate menu holds all of this: Scan server, Legal notices, and the account control that signs in. Either way the address is kept in the app's storage (companion-scan-server, src/shared/api-base.ts), and saving a different server drops the session token, which belongs to the old one. A build can name a default server with VITE_API_BASE; an address saved on the device wins over it. The hosted web app never reads the saved address, so the public site behaves as it always has.
Only https:// addresses are accepted, and an address is an origin: no path, query or user name. Plain http is refused rather than allowed, because no documented setup needs it. A Companion Hub serves its apps over HTTPS, a self-hosted server on a tailnet uses a tailscale cert certificate (docs/operations/DEPLOY.md), and the phone browser already needs HTTPS for the camera. The Android app refuses cleartext and mixed content (mobile/capacitor.config.ts), the desktop app's content security policy allows only https: and wss: to remote hosts, and the session token must not cross a network in clear text. A server that only answers plain http on a LAN needs TLS in front of it before the apps can use it.
The server reads these settings. Defaults are the code's own, and the Hub column says where Companion Hub supplies a value.
| Variable | Default | Effect | Companion Hub |
|---|---|---|---|
LISTEN_HOST |
127.0.0.1, this machine only |
The address the API listens on. Phones and browsers reach the API through Vite's HTTPS port, which forwards to it there. 0.0.0.0 (every interface) or one address of this machine lets other machines call port 8000 itself; with sign-in off the server then prints a warning at start, and serves anyway. The default closes port 8000 only: Vite's HTTPS port listens on every interface and forwards the scan and Place routes, so with sign-in off anyone who reaches it can still read and delete every scan. Sign-in is what protects them. A value that is not an IP address stops the server at start (DEPLOY.md; tests/unit/server/listen_host.test.ts, tests/unit/server/listen_host_server.test.ts). |
The Docker image sets 0.0.0.0: the container's port is the way in. |
INFERENCE_MODE |
ollama |
Engine: ollama, onnx, mock or grounding-dino (which also needs GDINO_URL, and GDINO_TOKEN when the service has one). |
Not set by the Hub. |
OLLAMA_HOST |
http://localhost:11434 |
Ollama address. A bare host:port is accepted. |
From the Hub's AI settings (hub_integration.inference). |
OLLAMA_MODEL |
qwen3-vl:4b |
Vision model to run. If that tag is not pulled, the server uses a substitute, and /health reports the one in use. |
From the Hub's AI settings (vision_model). |
OLLAMA_NUM_CTX |
8192 |
Context window for each Ollama call. Values above 131072 are clamped; invalid values fall back to 8192. | Not set by the Hub. |
OLLAMA_NO_THINK |
auto |
How a thinking model is kept from reasoning. auto asks a Qwen3-family model once at start-up and uses think: false if it honours it, else answers it with its reasoning closed; think-false or prefill skips that check. /health's noThink says which is in use. |
Not set by the Hub. |
CI_SERVER_URL |
unset (memory push inert) | Companion Memory API base, for example http://host:8642/api. |
Written after the user connects Companion Memory in the Hub. |
CI_SERVER_TOKEN |
unset (memory push inert) | Companion Memory API key, sent as x-api-key. No route or screen shows it. |
Written after the user connects Companion Memory in the Hub. |
VPS_WORKER_URL |
unset (the visual map jobs skip, with a hint) | The private OpenVPS worker, subsystems/vps-worker/: an http(s) URL, and one with a user name or password is refused. The worker takes no token, so it must answer this server alone; on this PC both run in containers, on a private Docker network where it is http://vps-worker:9050. The capability report's vps-worker row shows its origin only. |
Not set by the Hub. |
PORTAL_OIDC_ENABLED |
off | 1 or true turns on "Sign in with Companion Account". With an OIDC_ISSUER_URL, this also turns on strict world authorisation. |
The app form's sign-in switch (default off). |
OIDC_ISSUER_URL |
unset | CI-Portal base URL. Sign-in stays off while it is empty. The sign-in endpoints are discovered from it. | From the Hub's Companion cloud URL (hub_integration.oidc). |
OIDC_CLIENT_ID |
ci-web-xr-scan |
Must match the CI-Portal client registration. Do not rename it. | Not set by the Hub. |
APP_BASE_URL |
the origin the page was opened at | Public origin the server sends people back to: the sign-in redirect, the device sign-in page and the share links. Unset, it is the origin the request came in on, which through Vite on this machine, or a proxy in HUB_TRUSTED_PROXY_CIDRS, is the HTTPS page the person opened, from the proxy's X-Forwarded-Host and -Proto (server/forwarded.ts; tests/unit/server/sign_in_vite_server.test.ts). Set it when people reach the server through a proxy it does not trust. With sign-in on, APP_BASE_URL unset and LISTEN_HOST off the loopback address, the server prints a warning at start that names it. Its host is also a name the API answers to (server/host_check.ts; tests/unit/server/host_check_server.test.ts). |
Set by the Hub when the app is exposed (to confirm for this app). |
APP_LOCAL_DOMAIN, APP_DOMAIN, APP_BASE_HOST |
unset | More names the API answers to; a request for any other dotted name that no setting gives is refused with 421 (server/host_check.ts; tests/unit/server/host_check_server.test.ts). |
Set by the Hub for every app: the <app>.<LOCAL_DOMAIN> name its router and the Cloudflare tunnel reach the app by, the app's public name or the Hub's LAN host and port, and the host of APP_BASE_URL (COMPANION_HUB.md). |
HUB_GATEWAY_ALLOWED_HOSTS |
unset | More names the API answers to, comma-separated; an entry after a leading dot, such as .ts.net, stands for every name under it. Unset while one of the three above is set (a Hub that writes no list), the API answers host.docker.internal and every name under .ts.net, .local, .lan, .home, .home.arpa and .internal (server/host_check.ts; tests/unit/server/host_check.test.ts, host_check_server.test.ts). |
Set by the Hub v0.3.17 and later for every app: its tailnet names (.ts.net, for Private VPN's tailscale serve), host.docker.internal, the Private VPN router's <app>.<store>, the tunnel's name, and the LAN suffixes when the app's port is open on the network (COMPANION_HUB.md). |
HUB_TRUSTED_PROXY_CIDRS |
unset: this machine only | The proxies whose X-Forwarded-For, -Proto and -Host the server believes, comma-separated addresses or ranges such as 172.18.0.5/32 or fd00::/8. A loopback peer (Vite, vite preview, any proxy on this machine) is always believed; every other peer's forwarded headers are ignored, so nobody who reaches the API's port directly chooses the address a sign-in is sent back to, the rate-limit bucket it is counted in, the address the device approval page shows, or a cookie's Secure flag. From a trusted proxy the client's address is the nearest X-Forwarded-For entry that is not a trusted proxy, the connection is HTTPS when the last X-Forwarded-Proto entry says so, and a forwarded host counts only when it is a name the API answers to. An entry that is neither an address nor a range is left out, with a warning at start (server/forwarded.ts; tests/unit/server/forwarded.test.ts, forwarded_server.test.ts). |
Set by the Hub v0.3.2 and later for every app: Traefik's address on the Hub network and the edge hops before it (cloudflared, the Tailscale sidecar), each as a /32, and left out when it can vouch for none (COMPANION_HUB.md). |
PORTAL_OIDC_ALLOWED_EMAILS |
empty, which admits nobody | Comma-separated allowlist of signed-in emails. Fails closed. | The app form's allowlist field. |
SESSION_SECRET |
a key the server keeps | Signs the sign-in session: the browser cookie and the native shell's token. Unset, the server makes a key on its first start with sign-in on and keeps it in the worlds folder (WORLDS_DIR/.session-secret, readable by its owner alone), so a restart signs no one out; deleting the file signs everyone out. Set it to choose the key yourself. |
Not set by the Hub. |
When Companion Hub hosts the scanner, the Hub fills the memory and inference values from the app's store manifest (hub_integration in ci-web-xr-scan/config.json in the CI-Marketplace repo), so nobody types them by hand. The Hub writes the memory values after a completed connect. The app form also has advanced fields for an external Companion Memory, which you can fill instead. The server reads its memory settings once at boot, so a connect needs a server restart. Whether the Hub restarts the app itself is to confirm.
The sign-in endpoints (authorize, token, userinfo and JWKS) are not set by hand. The server reads them from CI-Portal's OpenID metadata, at ${OIDC_ISSUER_URL}/.well-known/openid-configuration or, where CI-Portal serves it under its auth routes, at ${OIDC_ISSUER_URL}/api/auth/.well-known/openid-configuration. It accepts the metadata only if its issuer is OIDC_ISSUER_URL, every endpoint is on that origin, and PKCE S256 is offered. The boot log says what it found. If neither location can be read, the server uses the usual /api/auth/ paths and logs a warning. PORTAL_OIDC_JWKS_URI overrides the JWKS URL only.
Sign-in is off unless PORTAL_OIDC_ENABLED is on. The first-run control starts it at /authenticate/oidc?redirect=/, which returns to the scanner after CI-Portal. A direct visit to /authenticate/oidc lands in the world editor instead. When sign-in is off, the only sign-in route registered is /authenticate/status. A native shell starts the same sign-in with shell=1, a PKCE challenge and a state of its own, which the server hands back beside the code so the app can ignore a return it did not ask for, and gets its session from POST /authenticate/shell/exchange; see mobile/README.md. The desktop app sends shell=desktop instead, and the server hands its code back at computer.ci.scan.desktop://auth rather than the phone app's scheme. CI-Portal only ever redirects to the Scan server's own /authenticate/oidc/callback, so neither app scheme is registered with the Portal.
An app that cannot come back from a browser, such as the Unity apps on a Quest 3, an XREAL Aura or a phone, signs in with a code instead (server/device_sign_in.ts, the OAuth device grant of RFC 8628). It asks POST /authenticate/device/code for a code and shows it beside a QR of the approval page. The person opens /authenticate/device on a phone or laptop, signs in with their Companion Account as usual, checks that the code matches, ticks that the device is with them and that they started the sign-in, and approves. The app's next poll of POST /authenticate/device/token gets the same session token a shell exchange hands out. A code lasts five minutes and works once: 8 letters, with no digits and no I, L, O or U. The app polls no faster than its interval (5 seconds); each early poll adds 5 seconds, and the third burns the code. Only the Unity apps' ids may ask (DEVICE_CLIENTS). The approving phone has to reach this server, so on a tailnet install it has to be on the tailnet too.
A pasted session token (the Unity apps' fallback). The Unity apps also take a token typed into their settings, Companion.Token.ScanServer (or COMPANION_SCAN_SERVER_TOKEN in their environment), and send it as Authorization: Bearer when no Companion Account is signed in on the device. The server has no token of its own for that field: what works there is a session token, the one the device grant hands out, which the guard takes like any other session of an allowlisted account (tests/unit/server/device_sign_in.test.ts, tests/unit/server/scan_session_guard.test.ts). To get one without the app, run the device grant from a terminal with the Unity Scan app's id: POST /authenticate/device/code with client_id=companion-unity-scan, open its verification_uri_complete in a browser signed in with an allowlisted account and approve, then POST /authenticate/device/token with grant_type=urn:ietf:params:oauth:grant-type:device_code, the device_code and the same client_id, no faster than every 5 seconds, until the answer carries access_token. The token lasts seven days. It outlives a restart, since the key that signs it is kept (tests/unit/server/session_secret.test.ts), and stops working when that key changes: the .session-secret file deleted or SESSION_SECRET changed, which ends every session. Taking its account off PORTAL_OIDC_ALLOWED_EMAILS ends it at the next request. One token alone cannot be revoked: keys for one device that can be revoked are not built, and whether to build them is the owners' decision.
Once sign-in is on, the API needs a Companion session. The session comes as the browser cookie or as a Bearer token from an app (the phone and desktop apps, the Unity apps), and never in a URL: a session sent as ?token= is refused. A request that cannot carry a header (an image, a download link, a socket) carries a URL token instead, which a signed-in app asks POST /authenticate/url-token for. It opens one path, or the files of one scan, for one use (a GET or HEAD, or a socket's opening request), for five minutes, and the guard accepts it there alone (tests/unit/server/scan_session_guard.test.ts, tests/unit/server/ws_upgrade_routes.test.ts). The data, write and compute routes (scans, sessions, projects, uploads, ingest, inference, jobs, events) answer 401 without a session or such a token, and /health, /authenticate/* and the app bundle stay open. The reads of one world's record stay open too, and writes through the /worlds/<slug> routes need that world's token (below). SCAN_REQUIRE_AUTH=1 applies the same session gate with sign-in off, and then no request gets through it. A public Scan needs sign-in on.
Update a server that has sign-in on together with the phone and desktop apps, or before them. An app from before URL tokens puts its session in ?token= on those requests, which an updated server refuses, so its pictures, download links and live sockets get 401 there; its other requests carry the session as Bearer and still work. An app with URL tokens asks an older server for one and gets 404 while /authenticate/status says sign-in is on. It then sends those URLs without a credential, which that server refuses as well, and its console says to update the server (tests/unit/node/url_token.test.ts; mobile/README.md).
Turning sign-in on also turns on strict world authorisation. Sign-in is on when PORTAL_OIDC_ENABLED is on and OIDC_ISSUER_URL is set, and no flag turns strict mode off while it is (server/wp-a-auth.ts, tests/unit/server/wp-a-auth.test.ts). With sign-in off, WORLD_STRICT_AUTH=1 turns strict mode on by itself, and SCAN_REQUIRE_AUTH=1 turns it on together with the session gate. Only the value 1 turns either flag on.
A world token is the token in one of a world's share links (owner, editor, commenter, viewer or scanner), sent as ?token= or Authorization: Bearer. A Companion session is not a world token, and a world route reads one only from Authorization: Bearer: a session sent as ?token= is refused there like any token that is not the world's (403, tests/unit/server/server_core_world_access.test.ts). In strict mode:
Request on one world (/worlds/<slug>…) |
What it needs |
|---|---|
GET of the record, /patches, /comments, /jobs |
Nothing, even with sign-in on. The record holds the world's name, location, scans, Things and comments. Its share tokens are blanked for a caller with no token. |
GET /frames/:scanId, GET /export.glb |
A viewer token or higher |
POST /comments |
A commenter token or higher |
GET /share, POST /patches, POST /patches/revert, POST /jobs |
An editor token or higher |
POST /members (an agent key) |
An editor token or higher |
POST /members/:memberId/revoke |
The owner token, also without strict mode |
So a signed-in person who opened the editor with no world token can read the world, and the world's patch, comment and job routes refuse their writes. A sign-in started by visiting /authenticate/oidc directly ends in the editor with the default world's owner link. These rules are held by tests/unit/server/server_core_world_access.test.ts and tests/unit/server/export_route_guard.test.ts.
Strict mode covers only the /worlds/<slug> routes. The Place (/projects), scan, session and /process-scan routes never ask for a world token, except the two below, and some of them change or delete a world. Among other things, a caller they admit can rename a Place (PUT /projects/:id), delete a scan, which takes it out of its world (DELETE /scans/:filename), delete a Place that has no scans left, together with its world file (DELETE /projects/:id), and queue a job into a Place's world (POST /process-scan) even though POST /worlds/<slug>/jobs refuses that caller (tests/unit/server/server_core_world_access.test.ts). Who they admit:
- Sign-in on: any account on the allowlist, with its session and no world token.
- Sign-in off,
WORLD_STRICT_AUTH=1alone: anyone who can reach the server, with no credential. They can also create worlds (POST /worlds). This flag does not protect a shared server: turn sign-in on.
The two exceptions: a Place's visual maps (ADR 0018, wave 22 ticket 0004). PUT /projects/:id/vps-maps/:revisionId/status and DELETE /projects/:id/vps-maps/:revisionId ask for an owner token of the Place's own world (project-<id>, the world GET /projects/:id/world reads) on every install, an open one included, whatever the strict flags say. The token comes as ?token= or Authorization: Bearer, and only an owner whose record is neither revoked nor expired counts:
| Caller | What the two routes answer |
|---|---|
| No member token, on any install | 401 |
| A viewer, commenter, editor or scanner token | 403 |
| A token that is no member's of this world: a revoked or an expired owner token, another world's | 403, and 401 beside a valid session, which reads as a request with no member token (F-05) |
| The owner token | Let in, to the route's own answers |
| Sign-in on: a Companion session alone | 401: a session is never an owner token. The /projects session guard runs first, so a write needs the session and the owner token both |
GET /projects/:id/vps-maps asks for no token, as GET /projects/:id asks for none. Nothing hands an owner link out yet (the Share menu offers view, comment and edit links), so these two routes can be used only by someone who can read worlds/project-<id>.json on the server; how an owner gets the link is an open decision of wave 22. The routes that ask for no token can still make a Place's maps stale (PUT /projects/:id/spatial-frame) or delete them (the scan, session and Place deletions), as retention requires. These rules are held by tests/unit/server/vps_map_routes.test.ts.
.
├── index.html # AR scanning app entry point
├── viewer.html # Standalone 3D viewer / World Editor entry point
├── scanner.html # Share-link scanner redirect entry point
├── webxr.html # WebXR-forced runtime entry point
├── xr-world.html # Headset world editor (immersive-vr) entry point
├── ar-hittest-sphere.html # 8th Wall hit-test prototype (diagnostic)
├── ar-ground-anchor.html # Ground-anchor calibration prototype (diagnostic)
├── download_models.py # ONNX model download helper
├── vite.config.ts # Vite + Tailscale HTTPS config (also the Rollup multi-page build input)
├── playwright.config.ts # Playwright project configurations
├── package.json
├── tsconfig.server.json # Type-check config for server/ and scripts/*.ts (npm run typecheck:server)
│
├── server/ # All server-side modules, run by Node 26 as TypeScript (grouped out of the repo root)
│ ├── main.ts # HTTP + WebSocket routes, CORS allowlist, capability-token auth
│ ├── inference.ts # Engine-agnostic inference (ollama / onnx / mock)
│ ├── prompt.ts # VLM prompt builder + JSON parser
│ ├── jobs.ts # Legacy Job/OptimizeScanManifest shapes (queue retired — ADR 0003)
│ ├── pipeline.ts # Scan-optimization pipeline (dedup/LOD/quantize/Draco)
│ ├── portal_auth.ts # OIDC "Sign in with Companion Account" (CI-Portal)
│ ├── memory_push.ts # CI-Server /v1/events memory push
│ ├── scan_id.ts / scan_index.ts / session_id.ts / thing_match.ts / sensenova_vision.ts / exec_probe.ts
│ ├── repo-root.ts # REPO_ROOT — resolves paths outside server/ (scripts/, public/models/)
│ ├── migrations/ # migrate_jobs.ts, migrate_scan_ids.ts (one-shot data migrations)
│ ├── world/ # world_job_pump.ts (single-flight WorldJob pump), world_lock.ts,
│ │ # world_membership.ts, world_prune.ts
│ ├── splat/ # splat_train.ts (Brush) + spirula_train.ts (Spirula Studio) — the
│ │ # two SPLAT_BACKEND drivers behind one job type; splat_detect.ts
│ │ # (OWLv2), splat_finish.ts (@playcanvas/splat-transform),
│ │ # splat_align.ts, splat_train_dataset.ts
│ ├── colmap/ # colmap_poses.ts (pose solve + quality verdict), colmap_model.ts
│ ├── panoptic/ # panoptic_scan.ts, panoptic_segments.ts, panoptic_lift.ts
│ ├── person4d/ # person_4d.ts (off-box 4DAnyone delegation — ADR 0006)
│ ├── vps/ # vps_map_write.ts, vps_map_deletion.ts, vps_map_routes.ts (a Place's
│ │ # visual map revisions: their writers, deletion and owner routes, ADR 0018);
│ │ # vps_worker.ts (the private OpenVPS worker's client and skip contract)
│ └── lingbot-map/ # lingbot_map.ts, lingbot_map_glb.ts (LingBot-Map reconstruction glue)
│
├── public/
│ ├── xr.js # 8th Wall SLAM engine (committed; separately licensed)
│ ├── manifest.json # PWA manifest
│ ├── sw.js # Service worker (precache + offline write queue)
│ ├── icon-192.png # app icons, drawn by npm run gen-icons (scripts/generate-icons.mjs)
│ ├── icon-512.png
│ ├── icon-maskable-512.png # maskable variant: the mark sits inside the safe circle
│ ├── apple-touch-icon.png # iOS home-screen icon (180 px, opaque)
│ ├── camera-check.html / compass-bench.html / smoke.html # device diagnostic pages
│ ├── models/ # ONNX model files for INFERENCE_MODE=onnx (gitignored, 2.2GB;
│ │ # populated by download_models.py; also what the browser
│ │ # downloads for on-device inference — see "Inference" below)
│ └── resources/ # 8th Wall worker scripts + tflite models
│
├── scans/ # Uploaded .glb scan files (created at runtime, repo root)
├── worlds/ # World manifests, edit patches, and queued jobs (created at runtime)
│
├── src/ # Frontend — unaffected by the server/ regrouping above
│ ├── main.ts # Frontend app bootstrap
│ ├── pwa.ts # Service-worker registration + offline write queue
│ ├── ar/ # provider.ts, eighthwall.ts, webxr.ts, native.ts (ScanAR),
│ │ # native-bridge.ts, runtime-select.ts, scanner.ts
│ ├── capture/ # capture.ts, auto-capture.ts, keyframes.ts, quality-monitor.ts
│ ├── inference/ # router.ts, server.ts, webgpu.worker.ts, prompt.ts,
│ │ # lfm-driver.ts, model-provisioning.ts
│ ├── scene/ # store.ts, pointcloud.ts
│ ├── spatial/ # resolver.ts (2D bbox → 3D world position)
│ ├── export/ # gltf.ts, summary.ts
│ ├── ui/ # overlay.ts, panel.ts, history.ts
│ ├── viewer/ # editor + layers: viewer.ts, editor.ts, assets.ts,
│ │ # geomap.ts, lingbot-map.ts, livefeed.ts, measure.ts, measure-area*.ts,
│ │ # splat-toolbox.ts, splat-viewer.ts, splat-layer.ts,
│ │ # splat-detect-layer.ts, xr-world.ts (headset editor)
│ ├── world/ # types.ts (WorldProject/ScanManifest/LayerManifest/EditPatch),
│ │ # geo.ts, layers.ts, vps-maps.ts (the visual map revision rules)
│ ├── geo/ # geo-tracker.ts (device geolocation tracking)
│ ├── project/ # project-store.ts
│ ├── rtc/ # broadcaster.ts (WebRTC live geometry)
│ ├── debug/ # remote-log.ts
│ ├── shared/ # cv-palette.ts, test-homes.ts, session-id.ts
│ └── test/ # webxr-emulation.ts
│
├── scripts/ # Node, shell and Python dev scripts — see Development Scripts below
│
├── tests/
│ ├── *.spec.ts # Playwright specs (AR flow, API/CV-mock, house-readiness,
│ │ # test-homes, video-ingest, e2e-suite, editor/lingbot/splat
│ │ # mocks, webxr-emulated, xr8-scan, project, server) + fixtures/, support/
│ └── unit/
│ ├── server/ # The server unit suite (node:test) — inference_mock, lingbot_map,
│ │ # memory_push, portal_auth, scan_index, session_id, splat_*, …
│ └── node/ # Node unit suites — detection_store, editor_pick, glb_provenance,
│ # lingbot_map_glb, pipeline_detection_graph, resolver
│
├── mobile/ # Capacitor 8 shell: the Android and iOS apps (ScanAR plugin)
├── desktop/ # Tauri 2 desktop app: the editor and viewer, no capture
├── deploy/ # systemd units, launchd agents + env template for a persistent deployment
├── docs/ # adr/, factory/ (ticket waves + the atlas), operations/, pipelines/,
│ # product/, targets/ (one page per device target), testing/
├── video/ # Self-contained marketing/capture tool (own package.json)
├── subsystems/4d-capture/ # Off-box 4D person reconstruction (ADR 0006; own package.json)
├── subsystems/osmo-ble/ # Self-contained BLE gimbal-control subsystem (own package.json)
├── subsystems/scan-assist/ # Read-only MCP server over one Place, off by default (own package.json)
└── subsystems/vps-worker/ # Private OpenVPS worker: MapLocalizer and HLOC map builds on an NVIDIA GPU (ADR 0018; own package.json)
The server's unit suite lives under tests/unit/server/. It ran on Deno until wave 18, as
tests/unit/deno/, and moved with the server to Node (ADR 0016). Run it all with
npm run test:server (node --test, one file at a time; npm run typecheck:server type-checks
it). Its assertions come from tests/unit/server/assert.ts, which keeps @std/assert's equality
rules, and its fake upstream servers from tests/unit/server/http_server.ts. The
tests/unit/node/ suites run under node --test too, each with its own script:
| Suite | Script | What it covers |
|---|---|---|
lingbot_map_glb.test.ts |
npm run test:lingbot:glb |
the PLY → GLB sidecar path through @gltf-transform/functions, which loads the sharp native binary |
pipeline_detection_graph.test.ts |
npm run test:pipeline:graph |
the real optimizeScan(), on the same @gltf-transform packages |
editor_pick.test.ts |
npm run test:editor:pick |
frontend viewer code (src/viewer/editor.ts + three) |
detection_store.test.ts |
npm run test:store |
frontend code (src/scene/store.ts's indexedDB/navigator.storage) |
glb_provenance.test.ts |
npm run test:provenance |
frontend code (src/export/gltf.ts + src/viewer/editor.ts), transitively DOM-typed |
resolver.test.ts |
npm run test:resolver |
frontend code (src/spatial/resolver.ts + three, DOM-typed ARProvider.start(canvas)) |
inference_router.test.ts |
npm run test:router |
src/inference/router.ts, with navigator and Worker stubbed |
model_provisioning.test.ts |
npm run test:model-provisioning |
src/inference/model-provisioning.ts's pure helpers only, deliberately avoiding its IndexedDB/fetch/navigator module-scope code |
detection_gate.test.ts |
npm run test:detection-gate |
scripts/lib/detection-gate.mjs, shared logic for the npm-script family (eval-cv.mjs, check-detection-gate.mjs, accept-detection-baseline.mjs) |
clock_sync.test.ts |
npm run test:clock-sync |
src/capture/clock-sync.ts, which lives under src/ with the browser code it ships alongside |
clip_validation.test.ts |
npm run test:clip-validation |
src/capture/clip-validation.ts |
splat4d_window.test.ts |
npm run test:splat4d |
src/viewer/playback-clock.ts, frontend viewer code |
Every suite above except test:lingbot:glb is wired into npm run verify — it runs on its own
because @gltf-transform/functions pulling in sharp's native binary makes it the one suite
that can fail on a machine with no prebuilt binary for its platform, which shouldn't block a
routine verify.
CI runs npm run typecheck:server and npm run test:server only when started by hand, via
.github/workflows/server-ci.yml (workflow_dispatch). Nothing runs it on push or PR. The pre-push hook runs npm run verify locally. The full containerized
smoke test (Docker build + /health + static UI gate) is manual via
.github/workflows/docker-publish.yml.
The repo defines over 140 npm scripts (package.json). The most common:
Node ≥ 26.13.0 is required. The server runs its TypeScript directly (
node server/main.ts), and so do the scripts that import.ts(scripts/generate-test-homes.mjs,scripts/generate-cv-images.mjs,scripts/smoke-pipeline.mjs): Node strips the types, and there is no build step..node-version(26.13.1) is read automatically by the version managers that support it (fnm, nodenv, Volta); nvm and asdf read their own files (.nvmrc,.tool-versions), so on those you either configure them to read.node-versionor select 26.13.1 yourself (nvm install 26.13.1).engine-strict=truein.npmrcis the backstop either way — it makesnpm cirefuse rather than warn. The Dockerfile's floatingnode:26-alpineandnode:26-trixie-slimtags stay on the same major line.
| Script | Description |
|---|---|
npm start |
Start both the API server and Vite together |
npm run dev |
Vite only |
npm run server |
The API server only (node --watch server/main.ts, reading .env when there is one) |
npm run build |
TypeScript check + Vite production build |
npm test |
Playwright tests (webkit-desktop) |
npm run test:mobile |
Playwright tests (webkit iPhone 15 emulation) |
npm run test:iphone |
Playwright (WebKit, iPhone 15 profile) against the live tailnet URL; no real device, no USB |
npm run test:house |
Two-story-house field-acceptance suite |
npm run test:box |
Self-contained browser loop — boots its own API server (:8100) and Vite (:5273) on scratch data dirs, seeds a corpus, runs the api + chromium-mock Playwright projects (or the ones TEST_BOX_PROJECTS names), tears it all down. Never touches the long-lived :8000/:5173 servers or the real scans/. |
npm run test:mock / test:api |
Mock-engine + API-only test tiers |
npm run smoke:pipeline |
End-to-end scan-optimization pipeline smoke test |
npm run setup:models |
Show the recommended Ollama vision-model catalog and install the ones you want |
npm run bench:models |
Score Ollama vision-model candidates against the real-photograph corpus to pick OLLAMA_MODEL (BENCH_MODELS=mock for the mock-engine baseline, CV_CORPUS=... to override the corpus) |
npm run eval:cv |
Score /infer output against ground truth — real-photograph corpus by default, CV_CORPUS=synthetic for the mock-engine regression fixture |
npm run ingest:video |
Ingest a walkthrough video into a session scan |
npm run links:house |
Print the house-validation scanner/viewer links |
npm run gen:test-data / seed:test-data |
Generate / seed test fixtures |
npm run typecheck:server / test:server |
Type-check the server and its suite / run the server unit suite (tests/unit/server/) |
npm run test:splat:unit / test:splat:make-fixture |
The server suite's splat_train (Brush), spirula_train, splat_detect/finish/align files + Playwright fixture builder |
npm run test:mock:unit |
The server suite's file for the mock inference engine |
npm run test:lingbot:glb / test:lingbot:fetch-video / test:lingbot:make-fixture |
LingBot-Map GLB test (Node, needs sharp) + fixture scripts |
npm run gen-icons |
Regenerate PWA icons |
npm run qr / logs:watch / logs:iphone |
Dev QR link + log tailing helpers |
One file of the server suite runs on its own with node --test (e.g. node --test tests/unit/server/splat_train.test.ts).
All endpoints are served by the API server on :8000 and proxied through Vite on :5173. Port 8000 answers this machine only unless LISTEN_HOST opens it, so from another machine use :5173.
The full, canonical route table lives in docs/architecture.md; the most-used endpoints:
| Method | Path | Description |
|---|---|---|
GET |
/health |
Returns { status, model, mode, modelReady, engineLoadState }. engineLoadState is loading, ready or failed. |
GET |
/memory/status |
Returns { enabled, baseUrl, sourceSystem, reachable? }. Never returns the token. |
GET |
/authenticate/status |
Returns { enabled }: whether "Sign in with Companion Account" is on. Boolean only. |
GET |
/authenticate/oidc |
Starts Companion Account sign-in when it is on. The callback, /authenticate/whoami and POST /authenticate/logout complete the flow. |
POST |
/authenticate/url-token |
A signed-in app (the session as Authorization: Bearer, or the cookie) asks for a URL token: { path, use }, where use is get or socket, → { token, expiresIn }. The token opens path and the paths below it (a path ending in . opens every name that starts with it, so one token opens one scan's files) for that use alone, for five minutes and never past the session's end. Never /, /authenticate…, a query or a fragment (400). Not registered while sign-in is off (404). |
POST |
/authenticate/shell/exchange |
A native shell trades the one-time code from its sign-in, with its PKCE verifier, for a session token ({ token, email, name }). Single use, 60 seconds. The body is at most 4 KiB (413). A request that names no live code is limited to 60 a minute per client address (429, Retry-After: 60); a request that names a live code is never refused for that budget. Behind Vite, or a proxy in HUB_TRUSTED_PROXY_CIDRS, the client's address is the one the proxy forwards; behind any other proxy it is the proxy's (server/forwarded.ts). |
POST |
/authenticate/device/code |
An app that cannot finish a browser sign-in asks for a code: { client_id, device_name?, device_platform? } → { device_code, user_code, verification_uri, verification_uri_complete, expires_in: 300, interval: 5 } (RFC 8628). Only the Unity apps' ids (DEVICE_CLIENTS, else 400 invalid_client). 20 per 10 minutes per client address, read as for the shell exchange (429), and at most 32 codes waiting at once (503). |
POST |
/authenticate/device/token |
The app polls with { grant_type: "urn:ietf:params:oauth:grant-type:device_code", device_code, client_id }. Until approved the answer is a 400 with authorization_pending, slow_down (5 seconds more each time; the third burns the code), access_denied, expired_token or invalid_grant; once approved, a single { access_token, token_type: "Bearer", expires_in, email, name }, the same session token as the shell exchange. |
GET, POST |
/authenticate/device |
The approval page for a code. A browser without a session signs in first and comes back to the same code. The page shows the code, the app, what the device says it is and the address it asked from (as this server, or the proxy it trusts, saw it), and connects nothing until both boxes are ticked. |
POST |
/infer |
Multipart image → RawDetection[] |
POST |
/process-scan |
Sync scan analysis: object-count, scene-description, floor-plan |
POST |
/upload-scan |
Multipart file (.glb) + optional metadata (JSON) → saves to scans/. An optional Idempotency-Key header (at most 200 printable characters) names the upload: a repeat with the same key, file and metadata within 15 minutes gets the first reply with Idempotent-Replayed: true, and nothing is stored or queued again. The keys are kept in memory, at most 256, so a restart forgets them (server/scan_upload_replay.ts; tests/unit/server/scan_upload_replay.test.ts, tests/unit/server/scan_contract.test.ts) |
GET |
/scans |
Returns JSON array of { filename, size, uploadedAt } |
GET/DELETE |
/scans/:filename |
Serve or delete one stored .glb (+ sidecars, world refs). A job working on the scan is asked to stop; when it has not ended within a few seconds the delete answers 202, hides the scan at once and finishes when the job ends, and asking again answers 404 once it is gone (PRIVACY.md) |
GET |
/scans/:filename/capture-review |
Read-only review of what is recorded about one scan: findings {code, severity, evidence, suggestion}, with missing evidence reported as unavailable. Behind the Companion session guard, when it is on, like the rest of /scans. See docs/architecture.md |
GET |
/worlds/:slug/assist, /worlds/:slug/assist/scans/:scanId |
Only with SCAN_ASSIST=1 (off by default): one Place, read-only, to its viewer token, for the scan assist MCP server. What it returns may reach a hosted model. |
POST |
/api/mcp |
Only with AGENT_MCP=1 (off by default): the agent MCP server, MCP Streamable HTTP, read-only tools an AI agent uses to answer questions about the Places whose viewer tokens or agent keys it holds (floor area, seating, objects, materials, colours, where an object was last seen, what changed, inventories and counts by Area, model files). Set up from the editor's Share > Connect an AI agent (/agents.html). What it returns goes on to the agent's model provider. |
DELETE |
/scans?confirm=delete-all |
Clears test scan storage and prunes world manifests |
POST |
/ingest-video |
Video-upload → session scan (no .glb on disk) |
GET |
/sessions |
Lists sessions |
GET |
/sessions/:id |
One session's record, plus keyframeIndices: the indices of the frames it holds, ascending. A keyframe whose upload failed leaves a gap (tests/unit/server/scan_contract.test.ts) |
GET |
/sessions/:id/… |
Session sidecars: lingbot-map.manifest.json, .point-cloud.ply, .poses.json, keyframe JPEGs |
POST |
/upload-summary |
Stores a scan summary |
GET |
/scan-locations |
Returns geo-located scan positions |
GET/POST |
/worlds |
List / create world projects |
GET |
/worlds/:slug |
World manifest: scans, layers, members, jobs, patches (+ .splat sidecars) |
GET |
/worlds/:slug/share |
Compatibility endpoint returning the share links scoped to one Place, only those at or below the caller's role (an owner token gets the owner link) |
POST |
/worlds/:slug/members |
Makes an agent key: a viewer token for one agent that expires ({ days?, label? }, 1 to 365 days, 30 by default). Editor or owner. See Keys |
POST |
/worlds/:slug/members/:memberId/revoke |
Revokes a member: an agent key, or a share link's token, which is replaced by a new link. Owner token only, on every install; an owner cannot be revoked |
POST |
/worlds/:slug/patches |
Persists transform, label, category, notes, visibility edit patches |
GET/POST |
/worlds/:slug/jobs |
List / queue async world jobs (align-scan, semantic-pass, splat-train, lingbot-map-reconstruct, …) |
GET |
/jobs / /jobs/:id |
Legacy view of optimize-scan jobs (shimmed from WorldJob data, shape unchanged) |
GET |
/worlds/:slug/frames/:scanId |
Pose, intrinsics, RGB URL, frustum for streamed keyframes |
GET |
/rtc-signal |
WebSocket upgrade: the WebRTC signalling relay for live geometry |
GET |
/events |
WebSocket upgrade: the server's event broadcast (scans, jobs, sessions) |
POST |
/client-logs |
Ingests client-side log batches |
GET |
/projects |
Lists projects |
GET |
/projects/:id/vps-maps |
A Place's visual map revisions and their version, as stored: ids, a fit, bounds and counts, never an image, a feature or a file path. Asks for no token, as GET /projects/:id does |
PUT |
/projects/:id/vps-maps/:revisionId/status |
The Place's owner activates (active) or revokes (revoked) a map revision, naming the vpsMapsVersion it read (409 with what the Place holds otherwise). Needs the Place's owner token on every install |
DELETE |
/projects/:id/vps-maps/:revisionId?expectedVersion=<n> |
The Place's owner deletes a map revision: its files, its queued jobs, its copy on the VPS worker and its record. Needs the Place's owner token on every install |
By default (sign-in off, neither strict flag set) world routes are open for local/Tailscale development. Invalid tokens are rejected, and a world's record never shows another member's token except to its owner. Sign-in, WORLD_STRICT_AUTH=1 or SCAN_REQUIRE_AUTH=1 requires world tokens for protected actions on the /worlds/<slug> routes, such as share-link generation, edit patches and queued jobs. The Place and scan routes never ask for one, except the two owner routes of a Place's visual maps, which ask for the Place's owner token on every install: see Strict world authorisation.
A Place's visual maps (ADR 0018, wave 22) are kept as revision records on the Place (Project.vpsMaps) and as files in the Place's own data folder, <PROJECT_MEDIA_DIR>/<projectId>/vps-maps/<revisionId>/. They go when the owner deletes one, when a session a map was built from is deleted or purged (DELETE /scans/:filename, DELETE /scans?confirm=delete-all, DELETE /sessions/:id, KEYFRAME_RETENTION_DAYS), and with their Place (DELETE /projects/:id, a merge); a new reference frame for the Place makes every map of the old one stale. See PRIVACY.md, sections 4 and 5 (tests/unit/server/vps_map_deletion.test.ts, tests/unit/server/vps_map_routes.test.ts).
Inference is engine-agnostic. The server picks its engine from INFERENCE_MODE:
ollama(default) — POSTs a JPEG to a local Ollama server running whateverOLLAMA_MODELnames (qwen3-vl:4bby default). Usenpm run setup:modelsto see the recommended models and install the ones you want, andnpm run bench:modelsto compare candidates.onnx— runs the bundledLiquidAI/LFM2.5-VL-1.6B-ONNXlocally viaonnxruntime-node(CPU/GPU). ~2–8s on Apple Silicon.mock— a deterministic colour-blob CV engine for CI and tests; needs no model download.grounding-dino— POSTs the frame to the detection service (scripts/grounding_dino_server.py,POST /detect) atGDINO_URL, with the scanner's own labels as the prompt: Grounding DINO's boxes from a GPU box in about a quarter of a second, with no description. See GPU_BACKENDS.md.
Separately, a WebGPU in-browser path runs the same LFM2.5-VL-1.6B-ONNX model directly on-device via onnxruntime-web's WebGPU execution provider (src/inference/lfm-driver-web.ts) — detection without the server, and no image leaves the phone. It is opt-in and capability-gated: the router (src/inference/router.ts) uses the server by default and only switches to WebGPU when both the infer-mode localStorage key selects it and InferenceRouter.hasWebGPU is true. In the web app that is a live navigator.gpu check, not a build flag — a browser without WebGPU never gets the option, and the side panel's toggle says so specifically instead of failing on use. The Android, iOS and desktop apps leave the path out (ON_DEVICE_IN_BUILD in the router; their bundles carry neither the worker nor onnxruntime-web, and no model), so hasWebGPU is false there whatever the WebView offers, and the toggle says that the app sends its photos to the Scan server (tests/unit/node/inference_router.test.ts, tests/unit/node/native_build.test.ts). If on-device inference fails once selected (timeout, a crashed worker, or an unprovisioned model), the router never silently retries through the server: it rejects with a typed WebGpuInferenceError and the capture fails honestly, so a capture the UI marked "On-device" never quietly leaves the device. See docs/factory/05-on-device-inference/0004-ungate-toggle-and-fallback-policy.md.
The ONNX files above are downloaded once, on a machine you control, for the server path. The on-device WebGPU path needs the same 2.2 GB reachable over HTTP from the phone instead — offered in the web app whenever the browser supports WebGPU (InferenceRouter.hasWebGPU), and never in the apps. Nothing extra is needed server-side: Vite already serves public/models/... once download_models.py has populated it.
What's new is getting those bytes onto the phone durably. src/inference/model-provisioning.ts:
- downloads each file with resumable
Rangerequests, flushing progress to IndexedDB every few MB so an interrupted transfer resumes instead of restarting; - verifies every file's received size against the server's before trusting it, so a truncated download is never handed to the inference runtime as a working session;
- caches the result in a dedicated IndexedDB database (survives reloads — a re-download only happens if the cache is explicitly cleared or the server's file size changes);
- requests persistent storage (
navigator.storage.persist()) so the ~2.2 GB isn't the first thing evicted under storage pressure, and reports honestly when the browser declines; - reports progress through the same
{stage, pct}protocolwebgpu.worker.tsand the AR overlay's progress bar already use — no second progress UI.
None of this starts implicitly. It's an explicit "Download" action in the side panel's AI Engine section (shown under the same hasWebGPU capability check as the toggle itself), and it never touches scan data to make room — checkStorageQuota (src/main.ts) accounts for the model cache alongside scan data and, when storage is tight, suggests removing the model first, since weights are re-downloadable and scans are not.
Measured on a Lume Pad 2 over a warm Tailscale link (2026-08-18): 21.6 MB/s, ~104 s for the full 2.2 GB, against a 10.04 GB origin quota. See docs/factory/05-on-device-inference/0002-browser-model-provisioning.md for the full measurement and design rationale.
Sessions that stream RGB keyframes can be densified server-side with LingBot-Map — a feed-forward Geometric Context Transformer that runs streaming 3D reconstruction directly from the JPEG keyframes the mobile app uploads.
Setup (one-time, on the inference box):
# 1. Install LingBot-Map in a venv the server can reach
git clone https://github.com/Robbyant/lingbot-map ~/lingbot-map
python3 -m venv ~/.venvs/lingbot-map && source ~/.venvs/lingbot-map/bin/activate
pip install -e ~/lingbot-map
# 2. Download a checkpoint (see lingbot-map README for variants)
huggingface-cli download robbyant/lingbot-map --local-dir ~/models/lingbot-map
# 3. Point the server at the venv python + checkpoint
export LINGBOT_MAP_PYTHON=~/.venvs/lingbot-map/bin/python
export LINGBOT_MAP_MODEL_PATH=~/models/lingbot-map/checkpoint.ptTriggering a reconstruction. The server exposes the lingbot-map-reconstruct world job type. Enqueue one against a scan that has a finalized session:
curl -X POST http://localhost:8000/worlds/default/jobs \
-H 'Content-Type: application/json' \
-d '{"type":"lingbot-map-reconstruct","scanId":"<scanId>"}'The job invokes scripts/lingbot_map_worker.py as a subprocess and writes three sibling artifacts into the session directory:
| File | What it is |
|---|---|
lingbot-map.point-cloud.ply |
Binary PLY of merged world points (XYZ + RGB when available) |
lingbot-map.poses.json |
Per-frame camera-to-world matrices + intrinsics |
lingbot-map.manifest.json |
Run index + stats; always written, even on skip/error |
All three are served read-only at /sessions/<id>/<artifact>. The desktop editor consumes them via the world-job artifact metadata. If LingBot-Map / torch is not installed, or the checkpoint is missing, the worker writes a skipped manifest with a remediation hint and the world job completes with that message rather than failing — so the UI explains why no reconstruction was produced.
A reconstruction that succeeds queues a floor-plan job (FLOORPLAN_AUTO=0 turns that off): scripts/floor_plan_worker.py, on the same interpreter and needing only its numpy, draws a 2D plan from the point cloud, as <base>.floor-plan.json, .svg and .dxf (for CAD tools; tests/unit/server/floor_plan_server.test.ts) beside the scan, shown in the editor's Layers → Floor plan section. The cloud is first fitted to the capture's own AR poses, which sets its scale and which way is up, so the plan is in metres when the capture's AR runtime measured in metres; a capture with no AR poses gets no plan. It is derived, not survey-grade. See docs/pipelines/splat-toolbox.md.
The same section of the editor that shows the LingBot-Map points downloads them, and the live cloud the phone recorded, as LAS files. They are estimated, not surveyed, and each records whether its coordinates are in metres (tests/unit/server/point_cloud_las.test.ts). See docs/pipelines/lingbot-map.md.
See docs/pipelines/lingbot-map.md for the full architecture diagram, UI walkthrough with screenshots, test setup, and CC-BY clip provenance.
splat-train is one job type with two interchangeable drivers, chosen by SPLAT_BACKEND:
export SPLAT_BACKEND=brush # default — omit it and you get this
export SPLAT_BACKEND=spirula # Spirula Studio insteadNothing downstream changes with the choice. Both land <base>.splat.ply and <base>.splat-train.manifest.json under scans/, and splat-finish / splat-detect consume those by name, so a backend switch is a deployment decision rather than a code change (server/main.ts:3547-3549). An unrecognised value falls back to Brush rather than failing the job — a typo'd env var must not stop a fleet from reconstructing. The manifest's tool field ("brush" / "spirula") records which driver produced a given artifact, so "why does this scan look different" is answerable after the fact.
Brush is the default and stays the default. Its number on the known-good fixture (scans/sess-video-20260830-033839.splat-train.manifest.json, 32 keyframes, COLMAP-solved 32/32): 15 000 iterations → 246 838 gaussians, 37.5 MB, 166 s. The head-to-head against Spirula on that same session — and the reason "Spirula is faster" is the wrong summary of it — is in docs/pipelines/splat-train.md § Measured A/B; the criteria that would move the default are ADR 0007, item 7.
Installing Spirula. It is not vendored and not bundled — no Spirula source is in this repo, no Spirula binary ships in the container image, and nothing here builds it from source. It is downloaded separately by whoever runs the box and invoked as a child process over argv and files on disk, exactly as Brush and COLMAP already are. Spirula Studio is GPL-3.0 and this repo is not; that arm's-length arrangement is the only permitted coupling, and the reasoning, the open licence review, and the things that would change the analysis are all in ADR 0007 rather than repeated here. Do not bundle, fork, or link it without going back to that document first.
# Download a prebuilt release (the ubuntu-vulkan-x86_64 zip) — do NOT build from source
# https://github.com/harry7557558/spirula-studio/releases
unzip spirula-*.zip -d ~/opt/spirula && chmod +x ~/opt/spirula/spirula
~/opt/spirula/spirula --version # 2026.8.28 is what this box runs~/opt/spirula/spirula is the first path the resolver tries, so that layout needs no env var at all; SPIRULA_BIN overrides it. It needs a Vulkan-capable GPU.
When Spirula is absent, a splat-train job with SPLAT_BACKEND=spirula completes as skipped with a remediation naming the download and reminding you that SPLAT_BACKEND=brush switches back — the same contract as a missing BRUSH_BIN or COLMAP_BIN. It is never a crash and never a failed job.
The remaining knobs (SPIRULA_DEVICE, SPIRULA_TRAIN_ITERS, SPIRULA_SH_DEGREE, SPIRULA_PRESET, SPIRULA_QUALITY) are documented in .env.example; iterations and SH degree default to Brush's 15000/2 so an A/B is like-for-like. Two behaviours differ from Brush and are worth knowing: Spirula's Nerfstudio parser rejects "camera_model": "PERSPECTIVE", so the dataset builder writes OPENCV for it instead of adding a second converter; and Spirula has no max-resolution flag anywhere in its CLI, so it trains at the dataset's native size and there is no counterpart to BRUSH_MAX_RES.
sensenova_vision.ts drives the upstream SenseNova-Vision launcher for recon3d / camera-pose / depth / normal / bbox / pan-seg tasks against a session's keyframes, invoking it through WSL when SENSENOVA_BASH points at wsl.exe. Install the isolated Linux runtime with scripts/setup-sensenova-wsl.sh (run as root inside WSL), then set SENSENOVA_DIR, SENSENOVA_MODEL_PATH, and SENSENOVA_BASH — see .env.example for details. If unset or the runtime isn't installed, the worker returns a skipped result with a remediation hint instead of failing.
For the splat tools (view / train / detect / ingest-video / compress) see docs/pipelines/splat-toolbox.md.
For the two-story-house field acceptance protocol see docs/testing/HOUSE_VALIDATION.md (npm run links:house, npm run test:house).
# Hermetic gate — the server, frontend and test type-checks, the server suite, and
# the Node unit suites `verify` names. No servers, browsers, or seeded corpus needed.
npm run verify
# Playwright E2E tests (desktop WebKit)
npm test
# Mobile Safari viewport (WebKit with the iPhone 15 profile; no simulator, no device)
npm run test:mobile
# The same profile against the live tailnet URL, so the real cert, proxy and CORS path
# is exercised. No real device and no USB: Playwright cannot drive Safari on an iPhone.
npm run test:iphone
# Full isolated browser loop: boots its own API server + Vite on scratch ports and
# data dirs, seeds a corpus, runs the api + chromium-mock Playwright projects.
npm run test:box
# The same loop on the two Safari profiles (npm test and npm run test:mobile above
# need servers of their own): TEST_BOX_PROJECTS replaces the api + chromium-mock pair.
TEST_BOX_PROJECTS=webkit-iphone15,webkit-desktop npm run test:boxSee playwright.config.ts for project configurations. The on-device checklists for each target are linked from docs/targets/.
.githooks/pre-push runs npm run verify and refuses the push if it fails, so
a red main can't leave your machine. It's opt-in per clone (git doesn't track
.git/hooks):
git config core.hooksPath .githooksThe hook covers only the hermetic gates — the Playwright suites need servers, a
browser binary, and a seeded corpus, so they stay in npm run test:box rather
than in front of every push. Emergency escape hatch: git push --no-verify.
The automated tests do not run the engine. public/test-fixtures/xr8-mock.js, loaded with
/?mock=xr8, is a scripted stand-in: it sends SLAM poses, world feature points and a fake camera
feed, and the mock-xr8-* Playwright specs drive the capture loop on it in headless Chromium
(npm run test:mock). No spec is tagged @simulator, though tests/ar-scan.spec.ts mentions the
tag, and no test uses an engine simulator.
| Stage | Data handled |
|---|---|
| Capture | Camera and spatial scene input from the client device |
| Processing | Optional local reconstruction/model pipeline |
| Server | Local API and session state |
| Viewer | Scene and WebXR presentation |
The optional reconstruction toolchain is separate from the basic viewer/server flow. Camera capture requires the HTTPS setup described in Quick setup; keep model files, captured scenes, and any server credentials in the intended local storage and deployment boundary.
Companion Scan is free and public under the PolyForm Noncommercial License 1.0.0. The full text is in LICENSE; common questions are answered in the License FAQ. For commercial licensing, email support@companionintelligence.com.
Required Notice: Copyright LifeScope INC, DBA Companion Intelligence (https://ci.computer)


