fabricatio-novel
AI-powered novel generation — outline to publication-ready EPUB.
Full dataflow and generation-logic walkthrough: docs/superpowers/specs/2026-08-21-novel-generation-dataflow.md
Installation
pip install fabricatio[novel]
# or
uv pip install fabricatio[novel]
For the CLI tool:
pip install fabricatio-novel[cli]
Pipeline
Generation runs a staged, template-driven pipeline over a context tree
(NovelContext → ChapterContext → StoryContext → SceneContext), with every plan and
character state proposed by the LLM in batched calls:
- Metadata — outline →
NovelPlan(title, description, word count, global writing constraint, bible) - Characters — bible roster → one
CharacterSpan(start + end card) per character for the whole novel - Chapters — chapter plans, then N-1 boundary cards per character so chapter 1 starts at the roster start and the last chapter ends at the roster end
- Stories — per chapter: story plans, then S-1 boundary cards per character anchored on the chapter's start/end
- Scenes — per story: scene plans; the story's spans are broadcast to every scene, which is where the prose is actually written
- Assembly — the composed context tree becomes a
Novel;NovelBuilder(Rust/PyO3) produces the EPUB
Character state is two pure cards, never an interpolated chain: the LLM is only asked for the coarsest boundary states, and code stitches them so continuity is guaranteed. Single-child levels inherit their parent's spans with no LLM call.
The CLI runs the pipeline as a staged workflow (DebugNovelWorkflow), persisting a
whole-tree JSON snapshot after every stage so any wrong result is traceable:
01_init → 02_metadata → 03_characters → 04_chapter_plans → 05_story_plans
→ 06_scene_plans → 07_scenes → 08_novel → 09_epub
An optional RAG variant (RagDebugNovelWorkflow) retrieves WritingStyleDocument
entries from LanceDB once per story and renders them raw into the scene prompts.
Key Classes
Context channels
| Class | Role |
|---|---|
NovelContext |
Root channel: outline, language, roster charactor_span, chapter_context |
ChapterContext |
Chapter channel: charactor_span, story_context, heading block |
StoryContext |
Story channel: charactor_span, scene_context, story-scoped RAG style docs |
SceneContext |
Leaf channel: broadcast charactor_span, content (the only composed prose) |
CharacterSpan |
Start + end CharacterCard; derive_child_spans stitches boundary cards |
SeriesBible |
characters roster string + background_settings fact list; broadcast down |
Plans & models
| Class | Description |
|---|---|
NovelPlan |
Novel metadata: title, description, word count, global constraint, bible |
ChapterPlan / StoryPlan / ScenePlan |
Weighted per-element plans (title, description, weight, style, constraint, cast) |
Scene / Story / Chapter / Novel |
Materialized output tree with word-count satisfaction |
WritingStyleDocument / EnrichedDocument |
LanceDB-backed writing-style references |
Capabilities (mixins)
| Class | Description |
|---|---|
SceneCompose |
Scene requirement rendering + prose generation |
StoryCompose |
Scene planning, scene write preparation, serial scene composition |
ChapterCompose |
Story planning, draft_story_spans (S-1 boundary cards), story composition |
NovelCompose |
Metadata, prepare_character_span (roster), chapter planning, draft_chapter_spans (N-1 boundary cards) |
RAGCompose |
Retrieves style docs once per story; extends scene prompts |
BibleCompose |
Creates/updates the setting bible from an outline |
Actions (staged workflow)
| Action | Stage |
|---|---|
InitNovelContext |
01_init — build context from outline/language/constraint/bible |
MetadataStage |
02_metadata — propose novel plan |
CharactersStage |
03_characters — propose roster spans |
ChapterPlanStage |
04_chapter_plans — plan chapters + draft boundaries |
StoryPlanStage |
05_story_plans — plan stories + draft boundaries |
ScenePlanStage / RagScenePlanStage |
06_scene_plans — plan scenes (with RAG) |
SceneWriteStage / RagSceneWriteStage |
07_scenes — broadcast spans + write scene prose |
AssembleStage |
08_novel — materialize Novel |
DumpEpubStage |
09_epub — export EPUB |
Workflows
| Workflow | Description |
|---|---|
DebugNovelWorkflow |
Outline → EPUB, one stage per action with per-stage snapshots |
RagDebugNovelWorkflow |
Same, with writing-style RAG per story |
Rust / PyO3
| Symbol | Description |
|---|---|
NovelBuilder |
Builder for EPUB 3.0 novels: title/description/authors, chapters (auto-XHTML), cover, fonts, CSS, TOC |
text_to_xhtml_paragraphs |
Plain text → <p>-wrapped XHTML paragraphs |
Usage
CLI
# Generate a novel from an outline
fanvl w -o "In a world where dreams are currency..."
# Generate with writing style RAG (LanceDB)
fanvl wr -o "In a world where dreams are currency..." -rq "Hemingway terse prose style"
# Constrain generation with a setting bible + global writing constraint
fanvl w -o "..." -b settings/bible.json -c "first person view throughout"
# Create / update / show the setting bible
fanvl bible create -o "In a world where dreams are currency..." --out settings/bible.json
fanvl bible update settings/bible.json -o "..." --sections characters
fanvl bible show settings/bible.json
# Store reference texts as writing style documents in LanceDB
fanvl store-refs ./corpus/*.txt
fanvl enrich-refs ./corpus/*.txt -eg "Extract world-building facts"
Programmatic
from fabricatio_novel.workflows.novel import DebugNovelWorkflow
from fabricatio_core import Event
event = Event.instantiate("write")
event.payload["novel_outline"] = "In a world where dreams are currency..."
role = Role.with_bio(name="writer").subscribe(event, DebugNovelWorkflow).dispatch()
EPUB Builder (Rust)
from fabricatio_novel.rust import NovelBuilder, text_to_xhtml_paragraphs
xhtml = text_to_xhtml_paragraphs(raw_chapter_text)
builder = (
NovelBuilder()
.new_novel()
.set_title("My Novel")
.add_author("Author Name")
.add_chapter("Chapter 1", xhtml)
.add_inline_toc()
)
builder.export("output.epub")
Dependencies
fabricatio-core— Core interfaces, template management, LLM capabilitiesfabricatio-character— Character card modelspydantic— Data validation via models- Optional:
fabricatio-lancedb— writing style RAG,typer— CLI
License
MIT — see LICENSE
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distributions
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file fabricatio_novel-0.14.0-cp314-cp314-win_amd64.whl.
File metadata
- Download URL: fabricatio_novel-0.14.0-cp314-cp314-win_amd64.whl
- Upload date:
- Size: 2.4 MB
- Tags: CPython 3.14, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via:
uv/0.12.5 {"installer":{"name":"uv","version":"0.12.5","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d74d9843689625ce19b1a5292efb33d745888c1ddbf5d475adedb644c1c14b83
|
|
| MD5 |
311fe9dd4cd5a7972dbcafcfd70029c0
|
|
| BLAKE2b-256 |
034f83341d4557f50e686fd475148b996cf12b30c242ebc32b867f7c53852eb3
|
File details
Details for the file fabricatio_novel-0.14.0-cp314-cp314-manylinux_2_34_x86_64.whl.
File metadata
- Download URL: fabricatio_novel-0.14.0-cp314-cp314-manylinux_2_34_x86_64.whl
- Upload date:
- Size: 2.6 MB
- Tags: CPython 3.14, manylinux: glibc 2.34+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via:
uv/0.12.5 {"installer":{"name":"uv","version":"0.12.5","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1fdbfd8d03c274f7c8551da3b88a897310be7cbbece6d40f363a1a8cf23ded56
|
|
| MD5 |
2e6e00d22c97a0b590d56d896d2f2783
|
|
| BLAKE2b-256 |
e54b7fc27a963dc6f5f1fdf1cf628ed6b8a4cf1b76884c32d6c39b3af5764023
|
File details
Details for the file fabricatio_novel-0.14.0-cp314-cp314-manylinux_2_34_aarch64.whl.
File metadata
- Download URL: fabricatio_novel-0.14.0-cp314-cp314-manylinux_2_34_aarch64.whl
- Upload date:
- Size: 2.3 MB
- Tags: CPython 3.14, manylinux: glibc 2.34+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via:
uv/0.12.5 {"installer":{"name":"uv","version":"0.12.5","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
26bbf81e80caf3d0967ebf1696047202f1a1116be3244dc0392e4eebd00ff47c
|
|
| MD5 |
034c8d96eab2786684741c63ce6b2cdc
|
|
| BLAKE2b-256 |
53c4133c1c024a5096282e7a60684ed8b7730ae9ba497eb4a654c0933219aa50
|
File details
Details for the file fabricatio_novel-0.14.0-cp314-cp314-macosx_11_0_arm64.whl.
File metadata
- Download URL: fabricatio_novel-0.14.0-cp314-cp314-macosx_11_0_arm64.whl
- Upload date:
- Size: 2.2 MB
- Tags: CPython 3.14, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via:
uv/0.12.5 {"installer":{"name":"uv","version":"0.12.5","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0efa3b3f9165a24e36c920b7e9e36753d1d614b3fc48a23d8764d03433b2649a
|
|
| MD5 |
7f2fc29c54074cca7776ce3e739a2a90
|
|
| BLAKE2b-256 |
d2ef7eee361792da6a4c4d0bee4612a4a2e036bec3d0fd201ea397c5b102f901
|
File details
Details for the file fabricatio_novel-0.14.0-cp313-cp313-win_amd64.whl.
File metadata
- Download URL: fabricatio_novel-0.14.0-cp313-cp313-win_amd64.whl
- Upload date:
- Size: 2.4 MB
- Tags: CPython 3.13, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via:
uv/0.12.5 {"installer":{"name":"uv","version":"0.12.5","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
da51c17f186d29e4e371d597ecbdabf82700e385e49c39a04d5a48171c5e5c4a
|
|
| MD5 |
1e66e99e4424b2c4bc5402a81b1b0172
|
|
| BLAKE2b-256 |
b8d50ca80f513b78e6556749fbff2e4e867f1bcbd9dea0b1793c6cd006d372cd
|
File details
Details for the file fabricatio_novel-0.14.0-cp313-cp313-manylinux_2_34_x86_64.whl.
File metadata
- Download URL: fabricatio_novel-0.14.0-cp313-cp313-manylinux_2_34_x86_64.whl
- Upload date:
- Size: 2.6 MB
- Tags: CPython 3.13, manylinux: glibc 2.34+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via:
uv/0.12.5 {"installer":{"name":"uv","version":"0.12.5","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b00cee2829e749752011ff02efa7d23bd2cb6d034e322fe82483fbc67b61ad3f
|
|
| MD5 |
7e2b1e6467e9dc4da26da9dcae07722f
|
|
| BLAKE2b-256 |
6df1d5412316810deaa59bf3c2a8820a7e2490bf2cd211324b63114dd9b9ddce
|
File details
Details for the file fabricatio_novel-0.14.0-cp313-cp313-manylinux_2_34_aarch64.whl.
File metadata
- Download URL: fabricatio_novel-0.14.0-cp313-cp313-manylinux_2_34_aarch64.whl
- Upload date:
- Size: 2.3 MB
- Tags: CPython 3.13, manylinux: glibc 2.34+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via:
uv/0.12.5 {"installer":{"name":"uv","version":"0.12.5","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8a7e4d73acca6684bc5318ac692a88b6fad6b7873db68bfe5e16f4a893515a03
|
|
| MD5 |
f5d259432157f3abd2d97383d481fd12
|
|
| BLAKE2b-256 |
35eed64b649c90a4c98f247ad966f760e19e0fea55e6eb8440c2be9e4f4b11f3
|
File details
Details for the file fabricatio_novel-0.14.0-cp313-cp313-macosx_11_0_arm64.whl.
File metadata
- Download URL: fabricatio_novel-0.14.0-cp313-cp313-macosx_11_0_arm64.whl
- Upload date:
- Size: 2.2 MB
- Tags: CPython 3.13, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via:
uv/0.12.5 {"installer":{"name":"uv","version":"0.12.5","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
41587f1805879b1db8bf60cc7821b16a87f665a66e77c64a2da579650c77113f
|
|
| MD5 |
8c706145a206c3ebddceacf677a62b38
|
|
| BLAKE2b-256 |
f88b120ed47eaf65dab85b2c08f0fb9dec082d6422a1af9c87e183cf189ca7a4
|
File details
Details for the file fabricatio_novel-0.14.0-cp312-cp312-win_amd64.whl.
File metadata
- Download URL: fabricatio_novel-0.14.0-cp312-cp312-win_amd64.whl
- Upload date:
- Size: 2.4 MB
- Tags: CPython 3.12, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via:
uv/0.12.5 {"installer":{"name":"uv","version":"0.12.5","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2f3a95d657a412d1ac28c14020e0e53caa380c7eeee2694458abc897e3464fd8
|
|
| MD5 |
e4901083a2780a536bfa3d8bedc184cd
|
|
| BLAKE2b-256 |
0bebc6616a2c916397c6d9f7184df8d4387b4bf1bc41a859b49d67743d478fa5
|
File details
Details for the file fabricatio_novel-0.14.0-cp312-cp312-manylinux_2_34_x86_64.whl.
File metadata
- Download URL: fabricatio_novel-0.14.0-cp312-cp312-manylinux_2_34_x86_64.whl
- Upload date:
- Size: 2.6 MB
- Tags: CPython 3.12, manylinux: glibc 2.34+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via:
uv/0.12.5 {"installer":{"name":"uv","version":"0.12.5","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
313da5927eeaa96da6c71ff0bb06da9564f52ca0f457823e8c3361b0cb9f784c
|
|
| MD5 |
a3898c1b0ede8347b249aebe48b77521
|
|
| BLAKE2b-256 |
ce482505afae263a97a470fff969b85758c61bcd5358ea4a54ef5d82660d818d
|
File details
Details for the file fabricatio_novel-0.14.0-cp312-cp312-manylinux_2_34_aarch64.whl.
File metadata
- Download URL: fabricatio_novel-0.14.0-cp312-cp312-manylinux_2_34_aarch64.whl
- Upload date:
- Size: 2.3 MB
- Tags: CPython 3.12, manylinux: glibc 2.34+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via:
uv/0.12.5 {"installer":{"name":"uv","version":"0.12.5","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3c9ccbee812ac868fa0abaf4de6791ff6005641dab86dcfeffad56eb4e598296
|
|
| MD5 |
73fa4b09ad48793ae09d45acac8da8f7
|
|
| BLAKE2b-256 |
6f8a163b049afa3c41a068218b8ab7b04a71546f0491bfec229b07e0930ee164
|
File details
Details for the file fabricatio_novel-0.14.0-cp312-cp312-macosx_11_0_arm64.whl.
File metadata
- Download URL: fabricatio_novel-0.14.0-cp312-cp312-macosx_11_0_arm64.whl
- Upload date:
- Size: 2.2 MB
- Tags: CPython 3.12, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via:
uv/0.12.5 {"installer":{"name":"uv","version":"0.12.5","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
21282cb3699c878ace45d5e5ee998386976650a67a138cf1d235f410f4606393
|
|
| MD5 |
6e82fb4f40af1b14660796d677cfeeda
|
|
| BLAKE2b-256 |
d68519e98bd5036d0d1e531d392ef8b183f7df68f05d8437cc66de16ff70fd74
|