12 KiB
GENOME.md — the-nexus
Project Overview
the-nexus is a hybrid repo that combines three layers in one codebase:
- A browser-facing world shell rooted in
index.html,boot.js,bootstrap.mjs,app.js,style.css,portals.json,vision.json,manifest.json, andgofai_worker.js - A Python realtime bridge centered on
server.pyplus harness code undernexus/ - A memory / fleet / operator layer spanning
mempalace/,mcp_servers/,multi_user_bridge.py, and supporting scripts
The repo is not a clean single-purpose frontend and not just a backend harness. It is a mixed world/runtime/ops repository where browser rendering, WebSocket telemetry, MCP-driven game harnesses, and fleet memory tooling coexist.
Grounded repo facts from this checkout:
- Browser shell files exist at repo root:
index.html,app.js,style.css,manifest.json,gofai_worker.js - Data/config files also live at repo root:
portals.json,vision.json - Realtime bridge exists in
server.py - Game harnesses exist in
nexus/morrowind_harness.pyandnexus/bannerlord_harness.py - Memory/fleet sync exists in
mempalace/tunnel_sync.py - Desktop/game automation MCP servers exist in
mcp_servers/desktop_control_server.pyandmcp_servers/steam_info_server.py - Validation exists in
tests/test_browser_smoke.py,tests/test_portals_json.py,tests/test_index_html_integrity.py, andtests/test_repo_truth.py
The current architecture is best understood as a sovereign world shell plus operator/game harness backend, with accumulated documentation drift from multiple restoration and migration efforts.
Architecture Diagram
graph TD
browser[Index HTML Shell\nindex.html -> boot.js -> bootstrap.mjs -> app.js]
assets[Root Assets\nstyle.css\nmanifest.json\ngofai_worker.js]
data[World Data\nportals.json\nvision.json]
ws[Realtime Bridge\nserver.py\nWebSocket broadcast hub]
gofai[In-browser GOFAI\nSymbolicEngine\nNeuroSymbolicBridge\nsetupGOFAI/updateGOFAI]
harnesses[Python Harnesses\nnexus/morrowind_harness.py\nnexus/bannerlord_harness.py]
mcp[MCP Adapters\nmcp_servers/desktop_control_server.py\nmcp_servers/steam_info_server.py]
memory[Memory + Fleet\nmempalace/tunnel_sync.py\nmempalace.js]
bridge[Operator / MUD Bridge\nmulti_user_bridge.py\ncommands/timmy_commands.py]
tests[Verification\ntests/test_browser_smoke.py\ntests/test_portals_json.py\ntests/test_repo_truth.py]
docs[Contracts + Drift Docs\nBROWSER_CONTRACT.md\nREADME.md\nCLAUDE.md\nINVESTIGATION_ISSUE_1145.md]
browser --> assets
browser --> data
browser --> gofai
browser --> ws
harnesses --> mcp
harnesses --> ws
bridge --> ws
memory --> ws
tests --> browser
tests --> data
tests --> docs
docs --> browser
Entry Points and Data Flow
Primary entry points
index.html— root browser entry pointboot.js— startup selector;tests/boot.test.jsshows it chooses file-mode vs HTTP/module-mode and injectsbootstrap.mjswhen served over HTTPbootstrap.mjs— module bootstrap for the browser shellapp.js— main browser runtime; owns world state, GOFAI wiring, metrics polling, and portal/UI logicserver.py— WebSocket broadcast bridge onws://0.0.0.0:8765nexus/morrowind_harness.py— GamePortal/MCP harness for OpenMW Morrowindnexus/bannerlord_harness.py— GamePortal/MCP harness for Bannerlordmempalace/tunnel_sync.py— pulls remote fleet closets into the local palace over HTTPmulti_user_bridge.py— HTTP bridge for multi-user chat/session integrationmcp_servers/desktop_control_server.py— stdio MCP server exposing screenshots/mouse/keyboard control
Data flow
- Browser startup begins at
index.html boot.jsdecides whether the page is being served correctly; in HTTP mode it injectsbootstrap.mjsbootstrap.mjshands off toapp.jsapp.jsloads world configuration fromportals.jsonandvision.jsonapp.jsconstructs the Three.js scene and in-browser reasoning components, includingSymbolicEngine,NeuroSymbolicBridge,setupGOFAI(), andupdateGOFAI()- Browser state and external runtimes connect through
server.py, which broadcasts messages between connected clients - Python harnesses (
nexus/morrowind_harness.py,nexus/bannerlord_harness.py) spawn MCP subprocesses for desktop control / Steam metadata, capture state, execute actions, and feed telemetry into the Nexus bridge - Memory/fleet tools like
mempalace/tunnel_sync.pyimport remote palace data into local closets, extending what the operator/runtime layers can inspect - Tests validate both the static browser contract and the higher-level repo-truth/memory contracts
Important repo-specific runtime facts
portals.jsonis a JSON array of portal/world/operator entries; examples in this checkout includemorrowind,bannerlord,workshop,archive,chapel, andcourtyardserver.pyis a plain broadcast hub: clients send messages, the server forwards them to other connected clientsnexus/morrowind_harness.pyandnexus/bannerlord_harness.pyboth implement a GamePortal pattern with MCP subprocess clients over stdio and WebSocket telemetry uplinkmempalace/tunnel_sync.pyis not speculative; it is a real client that discovers remote wings, searches remote rooms, and writes.closet.jsonpayloads locally
Key Abstractions
Browser runtime
app.js- Defines in-browser reasoning/state machinery, including
class SymbolicEngine,class NeuroSymbolicBridge,setupGOFAI(), andupdateGOFAI() - Couples rendering, local symbolic reasoning, metrics polling, and portal/UI logic in one very large root module
- Defines in-browser reasoning/state machinery, including
BROWSER_CONTRACT.md- Acts like an executable architecture contract for the browser surface
- Declares required files, DOM IDs, Three.js expectations, provenance rules, and WebSocket expectations
Realtime bridge
server.py- Single hub abstraction: a WebSocket broadcast server maintaining a
clientsset and forwarding messages from one client to the others - This is the seam between browser shell, harnesses, and external telemetry producers
- Single hub abstraction: a WebSocket broadcast server maintaining a
GamePortal harness layer
nexus/morrowind_harness.pynexus/bannerlord_harness.py- Both define MCP client wrappers,
GameState/ActionResult-style data classes, and an Observe-Decide-Act telemetry loop - The harnesses are symmetric enough to be understood as reusable portal adapters with game-specific context injected on top
- Both define MCP client wrappers,
Memory / fleet layer
mempalace/tunnel_sync.py- Encodes the fleet-memory sync client contract: discover wings, pull broad room queries, write closet files, support dry-run
mempalace.js- Minimal browser/Electron bridge to MemPalace commands via
window.electronAPI.execPython(...) - Important because it shows a second memory integration surface distinct from the Python fleet sync path
- Minimal browser/Electron bridge to MemPalace commands via
Operator / interaction bridge
multi_user_bridge.pycommands/timmy_commands.py- These bridge user-facing conversations or MUD/Evennia interactions back into Timmy/Nexus services
API Surface
Browser / static surface
index.htmlserved over HTTPboot.jsexportsbootPage(); verified bynode --test tests/boot.test.js- Data APIs are file-based inside the repo:
portals.json,vision.json,manifest.json
Network/runtime surface
python3 server.py- Starts the WebSocket bridge on port
8765
- Starts the WebSocket bridge on port
python3 l402_server.py- Local HTTP microservice for cost-estimate style responses
python3 multi_user_bridge.py- Multi-user HTTP/chat bridge
Harness / operator CLI surfaces
python3 nexus/morrowind_harness.pypython3 nexus/bannerlord_harness.pypython3 mempalace/tunnel_sync.py --peer <url> [--dry-run] [--n N]python3 mcp_servers/desktop_control_server.pypython3 mcp_servers/steam_info_server.py
Validation surface
python3 -m pytest tests/test_portals_json.py tests/test_index_html_integrity.py tests/test_repo_truth.py -qnode --test tests/boot.test.jspython3 -m py_compile server.py nexus/morrowind_harness.py nexus/bannerlord_harness.py mempalace/tunnel_sync.py mcp_servers/desktop_control_server.pytests/test_browser_smoke.pydefines the higher-cost Playwright smoke contract for the world shell
Test Coverage Gaps
Strongly covered in this checkout:
tests/test_portals_json.pyvalidatesportals.jsontests/test_index_html_integrity.pychecks merge-marker/DOM-integrity regressions inindex.htmltests/boot.test.jsverifiesboot.jsstartup behaviortests/test_repo_truth.pyvalidates the repo-truth documents- Multiple
tests/test_mempalace_*.pyfiles cover the palace layer tests/test_bannerlord_harness.pyexists for the Bannerlord harness
Notable gaps or weak seams:
nexus/morrowind_harness.pyis large and operationally critical, but the generated baseline still flags it as a gap relative to its size/complexitymcp_servers/desktop_control_server.pyexposes high-power automation but has no obvious dedicated test file in the roottests/suiteapp.jsis the dominant browser runtime file and mixes rendering, GOFAI, metrics, and integration logic in one place; browser smoke exists, but there is limited unit-level decomposition around those subsystemsmempalace.jsappears minimally bridged and stale relative to the richer Python MemPalace layermulti_user_bridge.pyis a large integration surface and should be treated as high regression risk even though it is central to operator/chat flow
Security Considerations
server.pybindsHOST = "0.0.0.0", exposing the broadcast bridge beyond localhost unless network controls limit it- The WebSocket bridge is a broadcast hub without visible authentication in
server.py; connected clients are trusted to send messages into the bus mcp_servers/desktop_control_server.pyexposes mouse/keyboard/screenshot control through a stdio MCP server. In any non-local or poorly isolated runtime, this is a privileged automation surfaceapp.jscontains hardcoded local/network endpoints such ashttp://localhost:${L402_PORT}/api/cost-estimateandhttp://localhost:8082/metrics; these are convenient for local development but create environment drift and deployment assumptionsapp.jsalso embeds explicit endpoint/status references likews://143.198.27.163:8765, which is operationally brittle and the kind of hardcoded location data that drifts across environmentsmempalace.jsshells out throughwindow.electronAPI.execPython(...); this is powerful and useful, but it is a clear trust boundary between UI and host executionINVESTIGATION_ISSUE_1145.mddocuments an earlier integrity hazard: agents writing topublic/nexus/instead of canonical root paths. That path confusion is both an operational and security concern because it makes provenance harder to reason about
Runtime Truth and Docs Drift
The most important architecture finding in this repo is not a class or subsystem. It is a truth mismatch.
- README.md says current
maindoes not ship a browser 3D world - CLAUDE.md declares root
app.jsandindex.htmlas canonical frontend paths - tests and browser contract now assume the root frontend exists
All three statements are simultaneously present in this checkout.
Grounded evidence:
README.mdstill says the repo does not contain an active root frontend such asindex.html,app.js, orstyle.css- the current checkout does contain
index.html,app.js,style.css,manifest.json, andgofai_worker.js BROWSER_CONTRACT.mdexplicitly treats those root files as required browser assetstests/test_browser_smoke.pyserves those exact files and validates DOM/WebGL contracts against themtests/test_index_html_integrity.pyassumesindex.htmlis canonical and production-relevantCLAUDE.mdsays frontend code lives at repo root and explicitly warns againstpublic/nexus/INVESTIGATION_ISSUE_1145.mdexplains whypublic/nexus/is a bad/corrupt duplicate path and confirms the real classical AI code lives in rootapp.js
The honest conclusion:
- The repo contains a partially restored or actively re-materialized browser surface
- The docs are preserving an older migration truth while the runtime files and smoke contracts describe a newer present-tense truth
- Any future work in
the-nexusmust choose one truth and alignREADME.md,CLAUDE.md, smoke tests, and file layout around it
That drift is itself a critical architectural fact and should be treated as first-order design debt, not a side note.