ALTWORLD: A Persistent Life-Sim Architecture That Separates LLM from Database to Solve AI Amnesia

ALTWORLD is a persistent life-simulation game built to solve the "AI amnesia" problem common in AI-driven games and agents. Instead of relying on an LLM's context window to maintain world state, the system stores the canonical run state in structured tables and JSON blobs within a PostgreSQL database.
Architecture and Implementation
The project uses a Next.js App Router, Prisma, and PostgreSQL stack to handle complex transactional run creation. When a player inputs a move, the system mutates state through explicit simulation phases first, then generates narrative text after state changes. This strict separation ensures actions happen according to a timeline and past decisions influence future events.
The AI physically cannot hallucinate items like a sword into inventory because the PostgreSQL database will reject illogical state changes. The system can recover, restore, branch, and continue purely from hard data, creating a materially constrained life-sim tone rather than a pure power fantasy.
Key Components
- World Forge: An AI-assisted tool where players pitch scenarios, and the system generates factions, NPCs, and pressures. Claude helped write strict JSON schema validation and normalization pipelines that convert generative drafts into hard database rows.
- Simulation Loop: Includes lock-recovery and state-mutation logic for turn advancement, ensuring world systems and NPC decisions resolve before the narrative renderer is called.
- State Management: The canonical run state is stored in PostgreSQL with structured tables and JSON blobs, completely separating the LLM from the database.
Development Approach
The developer used Claude heavily for underlying engineering tasks rather than just prose generation. Claude helped structure the architecture, write validation pipelines, and implement the simulation loop logic. The game runs on a self-made engine called StoriDev.
The project is free to try with guest preview runs offering a limited number of free moves before account creation is required. The developer specifically seeks feedback from other developers working on persistent AI agents or decoupled architectures.
📖 Read the full source: r/ClaudeAI
👀 See Also

Multi-agent setup triggers $3,400 in charges due to hallucination loop
A developer hardcoded a corporate virtual card into environment variables for testing a multi-agent MCP setup, resulting in $3,400 in charges when a primary agent got stuck in a hallucination loop that spun up new paid proxy instances every 45 seconds for 14 hours.

Building a Concert Radar with OpenClaw: Scraping Multiple Sources for Artist Shows
A developer built a concert radar using OpenClaw on a VPS that pulls artists from Spotify, scans multiple sources daily, normalizes events, matches artists, deduplicates, and tracks new announcements via cron jobs.

Practical experience replacing automation stack with MCP servers and local LLMs
A developer shares results from 4 months of running personal automation infrastructure using MCP servers with Qwen 2.5 32B and Llama 3.3 70B models on dual 3090 hardware, detailing what works well and what doesn't.

Multi-Agent Systems Fail Silently with Garbage Output, Requiring Metadata Validation
A developer running a 39-agent system for two weeks found that when one agent produces garbage output, downstream agents process it confidently, creating polished but fabricated results. The solution involves wrapping output in metadata envelopes that declare task completion and source counts.