Skip to content

Token World

A universe simulator where LLM-powered agents inhabit a text-based world with procedurally generated mechanics.

Overview

Token World is a simulation engine where LLM-powered agents interact with a text-based environment whose rules emerge on-the-fly. The engine interprets agent actions, maps them to existing mechanics or generates new ones as executable Python code, and returns observations grounded entirely in the knowledge graph.

From a resident agent's perspective, the world feels fully real -- every observation derives from actual graph state and mechanic execution. There is no hallucinated or ungrounded state.

Key Concepts

Knowledge Graph

All world state lives in a schema-less property graph powered by NetworkX. Nodes and edges carry arbitrary key-value attributes with no upfront schema. If it's not in the graph, it doesn't exist.

Mechanics

World rules are Python functions generated by LLMs and executed deterministically. Each mechanic:

  • Checks preconditions against the current graph state
  • Applies side effects that mutate the graph
  • Produces mutations that are logged for replay and rollback

Resident Agents

LLM-powered inhabitants that perceive and act within the world through natural language. Each agent maintains its own memory and session history.

Simulation Engine

Orchestrates the core tick loop:

  1. Agent produces an action (natural language)
  2. Engine classifies and interprets the action
  3. Engine matches to an existing mechanic or pauses for generation
  4. Mechanic executes against the knowledge graph
  5. Engine generates a grounded observation from the updated state