fix: template prompt bloat and variable substitution failures

- chapter_polish: remove sections:deliverables — chapter text already in
  {chapter_text}; this caused 150KB+ prompts for late chapters (40MB logs)
- chapter_roundtable: require structured CONSENSUS REACHED block so
  key_changes is always formatted as an extractable string; change
  key_changes schema from list to string to match
- book_chapter: remove sections:history to reduce context; restructure
  Pass 0 to plan-only (no prose output) so the chapter is only written
  once in Pass 1 instead of twice; add explicit instruction in package
  hint to copy full chapter_text into spawn context
- short_story: remove sections:history and sections:deliverables (standalone
  task, needs neither); restructure Pass 0 to plan-only, Pass 1 to write;
  add note to handle literal {genre_name} placeholders gracefully
- recipe_develop, ai_article_write, blog_write: remove sections:history
  (these standalone tasks do not need full project conversation history;
  deliverables kept so they can read the research/plan file)

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
David Baity
2026-03-12 09:05:45 -04:00
parent 5c1b1846fb
commit 4c9222960d
7 changed files with 57 additions and 53 deletions

View File

@@ -17,7 +17,6 @@ agent_prompt:
sections:
- agent
- project
- history
- rag
- deliverables
- message
@@ -27,7 +26,7 @@ sections:
steps:
- type: think
hint: |
PASS 0 — BIBLE & CONTINUITY CHECK (do this FIRST, before drafting)
PASS 0 — BIBLE & CONTINUITY PLAN (produce a PLAN only — do NOT write chapter prose yet)
GENRE: {genre_name} | AUDIENCE: {genre_audience}
PROSE STYLE GUIDE: {prose_style}
@@ -57,44 +56,53 @@ steps:
Label them: "PREVIOUS CHAPTER ENDED WITH: ..."
Your new chapter MUST pick up from this exact moment.
STEP 4 — PLAN YOUR CHAPTER:
State your plan:
STEP 4 — CHAPTER PLAN:
State your plan — do NOT write prose yet:
- CHAPTER: Exact chapter number and title (from the task message)
- POV CHARACTER: Whose perspective are we in?
- FIRST LINE: How does this chapter begin, continuing from the previous ending?
- FIRST LINE: The exact opening sentence, continuing from the previous ending
- EMOTIONAL ARC: What does the protagonist feel at start vs end?
- CHAPTER GOAL: What plot event MUST happen here?
- CLOSING HOOK: Exact last image or line that makes readers continue?
- KEY BEATS: 35 numbered scene beats that will form the chapter
- CLOSING HOOK: Exact last image or line that makes readers continue
Now write the full draft chapter following the prose style guide above.
Be consistent with ALL character names and world rules from the bible.
Stop here. Output ONLY the plan above. The full chapter will be written next.
- type: think
model: power
hint: |
PASS 2DEEPEN & SHARPEN
PASS 1WRITE THE FULL CHAPTER
Read your draft critically through an editor's eyes:
- Does the first line continue naturally from the previous chapter's ending?
- Does the opening hook land in the first two lines?
- Are ALL character names consistent with the bible/outline?
- Is every dialogue exchange tight and voice-distinct between characters?
- Are there any "telling" moments that should be "showing"?
- Does every scene beat move the story forward OR reveal character?
- Is the closing hook specific and compelling, not generic?
- Does the prose match the genre style guide above?
- Is the chapter at the target length? ({chapter_target_words} words — write the full chapter)
Using the plan from your previous step, write the complete chapter now.
Rewrite the COMPLETE final chapter incorporating all improvements.
Output ONLY the polished chapter text — no commentary, no "Pass 2" headings.
Start directly with the chapter title and opening line.
Requirements:
- Start with the FIRST LINE you planned — make it continue naturally from the previous chapter
- Follow the KEY BEATS in order, but write with full scene depth — don't skip
- All character names must be consistent with the bible/outline
- Every dialogue exchange must be tight and voice-distinct
- Show, don't tell — externalize emotion through action, detail, and dialogue
- Every scene beat moves the story forward OR reveals character (no filler)
- End with the CLOSING HOOK you planned
- Match the prose style guide: {prose_style}
- Target length: {chapter_target_words} words — write the full chapter, not a summary
Output ONLY the polished chapter text.
Start directly with the chapter title (e.g., "Chapter N: [Title]") and opening line.
No commentary, no plan headers, no "Pass 1" label.
- type: document
filename: "chapter-{chapter_ref}"
- type: package
hint: |
The chapter has been written and committed. Now spawn the three independent editorial reviewers
The chapter has been written and committed.
CRITICAL — include the `chapter_text` field:
Copy the COMPLETE chapter text you just wrote into the `chapter_text` field.
Reviewers have NO other way to access the chapter content.
Do NOT summarize or truncate it — include every word of the final chapter.
Now spawn the three independent editorial reviewers
and the roundtable debate. Use the exact task_names shown — the roundtable depends_on all three.
schema:
chapter_text: string