ワンクリックで
context
Runtime context passed to compiled closures — the world as seen from inside
Codex または Claude でインストール この Prompt をコピーして Codex、Claude、または他のアシスタントに貼り付けると、Skill ページを確認してインストールできます。
メニュー
Runtime context passed to compiled closures — the world as seen from inside
Codex または Claude でインストール この Prompt をコピーして Codex、Claude、または他のアシスタントに貼り付けると、Skill ページを確認してインストールできます。
SOC 職業分類に基づく
Portable tokens of capability, identity, and access
The grammar rules that make MOOLLM's file system object-oriented. Plural directory names declare element type; UPPERCASE marker files declare interface exports (COM-style, minus the UUIDs); directories are implementation classes exporting every interface whose marker file sits at their root.
Mother skill for platform-descriptor sister skills. Defines what a BIOME is — a bounded region of an ecosystem (coexisting, exchanging, never isolated) for one platform you operate — and what files, subdirectories, and cross-biome bridges every daughter biome inherits.
A skill is documentation that learned to do things.
GNU Emacs as a stateful Lisp machine for agents — daemon, moo-* protocol, emacs.py router, emacs:// URLs, spoken grammar, play-learn-lift.
Schemapedia — schema plugins, families, gateways, formats.yml, mechanism_relations; self-object kernel; delegates to sibling skills.
| name | context |
| description | Runtime context passed to compiled closures — the world as seen from inside |
| allowed-tools | ["read_file","write_file"] |
| tier | 1 |
| protocol | RUNTIME-CONTEXT |
| tags | ["moollm","runtime","context","closure","state","primitive"] |
| related | ["object","adventure","room","buff","simulation"] |
| adversary | global-state |
"The context IS the world as seen from inside the closure." — Dave Ungar, on lexical scope
The world object is passed to every compiled closure. It provides:
world.skills.skill_nameworld.player, world.roomAlways present in every world:
world.turn // Current simulation turn
world.timestamp // ISO timestamp
world.adventure // Root adventure state
.name
.flags // Global boolean flags
.world_state // Global key/value state
world.player // Current player
.id
.name
.location // Path to current room
.inventory // Array of item ids
.buffs // Active buffs
world.room // Current room
.id
.name
.path
.exits
.objects
.is_dark
.is_dangerous
world.party // Party state
.members
.leader
Present when relevant:
// When running object simulate/methods:
world.object // The object being simulated
.id
.state // Object's mutable state
// Methods are bound: world.consume_fuel(1)
// When action targets something:
world.target // The target
.id
.type // "object", "character", "room"
// When NPC is simulating:
world.npc // The NPC
.id
.goals
.state
Skills register state under world.skills.<skill_name> using underscores:
// Skill "economy" → world.skills.economy
world.skills.economy.gold // 100
// Skill "pie-menu" → world.skills.pie_menu (underscore!)
world.skills.pie_menu.last_selection // "north"
// Skill "time" → world.skills.time
world.skills.time.hour // 14
world.skills.time.phase // "afternoon"
Why underscores? Dashes aren't valid JS/Python identifiers. foo-bar skill → foo_bar namespace.
This keeps skill state organized and avoids collisions.
Methods bound to world for interaction:
world.emit("The lamp dies!") // Show message
world.narrate("Darkness falls.", "dramatic")
world.trigger_event("GRUE_APPROACHES", { room: world.room.path })
world.has("brass-key") // true/false
world.give("gold-coins") // Add to inventory
world.take("used-potion") // Remove from inventory
world.flag("dragon_slain") // Get flag
world.set_flag("treasure_found", true) // Set flag
world.get("object.state.fuel") // Get by path
world.set("object.state.lit", true) // Set by path
world.go("../maze/room-a/") // Move player
world.can_go("north") // Check exit
world.add_buff({ name: "Caffeinated", effect: { energy: +2 }, duration: 5 })
world.remove_buff("caffeinated")
world.has_buff("grue_immunity")
world.log("Debug: fuel = " + world.object.state.fuel)
simulate_js: (world) => {
if (world.object.state.lit) {
world.consume_fuel(1); // Call object method
if (world.object.state.fuel <= 0) {
world.extinguish(); // Call object method
world.emit("The lamp sputters and dies!");
if (world.room.is_dark && world.room.is_dangerous) {
world.trigger_event("GRUE_APPROACHES");
}
}
}
}
guard: "player has the key AND room is not dark"
guard_js: (world) => world.has("brass-key") && !world.room.is_dark
score_if: "player is tired OR room is dark"
score_if_js: (world) => world.has_buff("tired") || world.room.is_dark
# Skill "economy" needs to check gold
guard: "player has at least 10 gold"
guard_js: (world) => world.skills.economy.gold >= 10
# Skill "pie-menu" checks last selection
score_if: "last pie menu selection was north"
score_if_js: (world) => world.skills.pie_menu.last_selection === "north"
world is NOT just a bag of key/values. It has defined structure:
Skills don't pollute root world. They register under world.skills.skill_name:
// Skill "economy" → world.skills.economy
world.skills.economy.gold
world.skills.economy.currency
// Skill "pie-menu" → world.skills.pie_menu (underscore!)
world.skills.pie_menu.last_selection
world.skills.pie_menu.hover_direction
// Skill "foo-bar" → world.skills.foo_bar
world.skills.foo_bar.some_state
Rule: skill-name with dashes → skill_name with underscores in namespace.
Object methods appear as functions on world:
// Object defines:
methods:
consume_fuel: "reduce fuel by amount"
// At runtime, method is bound:
world.consume_fuel(1) // Works!
CRITICAL: We always generate BOTH _js AND _py versions of compiled expressions.
# Natural language
guard: "player has the key AND room is not dark"
# BOTH generated:
guard_js: (world) => world.has("brass-key") && !world.room.is_dark
guard_py: lambda world: world.has("brass-key") and not world.room.is_dark
| Runtime | Purpose |
|---|---|
| Python | Server-side simulation, testing, LLM tethering |
| JavaScript | Browser runtime, standalone play |
world.player, world.room, etc.world.has(), world.emit(), etc.- event: COMPILE_EXPRESSION
field: guard
source: "player has the key"
targets:
- field: guard_js
language: javascript
- field: guard_py
language: python
expected_type: boolean
class World:
"""Python runtime context — mirrors JavaScript World class."""
def __init__(self, adventure_data):
self.turn = 0
self.adventure = adventure_data
self.player = adventure_data['player']
self.room = None # Set on navigation
self.party = adventure_data['party']
self.object = None # Set during object simulation
self.skills = {} # Skill state namespaces
def has(self, item_id: str) -> bool:
return item_id in self.player.get('inventory', [])
def flag(self, name: str) -> bool:
return self.adventure.get('flags', {}).get(name, False)
def emit(self, message: str):
print(message) # Or queue for output
def trigger_event(self, name: str, data=None):
# Event system handles this
pass
class World {
/** JavaScript runtime context — mirrors Python World class. */
constructor(adventureData) {
this.turn = 0;
this.adventure = adventureData;
this.player = adventureData.player;
this.room = null; // Set on navigation
this.party = adventureData.party;
this.object = null; // Set during object simulation
this.skills = {}; // Skill state namespaces
}
has(itemId) {
return (this.player.inventory || []).includes(itemId);
}
flag(name) {
return (this.adventure.flags || {})[name] || false;
}
emit(message) {
console.log(message); // Or queue for UI
}
triggerEvent(name, data) {
// Event system handles this
}
}
RUNTIME-CONTEXT — The world passed to closures (Python + JavaScript)