Inspiration
I built CircuitForge because I was struggling in my digital circuits class. Building combinational logic by hand or using clunky desktop simulators is frustrating, and one tiny wiring error can take hours to track down. I wanted to use modern AI to help design and debug my circuits, but standard AI assistants completely break when faced with visual canvas tools. They rely on screenshots and pixel coordinates, which fails miserably when pins are a few pixels wide and wires overlap. Instead of forcing AI to squint at a canvas and guess where to click, I wanted to give it direct, semantic access to the underlying mathematical graph of the circuit.
What It Does
CircuitForge is a browser-based digital logic studio where humans and AI agents collaborate on the exact same circuit in real time.
- For Humans: A clean visual canvas to place gates, route wires, and build computers from scratch.
- For AI Agents: A WebMCP control plane with 19 native tools to inspect, build, and verify circuits without ever "seeing" a single pixel.
Key features include:
- Modular Synthesis: Agents can build subcircuits (like an OR gate made of NANDs), test them, and package them into reusable custom ICs.
- Automated Verification: Instead of guessing if an LED is on, agents run a full truth-table verification that systematically tests every input combination.
- Signal Tracing: Tools to trace signals upstream/downstream and find floating inputs.
- Shared Viewport: Agents can pan and zoom the camera so the human and AI are always looking at the same part of the board.
How We Built It
We built CircuitForge as a 4-tier web app bridging modern web standards with a compiled WebAssembly simulation engine:
- Simulation Core: A modernized, browser-safe version of Sebastian Lague's Digital Logic Sim, running in Unity WebGL/WASM.
- C# Semantic Bridge: A custom command dispatcher that executes typed graph mutations (adding gates, toggling pins) directly on the C# netlist.
- TypeScript WebMCP Host: A Vite frontend that registers our tools into the browser's
document.modelContextwith strict Zod schemas. - Dual-Agent Support: Built-in browser WebMCP (for ChatGPT/Chrome) and a standalone WebSocket relay so external CLI agents (like Claude Code or Codex) can control the canvas too.
Challenges We Ran Into
- The Opaque Canvas: WebGL renders straight to the GPU, so there are no DOM nodes for gates or wires. Automation tools just see a blank
<canvas>. We solved this by serializing the internal C# graph into clean, typed JSON snapshots that the AI can read directly. - Async JS vs. Single-Threaded WASM: JS is async, but Unity WebGL runs single-threaded. Blocking the main thread froze the browser. We built a custom async request map with UUIDs so JS could fire a tool call, yield to the event loop, and wait for C# to resolve the Promise via a
.jslibextern. - Timing and Physics Bugs: When agents packaged subcircuits, long chip names would clip through the pins. We had to write an auto-sizer algorithm. We also had to fix race conditions during truth-table verification by forcing the simulation to "settle" for a few physics cycles before reading the outputs.
Accomplishments That We're Proud Of
- True Agentic Control: We built a system where AI can design complex logic purely through code and semantic tools, completely bypassing the hallucinations of computer vision and OCR.
- Autonomous Hierarchical Design: It was awesome to watch the AI take a prompt like "build a 3-input OR gate using only NANDs", wire it up, verify the truth table, package it as a custom chip, and then immediately use that new chip to build a majority function.
- Works Everywhere: Whether you're using an in-browser agent or an external CLI tool like Claude Code, it interacts with the live canvas seamlessly.
What We Learned
- Canvas apps can be agent-native: You don't need to sacrifice rich WebGL graphics to support AI agents. You just need to expose the underlying data model via WebMCP.
- State tracking matters: Adding monotonic revision numbers to every tool call completely fixed race conditions between the human clicking and the AI placing components.
- Digital logic is perfect for AI: Because boolean logic has strict, unambiguous mathematical rules, it's an incredible benchmark for testing an AI's ability to reason and self-correct.
What's Next for CircuitForge
- Full CPU Architectures: Moving beyond basic gates to build full 8-bit CPUs with registers, decoders, and RAM.
- Interactive Tutor Mode: An AI tutor that generates circuits with subtle bugs (like floating inputs or race hazards) and helps students debug them step-by-step.
- HDL Support: Adding tools to compile Verilog/VHDL directly into interactive CircuitForge schematics.
Built With
- c#
- cloudflare
- javascript
- json-rpc
- mcp
- node.js
- openai
- typescript
- unity
- vite
- wasm
- webgl
- zod
Log in or sign up for Devpost to join the conversation.