About this project

Storyloom is an AI-powered visual novel engine that generates narrative in real time. It uses a streaming XML pipeline (StreamParser → StateManager → EventDispatcher) that parses LLM output line-by-line without buffering, and a bridge pre-fetch mechanism that fires the next API call mid-paragraph to hide latency behind reading time. Key capabilities include: - Two game modes: Text and Graph, with in-scene choices plus outline-level route forks at checkpoints - Character sprites and scene backgrounds with an asset pipeline that does O(1) catalog matching, LLM fallback, and async AI generation - State validation where the LLM suggests writes and the engine type-checks before applying; rejected writes feed back to the model - Context management via sliding window, permanent system prompt anchor, and checkpoint compression (~50K tokens) - Co-creation flow where the AI interviews the user about their idea before generating world, characters, and plot - Atomic JSON saves that are mode-agnostic, allowing switching between text and graph modes at any time - i18n support for English, Simplified Chinese, and Traditional Chinese via gettext - Web UI built on FastAPI + SSE + vanilla JS SPA, with optional native desktop window via pywebview Installation options include a standalone binary (no Python required), PyPI wheel (Python ≥ 3.10), and from source. Optional extras add native desktop window support and background removal for generated images using onnxruntime. The project is MIT licensed and follows a stdlib-first Python convention with Conventional Commits.