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

@@ -10,7 +10,6 @@ agent_prompt:
sections: sections:
- agent - agent
- project - project
- history
- rag - rag
- deliverables - deliverables
- message - message

View File

@@ -10,7 +10,6 @@ agent_prompt:
sections: sections:
- agent - agent
- project - project
- history
- rag - rag
- deliverables - deliverables
- message - message

View File

@@ -17,7 +17,6 @@ agent_prompt:
sections: sections:
- agent - agent
- project - project
- history
- rag - rag
- deliverables - deliverables
- message - message
@@ -27,7 +26,7 @@ sections:
steps: steps:
- type: think - type: think
hint: | 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} GENRE: {genre_name} | AUDIENCE: {genre_audience}
PROSE STYLE GUIDE: {prose_style} PROSE STYLE GUIDE: {prose_style}
@@ -57,44 +56,53 @@ steps:
Label them: "PREVIOUS CHAPTER ENDED WITH: ..." Label them: "PREVIOUS CHAPTER ENDED WITH: ..."
Your new chapter MUST pick up from this exact moment. Your new chapter MUST pick up from this exact moment.
STEP 4 — PLAN YOUR CHAPTER: STEP 4 — CHAPTER PLAN:
State your plan: State your plan — do NOT write prose yet:
- CHAPTER: Exact chapter number and title (from the task message) - CHAPTER: Exact chapter number and title (from the task message)
- POV CHARACTER: Whose perspective are we in? - 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? - EMOTIONAL ARC: What does the protagonist feel at start vs end?
- CHAPTER GOAL: What plot event MUST happen here? - 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. Stop here. Output ONLY the plan above. The full chapter will be written next.
Be consistent with ALL character names and world rules from the bible.
- type: think - type: think
model: power model: power
hint: | hint: |
PASS 2DEEPEN & SHARPEN PASS 1WRITE THE FULL CHAPTER
Read your draft critically through an editor's eyes: Using the plan from your previous step, write the complete chapter now.
- 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)
Rewrite the COMPLETE final chapter incorporating all improvements. Requirements:
Output ONLY the polished chapter text — no commentary, no "Pass 2" headings. - Start with the FIRST LINE you planned — make it continue naturally from the previous chapter
Start directly with the chapter title and opening line. - 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 - type: document
filename: "chapter-{chapter_ref}" filename: "chapter-{chapter_ref}"
- type: package - type: package
hint: | 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. and the roundtable debate. Use the exact task_names shown — the roundtable depends_on all three.
schema: schema:
chapter_text: string chapter_text: string

View File

@@ -8,7 +8,6 @@ sections:
- agent - agent
- project - project
- rag - rag
- deliverables
- message - message
- instructions - instructions

View File

@@ -51,13 +51,21 @@ steps:
- Continuity with prior chapters and world rules - Continuity with prior chapters and world rules
If the group has reached sufficient consensus for the polish step, If the group has reached sufficient consensus for the polish step,
end your response with: CONSENSUS REACHED end your response with this EXACT block — no variations, no paraphrasing:
CONSENSUS REACHED
CRITIQUE: [One concise paragraph summarizing the full editorial consensus]
KEY CHANGES:
- [Specific change 1]
- [Specific change 2]
- [Specific change 3 if needed]
VERDICT: [PASS / REVISE / REWRITE]
- type: package - type: package
schema: schema:
consensus_critique: string consensus_critique: string
chapter_verdict: string chapter_verdict: string
key_changes: list key_changes: string
spawn: spawn:
- task_type: chapter_polish - task_type: chapter_polish
task_name: "Polish: {chapter_ref}" task_name: "Polish: {chapter_ref}"

View File

@@ -10,7 +10,6 @@ agent_prompt:
sections: sections:
- agent - agent
- project - project
- history
- rag - rag
- deliverables - deliverables
- message - message

View File

@@ -10,9 +10,7 @@ agent_prompt:
sections: sections:
- agent - agent
- project - project
- history
- rag - rag
- deliverables
- message - message
- rejection_feedback - rejection_feedback
- instructions - instructions
@@ -20,17 +18,18 @@ sections:
steps: steps:
- type: think - type: think
hint: | hint: |
PASS 0 — STORY PLAN (do this before drafting) PASS 0 — STORY PLAN (produce a PLAN only — do NOT write prose yet)
GENRE: {genre_name} | AUDIENCE: {genre_audience} GENRE: {genre_name} | AUDIENCE: {genre_audience}
PROSE STYLE: {prose_style} PROSE STYLE: {prose_style}
(If any of the above are empty, infer genre, audience, and prose style from the task description and project goal.) NOTE: If any field above shows as a literal placeholder (e.g. {genre_name}), it was not
provided — infer genre, audience, and prose style from the project description and task message.
TARGET LENGTH: 3,00015,000 words (short story to novelette) TARGET LENGTH: 3,00015,000 words (short story to novelette)
Before writing, plan the story: Before writing, plan the story — output ONLY this plan block, no prose:
TITLE: [Working title] TITLE: [Working title]
HOOK: [The first sentence or image that pulls the reader in] HOOK: [The exact first sentence or image that pulls the reader in]
PREMISE: [One sentence — the "what if" or core situation] PREMISE: [One sentence — the "what if" or core situation]
PROTAGONIST: [Name, age, voice, fatal flaw, want vs need] PROTAGONIST: [Name, age, voice, fatal flaw, want vs need]
ANTAGONIST / OBSTACLE: [What opposes the protagonist — person, force, or internal] ANTAGONIST / OBSTACLE: [What opposes the protagonist — person, force, or internal]
@@ -41,32 +40,25 @@ steps:
EMOTIONAL CORE: [What does this story make the reader FEEL?] EMOTIONAL CORE: [What does this story make the reader FEEL?]
POINT OF VIEW: [1st / 3rd limited / 3rd omniscient] POINT OF VIEW: [1st / 3rd limited / 3rd omniscient]
TENSE: [Past / present] TENSE: [Past / present]
KEY SCENES: [35 numbered scene beats]
Now write the complete first draft. Stop here. The full story will be written in the next step.
Follow the prose style guide. Stay in chosen POV throughout.
Show — don't tell. Use dialogue. Use sensory detail.
End with purpose: the final line should feel earned and resonant.
- type: think - type: think
model: power model: power
hint: | hint: |
PASS 2DEEPEN & SHARPEN PASS 1WRITE THE COMPLETE STORY
Read your draft critically through an editor's eyes: Using the plan from your previous step, write the full story now.
- Does the opening line hook the reader immediately? Follow the prose style from the plan. Stay in chosen POV throughout.
- Is every scene earning its place in the story? Show — don't tell. Use dialogue. Use sensory detail.
- Are there any "telling" passages that should be "showing"? Start with the HOOK from your plan as the literal first sentence.
- Is the protagonist's want vs need clearly felt (not stated) by the end? End with the RESOLUTION — the final line must feel earned and resonant.
- Is the dialogue tight, voice-distinct, and advancing the story? Target: reach the word count appropriate for the story (3,00015,000 words).
- Does the pacing serve the emotional arc? (Slow the key moments. Cut the connective tissue.)
- Is the final line earned and resonant — not a summary?
- Is the prose consistent with the style guide?
- Is the total length appropriate for the story being told?
Rewrite the COMPLETE final story incorporating all improvements. Output the complete story starting with # [Title].
Output ONLY the polished story starting with the title as # [Title]. No commentary, no "Pass 1" label, no preamble.
No commentary, no "Pass 2" label, no preamble.
- type: document - type: document
filename: "{{task_name_slug}}" filename: "{{task_name_slug}}"