diff --git a/templates/chapter_production.yml b/templates/chapter_production.yml index 063e2289..16120806 100644 --- a/templates/chapter_production.yml +++ b/templates/chapter_production.yml @@ -108,25 +108,6 @@ steps: task_type: "book_chapter" content: "{chapter_dispatch_message}" - # If COMPLETE, dispatch project_index to compile the manuscript and signal book done - - type: think - max_tokens: 50 - output_key: index_dispatch_message - hint: | - Read production_status above. - If production_status is COMPLETE, output exactly: - Compile the manuscript index for {project.name}. All chapters are polished and complete. - If production_status is NEEDS_CHAPTER, output exactly: none - - - type: tool - action: enqueue_strategy - optional: true - params: - company_slug: "crimson_leaf_publishing" - project_slug: "{project.slug}" - task_type: "project_index" - content: "{index_dispatch_message}" - - type: reply target: channel channel_name: "crimson_leaf_publishing:live-feed" diff --git a/templates/project_index.yml b/templates/project_index.yml index 19d23345..c647a50e 100644 --- a/templates/project_index.yml +++ b/templates/project_index.yml @@ -74,8 +74,61 @@ steps: - type: document filename: "MANUSCRIPT-README" - # Sprint 81 Loop 2: when a book is complete, automatically dispatch a marketing campaign - # to Crimson Leaf Marketing. optional: true so that if dispatch fails, the book is still done. + # Guard: only dispatch CLM marketing if this project_index was triggered as a genuine + # book-complete event. If the task message is "none", generic, or empty (e.g. from + # chapter_production running mid-book), skip the dispatch. + - type: think + max_tokens: 50 + output_key: clm_dispatch_gate + hint: | + Read the task message above (the original message this task was given). + If the message is blank, "none", or a generic system message (e.g. "Compile the manuscript + index", "Pulse-check", "Project review"), output exactly: skip + If the message contains a real book title, author, genre, and/or an explicit marketing + request, output exactly: dispatch + Output ONLY one word: skip or dispatch + + # Assemble the final CLM dispatch content. If gate is "skip", outputs "none" so the + # server-side handler finds no real payload and returns gracefully (optional: true). + - type: think + max_tokens: 600 + output_key: clm_dispatch_content + hint: | + The dispatch gate is: {clm_dispatch_gate} + + If the gate is "skip", output exactly: none + + If the gate is "dispatch", write the full marketing campaign request: + + MARKETING CAMPAIGN REQUEST -- {project.name} + + The manuscript for "{project.name}" is complete and ready for marketing. + + BOOK DETAILS: + Title: {project.name} + Genre: {genre_name} + Audience: {genre_audience} + Author: {lead_author} + Company: Crimson Leaf Publishing + + The MANUSCRIPT-README is available in the Crimson Leaf Publishing Gitea repository + under the {project.name} project deliverables. It contains the full reading order, + chapter summaries, continuity chain, and editorial verdict. + + Please launch a full marketing campaign including: + - Campaign strategy (target platforms, timeline, budget allocation) + - Social media content pack (TikTok, Instagram, Facebook) + - Email campaign (reader list announcement) + - Press release (book announcement) + - Ad copy (platform-specific variations) + - Author bio update + + MISSION: Get this book discovered by its audience and generate revenue for Crimson Leaf. + + Output ONLY the content text above (or "none" if gate is skip). + + # Sprint 81 Loop 2: dispatch marketing only when clm_dispatch_content is a real brief. + # optional: true -- if content is "none" the handler returns gracefully. - type: tool action: enqueue_strategy optional: true @@ -83,31 +136,7 @@ steps: company_slug: "crimson_leaf_marketing" project_slug: "book-marketing-agency" task_type: "marketing_campaign" - content: | - MARKETING CAMPAIGN REQUEST -- {project.name} - - The manuscript for "{project.name}" is complete and ready for marketing. - - BOOK DETAILS: - Title: {project.name} - Genre: {genre_name} - Audience: {genre_audience} - Author: {lead_author} - Company: Crimson Leaf Publishing - - The MANUSCRIPT-README is available in the Crimson Leaf Publishing Gitea repository - under the {project.name} project deliverables. It contains the full reading order, - chapter summaries, continuity chain, and editorial verdict. - - Please launch a full marketing campaign including: - - Campaign strategy (target platforms, timeline, budget allocation) - - Social media content pack (TikTok, Instagram, Facebook) - - Email campaign (reader list announcement) - - Press release (book announcement) - - Ad copy (platform-specific variations) - - Author bio update - - MISSION: Get this book discovered by its audience and generate revenue for Crimson Leaf. + content: "{clm_dispatch_content}" - type: close rag_update: true