โœฆ The RhoMog Model โœฆ

A living demonstration of continuation mobility in a distributed object system โ€” told as a fantasy world so the mechanics are immediately legible.

What is the RhoMog Model?

RhoMog stands for Rho Mobile Object Graph. Rho is KAI's infix scripting language. Mobile refers to the central property being demonstrated: that running computations โ€” not just data โ€” can be suspended, relocated across hosts, and resumed with complete fidelity. Object Graph is what KAI manages: a distributed graph of typed, reflectable objects whose identity persists across node boundaries.

The canonical source of truth for this model is a single Rho script: ContinuationMobilityDemo.rho. Everything else โ€” the C++ reference executable, the animated Migration View, this page โ€” exists to make the script's behaviour legible to a human reader without requiring them to run it.

The core claim: in a fully integrated KAI runtime, a suspended continuation is a serialisable binary payload. It can be frozen on one node, transmitted over ENet UDP, and resumed on another node. The computation does not know it moved. The RhoMog Model demonstrates what this looks like at the agent and host level, using explicit snapshot-and-restore mechanics as a stand-in for the real continuation migration hooks that are the next implementation step.

The Four Realms

Each realm is a logical region hosted on a network node. Hover the realm names in the Migration View to see the technical node identifier.

โš” Ironhold   NodeA / Start region
The starting fortress. Most heroes begin here. Initial load is high; the War Council later redistributes forces away from it. In technical terms: NodeA hosts the Start region, which receives the majority of initial agent placement.

๐Ÿ’€ Ashmarket   NodeB / Market region โ€” fails at tick 60
A cursed trading post, prosperous at first and then doomed. The Oracle detects congestion early and reroutes heroes away. At tick 56, three heroes are drawn back by fate. At tick 60, the node fails and they are lost โ€” temporarily. This is the failure scenario: a live host going dark with agents on it.

๐ŸŒŠ Harborveil   NodeC / Harbor region โ€” Pi host
The mist-shrouded port where the Oracle dwells. When the Oracle perceives congestion in Ashmarket, it redirects heroes here. In technical terms: Pi's planning logic runs on NodeC and routes agents to Harbor when Market load is excessive.

โœจ The Refuge   NodeD / Backup region โ€” recovery target
The sanctuary that receives overflow and the fallen alike. The War Council sends excess heroes here during load balancing. After Ashmarket falls, the resurrected heroes appear here. In technical terms: NodeD hosts the Backup region and is the designated recovery host for the snapshot restore.

The Ten Heroes

Each hero is a mobile agent โ€” a running computation with identity, placement, and history. Their glyph is their class icon in the Migration View. Hover any hero to see their technical identifier (Agent_1 through Agent_10) alongside their chronicle.

โš”Aldric
Knight
Agent_1 ยท failure drill target
๐Ÿ”ฎSeraphine
Mage
Agent_2 ยท failure drill target
๐Ÿ—กCorvin
Rogue
Agent_3 ยท failure drill target
๐ŸนBrynn
Ranger
Agent_4 ยท patrol / balance
โ˜ Thorn
Warlock
Agent_5 ยท Market โ†’ Harbor via Pi
โœIsolde
Cleric
Agent_6 ยท Market โ†’ Harbor via Pi
โ™ชDax
Bard
Agent_7 ยท Market โ†’ Harbor via Pi
๐ŸŒ‘Vex
Assassin
Agent_8 ยท Market โ†’ Harbor via Pi
๐ŸŒฟMira
Druid
Agent_9 ยท Harbor from init
๐Ÿ”ฅGorath
Berserker
Agent_10 ยท Harbor from init

The Three Forces That Move Heroes

Wandering โ€” Autonomous Patrol

Every eleven ticks (modulo agent id), a hero moves to a region on a different host than their current one. No external instruction drives this โ€” it is the agent's own behaviour. This models compute that migrates for locality or resource reasons without being told to. In the Rho script: autonomous patrol via moveAgent.

Oracle's Vision โ€” Pi-Guided Routing

Every five steps, a hero consults the Oracle. The Oracle is Pi โ€” KAI's stack-based planning language โ€” running on Harborveil (NodeC). Pi evaluates current host load and can redirect the hero. In this demonstration, Pi detects that Ashmarket is overcrowded and reroutes the four heroes there to Harborveil. Later, when a host reaches saturation, Pi sends its denizens to The Refuge. This is policy-driven migration: an external planner deciding where compute should run based on runtime conditions.

War Council โ€” Load Balancing

