Skip to content

varun29ankuS/Roshera-CAD

Repository files navigation

Roshera

Roshera

An agent runtime for geometry — a native Rust B-Rep kernel with a semantic surface AI can query, reason about, and act on.

Status License


Roshera kernel demo — datum system, B-Rep topology, viewport navigation

Native B-Rep kernel: datum system, topology, tessellated viewport — running through the same REST/WebSocket bridge an external agent would use.


Roshera is an agent runtime for geometry. The product is the kernel and the bridge it exposes: a native Rust B-Rep engine whose primitives, topology, and operations carry enough semantic structure for an LLM to query, reason about, and drive directly. Humans orchestrate; agents execute. The React/Three.js frontend that ships in this repo is one client of that runtime — it talks to the kernel over REST + WebSocket the same way an external agent would.

The differentiator is the readable surface: geometry is not just triangles, it is a queryable model with named features, intent, and history. Many things work, many things don't — see Status for what's actually usable today.

Dark Mode Light Mode
Dark Mode Light Mode

Architecture

roshera-backend/
  geometry-engine/     B-Rep kernel: NURBS math, primitives, topology, operations, tessellation
  ai-integration/      LLM providers (Claude, OpenAI) + vision pipeline + smart routing
  timeline-engine/     Event-sourced design history with branching
  session-manager/     Multi-user collaboration with RBAC
  export-engine/       STL, OBJ, encrypted .ros (AES-256-GCM), STEP (in progress)
  rag-engine/          Vamana-indexed retrieval for design knowledge
  api-server/          Axum REST + WebSocket API
  shared-types/        Common type definitions

roshera-app/           React + Three.js + TypeScript browser client

Direction

The kernel is the product. The viewport you see in the screenshots is one client of it, written to prove the bridge works at human latency. The same REST + WebSocket surface drives agents.

Where this is going: agents that pick faces, fillet edges, run sections, and walk a part the way a designer would — by reasoning over the readable surface (named features, persistent IDs, the timeline of events that produced the current state), not by parsing triangle soup. A CLI client and an MCP server are next on the list, then embeddings and retrieval over the timeline so an agent can answer questions like "how did this corner get to be 4mm" without re-deriving the model from scratch.

Status

What follows is honest about what's tested versus what's implemented but rough. Measured perf numbers are in Performance.

Layer Component Status
Math Vector3, Matrix4, Quaternion Tested
B-spline, NURBS evaluation Tested; perf above budget (see Performance)
Primitives Box, Sphere, Cylinder, Cone, Torus B-Rep topology with Euler validation
Topology Manifold detection, adjacency Tested
Tessellation Per-surface dispatch, adaptive subdivision Works for analytic surfaces; extruded curved profiles still have watertightness issues
Operations Extrude (draft, taper, twist) Implemented; side-face seam bugs being chased
Boolean (union, intersect, difference) Implemented; edge cases (e.g. drill-through-cube) still fail in places
Fillet (constant-radius) Implemented, lightly tested
Chamfer, Offset, Sewing Implemented, lightly tested
Revolve (full/partial) Implemented, lightly tested
Sweep (single path) Implemented; multi-guide not done
Loft (ruled surfaces) Implemented; smooth NURBS loft not done
Sketch 2D Newton-Raphson constraint solver Implemented
Assembly Data model + mates Defined; constraint solver not done
Export STL, OBJ, encrypted .ros Works
STEP Skeleton in place; output not validated
AI Claude + OpenAI providers Works
Vision pipeline + smart routing Implemented
Natural language command parsing Works for common commands
Infrastructure Timeline (event-sourced history) Works
RAG (Vamana vector index) Works
Session manager (multi-user, RBAC) Works
Frontend React + R3F viewport, toolbar, chat Works; rough around the edges

Performance

Measured numbers from the geometry kernel. See individual sections below for detail and methodology. Full table and reproduction commands in BENCHMARKS.md.

Math microbenchmarks

Criterion, release build, median of 100 samples.

Operation Time
Vector3 dot 500 ps
Vector3 cross 884 ps
Vector3 normalize 1.68 ns
Vector3 add 984 ps
Matrix4 multiply 5.14 ns
Matrix4 inverse 29.4 ns
Matrix4 transpose 5.50 ns
Point3 distance 505 ps
Point3 translate 868 ps

