LiPu-jpg/Openwrite

AI小说创作引擎 - 对话式引导创建项目、动态+静态文件防遗忘、多维风格提取与合成、通用技法质量审核、热门题材查看分析、多层渐进式压缩长文本 支持:四级大纲(总纲→篇→节→章)、三层风格合成、伏笔DAG管理、情节弧线-节拍模板驱动写作、去AI味技法

OpenWrite – AI‑augmented workstation for writing long‑form fiction

What it is – OpenWrite is a locally‑run application that lets authors co‑write a novel with two specialised AI agents:

  • Goethe – helps you organise ideas, characters, world‑building and the rolling outline.
  • Dante – takes the confirmed assets, assembles the appropriate context, drafts a chapter, runs an automated review, updates the story’s “truth” files and writes the result to disk.

All of this lives inside a single, version‑controlled project folder and a web‑based Studio UI (or an equivalent CLI). The system is built to keep the author’s intent, plot facts and character states consistent across dozens or hundreds of chapters.


Core capabilities

Feature How OpenWrite handles it
Full‑stack studio Web UI for creating a novel, configuring models, editing outlines, managing assets, writing, reviewing, searching, and exporting to Markdown/TXT/EPUB.
Dual agents Goethe = planning & asset creation; Dante = context assembly, drafting, fact extraction, state settlement. Agents only write after the author explicitly confirms a diff.
Single source of truth src/ holds the canonical outline, author intent, character and world files. Runtime data (manuscript, memory, reviews, caches) lives under data/.
Long‑context handling For each chapter the system builds a canonical packet that includes recent chapters, the rolling outline, relevant character/state snippets and up‑to‑four recalled earlier passages.
State tracking Inline, line‑based annotations (e.g., //**Shen Jin[伤势]:左臂轻伤 -> 已恢复**) record character locations, injuries, relationships, etc. Conflicts are detected automatically.
Transactional writing A per‑novel lock guarantees that writing, state updates and file writes succeed together; on failure the system rolls back to a snapshot.
Structured review loop 37‑dimensional review checks author intent, style, continuity, factual consistency, etc. Issues are shown with severity, linked to the source text, and can generate diff‑based revision proposals.
Private reference library & RAG Import old drafts or external works, run a local FastEmbed vector index (or OpenAI‑compatible embeddings), optionally enable LightRAG graph‑based retrieval for entity‑level reasoning.
Extensible Skills Standard SKILL.md files (or runtime manifest.yaml skills) can be invoked in a turn with @skill-id. Skills are sandboxed and never bypass the author‑confirmation step.
Model‑agnostic Supports OpenAI, Anthropic, or any OpenAI‑compatible endpoint. Model parameters (model name, temperature, context window, etc.) are set in the Studio’s Model Settings panel.

Getting started (quick‑start)

  1. Clone & launch
    git clone https://github.com/LiPu-jpg/Openwrite.git
    cd Openwrite
    python3.10 -m venv .venv
    source .venv/bin/activate   # Windows: .venv\Scripts\activate
    python -m pip install -e .
    openwrite studio   # opens the local web UI
    
    On macOS/Windows you can also double‑click the provided 启动 OpenWrite.command / 启动 OpenWrite.bat which creates an isolated runtime, installs dependencies and opens the UI.
  2. Configure a model – In the Studio’s top‑bar Model Settings choose OpenAI, Anthropic or a custom endpoint, enter the API key and test the connection.
  3. Create a novel – The first‑run wizard asks for a title and a folder (default ~/OpenWriteNovels/<Title>). The folder will contain the src/ and data/ sub‑trees.
  4. Plan with Goethe – Open the AI Collaboration pane, discuss plot ideas, characters, world rules. Goethe proposes drafts, you approve the diff, and the assets are written to src/.
  5. Write with Dante – From the outline view pick a chapter, set a word‑count goal, and click Write. Dante assembles the canonical packet, calls the LLM, writes the chapter, extracts factual changes and updates the state files.
  6. Review & revise – Use the Review pane to see automatically generated issues, filter by severity, and apply suggested diffs.
  7. Export – When the manuscript is complete, go to Project Migration and export to Markdown, plain‑text or EPUB.

Architecture at a glance

Studio ──┐
Goethe ──┤   → NovelApplicationService (canonical packet, write/review/revision, state bookkeeping)
Dante  ──┼─
CLI    ──┘

All interfaces share the same action surface so the CLI and the UI behave identically. The service stores the confirmed source files under src/ and all transient data under data/.


License & community

  • License – Apache‑2.0 for the core code; third‑party components keep their original licences (FastEmbed, LightRAG, LiteLLM, Vditor, etc.).
  • Contributing – Run python -m pip install -e ".[dev]" and pytest to check the test suite. Issues and feature requests are handled via the GitHub Issues page.
  • Acknowledgements – Built on LightRAG (graph + vector retrieval), FastEmbed (local embeddings), LiteLLM (model gateway), Vditor (Markdown editor) and the oh‑story‑claudecode skill suite.

Who it’s for

  • Authors writing a multi‑chapter novel who need a reliable way to keep character arcs, world rules and plot foreshadowing consistent.
  • Writers who want AI assistance without surrendering control – every change to the canonical story files must be explicitly approved.
  • Teams that prefer a local‑first workflow (no mandatory cloud storage) but still want optional cloud embeddings or LLM endpoints.

Bottom line – OpenWrite is a full‑featured, locally‑hosted AI‑agent platform tailored to the long‑context challenges of novel‑length writing. It combines planning, drafting, automated review, vector/RAG retrieval and a version‑safe UI, all while keeping the author in the loop for every decisive edit.

Related

  • Project
  • Project
  • Project
  • Project
  • Project