一键导入
micropolis-command-bus
// Routes all Micropolis UI, CLI, MCP, chat, pie menu, and LLM actions through a safe command bus with preview/proposal/approval. Use when agents need to inspect, propose, approve, reject, or dispatch Micropolis commands.
// Routes all Micropolis UI, CLI, MCP, chat, pie menu, and LLM actions through a safe command bus with preview/proposal/approval. Use when agents need to inspect, propose, approve, reject, or dispatch Micropolis commands.
| name | micropolis-command-bus |
| description | Routes all Micropolis UI, CLI, MCP, chat, pie menu, and LLM actions through a safe command bus with preview/proposal/approval. Use when agents need to inspect, propose, approve, reject, or dispatch Micropolis commands. |
| license | GPL-3.0 |
| tier | 2 |
| protocol | MICROPOLIS-COMMAND-BUS |
| allowed-tools | ["read_file","write_file","run_terminal_cmd"] |
| related | ["micropolis","moollm","mooco","skill","card","advertisement","action-queue","protocol","github","skill-snitch","speed-of-light","planning","simulation","constructionism"] |
| tags | ["micropolis","command-bus","mcp","llm-actions","operator-model","sveltekit","safety"] |
"All roads to the simulator go through the bus."
The Micropolis command bus is the shared operation layer for humans, UI widgets, pie menus, keyboard shortcuts, chat slash commands, MCP tools, CLI commands, and MOOLLM characters.
It is the Micropolis equivalent of Blender operators, extended with MOOLLM-style proposal, preview, approval, and audit semantics.
All agent-controlled Micropolis actions must go through the command bus. Do not call simulator, view, window, workspace, or GitHub mutation APIs directly when a command exists or should exist.
Read in this order:
GLANCE.yml — quick activation checkCARD.yml — machine-readable interface, advertisements, methodsSKILL.md — this operational protocolREADME.md — deeper human-facing rationaleNever load a lower layer without reading the layer above it first.
| File | Role |
|---|---|
apps/micropolis/src/lib/CommandBus.ts | Core bus: commands, dispatch, preview, undo, proposals |
apps/micropolis/src/lib/micropolisCommands.ts | Micropolis command registry |
apps/micropolis/src/lib/CommandMcpService.ts | MCP-style service wrapper |
apps/micropolis/cli/bus/index.ts | Unified CLI command-bus branch |
skills/micropolis-command-bus/CARD.yml | MOOLLM card interface |
skills/micropolis-command-bus/GLANCE.yml | Tiny mipmap summary |
Commands are data objects:
{
id: string;
label: string;
icon?: string;
context?: string | string[];
enabled?: boolean | ((context) => boolean);
run: (context) => result;
preview?: (context) => preview;
undo?: (context) => undo;
policy?: {
risk: "safe" | "reversible" | "destructive" | "external";
allowLLM?: boolean;
requiresApproval?: boolean | ((context) => boolean);
};
}
All surfaces dispatch the same command IDs:
| Risk | LLM Behavior |
|---|---|
safe | May dispatch directly when useful |
reversible | Prefer proposal unless user explicitly approved direct execution |
destructive | Must preview and propose; user approval required |
external | Must preview and propose; explicit user approval required |
llm, especially if not safe.Run from MicropolisCore/micropolis:
npm run micropolis -- bus list --format yaml
npm run micropolis -- bus preview <command-id> --args '{"key":"value"}' --actor llm --reason "why" --format yaml
npm run micropolis -- bus propose <command-id> --args '{}' --actor llm --reason "why" --format yaml
npm run micropolis -- bus proposals --status pending --format yaml
npm run micropolis -- bus approve <proposal-id> --actor user --format yaml
npm run micropolis -- bus reject <proposal-id> --reason "why" --format yaml
The command-bus branch is one module of the unified CLI. --help, about, and api are the terminal-facing documentation.
CommandMcpService.ts exposes MCP-style tools:
command_listcommand_previewcommand_proposecommand_dispatchcommand_proposal_listcommand_proposal_approvecommand_proposal_rejectThis is not yet a standalone MCP server process. It is the service layer that a future mooco or MCP adapter can export.
This skill deliberately composes with:
| Skill | How |
|---|---|
micropolis | Domain model, simulation, Git multiverse, educational purpose |
micropolis | Unified CLI and module surface |
tool-calling-protocol | why/reason discipline and safe tool execution |
action-queue | Pending command proposals are action-queue entries |
advertisement | Commands advertise capabilities and map naturally to pie menus |
card | CARD.yml declares methods, ads, K-lines, and interface |
github | Future external commands for issues, PRs, commits, branches |
skill-snitch | Audit command declarations against actual dispatch behavior |
mooco | Future orchestrator can operationalize MCP service and proposal state |
speed-of-light | Multiple AI tutors can debate proposals inside one LLM call |
constructionism | Students learn by previewing, proposing, running, undoing actions |
UI surfaces should not own behavior. They invoke named operations with context.
The bus gives Micropolis a single, inspectable, replayable command vocabulary. That vocabulary can drive the simulator today and later drive tabbed windows, spatial outlines, GitHub-as-MMORPG workflows, role presets, AI tutors, and multiplayer governance.
session-log.skill-snitch checks: every mutating code path should correspond to a command.