Build a 3D office for your AI agents with Claude Code or ChatGPT
Six robots walk around a glass office at blue hour, hand work to each other, fail a test, fix it, get approved, and celebrate. All of it comes from one 42 KB prompt that I have made public. This is a step-by-step guide to rebuilding it yourself with Claude Code or with Codex from ChatGPT.
Đọc bản tiếng Việt: Xây văn phòng 3D cho AI agent bằng Claude Code hoặc ChatGPT.
I build agents for other people to use. With a multi-agent system, the hard question is rarely “what can it do?” It is “what is it doing right now?” A team of agents running in a terminal is one long log. Who is waiting on whom, where the work is stuck, why this task is on its second attempt: you can find all of that in the log, eventually.
So I built a 3D office that runs in the browser and called it AI Agent World. The six agents are six robots: Orion coordinates, Piper is the product manager, Iris does research, Kai writes code, Quinn tests, Rex reviews. When Orion hands a task to Piper, you see Orion turn to face Piper and a glowing arc travel between them. When Quinn fails a test, Quinn slumps, a buzzer sounds, and Kai walks back to the desk to fix it.
The prompt that builds it is on GitHub: github.com/lucwj/ai-agent-3d-prompts. This post walks through using it from start to finish, with Claude Code or with Codex, the coding agent that comes with ChatGPT.
What you get, and what you don’t
The prompt builds the client: the 3D world, the interface, and a deterministic simulation that runs in the browser. No LLM is called. Task cards, research findings and test names are templates picked by keywords in the task title. The top bar says “Simulation mode · no live inference”, and the prompt requires the agent to say so everywhere it matters.
That sounds like a toy, but the order is deliberate. The prompt defines a contract: a fixed vocabulary of events and a WebSocket protocol. The simulation is just one backend that speaks the contract. Later you can swap it for a real orchestrator (Claude Code, the Agent SDK, LangGraph, anything) without changing a line in the 3D layer or the UI. The last section covers how.
The rule I hold hardest in the prompt is that no animation is allowed to lie. A robot walks only when its state says it is walking. A desk screen glows only when its owner is working. A pretty picture that disagrees with the system is worse than no picture.
What you need
| You need | Notes |
|---|---|
| A coding agent that can run shell commands | Claude Code or Codex. Cursor and others should work too, but I have only tested Claude Code |
| The threejs-skills skill pack | Required; step 2 explains why |
| Node.js 22 or later | Check with node --version |
| A browser with WebGL | Any recent Chrome, Edge, Safari or Firefox |
| The prompt | prompts/ai-agent-world.md in the repo |
You don’t need to know three.js. Being able to read errors in the browser console helps a lot, because you are the only one who can see the screen.
What if I only have the Claude.ai or ChatGPT chat?
The prompt is written for an agent that creates a few dozen files, runs npm install, runs the tests, and fixes things when the tests go red. A chat window in the browser can’t do that; you would be copying files by hand and pasting errors back and forth. I don’t recommend it.
The good news is that both sides ship a coding agent with their paid plans: Claude Code with Claude, Codex with ChatGPT (Codex also runs inside the ChatGPT desktop app). Which plan includes what changes often, so check each vendor’s own pricing page.
Step 1: Install a coding agent
Claude Code (macOS, Linux, WSL):
curl -fsSL https://claude.ai/install.sh | bashclaude --versionOn Windows, run irm https://claude.ai/install.ps1 | iex in PowerShell, or npm install -g @anthropic-ai/claude-code anywhere you have Node. The first time you run claude, it opens a browser to sign in.
Codex (comes with ChatGPT):
npm install -g @openai/codexcodex --versionThe first time you run codex, choose to sign in with your ChatGPT account.
Whichever you pick, use the strongest model your plan offers. The prompt is long and full of cross-references between sections, and smaller models tend to drop details from the second half.
Step 2: Install threejs-skills. Don’t skip this.
This is the step I would underline twice. Models learned three.js from training data that mixes many releases, and a lot was renamed or removed between r160 and r186: PCFSoftShadowMap is gone in r186, Clock gave way to Timer, RGBELoader became HDRLoader. Without the skills, the agent writes against old APIs, you get a black screen or a red console, and you spend round after round fixing mistakes that never needed to happen.
threejs-skills is a set of 13 skills that target three r186, React Three Fiber 9.8 and drei 10.7, the exact versions the prompt asks for. My original build had them installed.
Create the project folder first, then install the skills into it:
mkdir ai-agent-world && cd ai-agent-worldgit initFor Claude Code, skills live in .claude/skills/ (one project) or ~/.claude/skills/ (all projects):
npx skills add cloudai-x/threejs-skills -a claude-codeFor Codex, skills live in .agents/skills/ (one project) or ~/.agents/skills/ (all projects):
npx skills add cloudai-x/threejs-skills -a codexTo use both, pass both: -a claude-code -a codex. If you would rather not use the skills CLI, copy them by hand:
git clone https://github.com/CloudAI-X/threejs-skills.git /tmp/threejs-skillsmkdir -p .claude/skills && cp -r /tmp/threejs-skills/skills/* .claude/skills/ # Claude Codemkdir -p .agents/skills && cp -r /tmp/threejs-skills/skills/* .agents/skills/ # CodexCheck that the skills folder contains threejs-fundamentals, threejs-react-three-fiber, threejs-lighting, threejs-geometry, threejs-materials, threejs-interaction, threejs-animation and a few more, each a folder with a SKILL.md inside.
The two agents use skills slightly differently. Claude Code loads a skill on its own when the skill’s description matches the work at hand. Codex picks skills on its own too, but you can name one explicitly by typing $ and its name, for example $threejs-react-three-fiber, or run /skills to see the list. For the 3D phases I recommend naming the skills in your message with either agent, just to be sure.
Step 3: Put the prompt in the project
The repo’s README says to copy the whole prompt and paste it into the agent. That works. I prefer to keep the prompt as a file in the project, because the eight phases will span several sessions, and at each phase the agent should reread the sections that matter instead of relying on the memory of a long conversation:
mkdir -p docscurl -fsSL https://raw.githubusercontent.com/lucwj/ai-agent-3d-prompts/main/prompts/ai-agent-world.md -o docs/ai-agent-world.mdThe folder now looks like this:
ai-agent-world/├── .claude/skills/ or .agents/skills/ for Codex│ ├── threejs-fundamentals/SKILL.md│ ├── threejs-react-three-fiber/SKILL.md│ └── ...└── docs/ └── ai-agent-world.md the prompt, about 42 KBOne small snag you may hit in phase 1: the Next.js project generator can refuse to run because the folder is not empty (it already has .claude/ or .agents/). If the agent reports that, tell it to scaffold into a temporary folder and move the files over. It should not delete the skills folder.
Reading the prompt in five minutes
You don’t need to read all 405 lines before you start, but you should know how it is laid out, because when something breaks you will point the agent at the right section.
| Section | Contents | Why it matters |
|---|---|---|
| 0 | Six non-negotiables | Rendering never mutates state, deterministic simulation, honesty, 60 fps, strict TypeScript, no binary assets |
| 1–2 | Stack and folder layout | Next.js 16, React 19, R3F 9, drei 10, three r186, Zustand 5, Tailwind 4 |
| 3 | Domain model | Six agents, tasks, the state machine, the event vocabulary, the backend contract |
| 4 | Simulation engine | Who walks where, does what, for how long, in each phase |
| 5 | Office layout | Coordinates of every desk and zone, in metres |
| 6 | 3D rendering | Canvas, lighting, robots, walking paths, communication arcs, camera |
| 7 | HTML interface | Top bar, side panel, task dialog |
| 8 | Audio | Every sound synthesised with Web Audio, no audio files |
| 9 | Tests | A headless test script for the engine |
| 10 | Known pitfalls | Bugs I actually hit while building the original |
| 11 | Eight phases and acceptance criteria | The order of work |
At its heart is a task’s state machine. Each phase has one responsible agent, and each arrow is a signal the engine emits:
flowchart LR Q[queued] -->|picked_up| I[intake] I -->|delegated| P[planning] P -->|plan_ready| R[research] R -->|findings_published| M[implementation] M -->|submitted| T[testing] T -->|tests_passed| V[review] V -->|approved| D[done] T -->|tests_failed| M V -->|changes_requested| M
Orion takes the task at intake and delegates to Piper. Piper breaks it down in planning and passes it to Iris. Iris researches, Kai builds, Quinn tests, Rex reviews. A failed test or a request for changes sends it back to implementation; after three attempts the task is failed.
The second thing worth knowing is how data flows, because this is what decides whether you hold 60 fps:
flowchart LR B[AgentBackend<br/>simulation or WebSocket] -->|snapshot 30×/s| L[liveWorld<br/>mutable buffer] B -->|events| F[Activity feed + sound] L -->|read every frame in useFrame| W[3D world] L -->|at most every 160 ms| Z[Zustand mirror] Z --> U[HTML interface]
The 3D layer reads straight from a buffer every frame, without going through React. The HTML interface updates at most every 160 ms unless something significant changed. A robot moving never causes a React render. If your agent gets this wrong, the fans spin up and the frame rate halves.
Step 4: One phase at a time
Open the agent in the project folder (claude or codex). The prompt splits the work into eight phases, each with its own acceptance criteria. The most important advice in this post: do one phase, check it with your own eyes, commit, then move on. A strong enough model can do all eight in one go, but a bug from phase 3 that you only notice in phase 7 is painful to dig out.
The first message:
Read all of docs/ai-agent-world.md, especially section 0 (Non-negotiables)and section 10 (Known pitfalls). It is the spec for the whole project.
Now do Phase 1 from section 11 only. Do not start later phases.When you're done, run npm run typecheck, npm run lint and npm test andshow me the output of each. Don't report it as done until all three pass.For later phases, change the phase number and the sections to reread:
Do Phase 3 from docs/ai-agent-world.md. Before writing code, rereadsections 5, 6 and 10. Use the installed three.js skills(threejs-fundamentals, threejs-react-three-fiber, threejs-lighting) for everythree, R3F and drei API; don't rely on memory.
When you're done, run typecheck, lint and test, then start npm run dev andgive me the URL. I'll open it in a browser and tell you what I see.With Codex, name the skills with $, for example $threejs-react-three-fiber.
When a phase is green, commit:
git add -A && git commit -m "Phase 3: office world"A commit per phase lets you go back when the agent fixes one bug and breaks three other things. That will happen.
What to check after each phase
| Phase | The agent builds | You check |
|---|---|---|
| 1 | Scaffold, domain model, state machine, scheduler, simulation engine. No 3D yet | npm test prints all ✓. The demo task finishes on iteration 2, phases in the right order |
| 2 | Store, backend client, the whole HTML interface | The 3D area is still empty, but Run demo moves the task cards, agent statuses and activity feed |
| 3 | Canvas, lighting, office, desks, camera, interaction | The static office looks finished: glass partitions, skyline, desks with screens, mission-control wall, planning board, collaboration table, lounge |
| 4 | Robots per role, animation, walking paths, communication arcs, speech bubbles | The demo plays end to end: Orion → Piper → Iris → Kai → Quinn (fail) → Kai → Quinn (pass) → Rex → Orion |
| 5 | Mission-control wall and planning board reflect tasks | Desk screens glow while their owner works; sticky notes appear on the board as Piper breaks down the task |
| 6 | Performance: low-quality path, reduced motion, mobile | 60 fps on a laptop, clean console with StrictMode on; also try ?quality=low in the URL |
| 7 | Sound synthesised with Web Audio | Click the page once, then run the demo: every event has its own cue, M mutes |
| 8 | README, e2e test, cleanup | Lint, typecheck and tests all green |
The project-wide definition of done sits at the end of the prompt, and I think it is a good bar: a newcomer runs npm install && npm run dev, presses Run demo, and within 90 seconds has watched six distinct robots walk between labelled stations, exchange glowing messages, fail a test, fix it, get approved and celebrate, with sound, with every step mirrored in the side panel, and the top bar never once pretended an LLM was involved.

