跪拜 Guibai
← Back to the summary

AI Novel Writing Always Collapses by Chapter 30. Here's the CI/CD Fix.

Why Does AI Writing Long Novels Always Collapse by Chapter 30? A Detailed Engineering Solution

Foreword

Have you ever tried writing a novel with ChatGPT?

The first few chapters are pretty good, with vivid characters and a tight plot. But around chapter 30, you suddenly find: the protagonist's sister's name has changed, the foreshadowing planted in chapter 5 has been forgotten, the pacing has turned from a satisfying read into a monotonous log, and the face-slapping routines are all the same...

This isn't your problem, nor is it the model's problem. It's a process problem.

Over the past three months, as a programmer who has written code for 7 years, I used a CI/CD mindset to reconstruct the AI writing process, built a toolset called NovelOps, and successfully ran a 270-chapter serialized novel. This article is a complete technical summary after three months of stepping into pitfalls.

It's not empty theory; it's an engineering solution that has actually been run through.


Three Collapse Points: Why AI Fails by Chapter 30

Let's start with the problems. These three collapse points are not accidental; they are structural—you will definitely encounter them when using AI to write long-form content.

Collapse Point 1: Loss of Consistency—AI Has No "Memory"

By the time you write chapter 30, the AI has already "forgotten" the settings from chapter 3:

Why? The context window of a large language model is limited. Even if you use a model with a 128K context, you cannot cram 30 chapters × 1500 words = 45,000 words of text plus setting documents into a single conversation. When you start a new conversation to write chapter 30, the model's "memory" of the previous 29 chapters relies entirely on the summary you feed it in the prompt—and summaries inevitably lose details.

This is equivalent to a program running to its 30th cycle, and all global variables are reset—the program will certainly crash.

Collapse Point 2: Pacing Out of Control—From "Satisfying Read" to "Monotonous Log"

Why? AI doesn't understand what "pacing" is. You can tell AI to "write a satisfying chapter," and it can. But when you ask it to write 30 chapters continuously, it cannot automatically maintain a cross-chapter "pacing curve." Pacing is a set of quantifiable indicators—tension-release ratio, consecutive chapters of suppression, payoff density, temperature level—AI doesn't consider these cross-chapter metrics when writing a single chapter.

AI writing without pacing planning is like a performance without a metronome—the first few bars are okay, but it gets messier later on.

Collapse Point 3: Repetitive Tropes—AI's "Narrative Shape" Solidifies

Why? Large language models have "narrative inertia." When generating content, the model tends to repeat the patterns it has seen most often in its training data. After writing a lot, these templates are continuously reinforced within the context, causing subsequent generations to become more and more similar.

This isn't a problem of "writing poorly"; it's a problem of "narrative shape solidification." What's needed is conscious planned disruption.

The Commonality of the Three Collapse Points

They are all "cross-chapter" problems, not "single-chapter" problems. AI writes a single chapter fine, but collapses when writing multiple chapters.

This is a classic engineering problem, not a model capability problem. A worker can make a part fine for one day, but if you ask them to make parts for 100 days without introducing quality inspection processes, standard specifications, and state tracking, the part on day 30 will definitely be different from the one on day 1.


Five Core Technologies: Reconstructing the Writing Process with a CI/CD Mindset

I come from a programming background, having written code for 7 years. When I realized the collapse points of AI long-form writing are highly similar to classic problems in software engineering, I realized the same methodology could be used to solve them:

Software Engineering Problem AI Writing Corresponding Problem Solution
Inconsistent code quality Inconsistent chapter quality CI/CD pipeline + quality gates
State loss Consistency loss State persistence (state tracks)
Code duplication Trope repetition Code review + refactoring mechanism
Insufficient test coverage Pacing/payoff not quantifiable Quantitative metrics + automatic detection
Deployment not rollback-able Chapters not traceable Version management + state snapshots

So I spent 3 months building NovelOps—reconstructing the web novel creation process using the idea of a CI/CD pipeline.

Global Planning (7 steps) → G1 State Loading → THINK (Chapter Conception) → DRAFT (Text Generation) → G2-G7 (6 Quality Gates) → REVISE (Return for Rewrite) ↻ G8 (Human Confirmation) → State Update (15 tracks)
↑ Loop per chapter, until chapter 270 ↑

Technology 1: 8-Level Quality Gates

Every chapter must pass 8 "security checks" after being written. Failure at any level sends it back for a rewrite. This borrows the CI/CD "fail fast" principle—the earlier a problem is found, the lower the cost to fix it.

Gate Name Check Content If Failed
G1 State Loading Are 15 state tracks fully loaded? Block writing, fix state file
G2 Input Validation Are the outline, character card, and pacing card complete? Complete missing inputs
G3 Outline Alignment Does the chapter content match the outline? Return for rewrite, with deviation notes
G4 Character Consistency Are Soul Field iron rules violated? Return for rewrite, mark violations
G5 Pacing Check Do the tension-release ratio and temperature level meet standards? Return for revision, with correction suggestions
G6 Anti-AI-Flavor Detection Sentence pattern repetition rate, vocabulary diversity, etc. Return for revision, mark exceeding items
G7 Foreshadowing Management New foreshadowing / pay off old foreshadowing Update foreshadowing register
G8 Human Confirmation Author's final review Pass → Update state / Reject → Return

