# danyalabbas/simulatecraft architecture

> Architecture diagram of the GitHub repository danyalabbas/simulatecraft, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-16). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/danyalabbas/simulatecraft
- Repository: https://github.com/danyalabbas/simulatecraft

## Overview

SimulateCraft runs LLM-driven Minecraft agents: a user configures and starts a simulation, agents observe the world and choose actions, the environment applies them, and the browser presents live state and accepts human input. The core Runner orchestrates agent decisions, environment steps, and events. The README confirms browser map/chat/goals and the local viewer; sampled source supports the core loop and selected memory, skill, world-settings, and server relationships. Other UI and integration details are not fully sampled, so uncertain links are omitted.

Main entry points: [`src/simulatecraft/brains/llm.py`](https://github.com/danyalabbas/simulatecraft/blob/main/src/simulatecraft/brains/llm.py) (LLM brain), [`src/simulatecraft/minecraft/env.py`](https://github.com/danyalabbas/simulatecraft/blob/main/src/simulatecraft/minecraft/env.py) (Minecraft environment), [`src/simulatecraft/core/runner.py`](https://github.com/danyalabbas/simulatecraft/blob/main/src/simulatecraft/core/runner.py) (Simulation runner), [`src/simulatecraft/server/app.py`](https://github.com/danyalabbas/simulatecraft/blob/main/src/simulatecraft/server/app.py) (REST and WebSocket server)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_control["Simulation control"]
  node_cli["CLI startup<br/>[cli.py]"]
  node_runner["Simulation runner<br/>[runner.py]"]
  node_agent["Agent model<br/>[agent.py]"]
  node_schemas["Action and observation schemas<br/>[schemas.py]"]
  node_events["Event bus<br/>[events.py]"]
end

subgraph group_reasoning["Agent reasoning"]
  node_brain["LLM brain<br/>[llm.py]"]
  node_planner["Plan generation<br/>[planner.py]"]
end

subgraph group_world["Minecraft world"]
  node_environment["Environment interface<br/>[environment.py]"]
  node_minecraft["Minecraft environment<br/>[env.py]"]
  node_actions["Minecraft actions<br/>[actions.py]"]
  node_observations["World observations<br/>[observations.py]"]
  node_connection["Bot connection<br/>[connection.py]"]
  node_bot["Mineflayer bot<br/>[bot.js]"]
  node_worldsettings["World settings<br/>[world_settings.py]"]
  node_rcon["Minecraft RCON<br/>[rcon.py]"]
  node_worldstore[("World settings file")]
end

subgraph group_experience["Memory and skills"]
  node_stream["Memory stream<br/>[stream.py]"]
  node_retrieval["Memory retrieval<br/>[retrieval.py]"]
  node_skills["Skill registry<br/>[registry.py]"]
  node_persona["Agent personas<br/>[persona.py]"]
end

subgraph group_interface["Browser interface"]
  node_server["REST and WebSocket server<br/>[app.py]"]
  node_browser["Browser viewer<br/>[app.js]"]
  node_logviewer["Event log viewer<br/>[log.py]"]
end

node_user(("User"))

node_user -->|"starts simulation"| node_cli
node_cli -.->|"starts"| node_runner
node_runner -->|"queries decisions"| node_agent
node_runner -->|"observes and steps"| node_environment
node_runner -->|"publishes events"| node_events
node_agent -.->|"requests decisions"| node_brain
node_brain -->|"validates actions"| node_schemas
node_brain -->|"uses planning"| node_planner
node_brain -->|"retrieves memories"| node_retrieval
node_brain -->|"reuses skills"| node_skills
node_brain -.->|"records experience"| node_stream
node_retrieval -->|"reads records"| node_stream
node_environment -->|"implemented by"| node_minecraft
node_minecraft -->|"applies actions"| node_actions
node_minecraft -->|"builds observations"| node_observations
node_minecraft -->|"manages bot links"| node_connection
node_connection -.->|"connects to"| node_bot
node_minecraft -->|"runs commands"| node_rcon
node_worldsettings -->|"applies world rules"| node_rcon
node_worldsettings -->|"persists settings"| node_worldstore
node_server -->|"controls simulation"| node_runner
node_server -->|"handles inbound chat"| node_events
node_server -->|"manages agents"| node_persona
node_browser -->|"controls and views"| node_server
node_user -->|"views map and chat"| node_browser
node_events -->|"feeds event log"| node_logviewer

click node_cli "https://github.com/danyalabbas/simulatecraft/blob/main/src/simulatecraft/cli.py"
click node_runner "https://github.com/danyalabbas/simulatecraft/blob/main/src/simulatecraft/core/runner.py"
click node_agent "https://github.com/danyalabbas/simulatecraft/blob/main/src/simulatecraft/core/agent.py"
click node_schemas "https://github.com/danyalabbas/simulatecraft/blob/main/src/simulatecraft/core/schemas.py"
click node_events "https://github.com/danyalabbas/simulatecraft/blob/main/src/simulatecraft/core/events.py"
click node_brain "https://github.com/danyalabbas/simulatecraft/blob/main/src/simulatecraft/brains/llm.py"
click node_planner "https://github.com/danyalabbas/simulatecraft/blob/main/src/simulatecraft/planning/planner.py"
click node_environment "https://github.com/danyalabbas/simulatecraft/blob/main/src/simulatecraft/core/environment.py"
click node_minecraft "https://github.com/danyalabbas/simulatecraft/blob/main/src/simulatecraft/minecraft/env.py"
click node_actions "https://github.com/danyalabbas/simulatecraft/blob/main/src/simulatecraft/minecraft/actions.py"
click node_observations "https://github.com/danyalabbas/simulatecraft/blob/main/src/simulatecraft/minecraft/observations.py"
click node_connection "https://github.com/danyalabbas/simulatecraft/blob/main/src/simulatecraft/minecraft/connection.py"
click node_bot "https://github.com/danyalabbas/simulatecraft/blob/main/src/simulatecraft/minecraft/bot/bot.js"
click node_worldsettings "https://github.com/danyalabbas/simulatecraft/blob/main/src/simulatecraft/minecraft/world_settings.py"
click node_rcon "https://github.com/danyalabbas/simulatecraft/blob/main/src/simulatecraft/minecraft/rcon.py"
click node_stream "https://github.com/danyalabbas/simulatecraft/blob/main/src/simulatecraft/memory/stream.py"
click node_retrieval "https://github.com/danyalabbas/simulatecraft/blob/main/src/simulatecraft/memory/retrieval.py"
click node_skills "https://github.com/danyalabbas/simulatecraft/blob/main/src/simulatecraft/skills/registry.py"
click node_persona "https://github.com/danyalabbas/simulatecraft/blob/main/src/simulatecraft/server/persona.py"
click node_server "https://github.com/danyalabbas/simulatecraft/blob/main/src/simulatecraft/server/app.py"
click node_browser "https://github.com/danyalabbas/simulatecraft/blob/main/src/simulatecraft/server/static/app.js"
click node_logviewer "https://github.com/danyalabbas/simulatecraft/blob/main/src/simulatecraft/viewers/log.py"
click node_worldstore "https://github.com/danyalabbas/simulatecraft/blob/main/data/world_settings.json"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_cli,node_runner,node_agent,node_schemas,node_events,node_user toneBlue
class node_brain,node_planner toneAmber
class node_environment,node_minecraft,node_actions,node_observations,node_connection,node_bot,node_worldsettings,node_rcon,node_worldstore toneMint
class node_stream,node_retrieval,node_skills,node_persona toneRose
class node_server,node_browser,node_logviewer toneIndigo
```

## Components

### Simulation control

- [CLI startup](https://github.com/danyalabbas/simulatecraft/blob/main/src/simulatecraft/cli.py): `src/simulatecraft/cli.py`
- [Simulation runner](https://github.com/danyalabbas/simulatecraft/blob/main/src/simulatecraft/core/runner.py): `src/simulatecraft/core/runner.py`
- [Agent model](https://github.com/danyalabbas/simulatecraft/blob/main/src/simulatecraft/core/agent.py): `src/simulatecraft/core/agent.py`
- [Action and observation schemas](https://github.com/danyalabbas/simulatecraft/blob/main/src/simulatecraft/core/schemas.py): `src/simulatecraft/core/schemas.py`
- [Event bus](https://github.com/danyalabbas/simulatecraft/blob/main/src/simulatecraft/core/events.py): `src/simulatecraft/core/events.py`

### Agent reasoning

- [LLM brain](https://github.com/danyalabbas/simulatecraft/blob/main/src/simulatecraft/brains/llm.py): `src/simulatecraft/brains/llm.py`
- [Plan generation](https://github.com/danyalabbas/simulatecraft/blob/main/src/simulatecraft/planning/planner.py): `src/simulatecraft/planning/planner.py`

### Minecraft world

- [Environment interface](https://github.com/danyalabbas/simulatecraft/blob/main/src/simulatecraft/core/environment.py): `src/simulatecraft/core/environment.py`
- [Minecraft environment](https://github.com/danyalabbas/simulatecraft/blob/main/src/simulatecraft/minecraft/env.py): `src/simulatecraft/minecraft/env.py`
- [Minecraft actions](https://github.com/danyalabbas/simulatecraft/blob/main/src/simulatecraft/minecraft/actions.py): `src/simulatecraft/minecraft/actions.py`
- [World observations](https://github.com/danyalabbas/simulatecraft/blob/main/src/simulatecraft/minecraft/observations.py): `src/simulatecraft/minecraft/observations.py`
- [Bot connection](https://github.com/danyalabbas/simulatecraft/blob/main/src/simulatecraft/minecraft/connection.py): `src/simulatecraft/minecraft/connection.py`
- [Mineflayer bot](https://github.com/danyalabbas/simulatecraft/blob/main/src/simulatecraft/minecraft/bot/bot.js): `src/simulatecraft/minecraft/bot/bot.js`
- [World settings](https://github.com/danyalabbas/simulatecraft/blob/main/src/simulatecraft/minecraft/world_settings.py): `src/simulatecraft/minecraft/world_settings.py`
- [Minecraft RCON](https://github.com/danyalabbas/simulatecraft/blob/main/src/simulatecraft/minecraft/rcon.py): `src/simulatecraft/minecraft/rcon.py`
- [World settings file](https://github.com/danyalabbas/simulatecraft/blob/main/data/world_settings.json): `data/world_settings.json`

### Memory and skills

- [Memory stream](https://github.com/danyalabbas/simulatecraft/blob/main/src/simulatecraft/memory/stream.py): `src/simulatecraft/memory/stream.py`
- [Memory retrieval](https://github.com/danyalabbas/simulatecraft/blob/main/src/simulatecraft/memory/retrieval.py): `src/simulatecraft/memory/retrieval.py`
- [Skill registry](https://github.com/danyalabbas/simulatecraft/blob/main/src/simulatecraft/skills/registry.py): `src/simulatecraft/skills/registry.py`
- [Agent personas](https://github.com/danyalabbas/simulatecraft/blob/main/src/simulatecraft/server/persona.py): `src/simulatecraft/server/persona.py`

### Browser interface

- [REST and WebSocket server](https://github.com/danyalabbas/simulatecraft/blob/main/src/simulatecraft/server/app.py): `src/simulatecraft/server/app.py`
- [Browser viewer](https://github.com/danyalabbas/simulatecraft/blob/main/src/simulatecraft/server/static/app.js): `src/simulatecraft/server/static/app.js`
- [Event log viewer](https://github.com/danyalabbas/simulatecraft/blob/main/src/simulatecraft/viewers/log.py): `src/simulatecraft/viewers/log.py`

### Other components

- **User**

## Connections

- User → CLI startup: starts simulation (evidence: `README.md`)
- CLI startup → Simulation runner: starts
- Simulation runner → Agent model: queries decisions (evidence: `src/simulatecraft/core/runner.py`)
- Simulation runner → Environment interface: observes and steps (evidence: `src/simulatecraft/core/runner.py`)
- Simulation runner → Event bus: publishes events (evidence: `src/simulatecraft/core/runner.py`)
- Agent model → LLM brain: requests decisions
- LLM brain → Action and observation schemas: validates actions (evidence: `src/simulatecraft/brains/llm.py`)
- LLM brain → Plan generation: uses planning (evidence: `src/simulatecraft/brains/llm.py`)
- LLM brain → Memory retrieval: retrieves memories (evidence: `src/simulatecraft/brains/llm.py`)
- LLM brain → Skill registry: reuses skills (evidence: `src/simulatecraft/brains/llm.py`)
- LLM brain → Memory stream: records experience (evidence: `src/simulatecraft/brains/llm.py`)
- Memory retrieval → Memory stream: reads records (evidence: `src/simulatecraft/memory/retrieval.py`)
- Environment interface → Minecraft environment: implemented by (evidence: `src/simulatecraft/minecraft/env.py`)
- Minecraft environment → Minecraft actions: applies actions (evidence: `src/simulatecraft/minecraft/env.py`)
- Minecraft environment → World observations: builds observations (evidence: `src/simulatecraft/minecraft/env.py`)
- Minecraft environment → Bot connection: manages bot links (evidence: `src/simulatecraft/minecraft/env.py`)
- Bot connection → Mineflayer bot: connects to
- Minecraft environment → Minecraft RCON: runs commands (evidence: `src/simulatecraft/minecraft/env.py`)
- World settings → Minecraft RCON: applies world rules (evidence: `src/simulatecraft/minecraft/world_settings.py`)
- World settings → World settings file: persists settings (evidence: `src/simulatecraft/minecraft/world_settings.py`)
- REST and WebSocket server → Simulation runner: controls simulation (evidence: `src/simulatecraft/server/app.py`)
- REST and WebSocket server → Event bus: handles inbound chat (evidence: `src/simulatecraft/server/app.py`)
- REST and WebSocket server → Agent personas: manages agents (evidence: `src/simulatecraft/server/app.py`)
- Browser viewer → REST and WebSocket server: controls and views (evidence: `README.md`)
- User → Browser viewer: views map and chat (evidence: `README.md`)
- Event bus → Event log viewer: feeds event log (evidence: `src/simulatecraft/viewers/log.py`)
