Supports OpenAI models to facilitate procedural or AI-driven generation and management of graph-based world histories.
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@Alethea World History EngineList all factions currently at war and summarize their main grievances."
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
Alethea π
A narrative graph engine used to generate, track, and visualize fictional worlds using LLMs or purely procedurally.
π Overview
World History Engine is a narrative framework that can work in two modes:
AI-Assisted: As an MCP Server for LLMs (like Claude), allowing them to query and mutate the world state consistently.
Procedural (Standalone): As a classic generator where you use the GUI or CLI to spawn worlds based on YAML templates, without needing an API key or LLM.
It maintains a consistent internal graph database of entities (Factions, Characters, Locations) and their relationships.
β¨ Key Features
π΅οΈββοΈ RAG for Fiction: Keeps track of thousands of entities without filling up the LLM context window.
π² Dual Mode: Works with Claude/OpenAI OR as a standalone offline generator.
πΈοΈ Graph-Based Consistency: Entities have strict relationships (e.g.,
Faction A --[war]--> Faction B).β³ Time-Travel Debugging: Includes a web-based visualizer (
world_viz.html) with a timeline slider. Roll back history to see how the world looked 50 epochs ago.
π Architecture
Here is the internal structure of the world engine entities:
π Quick Start
π³ Docker Deployment
1. Build the Image
Build the container image from the root of your repository:
2. Run the Container
Run the image, exposing the two required ports. Replace your_api_key_here with your actual key. You can skip BASE_URL if using standard OpenAI.:
3. Access
Web UI (Standalone Generation): Access the graphical interface at
http://localhost:8001.MCP Server (AI Integration): Connect your Claude Desktop or other MCP client to
http://localhost:8000.Logs: View combined logs for both services:
docker logs world-engine-instance.
Prerequisites for deployment without Docker
Python 3.11+
uv(recommended) orpip
Installation
π² Generating Worlds (Standalone)
You can generate worlds without configuring any AI:
Option 1: Graphical Interface (GUI) Start the web server to generate and visualize worlds interactively.
Option 2: Command Line (CLI)
Run the main generation script to create a fresh world snapshot in world_output/.
π€ Running with LLM (MCP Server)
To use this engine as a tool inside Claude (for interactive storytelling), run the MCP server:
Add this to your claude_desktop_config.json:
To use this engine as a tool inside Qwen Desktop, paste the following configuration in the MCP settings:
And add description
π Visualizing Your World
The engine comes with a standalone HTML visualizer.
Generate a world using GUI, CLI, or MCP.
Open
static/world_viz.htmlin your browser.Upload the JSON export (from
world_output/).Explore: Drag nodes, filter by factions, and use the Timeline Slider to replay history.
βοΈ Configuration & Templates
The engine's logic is data-driven. You can modify the simulation rules in data/templates/:
factions.yaml: Define cultures, taboos, and aggression levels.biomes.yaml: Configure environmental generation.resources.yaml: Manage economy items.
And more other rules of naming in data/naming
πΊοΈ Roadmap
Persistent storage (PostgreSQL/Neo4j support)
Develop AI driven quest generator
π€ Contributing
Contributions are welcome! Please check out the issues tab or submit a PR.
π License
This project is licensed under the MIT License - see the LICENSE file for details.