A 1.2 MB pure-Rust rewrite of headless Blender built for AI agents — 3D B-rep modeling engine, CLI, and MCP server
docs: simplify CONTRIBUTING, ROADMAP, and link milestones
wrong-nebula86661478a8cb
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.mdindex 41d798a..618ac8f 100644--- a/CONTRIBUTING.md+++ b/CONTRIBUTING.md@@ -1,117 +1,36 @@# Contributing to Forma-Thanks for your interest in contributing to **Forma**!+Contributions are very welcome! Check [`ROADMAP.md`](ROADMAP.md) or the blueprints in [`contribute/`](contribute/README.md) to see what's planned.-Forma is a pure-Rust, headless 3D polyhedral modeling engine built for AI agents — shipping as a ~1.7–1.8 MB native CLI, a ~0.8 MB WebAssembly library (`forma-3d`), and a compact stdio MCP server (`forma-mcp`).+*(If you're an AI agent, see [`AGENTS.md`](AGENTS.md) and [`SKILL.md`](SKILL.md).)*-If you are an AI agent working in this repository, also read [`AGENTS.md`](AGENTS.md) and [`SKILL.md`](SKILL.md).-------## Quick Start: Build & Test--Prerequisites: Rust stable toolchain (`edition = "2021"`). For WASM builds: `rustup target add wasm32-unknown-unknown` and Node.js `>= 18`.+## Build & Test```bash-# Run core workspace unit, integration, and fuzz-invariant tests-cargo test--# Build release native binaries (forma, forma-mcp)-cargo build --release--# Build optional headless HTTP server (excluded from default-members)-cargo build --release -p forma-server--# Build WASM bundle and run npm smoke tests-npm run build:wasm-npm test+cargo test # core unit, integration & fuzz-invariant tests+cargo build --release # native CLI + MCP binaries+npm run build:wasm && npm test # WASM bundle + npm smoke tests```------## Workspace Layout--```text-crates/-├── forma-core/ # Polyhedral mesh kernel, CSG booleans, bevel/shell/subsurf/remesh/QEM,-│ # UVs, spatial queries (clearance/section), zero-GPU renderer, import/export-├── forma-lang/ # Forma-Pipe & compact DSL parser/evaluator, transactional runner, GBNF spec-├── forma-cli/ # `forma` CLI binary (eval, render, draw, spec)-├── forma-mcp/ # `forma-mcp` stdio JSON-RPC 2.0 server (4 tools, <800 o200k tokens)-├── forma-wasm/ # WASM bindings powering the `forma-3d` npm package-└── forma-server/ # Opt-in headless HTTP/1.1 microservice (excluded from default-members)-```--Other key directories:-- [`grammar/`](grammar/) — GBNF grammar for constrained decoding (`forma_pipe.gbnf`).-- [`bin/`](bin/) & [`lib/`](lib/) — Node.js wrappers for `forma-3d` CLI, MCP, and ESM library.-- [`contribute/`](contribute/) — Forward-looking architectural blueprints, RFCs, and addon specs.-- [`docs/`](docs/) — Benchmark reports, architecture audits, and verification logs.-------## Non-Negotiable Constraints--Forma's value comes from staying fast, tiny, deterministic, and strictly watertight. PRs must respect these constraints:--1. **Binary & WASM size budget:**- - Core native `forma` binary stays around **~1.7–1.8 MB** (zero-dependency pure Rust; avoid heavy transitive crates).- - Core `forma.wasm` stays around **~0.8 MB** (`--profile wasm-release`).- - Heavy or domain-specific capabilities do **not** go into `default-members` — they ship as opt-in workspace crates (see [Core vs. Opt-In Crates](#core-vs-opt-in-crates)).-2. **MCP tool-schema budget (`< 800` `o200k` tokens):**- - `forma-mcp` exposes 4 tools (`eval`, `inspect`, `tx`, `export`) currently totaling **789 `o200k` tokens**.- - Do not inflate the core MCP tool schemas. Extended reference docs belong in lazy `inspect(topic=...)` or a separate opt-in MCP server (e.g., `forma-print --mcp`).-3. **Strict-by-default manifold invariants:**- - `forma-cli` and `forma-mcp` default to `strict = true` (`--no-strict` / `strict: false` is explicit opt-out).- - Under `strict`, every modified part must satisfy `WT=ok` (watertight), `CW=true` (consistent winding), `NM=0` (zero non-manifold edges), `B=0` (zero boundary edges), `NaN=0`, and non-negligible positive volume (scale-invariant check). Failed ops must roll back cleanly via transactional snapshots.-4. **Determinism & zero panics:**- - Core ops must not panic or produce `NaN`s on adversarial inputs, and `.glb` export must remain deterministic.- - Use `BTreeMap` / deterministic ordering rather than `HashMap` where output order is observable.-5. **Honest documentation:**- - Never overclaim geometric capabilities (for example, `.step` export is a watertight planar-face ISO 10303-21 solid, not analytic NURBS).-6. **License:**- - All contributions are licensed under `GPL-3.0-or-later` (see [`LICENSE`](LICENSE)).-------## Core vs. Opt-In Crates (and Out-of-Scope Work)--| Tier | What Belongs Here | Impact on Core |-|---|---|---|-| **Core (`default-members`)** | Mesh kernel fixes, boolean/bevel/selector robustness, spatial queries, `Forma-Pipe` ergonomics, diagnostic/craftsmanship tooling, WASM/CLI/MCP parity | Must stay within native/WASM size & `<800`-token MCP budgets |-| **Opt-In Workspace Crates** | Domain-specific workflows built on `forma-core` (e.g. `forma-server`, [`forma-print`](contribute/forma-print.md), [`forma-ue`](contribute/forma-ue.md), [`forma-retopo`](contribute/retopo.md)) | Listed in `workspace.members`, **excluded** from `default-members` → `0 bytes` on core/WASM and `0 tokens` on core `forma-mcp` |-| **Separate Companion Apps / Addons** | Rigging/armatures, skinning, shape keys/morph targets, animation retargeting, high-to-low map baking, and full PBR/EEVEE-class headless rendering | Out of scope for core `forma`; planned as separate companion tooling that consumes Forma's `.glb`/mesh output |-------## Design Review Before Large Changes--Before opening a multi-PR series or introducing a new surface (a `Forma-Pipe` op, a new file format, a new opt-in crate, or an MCP change):--1. Check [`ROADMAP.md`](ROADMAP.md) and [`contribute/`](contribute/README.md) to see if a blueprint already exists.-2. Open a GitHub Issue (or a short RFC markdown PR in `contribute/`) describing:- - What problem it solves and whether it lives in core or an opt-in crate.- - Public syntax / CLI / API shape and expected binary-size & token-budget impact.- - Test and invariant verification plan.-3. Wait for maintainer sign-off on the design before sending implementation PRs. This avoids wasted work and keeps the codebase cohesive.-----+Optional crates (excluded from `default-members`): `cargo build --release -p forma-server`.-## Pull Request Checklist+## Repo Layout-- [ ] `cargo test` passes with zero warnings on touched crates.-- [ ] New geometric ops include unit/invariant tests in `crates/forma-core/tests/` verifying `WT=ok`, `NM=0`, `B=0`, and strict rollback behavior.-- [ ] Any `Forma-Pipe` syntax change updates `SPEC_PIPE`, `grammar/forma_pipe.gbnf`, `SKILL.md`, and `AGENTS.md` as appropriate.-- [ ] Core binary size, WASM size, and `forma-mcp` token budget are not regressed (run `npm run build:wasm && npm test` if touching core/lang/wasm).-- [ ] PR is focused on a single concern with a clear description and reproduction/verification notes.+- `crates/forma-core` — mesh kernel, booleans, ops, UVs, spatial queries, preview renderer, import/export+- `crates/forma-lang` — `Forma-Pipe` DSL, parser, evaluator, GBNF grammar+- `crates/forma-cli` / `forma-mcp` / `forma-wasm` — CLI, stdio MCP server, and `forma-3d` WASM package+- `crates/forma-server` — opt-in headless HTTP worker+- `contribute/` — blueprints and notes for upcoming features and addons----+## Four Rules to Keep in Mind-## Where Help Is Wanted Most+1. **Keep core tiny:** Core `forma` stays ~1.7–1.8 MB native / ~0.8 MB WASM (pure Rust, minimal deps).+2. **Keep MCP compact:** Core `forma-mcp` stays under **800 `o200k` tokens** (currently 789).+3. **Strict watertightness by default:** `--strict` must reject non-manifold, open-boundary, inverted-winding, `NaN`, or zero-volume results and roll back cleanly.+4. **Domain pipelines live in opt-in crates:** Big domain workflows (3D printing, UE5, etc.) go in their own workspace crate excluded from `default-members` (`0` bytes / `0` tokens added to core). Rigging, animation, map baking, and full PBR/EEVEE-class rendering are separate companion apps, not part of core Forma.-See [`ROADMAP.md`](ROADMAP.md) and [`contribute/README.md`](contribute/README.md) for active blueprints and open items, especially:+## Sending Changes-- **Kernel & geometry hardening:** curved-tool boolean edge cases, bevel clamping, and fuzz-invariant coverage.-- **Craftsmanship & agent ergonomics:** deterministic geometric critic (`--critique`), declarative `assert` spatial contracts, `def` macros, and cutaway/wireframe preview modes ([`contribute/craftsmanship.md`](contribute/craftsmanship.md)).-- **Opt-in 3D printing addon (`forma-print`):** DFM checks, auto-orientation, multi-color AMS/MMU `.3mf` export ([`contribute/forma-print.md`](contribute/forma-print.md)).-- **Opt-in Unreal Engine / OpenUSD addon (`forma-ue`):** `UCX_`/`UBX_` collision hulls, lightmap UV2, LOD chains, pure-Rust `.usda` export ([`contribute/forma-ue.md`](contribute/forma-ue.md)).+- **Bug fix or small improvement?** Just open a PR with a test covering the change.+- **Big new feature, op, or addon crate?** Open a quick GitHub Issue first so we agree on the shape before you spend time building it.+- License: `GPL-3.0-or-later` ([`LICENSE`](LICENSE)).diff --git a/ROADMAP.md b/ROADMAP.mdindex 4644be4..4e0fbaf 100644--- a/ROADMAP.md+++ b/ROADMAP.md@@ -1,49 +1,27 @@# Forma Roadmap-This roadmap tracks what works today in **Forma**, what is actively planned next, and where opt-in addons or separate companion apps fit into the ecosystem.+A quick look at what works today, what's up next, and where to jump in. See [`CONTRIBUTING.md`](CONTRIBUTING.md) to get started.-Looking to pick up a piece of work? Read [`CONTRIBUTING.md`](CONTRIBUTING.md) and browse the detailed blueprints in [`contribute/`](contribute/README.md).+## Works Today (`v0.4.2`)----+- **Watertight pure-Rust mesh kernel:** booleans (with multi-hole batching), bevels, shell, crease-aware Catmull-Clark `subsurf`, voxel `remesh`, QEM `decimate`, `pipe`, `loft`, `sweep`, `thread`, `text3d`, and linear/radial patterns.+- **`Forma-Pipe` & strict safety:** semantic selectors, relational placement (`on`, `align`), `clearance()` / `section()` queries, transactional rollback, strict-by-default manifold checks, and GBNF grammar.+- **Zero-GPU visuals & I/O:** ~4 ms 4-view studio PNG renderer, vector SVG blueprints, `.glb`/`.obj`/`.stl` import, and `.glb`/`.step`/`.3mf`/`.stl`/`.obj`/`.svg`/`.blend` export.+- **Distribution:** ~1.7–1.8 MB native CLI/MCP, ~0.8 MB WASM npm package (`forma-3d`), and opt-in `forma-server`.-## What Works Today (`v0.4.2`)+## Up Next-- **Core Polyhedral Kernel (`forma-core`):** Double-precision watertight manifold mesh kernel, BVH-localized booleans with automatic multi-hole batching, ring-preserving bevels, shell/solidify, crease-aware Catmull-Clark `subsurf`, Surface Nets voxel `remesh`, Link-Condition QEM `decimate`, `pipe`, `loft`, `sweep`, helical `thread`, `text3d`, and `pattern_linear`/`pattern_radial`.-- **Declarative Language (`forma-lang`):** `Forma-Pipe` with semantic selectors (`vertical`, `top_rim`, `bottom_rim`, `outer_rim`, `top`, `sides`), relational placement (`on`, `align`), exact `clearance()` and `section()` queries, transactional snapshots, and GBNF grammar for constrained decoding.-- **Strict-by-Default Validation:** `forma-cli` and `forma-mcp` default to `strict = true`, rejecting non-manifold, open-boundary, inconsistent-winding, `NaN`, or negligible-volume geometry and rolling back cleanly.-- **Zero-GPU Rendering & Blueprints:** Built-in 4-view (`Front / Right / Top / Iso`) studio PNG renderer (~4 ms) and dimensioned vector SVG blueprints (`forma draw`).-- **Import & Export:** Pure-Rust `.glb` (glTF 2.0 Y-up, PBR + LSCM/triplanar UVs), `.obj`, and `.stl` import; `.glb`, faceted ISO 10303-21 `.step`, `.3mf`, `.stl`, `.obj`, `.svg`, `.png`, and optional `.blend` export.-- **Distribution:** ~1.7–1.8 MB native CLI/MCP binaries, ~0.8 MB WASM npm package (`forma-3d`), and opt-in headless HTTP worker (`forma-server`).-------## Planned — Core Engine--| Area | Goals | Blueprint / Details |-|---|---|---|-| **Kernel & Fuzz Hardening** | Expand `fuzz_invariants.rs` with curved tools (`cyl`/`cone`/`sphere`/`revolve`), tighten bevel XY clamping, add BVH self-intersection diagnostics, and surface actionable grazing-boolean hints. | Core (`forma-core`) |-| **Craftsmanship & Agent Piloting** | Deterministic geometric critic (`--critique`), declarative `assert` spatial contracts, pure parametric `def` macros + lazy stdlib (`inspect(topic="stdlib")`), and renderer `section`/`wire`/`scale` modes. | [`contribute/craftsmanship.md`](contribute/craftsmanship.md) |-| **Plugin CLI Dispatch** | Lightweight Git-style subcommand forwarding (`forma <addon> ...` → `forma-<addon>` on `$PATH`) so opt-in crates integrate seamlessly at `< 1 KB` core cost. | Shared across addons |-------## Planned — Opt-In Workspace Addons (Zero Bloat on Core)--Opt-in addons live in `workspace.members` but stay excluded from `default-members`, adding **0 bytes** to core `forma`/`forma.wasm` and **0 tokens** to core `forma-mcp`.--| Addon Crate | Scope | Status | Blueprint |+| Track | Focus | Notes / Blueprint | Milestone ||---|---|---|---|-| `forma-print` | 3D printing DFM audit (16+ FDM/SLA/SLS printer profiles), visual DFM heatmaps, auto-orientation, slicer-native multi-color AMS/MMU `.3mf` export, part splitting & plate nesting, optional slicer CLI / LAN bridges. | Blueprint ready — help wanted | [`contribute/forma-print.md`](contribute/forma-print.md) |-| `forma-ue` | Unreal Engine 5 pipeline: `UCX_`/`UBX_` QuickHull collision hulls, lightmap UV2 (`TEXCOORD_1`), auto `LOD0`–`LOD3`, pure-Rust `.usda` (OpenUSD) exporter, `SM_` hygiene. | Blueprint ready — help wanted | [`contribute/forma-ue.md`](contribute/forma-ue.md) |-| `forma-retopo` | Curvature/field-aligned quad retopology (Instant Meshes–style extrinsic 4-RoSy solver) for organic scan/sculpt cleanup without risking core watertight stability. | Feasibility note — deferred | [`contribute/retopo.md`](contribute/retopo.md) |-----+| **Core & Craftsmanship** | Curved-tool fuzzing, bevel clamping, `--critique` lint, `assert` spatial contracts, `def` macros, cutaway/wire previews | [`contribute/craftsmanship.md`](contribute/craftsmanship.md) | [Milestone #1](https://github.com/wrong-nebula/forma/milestone/1) |+| **3D Printing (`forma-print`)** | Opt-in crate: DFM checks, 16+ printer profiles, visual heatmaps, auto-orient, multi-color AMS/MMU `.3mf`, splitting & nesting | [`contribute/forma-print.md`](contribute/forma-print.md) | [Milestone #2](https://github.com/wrong-nebula/forma/milestone/2) |+| **Unreal Engine (`forma-ue`)** | Opt-in crate: `UCX_`/`UBX_` collision hulls, lightmap UV2, auto-LODs, pure-Rust `.usda` (OpenUSD) | [`contribute/forma-ue.md`](contribute/forma-ue.md) | [Milestone #3](https://github.com/wrong-nebula/forma/milestone/3) |-## Ecosystem / Separate Companion Apps (Out of Core Scope)+*Later / Deferred:* Curvature-aligned quad retopology (`forma-retopo`) — feasibility note in [`contribute/retopo.md`](contribute/retopo.md).-To keep Forma's modeling kernel lean, fast, and strictly watertight, the following areas are intentionally **outside core `forma`** and planned as separate companion apps or external addons that consume Forma's `.glb` / mesh exports:+## Separate Companion Apps (Out of Core Scope)-- **Headless PBR / EEVEE-Class Renderer:** A dedicated headless rendering companion app inspired by Blender's renderer and EEVEE, built with the same agent-first philosophy as Forma (while Forma's built-in renderer stays a tiny, zero-GPU diagnostic previewer).-- **Character Rigging, Animation & Map Baking:** Armatures/skeletons, skin weights, shape keys (morph targets), animation clip retargeting, and high-to-low normal/roughness baking.+To keep Forma's modeling kernel fast and tiny, these are planned as separate companion apps/addons that consume Forma's `.glb` output rather than living in core:-If you want to collaborate on a companion crate or interoperability contract (e.g., clean `.glb` handoff conventions between Forma and downstream rigging/rendering tools), open an issue to discuss!+- **Headless PBR / EEVEE-style renderer** (a dedicated headless rendering app inspired by Blender's renderer and EEVEE).+- **Character rigging, skinning, shape keys, animation retargeting, and map baking.**diff --git a/contribute/README.md b/contribute/README.mdindex 749ba0c..dedc80e 100644--- a/contribute/README.md+++ b/contribute/README.md@@ -1,22 +1,8 @@-# Forma Contributor Blueprints & RFCs+# Blueprints & Notes-This folder contains forward-looking architectural blueprints, design notes, and feasibility studies for features and opt-in addons planned around **Forma**.+Design notes for upcoming features and opt-in addons. Want to pick something up? Check [`CONTRIBUTING.md`](../CONTRIBUTING.md) and open a quick issue before starting a big PR.-Before starting work on any blueprint here, please read [`CONTRIBUTING.md`](../CONTRIBUTING.md) and [`ROADMAP.md`](../ROADMAP.md), then open a GitHub Issue (or small design-review PR) to align on scope before submitting large implementation PRs.--## Active Blueprints--| Document | Target | Status | Summary |-|---|---|---|---|-| [`forma-print.md`](forma-print.md) | Opt-in crate (`crates/forma-print`) | Blueprint / Help Wanted | 3D printing DFM engine (16+ FDM/SLA/SLS profiles), visual heatmaps, auto-orientation, slicer-native multi-color AMS/MMU `.3mf`, splitting & nesting, optional slicer CLI / LAN bridges. |-| [`forma-ue.md`](forma-ue.md) | Opt-in crate (`crates/forma-ue`) | Blueprint / Help Wanted | Unreal Engine 5 export addon: `UCX_`/`UBX_` QuickHull collision hulls, lightmap UV2 (`TEXCOORD_1`), auto `LOD0`–`LOD3`, pure-Rust `.usda` (OpenUSD) exporter. |-| [`craftsmanship.md`](craftsmanship.md) | Core (`forma-core` / `forma-lang`) | Blueprint / Help Wanted | Deterministic geometric critic (`--critique`), declarative `assert` spatial contracts, `def` macros + lazy stdlib, cutaway/wireframe preview modes, grazing-boolean diagnostics. |-| [`retopo.md`](retopo.md) | Opt-in crate (`crates/forma-retopo`) | Feasibility Note / Deferred | Curvature/field-aligned quad retopology (Instant Meshes–style 4-RoSy solver) as an optional addon without risking core watertight invariants. |--## Adding a New Proposal--If you want to propose a major feature or a new opt-in crate:--1. Copy the header metadata pattern used in the blueprints above (`Status`, `Target`, `Core Impact`, `Design Review`).-2. Explicitly state binary-size / WASM / MCP token impact and how strict manifold invariants (`WT=ok NM=0 B=0`) are preserved.-3. Open a PR adding your proposal to `contribute/` or start a GitHub Issue linking to your draft.+- [`forma-print.md`](forma-print.md) — **3D Printing addon** (DFM checks, printer profiles, auto-orient, multi-color `.3mf`)+- [`forma-ue.md`](forma-ue.md) — **Unreal Engine addon** (`UCX_`/`UBX_` collision, UV2, LODs, `.usda`)+- [`craftsmanship.md`](craftsmanship.md) — **Core craftsmanship** (`--critique` lint, `assert` contracts, `def` macros, preview modes)+- [`retopo.md`](retopo.md) — **Quad retopology** (deferred feasibility note)