Architecture
ποΈ Moincraft Architecture#
System Map#
Hermes/Hermit operator ββREST/opsβββΆ Relay :55667
β β²
ββ persona + memory + skills β optional DASHBOARD_API_TOKEN
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β PM2 / launch_all.sh β
ββββββββββββββββ¬βββββββββββββββ¬ββββββββββββββ¬ββββββββββββββ€
β mc-server β dashboard βmindcraft- β prismarine- β
βPaper 1.21.11 βSvelte :55666 βbots :55668 βviewer :55669β
β G1GC JVM βrelay :55667 βmain.js βviewer.js β
ββββββββ¬ββββββββ΄βββββββ¬ββββββββ΄βββββββ¬βββββββ΄βββββββ¬βββββββ
β β β β
:25565 socket.io MindServer Three.js
TCP/UDP events hub + WS WebGL
β β β β
ββββββββββββββββ΄βββββββββββββββ΄ββββββββββββββ
Mineflayer Bots (per agent)
Port Map#
| Port | Service | Notes |
|---|---|---|
| 25565 | Paper MC Server | MOINCRAFT_SPIGOT_PORT |
| 55666 | Svelte Dashboard UI | MOINCRAFT_NEW_DASHBOARD_PORT |
| 55667 | Dashboard relay backend | DASHBOARD_PORT, Socket.IO |
| 55668 | MindServer | MINDSERVER_PORT, agent hub |
| 55669 | Prismarine Viewer | MOINCRAFT_VIEWER_PORT, WebGL |
| 55661+ | Per-agent viewer ports | base + offset |
AIRI-Inspired Layer Split#
- Soul/Operator: Hermes owns durable persona, memory, skills, and remote messaging
- Runtime Bridge: Relay
:55667is the stable API boundary β prefer extending relay contracts over calling MindServer internals - Embodied Agents: Mindcraft/Mineflayer owns Minecraft state, pathfinding, action execution, in-world coordination
Agent Lifecycle#
bootstrap() β Mindcraft.init() β createAgent(settings)
ββ Agent.start()
ββ ActionManager β action queue + interrupts
ββ Prompter β LLM abstraction (chat/code/vision/embed)
ββ History β sliding window + LLM summarization
ββ Coder β code gen + ESLint lint + SES sandbox exec
ββ NPCController β item/build goals + constructions
ββ MemoryBank β (stub, extend for vector DB)
ββ SelfPrompter β autonomous goal loop (STOPPED/ACTIVE/PAUSED)
ββ VisionInterpreter β screenshot β vision model
ββ CooperationFramework β multi-agent levels 1β5
ββ initModes() β tick-based reactive behaviors
Startup Order (Critical)#
1. Paper MC server (wait :25565 TCP)
2. mindcraft-bots (AGENT_STARTUP_DELAY_MS=1500 between agents)
3. prismarine-viewer (after server ready)
4. dashboard
β οΈ Only ONE orchestrator at a time β either moincraft.service (systemd) OR user-level moincraft-*.service β NEVER both (causes EADDRINUSE + session.lock conflicts).
Prompter β 4 Model Slots#
{
"model": "chat model (default fallback for all)",
"code_model": "specialized for !newAction codegen",
"vision_model": "multimodal for !lookAtPlayer etc",
"embedding": "semantic search for examples + skill docs"
}
Prompt templates use $VAR placeholders: $NAME $STATS $INVENTORY $MEMORY $COMMAND_DOCS $CODE_DOCS $EXAMPLES $SELF_PROMPT $LAST_GOALS $BLUEPRINTS $CONVO $ACTION $TO_SUMMARIZE
History β Memory System#
- Sliding window: keeps last
max_messages(default 15) turns - Summarization: when full β LLM compresses oldest 5 turns into
memory(β€500 chars) - Persistence:
bots/{name}/memory.jsonβ survives restarts ifload_memory: true - Full history: appended to
bots/{name}/histories/{timestamp}.json - Prompt injection:
$MEMORYinjects summary; recent turns provide context
SelfPrompter β Autonomous Loop#
start(goal) β loop {
send "You are self-prompting with goal: '{goal}'. Use a !command."
if no command used 3Γ in a row β stop
await 2s cooldown
}
States: STOPPED(0) ACTIVE(1) PAUSED(2). Auto-restarts if idle β₯ cooldown and state is ACTIVE.
Coder β Safe Code Execution#
- Generates JS code blocks via
promptCoding() - ESLint lints before execution (catches hallucinations)
lockdown()+makeCompartment()via SES for sandboxing- Max 5 attempts, max 3 no-code failures before abort
- Code has access to:
bot,skills,world,Vec3(norequire/import)
RAG β Examples & Skill Library#
- Embeds all conversation + coding examples via
embedding_model - At prompt time: cosine similarity β top-N most relevant injected as
$EXAMPLES - Skill docs for
!newAction: embed task β cosine sim β top-N docs as$CODE_DOCS - Always includes:
placeBlock,wait,breakBlockAt relevant_docs_count: 5,EXAMPLES_INIT_TIMEOUT_MS=20000- Fallback without embedding model: word overlap scoring