That screenshot is the best moment of the demo. The demo task is scripted so that Quinn always fails the first build, so every run shows exactly one round of rework. The simulation is deterministic: the same seed and the same inputs give the same run, tick for tick. That is what makes the phase 1 tests mean something.
When the agent gets it wrong
It will; the original also took several rounds of fixes. The 3D phases (3 and 4) are where the most pieces have to line up. A message template that works:
In phase 4, when I click Run demo, [what you see].The console says: [paste the full error].Reread section 10 of docs/ai-agent-world.md, find the cause, and fix onlythat. Don't rewrite anything else. Afterwards, rerun typecheck and test.“Fix only that” matters more than you would think. When an agent hits a hard bug, it tends to rewrite the whole file, and the rewrite brings new bugs with it.
If a session has grown so long that the agent starts forgetting what you agreed on, start a fresh one (/clear in Claude Code), and ask it to reread docs/ai-agent-world.md and skim the existing code before the next phase. Since the spec lives in a file, a fresh session loses nothing.
Pitfalls I paid for
Section 10 of the prompt lists the bugs I actually hit while building the original. If you share or trim the prompt, keep that section. In short:
| Pitfall | Symptom | How the prompt avoids it |
|---|---|---|
drei <Html> with React 19 and StrictMode | Console errors about unmounting a root on every double render | Speech bubbles are plain DOM, positioned by projecting through the camera every frame |
| Remounting the Canvas when quality changes | Every WebGL resource torn down and rebuilt, flicker, removeChild errors | Never key the Canvas on quality; shadows and dpr are reactive props |
PCFSoftShadowMap | Removed in three r186 | PCFShadowMap plus shadow.radius |
| Node runs the engine in tests | node --experimental-strip-types can’t load the files | Simulation files import siblings with .ts extensions and never import React, three, Next or @/ aliases |
| Sound before the user clicks | The browser blocks the AudioContext | Create and resume it only on a pointer or key event; before that, play() does nothing |
| A hidden tab comes back | Robots teleport | Each real-time step is clamped to at most 0.1 s |
| React re-rendering 30 times a second | Frame rate drops, the laptop heats up | A liveWorld buffer for 3D, a Zustand mirror updated at most every 160 ms |
| Floating UI covers the office | Half the scene is hidden on laptops and phones | The camera backs off based on the free screen area |
| A camera drag counts as a click | Every orbit clears the selection | Only treat it as a click if the pointer moved 5 px or less |
Pitfall 1 is the easiest to fall into. Plenty of R3F tutorials use <Html> for floating labels, so every agent reaches for it first. That is why section 10 lives inside the prompt rather than in a separate blog post: the agent needs to read it before it writes the first line of code.
Make it your own office
The six roles in the prompt form a software team, but your office doesn’t have to be one. Three things are easy to change, and you should edit them in docs/ai-agent-world.md before you start phase 1:
- Agent names, colours and taglines: the table in section 3.1. Keep the six roles and ids unless you want to rewrite the choreography in section 4.2, because who walks where in each phase is written per role.
- The work content: section 4.3 describes the templates for subtasks, findings, test names and review notes, keyed by keywords. For a marketing office, swap them for “brief”, “competitor research”, “draft”, “brand review”.
- Sample tasks and the sprint: section 4.4. This is where you tell your own story.
Deeper changes, like the number of agents, the number of phases or the floor plan, are better made after the original runs: one change at a time, keeping the section 9 tests green. Those tests are the only safety net when you let an agent touch the state machine.

