M.Larin

Case study / AI agent workflow

WebMmorpg

A browser MMORPG built by nine AI agents. I designed the team.

WebMmorpg is a small real-time online RPG for the browser and for Telegram as a Mini App: a persistent world, monsters, quests, crafting and auto-battle that keeps playing while you are away. Since June 2026 it has been built by Claude Code agents that work in written roles.

This page is about the part I made: the roles, the hard rules, the three MCP servers the agents work through, the checks, and what I learned by running it every day.

Project
Hobby game, still changing quickly. Texts players read are Russian, code and docs are English.
Stack
C# on .NET 9 with PostgreSQL, plain JavaScript and PixiJS 8 client, Node Telegram bot
Period
2026-06-30 to 2026-11-09 (the last commit when this page was written)
My part
Roles and rules, three MCP servers, the checks, the decisions. The agents recommend, I decide.
9role agents, each with a written scope, a tool list and a report format
3MCP servers: a headless client (30 tools), a real-client driver (17) and a map toolkit
444 of 520commits carry an agent co-author trailer
1,000+server test methods, run on virtual ticks, never on sleeps

How the team is wired

I talk to a chat. The chat calls the roles.

The chat does not write the code itself. It reads my words, decides whether I asked for a discussion or for work, writes a short brief and calls the roles it needs as background agents. That keeps its own context small and the work in the hands of agents with narrow scopes.

  1. My words decide

    An order is built to a working result. A "what if" is discussed. Never "shall I build it?".

  2. A short brief

    The goal, a done criterion a person can check, the files to read, the report limit.

  3. Roles in the background

    Independent ones in parallel, dependent ones in turn. One agent per area at a time.

  4. A short report

    At most about 30 lines. First line is one sentence. What was done, how it was checked, what was not.

  5. Checked, then answered

    The chat checks the test line and the change summary, sends a checker when in doubt, and answers me in Russian in a few lines.

Execution words

"Сделай", "добавь", "исправь", "построй" (do it, add it, fix it, build it) mean: carry it to a working result and do not ask for permission to build.

Discussion words

"Придумай", "что если", "как бы нам" (come up with, what if, how could we) mean: one short take with one recommendation. Nothing is built. An idea worth keeping goes to a written list.

The nine roles

Thin agents with narrow scopes

Every role is one short file: a description that says what it is for and what it is not for, a tool allowlist, its own never-list and a report format. All run on Claude Sonnet. Reference knowledge lives in the CLAUDE.md of the folder an agent works in, not in the agent file.

Decide what to buildThey write briefs, numbers and texts. No code.

product-manager

Owns what gets built next and why: the roadmap, the launch plan, short briefs with observable done criteria, and acceptance of results. Talks to me in plain Russian and recommends one thing instead of listing options.

Neverwrites code, content, art or maps. Sends or pays nothing outside the repo without my go.

Toolsfiles, shell, web fetch and search

game-designer

How the game plays and reads: mechanics, progression, balance numbers, quests, NPCs, story, every player-facing text in Russian, and the content of a location as data that a sync tool compiles.

Neveredits server code or generated config. Never puts a feature into a text that the game does not have today.

Toolsfiles, shell

BuildEach one owns an area of the repository.

server-developer

The only role that edits the server, the battle system, the data contracts and their tests. Strict about reuse: it extends the class that already owns a mechanic and never writes a twin. Its report lists the classes added and every place changed.

Nevertouches game numbers, texts, maps or client code.

Toolsfiles, shell

developer

Everything else in code: the main web client, tools, web pages, the Telegram bot. Does the change the brief asks for and nothing around it, runs the checks named in the folder's rules and quotes the result line.

Neveredits server code or hand-edits maps. Never reports green without having run it.

Toolsfiles, shell

level-designer

Designs a map's topology and look through the map toolkit, looks at every PNG preview before it judges anything, and publishes only a finished map. "Valid data is not a designed place."

Neverhand-edits published maps or uses a guard-bypass flag unless the brief says so in words. When a guard refuses, it stops and reports.

Toolsmap toolkit MCP, files, shell

artist

Two modes that are always separate runs. MAKE rolls candidates in batches and shows one contact sheet per batch. AUDIT is the slow read-only hunt for graphical artifacts in the real client, and it writes bug files and a stamp.

Neveraccepts its own candidate, judges its own pictures, or spends outside the brief's budget. No budget in the brief means: report the dry-run estimate and stop.

Toolsfiles, shell, PowerShell

CheckThey find problems. They do not fix them.

tester

QA. Reproduces a bug as a failing automated test, finds the root cause down to file and line, and writes it up with a proposed fix that serves as the brief for whoever fixes it. Also audits the suite for bloat and gaps and hunts bugs with no symptom given.

Neverpatches game code, however small the fix looks. The split keeps the diagnosis independent of the fix.

