Taming Blind Vibecoding: Metarhia's Experiment with an Architectural DSL, Role-Based AI Reviewers, and Multi-Transport MetacomLongread · digest for November 30
European comic-style illustration: engineering rules and an architectural framework organizing a chaotic stream of AI-generated code
Longread6 sections≈ 16 min

Taming Blind Vibecoding: Metarhia's Experiment with an Architectural DSL, Role-Based AI Reviewers, and Multi-Transport Metacom

An architect who spent years training developers to read every single line of systems code suddenly announces: "Starting now, I'm intentionally not looking inside a single file of the client app." Let AI agents pile in hundreds of thousands of lines—the bigger and messier the ball of mud, the better. It sounds like sabotage against his own principles. Yet that's the core idea of the experiment by Timur Shemsedinov and the Metarhia team: testing architectural control tools on a neat toy library is pointless because an AI behaves like a diligent intern there. Real problems only surface when a codebase balloons to the size of a live product and starts growing a mind of its own.

Why Intentionally Grow a Wild Codebase Blind

When AI helps write compact system libraries like impress, metaschema, metautil, metavm, or globalstorage, everything looks suspiciously smooth. Each module is small, boundaries are clear, and a human keeps a hand on the wheel. The model rarely slips and easily matches the repository's style.

Product projects look completely different when vibecoding runs for months without tight reins. Over six months, model context degrades. Yesterday's agreements evaporate, invariants break, and direct instructions from the architect get ignored. Eventually, schedule predictability vanishes: you can no longer tell if a new feature will take two hours or two weeks. Teams burn budget trying to patch a crumbling codebase and sooner or later reach a desperate conclusion—extract some kind of spec from the chaos and regenerate the project from scratch.

To study this disease in lab conditions and cure it systematically, the project was split into two isolated tracks. The first track is the core Metarhia tech stack. AI writes code there too, but against a dedicated technical spec and under 100% human review: not a single change to a network protocol or storage layer goes in blind. The second track is a "wild" client testbed that grew out of last year's educational chat prototype with CRDTs, browser OPFS storage, and cryptographic signatures (the closest public reference for this codebase is xxii.chat).

They are deliberately cramming everything into this client testbed: messenger, video calls, P2P streaming, file sharing, and even a built-in video editor. The goal is to grow it to hundreds of thousands of lines—up to half a million—without ever opening the client source files by eye. Meanwhile, the product AI has one ironclad rule: it is forbidden from making tech or architectural choices. Need transport or storage? Use the stack's existing primitives instead of inventing a wrapper around third-party packages.

The experiment is broken into four sequential stages:

  1. Accumulate a critical mass of "blind" code and honestly measure its real quality.
  2. Bring the overgrown project under strict architectural control using a formal structure-description language.
  3. Streamline automated review and refactoring using specialized agents.
  4. Restore predictable workflows and realistic time estimates for new features.

It's too early to jump to conclusions: at the time of writing, the testbed has only been generating for three days. The team plans to assemble and show working architectural control tools in about two weeks, and accumulate a genuinely heavy codebase in roughly a month. Still, the mechanics for taming that chaos have already been tested on smaller 1,000–2,000-line bases and mapped out in detail.

Architectural DSL Instead of Endless Prose Specs

When working with AI agents, the first instinct seems logical: let's write a detailed 20-page text spec laying out every requirement, and the model will get it. In practice, the opposite happens. At every step, the model has to re-read walls of natural language, guess module boundaries, and invent how services connect. Shift the wording slightly, and the agent quietly routes around existing logic.

The way out is moving the system skeleton out of free-form prose into a formal DSL (Domain-Specific Language with regular syntax that a parser turns unambiguously into an AST). The leverage is striking: around 200 lines of such a description (literally 3–4 screens of scrolling) can keep a 100,000–200,000-line codebase in check—and potentially up to half a million.

