What it is
Crucible is a browser-based development environment for Web3 apps (dApps, which are web frontends backed by smart contracts). You describe an app in plain language. An AI agent writes the Solidity contracts and the frontend, compiles and deploys them to a local blockchain, and shows a live preview. The chat is the main interface. The editor, terminal and transaction inspector let you watch and override each step.
The problem
A dApp workflow spans several separate tools: an editor, a terminal running a local node, a browser, a wallet extension and a block explorer. The developer wires them together by hand, for example by adding a local RPC URL to the wallet and resetting nonces after each chain restart. A general AI assistant sees only the source files. It cannot see chain state, balances or past deployments.
Crucible puts these tools behind one agent, so the agent reads the same chain, files and logs that the developer sees.
How it works
The repository is a Bun and Turborepo monorepo. A control plane in packages/backend (Hono, better-auth, Postgres through Prisma) manages workspaces. It starts one Docker container per workspace, using the crucible-runtime image. Each container hosts that workspace's tool servers. The agent calls these servers through MCP (Model Context Protocol, a standard for exposing tools to a model).
| Package | Role |
|---|---|
packages/agent | Agent loop built on AI SDK v6 streamText, with one MCP client per tool server |
packages/mcp-chain | Per-workspace Hardhat node: snapshot, revert, mine, fork |
packages/mcp-compiler | Solidity compilation and artifact store |
packages/mcp-deployer | Local, 0G Galileo and Sepolia deploys, plus transaction traces |
packages/mcp-wallet | Dev accounts, signing and contract calls |
packages/mcp-memory | Revert-fix memory on 0G Storage, with a local file fallback |
packages/mcp-mesh | Runs a Gensyn AXL peer-to-peer node and exchanges help requests |
packages/mcp-terminal, packages/mcp-devtools | Agent shell access and tool-call events |
packages/frontend | SvelteKit app with CodeMirror editor, xterm.js terminal and preview pane |
packages/types | Shared types for agent events, API and tool inputs |
The data flow for one prompt:
- The browser posts the prompt to the control plane. The agent streams events back over server-sent events.
- The agent writes files into the workspace directory on the host. That directory is mounted into the container.
- The compiler reads contracts from that directory. The deployer records results in
.crucible/state.json. - The control plane runs a Vite dev server for the workspace frontend and shows it in an iframe.
- The preview page gets a small script that provides
window.ethereum. The script forwards allowed requests to the parent page bypostMessage. The parent sends them to the backend RPC endpoint, which forwards them to Hardhat. Private keys stay out of the iframe.
The self-healing loop in packages/agent/src/loop.ts starts when a deploy or contract call reverts. It forces a fixed sequence of phases: snapshot the chain, trace the transaction, recall known fixes, write a patch, recompile, restore the snapshot and redeploy. If the redeploy succeeds, the agent resumes the original task. After three failed attempts, the turn ends with a repair_failed event. The recall step checks memory for fixes seen before. When memory has no hit, the system prompt tells the agent to ask peer instances over the mesh.
After a deploy, the agent connects to KeeperHub's hosted MCP server when KEEPERHUB_API_KEY is set. It then uses KeeperHub's workflow tools to set up scheduled or conditional on-chain actions.
What I built
I built the tool servers the agent calls (the MCP servers in the table above). I also built the KeeperHub integration, the 0G integration and the wiring of both into the agent loop. I hosted the live demo on DigitalOcean droplets.
Design decisions
A real backend runtime instead of WebContainers. docs/ARCHITECTURE.md rejects browser-hosted runtimes because Hardhat tracing, long-lived chain state, the AXL node and shared shell sessions need real processes. The browser renders the interface. The backend owns the runtime. The cost is that Crucible cannot be a static site and needs a stateful server.
One container per workspace. Each workspace gets its own chain, tool servers and AXL node. A tool call on one workspace cannot reach another. The runner has no auth of its own, so its host ports must stay bound to loopback, and the control plane checks the session and workspace owner.
A raw socket for the terminal. The docs say Bun's process model cannot hold an interactive bash session and dockerode's hijack mode hangs under Bun. The backend instead upgrades a socket to the Docker engine by hand, in a few dozen lines. The agent uses a separate shell (mcp-terminal), so agent commands and user typing do not mix output.
Forced phases for repair. The loop restricts the available tools and the forced tool choice in each repair phase. This keeps a weaker model on the sequence, and it prevents skipped steps. The trade-off is that the repair path is rigid. A fix that needs a different order of steps is not possible.
Visible fallback for inference. The agent uses 0G Compute by default. An OpenAI-compatible endpoint is a degraded-mode fallback. The docs require the UI to show the active provider, so a fallback is never presented as a 0G response.
Memory split from the working tree. Source files live on backend disk for speed. Only verified fixes go to 0G Storage.
Run it locally
You need Bun 1.3 or later, Docker and a Postgres database. The repository also ships a VS Code devcontainer with Postgres.
- Clone the repository:
git clone https://github.com/WhyAsh5114/Crucible.git - Install dependencies:
cd Crucible && bun install - Copy the backend config:
cp packages/backend/.env.example packages/backend/.env - Set
DATABASE_URLandBETTER_AUTH_SECRETin that file. AddKEEPERHUB_API_KEYand the 0G credentials to enable those features. - Build the workspace runtime image:
docker build -t crucible-runtime:latest -f packages/backend/runtime/Dockerfile . - Start the backend and frontend:
bun run dev
For hosted deployment, see docs/DEPLOYMENT.md in the repository.
Reference
| Layer | Choice | Used for |
|---|---|---|
| Runtime and build | Bun, TypeScript, Turborepo | Execution, types and task graph |
| Backend | Hono, better-auth (SIWE and Google), Prisma, Postgres | API, sessions and workspace metadata |
| Frontend | SvelteKit 2, CodeMirror 6, xterm.js | App shell, editor and terminal |
| Agent | AI SDK v6, @ai-sdk/mcp | Tool calling and MCP clients |
| Chain tooling | Hardhat, solc-js, viem | Local chain, compile and RPC types |
| 0G | Compute, Storage (KV and log) | Inference with receipts and persistent memory |
| Mesh | Gensyn AXL | Peer-to-peer help requests between instances |
| Automation | KeeperHub hosted MCP | Post-deploy workflows |
| Tests and CI | Vitest, bun test, GitHub Actions | Format, lint, type check, build and tests |
Outcome
Three people built Crucible for Open Agents 2026, an ETHGlobal event that ran asynchronously for 14 days from 24 April 2026. The hackathon page records no placement. It notes a shout-out from KeeperHub for the integration.
The repository has about 650 commits from 25 April to 3 May 2026 across three contributors, and an MIT LICENSE file. todo.md marks the local build, self-repair, 0G and KeeperHub work as done. It lists as unchecked the dedicated mesh panel, the same-machine and two-laptop AXL proofs, and the live KeeperHub demo run.