Technology 2: 15 Dynamic State Tracks

The core solution to "consistency loss." The 15 state tracks are equivalent to 15 database tables, automatically updated after each chapter is written and automatically loaded when writing the next chapter.

Core state tracks include:

# State update process after each chapter is written
chapter_30.write()        # AI generates text
state_tracks.update(chapter_30)  # Automatically extract state changes
# 15 tracks update automatically
character_state.update()   # Character A changes from "angry" to "calm"
foreshadow.register()      # Register new foreshadowing #037, planned payoff in chapter 45

# When writing chapter 31
context = state_tracks.load(chapters_1_to_30)  # Load all states
chapter_31 = AI.generate(prompt + context)     # Write with complete "memory"

This is like giving AI an "external memory." It's like a program querying data from a database at runtime, rather than loading the entire database into memory.

Technology 3: Quantitative Anti-AI-Flavor Detection

"AI flavor" is not mysticism; it is quantifiable. I wrote a metrics.py script that automatically detects 6 indicators:

Indicator Threshold Consequence of Exceeding
Sentence Pattern Repetition Rate ≤3 times G6 interception
Vocabulary Diversity (TTR) ≥0.45 G6 interception
AI High-Frequency Word Density ≤5 times/1000 words G6 interception
Paragraph Length Variance ≥80 G6 interception
Dialogue Proportion 30%-60% Warning if out of range
Emotional Word Density ≤8 times/1000 words G6 interception

"De-AI-flavoring" is not a subjective judgment; it's a set of objective indicators. Turn "de-AI-flavoring" from mysticism into engineering.

Technology 4: 270-Chapter Pacing Planning Card

Before writing the main text, first generate a chapter-by-chapter pacing annotation for all 270 chapters. When writing the main text, feed the current chapter's pacing annotation as a constraint to the AI:

Chapters 01-10:  Tension Tension Release Tension Tension Release Tension Tension Release Explosion
Rule: 1 small payoff (Release) every 3 chapters, 1 big explosion (Explosion) every 10 chapters
Suppression does not exceed 2 consecutive chapters

Temperature Levels: Cold (10-15%) / Warm (20-25%) / Hot (30-35%) / Explosion (15-20%) / Extreme Explosion (5-10%)

Iron Rule: No more than 5 consecutive chapters at the same temperature level; a cold chapter must be followed by a hot chapter.

Technology 5: Creative Disruption Mechanism

The core solution to "trope repetition." It's not random injection, but planned disruption—consciously breaking the AI's narrative inertia while ensuring the outline direction remains unchanged.

Trigger Conditions: 8 types, including scene repetition, hook repetition, emotional curve repetition, villain reaction repetition, etc.

Disruption Actions: Perspective switch, unexpected insertion, time jump, information reversal, emotional mismatch, form variation

AI's narrative inertia is "inertia," not "error." Tropes are tropes because they work. What you need to do is inject variation at the moment tropes solidify, so readers always have the freshness of "not guessing the next step."


Final Results

Using this system, a 270-chapter workplace strong-female-lead novel was run through:

Dimension Data
Outline 270 chapters / 9 volumes
Characters 22 characters (including Soul Field iron rules)
Foreshadowing 37 items (all registered and managed)
Pacing Card 270 chapters annotated chapter-by-chapter
State Tracks 15 tracks updated automatically
Quality Gates 8 levels (G1-G7 automatic + G8 human)

270 chapters, no collapse. Consistent characters, paid-off foreshadowing, controlled pacing, non-repetitive tropes. Not because a stronger model was used, but because a more robust process was used.


Summary

The core challenge of AI long-form writing is not "making AI write better," but "making AI maintain the same quality standard in chapter 30 as in chapter 1." This requires not a stronger model, but a more robust process.

The five core technologies each borrow mature methodologies from software engineering:

  1. 8-Level Quality Gates ← CI/CD Pipeline
  2. 15 Dynamic State Tracks ← State Persistence
  3. Quantitative Anti-AI-Flavor Detection ← Automated Testing
  4. 270-Chapter Pacing Planning Card ← Project Planning
  5. Creative Disruption Mechanism ← Code Refactoring

The tool is completely open-source and free. If you are also writing novels with AI and stuck at the "30-chapter collapse" bottleneck, you can give it a try.


Next Steps

This article is an overview. Next, I will break down the detailed design of each technical module one by one. If you are interested, you can follow for subsequent updates.

Feel free to discuss any questions in the comments, and I will reply to each one.


This article is the first in the "AI Writing Engineering" series, totaling 11 articles. If you found it helpful, please give it a like.

Comments

Top 2 of 4 from juejin.cn, machine-translated. The original thread is authoritative.

gelory

Can you share the link?

fulton

https://github.com/fuxiangxu/novel-ops

星河微尘

Is it open source?

fulton

https://github.com/fuxiangxu/novel-ops