Think of it like building a house. A prose spec is verbal advice to a crew: "Put a spacious living room here, a kitchen somewhere nearby, and spread outlets conveniently." A week later, you find the foreman knocked down a load-bearing wall because it made running cable easier. An architectural DSL is a rigid steel frame with pre-marked openings, risers, and hookup points. The crew still lays bricks and pulls wire inside rooms, but they physically cannot move a floor slab or punch a door into the next wing.

In Metarhia's setup, this DSL handles three jobs at once. First, it serves as a live system map: if a project has already grown blind, AI scans the repo and drafts a DSL map, and the architect opens those 200 lines, spots structural skew immediately, and edits the structure right in the description.

Second, the DSL acts as an algorithmic scaffolder. A parser reads the description and—without any AI involvement—creates the right folders and stub files complete with contracts, typings, and data schemas. The agent only fills in the application logic inside functions without inventing signatures on the fly.

Third, it's an executable wiring layer. Top-level initialization and module glue run directly from this description. It supports two or three hierarchy levels: services and instances, subsystems inside them, and specific submodules below. If the architect changes two lines in the DSL, the agent receives a crisp architectural diff and syncs the code to the new structure.

One interesting detail concerns visual diagrams. AI dev circles often debate low-code and visual builders where you draw boxes and arrows and supposedly generate a program. Experience shows the reverse works far worse: when a visual diagram is the source of truth, the output is almost always tangled spaghetti. That's why this setup is text-first. There is one source of truth—a text DSL with pluggable syntax (Lisp, Markdown, or potentially YAML)—while flowcharts and dependency graphs, similar in spirit to Graphify, are generated from it automatically so the architect can defend decisions to the team.

CriterionBlind Vibecoding from Prose SpecsArchitectural DSL & Role-Based Agents
Where architecture livesScattered across chats, prompts, and long text docsCaptured in ~200 lines of formal syntax parsed to an AST
What AI does at task startGuesses folder structure, contracts, and module linksReceives generated scaffolding with ready types and schemas
How project structure changesAgents rewrite chunks at random, accumulating silent driftArchitect edits the DSL; agent syncs code via a clear diff
Team visualizationDrawn manually and goes stale immediatelyDiagrams are generated automatically from the text source
Schedule predictabilityDrops after a few months due to context degradationHolds steady thanks to strict boundaries and small scoped tasks

Today's honest limitation is clear too: the DSL language layer targets JavaScript, TypeScript, and Lisp. Porting the same approach to C, Rust, or Go is theoretically doable, but even with contributors it's roughly six months of work.

Role-Based AI Agents: Why Separate the Coder from the Critic

Even with a perfect blueprint, hiring one contractor to design the house, lay the tile, and sign off on their own inspection is a bad idea. AI development works the same way. A common mistake is picking one "smartest" model and asking it to do everything from planning to final review.

In this experiment, roles were split not just across models in general, but across specific agents tuned with different reasoning effort. Three specializations emerged in practice.

European comic-style illustration showing three role-based agents: a planner, a coder, and a critic

The first role is spec and decomposition planners. Here they put "deep-thinking" models (Fable and Astra were used during trials). Their job is both simple and sticky: interview the human, pull out unstated details, close gaps in requirements, and slice a large feature into clear chunks for lighter executors. Letting these "thinkers" write routine linear code proved counterproductive—they overengineer simple paths and invent unrequested abstractions.

The second role is linear code executors. Faster, more direct models like Sonnet, Grok, or Codex sessions shine here. Given a narrow scoped spec and ready contracts from the DSL, they produce clean classes, branches, and module implementations without flights of fancy.

The third role is the critic and reviewer agent, assigned to Opus. It doesn't write features itself; instead, it reads generated code critically, catches architectural violations and contract mismatches, and files proper bug reports and issues for fixes.

To keep this crew from stepping on each other in one directory, orchestration moved into an open-source tool called reslop (a CLI and live dashboard on Node.js 18.15.0+). Under the hood, it connects over a dozen agent harnesses via the ACP protocol—from Claude Code and Codex to Cursor and Cline (DeepSeek Harness is moving in the same plugin-based direction).

