---
name: draft-chapter
title: Build a chapter's prose from its beats
description: Use when a chapter's beats are in place and the author wants the prose written — estimating the cost, building the whole chapter in one pass, and polling for completion. This is the generation step; it debits credits.
version: 1.0.0
requires_tools: [series_get, book_timeline, bible_doc_attach, credits_estimate, build_chapter, build_state]
related: [start-new-series, revise-and-polish]
---

# Draft a chapter

Generation is **beat-grain**: `build_chapter` writes an entire chapter from its beats in one pass (planning each beat, then rendering prose from the beats, entity bible and voice profile). There is no separate spec/prose/editorial step to trigger.

## Prerequisites
- A chapter whose beats carry real content (not just titles). Read the current shape with `book_timeline` — it lists every beat compactly; that list is complete, not a sample.
- A set voice/story profile improves output more than model choice. Check via `series_get`; flag a null profile to the author.
- **There is no steering parameter.** To change output, change structure — edit beats / notes / voice / attached ref docs, then rebuild. Never expect a free-text "instructions" field.

## Steps
1. **Resolve the series and read the chapter.** `series_get`, then `book_timeline` to confirm the beats are ready.
2. **Attach any reference docs** the chapter should draw on: `bible_doc_attach`. A ref doc only reaches generation if attached to the chapter.
3. **Estimate the cost.** `credits_estimate` with `operation: "build_chapter"` and the chapter id. If it returns `free_first_chapter: true`, the first chapter is on the house — tell the author, offer to build it, and do not quote a price. Never decide on your own that a build is free; let the tool be the source of truth.
4. **Confirm, then build.** With the author's go-ahead, call `build_chapter`. It returns immediately with a `run_id` — do **not** wait inline; a build commonly exceeds the function time limit.
5. **Poll.** Check `build_state` on your own cadence until it completes, then tell the author it's ready.

## Credits
`build_chapter` debits credits (unless the first-chapter freebie applies). Always `credits_estimate` first when unsure, and surface the number before spending.

## Done when
`build_state` reports the build complete and the chapter has rendered prose. If `build_chapter` returns a `not_ready` error, relay its `notes` and help the author flesh out the thin beats rather than retrying.
