A multi-agent system designed to write long-form coherent novels by maintaining a structured, multi-tier memory of the world, characters, and plot.
Many thanks to Gemini and GPT for their help!
Note
The project is currently in a very early stage.
👉 Project Architecture | 👉 Flowchart | 👉 User Guide | 👉 Documents
- Long-Term Consistency: Uses a hybrid database (SQLite + FAISS) to track "hard" facts (rules, relationships) vs. "soft" details (descriptions, atmosphere).
- Multi-Agent Collaboration: Specialized AI roles (Architect, Writer, Critic, Scanner) work together to plan, write, review, and archive the story.
- Dual Model Support: Supports Google Gemini and OpenAI Compatible APIs.
- Dedicated Embedding Service: Decoupled architecture allowing separate endpoints for Generation (LLM) and Embeddings (Vector DB).
- Continuous Writing: Automated loop to generate multiple chapters in sequence.
- Two-Stage Plot Planning: Builds both a high-level Novel Plot Outline and a Detailed Plot Outline before chapter planning.
- Unified Discussion Template: World/plot/guide/chapter-text discussions now share one normalized template and title format.
- Centralized i18n & Prompt Management: All AI instructions and UI strings are strictly separated into the
i18n/directory, supportingzh-CNandennatively. - Intent-Gated Retrieval Chain: Planning/writing now enforce
Intent Classifier -> SQLite Prefilter -> FAISS Retrieval -> Cross-Tier Alignment. - Atomic Memory Transactions: Synchronized SQLite and FAISS commits with index cloning and automated rollback on
BLOCKINGconflicts. - Deep Interruption Recovery: Exhaustive integrity validation of all runtime artifacts before resuming.
- Language Guard: Automatic confidence-based language detection and rewrite loop.
- Conflict Severity Levels: Conflicts are classified as
BLOCKINGorNON_BLOCKINGfor safer automation.
-
Prerequisites:
- Python 3.10+
- (Optional) A supported local LLM model (GGUF format) for Llama.cpp or an OpenAI-compatible server.
- (Optional) A supported local Embedding model for Llama.cpp or an OpenAI-compatible server.
-
Install Dependencies:
pip install -r requirements.txt
-
Configuration:
- Open
src/config.py. - Set
LANGUAGE = "Chinese"or"English". - Configure role model routing and workflow controls.
- Open
python src/main.py --initFill novel/Novel_Overview.md and start:
python src/main.py --start- Plan:
python src/main.py --plan 1 - Write:
python src/main.py --write 1 - Scan:
python src/main.py --scan 1 - Conflicts:
python src/main.py --conflicts-triage
# Generate 5 chapters starting from Chapter 1
python src/main.py --auto 1 5The system now supports separating the Generation Model from the Embedding Model for optimal local performance.