# WenShape: A Structured Agent System for Long-Form Chinese Novel Writing

> WenShape (formerly NOVIX) is a context-aware, agent-based novel creation system designed for Chinese-language medium and long fiction. It tracks volumes, chapters, character cards, and world-building facts in plain-text files, with a selective context injection engine to reduce LLM hallucination across multi-chapter stories.

**unitagain/WenShape** — WenShape文枢(原NOVIX写作):深度上下文感知的智能体小说创作系统/A Deep Context-Aware Agent-Based Novel Creation System

- Repository: https://github.com/unitagain/WenShape
- Website: https://wenshape.cn
- Stars: 420 · Forks: 65
- Language: Python
- License: NOASSERTION
- Published: 2026-09-10 · Updated: 2026-09-10 · Language: en
- Canonical page: https://hysenlabs.com/projects/unitagain-wenshape

## The Problem WenShape Addresses in Long-Form Fiction

Writing a novel longer than a few chapters with an LLM runs into a consistency problem. Characters acquire contradictory backstories, world rules shift between scenes, and facts established in chapter two vanish by chapter twenty. Most LLM writing tools address this by inserting a larger system prompt, but that scales poorly and wastes token budget on facts that are irrelevant to the current scene.

WenShape approaches the problem structurally. Rather than treating the LLM as a black box that writes an entire book from one prompt, it breaks writing into a visible, maintainable workflow: the story is divided into volumes and chapters, characters live in dedicated YAML card files, world-building facts are stored in a JSONL evidence store, and a context engine selects what to inject for each chapter based on relevance rather than recency.

The project targets writers of Chinese-language web fiction (wangshu), IP adaptation, and long-form serialized drama, though the README includes an English translation and the backend supports any LLM provider that speaks the OpenAI-compatible protocol. The last push was on 2026-09-14. The latest release is v0.4.0 from 2026-04-07.

## Volume, Chapter, and Card Architecture

