fix: stop chapter_production from dispatching project_index mid-book

- Remove project_index dispatch from chapter_production.yml entirely.
  chapter_production should ONLY dispatch book_chapter. The project_index
  dispatch belongs to book_editorial (which already handles it correctly).
  This was the root cause of the CLM hallucination cascade:
    pulse_check -> project_review -> chapter_production -> project_index -> marketing_campaign (infinite loop)

- Add clm_dispatch_gate guard in project_index.yml. project_index now checks
  whether its task message is a real book-complete signal or a generic/none
  message. If gate is 'skip', clm_dispatch_content is 'none' and the enqueue
  call returns gracefully (optional: true). Only fires when triggered by
  book_editorial with a legitimate completion message.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
David Baity
2026-04-28 20:02:41 -04:00
parent f023926944
commit 1bff66b674
2 changed files with 56 additions and 46 deletions

View File

@@ -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"