Primitive creation

Full B-Rep topology construction with a fresh BRepModel per iteration. Criterion, release build.

Primitive Time
Box 65 µs
Sphere 49 µs
Cylinder 50 µs

Boolean and intersection

Internal benchmark suite on 1k-face inputs, release build.

Operation Measured Internal target
Boolean union 50.5 ms <100 ms
Boolean intersection 75.4 ms <150 ms
Face–face intersection 25.3 ms <50 ms

All three are within their internal regression budgets on this host.

NURBS and B-spline evaluation

1M-point sweep, release build.

Operation Measured Internal target
NURBS surface eval 158 ms <25 ms
B-spline curve eval 36.8 ms <10 ms

Both are above their internal regression budgets — NURBS eval by ~6× and B-spline eval by ~3.7×. Flagged for profiling and optimization.

Tessellation and memory

Metric Measured Internal target
Tessellation (1M triangles, estimated) 5,350 ms <250 ms
Memory per 1M vertices (SoA layout) 34.3 MB <192 MB

Memory is under budget on this host. Tessellation is the largest performance gap (~21× over target) and the next thing to profile.

Coverage gaps

  • Delete primitives — only correctness tests (delete_solid, delete_face, cascade, orphan cleanup). No Criterion target yet.
  • 2D sketch creation (sketch2d) — ~5k LoC subsystem with 69 passing correctness tests, but no timing benchmark target.
  • Cone / Torus — primitive creation benchmarks only cover Box / Sphere / Cylinder.

These are tracked as blind spots to add to benches/geometry_bench.rs.

Methodology

  • Host: Windows 11, x86_64, release build.
  • Profile overrides: CARGO_PROFILE_BENCH_LTO=off, CARGO_PROFILE_BENCH_CODEGEN_UNITS=16. Full-LTO would shave an additional 15–30% off these numbers but currently hits a rustc-LLVM OOM on this host — fix tracked separately.
  • Criterion numbers reported as the median of 100 samples after a 3-second warmup.
  • Internal-suite numbers (Boolean / NURBS / tessellation) are single-sample wall-clock with per-operation iteration counts in the 10–100 range. Treat Criterion numbers as the statistical baseline.
  • "Internal target" = internal regression budget. Not a comparison against any third-party kernel.

Reproduce:

cd roshera-backend
CARGO_PROFILE_BENCH_LTO=off CARGO_PROFILE_BENCH_CODEGEN_UNITS=16 \
  cargo bench -p geometry-engine --bench geometry_bench

CARGO_PROFILE_RELEASE_LTO=off CARGO_PROFILE_RELEASE_CODEGEN_UNITS=16 \
  cargo test --release -p geometry-engine --lib test_performance_benchmark_suite -- --nocapture

Getting Started

# Backend
cd roshera-backend
cargo run --bin api-server
# API on http://localhost:3000, WebSocket on ws://localhost:3000/ws

# Frontend (separate terminal)
cd roshera-app
npm install
npm run dev
# UI on http://localhost:5173

Docker

cd roshera-backend
docker compose up

Prerequisites

  • Rust 1.75+
  • Node.js 20+

API

# Create a box
curl -X POST http://localhost:3000/api/geometry \
  -H "Content-Type: application/json" \
  -d '{"operation": "create_primitive", "parameters": {"type": "box", "width": 10, "height": 10, "depth": 10}}'
// WebSocket
const ws = new WebSocket("ws://localhost:3000/ws");
ws.send(JSON.stringify({
  type: "GeometryCommand",
  data: { command: "CreatePrimitive", parameters: { type: "sphere", radius: 5.0 } }
}));

Logo

Roshera Logo Dimensions

The Roshera mark is a Boolean union of a rectangle (2x × 3.236x) and a circle (radius x).

License

Dual licensed. Free for non-commercial use (research, education, personal projects). Commercial use requires a paid license.

See LICENSE for details. Contact 29.varuns@gmail.com for commercial licensing.

About

Open-source AI-native CAD engine — B-Rep geometry kernel in Rust with NURBS, real-time tessellation, encrypted .ros format, and LLM-driven design. No OpenCASCADE dependency.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors