Skip to content

armgit / forma

Public Imported from GitHub
0

A 1.2 MB pure-Rust rewrite of headless Blender built for AI agents — 3D B-rep modeling engine, CLI, and MCP server

5.2 KB
Raw Blame

Core Craftsmanship & Agent Piloting Blueprint

  • Status: Milestone #1 Implemented (Milestones #2–#5 Help Wanted)
  • Target: Core (forma-core & forma-lang)
  • Core Impact: Strictly zero ML weights, < 5 ms deterministic checks, 0 extra output tokens on clean --critique builds
  • Design Review: Required per feature PR (see CONTRIBUTING.md)

Architectural Principle

Do not bundle a local neural critique model into core forma — that would destroy the ~1.7–1.8 MB native / ~0.8 MB WASM / zero-GPU footprint while still having weaker 3D spatial judgment than the host frontier model.

Instead, split quality feedback into:

  • Layer A (Deterministic, inside forma-core, 0 KB weights, < 5 ms): Fast geometric linting, spatial assertions, and cutaway/wireframe diagnostic views.
  • Layer B (Host VLM visual loop): The calling agent inspects the 4-view render and deterministic lint notes to refine geometry.

Prioritized Craftsmanship Features

  1. Deterministic Geometric Craftsmanship Critic (forma lint / --critique, invariants.rs & spatial.rs) — ✅ Implemented:

    • Emits 0 extra tokens on clean --critique builds (0.0% FPR / 100.0% recall verified across 28 reference + failure models; median 8.8 ms end-to-end incl. eval).
    • Flags INVALID_SOLID, FLOATING_SHELL, DEGENERATE_FACES (> 0.5%), THIN_WALL (wall_proxy < 0.005), EXTREME_ASPECT (> 20:1), GRAZING_GAP (scale-relative 5e-4 × pair_diag), PART_INTERSECTION, and opt-in RAW_BOX (--raw-box).
    • Next refinements: upgrade THIN_WALL to build on WallThicknessReport's inward-ray min/p01 in features.rs (separating localized chamfer/lip knife-edges from true thin walls), reuse boolean::check_self_intersections, and add center-of-mass stability/tipping overhang checks.
    • BVH-Accelerated Assembly Contact Graph (spatial.rs): Computes exact pairwise part contacts (INTERSECTING, CONTACT, NEAR_GAP, DISJOINT) using SpatialBvh + strict-interior piercing witness & inward face-centroid winding disambiguation (distinguishing flush mating / exact pin-in-bore CONTACT from volumetric INTERSECTING). Exposed via forma lint [--json] [--raw-box], forma eval --critique, MCP inspect({ lint: true }), and WASM/JS session.lint(). Semantic "missing hardware" judgment intentionally stays in Layer B (the host frontier LLM).
  2. Declarative Spatial Assertions & Stateless Articulation Sweeps (assert in Forma-Pipe):

    • 1-line engineering contracts that auto-rollback with exact deltas on failure:
      assert clearance(shaft, bore) >= 0.005
      assert connected(assembly)
      assert grounded(base, z=0)
      assert section_loops(flange, z=0) == 6
      assert swing_clear(lid, housing, origin=(0,-0.05,0.04), axis=(1,0,0), deg=110, tol=2) >= 0.0003
      assert slide_clear(drawer, chassis, dir=(0,-1,0), dist=0.08, tol=0.002) >= 0.0003
      
    • Stateless Articulation Clearance (swing_clear / slide_clear): Inspired by the geometric swing-collision testing and motion rectification stage of Functionalization / GraFu (Zhao et al., SIGGRAPH Asia 2026, arXiv:2605.18010), samples rigid-transform poses along a revolute arc or prismatic travel with AABB pruning + spatial::clearance(), reporting the exact collision angle/distance and hit centroid in < 5 ms without introducing persistent rigging or animation state into core Scene. Always evaluates exact range endpoints (0 and max) plus an optional tol overtravel / tolerance-extreme margin so nominal-only sweeps cannot hide collisions at worst-case stroke.
  3. Pure Parametric Macros (def) + Lazy Industrial-Design Stdlib (inspect(topic="stdlib")):

    • Reusable sub-assemblies (def standoff(r_out, r_in, h) = ...).
    • On-demand high-craft detail recipes (counterbored bosses, gusset ribs, snap-fit lips, flanged collars, knuckle hinges, sliding rails, Gothic arches) loaded lazily via inspect(topic=...) at 0 base-schema tokens.
  4. Visual-Critique Renderer Modes (render.rs):

    • mode="section|wire|scale" — mid-plane cutaways (exposing internal walls and clearances), clay+wireframe overlays, and orthographic ruler ticks for a tight 2-pass visual refinement loop.
  5. Actionable Grazing-Boolean Diagnostics (boolean.rs):

    • Pinpoint the exact offending edge centroid (x, y, z) and suggest a concrete overlap/extension fix whenever --strict rolls back a grazing coplanar boolean.
  6. Agent Workflow Guardrails & Plugin Ergonomics (forma-mcp / forma-cli):

    • Purpose-upfront & interfaces-before-cosmetics: encourage deciding render-only vs. print/both before detailing (locking units("mm"), higher segs on printed bores, and real wall thickness up front), modeling mating faces/bores before aesthetic bevels, and taking a tx(checkpoint) before optional cleanup ops (remesh/decimate).
    • Zero-token MCP Prompts/Resources & forma doctor: expose starter workflow prompts/resources alongside forma-mcp's 4 tools (0 extra tool-schema tokens), plus a lightweight offline forma doctor check for plugin/CLI installs.