Logo
How I Write Books with AI — Six Volumes for Grandma

How I Write Books with AI — Six Volumes for Grandma

Photo by betül nur akyürek: Pexels

In my previous post, I ended with: "Stay tuned, I have a feeling this is not where the story ends..."

I was right.


A few months later, Grandma ran out of books. Crime thrillers — too dark. Romances — too shallow. Family sagas, Polish, spanning generations, set in historical periods — that's her jam.

And then a thought occurred to me that sounds completely normal to any engineer, but would seem absurd to everyone else: if the TTS pipeline already works... why not have AI write new books instead of converting existing ones into audiobooks?

This is how "The Dębicki Dynasty" was born — a family saga in six volumes. Polish setting, 19th and 20th centuries, multiple generations, over a hundred years of history. Generated by AI, read aloud in my cloned voice, delivered to Grandma as audiobooks.


Why One Model Isn't Enough

You might think this was simple. Intuition says: give Claude a prompt "write a family saga, 6 volumes", and you're done.

That's not how it works. A book's plot is more than just text. Here, themes interweave and characters don't suddenly "resurrect" because the model forgot they were already killed. For a model, writing a letter or a short essay is trivial — but writing a 6-volume saga is a different beast entirely.

The context window has its limits, but that's not the only problem. Even if the model could "see" the entire book at once — the quality of text generated from a single, hours-long prompt is uneven. The first chapters are usually excellent. Then the model starts losing threads, repeating phrases, losing character consistency. And with six volumes — that's a recipe for chaos.

So I approached it like an engineer. The solution: multiple specialized agents, each with one clearly defined task.

The entire book project starts with an idea. I have to come up with the plot and story outline (now the whole family does). It's a raw sketch of the story. A few paragraphs: what's it about, who's the main character, what era, what atmosphere. Something you could write on a napkin over lunch.

In addition to the outline (outline.md), I have the book's style defined in a separate file (style.md). For Grandma's books, I don't change this file. But if my Aunt, a mystery lover, comes along — I can easily change the agent's writing style.

rules.md and style.md — these are shared files that I write once and use for all sagas. The narrative rules and style guide are common, where I establish guidelines for book generation (e.g., vary sentence length, write dates in words). This way, regardless of style, the book "sounds" natural.

AI Creates the Plot

Next, I run /new-series — a Claude Code command that takes that outline and generates a complete set of files for the entire saga. For each volume separately:

  • book.md — full specification: title, author, genre, era, locations, character descriptions with ages at the beginning and end of the volume, detailed plot summary, style and tone notes. And a separate section: References to Previous Volumes — a list of themes, characters, and symbols that should return. The planning agent deliberately inserts these bridges between volumes.
  • outline.md — chapter-by-chapter outline: when, where, what happens, what's the emotional arc of the scene, how it connects to the volume's arc.

This agent — let's call it the Architect — thinks about the saga as a whole. It doesn't write prose, doesn't review. It only plans the narrative arc, divides the story into volumes, designs characters and bridges between them.

And regular Claude does this well. Better than I'd do it manually in reasonable time. No need for expensive models or complicated solutions. Though I'm honestly thinking about putting Sonnet to work on this.

This is the planning phase.

Three Agents in a Loop, Chapter After Chapter

The entire pipeline from idea to audiobook looks like this:

📝 PHASE 1: Planning

Story outline (file with the idea)

[Architect] — generates book.md + outline.md for each volume

🔄 PHASE 2: Writing Loop (per volume, chapter by chapter)

Context: rules.md + book.md + style.md + outline.md + previous chapter summary + continuity from previous volume

1️⃣ [Writer] — generates chapter N

2️⃣ [Reviewer] — validates: PASS ✓ or FAIL ✗

→ if FAIL: Writer writes again (max 2 attempts)

3️⃣ [Summarizer] — summarizes chapter in ~200 words

→ summary = context for chapter N+1

⏰ Loop repeats for each chapter

After volume completion:

[Archivist] — creates tome_summary_tN.md (full volume summary for context in volume N+1)

⚙️ PHASE 3: Production

Markdown → EPUB → TTS (Text-to-Speech) → Audiobook

💡 Key idea: Each agent has one job. Recurring summaries connect chapters. The pipeline never blocks — if something fails, we log a warning and move on.

The Archivist Agent is the guardian of continuity between volumes. After all chapters in a volume are generated, it reads the entire content and creates a document tome_summary_tN.md. This file records: who's alive, who's dead, the state of relationships between characters, key plot twists, open plot threads, important objects and places. This isn't a summary for readers — it's a technical document for AI. Precise, without flourishes. When the Writer starts volume N+1, it gets this file as part of the context. Thanks to this, characters don't "resurrect", names stay consistent, and threads close properly.

