core/ the engine (Rust): model, commands, importers, exporters, renderers, CLI, MCP
app/ the desktop app: React + three.js interface (src/), Tauri shell (src-tauri/)
examples/ models built from command scripts
tools/ demo recording, IFC checks, tombstones (dead-code finder: [tombstones.md](tombstones.md))
docs/ this documentation
brand/ logo, icon and banner (generated by brand/beaver.py)
- Model (
model.rs,components.rs,topology.rs): welded vertices, edges and planar faces with holes; groups (nested), components (definitions and placements), tags, guides, views. Push/pull, face splitting and auto-folding live here. - Commands (
commands.rs; the enum itself iscommands/command.rs): one enum, one JSON command per variant.Engine::exec_jsonruns a command and handles undo (mutates()lists the read-only ones).Engine::runis the dispatch table: it sends each command to the file for its area incommands/(draw, shape, build, groups, tags, paint, rendering, sections, annotate, files, library, media, session). - Scene (
scene.rs): what a viewer needs to draw a model: triangles with their owners (for picking), edges, outlines, the outliner tree, face-me figures. The viewport gets it as bytes (Bulk::encode: the big lists as typed arrays, the faces and edges as columns;decodeSceneinapp/src/engine.ts), the tests, MCP and the command line as JSON. - Live model (
live.rs): the model shared through a file, so the app, the browser bridge and MCP agents see each other's changes. - Files: SketchUp (
skp.rslegacy,skp_vff.rs2013+, clean-room readers worked out from sample files), DXF/DWG (dxf.rs,dwg.rs), IFC (ifcin.rswith IfcOpenShell,ifc.rsout), FBX, OBJ, point clouds (cloud.rs), and exporters (export.rs,export2.rs). - Pictures: a rasterizer for quick renders and drawings (
render.rs) and a path tracer with a denoiser for photoreal ones (pt.rs, see RENDERER.md). - Plugins (
plugins.rs): listing, installing and thepartsmeasurements. Plugins themselves run in the app's sandbox (PLUGINS.md).
Viewport.tsx: the three.js view and every tool (one step function per tool for a press and for a move), snapping (inference.ts), the axis gizmo (gizmo.tsx). Its types, colors, edge styling, materials and pure geometry are inviewport/.App.tsx: layout, menus, the command palette (palette.tsx). Its state and actions are in hooks:useplugins.ts,usefiles.ts(file actions and imports),uselook.ts(skin, layout, workspace); the File menu isfilemenu.tsx.- Panels, one file each:
buildpanels.tsx,library.tsx,environments.tsx,views.tsx,entityinfo.tsx,contextmenu.tsx,materialspanel.tsx,renderdialog.tsx,dialogs.tsx,shortcuts.tsx(what they share is inpanelkit.tsx); dialogs usesheet.tsx. toolbar.tsx,appearance.tsx(themes),learn.tsx(lessons),updater.tsx.- Plugins:
plugins.tsx(types and dialogs),pluginhost.ts(the host side of a run),sandbox.tsandlockdown.ts(the worker every plugin runs in, JavaScript and Ruby alike),ruby.ts. - Styles are SCSS:
src/styles/main.scsslists the partials in cascade order (later ones override earlier ones);_mixins.scssand_variables.scsshold what is repeated at compile time. Anything a theme or skin changes at runtime stays a CSS custom property (_tokens.scss, set fromskins.ts). - In the desktop app, commands go to the engine through Tauri; in the browser
they go to the bridge on localhost (
engine.ts).
The bridge needs a per-launch token and only accepts its own page (no other
websites, no DNS rebinding), the app has a strict content security policy,
importers are fuzzed, plugins are sandboxed and run under an allowlist that the
engine enforces (core/src/policy.rs), agents are held to a workspace folder,
the live model file is saved atomically with backups, and updates are signed. See SECURITY.md.
Several programs can edit one model file (the app, the bridge, an agent over MCP). Every one of them writes it the same
way (Live::save_inner in core/src/live.rs), so a save somebody was told succeeded is never lost:
- The model is serialised first, with no lock held (this is the slow part).
- A lock file beside the model (
.<name>.lock, an advisory lock from the standard library) is taken. - With the lock held, the file must still be what this program last read or wrote (modification time, size and file identity). If it is not, nothing is written; the caller plans again on the newer file (the app runs the command again on it, an agent's flush sets its pending work aside and takes theirs).
- The outgoing file is backed up when the schedule says so, and for the first write of a call that has run for a while.
- The new bytes go to a temp file and are flushed, the stamp is checked once more immediately before the rename, and the file is renamed over the old one. A crash at any step leaves the old file or the whole new one.
An agent call that runs out of time is taken back without depending on the (capped) undo list. When nobody else has written
the file, the model goes back to what the call began with. Otherwise what the call wrote is worked out entry by entry
(points, edges, faces, groups, placements, ... by id, as a history::Patch), measured from the model the call began with
or, after somebody else's save was loaded, from that save. The rollback reloads the file as it is now and takes those
changes off it. An entry that only the call changed goes back; an entry somebody else changed too stays as they have it.
When anything stays, or the result would not be a consistent model, or the call is too big to track, the person's data
wins: the call's last written version is set aside in an unsaved-* file (private to the owner) and the agent is told the
rollback was not complete. If the file moves while the rollback is being written, the plan is made again on the newer file.
Two more rules keep that true when things go wrong. Work is only replaced by somebody else's file after it has been set aside
successfully (the set-aside file is created new under a unique name, never through a link, shortened for a very long model
name, private to the owner); when that fails, their file is left as it is, memory keeps the work, the person is told, and
the next look at the file tries again. The last two tries of a rollback hold the lock from reading the file to writing it,
so a person who saves all the time cannot keep it from finishing; if it still cannot finish, the person is told as well as
the agent. A lock file that is a link, a folder or unreadable is repaired where possible, and the person is told once when no
lock can be made at all. The file's stamp also holds a quick fingerprint of its first and last 64 KB.