Every 25 ticks, the world measures host load across all four realms. If the busiest host has more than one more hero than the least loaded, the War Council intervenes and relocates heroes to equalise pressure. This is scheduler-driven migration โ€” the system relocating compute without agent awareness. In the Rho script: balanceLoad(), comparing hostLoad entries.

The Phases

Wandering
autonomous patrol
Heroes move between realms on their own schedule, driven by their step count and id.
Oracle's Vision
Pi language routing decision
The Oracle evaluates host load and issues movement directives to individual heroes.
Memory Crystal
world snapshot captured
Every 20 ticks, the full state of all heroes is preserved. This becomes the recovery baseline.
War Council
load balancing across hosts
Every 25 ticks, overloaded hosts shed heroes to underloaded ones.
Shadow Falls
host failure / node removed
Ashmarket (NodeB) is removed from the live set at tick 60. Heroes on it are lost from the world.
Resurrection
snapshot restore / agent recovery
Lost heroes are reconstructed from the last memory crystal at The Refuge, with all state intact.

The Failure and Recovery Sequence

This is the central demonstration. The sequence is deterministic and runs the same way every time:

TickEvent (Fantasy)Event (Technical)
0Ten heroes summoned across three realms10 agents initialised: 4 on NodeA, 4 on NodeB, 2 on NodeC
20Oracle reroutes Ashmarket heroes to Harborveil. First memory crystal forged.Pi routing: agents 5โ€“8 moved from Marketโ†’Harbor. Snapshot captured.
25War Council dispatches two heroes from Ironhold to The RefugeLoad balance: 2 agents moved from NodeAโ†’NodeD
40Second memory crystal forgedSnapshot updated โ€” new recovery baseline reflecting post-balance positions
56Fate draws Aldric, Seraphine, and Corvin into Ashmarket's shadowFailure drill: agents 1, 2, 3 forced onto NodeB (Market region)
60Memory crystal forged. Ashmarket falls. Three heroes lost. Three heroes reborn at The Refuge.Snapshot captured. NodeB fails: agents 1โ€“3 removed. Snapshot restore: agents 1โ€“3 reconstructed on NodeD with restored=true, migrations+1.
61โ€“80The reborn rejoin the living. The realm stabilises.Post-recovery: restored agents participate in patrol, Pi routing, and balancing normally.
Why is the drill deterministic? Agents 1, 2, and 3 are explicitly moved to NodeB at tick 56. Without this, patrol and balancing may have scattered them across other hosts, making the failure event unpredictable and the recovery hard to observe. The drill exists to make the scenario readable โ€” the same three heroes fall, the same three are reborn, every run.

What the Views Show

Migration View animates the hero glyphs moving between realm cards in real time. Each glyph is a running agent. The phase strip tracks the current operation. The event banner narrates the latest action in fantasy language with technical terms bracketed. Hover any hero to inspect their full chronicle. Gold glow = resurrected from snapshot.

System View presents the same simulation as structured data โ€” host and region state, agent lists, counters, a key-moment timeline, and a rolling event log. Use it to read exact agent state at any tick and verify recovery produces the expected outcome.

Relationship to the KAI Runtime

This demonstration does not use the KAI executor, Registry, or ENet network stack directly. It is a reference model: a self-contained, testable simulation of the intended behaviour. The Rho script is the canonical narrative. The C++ executable is a deterministic reference implementation of the same logic, covered by a GoogleTest suite. The HTML views are explanations of that narrative.

The next step โ€” not yet implemented โ€” is to wire the Rho script's migration events to real KAI continuation hooks, so that the Suspend / Migrate / Resume sequence becomes an actual cross-process continuation transfer over ENet UDP. The RhoMog Model defines that target behaviour unambiguously, so the implementation has a clear contract to fulfil.

Source Files

Demo/ContinuationMobilityDemo/ContinuationMobilityDemo.rhoCanonical narrative. Source of truth for all views.
Demo/ContinuationMobilityDemo/ContinuationMobilityDemo.cppC++ reference executable. Same logic, deterministic output, CI-testable.
Demo/ContinuationMobilityDemo/ContinuationMobilityAnimation.htmlAnimated Migration View. Fantasy skin with technical hover labels.
Demo/ContinuationMobilityDemo/ContinuationMobilityDemo.htmlSystem View. Structured data display of the same simulation.
Demo/ContinuationMobilityDemo/style.cssShared stylesheet for all HTML views.
Test/Examples/ContinuationMobilityDemoTests.cppGoogleTest suite for the C++ reference model.
Test/Language/TestRho/ContinuationMobilityDemoScriptTest.cppSmoke test: verifies the Rho script executes successfully.