Skip to content

k1bot2026/ForgeAI

Repository files navigation

ForgeAI

AI-Powered Engineering Design Tool

From problem description to production-ready blueprints, BOMs, and assembly guides -- driven by a multi-agent AI system with intelligent LLM routing.


Status TypeScript React Express Claude License


The Problem

Engineering design is iterative, multi-disciplinary, and time-consuming. A single product -- even something as simple as a sensor mount for a conveyor belt -- requires structural analysis, electrical design, wiring diagrams, firmware, a bill of materials, and assembly instructions.

Each discipline has its own tools, its own experts, and its own bottleneck.

ForgeAI replaces that fragmented process with a single guided workflow. Describe your engineering problem in plain language, and a team of specialized AI agents collaborates to produce a complete, validated design package.


Screenshots

Dashboard & Project Management

ForgeAI Dashboard

Project creation, backend health monitoring, and orchestrator testing interface

Full Application View

ForgeAI Full Page

Complete interface showing project management, active project selection, and the AI orchestrator test panel with SSE streaming


Architecture

ForgeAI uses a multi-agent architecture with a 5-tier LLM routing system. Each agent is a specialized AI call with a domain-specific system prompt, coordinated by an Orchestrator.

System Overview

graph TB
    subgraph Frontend["Frontend (React + Vite)"]
        UI[Project Dashboard]
        WIZARD[9-Step Design Wizard]
        SSE_HOOK[useDesignAgent Hook]
        THREE[Three.js 3D Viewer]
        WIRING_UI[D3.js Wiring Diagrams]
        MONACO[Monaco Code Editor]
    end

    subgraph Backend["Backend (Express + TypeScript)"]
        API[REST API + SSE Streaming]
        ORCH[Orchestrator Agent]
        DB[(SQLite Database)]
        
        subgraph Agents["Specialized AI Agents"]
            REQ[Requirements]
            STRUCT[Structural]
            ELEC[Electrical]
            PHYS[Physics Validation]
            WIRE[Wiring]
            EMB[Embedded/Firmware]
            CAD[CAD/3D Models]
            BOM_A[Bill of Materials]
            ASM[Assembly Guide]
        end

        subgraph LLM["5-Tier LLM Router"]
            T1["Tier 1: Local Small<br/>(Ollama - fast tasks)"]
            T2["Tier 2: Local Medium<br/>(LocalAI Gateway)"]
            T3["Tier 3: Local Large<br/>(Heavy local models)"]
            T4["Tier 4: Claude Standard<br/>(claude-sonnet-4)"]
            T5["Tier 5: Claude Complex<br/>(Full reasoning)"]
        end
    end

    UI --> API
    SSE_HOOK -->|Server-Sent Events| API
    API --> ORCH
    ORCH --> Agents
    Agents --> LLM
    Agents --> DB
    API --> DB

    style Frontend fill:#1a1a2e,stroke:#16213e,color:#e0e0e0
    style Backend fill:#0f3460,stroke:#16213e,color:#e0e0e0
    style Agents fill:#533483,stroke:#16213e,color:#e0e0e0
    style LLM fill:#e94560,stroke:#16213e,color:#e0e0e0
Loading

Agent Pipeline

The design flows through 9 specialized agents in sequence. The Physics Agent acts as a validation gate -- designs must pass structural and thermal checks before proceeding to manufacturing phases.

flowchart LR
    INPUT["User Input<br/>Problem Description"] --> ORCH["Orchestrator<br/>Design Plan"]
    ORCH --> REQ["Requirements<br/>Analysis"]
    REQ --> CONCEPT{"Concept<br/>Generation"}
    CONCEPT --> STRUCT["Structural<br/>Agent"]
    CONCEPT --> ELEC["Electrical<br/>Agent"]
    STRUCT --> PHYS["Physics<br/>Validation Gate"]
    ELEC --> PHYS
    PHYS -->|Pass| WIRE["Wiring<br/>Agent"]
    PHYS -->|Fail| CONCEPT
    WIRE --> EMB["Embedded<br/>Agent"]
    EMB --> CAD_A["CAD<br/>Agent"]
    CAD_A --> BOM_A["BOM<br/>Agent"]
    BOM_A --> ASM["Assembly<br/>Agent"]
    ASM --> OUTPUT["Complete Design<br/>Package (ZIP)"]

    style PHYS fill:#e94560,stroke:#333,color:#fff
    style OUTPUT fill:#00C853,stroke:#333,color:#fff
    style INPUT fill:#2196F3,stroke:#333,color:#fff
