name: chapter_production description: "CLP self-driving chapter dispatch -- checks project pipeline status and spawns the next unwritten chapter." debug: true model: power system: agent_prompt agent_prompt: - "= identity.md" sections: - agent - project - deliverables - rag - message - instructions steps: - type: tool action: git_read_file optional: true output_key: book_outline_text params: path: "outline.md" - type: think max_tokens: 2000 output_key: next_chapter_decision hint: | You are {agent.name}, production manager for {project.name}. Review the DELIVERABLES section above. Count the final-chapter-*.md files. These are the chapters that have been fully completed (written + polished + approved). Also check the BOOK OUTLINE if available above. Determine which chapter needs to be written NEXT: - If no chapters exist: ch-01 - If ch-01 exists but ch-02 does not: ch-02 - Continue this pattern up to the chapter_target_words limit - If all chapters are complete: the book is DONE Output: STATUS: NEEDS_CHAPTER or COMPLETE NEXT_CHAPTER: ch-01 (or ch-02, etc., or N/A if COMPLETE) CHAPTER_TITLE: - type: think max_tokens: 100 output_key: production_status hint: | Read the STATUS line from the chapter production decision above. Output EXACTLY one of these values, nothing else: - NEEDS_CHAPTER - COMPLETE - type: think max_tokens: 400 output_key: chapter_dispatch_message hint: | Read the next chapter decision above. If STATUS is COMPLETE: output exactly: none If STATUS is NEEDS_CHAPTER, write a chapter dispatch message for Iris (lead author). Include: - Book: {project.name} ({genre_name}) - Chapter to write: the NEXT_CHAPTER value from the decision - Chapter title: the CHAPTER_TITLE value - Characters: {character_profiles} - Word count target: {chapter_target_words} words - Instruction: check the most recent polished chapter for continuity, then write this chapter following the outline Output ONLY the dispatch message. No preamble. - type: tool action: enqueue_strategy optional: true params: company_slug: "crimson_leaf_publishing" project_slug: "{project.slug}" task_type: "book_chapter" content: "{chapter_dispatch_message}" - type: reply target: discussion adjudication: enabled: false