AI app builder
Foundry
Describe an app, watch an agent build it in a Docker sandbox, and review the preview and diff before anything becomes real.
Foundry is an app builder where you describe an app and an agent builds it inside a Docker sandbox. You review a live preview and a diff, and nothing becomes real or billable until you accept it.
01 / 06 · prompt
The short version
What was hard
Scope. I studied 13 builders, from Lovable and Replit to Bolt.new, v0 and OpenHands, and my first feature list read like a pile of capability areas instead of a product. The fix was one lifecycle from prompt to export, plus a few rules taken straight from what people complain about in the incumbents. You don't pay for failed generations, a checkpoint is a git commit, and secrets never land in chat.
How I set the agents up
Every change started as an OpenSpec spec with scenarios, and the agents built against that instead of a chat log. A second model family reviewed each change. The live specs ran against real models, so "it works" came from a run, not from an agent saying so.
How it turned out
Three months in, the whole loop works: prompt, agent run in a sandbox, live preview, diff, accept, checkpoint. Narrow live specs pass against real models at about 3 minutes and 45 cents a run, and billing only ever charges for accepted work.
Architecture
The conductor owns every state change. The sandbox talks to models only through the keyless gateway, and the browser reaches the running app only through the preview proxy.
What's next
Line-level diffs and a Costs screen in the UI.
Moving restart-time deploys and migrations behind the same action executor. It's specced at 51 tasks.
Stack and numbers
to build
per live run
per live run
The detailsWhy I built it, what it does and the decisions behind it
Why I built it
I started with a prior-art study of 13 builders, from Lovable and Replit to Bolt.new, v0 and OpenHands. My first feature list read like capability areas, not a product. It had no single lifecycle from prompt to export, no real state machines, and no acceptance criteria that asked for a real run instead of an agent saying it worked.
So I rewrote the spec around one lifecycle (prompt, task, run, diff, preview, verification, checkpoint, deploy, export) and seven product rules. The ones I care about most come from what people complain about in the incumbents. Failed generations don't bill. A checkpoint is a commit, so there's one history. Secrets never land in chat, code or commits.
What it does
- Prompt-first projects home that creates a project and drops you into a three-pane builder: agent timeline, Files, Diff and Preview, and a task and checkpoint column.
- Agent runs through Oh My Pi, one
omp --mode rpcprocess per task inside the sandbox, with streamed prose and grouped tool calls in the timeline. - Seven task modes as a closed type. Discuss and plan structurally can't hold mutating capabilities, and a sensitive capability marked
autois a compile error. - Tool approval in the timeline with Approve and Reject, under a permission mode of Ask, Accept edits, Approve all or Auto.
- Docker sandboxes by default, Firecracker opt-in, behind a preview proxy that strips headers and upgrades WebSockets.
- Checkpoints are real git commits, with scoped restore: code only, preview, deploy config, or everything.
- Cost ledger with credit events, budget caps and settlement. Debits only happen after accept.
- A keyless inference gateway, so sandboxes never hold real provider keys.
Key decisions
Effect everywhere
Why
A browser-safe domain and RPC layer plus a node-only conductor built from Effect services. Typed errors, dependency injection and tracing run end to end, and one Schema decodes at every boundary.
What it cost
The learning curve is steep, and the planned move to Effect v4 starts with about 966 language-service findings to clear.
The sandbox is the wall, accept is the gate
Why
Oh My Pi gave me a full harness (MCP, todos, model roles) without building one. Tools run freely inside the sandbox and nothing becomes real until the diff is accepted.
What it cost
Oh My Pi doesn't expose Foundry's own test and build results, which breaks the golden-path live gate.
Billing boundary equals acceptance boundary
Why
One pure predicate decides whether a task is billable, and the only debit call site sits behind diff accept. That puts "you don't pay for failed generations" in the code, not on the pricing page.
What it cost
Spend from a turn that dies partway through isn't recorded yet.
Checkpoint equals commit
Why
An internal git store holds the one history. Restore is a checkout and there are no two-way sync conflicts.
What it cost
GitHub sync is manual-first and still a stand-in, so GitHub operations return 501.
SQLite and Drizzle, no raw SQL
Why
git clone && pnpm dev with zero infrastructure, which matters when an agent sets up the stack.
What it cost
Postgres for production is a stated requirement with no driver wired in.