Taming the AI: A Developer's Tool for Consistent Long-Form Fiction
If you've ever tried to use a large language model to write a long story or a novel, you've hit the wall. The AI starts strong, but by chapter three, the protagonist's eye color has changed, their hometown is different, and a sidekick you never wrote has shown up. These "hallucinations" or consistency errors break the narrative and make the output unusable for serious projects.
This is the core problem the webnovel-writer project tackles head-on. It's not just another AI writing prompt wrapper; it's a structured system designed to maintain coherence over thousands of words, making AI a viable co-pilot for long-form fiction.
What It Does
In essence, webnovel-writer is a local web application that orchestrates AI-generated writing with rigorous consistency checks. You provide a core premise and outline. The system then manages the generation process, maintaining a dynamic "story bible" that tracks characters, locations, plot points, and established facts. Before writing a new section, it checks this bible to ensure everything aligns, and it updates the bible with new details as they are created. It turns a one-shot AI prompt into a stateful, iterative writing process.
Why It's Cool
The cleverness here is in the architecture. Instead of fighting the model's tendency to forget, the project builds an external memory system.
- Dynamic Knowledge Management: The "story bible" is a living document. The AI doesn't just read from it; it also writes to it, creating a feedback loop that grounds all future output.
- Structured Workflow: It breaks down the monumental task of "write a novel" into manageable, AI-friendly steps: plan outline, develop characters, write chapter, review for consistency, repeat.
- Developer-Friendly Stack: Built with Go for the backend and a simple web frontend, it's straightforward to set up locally. It's designed to work with your own OpenAI-compatible API key (like OpenAI or local models via LiteLLM), giving you control over costs and models.
- Solves a Real Problem: This isn't abstract. For developers who are also writers, world-builders, or creators of text-based games, this provides a practical scaffold to leverage AI without the constant cleanup.
How to Try It
Getting started is pretty standard for a Go project. You'll need Go 1.21+ installed and an API key.
- Clone the repo:
git clone https://github.com/lingfengQAQ/webnovel-writer.git cd webnovel-writer - Set up your environment variables. Copy the example config and add your API details:
cp .env.example .env # Edit