Inspiration
It started with a palace. A real, historical palace. Or, more precisely, with trying to understand how it actually worked.
I wasn’t satisfied with simply finding the dining room or the library on a floor plan — especially because some of the things I wanted to understand were not visible on plans at all. I wanted to know what life in a residence like that looked like, and how the entire space was designed around it. How rooms were positioned in relation to the cardinal directions to make use of daylight, and where a pantry should be placed if it was actually meant to stay cool. How far a serving dish had to travel before it reached the table, and how the movement of guests, residents and servants was kept separate. How architecture itself created privacy, hierarchy and boundaries of access.
Over time, those questions turned into a project of my own fictional residence.
I started designing the plan together with an AI agent — and it was a difficult, but surprisingly productive collaboration. Codex developed the generator while I inspected and adjusted the generated model in Blender. Together, we analysed sources, discussed possible solutions and iterated on the layout.
The problem was that every change, even a small one, meant another code edit, another generation, another render, another review and another explanation of what still needed fixing. My sketches and descriptions were not always as clear to the agent as I thought they were.
It became increasingly frustrating that we couldn’t simply work on one shared project — something that would be understandable and editable for both of us.
And then WebMCP appeared.
Who it's for
We built the Cabinet first with writers, game masters and worldbuilders in mind, but the underlying idea is deliberately broader. A fictional palace, a game map, a room layout or a treasure hunt for children may be very different projects, but they all involve thinking through a space, deciding what matters about it and turning those decisions into something visible and editable.
The Cabinet brings maps, spatial rules, story information, notes and collaboration with an agent into one working environment. Its aim is simple: to help people build worlds that remain coherent as they grow, and stories that fit the worlds in which they take place.
What it does
The Cartographer’s Cabinet is a spatial worldbuilding studio for designing places, describing how they work and turning them into stories. It can be used entirely by a human author, but through WebMCP an AI agent can sit beside them as a second cartographer at the table — and, on the narrative side of the same project, as a co-author.
A project can begin at almost any scale: a world, a region, a town, an estate, a building, a floor or a single room. These places remain connected in one hierarchy. The author or agent can move from a map of an entire realm to a town within it, then enter an estate, open one of its buildings and continue down to an individual room with its furniture and objects. Adding detail does not divide the world into unrelated maps.
In Drawing mode, the physical world takes shape. The user or agent can create terrain, roads and paths, boundaries, buildings, walls, rooms, doors, windows, stairs, furnishings and other objects. The editor can therefore support both broad maps and detailed architectural plans while preserving the relationships between them.
In Story mode, the same project captures the information that makes those places part of a living world. The author can create characters and groups, assign ownership, define access and keys, describe relationships, add custom properties, establish zones and record authorial intentions or design constraints. Scenarios represent different moments or possible versions of events, lenses reveal selected information, and the writer’s notebook keeps ideas, scenes and longer passages beside the world to which they belong.
WebMCP gives the agent practical access to this workspace. It can inspect the project, create its hierarchy, draw maps, construct and furnish buildings, organise their surroundings and establish the initial Story layer. The human can review that work, change it directly and let the agent continue from the edited version without rebuilding the entire context in conversation.
The Cabinet can also examine parts of the world rather than merely store them. Route planning can consider geometry, doors, access rules, keys and character knowledge. Scenarios make it possible to test different circumstances without destroying the base version. The author and agent can therefore ask whether a planned sequence of events actually works inside the world they have built.
Because geography, architecture, objects, characters, relationships, rules and intentions remain connected, the project becomes a structured memory for the agent. It can return to the world itself instead of relying only on what still fits in the conversation.
The result is a living model of a place or world: something a person can draw, understand and write from alone, or develop together with a second cartographer and co-author at the same table.
How we built it
We built The Cartographer’s Cabinet as a browser-based application using Next.js, React and TypeScript. Maps are rendered as interactive SVG, giving us precise control over geometry while keeping visible elements selectable, editable and connected to their underlying data.
The project is represented as a structured world rather than a canvas of unrelated shapes. Its domain model covers nested places, irregular regions, paths, walls, openings, rooms, furnishings and transitions between levels. Geometry operations combine our own TypeScript code with JSTS.
Changes pass through a transaction system before they are committed. This validates operations, keeps related edits together as a single undoable action and prevents a partially applied change from leaving the project in an inconsistent state.
Drawing and Story data belong to the same project structure. The writer’s notebook uses Lexical for editing while storing portable Markdown. Projects are kept locally in the browser with IndexedDB and Dexie, validated using Zod, and can be imported or exported as versioned JSON. Immutable snapshots and revision-aware persistence help protect data as edits and asynchronous operations overlap.
WebMCP sits directly on top of this domain model. The page registers structured tools that allow an agent to inspect the editor context, navigate the hierarchy, read project data, create and modify objects, manage Story information, calculate routes, create checkpoints and apply larger batches of related changes.
Agent actions pass through the same validation and transaction system as edits made through the interface. This keeps their results visible, reviewable and undoable by the human author.
Performance-sensitive operations are separated from the interface where necessary. Route calculations run in a Web Worker, while reusable spatial data is cached to avoid repeating work when the relevant parts of the project have not changed.
We developed and tested the Cabinet through both the interface and WebMCP, using the full Residence of the Silver Lindens demonstration project alongside smaller focused cases. Our verification pipeline includes linting, TypeScript checks, dead-code and architecture-boundary checks, more than 1,500 Vitest tests, a production build, live browser sessions and additional release checks.
The application is exported as a static site and hosted on Cloudflare Pages. It requires no account or application server, and project content remains in the user’s browser unless they deliberately export and share it.
Challenges we ran into
The greatest challenge was keeping the spatial editor, Story layer, human interface and WebMCP connected to one coherent model. Agent actions had to remain valid, editable and undoable through the ordinary interface instead of creating a separate version of the project behind the scenes.
Geometry became increasingly demanding as the editor grew beyond simple shapes. Irregular regions, paths with changing widths, walls, openings and transitions between floors all needed to work together. A door had to be both a visible object and a real opening in a wall. Stairs had to connect the correct levels. Route planning had to understand physical geometry alongside access rules, keys and character knowledge.
Scale exposed problems that small examples did not reveal. Operations that were effortless on a simple map could freeze the interface on a complete estate. Route searches produced too many possible connections, large saves interrupted editing, and asynchronous work could finish after the project on which it began had already changed. Solving these problems required changes to both computation and persistence rather than merely hiding the delays in the interface.
WebMCP presented a different kind of challenge: describing complex spatial operations precisely enough for an agent to use them correctly. Ambiguous coordinate systems, optional fields and unhelpful geometry errors could make a technically working tool difficult to understand. Testing the tools by constructing a complete residence revealed issues that isolated calls had missed.
Accomplishments that we're proud of
We are most proud that The Cartographer’s Cabinet became a genuine shared workspace rather than an editor with a few AI commands attached to it. A human and an agent can inspect and change the same world, pass the work between them and continue without translating it into a separate format.
The Residence of the Silver Lindens proved that this approach works beyond a small technical demonstration. An agent constructed the estate, its three-storey residence, surrounding buildings, grounds, rooms, doors, windows, stairs and furnishings. We then reviewed and edited it by hand, expanded its Story layer and used it to test routes, scenarios, lenses, authorial intentions and the writer’s notebook.
The finished application remains local-first and requires no account or application server. It includes 69 registered WebMCP tools, versioned project import and export, and over 1600 automated tests. Those systems have been exercised together on one substantial project rather than demonstrated only as isolated features.
What we learned
We learned that meaningful collaboration with an agent depends less on adding a chat box and more on giving the agent access to the actual creative workspace. When both participants can inspect and change the same project, the conversation can move naturally between discussion, construction, manual revision and further analysis.
We also learned how much more useful spatial information becomes when it remains connected to meaning. A room is more than a polygon when the project also knows what purpose it serves, who owns it, who may enter it and how it relates to the surrounding spaces. Once geography, architecture, characters, rules and authorial intentions share one structure, the model can support both worldbuilding and the stories that unfold within it.
Realistic use taught us things that small examples could not. The Silver Lindens estate uncovered performance, persistence, geometry and interface problems that were almost invisible in simpler projects. Automated tests preserved the resulting fixes, but working live through both the interface and WebMCP remained essential.
Finally, we learned that clarity is part of the engineering. Human labels, documentation, agent tool descriptions and useful error messages all explain the same system to different users. A capable feature can become effectively inaccessible if any one of those explanations is unclear.
What's next for The Cartographer's Cabinet
The immediate next step is to keep refining the Cabinet through larger projects and real use. We want to improve performance, make complex tools easier to discover and continue expanding both Drawing and Story while testing each new part through the interface and WebMCP.
We would also like to move beyond the current two-dimensional workspace. The existing spatial hierarchy could provide the foundation for 3D representations of buildings and terrain, with a Blender workflow for developing detailed models outside the browser. A more comfortable experience on tablets and mobile devices is another direction we want to explore.
There is also more to discover in the collaboration between author and agent. As projects grow, the agent should be able to navigate larger worlds efficiently, connect places with notes and story ideas, follow decisions made earlier and help explore how changes to the world affect the stories taking place within it.
Most of all, we want to see what happens when the Cabinet leaves our own test projects and reaches other writers, game masters, worldbuilders — or simply people with a space they want to figure out. We hope it helps someone gather a complicated world from scattered sketches, notes and conversations, bring it together in one place, and create a story that could only happen there.
Built With
- chatgpt
- cloudflare-pages
- codex
- dexie
- indexeddb
- jspdf
- jsts
- next.js
- react
- svg
- typescript
- vitest
- web-workers
- webmcp
- zod
Log in or sign up for Devpost to join the conversation.