Connecting real agents
This is where the prompt stops on purpose. It defines the contract; the real backend is yours to write.
Set two environment variables and the client drops the simulation and connects over WebSocket:
NEXT_PUBLIC_AGENT_BACKEND=websocketNEXT_PUBLIC_AGENT_WS_URL=wss://your-server.example/worldThe protocol is JSON. The client sends commands; the server sends events, snapshots and acknowledgements:
{ "type": "command", "id": "8f1c…", "command": { "name": "submitTask", "input": { "title": "Add rate limiting to the public API" } } }{ "type": "ack", "id": "8f1c…", "ok": true, "result": { "id": "T-004" } }{ "type": "event", "event": { "type": "qa.failed", "agentId": "quinn", "targetAgentId": "kai", "taskId": "T-004", "message": "Quinn failed build #1: rejects expired access token", "severity": "warning", "feed": true } }{ "type": "snapshot", "snapshot": { "clock": 42.1, "status": "running", "speed": 1, "agents": [], "tasks": [], "links": [] } }Your server only has to translate what the real agent system is doing into the event vocabulary in section 3.4 (task.assigned, plan.created, qa.failed, review.approved, …) and send a snapshot whenever something changes. The 3D layer and the interface don’t need to know whether the other end is Claude, GPT or a Python script.

