Instruction file imported from jspeth/monkamoo (
.cursor/rules/project-intelligence.mdc). Copyright stays with the author.
MonkaMOO Project Intelligence
Current State (August 2026)
- The project is Node.js (ESM, plain JavaScript — no TypeScript), ported from Python in August 2026. The Python implementation has been removed; it's preserved at the
python-finalgit tag. - Read
memory-bank/activeContext.mdandmemory-bank/progress.mdfor current status.
Critical Invariants
world.jsonformat is frozen.sortedJSONStringify(src/utils.js) must keep producing byte-identical output to Python'sjson.dumps(sort_keys=True, indent=2). The round-trip test intest/world.test.jsenforces this — never weaken that test.- Command dispatch must stay synchronous. No
awaitinsideWorld.parseCommand→ verb methods.AIPlayer.handleToolCallscaptures command output viacapturedMessagesbetween two synchronous statements; async anywhere in that path silently breaks AI tool results. - The class serialized as
"Object"is namedThing(src/core/thing.js) —Objectcollides with the JS built-in. The mapping lives in the class registry; keepstatic typeNamevalues matching world.json. - Class registration avoids an ESM cycle. New world classes must: extend Base/Thing, set
static typeName, callregisterClass(...)at module bottom, and be imported fromsrc/core/registry.js. Never importregistry.jsfrom a class module — importclassRegistry.js(the leaf) instead. - Verb dispatch is security-guarded.
Base.getFunctionskips anything onObject.prototype. Preserve this when touching dispatch.
Conventions
- Verb methods are named after the verb the player types (
look,dig) ordo_verb(do_name,do_save) — this snake_case is a dispatch convention, not a style slip; Biome's naming rule is off for this reason. - Logger names mirror the Python era (
monkamoo.web,monkamoo.world, ...);src/logger.jsuses printf-style interpolation like Python logging. - Lint/format with Biome (
npm run lint); test withnode:test(npm test). Parser behavior is pinned by golden fixtures generated from the Python parser.
Gotchas
bots/*.jsonis runtime data (gitignored) — AI conversation histories in OpenAI chat format.- The web session is a hand-rolled HMAC-signed cookie (
monkamoo_sessionin server.js). - The interact REPL exits with
.exit(node:repl), notexit. - The parser golden fixtures (
test/fixtures/parser-golden.json) were generated from the original Python parser and pin its behavior; regenerating them requires checking out thepython-finaltag.