How alienet1109/bookworld works
BookWorld turns a configured fictional world into a scene-based, multi-agent story that users can monitor and control in the web interface. Novel-data extraction and character-card conversion are separate preparation routes that create inputs for simulations. The graph follows the documented workflow and the sampled server, history, embedding, database, and frontend code; some internal agent-to-agent and persistence wiring is not shown in the excerpts, so uncertain links are omitted.
Main entry points: message.js Story interface · main_role_agent.py Character agents · llm LLM adapters · BookWorld.py Simulation controller
Components 20
Web interface
- Story interface
frontend/js/message.js - World map
frontend/js/left-section/map-panel.js - Character profiles
frontend/js/left-section/profile-panel.js - Scene controls
frontend/js/right-section/scene-panel.js - WebSocket server
server.py
Story simulation
- Simulation controller
BookWorld.py - World agent
modules/world_agent.py - Character agents
modules/main_role_agent.py - Story evaluation
modules/eval_agent.py - Character prompts
modules/prompt/role_agent_prompt_en.py - World prompts
modules/prompt/world_agent_prompt_en.py - LLM adapters
modules/llm
Agent state
- Simulation history
modules/history_manager.py - Agent memory
modules/memory.py - ChromaDB
modules/db/ChromaDB.py - Embedding models
modules/embedding.py
World preparation
- Novel extraction
extract_data/extract_data.py - Setting extraction
extract_data/extract_settings.py - Card conversion
convert_sillytavern_cards_to_data.py
Other components
- User
Connections 22
- User → Story interface: controls
- Story interface → WebSocket server: WebSocket messages
- WebSocket server → Story interface: story and status
- WebSocket server → Simulation controller: controls simulation
- Simulation controller → WebSocket server: story and state
- Simulation controller → World agent: orchestrates world
- World agent → Character agents: coordinates characters
- Character agents → Character prompts: uses prompts
- World agent → World prompts: uses prompts
- Character agents → LLM adapters: generates dialogue
- World agent → LLM adapters: generates world
- Story evaluation → LLM adapters: requests evaluation
- Simulation controller → Simulation history: records progression
- Character agents → Agent memory: updates memories
- Agent memory → ChromaDB: stores and retrieves
- ChromaDB → Embedding models: embeds text
- Novel extraction → LLM adapters: extracts story data
- Setting extraction → LLM adapters: extracts settings
- Card conversion → Character agents: prepares role data
- Story interface → World map: shows map
- Story interface → Character profiles: shows characters
- Story interface → Scene controls: selects scenes