Toolseverything except eight unrelated MCP servers; its own project memory

player

Plays the game like a person: only through the game tools, either the headless client for mechanics and numbers or the real client in a browser for what the player sees. Narrates a first-person playtest, flags friction and files symptoms.

Neverreads server source or game data to shortcut understanding, and never guesses a root cause. An error or timeout is reported exactly as it happened.

Toolsthe two game MCP servers, file access, no shell

Keep it healthyEvery line an agent reads costs context.

curator

Keeps the rule files, agent files, skills, memory and docs small, true and in the right place. Measures first, then proposes numbered cleanups split into safe and needs-a-decision. Changes nothing until I name the items.

Neverwrites game code, deletes the only copy of a decision, or puts a secret into a file or report.

Toolsfiles, shell, web fetch

Who may change what

The rules are written down, short and absolute

Nothing here depends on an agent being careful. Each area has one owner, and the dangerous actions are forbidden to everyone unless I ask.

Server code and its tests
server-developer only
Client, tools, bot
developer
Published maps
nobody by hand; level-designer through the toolkit
Location content and texts
game-designer, as data
Pictures and sprites
artist (MAKE), judged in a separate AUDIT run
Bug write-ups
tester and player file; whoever fixes deletes
Roadmap and briefs
product-manager
Rule files, agent files, memory
curator, on my go
Commit, push, merge, publish
nobody, unless I ask
Secrets in files, logs, reports
nobody, ever

Separation of duties: how a bug travels

  1. player

    Plays, sees something wrong, files the symptom: what it did, what it expected, what happened. No cause guessed.

  2. tester

    Reproduces it as a failing test, finds the root cause at file and line, writes the proposed fix as a brief.

  3. server-developer or developer

    Fixes it from the write-up, adds the test that failed before, quotes the result line.

  4. the bug file is deleted

    The passing test and git history are the record. The bugs folder holds 3 files today.

Why. The one who diagnoses a bug should not be the one who fixes it, and the one who makes a picture should not be the one who judges it. Both splits cost a little speed and remove a whole class of self-approved mistakes.

Tools I built for the agents

Three MCP servers, plus the checks around them

An agent can only be as good as what it can see and do. These servers give the roles eyes and hands inside the game and the map pipeline.

webmmorpg-headless-client

Plays the game with no screen

A client that speaks the game's own WebSocket protocol. The player agent uses it for mechanics, long grinds, numbers and quest flow. Each character is a named agent id, so several agents can play at once.

Every action answers with the world state afterwards, so the agent reads what really happened instead of what it hoped would happen.

  • get_world_state
  • move
  • move_dir
  • stop_move
  • attack_start
  • attack_stop
  • gather_start
  • gather_stop
  • cast_skill_start
  • cast_skill_stop
  • set_auto_battle
  • interact
  • interact_npc
  • talk_to_npc
  • equip_item
  • unequip_item
  • use_item
  • inspect_item
  • pickup_item
  • open_shop
  • buy_item
  • sell_item
  • open_craft
  • craft_item
  • accept_quest
  • turn_in_quest
  • cancel_quest
  • chat
  • wait
  • list_active_agents
webmmorpg-js-client

Drives the real client like a person

The real game client in a private Playwright browser, driven by real mouse and key events, with screenshots the agent can look at. Used when the question is what the player sees and feels.

The whole interface is drawn inside one canvas, so there is no DOM to read. A small in-page hook, switched on only by a URL flag, lists every visible widget with its text and rectangle. The official Playwright MCP cannot see a canvas-only interface, so I wrote a thin server of my own. Every start is a new guest account, and the browser must be stopped when the run ends.

  • screenshot
  • gui
  • entities
  • start
  • login
  • state
  • click
  • tap_entity
  • goto
  • key
  • type
  • wait
  • wait_for
  • errors
  • net
  • eval
  • stop
webmmorpg-map-agent

Designs and publishes maps

A command-line toolkit that is also an MCP server, one tool per command. A map is designed as batches of operations in a throw-away work copy, with undo and redo. Then validate --strict, PNG previews that the agent must actually look at, compile, bake, and publish into the shared maps with guards.

The toolkit's guards refuse risky publishes: over an existing or live map, or a rename. The level-designer may not use the bypass flags unless the brief says so in words, may not publish over the live map or a map that already has quests against it, and treats a refusal as a stop-and-report, not a puzzle to work around.

Design preview of the town map rendered by the map toolkit, with zones, spawn points, walls, water and relief
A design preview rendered by the toolkit: zones, spawn points, NPC homes, walls, water and relief, with a legend.
Art pipeline

Sprites in batches, judged on one sheet

The artist rolls all candidates of a batch in one command, puts them on a single contact sheet and looks once. Quality is set low, a dry run comes before any spend, and an asset gets at most two look rounds before the agent stops and says what is wrong.

