Arch Agent Studio
by corawz
README.md
# Arch Agent Studio
**An open-source, harness-agnostic architectural modeling toolkit for AI agents.**
An agent describes a building through a small set of structured tools. A deterministic geometry
checker tells it exactly what is wrong. A read-only 3D viewer shows the result — bad rooms in red,
repaired rooms back to neutral — on a phone or a desktop, live or as a static replay.
> **Live static replay demo (zero backend, works on phone & desktop):**
> https://corawz.github.io/arch-agent-studio/
>
> Status: Phase 1 MVP release. Screenshots below are real captures from the bundled
> Claude Code recordings; see the [compatibility matrix](#harness-compatibility) for what has been
> live-verified so far.
## Why this architecture
The common way to get 3D out of a language model is to have it write a one-off script and hope
the result is right. That fails quietly: rooms overlap, walls poke through the site boundary, a
door sits past the end of its wall, and nothing in the loop notices.
Arch Agent Studio takes the opposite approach.
- **Restricted, structured tools instead of free-form code.** The agent can only create a
building, add or change rooms and export. Every argument is schema-checked; an unknown field is
refused rather than silently dropped. There is no shell and no code execution behind these tools, and the
only files they can write are exports inside one export directory.
- **A deterministic validator instead of self-assessment.** After every change the server returns
a validation report computed by plain geometry code: which rooms, which rule, by how much, and a
suggested fix. The same input always produces the same report.
- **Errors are shown, not hidden.** A room that breaks a rule is still placed in the scene so the
viewer can paint it red and the agent can repair it with `modify_room`. The repair loop is
visible step by step.
- **The harness is interchangeable.** The server speaks standard MCP over stdio. It does not ship
its own chat UI, model proxy or API-key handling; you bring the agent you already use.
## Architecture and features
```
AI agent (any MCP harness)
│ stdio (MCP)
▼
packages/mcp-server ──────► packages/core
10 modeling tools building model, operations,
read-only preview bridge 6 validation rules, glTF export, session trace
│ HTTP GET + WebSocket (read-only, loopback by default)
▼
packages/viewer
live 3D white-model preview · static replay site (no backend)
```
**10 MCP tools**
| Tool | Purpose |
|---|---|
| `create_building` | Start a building: footprint, floor height, number of floors |
| `upsert_floor` | Add or rename a floor, or change its height |
| `add_room` / `add_rooms_batch` | Place one room or several, with optional doors and windows |
| `modify_room` | Change a room's position, size, type, name or openings |
| `delete_room` | Remove a room |
| `validate_layout` | Run the geometry checks and return the full report |
| `get_scene_state` | Read the current model, summary and validation |
| `export_scene` | Export the model (JSON), a glTF 2.0 white model, or the session replay |
| `get_preview_info` | Where the preview is listening and how it is protected |
**6 deterministic geometry rules**
| Code | Severity | Meaning |
|---|---|---|
| `OUT_OF_BOUNDS` | error | A room extends past the building footprint |
| `ROOM_OVERLAP` | error | Two rooms on the same floor overlap |
| `MIN_DIMENSION` | error | A room is narrower than 1.5 m (corridors: 1.2 m) or has a non-positive size |
| `OPENING_OUT_OF_WALL` | error | A door or window does not fit on its wall, or overlaps another opening |
| `DUPLICATE_ID` | error | Two rooms share an id (also: duplicate floor levels, duplicate opening ids in a room) |
| `DISCONNECTED_FLOOR_HINT` | warning | Some rooms on a floor are not connected to the floor's main group of rooms (a hint, never blocking) |
**Viewer**
- Mobile/remote-first: on a phone the 3D view is the main area with a collapsible bottom sheet;
on a desktop it sits next to a fixed sidebar. One-finger rotate, two-finger zoom and pan.
- Rooms with errors are highlighted in red; selecting an issue isolates its floor and frames the
room; a clean layout shows a green pass state.
- Floor filter and exploded view; tap or hover a room for its name, type, floor, size and area.
- **Live** mode follows the agent over a WebSocket and reconnects on its own.
- **Static Replay** mode is the same front-end built as a plain static site (relative paths, no
server), with play, step and timeline controls. It is always labelled `Static Replay Demo`.
**Export**: standard glTF 2.0 (one box per room, Y-up, metres) and the building as JSON.
## Screenshots
Captured in Chrome from the bundled static replay recordings (`Sydney Corner Café & Bookshop` and
`Architecture School Studio & Pin-up Gallery`):
| | |
|---|---|
|  |  |
|  |  |
## Quick start
```bash
bun install
bun run build:all # core + MCP server, the live viewer page and the static replay site
bun run test
```
Mount the server in your harness (Claude Code shown; more in
[`examples/harness-configs/`](examples/harness-configs/)):
```json
{
"mcpServers": {
"arch-agent-studio": {
"command": "bun",
"args": ["/path/to/arch-agent-studio/packages/mcp-server/dist/cli.js"]
}
}
}
```
Then ask the agent for a building, and open `http://127.0.0.1:4747/` to watch it take shape.
To look at the bundled replays without any agent:
```bash
cd packages/viewer/dist-replay && python3 -m http.server 8080
```
### Harness compatibility
| Harness | Status | Notes |
|---|---|---|
| Claude Code | **Verified** | v2.1.323 on Linux with Bun 1.4.4, in a non-interactive session started with `--mcp-config`; all 10 tools exercised end to end. `.mcp.json` auto-discovery and `claude mcp add` not yet exercised. Details: [`docs/m3-verification.md`](docs/m3-verification.md) |
| Codex CLI | Config Template (Unverified) | [`codex.config.toml`](examples/harness-configs/codex.config.toml) |
| OpenCode | Config Template (Unverified) | [`opencode.json`](examples/harness-configs/opencode.json) |
| Cursor | Config Template (Unverified) | [`cursor.mcp.json`](examples/harness-configs/cursor.mcp.json) |
| Antigravity | Config Template (Unverified) | [`antigravity.mcp.json`](examples/harness-configs/antigravity.mcp.json) |
"Verified" means we ran it. "Config Template" means the file follows the harness's documented
format and has not been launched against the real tool.
### Bundled replays
The static replay site ships four recordings. Each one is a real Claude Code session driving this
MCP server from a single prompt; the steps are stored exactly as the session produced them.
Prompts, model, step counts and which runs hit validation errors are listed in
[`docs/m3-verification.md`](docs/m3-verification.md).
## Remote-first security model
The preview is meant to be watched from another device while an agent works on a remote machine,
so its defaults are conservative.
- **Loopback by default.** The preview binds to `127.0.0.1`. Nothing is reachable from the network
unless you change `--host`.
- **Read-only.** It answers `GET`/`HEAD` and pushes updates over a WebSocket. Every other method
is `405`, messages sent by clients are ignored, and no endpoint can change the model, read a
file or run anything.
- **Remote access goes through something you already trust**: a private network such as Tailscale,
or an authenticated reverse proxy named with `--allowed-hosts`. Requests addressed to an
unexpected host name are refused, which blocks DNS rebinding.
- **Optional access token.** When the `ARCH_PREVIEW_TOKEN` environment variable is set (at least
16 characters), the model data requires that token; `--preview-token` makes a missing variable a
start-up error instead of an open preview. The value is never taken from the command line. The
viewer page keeps it in memory only — not in `localStorage`, not in the URL — and sends it to the
WebSocket as a sub-protocol, so the page does not put it into history, logs or referrers.
(Scripts may still pass it as an `Authorization` header or a `?token=` query parameter.)
- **Static hosting by lookup table.** The viewer build is read into memory at start-up and served
by exact match; a request path is never joined to a disk path.
- **Exports stay in one directory.** `export_scene` accepts relative paths inside the export
directory only; absolute paths, `..` and symlink escapes are refused.
## Limitations and non-goals
- **Geometry checks only.** The validator checks rectangles against rectangles. It is not a
building-code, fire-safety or accessibility review and makes no such claim.
- **Not BIM.** Rooms are axis-aligned boxes with doors and windows as marks on walls. There is no
IFC import or export, no walls with thickness, no stairs, structure or services.
- **Runtime.** Everything here has been run on Bun 1.4.4. Node.js/npm has not been tested yet.
- **One harness verified.** See the matrix above.
- **No chat UI, no model proxy, no key management, no usage dashboard.** Those belong to the
harness.
- The viewer has been checked in desktop Chrome and at phone widths in Chrome's device mode;
testing on a range of physical phones is still to come.
## AI collaboration disclosure
This project is built by its author together with AI coding partners. The author sets the product
positioning, the architectural constraints, the security boundaries and the acceptance bar, and
reviews and accepts each milestone. AI coding partners contributed design drafts, the code, the
tests and the replay recordings, and reviewed one another's work. The recordings in the replay
site were produced by a model calling the tools; none of their steps were written or edited by
hand.
## License
[MIT](LICENSE) — Copyright (c) 2026 Yanjun Zhou.