Loading

LLM Routing Strategy

ForgeAI intelligently routes AI tasks across 5 tiers based on complexity, falling back gracefully when local models aren't available:

flowchart TD
    TASK[Incoming Agent Task] --> ROUTER{LLM Router}
    
    ROUTER -->|"Simple classification,<br/>formatting"| LOCAL_S["Local Small<br/>(Ollama Direct)"]
    ROUTER -->|"Code generation,<br/>analysis"| LOCAL_M["Local Medium<br/>(LocalAI Gateway)"]
    ROUTER -->|"Complex reasoning,<br/>multi-step"| LOCAL_L["Local Large<br/>(Heavy Local)"]
    ROUTER -->|"Standard agent work"| CLAUDE_S["Claude Standard<br/>(SDK / CLI)"]
    ROUTER -->|"Full design reasoning,<br/>validation"| CLAUDE_C["Claude Complex<br/>(Full Context)"]

    LOCAL_S -->|Unavailable| LOCAL_M
    LOCAL_M -->|Unavailable| CLAUDE_S
    LOCAL_L -->|Unavailable| CLAUDE_S

    style ROUTER fill:#e94560,stroke:#333,color:#fff
    style LOCAL_S fill:#4CAF50,stroke:#333,color:#fff
    style LOCAL_M fill:#8BC34A,stroke:#333,color:#fff
    style LOCAL_L fill:#CDDC39,stroke:#333,color:#000
    style CLAUDE_S fill:#7C4DFF,stroke:#333,color:#fff
    style CLAUDE_C fill:#6200EA,stroke:#333,color:#fff
Loading

Database Schema