Task handoff is deliberately simple and transparent: agents communicate through plain markdown files on disk and edit code in isolated branches via git worktree. Parallelism is intentionally throttled too. You could spin up ten agents at once, but you'd immediately lose track of who wrote what in the markdown chain. Controllability matters more than maxing out CPU cores.

Readable Diffs, Refactoring Stamps, and Why Style Beats Skills

Picture a normal workday with an agent farm like this. Code pours into the repo at 20,000–80,000 lines per day. Open that stream in a standard git diff and your eyes glaze over in fifteen minutes: endless red-and-green walls stripped of context, where you can't tell if one variable changed or an entire module was rewritten.

reslop was born out of trying to make reviewing "AI slop" physically bearable for a human. Instead of a blind line-by-line dump, it shows whole functions and classes so the block's intent reads clearly. Small repetitive edits get grouped into batches you can approve or reject with one keystroke. Inside modified lines, a word-level sub-diff (like GitHub's web UI) draws your eye straight to a renamed token or shifted condition instead of forcing you to reread the whole line. Everything is keyboard-driven, without mouse gymnastics.

Another handy feature is built-in refactoring "stamps". You don't have to type a long prompt explaining what's wrong with a block every time. Tag it with a standard marker—"decompose", "too granular — merge", "extract invariants", or "add intermediate variables"—and an agent picks up the tag and rewrites that section.

The biggest surprise of this phase, however, involved AI rules. Intuitively, it feels like dropping detailed skills files and style guides into the repo root should make agents follow them faithfully. In reality, models periodically forget those instructions, especially as context swells. Yet they copy the style of surrounding code right inside the repository files almost flawlessly.

Repository Style Holds AI in Line Better Than Prose Rules

Two or three quick review passes with refactoring stamps over a couple of days bring a codebase to a uniform pattern. After that, models start reproducing the right structure on their own without reminders in skills files. Predictable style also brings back accurate estimation: when modules are uniform and transparent, it's clear again how much time and how many tokens the next feature will take.

How Multi-Transport Metacom Grew Inside the Experiment

While the client "all-in-one" app piled up blind code, the strictly controlled first track saw the biggest engineering upgrade. The Metacom RPC network protocol grew by roughly 30% and evolved from a client-server library into an end-to-end multi-transport layer covering all system communication—from server worker threads to direct browser-to-browser links.

On Node.js servers, inter-thread messaging between Impress workers used to run directly over raw MessagePort API. Now Metacom sits on top. Under the hood it's still MessagePort with all its benefits, like passing objects and sockets without extra serialization, while developers get one unified call protocol.

Infographic schematic of the Metacom protocol architecture with end-to-end network transports from server to P2P

In the browser, they pulled a similar trick with tabs. Opening a separate network connection from each of five open tabs of the same app is wasteful. So tab-to-Service-Worker communication moved onto a single proxy: all tabs multiplex requests over one shared WebSocket to the server. WebRTC hit a classic browser restriction—browsers don't allow opening a WebRTC connection directly inside a Service Worker. They worked around it cleanly: one host tab holds the live link, and the other tabs share it through that same Service Worker proxy.

The external network layer expanded significantly too:

  • Full HTTP/2 transport joined the existing HTTP/1.1 support.
  • WebSocket was rewritten to drop the external ws dependency completely (finished by contributor Georgiy).
  • File transfers were updated for the new channels, extending Roman's existing WebRTC implementation.
  • A WebRTC transport was built over reliable, ordered RTCDataChannel (which runs on SCTP and DTLS with a WebSocket-like interface). Fun detail: AI wrote the WebRTC transport code, but the author read and refined every line manually, leaving zero "blind" code in the core stack.

For application code, all of this sits behind a plain URL. The client passes an address with a scheme, and Metacom decides which channel to use: connect directly to a nearby peer over WebRTC or fall back to WebSocket via the server. Metacom itself can even act as the signaling channel for exchanging IP addresses and ports. NAT traversal and router punch-through (STUN and TURN servers, critical for UDP traffic) moved into a separate metaice package. Heavy video and audio streams bypass Metacom on dedicated media and file channels so they never clog RPC calls.

