Skip to content
AzrkielPublic

About

Think it. Have it.

Resources

Security policy

Stars

1 star

Watchers

0 watching

Forks

Latest commit

 

History

1,024 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Mirum

Mirum turns a text description of a mechanical part into a 3D CAD model. You type something like "NACA 2412 wing rib, 200 mm chord, 3 bolt holes", and it returns a STEP file, a GLB file for viewing, and the CadQuery script that produced them.

It is a research project, pre-1.0. See What doesn't work yet before relying on the output.

Release (RC1)

The RC1 release guide covers the local Docker images. RC1 has no hosted deployment. Typed checked design works without a provider key for rectangular cantilevers, CO₂ dragsters, glider CEM and regenerative chamber geometry. AI drafts are off by default. Results carry no engineering certification.

The release binds to loopback and uses a shared access token. It supports one backend process and one active checked job, with six jobs per client per hour, a 420-second deadline and six-hour download retention. Run storage is capped at 512 MiB total.

The checked-program integration plan describes how MEL, revision review and independent geometry checks will support the first equipment-bay assembly.

What it does

  • Reads a prompt and pulls out dimensions, material, and part type.
  • Splits the request into parts and the rules for how they fit together.
  • Asks an LLM (Gemini) to write a CadQuery script for each part.
  • Runs each script against the OpenCASCADE geometry kernel. If the script crashes, the error goes back to the LLM for another attempt, up to 3 retries.
  • Runs basic validity checks on the resulting solid.
  • Positions the parts into one assembly and exports it.

The output is B-Rep geometry (exact surfaces), not a triangle mesh. The GLB is only for the browser viewer.

How it works

A request to /generate goes through these steps, and progress is streamed back as server-sent events:

  1. Requirements extraction. An LLM call turns the prompt into a structured DesignRequirements object.
  2. Planner. An LLM call produces an AssemblyManifest: a list of parts and mating rules.
  3. Domain classifier. Each part is assigned one of seven categories (see below). The category decides which instructions and helper functions the code-writing step gets.
  4. Machinist. An LLM call writes a CadQuery script for the part. Similar past scripts that compiled are added to the prompt as examples (TF-IDF lookup over telemetry).
  5. Security scan. The script is parsed and rejected if it imports anything outside cadquery, cq, math, cad_utils, cad_aero, or uses banned builtins such as eval, exec, open, getattr.
  6. Sandboxed run. The script runs in a subprocess with a 30 second timeout and a 1.5 GB memory cap. The script is passed on stdin and the API keys are not passed to the subprocess.
  7. Critic loop. On failure, the traceback is sent back to the Machinist. Domain C parts also get surface continuity and curvature checks.
  8. Geometry certificate. Six checks on the compiled solid: volume > 0, surface area > 0, no degenerate faces, finite bounding box, valid B-Rep topology, at least one solid. A mass estimate is added from a material density table.
  9. Assembler. Plain code, no LLM. It loads the STEP files and applies the transforms from the manifest.

Steps 3 to 8 run concurrently per part.

Part categories

Domain Covers Approach
A Plates, brackets, boxes, enclosures Extrusions and boolean operations
B Gears, threads, cams, bearings Parametric formulas and ISO tables in cad_utils.py
C Handles, shells, bottles, other smooth shapes Lofts and sweeps over spline cross-sections
D Airfoils, wing sections, ribs, spars NACA 4-digit profile generation, wing helpers in cad_aero.py
E Sheet metal panels, trays, bent brackets Thin-wall helpers with a material thickness parameter
F Nozzles, combustion chambers, nacelle cowls Revolved profiles
G Nose cones, fuselages, fairings Revolved and multi-station lofted bodies

When categories overlap, D wins over everything, F wins over B, G wins over C, and E wins over A.

Optional analysis

These are off by default and set per request:

  • run_aero: runs XFOIL on Domain D parts and returns lift, drag, and moment coefficients against angle of attack, plus a stall estimate. This is 2D section analysis.
  • run_struct: computes ISA atmosphere values, FAR-23 maneuver and gust load factors, stall and corner speeds, and single-cell wing-box bending and shear margins.

