An open source parametric CAD tool, written from the ground up in Rust: its own geometry kernel, a native and a browser client, and a self-hostable server.
Shapes are stored exactly: a cylinder is an axis and a radius, a circle a frame and a radius. No NURBS; surfaces that have no closed form will be defined by how they are built (a fillet is a ball rolling between two faces) and evaluated numerically.
Every result is bit-identical on every target. The kernel uses only IEEE
+ - * / sqrt and its own trigonometry (forge_math::dmath), never the
platform math library, and CI runs the whole test suite natively and as
wasm32 to prove it.
Units are millimetres. Tolerances live in forge_math::tol.
The repository is split by what a thing is:
kernel/is the geometry kernel: exact results, zero third-party crates. No unsafe code but in two crates, each reviewed:forge-alloc(a global allocator is unsafe by definition) andforge-par(one block: running a borrowing closure on a host's thread erases its lifetime, asstd::thread::scopedoes inside std; every closure is joined before its scope returns).interface/is everything that uses the kernel: part files, the agent layer and the command line. The app, host and protocol go here too (design).verify/is what checks the kernel and is never shipped.research/records how each derived formula and constant was reached, andtools/holds the speed gate, the OpenCascade oracle and test runners.
kernel/ |
what |
|---|---|
forge-alloc |
the wasm heap |
forge-par |
scoped threads for every parallel path: std's, or a host's (a browser's Web Workers) |
forge-math |
vectors, frames, deterministic trig, intervals, polynomial roots, small linear algebra |
forge-geom |
curves, surfaces, intersections |
forge-topo |
B-rep bodies, stable names, the validity checker |
forge-sketch |
2D sketches, geometric constraint solver, profile extraction |
forge-ops |
profiles, extrude, revolve, sweep, coil, loft, fillets, chamfers, shell, draft |
forge-bool |
booleans, sequential and n-ary |
forge-gpu |
the GPU batch backend |
forge-font |
glyph outlines for text features |
forge-mesh |
exact predicates, constrained Delaunay, tessellation, STL |
forge-model |
part histories and regenerating them |
interface/ |
what |
|---|---|
forge-lang |
Forge (.fg), the part language: parts, sheet metal, assemblies, drawings; typed errors and edit ops, versions |
forge-units |
the unit table (mm, in, deg, kg, ..) and a part's # units line; forge_lang::units writes typed values as Forge text |
forge-agent |
selectors, measuring, face meshes, rendering, JSON replies, the IPC and chat bridges |
forge-cli |
forgecad build/check/query/measure/render/export/edit/help, versions, serve, mcp (see AGENTS.md), import |
forge-import |
FreeCAD .FCStd bodies as .fg parts |
forge-render |
the renderer, wgpu native and in the browser; its own workspace, built apart from the kernel |
verify/ |
what |
|---|---|
forge-proof |
metamorphic properties, certificates, point membership against the CSG tree |
forge-bench |
benchmarks |
To install the native app and command-line tools from this checkout:
tools/install.sh # installs in ~/.cargo/bin (or $CARGO_HOME/bin)
forgecad # open the native app from any directory
forgecad open /path/to/part.fg # open a part (relative paths work too)
forgecad open --help # app options
forgecad help # command-line modeling tools
forgecad update # fetch latest main and reinstallThe installer builds release binaries with the pinned Rust toolchain. Keep the install
directory on PATH; optionally pass a different install root, such as
tools/install.sh "$HOME/.local". Run it again to update. The app is also available
directly as forge-app. Remove forgecad and forge-app from that root's bin
directory to uninstall.
ForgeCAD runs on Linux, macOS (Apple silicon and Intel) and Windows 10 and later; the
platforms workflow builds and tests it on macOS and Windows for every push to main.
- macOS:
tools/install.sh, as above (Rust from rustup; the Xcode command-line tools). It also putsForgeCAD.appin~/Applications, so Launchpad, Spotlight and the Dock open it. Speech:forgecad-setup-speechbuilds whisper.cpp with Metal. Settings live in~/Library/Application Support/forgecad, caches in~/Library/Caches/forgecad. - Windows:
powershell -ExecutionPolicy Bypass -File tools\install.ps1(Rust from rustup with the MSVC toolchain, and the Visual Studio Build Tools' C++ workload). It adds a Start menu entry.forgecad updateruns the PowerShell updater; speech:forgecad-setup-speech.ps1 [cpu|cuda|vulkan](needs CMake). Settings live in%APPDATA%, caches and conversations in%LOCALAPPDATA%.
API keys go in each platform's own keyring: the Secret Service, the macOS Keychain, the Windows Credential Manager.
forgecad update (also forgecad-update, or tools/update.sh from the checkout)
clones the latest main into a temporary directory and reinstalls into the same
installation root. Local changes and branches are left alone. Git access to
ssh://forgejo@git.commonty.org/david/ForgeCAD.git is required; set
FORGECAD_REPOSITORY to use a different remote. Updates include changes merged
to main; rerun tools/install.sh to install local changes instead. Remove
forgecad-update as well when uninstalling.
cargo test --workspace # native
cargo test --workspace --target wasm32-wasip1 # wasm, run under Node's WASI
cargo build --profile wasm --target wasm32-wasip1 # the browser build: fat LTO, simd128
tools/speed/gate.sh # native instruction counts and bits
GATE_COUNTER=callgrind tools/speed/gate.sh # the same under valgrind (VMs without perf counters)
tools/speed/wasm.sh # wasm instruction counts, ratio to native
wasm is single-threaded (wasm32-wasip1 has no threads), so the n-ary regen runs on one thread there.
The .fg language has a Lean proof in research/forge-lang/lean. It covers:
- the lexer model;
- the LL(1) grammar and parser;
- scope and built-in names;
- edit ops, undo and refactors.
A change to any of these extends that proof in the same commit. After it, check the language against its proof:
cd research/forge-lang/lean && lake build ForgeLang.LL1.Impl && lake build ForgeLang.LL1.ImplUnifiedDoc \
&& lake build && lake build fgparse fglex && lake env lean Axioms.lean # no sorryAx, no ofReduceBool
FG_LEAN=1 cargo test --release -p forge-lang --test parse_diff # Rust against the Lean oracle; commit the digest
CI (lean.yml) runs both, and fails if the committed digest is not the oracle's.
The toolchain is pinned in rust-toolchain.toml; rustup installs it on first use.
interface/forge-render is its own workspace, so wgpu never enters the commands above. From there:
cargo run --release -- gearbox # a bench part or a .fg path (`--help` lists keys and mouse)
cargo run --release -- --stress 5000 # the 15 bench parts placed 5,000 times
cargo run --release -- --stress 5000 --bench # a fixed orbit, frame times on stdout, no window (--window: with one)
cargo run --release -- crank --dims # the numbers a part has
cargo run --release -- crank --drag len # left drag changes one live, release commits it
cargo run --release -- --drag-bench # value change to frame, each bench part, no window
cargo test # GPU tests skip where there is no GPU
sh web/build.sh OUT # the browser page and the bench parts' meshes
Built meshes are cached in ~/.cache/forgecad/mesh, by content hash of the part file and the
kernel's sources. Nothing else reads that cache; kernel benchmarks never see it.
The Agent tab's microphone button dictates into the message box. Click again to stop; review the text and press Send. Escape cancels dictation. No open part is required. In Settings → Agent, choose a speech shortcut and hold-to-talk or toggle mode. “Send when done” is optional and off by default. Dictation runs locally with Whisper; sending the resulting message uses your selected agent as usual.
The installer and updater include forge-speech. Install its runtime and English model once:
forgecad-setup-speech cpu # CPU, small.en
forgecad-setup-speech cuda # NVIDIA CUDA; also installs the CPU fallback
forgecad-setup-speech vulkan # Vulkan; also installs the CPU fallbackSetup requires Git, CMake, a C/C++ compiler, curl and sha256sum; GPU builds also need
the corresponding development toolkit. It pins whisper.cpp to the helper's ABI and
checks model SHA256 hashes. Linux microphone capture requires libasound.so.2 and a
working ALSA default input. Restart ForgeCAD after setup. Models and libraries live in
$XDG_CACHE_HOME/forgecad/speech (normally ~/.cache/forgecad/speech);
FORGECAD_SPEECH_DIR overrides that directory. FORGECAD_SPEECH_MODEL selects
another compatible model. The first dictation loads and warms the model; later ones reuse it.
Remove forge-speech, forgecad-setup-speech and the cache directory to uninstall voice.
In the Agent tab, click the agent name and select Claude Code, Codex, or an
OpenAI-compatible endpoint. Codex uses the codex CLI on PATH and its existing
login (codex login); no API key is required in ForgeCAD. Its optional model is
set in Agent settings; leave it blank for the CLI default. ForgeCAD starts Codex
with its own app tools alongside your CLI configuration, keeps the conversation across
messages, and reloads its file changes into the document's undo history.
Claude Code and Codex run in the project directory with their normal user and project configuration, built-in tools, MCP servers, skills, hooks and permission rules. ForgeCAD adds CAD tools and document context without imposing a tool allowlist or overriding the CLI's sandbox or approval mode. Shell, web research and subagents are available according to the selected CLI and your configuration. These are non-interactive CLI sessions: actions needing an interactive approval may be refused by the CLI; configure permissions in the underlying CLI. ForgeCAD's Undo and version tracking cover supported project source files, not every external action performed by native tools.
Send and Enter remain available while the agent works. Follow-ups queue in order and run after the current turn, including attachments and voice dictation; the working indicator shows the queue count. Stop (or Escape) stops the current turn and cancels queued follow-ups. Changing the document, project or selected agent cancels queued messages rather than sending them to a different context.
All three backends share project and version tools. No open part is required to
chat: launch forgecad from a project folder to discuss or set up an empty project.
The Agent tab shows the project folder and opens the first part when it is created.
The repository containing an open document is the project root; without a
repository, its containing folder is used. Agents can create folders and read/write .fg, .md, .txt, and .csv
files across the project, list history, create named versions, compare, restore,
list releases, issue requested releases, and regenerate release exports. New
files create their parent folders. Existing-file writes require the exact old
text, so stale edits are refused.
Changed source files are tracked recursively (up to 500 files, 4 MiB each),
excluding hidden paths, symlinks, Git-ignored files, and generated folders such as
releases/ and exports/. A completed turn records its changed files together
as one Git save when history is enabled; pre-existing unrelated edits are kept
out. Named versions and releases checkpoint the turn before capturing it.
The agent is instructed to create versions, restore, enable history, and issue
releases only when asked; release and history-initialization tools additionally
require confirmed: true. Release creation builds the saved design and refuses
build errors or a paused history. Git identity must be configured for saves.
For example: “Create parts/, assemblies/ and docs/, then put a bracket in parts/bracket.fg”; “Create a version called First fit”; or “Compare v1 to current.”
Agent conversations are saved locally per project under
~/.local/state/forgecad/conversations (or $XDG_STATE_HOME/forgecad/conversations),
separately from Git history. Type /resume or click Chats in the Agent tab
to search previous conversations, then select one to restore its transcript,
backend/model, and agent session. /new starts another conversation; /resume ID
selects a known conversation directly. Codex and Claude continue their native
sessions; OpenAI-compatible endpoints restore their saved message history and
use the endpoint's existing keyring credentials. Existing ForgeCAD Codex logs
with a matching project marker are also imported read-only when the picker opens.
Resuming a conversation does not change project files or replay tool calls. Past file changes appear as summaries; use Versions to restore a design. Saved markup appears as a text annotation rather than an interactive thumbnail. Older Claude and endpoint conversations that predate this storage are not imported. Keep the project at the same path to use its conversation list.
Every newly launched window publishes a local connection, even before its first chat. A terminal Claude Code or Codex agent can use its shell tool to run:
forgecad agent list
forgecad agent send WINDOW 'Review the telescope mount and report clearance problems.'
forgecad agent status WINDOW REQUESTAll replies are JSON. Pick WINDOW from the list, which includes the project and selected UI agent/model. Send returns a request ID; status returns queued, running, done or failed, plus the reply. Poll status until done or failed. Terminal Claude can address UI Codex, and terminal Codex can address UI Claude. The UI agent replies in its existing conversation; the terminal caller reads that same reply through status. A terminal's unsaved conversation is not automatically attached: include the relevant context in the message.
Requests queue while the UI agent is busy, leave the user's draft intact, and are visibly labelled in the chat. A queued request fails if the window changes project or selected agent. Connections are private to the local user. Requests and replies last for the window's lifetime; the latest 128 records are retained, with at most 32 pending requests. Older running app versions need to be relaunched before they appear in the list.
MPL-2.0.