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

Autoresearch with Claude Code on Production Codebase: 60 Experiments, 3 Changes Kept
A developer ran 60 iterations of autoresearch with Claude Code on a production hybrid search system (Django, pgvector, Cohere embeddings), keeping only 3 changes with a 93% failure rate. The process identified ineffective optimizations and caught a Redis caching bug.

Using Claude AI to Create Reusable App Marketing Checklists for Solo Developers
A solo iOS developer used Claude AI to build a comprehensive marketing checklist covering pre-launch, launch week, and post-launch tasks, reducing the process from two weeks to one afternoon per app.

Developer uses Claude Code agents to resolve 635 issues across 42 board games in single session
A solo developer used Claude Code agents to fix 635 UI/UX issues across 42 multiplayer board games in one session, resulting in 325 commits while maintaining zero build errors. The workflow involved running four agents simultaneously, each handling a single issue from different games to avoid file conflicts.

Building Jarvis: A Self-Hosted AI Operations Layer with OpenClaw
A developer shares their architecture for a personal AI assistant running on a Mac mini 24/7, using OpenClaw, n8n, Obsidian, and a cascade of AI models to manage small business operations.