The storage layout is explicit and version-control friendly. Volumes are described in volumes/*.yaml files, chapter summaries in summaries/*_summary.yaml files, and final chapter drafts in drafts/<chapter>/final.md. A scene_brief.yaml per chapter holds the scene-level outline. Chapter ordering is persisted through an order_index field, which the frontend uses to maintain sequence even after batch operations.

Character cards live in cards/characters/*.yaml with fields for personality, backstory, relationships, and motivation. World-building cards use cards/world/*.yaml with a description-first structure (the newer format); older cards with rules and immutable fields are read and merged into the description field automatically for backward compatibility. A style card at cards/style.yaml stores the prose register for the project.

This file layout means the entire novel project is a directory of plain-text YAML, Markdown, and JSONL files. A writer can commit it to git, diff chapters between drafts, or hand the data to another tool. WenShape does not lock project data into a proprietary database.

## How the Context Engine Reduces Hallucination

The context injection mechanism is the design decision that separates WenShape from generic LLM writing assistants. Rather than inserting all character and world-building data into every prompt, the context_engine selects relevant context for each chapter generation call.

Fact retrieval combines BM25 keyword matching, entity enhancement, and chapter binding. A logarithmic chapter distance decay weights facts from nearby chapters more heavily than facts from distant chapters, but does not completely discard relevant world-building data even when it first appeared in chapter one. The decay function is described as log-linear: facts from the immediately preceding chapters rank highest, while facts that are generally true of the world receive a lower but nonzero weight.

The evidence_service constructs an index from canon/facts.jsonl, chapter summaries, and volume summaries. When the orchestrator calls a Writer or Editor agent for a new chapter, the context_engine selects a subset of this evidence, reducing both the prompt length and the risk of inserting irrelevant context that confuses the model.

The README explicitly describes this as the foundation for maintaining long-form context stability rather than a solved problem. The quality of the selection depends on the quality of the facts and summaries that have been maintained through earlier chapters.

## Installing and Running WenShape

WenShape has two deployment paths. The source installation requires Python 3.10 or later and Node.js 18 or later. From the project root:

```bash
cd WenShape-main
start.bat
```

The start.bat script calls start.py, which checks the Python and Node.js environment, installs dependencies if needed, starts the backend on port 8000, and starts the frontend dev server. On first run it also creates the local development configuration files.

For Windows users who do not want to manage the Python and Node.js environments, the repository's Releases page provides a one-click Windows package built by build_release.py. Download the latest release, extract it, and double-click WenShape.exe. The executable bundles everything needed including the config.yaml, .env template, data directory, and static assets.

For macOS and Linux, the source path is the supported route. The .env.example file shows the configuration format:

```bash
WENSHAPE_LLM_PROVIDER=custom
CUSTOM_API_KEY=sk-your-key-here
CUSTOM_BASE_URL=https://api.siliconflow.cn/v1
CUSTOM_MODEL_NAME=deepseek-ai/DeepSeek-V2.5
```

Supported providers set directly in the configuration UI include OpenAI, Anthropic, DeepSeek, Gemini, Qwen (Tongyi), Wenxin, AI Studio, and custom OpenAI-compatible endpoints. Agent-level overrides (WENSHAPE_AGENT_ARCHIVIST_PROVIDER, WENSHAPE_AGENT_WRITER_PROVIDER) allow using different models for the Archivist and Writer roles.

## The Fanfiction Workflow and Its Limits

WenShape includes a fanfiction import workflow for writers adapting existing IP. The workflow runs in four steps: search a source (Moegirl, Wikipedia, or Fandom), preview the page, crawl and extract the text, and generate character and world-building card proposals.

The crawler handles link identification, content extraction, and fallback strategies. Extracted content does not go directly into the project; it enters as a proposal that the writer reviews and either keeps, modifies, or discards. This design prevents low-quality wiki text from contaminating the card store.

The limit here is practical: the crawler depends on external sites being accessible and structured consistently. Moegirl and Fandom page structures change; a successful crawl on one IP may fail on another. The proposal step reduces the damage from a bad crawl but does not eliminate the need to manually verify that the extracted character information is accurate for the specific IP being adapted.

The workflow also accepts arbitrary http and https URLs as input, so writers can paste any publicly accessible page for extraction, not just the three named sources.

## License Constraint and the Lack of a Commercial Route

WenShape is released under the PolyForm Noncommercial License 1.0.0. This is not MIT, Apache, or any permissive open-source license. PolyForm Noncommercial allows free use for personal and research purposes but prohibits use in any commercial context, including using WenShape to produce content that you sell.

For an individual writer who publishes on a free platform, this is not an issue. For a studio, a content company, or a writer who sells their work, the license is a hard blocker. The license terms are in the LICENSE file at the repository root.

A comparison point: similar long-form writing tools like NovelAI or SudoWrite are closed commercial services. WenShape is open source for non-commercial use, which gives complete data control (all files stay local) and the ability to modify the system, but within the noncommercial constraint.

## Conclusion

WenShape suits Chinese-language fiction writers working on medium or long serialized novels who need consistent world-building across dozens of chapters without constantly reloading context by hand. It is a poor fit for writers who need commercial redistribution rights: the PolyForm Noncommercial License 1.0.0 prohibits commercial use. Before committing to it, verify that your preferred LLM provider is in the supported list and that your machine meets Python 3.10 and Node.js 18 requirements; the Windows one-click release removes those prerequisites but ties you to a specific build.

## FAQ

### What LLM models does WenShape support?

WenShape supports OpenAI, Anthropic, DeepSeek, Gemini, Qwen (Tongyi), Wenxin (ERNIE), AI Studio (PaddlePaddle), and any custom OpenAI-compatible endpoint configured in the .env file. Individual agents like the Writer or Archivist can be assigned different providers using the WENSHAPE_AGENT overrides.

### Does WenShape work on macOS and Linux?

Yes, through the source installation path. The one-click Windows release (WenShape.exe) works only on Windows. For macOS and Linux, install Python 3.10 or later and Node.js 18 or later, then run start.sh from the project root to start both the backend and frontend services.

### Can WenShape be used commercially to produce and sell fiction?

No. WenShape is released under the PolyForm Noncommercial License 1.0.0, which prohibits commercial use. Writers who sell their work or use WenShape in a business context would need a separate commercial license, which the repository does not offer.

## Sources

- [Issues](https://github.com/unitagain/WenShape/issues)
- [Project website](https://wenshape.cn)
- [README](https://github.com/unitagain/WenShape/blob/main/README.md)
- [Releases](https://github.com/unitagain/WenShape/releases)
- [unitagain/WenShape on GitHub](https://github.com/unitagain/WenShape)

---

Hysen Labs editorial analysis, written from the project's own repository and release notes. Cite the canonical page: https://hysenlabs.com/projects/unitagain-wenshape
