Files
crimson_leaf_publishing/templates/project_index.yml
David Baity 1bff66b674 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>
2026-04-28 20:04:24 -04:00

158 lines
5.2 KiB
YAML

name: project_index
description: "Compiles a master MANUSCRIPT-README.md index of all project deliverables, revisions, and publication status."
debug: true
system: agent_prompt
agent_prompt:
- "= identity.md"
sections:
- agent
- project
- deliverables
- message
- instructions
steps:
- type: think
hint: |
You are {agent.name}. Compile a comprehensive MANUSCRIPT-README.md for this project.
Look at the PROJECT DELIVERABLES section above -- it lists every file committed during this project.
Write a well-structured README that includes:
## [Book Title] -- Book 1
**[Company Name] | Author: [Lead Author] | Creative Director: [Creative Director]**
> [Opening hook line from Chapter 1]
Brief pitch (2-3 sentences about the project's concept, genre, and target audience).
---
## Publication Status
[Based on the editorial report in deliverables -- GO / NO-GO verdict, score if available, date]
---
## Reading Order
A table with columns: Chapter Number | Chapter Title | POV | File
(Pull from the final-chapter-*.md files in deliverables)
---
## Chapter Continuity Chain
A table showing how each chapter connects to the next:
Transition | Previous chapter ends... | Next chapter opens...
(Pull quotes from the actual chapter files)
---
## Revisions Applied
If any revise-*.md files exist in deliverables, list them with what was revised.
---
## Research & Planning Documents
List all non-chapter deliverables (outline, trend report, editorial report, launch strategy, etc.)
---
## Team
A table of agents, roles, and contributions based on the project context.
---
## Iteration History
If earlier draft files exist (write-chapter-*, rewrite-chapter-*, etc.), note them briefly.
---
*Generated by [Company Name] AI team | PAE Multi-Agent System*
- type: document
filename: "MANUSCRIPT-README"
# 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
params:
company_slug: "crimson_leaf_marketing"
project_slug: "book-marketing-agency"
task_type: "marketing_campaign"
content: "{clm_dispatch_content}"
- type: close
rag_update: true
adjudication:
enabled: true
pass_threshold: 65
deliverable_type: coordination
criteria:
completeness:
weight: 45
description: "All project deliverables are catalogued"
accuracy:
weight: 35
description: "Details about deliverables and team are correct"
structure:
weight: 20
description: "Index is well-organized and navigable"