Results can also be returned as plots (/analysis/plots) or a PDF (/analysis/pdf).

Running it

For the deterministic PicoGK regen chamber browser app, see the browser guide. It provides parameter inputs, a 3D mesh preview, and STL/report downloads without an LLM key. After bash codex-cloud/setup.sh, start it with bash codex-cloud/web.sh.

The main Streamlit workflow selector also includes Deterministic rocket nozzle: edit the chamber/nozzle and cooling-channel parameters, generate without model calls, preview the accepted mesh, and download its STL, geometry report and canonical parameters. This reuses the existing PicoGK builder and verifier through /engineering/regen/*. The backend must have the Linux PicoGK runtime installed; otherwise the form explains the missing runtime and disables generation. See main-app setup.

You need Docker, Docker Compose, and a Gemini API key.

Create a .env file in the repository root:

GEMINI_API_KEY_HEAVY=your_key

GEMINI_API_KEY_PRO is optional. Set it only if your Pro-model quota is on a different key. ADMIN_API_KEY is needed only for the /admin endpoints.

Then:

docker compose up --build

Example request:

curl -X POST http://localhost:8000/generate \
  -H "Content-Type: application/json" \
  -d '{"prompt": "NACA 2412 wing rib, 200mm chord, 3 bolt holes, 1.5mm 6061 aluminium"}' \
  --no-buffer

The response is an event stream. The final complete event contains the GLB (base64), the CadQuery script, and the geometry certificate. It also carries run_id and downloads (which of step / glb are available), a bom for multi-part assemblies (identical parts collapsed into quantities, per-part mass, CSV text), and a verification object that lists any part that compiled but failed a check, such as a bounding box that does not match the requested dimensions. Delivery stays fail-closed: a failed geometry certificate is an error, not a warning.

Download the files with GET /download/{run_id}/{fmt} (fmt is step or glb). The STEP is the exact revision the structural acceptance gate validated and rendered, not a second execution of the script. Files are kept for 6 hours.

Endpoints

Endpoint Method Purpose
/generate POST Full pipeline, streamed
/engineering/generate POST Deterministic typed cantilever CAD + measured STEP checks + bounded beam FEA; no LLM (API only)
/engineering/regen/config GET Deterministic nozzle presets, parameter schema and runtime readiness
/engineering/regen/jobs POST Submit a typed regenerative cooling chamber/nozzle mesh job; no LLM
/engineering/regen/jobs/{id} GET Poll nozzle generation and geometry acceptance
/engineering/regen/jobs/{id}/artifacts/{name} GET Download accepted stl, report or spec
/engineering/v1/* GET, POST, PATCH Checked cantilever design: reviewed typed brief, deterministic no-LLM solver, evidence-gated package. Typed path available; AI draft mode off by default (see below)
/plan POST Planner only, returns the manifest
/requirements POST Requirements extraction only
/route POST Provider-free route decision: the checked-capability route event for a prompt, or null
/clarify POST Returns clarifying questions for a vague prompt
/download/{run_id}/{fmt} GET Downloads the accepted step or glb of a /generate run (6 h retention)
/run POST Runs a CadQuery script you supply and returns a GLB
/refine POST Edits an existing result through follow-up prompts
/pmi/extract, /pmi/annotate POST Read tolerance annotations from a prompt, or add them to a generated run's STEP (run_id, not a path)
/export/parasolid POST Parasolid export (see limitations)
/analysis/plots, /analysis/pdf POST XFOIL results as plots or a PDF
/stats GET Failure rates by domain and operation
/admin/model-config GET, POST Read or change which model each agent uses

Checked cantilever design (/engineering/v1)

The typed path (form in the "Checked beam" page, or POST /engineering/v1/drafts with form input) is available: a human reviews the exact revision, then a deterministic solver with no model produces an evidence-gated package.

AI draft mode, where a model proposes the brief, is off by default. It passed a bounded live qualification for the checked beam (B13: 10 of 10 complete corpus cases accurate, plus one live review-UI run) and is still not an engineering certification. To turn it on, set MIRUM_ENGINEERING_AI_DRAFTS=1 (or true) on the backend, plus GEMINI_API_KEY_HEAVY. With it off, an AI-mode request returns 503 "AI draft preparation is not enabled", GET /engineering/v1/capabilities reports ai_enabled: false, and the UI shows form mode only. AI proposals still need the same human review; failed model replies are kept in an internal audit ledger only (7-day retention).

Abuse limits (all environment variables, read once at start; defaults in brackets): MIRUM_ENGINEERING_AI_DAILY_CALLS [200 provider calls per rolling 24 h across the process, 0 disables calls], MIRUM_ENGINEERING_AI_CONCURRENCY [2], MIRUM_ENGINEERING_JOBS_PER_CLIENT_HOUR [6], MIRUM_ENGINEERING_REFUSAL_MEMORY_SECONDS [120], MIRUM_ENGINEERING_DRAFT_TTL_SECONDS [14400, unfinalized drafts], MIRUM_ENGINEERING_MAX_DRAFTS [500], MIRUM_ENGINEERING_MAX_DRAFT_BYTES [16 MiB], MIRUM_ENGINEERING_MAX_DRAFTS_PER_CLIENT [20], MIRUM_ENGINEERING_MAX_AUDITS [1000], MIRUM_ENGINEERING_MAX_AUDIT_BYTES [32 MiB], MIRUM_ENGINEERING_MAX_BRIEFS [2000], MIRUM_ENGINEERING_MAX_BRIEFS_PER_CLIENT [100], MIRUM_ENGINEERING_MAX_BODY_BYTES [65536]. MIRUM_ENGINEERING_TLS_OS_TRUST=1 is a local diagnostic only (trust the OS certificate store for the provider connection, for TLS-intercepting antivirus); it is off by default because any locally added root could then read the API key.

What doesn't work yet

The new deterministic engineering API adds typed cantilever generation, independent STEP measurements, beam finite-element checks and bounded solver-feedback sizing without model calls. It is API-only and limited to a slender rectangular cantilever under a transverse end force. It is not 3D solid FEA, a PINN, or engineering standards certification; unsupported requests must not be presented as verified.

  • Not every prompt produces a part. In the last recorded full run of the evaluation set (2026-05-26, output/qa-reports/2026-05-26-full-litesub.md), 78 of 82 prompts passed. The 4 failures were three Domain C parts (two "Nothing to loft" errors and one OpenCASCADE StdFail_NotDone) and one Domain E part (the generated script used a wrong attribute name).
  • Smooth organic shapes are the weakest area. Lofts and sweeps fail more often than anything else, and a part can compile and still not look like what was asked for.
  • Speed varies. In that same run, simple parts took about 10 to 40 seconds. Harder parts took one to two minutes, and the slowest took over four.
  • Generation requires a passing geometry certificate. /generate fails closed if a required solid check fails or cannot run. Passing means the solid is well-formed, not that it matches the prompt, has correct assembly mates, or can be manufactured. Legacy /run and /refine still have narrower validation; they are not equivalent to the hardened Text-2-CAD acceptance pipeline.
  • Parasolid export is not active. It needs a commercial CAD Exchanger license. Without one the endpoint falls back to STEP.
  • Model training has not been run. The scripts in training/, inference/, and data_pipeline/ (fine-tuning, RLAIF, the mate-prediction GNN, dataset converters) are scaffolds. They are waiting on a GPU and on dataset access. The live pipeline uses stock Gemini models.
  • The memory cap does not apply on Windows. It relies on RLIMIT_AS, which is Linux-only. Run it in Docker.
  • The sandbox is a filter, not a guarantee. It is an allowlist over LLM-written Python plus a resource-limited subprocess. Escapes have been found and fixed before. Do not expose the API to untrusted users without further isolation.
  • Offline CI includes native CAD tests. In addition to lightweight schema and mocked analysis gates, Dockerfile.verify runs the native geometry, process-lifecycle and API tests. Model responses in these tests are fixtures; no live LLM generation quality or provider authentication is established.
  • Aerodynamic and structural numbers are estimates. XFOIL is a 2D panel method and the structural module uses a simplified single-cell wing-box. Neither has been validated against test data here.
  • No tagged releases. Everything ships from main.

Passive glider design search

The Streamlit workflow selector includes a passive-glider search for maximum trimmed L/D under designer constraints. See inputs, API, setup and limitations. It uses the integrated parametric AeroSandbox screening model, adaptive exploration/refinement and STL/template downloads; no provider calls are needed for search.

The new physics-based glider CEM workflow adds mission feasibility/gap reports, launch energy, process comparisons, wind-aware distance or duration search, measured-mass closure and uncertainty. Its current layouts are conventional, T-tail and V-tail. Outputs are screening geometry and templates; novel-family discovery and the PicoGK manufacturing builder remain unqualified and unavailable.

Verification

Targeted hardening ports and their scope are described in the integration notes.

docker build -f Dockerfile.verify -t mirum-integration-verify .
docker run --rm --network none --read-only --init \
  --cap-drop ALL --security-opt no-new-privileges \
  --memory 4g --cpus 2 --tmpfs /tmp:rw,exec,size=1g,mode=1777 \
  -e GEMINI_API_KEY_HEAVY=offline-fixture-never-sent \
  -e GEMINI_API_KEY= -e GOOGLE_API_KEY= mirum-integration-verify

In Windows Git Bash, prefix the docker run command with MSYS_NO_PATHCONV=1. The image uses CadQuery/OCP on Linux; native Windows DLL execution is not required. Paid-provider tests are excluded by default.

Tech stack

Layer Technology
LLM Gemini via google-generativeai: gemini-3.1-pro-preview for the Planner and requirements extraction, gemini-3.5-flash for everything else
Geometry CadQuery 2.x on OpenCASCADE
Aerodynamics XFOIL
Backend FastAPI, Uvicorn, server-sent events
Frontend Streamlit with a Babylon.js viewer
Environment Conda (conda-forge), because OpenCASCADE needs a native build

Model names are set in backend/config.py.

Repository layout

backend/
  main.py              FastAPI endpoints and the streaming pipeline
  agents.py            Planner, Machinist, Critic, Refiner, Assembler
  classifier.py        Domain classifier (A to G)
  compiler.py          AST scanner and subprocess sandbox
  cad_utils.py         Geometry helpers and ISO tables (available to generated scripts)
  cad_aero.py          Wing and airfoil helpers (available to generated scripts)
  strategies.py        Per-domain instructions for the Machinist
  schemas.py           Pydantic models
  retrieval.py         Example lookup for few-shot prompts
  continuity_check.py  Surface continuity checks for Domain C
  geometry_analysis.py Curvature checks for Domain C
  rendering.py         Zebra-stripe renders used by the Domain C checks
  exporters.py         Export formats
  verification/        Geometry certificate and material mass
  subagents/           Agent wrappers, telemetry, model registry
  propulsion/          Domain F code
  eval_harness/        Evaluation prompts and runner
  tests/
analysis/              Standalone analysis: airfoil (XFOIL), structures,
                       AVL, lifting line, plots, PDF report
frontend/
  app.py               Streamlit UI
data_pipeline/         Dataset preparation scripts (scaffold)
training/              Fine-tuning scripts (scaffold)
inference/             Constrained decoding and GNN models (scaffold)
docs/                  Design notes
output/                Plans, QA reports, demo assets
architecture.md        More detail on each pipeline stage
SECURITY.md            Security policy and how to report an issue

License

See LICENSE.

About

Think it. Have it.

Resources

Security policy

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages