chisel/README.md
maverick 974e26f592 Chisel v0 — AI CAD single-shot generator
Chat → Claude writes a JSCAD script → sandboxed Web Worker executes it →
live three.js preview + STL export. Parametric // @param comments become
live sliders. Server-side repair loop fixes geometry errors before the user
sees them.

- src/worker: Hono API, Claude orchestration (prompt-cached system prompt),
  /api/generate + /api/repair
- src/client: React + react-three-fiber viewport, JSCAD engine Web Worker
- Radical-branded (red #FF2D55 on #0B0B09, Syne + IBM Plex Mono)

Engine validated end-to-end: mug model → 3256-triangle valid binary STL.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-25 00:03:38 +10:00

2.2 KiB
Raw Blame History

◢ Chisel — AI CAD

Say it. Shape it. Message what you want built; Claude writes a parametric CAD script, it runs in a sandbox, and it appears in a live 3D viewport — exportable to real CAD.

The core idea: the design is a parametric script. Chat edits patch the script; sliders tune its parameters; export emits the geometry. Everything — editing, versioning, parametrics — falls out of that one choice.

Architecture (v0 — MVP)

React + react-three-fiber (chat + 3D viewport)
        │  POST /api/generate | /api/repair
        ▼
Hono Worker ── Claude (claude-sonnet-4-6, prompt-cached system prompt)
        │
        ▼  returns a JSCAD script
Sandboxed Web Worker (src/client/engine) ── runs script → binary STL
        ▼
three.js viewport  +  Download STL
  • Kernel: JSCAD (@jscad/modeling), pure JS — runs client-side in a Web Worker isolated from the DOM. Exports STL now.
  • Agent loop: generate → execute → on error, /api/repair (up to 3×) before the user sees anything.
  • Parameters: // @param name default // label comments in the script become live sliders that re-run locally with no API call.

Develop

npm install
wrangler secret put ANTHROPIC_API_KEY   # or add to .dev.vars for local dev
# terminal 1 — Worker API on :8787
npm run dev
# terminal 2 — Vite client on :5173 (proxies /api → :8787)
npm run dev:client

Open http://localhost:5173.

Deploy

npm run deploy        # builds client → ./public, then wrangler deploy

Serves at chisel.theradicalparty.com.

Roadmap

  • v1 — conversational edits as source-of-truth, vision verification (render → "does this match?"), auth + saved projects (D1/R2), 3MF/OBJ export.
  • v2STEP B-rep engine via build123d/OpenCascade in a Cloudflare Container/Sandbox, so exports reopen cleanly in Fusion/SolidWorks/FreeCAD. Version history & branching.
  • v3 — assemblies & mates, dimension queries ("how tall is it?"), manufacturing hints (3D print / CNC).

Layout

src/worker/     Hono API — Claude orchestration, prompts, repair
src/client/     React app, 3D viewer, JSCAD Web Worker engine