A strip of decor sprites next to a player character for scale: signposts, a notice board, a stump, bushes, firewood, a haystack and a tree
Decor sprites from the pipeline, with the player character on the left for scale.

Role chats

Seven skills. Five open a chat in a role after a clear: /product, /designer, /developer, /artist, /curator. Two are procedures: release publishing and refactoring.

One safety hook

A pre-tool hook auto-approves a plain rm only when every target is strictly inside the project. It never denies. Shell syntax, the repository's own history folder, the project root and a recursive delete of a top-level folder all fall back to the normal prompt.

Checks, not promises

Unit tests, an i18n checker that fails on hard-coded player text, a map validator, a data sync that rebuilds generated config, and a visual-audit stamp that says whether the current graphics were ever audited. An agent quotes the result line or does not claim green.

Research notes

What running the agents taught me

Each note is a thing that cost real time, and what I changed because of it.

Measure before reorganising

An audit on 2026-10-20 found 56 to 101 questions to me per feature, agent turns at 250 to 570 thousand tokens of context, and one feature that took 17 agents and about 1,500 turns. Causes: unbounded grep output, big documents read again and again, full-size images, stale reports, and knowledge in three drifting places. On 2026-11-07 I rebuilt the setup, and the old numbers are written down so new runs can be compared.

Source: the curator's notes

Keep roles thin, put knowledge next to the work

An agent file aims at about 60 lines and says only what the role is, what it is not, and how it reports. Area rules live in the rule file of that folder and load when an agent works there. The root file holds only what every session needs.

8 rule files, 17 decision logs

Lessons become checks, not longer prompts

When something costs a retry twice: first try a check that catches it, then one line in the nearest rule file, otherwise nothing. Each Lessons section stays under about 30 lines, and the curator folds them into rules or removes them.

Rule: root rule file, "Lessons"

A toolkit hit a quadratic wall

Compiling a big forest map is quadratic in the tree-collision shapes. About 109 thousand of them took around 11 minutes. With the woods at full density there were 530 thousand and the compile was killed after 2.7 hours. Now the shapes are counted before a long run and kept under about 250 thousand.

Source: map toolkit Lessons

Silent traps in the map toolkit

Moving a shape does not move the absolute coordinates stored beside it, so trees stayed behind and doorsteps pointed at nothing. The ground is painted in the order colours first appear, so a furrow could end up under its base colour. Lake pieces fall apart when rotated. Wall pairs are row then column. Each is now one Lessons line, so no agent pays for it twice.

Source: map toolkit Lessons

Prove a mechanism once

Fifteen per-location test files had grown to 54 percent of the suite while re-checking the same controllers on different ids. The rule now: prove a generic mechanism once in the file that owns it, and let a location check only its own data plus one end-to-end playthrough. Game time in tests is virtual ticks of 33 ms, never a sleep.

Source: tests rule file

Load changes timing, and I record what I do not know

The server's timers run up to twice as slow when the machine is busy, so a wall-clock check of a live server is valid only on an idle machine. A handful of tests fail intermittently under load. They are listed by name as not root-caused, with one unverified lead, instead of a bug file for every occurrence.

Source: server and tests rule files

Generative art needs spend rules

Quality stays low, a dry run comes first, a brief without a budget means "report the estimate and stop", candidates are judged on one contact sheet, and the art is settled on sheets before anyone opens the game client. The slow graphics audit is never started unasked, and a stamp records which graphics state was audited.

Source: artist role file

Real output

What the reports look like

Two reports from the working repository, summarised. They show the habit I wanted: numbers, file and line, and an honest list of what was not covered.

Live playtest, 2026-10-27

New-player onboarding, against a throw-away database

  • Every check it reached passed, no confirmed failure: level-2 packets arrived within 2 ms, the potion cooldown rejected a second use 250 ms later, passive regen started 8.3 s after the last hit.
  • Ten rough edges logged with numbers: 32 to 107 seconds of plain walking between quest givers, a locked skill that fails in complete silence, discovery XP that is large next to early quests.
  • One race, honestly labelled: a turn-in sent 500 ms after arriving was ignored once, the same one after a talk and a wait worked. Recorded as a probable range and timing race, not reproduced on purpose.
  • A "not reached" list: the bounty board needed level 6 and was skipped, and the report says so.
Duplication audit of one change set

Reuse and sync burden, ranked

  • Credits the good reuse first: mana regeneration moved onto an existing sweep controller, one credit path serves six kinds.
  • Finds the real cost: the mapping from an objective kind to the table its target lives in was encoded in six places, one with a silent default that a future kind would hit.
  • Gives the fix as a sketch with file and line: one extension on the kind type, and a default that throws.
  • Ends with a verdict: needs a small follow-up pass, otherwise ship.