The Writer Agent receives complete context: narrative rules, book specification, style guide, the chapter outline from the outline file, and the summary of the previous chapter. Its only job: write one chapter. Nothing more.

The Reviewer Agent doesn't see prompts or rules. It only sees the finished text and one question: does the chapter have hallucinations, narrative continuity problems, placeholders, unacceptable quality? It answers PASS or FAIL with a brief justification.

If FAIL — the text goes back to the Writer along with feedback. Maximum two attempts. If after three tries it's still FAIL — we save the last version with a warning and move on. The pipeline doesn't get stuck indefinitely.

The Summarizer Agent summarizes the just-generated chapter. This summary becomes context for the next Writer call. Thanks to this, each chapter "knows" what happened before — without loading the entire text into the context window.


Why the Reviewer is a Separate Agent

Because Writer and Reviewer have different tasks — and different tendencies.

A model that just generated text will have a natural bias toward rating it positively. A separate agent with a different prompt, focused only on verification, catches things the Writer overlooks: missing headers, chapters that are too short, placeholders like [insert name], meta-comments in the text (Chapter written — 1247 words).

Besides — separating these roles is a classic engineering principle: one component, one scope of responsibility. Easier to debug, easier to improve.


Continuity Between Volumes

Six volumes means six separate generation processes. Without an additional mechanism — volume II wouldn't know anything about events in volume I. Characters who died could suddenly come back to life. Names could change between volumes. Open threads would never return.

The solution: volume summary.

After generating each volume, a separate agent reads the entire content and creates a file tome_summary_tN.md — detailed summary: who's alive, who's dead, the state of relationships between main characters, key plot twists, open plot threads, important objects and places. This file becomes context for the Writer during the next volume's generation.

The prompt for creating this summary is very specific: "this is a working document for the AI generating the next volume, not a summary for readers". The difference matters. The agent should write precisely and technically — not literarily.


Prompt Engineering That Actually Makes a Difference

It's not enough to tell a model "write a chapter". Quality drastically improves when the Writer gets four context files:

rules.md — meta narrative rules. What's allowed, what's not, how to write dialogue, how long paragraphs should be, what to avoid — clichés, anachronisms, anglicisms. For each saga this file is different.

book.md — specification of the specific book: title, author, main characters, historical era, tone, number of chapters, key plot threads.

style.md — style guide: pacing of narration, ratio of dialogue to description, characteristic features of individual characters' speech.

outline.md — chapter-by-chapter outline: what should happen, which characters appear, what's the emotional arc of the scene.

Without rules.md the model wrote dialogue in modern style for 19th century characters. Without outline.md chapters had random structure and important threads got lost. Each file eliminates a different class of errors.


From Text to Audiobook and... Ebook

When all chapters pass validation — the rest happens automatically:

  1. Markdown chapters → chapters.json
  2. chapters.json → EPUB with cover art generated programmatically for each volume
  3. EPUB → TTS pipeline from previous posts

Each volume has unique cover colors matched to the mood of that part of the saga. Volume I "Wind from the East" — deep navy with gold. Volume VI "Dawn" — azure with bright accents. A detail Grandma probably won't notice in audiobook form — but I did it properly.

The pipeline runs unattended. I start it in the evening, by morning I have the next volume. And since it has built-in checkpoints — I can pause at any time and resume exactly where I left off.

Plus, I get both ebook and audiobook — 2 for 1.


What Grandma Says

She listens.

First volume was a test, I didn't tell her the entire book was written by multiple agents, only for her. She called and asked if volume II was ready yet.

It was.

I told her the truth about who writes her books. She saw no difference between Sienkiewicz and Henry ModrzAIjewski. That was proof the algorithm works.

Now I'm uploading entire series to her, and family and friends have fun coming up with new plots.


Key Takeaways

  • One agent isn't enough. Writer, reviewer, summarizer — each with clearly separated tasks does the job better than one agent trying to do everything.
  • Narrative continuity requires engineering. Chapter and volume summaries aren't a nice add-on — they're essential for any multi-part story.
  • Validation before review. Empty file, missing header, placeholder — catch them structurally before running the expensive agent.
  • Prompt engineering is half the battle. rules.md + book.md + style.md + outline.md make a huge difference in text quality.

And this opened the door for me to build my own system for writing and reading audiobooks for Grandma.