Agents writing against APIs that did not exist
V1 had no contract layer. Agents invented method names, mis-spelled exports, guessed constructor signatures. Code compiled file-by-file, failed the moment any two files had to cooperate.
The first attempt produced 93 files and 36k lines of code that never ran as a game. The second attempt — Dungeon Forge — is both a specific 3D strategy title and a reusable methodology for autonomous game production. The rewrite is not a bug fix. It is a re-architecture of what "autonomous code generation" has to validate before it can ship.
V1 had no contract layer. Agents invented method names, mis-spelled exports, guessed constructor signatures. Code compiled file-by-file, failed the moment any two files had to cooperate.
The browser gate validated imports and syntax. Whether a dungeon was walkable, whether combat closed its loop, whether loot propagated — never checked. MiroFish review (7-agent expert panel) scored V1 a 6/10 and named this the fundamental gap: "we validate syntax, not game logic."
Each 16k-token chunk was generated without awareness of its siblings. Two files could define the same class with incompatible signatures and both pass local validation.
Every pipeline regeneration overwrote manually extracted style/data/shader modules. Files crept back over the 350-line cap on every run. The pipeline fought its own cleanups.
A mid-tier crash left half-written files on disk. State tracking updated per file, not per tier. No rollback path.
Available budget: ~216,000 requests per 10-day window. V1 used 47. The pipeline was structurally incapable of spending the budget that a real Steam-grade build requires.
Three JSON contracts define the system before code exists: interfaces.json (module exports, methods, dependencies), events.json (event registry), constructors.json (signatures). Agents cannot invent APIs — every generated file is validated against the contract.
Systems communicate only through a shared EventBus. No system imports another. Fully parallel agent development becomes mechanically safe.
Every generation call sees sibling signatures and the contents of files it imports. Class definitions converge instead of diverging.
CANONICAL.md table + director prompt rules + write-guards at all three write paths + interfaces.json extraction_module flag. Twelve extraction modules survive every regeneration intact.
Every tier boundary is a git tag. Failure at tier N resets to tier N-1 automatically. No orphan files.
Director v2 (3-lane FSM), SLBB budget-broker, rate-guard, regression-gate, playtest-bot (LLM player via Playwright), balance simulator (1,000 playthroughs/day), debug agent, blocking visual gate. Eight modules, ~2,400 LOC, smoke-verified.
cp the folder, edit project-config.json, run start_iteration.sh. The chassis is not specific to Dungeon Forge — it is the methodology for turning an empty repo into a Steam-ready game in 10 days.