My original has an experimental bridge that reads Claude Code hooks: every time I type a prompt in the terminal, Orion picks up the work in the office. That bridge is not in the prompt yet. It runs locally, only understands Claude Code, and will be released together with the source code.
One lesson from that bridge: inferring “did the tests pass?” from an agent’s free text is a heuristic, and it is often wrong. If you write your own backend, have your agents print a structured line such as VERDICT: PASS or VERDICT: FAIL, or emit schema’d events straight from the orchestrator. The 3D world can only be as honest as the data it receives.
Current limitations
The full list is in the repo’s README. The biggest ones:
- There is no real backend yet. This is the largest gap.
- The workflow is one fixed path with six roles and six seats. Real systems have nested delegation, parallel tasks, and agents created on the fly.
- No persistence or replay: reload the page and everything is gone, and you can’t rewind a session.
- The robots have few gestures, the sound is good enough to tell events apart but not beautiful, mobile merely works, and the 3D world has no description for screen readers.
- The prompt is about 42 KB. Agents with short context windows tend to miss details in the later sections, which is why this guide recommends going phase by phase and keeping the prompt in a file.
My plan is to open source all of it: the client source, the world server, the Claude Code bridge, then adapters for other sources such as the Agent SDK, OpenAI and LangGraph. The prompt is the first step, so anyone who wants to build it, experiment with it, or argue about the architecture can start now.
Short FAQ
Do I need to know three.js or React? Not necessarily. You need to read console errors and describe what you see on screen. The agent writes the code.
Is Claude Code or Codex better for this? The original was built and fixed over many rounds with Claude Code. Codex uses the same skill format and reads the same prompt, so the process is identical. I haven’t compared the two on this project, so I won’t pick a winner.
Can I change the stack, say Vite instead of Next.js? Yes, but the known pitfalls are tied to the exact versions in the prompt. Change the stack and you own the new bugs that list doesn’t cover yet.
Will it run on a weak machine? There is a low-quality mode that switches on automatically when the frame rate drops, or force it with ?quality=low. Machines without a discrete GPU still struggle; it is one of the things to improve.
What does it cost? The world runs in the browser and calls no API. The only cost is your coding agent’s usage while you build it.
Where do I send feedback? Open an issue on the prompt repo.
References: ai-agent-3d-prompts, threejs-skills, Claude Code setup (Anthropic), Codex Agent Skills (OpenAI). Install commands change over time; if they disagree with the official docs, follow the docs.