name: book_chapter description: "Write one chapter — continuity check, draft, deepen, then spawn editorial review." debug: true system: agent_prompt requires: - genre_name - genre_audience - prose_style - chapter_target_words - chapter_ref skills: - guides/YAFictionGuide.md - guides/RomanceFictionGuide.md - guides/SciFiFictionGuide.md agent_prompt: - "= identity.md" - "agent.rag.json" sections: - agent - project - rag - skills - deliverables - message - rejection_feedback - instructions steps: - type: think hint: | PASS 0 — BIBLE & CONTINUITY PLAN (produce a PLAN only — do NOT write chapter prose yet) GENRE: {genre_name} | AUDIENCE: {genre_audience} PROSE STYLE GUIDE: {prose_style} TARGET CHAPTER LENGTH: ~{chapter_target_words} words CONTINUITY GUARDRAILS: - Use ONLY the outline / character bible and the immediately previous chapter for continuity. - Ignore future chapters, editorial reviews, roundtables, polish drafts, and any non-chapter artifacts. - Never pull facts from a deliverable whose filename indicates a later chapter than {chapter_ref}. ⚠️ CRITICAL: Your task name tells you EXACTLY which chapter to write. Look at the CURRENT MESSAGE — write THAT chapter and ONLY that chapter. Do NOT write Chapter 1 unless the message explicitly says "Chapter 1". STEP 1 — READ THE OUTLINE / CHARACTER BIBLE: Look at PROJECT DELIVERABLES for the outline file (it contains the Character Bible if this is a fiction project, and the Chapter Outline for all projects). Extract and record: - Protagonist: exact name, voice description, age (if fiction) - Love interest and supporting characters: exact names and roles (if fiction) - World rules / constraints (if paranormal or speculative) - This chapter's summary, emotional beat, and closing hook from the outline If no outline/bible is available, use the character names and project details from the task description above — be CONSISTENT throughout the book. STEP 2 — FIND THE PREVIOUS CHAPTER: Look at PROJECT DELIVERABLES for the chapter that comes BEFORE this one. If no previous chapter exists (this IS Chapter 1), skip to STEP 4. STEP 3 — QUOTE THE ENDING: Copy the LAST 2–3 sentences of the previous chapter here, word for word. Label them: "PREVIOUS CHAPTER ENDED WITH: ..." Your new chapter MUST pick up from this exact moment. STEP 4 — CHAPTER PLAN: State your plan — do NOT write prose yet: - CHAPTER: Exact chapter number and title (from the task message) - POV CHARACTER: Whose perspective are we in? - FIRST LINE: The exact opening sentence, continuing from the previous ending - EMOTIONAL ARC: What does the protagonist feel at start vs end? - CHAPTER GOAL: What plot event MUST happen here? - KEY BEATS: 3–5 numbered scene beats that will form the chapter - CLOSING HOOK: Exact last image or line that makes readers continue Stop here. Output ONLY the plan above. The full chapter will be written next. - type: think model: power hint: | PASS 1 — WRITE THE FULL CHAPTER Using the plan from your previous step, write the complete chapter now. Requirements: - Start with the FIRST LINE you planned — make it continue naturally from the previous chapter - Follow the KEY BEATS in order, but write with full scene depth — don't skip - All character names must be consistent with the bible/outline - Every dialogue exchange must be tight and voice-distinct - Show, don't tell — externalize emotion through action, detail, and dialogue - Every scene beat moves the story forward OR reveals character (no filler) - End with the CLOSING HOOK you planned - Match the prose style guide: {prose_style} - Target length: {chapter_target_words} words — write the FULL chapter, not a summary - ⚠️ DO NOT stop early. If you have not reached {chapter_target_words} words, continue writing — add interiority, sensory detail, extended dialogue beats, and scene transitions until you hit the target. Short chapters will be REJECTED in adjudication. Output ONLY the polished chapter text. Start directly with the chapter title (e.g., "Chapter N: [Title]") and opening line. No commentary, no plan headers, no "Pass 1" label. - type: document filename: "chapter-{chapter_ref}" - type: package hint: | The chapter has been written and committed. CRITICAL — include the `chapter_text` field: Copy the COMPLETE chapter text you just wrote into the `chapter_text` field. Reviewers have NO other way to access the chapter content. Do NOT summarize or truncate it — include every word of the final chapter. Now spawn the three independent editorial reviewers and the roundtable debate. Use the exact task_names shown — the roundtable depends_on all three. schema: chapter_text: string spawn: - task_type: chapter_review task_name: "Review (Devon): {chapter_ref}" agent_name: Devon priority: 6 context: chapter_text: "{chapter_text}" review_focus: developmental genre_name: "{genre_name}" genre_audience: "{genre_audience}" chapter_ref: "{chapter_ref}" - task_type: chapter_review task_name: "Review (Lane): {chapter_ref}" agent_name: Lane priority: 6 context: chapter_text: "{chapter_text}" review_focus: line genre_name: "{genre_name}" genre_audience: "{genre_audience}" chapter_ref: "{chapter_ref}" - task_type: chapter_review task_name: "Review (Cora): {chapter_ref}" agent_name: Cora priority: 6 context: chapter_text: "{chapter_text}" review_focus: continuity genre_name: "{genre_name}" genre_audience: "{genre_audience}" chapter_ref: "{chapter_ref}" - task_type: chapter_roundtable task_name: "Roundtable: {chapter_ref}" agents: - Devon - Lane - Cora priority: 7 context: chapter_text: "{chapter_text}" genre_name: "{genre_name}" genre_audience: "{genre_audience}" chapter_ref: "{chapter_ref}" depends_on: - "Review (Devon): {chapter_ref}" - "Review (Lane): {chapter_ref}" - "Review (Cora): {chapter_ref}" - type: close rag_update: true adjudication: enabled: true pass_threshold: 80 deliverable_type: consumer criteria: word_count: weight: 30 description: "Chapter meets the {chapter_target_words}-word minimum; under-length chapters fail" narrative_flow: weight: 25 description: "Story progresses naturally with good pacing" character_voice: weight: 20 description: "Characters are distinct and consistent" prose_quality: weight: 15 description: "Writing is polished and engaging" continuity: weight: 10 description: "Consistent with prior chapters and canon"