System LayerTransportWhat It Solves in PracticeCurrent Status & Notes
Server (Node.js)MessagePort under MetacomMessaging between Impress workers with zero-serialization object passingRunning in core stack
Browser (tabs)Service Worker proxyMultiplexes tabs into one WebSocket and shared WebRTCHost tab holds WebRTC; others route via proxy
Client — serverHTTP/1.1 and HTTP/2Standard RPC calls and HTTP multiplexingHTTP/2 added; no HTTP/3 yet
Client — serverCustom WebSocketPersistent bidirectional channel without external ws dependencyImplemented and tested
Peer-to-peer (P2P)WebRTC (RTCDataChannel)Direct data, delta, and file exchange without a serverAI-generated, fully reviewed by hand
NAT traversalmetaice (STUN / TURN)Establishes direct UDP links behind routersPushed to repo, not yet published on npm

One obvious gap left in the transport layer is HTTP/3. Other protocols like gRPC are on the radar too, though they'll only be added for a real need rather than a checkbox.

Local Subnet P2P, Crypto Signatures, and the Real Limits of Vibecoding

Why build all this hybrid transport machinery for chat and streaming? The payoff shows immediately in an office or home where a desktop, laptop, and two phones share one router. If five people in the same room watch a stream from a remote server, a classic setup pulls five identical heavy video streams over the external internet link. The pipe chokes and video stutters.

The experiment's design works like building plumbing: instead of running five separate pipes from the city main to every faucet, one main line enters the house and branches inside. Neighbor discovery avoids noisy local broadcast packets too. The server already sees the IP addresses of all connected clients. When it spots several devices on the same subnet, it introduces them, and the clients bring up direct WebRTC links. The external line carries just one video stream, and devices distribute it locally torrent-style—no fragile daisy chain and no overloaded central PC.

The hybrid architecture shines even brighter when the server goes down. If you stop the server mid-session, the app doesn't freeze on an endless spinner. Clients stay connected directly over WebRTC (RTC 1 linked) and keep trading messages and reactions on the local network. When the server comes back online, nodes automatically introspect the interface, sync accumulated changes via pull and push, and notify peers that the hub is back.

To make server-free exchanges trustworthy, security relies on cryptography from the first launch. The browser generates a key pair locally, and every record and file chunk is signed with cryptographic hashes. Devices can even pass client app updates to each other directly without a server—the receiver simply verifies the digital signature against the public key it received on initial install.

Local storage uses browser OPFS, an isolated filesystem inside the browser hidden from the OS file explorer and free of annoying permission prompts. On a modern SSD, synchronous access via FileSystemSyncAccessHandle inside a Web Worker is fast enough to record high-quality "raw" video and audio locally (StreamYard-style) while sending a lighter, lower-bitrate stream over the network. That said, the built-in video editor isn't wired to these raw recordings yet—nor are multi-peer chunked file seeding, YouTube streaming, multi-device account linking, or storing peer coordinates on a blockchain for fully serverless discovery. All of those remain at the spec stage.

There are also fundamental technology limits you can't brute-force. Offline sync relies on CRDTs (Conflict-free Replicated Data Types—structures that let nodes update state independently and converge to the same result without central locks). They merge structural edits effortlessly: counters, edits in different table cells, and block insertions tied to unique GUIDs. Yet CRDTs can't solve semantic conflicts. If two users go offline, both delete old tables, and both type completely different blocks, math can't guess who is right—the system can only merge both documents side by side. Plus, a growing delta log can't expand forever; it must be compacted periodically with milestone snapshots, say once a day.

That exact same boundary runs through the entire vibecoding experiment. Handing AI agents UI screens, forms, and business logic inside a rigid frame of DSL, contracts, and automated reviewers is a solid bet currently being stress-tested across hundreds of thousands of lines. Meanwhile, the system's foundation—network transports, NAT traversal, cryptography, sync protocols, and module boundaries—remains the personal responsibility and manual review zone of a human engineer.

Want a deep diveVotes help us choose what to break down in detail. This material has 0 votes.
Sources · 7