From 3a0f1253c7d6db515ebf1fc603bcc53a69ac096f Mon Sep 17 00:00:00 2001 From: Nova_2761 Date: Sat, 18 Apr 2026 00:31:44 +0000 Subject: [PATCH] Fix chapter_production: use correct polished file pattern (staging/polished/chapter-ch-XX.md) --- templates/chapter_production.yml | 188 ++++++++++++++++--------------- 1 file changed, 98 insertions(+), 90 deletions(-) diff --git a/templates/chapter_production.yml b/templates/chapter_production.yml index d0870519..defaee3d 100644 --- a/templates/chapter_production.yml +++ b/templates/chapter_production.yml @@ -1,90 +1,98 @@ -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 +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. + + STEP 1 -- Count completed (polished) chapters: + Look for files matching the pattern: staging/polished/chapter-ch-XX.md + Count how many such files exist (ch-01, ch-02, etc.) + These are the chapters that have been fully written AND polished. + + STEP 2 -- Count in-progress (drafted) chapters: + Look for any staging files that suggest a chapter has been drafted but not polished. + Examples: review files, roundtable files, or draft files for a given chapter ref. + + STEP 3 -- Determine next chapter: + The next chapter to write is the first chapter that has NO draft files at all. + - If polished: ch-01 through ch-04 and draft evidence for ch-05: next is ch-06 + - If polished: ch-01 and draft evidence for ch-02: next is ch-03 + - If nothing exists for any chapter: next is ch-01 + + Also check the BOOK OUTLINE if available above for chapter titles and total count. + If all chapters exist in some form up to the outline limit: 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: + POLISHED_COUNT: + DRAFTED_COUNT: + + - 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 \ No newline at end of file