erDiagram
    projects ||--o{ requirements : has
    projects ||--o{ design_revisions : has
    projects ||--o{ bom_items : has
    projects ||--o{ wiring_connections : has
    projects ||--o{ firmware_files : has
    projects ||--o{ assembly_steps : has

    projects {
        text id PK
        text name
        text description
        text environment
        text industry
        text urgency
        text board_category
        text board_type
        text status
    }

    design_revisions {
        text id PK
        text project_id FK
        integer version
        text phase
        text agent
        text content_json
    }

    bom_items {
        text id PK
        text project_id FK
        text part_number
        text description
        text material
        integer quantity
        text type
        real cost
        text supplier
    }

    wiring_connections {
        text id PK
        text project_id FK
        text from_component
        text to_component
        text signal_type
        text cable_spec
    }
Loading

Engineering Calculations & Algorithms

The agents don't just generate text -- they perform real engineering calculations. Below are the core formulas and algorithms used by the Structural, Physics, and Electrical agents.

Structural Analysis (Structural Agent)

Beam deflection under uniform load -- used to verify mounting brackets won't deform beyond tolerance:

$$\delta_{max} = \frac{5 \cdot w \cdot L^4}{384 \cdot E \cdot I}$$

where $w$ = distributed load (N/m), $L$ = beam length (m), $E$ = Young's modulus (Pa), $I$ = second moment of area (m⁴).

Von Mises stress criterion -- determines whether a component will yield under combined loading:

$$\sigma_{vm} = \sqrt{\sigma_x^2 - \sigma_x \sigma_y + \sigma_y^2 + 3\tau_{xy}^2}$$

The agent compares $\sigma_{vm}$ against the material's yield strength $\sigma_y$ and computes the safety factor:

$$n = \frac{\sigma_{yield}}{\sigma_{vm}} \quad \Rightarrow \quad \begin{cases} n \geq 2.0 & \text{Pass (green)} \ 1.5 \leq n < 2.0 & \text{Warning (orange)} \ n < 1.5 & \text{Fail (red)} \end{cases}$$

Bolt preload calculation for connection design:

$$F_{preload} = 0.9 \cdot \sigma_y \cdot A_s \qquad T = K \cdot d \cdot F_{preload}$$

where $A_s$ = tensile stress area, $K$ = torque coefficient (~0.2 for dry steel), $d$ = nominal bolt diameter.

Thermal & Vibration Analysis (Physics Agent)

Steady-state heat conduction through enclosure walls -- validates that electronics won't overheat:

$$\dot{Q} = \frac{T_{internal} - T_{ambient}}{R_{total}} \qquad R_{total} = \sum_{i=1}^{n} \frac{t_i}{k_i \cdot A_i} + \frac{1}{h_{conv} \cdot A_{surface}}$$

where $R_{total}$ combines conductive resistance through each wall layer ($t$ = thickness, $k$ = thermal conductivity) and convective resistance at the surface ($h_{conv}$ = convection coefficient).

Junction temperature estimation for electronics:

$$T_j = T_{ambient} + P_{dissipated} \cdot \left( R_{\theta JC} + R_{\theta CS} + R_{\theta SA} \right)$$

The Physics agent flags $T_j &gt; 0.8 \cdot T_{j,max}$ as a warning and $T_j &gt; T_{j,max}$ as a failure.

Natural frequency check to prevent resonance failures:

$$f_n = \frac{1}{2\pi} \sqrt{\frac{k}{m}} \qquad \text{Margin: } \frac{f_n}{f_{excitation}} > 1.4 \text{ or } < 0.7$$

The validation gate ensures the natural frequency is sufficiently separated from known excitation frequencies (motor RPM, conveyor vibration, etc.).

Electrical Design (Electrical Agent)

Power budget calculation across all circuits:

$$P_{total} = \sum_{i=1}^{n} V_i \cdot I_i \cdot D_i \qquad I_{supply} = \frac{P_{total}}{\eta \cdot V_{supply}}$$

where $D_i$ = duty cycle of component $i$ and $\eta$ = power supply efficiency.

Cable sizing based on voltage drop and thermal limits:

$$A_{min} = \frac{2 \cdot \rho \cdot L \cdot I}{\Delta V_{max}} \qquad \Delta V_{max} = 0.03 \cdot V_{supply}$$

where $\rho$ = resistivity (Ω·m), $L$ = cable length, $I$ = current, and the 3% voltage drop limit is applied per industrial standard.

RC filter design for sensor signal conditioning:

$$f_c = \frac{1}{2\pi \cdot R \cdot C} \qquad |H(f)| = \frac{1}{\sqrt{1 + \left(\frac{f}{f_c}\right)^2}}$$

Validation Gate Algorithm

The Physics agent runs all checks and produces a traffic-light report:

Algorithm: VALIDATION_GATE(design)
─────────────────────────────────────
  results ← []
  
  // Structural checks
  FOR each component IN design.structural:
      σ_vm  ← vonMises(component.loads)
      n     ← component.material.σ_yield / σ_vm
      δ_max ← deflection(component.geometry, component.loads)
      results.push({
          check:  "Structural integrity",
          status: n ≥ 2.0 ? GREEN : n ≥ 1.5 ? ORANGE : RED,
          value:  "Safety factor = {n:.2f}"
      })

  // Thermal checks
  T_j ← junctionTemp(design.electrical, design.enclosure)
  results.push({
      check:  "Thermal management",
      status: T_j < 0.8·T_max ? GREEN : T_j < T_max ? ORANGE : RED,
      value:  "T_junction = {T_j:.1f}°C (max {T_max}°C)"
  })

  // Vibration checks
  f_n ← naturalFreq(design.structural)
  margin ← f_n / design.environment.f_excitation
  results.push({
      check:  "Vibration isolation",
      status: margin > 1.4 OR margin < 0.7 ? GREEN : ORANGE,
      value:  "f_n = {f_n:.1f} Hz, margin = {margin:.2f}"
  })

  // Gate decision
  IF any result.status == RED:
      RETURN { proceed: false, results }
  ELSE:
      RETURN { proceed: true, results }
flowchart TD
    D[Design Input] --> S["Structural Analysis<br/>σ_vm, δ_max, safety factor"]
    D --> T["Thermal Analysis<br/>T_junction, R_thermal"]
    D --> V["Vibration Check<br/>f_natural vs f_excitation"]

    S --> GATE{"Validation<br/>Gate"}
    T --> GATE
    V --> GATE

    GATE -->|"All Green/Orange"| PASS["PASS<br/>Proceed to Wiring"]
    GATE -->|"Any Red"| FAIL["FAIL<br/>Return to Concept"]
    FAIL -->|"Auto-feedback"| REDESIGN["Structural/Electrical<br/>Agent Redesign"]
    REDESIGN --> D

    style PASS fill:#00C853,stroke:#333,color:#fff
    style FAIL fill:#e94560,stroke:#333,color:#fff
    style GATE fill:#FF9800,stroke:#333,color:#fff
Loading

The 9-Step Design Wizard

ForgeAI guides users through a complete engineering design workflow:

Step Agent Input Output
1 Orchestrator Problem description in plain language Design plan, agent routing
2 Requirements Context, environment, constraints Functional, mechanical, electrical specs
3 Structural + Electrical Requirements 2-3 concept alternatives
4 Physics Selected concept Validation report (pass/warn/fail)
5 Wiring Validated design Interactive SVG schematics
6 Embedded Wiring + board selection Compilable firmware code
7 CAD Full design 3D models (Three.js + Blender)
8 BOM All components Parts list with costs and suppliers
9 Assembly Everything Step-by-step build instructions

Every AI-generated output includes a disclaimer: "AI-generated design -- have it reviewed by a qualified engineer."


Agent Specifications

Agent Domain System Prompt Language Key Outputs
Orchestrator Project coordination Dutch Design plan, agent routing, phase management
Requirements Specification analysis -- Functional, mechanical, electrical specs; standards (CE, IP, ATEX)
Structural Mechanical engineering -- Component geometry, materials, stress calculations, safety factors
Electrical Controls engineering -- Circuit design, power budgets, cable specifications, EMC
Physics Design validation -- Static/dynamic analysis, thermal simulation, safety reports
Wiring Electrical diagrams -- Interactive SVG schematics, cable lists, pin mappings
Embedded Firmware -- C++/Python code for Arduino, ESP32, RPi Pico, STM32, PLCs
CAD 3D modeling -- Three.js geometry + Blender Python scripts for STEP/STL export
BOM Procurement -- Parts lists with buy-vs-make, costs, suppliers
Assembly Manufacturing -- Phased instructions, tool requirements, torque specs

Tech Stack

React Vite TypeScript Tailwind Express SQLite Three.js D3.js Claude Ollama

Layer Technology Purpose
Frontend React + Vite + TypeScript SPA with fast HMR
Styling Tailwind CSS Utility-first styling
Backend Express + TypeScript REST API + SSE streaming
Database SQLite (better-sqlite3) Projects, revisions, BOMs, wiring, firmware
AI Engine Claude API (claude-sonnet-4) Primary agent reasoning with streaming
AI Routing 5-tier LLM Router Ollama / LocalAI / Claude SDK / Claude CLI
3D Preview Three.js + OrbitControls In-browser 3D model interaction
3D Production Blender Python API STEP/STL/OBJ export for manufacturing
Wiring D3.js + SVG Interactive clickable schematics
Code Editor Monaco Editor Syntax-highlighted firmware editing
PDF Export Puppeteer / pdfkit Technical drawings and assembly guides
Monorepo pnpm workspaces Frontend + backend in single repo

Getting Started

Prerequisites

  • Node.js >= 20
  • pnpm >= 8
  • Blender >= 3.6 (optional -- falls back to Three.js-only mode)
  • An Anthropic API key with access to claude-sonnet-4

Development Setup

git clone https://github.com/k1bot2026/ForgeAI.git
cd ForgeAI

pnpm install

cp .env.example .env
# Add your ANTHROPIC_API_KEY to .env

pnpm dev

Frontend: http://localhost:5173 | Backend: http://localhost:3001

Environment Variables

Variable Description Required
ANTHROPIC_API_KEY Anthropic API key for Claude Yes
PORT Backend server port (default: 3001) No
BLENDER_PATH Path to Blender binary No
LOCALAI_URL LocalAI gateway endpoint No
OLLAMA_URL Ollama endpoint (default: http://localhost:11434) No

API Endpoints

Method Endpoint Description
GET /api/health Backend status check
GET /api/projects List all projects
POST /api/projects Create a new project
GET /api/projects/:id Get project details
PUT /api/projects/:id Update project
DELETE /api/projects/:id Delete project
POST /api/projects/:id/design Start orchestrator (SSE stream)

Project Structure

ForgeAI/
├── frontend/                    # React + Vite application
│   └── src/
│       ├── App.tsx              # Main UI with project CRUD + orchestrator
│       ├── hooks/
│       │   └── useDesignAgent.ts # SSE streaming hook for agent responses
│       └── main.tsx
├── backend/                     # Express + TypeScript API
│   └── src/
│       ├── agents/
│       │   └── orchestrator.ts  # Orchestrator with Dutch system prompt
│       ├── db/
│       │   ├── schema.ts        # 7 tables: projects, requirements, etc.
│       │   └── index.ts         # SQLite initialization
│       ├── routes/
│       │   ├── projects.ts      # CRUD endpoints
│       │   └── design.ts        # SSE streaming endpoint
│       ├── services/
│       │   ├── claude.ts        # Claude API wrapper with retry logic
│       │   └── llm/
│       │       ├── router.ts    # 5-tier LLM routing logic
│       │       ├── types.ts     # Provider interfaces
│       │       └── providers/
│       │           ├── claude-sdk.ts
│       │           ├── claude-cli.ts
│       │           ├── localai-gateway.ts
│       │           └── ollama-direct.ts
│       └── index.ts             # Express server entry
├── docs/
│   ├── DESIGN.md                # Full design document (Dutch)
│   └── screenshots/             # UI screenshots
├── pnpm-workspace.yaml          # Monorepo configuration
└── package.json                 # Root scripts (pnpm dev)

Codebase: 21 TypeScript files, ~2,250 lines of code


Roadmap

ForgeAI is built in 9 sequential phases. Each phase produces a working, testable increment.

gantt
    title ForgeAI Development Phases
    dateFormat X
    axisFormat %s

    section Foundation
    Phase 1 - Scaffolding          :done, p1, 0, 1
    Phase 2 - AI Integration       :done, p2, 1, 2

    section Core Agents
    Phase 3 - Requirements Wizard  :active, p3, 2, 3
    Phase 4 - Concept Design       :p4, 3, 4
    Phase 5 - Physics Validation   :p5, 4, 5

    section Manufacturing
    Phase 6 - Wiring + Firmware    :p6, 5, 6
    Phase 7 - CAD + Export         :p7, 6, 7
    Phase 8 - BOM + Assembly       :p8, 7, 8

    section Polish
    Phase 9 - Dashboard + Polish   :p9, 8, 9
Loading
Phase Focus Status Key Deliverable
1 Project scaffolding Done Monorepo, database, CRUD API
2 AI integration Done Claude API, Orchestrator, SSE streaming, LLM router
3 Requirements wizard Next Requirements agent, Steps 1-2 of wizard UI
4 Concept design -- Structural + Electrical agents, concept cards
5 Detail + validation -- Physics agent, Three.js viewer, validation gate
6 Wiring + firmware -- Interactive diagrams, code editor
7 CAD + export -- Blender integration, PDF/STEP/STL downloads
8 BOM + assembly -- Procurement tables, build guides
9 Polish + dashboard -- Project management, responsive design, ZIP export

Design Principles

  • User stays in control. Every AI output is reviewed and approved before the next phase begins
  • Structured JSON everywhere. All agent outputs are composable, validatable, and renderable
  • Validation before fabrication. Physics agent must approve before advancing to manufacturing
  • Graceful degradation. Works without Blender (Three.js fallback) or local models (Claude fallback)
  • AI-generated means AI-disclosed. All exports carry an engineering review disclaimer

License

MIT

Author

Built by k1bot2026

About

AI-powered engineering design tool — multi-agent system for conceptual design, structural analysis, CAD generation, and BOM output

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages