fix: add DEATH-FORWARD RULE to PASS 3 — prevents deceased chars getting living state

This commit is contained in:
2026-03-25 17:14:27 +00:00
parent 7eb23b6ea0
commit 2efc2ab787

View File

@@ -1,493 +1,502 @@
name: book_chapter name: book_chapter
description: "Write one chapter — continuity check, draft, self-check, then spawn editorial review." description: "Write one chapter — continuity check, draft, self-check, then spawn editorial review."
debug: true debug: true
system: agent_prompt system: agent_prompt
requires: requires:
- genre_name - genre_name
- genre_audience - genre_audience
- prose_style - prose_style
- chapter_target_words - chapter_target_words
- chapter_ref - chapter_ref
conditional_skills: conditional_skills:
- path: guides/YAFictionGuide.md - path: guides/YAFictionGuide.md
genre_contains: genre_contains:
- "YA" - "YA"
- "Young Adult" - "Young Adult"
- path: guides/RomanceFictionGuide.md - path: guides/RomanceFictionGuide.md
genre_contains: genre_contains:
- "Romance" - "Romance"
- "Contemporary Romance" - "Contemporary Romance"
- path: guides/SciFiFictionGuide.md - path: guides/SciFiFictionGuide.md
genre_contains: genre_contains:
- "Science Fiction" - "Science Fiction"
- "Sci-Fi" - "Sci-Fi"
- "SciFi" - "SciFi"
- "Science-Fiction" - "Science-Fiction"
# Genre-aware guide use: Only the guide whose genre_contains keywords match {genre_name} # Genre-aware guide use: Only the guide whose genre_contains keywords match {genre_name}
# is injected. The pipeline skips non-matching guides entirely, so there are no # is injected. The pipeline skips non-matching guides entirely, so there are no
# conflicting craft signals from other genres. # conflicting craft signals from other genres.
agent_prompt: agent_prompt:
- "= identity.md" - "= identity.md"
- "agent.rag.json" - "agent.rag.json"
sections: sections:
- agent - agent
- project - project
- rag - rag
- skills - skills
- deliverables - deliverables
- message - message
- rejection_feedback - rejection_feedback
- instructions - instructions
steps: steps:
- type: think - type: think
hint: | hint: |
PASS 0 — BIBLE, CONTINUITY, AND DRAFT PROMPT PASS 0 — BIBLE, CONTINUITY, AND DRAFT PROMPT
GENRE: {genre_name} | AUDIENCE: {genre_audience} GENRE: {genre_name} | AUDIENCE: {genre_audience}
PROSE STYLE GUIDE: {prose_style} PROSE STYLE GUIDE: {prose_style}
TARGET CHAPTER LENGTH: ~{chapter_target_words} words TARGET CHAPTER LENGTH: ~{chapter_target_words} words
GENRE GUIDE: Your skills section contains exactly the guide for {genre_name}. Apply it fully. GENRE GUIDE: Your skills section contains exactly the guide for {genre_name}. Apply it fully.
CONTINUITY GUARDRAILS: CONTINUITY GUARDRAILS:
- Use ONLY the outline / character bible and the immediately previous chapter for continuity. - Use ONLY the outline / character bible and the immediately previous chapter for continuity.
- Ignore future chapters, editorial reviews, roundtables, polish drafts, and any non-chapter artifacts. - Ignore future chapters, editorial reviews, roundtables, polish drafts, and any non-chapter artifacts.
- Never pull facts from a deliverable whose filename indicates a later chapter than {chapter_ref}. - Never pull facts from a deliverable whose filename indicates a later chapter than {chapter_ref}.
⚠️ CRITICAL: Your task name tells you EXACTLY which chapter to write. ⚠️ CRITICAL: Your task name tells you EXACTLY which chapter to write.
Look at the CURRENT MESSAGE — write THAT chapter and ONLY that chapter. Look at the CURRENT MESSAGE — write THAT chapter and ONLY that chapter.
Do NOT write Chapter 1 unless the message explicitly says "Chapter 1". Do NOT write Chapter 1 unless the message explicitly says "Chapter 1".
STEP 1 — READ THE OUTLINE / CHARACTER BIBLE: STEP 1 — READ THE OUTLINE / CHARACTER BIBLE:
Look at PROJECT DELIVERABLES for the outline file (it contains the Character Bible Look at PROJECT DELIVERABLES for the outline file (it contains the Character Bible
if this is a fiction project, and the Chapter Outline for all projects). if this is a fiction project, and the Chapter Outline for all projects).
Extract and record: Extract and record:
- Protagonist: exact name, voice description, age (if fiction) - Protagonist: exact name, voice description, age (if fiction)
- Love interest and supporting characters: exact names and roles (if fiction) - Love interest and supporting characters: exact names and roles (if fiction)
- World rules / constraints (if paranormal or speculative) - World rules / constraints (if paranormal or speculative)
- This chapter's summary, emotional beat, and closing hook from the outline - This chapter's summary, emotional beat, and closing hook from the outline
If no outline/bible is available, use the character names and project details If no outline/bible is available, use the character names and project details
from the task description above — be CONSISTENT throughout the book. from the task description above — be CONSISTENT throughout the book.
STEP 2 — FIND THE PREVIOUS CHAPTER: STEP 2 — FIND THE PREVIOUS CHAPTER:
Look at PROJECT DELIVERABLES for the chapter that comes BEFORE this one. Look at PROJECT DELIVERABLES for the chapter that comes BEFORE this one.
If no previous chapter exists (this IS Chapter 1), skip to STEP 4. If no previous chapter exists (this IS Chapter 1), skip to STEP 4.
STEP 3 — QUOTE THE ENDING: STEP 3 — QUOTE THE ENDING:
Copy the LAST 23 sentences of the previous chapter here, word for word. Copy the LAST 23 sentences of the previous chapter here, word for word.
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 — BUILD THE DRAFT PROMPT: STEP 4 — BUILD THE DRAFT PROMPT:
Write the exact drafting prompt for the next pass. That prompt must include: Write the exact drafting prompt for the next pass. That prompt must include:
- 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: The exact opening sentence, 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?
- KEY BEATS: 35 numbered scene beats that will form the chapter - KEY BEATS: 35 numbered scene beats that will form the chapter
- CLOSING HOOK: Exact last image or line that makes readers continue - CLOSING HOOK: Exact last image or line that makes readers continue
- Reminders about continuity, prose style, and target length - Reminders about continuity, prose style, and target length
- CHARACTER VOICE PROFILES (pre-extracted): - CHARACTER VOICE PROFILES (pre-extracted):
{character_profiles} {character_profiles}
If this block is empty, fall back to searching PROJECT DELIVERABLES for a file If this block is empty, fall back to searching PROJECT DELIVERABLES for a file
containing "## Voice Signatures" and copy it here. PASS 1 must write every containing "## Voice Signatures" and copy it here. PASS 1 must write every
character to their profile. character to their profile.
EDITORIAL OVERRIDES — apply these BEFORE writing any KEY BEATS: EDITORIAL OVERRIDES — apply these BEFORE writing any KEY BEATS:
{author_intent} {author_intent}
↑ If this line is not blank, it is a BINDING creative directive from the editor. ↑ If this line is not blank, it is a BINDING creative directive from the editor.
Include it verbatim in the draft prompt as: "AUTHOR'S INTENT: [text]" Include it verbatim in the draft prompt as: "AUTHOR'S INTENT: [text]"
PASS 1 must satisfy this intent completely. PASS 1 must satisfy this intent completely.
{closing_hook} {closing_hook}
↑ If this line is not blank, use it as the CLOSING HOOK instead of any outline hook. ↑ If this line is not blank, use it as the CLOSING HOOK instead of any outline hook.
Include it verbatim in the draft prompt as: "LOCKED CLOSING HOOK: [text]" Include it verbatim in the draft prompt as: "LOCKED CLOSING HOOK: [text]"
STEP 5 — CHECK LIVE CHARACTER STATE (if available): STEP 5 — CHECK LIVE CHARACTER STATE (if available):
Look in your RAG context for an asset called [character-state]. Look in your RAG context for an asset called [character-state].
If it exists — this is WHERE and WHO each character is RIGHT NOW. If it exists — this is WHERE and WHO each character is RIGHT NOW.
It OVERRIDES any outline predictions about character state. It OVERRIDES any outline predictions about character state.
Record as "LIVE CHARACTER STATE:" for use in PASS 1. Record as "LIVE CHARACTER STATE:" for use in PASS 1.
LOCATION CONTINUITY CHECK (perform this if [character-state] is present): LOCATION CONTINUITY CHECK (perform this if [character-state] is present):
Does this chapter's outline place any character at a location inconsistent Does this chapter's outline place any character at a location inconsistent
with their Location field in [character-state]? with their Location field in [character-state]?
Example conflict: character-state says "Earth hospital" but outline opens on Mars. Example conflict: character-state says "Earth hospital" but outline opens on Mars.
If conflict found — FLAG before drafting: If conflict found — FLAG before drafting:
"LOCATION CONFLICT: [char] is at [state-location] per last chapter but outline "LOCATION CONFLICT: [char] is at [state-location] per last chapter but outline
places them at [outline-location]. Resolve: (a) open chapter in transit, places them at [outline-location]. Resolve: (a) open chapter in transit,
(b) adjust scene to actual location, or (c) write a time-skip bridge paragraph. (b) adjust scene to actual location, or (c) write a time-skip bridge paragraph.
Do NOT silently teleport the character." Do NOT silently teleport the character."
Also note any Active obligations, Open loops, or Known secrets from [character-state] Also note any Active obligations, Open loops, or Known secrets from [character-state]
that should be honored or advanced in this chapter. that should be honored or advanced in this chapter.
Also check RAG for [world-state] — current NPC attitudes and faction memory. Also check RAG for [world-state] — current NPC attitudes and faction memory.
If present, record as "LIVE WORLD STATE:". Any NPC listed there who appears in If present, record as "LIVE WORLD STATE:". Any NPC listed there who appears in
this chapter should behave according to their recorded attitude. this chapter should behave according to their recorded attitude.
Stop here. Output ONLY the draft prompt. Do NOT write chapter prose yet. Stop here. Output ONLY the draft prompt. Do NOT write chapter prose yet.
- type: think - type: think
model: power model: power
max_tokens: 32000 max_tokens: 32000
hint: | hint: |
PASS 1 — WRITE THE DRAFT PASS 1 — WRITE THE DRAFT
Use the draft prompt below as your exact writing brief: Use the draft prompt below as your exact writing brief:
{steps[0].text} {steps[0].text}
Requirements: Requirements:
- Start with the FIRST LINE you planned — make it continue naturally from the previous chapter - Start with the FIRST LINE you planned — make it continue naturally from the previous chapter
- If the draft prompt contains a line starting with "LOCKED PREVIOUS CHAPTER HOOK:", - If the draft prompt contains a line starting with "LOCKED PREVIOUS CHAPTER HOOK:",
your FIRST LINE MUST directly resolve that hook — the reader expects the answer immediately your FIRST LINE MUST directly resolve that hook — the reader expects the answer immediately
- If the draft prompt contains a line starting with "AUTHOR'S INTENT:", treat it as a - If the draft prompt contains a line starting with "AUTHOR'S INTENT:", treat it as a
binding creative directive — your draft must satisfy that intent in full binding creative directive — your draft must satisfy that intent in full
- Follow the KEY BEATS in order, but write with full scene depth — don't skip - 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 - All character names must be consistent with the bible/outline
- Every dialogue exchange must be tight and voice-distinct - Every dialogue exchange must be tight and voice-distinct
- Show, don't tell — externalize emotion through action, detail, and dialogue - Show, don't tell — externalize emotion through action, detail, and dialogue
- Every scene beat moves the story forward OR reveals character (no filler) - Every scene beat moves the story forward OR reveals character (no filler)
- End with the CLOSING HOOK you planned - End with the CLOSING HOOK you planned
- Match the prose style guide: {prose_style} - Match the prose style guide: {prose_style}
- Target length: {chapter_target_words} words — write the FULL chapter, not a summary - Target length: {chapter_target_words} words — write the FULL chapter, not a summary
- ⚠️ DO NOT stop early. If you have not reached {chapter_target_words} words, continue - ⚠️ DO NOT stop early. If you have not reached {chapter_target_words} words, continue
writing — add interiority, sensory detail, extended dialogue beats, and scene transitions writing — add interiority, sensory detail, extended dialogue beats, and scene transitions
until you hit the target. Short chapters will be REJECTED in adjudication. until you hit the target. Short chapters will be REJECTED in adjudication.
DRAFTING DISCIPLINE — apply these on every page: DRAFTING DISCIPLINE — apply these on every page:
- {prose_style} is a hard constraint, not decoration - {prose_style} is a hard constraint, not decoration
- Not every paragraph needs a memorable or quotable line — use functional connective prose - Not every paragraph needs a memorable or quotable line — use functional connective prose
- Let observation precede interpretation: show the moment before naming what it means - Let observation precede interpretation: show the moment before naming what it means
- Avoid clustering aphorisms or thesis-style sentences back to back - Avoid clustering aphorisms or thesis-style sentences back to back
- Prefer scene motion over thesis delivery — action and dialogue carry meaning - Prefer scene motion over thesis delivery — action and dialogue carry meaning
- Write ONE complete draft now. Do NOT self-polish. Reviewers will give feedback downstream. - Write ONE complete draft now. Do NOT self-polish. Reviewers will give feedback downstream.
VOICE ANTI-PATTERNS — THESE ARE FORBIDDEN ON EVERY PAGE: VOICE ANTI-PATTERNS — THESE ARE FORBIDDEN ON EVERY PAGE:
- Do NOT open any chapter with the "didn't just X; it Y" sentence construction. - Do NOT open any chapter with the "didn't just X; it Y" sentence construction.
Every chapter must have a structurally distinct opener. Vary: in medias res, Every chapter must have a structurally distinct opener. Vary: in medias res,
quiet beat, dialogue cold open, environmental sweep, interiority. quiet beat, dialogue cold open, environmental sweep, interiority.
No two consecutive chapters may use the same opener structure. No two consecutive chapters may use the same opener structure.
- The book's thematic contrast (whatever it is — body/mind, memory/possibility, etc.) - The book's thematic contrast (whatever it is — body/mind, memory/possibility, etc.)
may appear ONCE per scene as a metaphor. Not in every paragraph. Trust the reader. may appear ONCE per scene as a metaphor. Not in every paragraph. Trust the reader.
If you have used the contrast in the last two paragraphs, you may not use it again If you have used the contrast in the last two paragraphs, you may not use it again
for at least three more paragraphs. for at least three more paragraphs.
- Do NOT label an emotion that you have already shown through action or dialogue. - Do NOT label an emotion that you have already shown through action or dialogue.
If the character's hands are shaking, do not also write "she was afraid." If the character's hands are shaking, do not also write "she was afraid."
If the dialogue already conveys anger, do not add "his voice was furious." If the dialogue already conveys anger, do not add "his voice was furious."
- Do NOT count or reference chapter numbers in the prose. - Do NOT count or reference chapter numbers in the prose.
"Five chapters of..." is an AI fingerprint. Never. "Five chapters of..." is an AI fingerprint. Never.
- Each character must have at least ONE verbal imperfection per scene they appear in: - Each character must have at least ONE verbal imperfection per scene they appear in:
a sentence they don't finish, a word they use wrong, a line that doesn't land, a sentence they don't finish, a word they use wrong, a line that doesn't land,
a moment of fumbling before the right words come. Perfect dialogue is dead dialogue. a moment of fumbling before the right words come. Perfect dialogue is dead dialogue.
- Check the CHARACTER VOICE PROFILE in the outline/bible (if present) — if each - Check the CHARACTER VOICE PROFILE in the outline/bible (if present) — if each
speaking character's dialogue cannot be identified as THEIRS without a speaker tag, speaking character's dialogue cannot be identified as THEIRS without a speaker tag,
rewrite until it can. Verbal tics, pet phrases, and characteristic patterns are rewrite until it can. Verbal tics, pet phrases, and characteristic patterns are
non-negotiable signatures. non-negotiable signatures.
Output ONLY the draft chapter text. Output ONLY the draft chapter text.
Start directly with the chapter title (e.g., "Chapter N: [Title]") and opening line. Start directly with the chapter title (e.g., "Chapter N: [Title]") and opening line.
No commentary, no plan headers, no "Pass 1" label. No commentary, no plan headers, no "Pass 1" label.
- type: think - type: think
model: power model: power
max_tokens: 32000 max_tokens: 32000
hint: | hint: |
SELF-CHECK — STRUCTURAL VALIDATION AND WORD-COUNT EXPANSION SELF-CHECK — STRUCTURAL VALIDATION AND WORD-COUNT EXPANSION
You have just written a chapter draft. Your job: check the draft against the structural You have just written a chapter draft. Your job: check the draft against the structural
checklist below, apply all corrections within scope (including word-count expansion if checklist below, apply all corrections within scope (including word-count expansion if
the draft is short), and output the final chapter. the draft is short), and output the final chapter.
DRAFT TO CHECK: DRAFT TO CHECK:
{steps[1].text} {steps[1].text}
CHECKLIST — check each item, note any issue found: CHECKLIST — check each item, note any issue found:
1. BEAT & HOOK: Does the chapter reach its intended emotional beat and closing hook 1. BEAT & HOOK: Does the chapter reach its intended emotional beat and closing hook
from the PASS 0 draft prompt? Flag if the chapter ends without the planned hook. from the PASS 0 draft prompt? Flag if the chapter ends without the planned hook.
2. NAMES & POV: Are all character names and the POV consistent with the bible/outline? 2. NAMES & POV: Are all character names and the POV consistent with the bible/outline?
Flag any name that doesn't match the project canon. Flag any name that doesn't match the project canon.
3. CONTINUITY TERMS: Do world rules, place names, and timeline references match 3. CONTINUITY TERMS: Do world rules, place names, and timeline references match
project state? Flag any factual break. project state? Flag any factual break.
4. FORMATTING: Are there obvious section-break artifacts, duplicate headers, 4. FORMATTING: Are there obvious section-break artifacts, duplicate headers,
or missing chapter title? Flag and fix. or missing chapter title? Flag and fix.
5. WORD FLOOR: Estimate draft word count: count paragraphs × ~60 words/paragraph. 5. WORD FLOOR: Estimate draft word count: count paragraphs × ~60 words/paragraph.
Target is {chapter_target_words} words. Target is {chapter_target_words} words.
BEFORE writing the VALIDATION LOG line, you MUST have your full word estimate. BEFORE writing the VALIDATION LOG line, you MUST have your full word estimate.
- If the draft is MORE THAN 10% under target: EXPAND NOW (write SCENE A, B, C BEFORE validation log). - If the draft is MORE THAN 10% under target: EXPAND NOW (write SCENE A, B, C BEFORE validation log).
- If within 10% of target: PASS, output verbatim. - If within 10% of target: PASS, output verbatim.
Do NOT write 'EXPANDED' in the log if you did not write actual new scenes. Do NOT write 'EXPANDED' in the log if you did not write actual new scenes.
6. OPENING HOOK: Check the PASS 0 draft prompt ({steps[0].text}) for a line labeled 6. OPENING HOOK: Check the PASS 0 draft prompt ({steps[0].text}) for a line labeled
"LOCKED PREVIOUS CHAPTER HOOK:". If present, verify the chapter's opening paragraph "LOCKED PREVIOUS CHAPTER HOOK:". If present, verify the chapter's opening paragraph
directly resolves it. If not, add a brief resolution sentence at the opening — directly resolves it. If not, add a brief resolution sentence at the opening —
do not leave a locked hook unanswered. do not leave a locked hook unanswered.
7. AUTHOR'S INTENT: Check the PASS 0 draft prompt ({steps[0].text}) for a line 7. AUTHOR'S INTENT: Check the PASS 0 draft prompt ({steps[0].text}) for a line
starting with "AUTHOR'S INTENT:". If present, confirm the completed chapter starting with "AUTHOR'S INTENT:". If present, confirm the completed chapter
satisfies that intent — note whether it was honored or partially missed. satisfies that intent — note whether it was honored or partially missed.
8. CLOSING HOOK LOCK: Check the PASS 0 draft prompt ({steps[0].text}) for a line 8. CLOSING HOOK LOCK: Check the PASS 0 draft prompt ({steps[0].text}) for a line
starting with "LOCKED CLOSING HOOK:". If present, verify the last paragraph of starting with "LOCKED CLOSING HOOK:". If present, verify the last paragraph of
the chapter uses that exact hook wording. If it's missing or paraphrased, add a the chapter uses that exact hook wording. If it's missing or paraphrased, add a
final paragraph that delivers the locked hook precisely. final paragraph that delivers the locked hook precisely.
ALLOWED CORRECTIONS: ALLOWED CORRECTIONS:
- Fix a wrong character name to match the canon name - Fix a wrong character name to match the canon name
- Fix a POV slip (e.g., the chapter is 1st-person but one paragraph shifted to 3rd) - Fix a POV slip (e.g., the chapter is 1st-person but one paragraph shifted to 3rd)
- Fix a missing or duplicated chapter title/header - Fix a missing or duplicated chapter title/header
- If the chapter is missing its closing hook entirely, add it as a final paragraph - If the chapter is missing its closing hook entirely, add it as a final paragraph
that matches the hook specified in the draft prompt — no new invention beyond the that matches the hook specified in the draft prompt — no new invention beyond the
planned hook planned hook
- WORD COUNT EXPANSION (when draft is more than 10% below {chapter_target_words}): - WORD COUNT EXPANSION (when draft is more than 10% below {chapter_target_words}):
IMPORTANT: Do NOT claim expansion in the VALIDATION LOG unless you have actually written it. IMPORTANT: Do NOT claim expansion in the VALIDATION LOG unless you have actually written it.
The WORD FLOOR line must show a word count you can verify by counting paragraphs. The WORD FLOOR line must show a word count you can verify by counting paragraphs.
Each paragraph ≈ 5080 words. Count your paragraphs × 60 to estimate total words. Each paragraph ≈ 5080 words. Count your paragraphs × 60 to estimate total words.
Write NEW SCENES sequentially AFTER the chapter ends: Write NEW SCENES sequentially AFTER the chapter ends:
SCENE A: 400+ words — interiority beat deepening the aftermath SCENE A: 400+ words — interiority beat deepening the aftermath
SCENE B: 400+ words — dialogue exchange with voice-distinct characters SCENE B: 400+ words — dialogue exchange with voice-distinct characters
SCENE C: 300+ words — grounded transition showing the next 24 hours SCENE C: 300+ words — grounded transition showing the next 24 hours
Total added prose must reach the word target. Obey voice anti-patterns from PASS 1. Total added prose must reach the word target. Obey voice anti-patterns from PASS 1.
Do NOT add new plot beats not in PASS 0. Each new scene is an EXPANSION, not a new chapter. Do NOT add new plot beats not in PASS 0. Each new scene is an EXPANSION, not a new chapter.
NOT ALLOWED — do not make any of these changes: NOT ALLOWED — do not make any of these changes:
- Improve existing sentences for prose quality, rhythm, or lyricism - Improve existing sentences for prose quality, rhythm, or lyricism
- Reorder scenes or restructure the chapter - Reorder scenes or restructure the chapter
- Add new metaphors or aphorisms to existing prose - Add new metaphors or aphorisms to existing prose
- Normalize or upgrade the authorial voice in existing sentences - Normalize or upgrade the authorial voice in existing sentences
OUTPUT FORMAT: OUTPUT FORMAT:
Start your response with a VALIDATION LOG section: Start your response with a VALIDATION LOG section:
VALIDATION LOG: VALIDATION LOG:
1. BEAT & HOOK: [check pass/fail with brief note] 1. BEAT & HOOK: [check pass/fail with brief note]
2. NAMES & POV: [check pass/fail with brief note] 2. NAMES & POV: [check pass/fail with brief note]
3. CONTINUITY TERMS: [check pass/fail with brief note] 3. CONTINUITY TERMS: [check pass/fail with brief note]
4. FORMATTING: [check pass/fail — note any fixes applied] 4. FORMATTING: [check pass/fail — note any fixes applied]
5. WORD FLOOR: [PASS/EXPANDED — include word count before and after] 5. WORD FLOOR: [PASS/EXPANDED — include word count before and after]
6. OPENING HOOK: [check pass/fail or N/A] 6. OPENING HOOK: [check pass/fail or N/A]
7. AUTHOR'S INTENT: [honored / partially missed — note / N/A if no intent set] 7. AUTHOR'S INTENT: [honored / partially missed — note / N/A if no intent set]
8. CLOSING HOOK LOCK: [locked hook delivered / missing / N/A if not locked] 8. CLOSING HOOK LOCK: [locked hook delivered / missing / N/A if not locked]
Then output the separator on its own line: Then output the separator on its own line:
---BEGIN CHAPTER--- ---BEGIN CHAPTER---
Then output the COMPLETE final chapter text (all original prose + any expansion). Then output the COMPLETE final chapter text (all original prose + any expansion).
Start the chapter directly with the chapter title and first line. Start the chapter directly with the chapter title and first line.
No preamble or commentary within the chapter text. No preamble or commentary within the chapter text.
# Commit chapter draft now — last_text() = self-check output (step 2). Must come before # Commit chapter draft now — last_text() = self-check output (step 2). Must come before
# PASS 3 think so the character-state extraction does not overwrite last_text(). # PASS 3 think so the character-state extraction does not overwrite last_text().
- type: document - type: document
filename: "Chapter_{chapter_number}_draft" filename: "Chapter_{chapter_number}_draft"
primary_deliverable: true primary_deliverable: true
strip_before_marker: "---BEGIN CHAPTER---" strip_before_marker: "---BEGIN CHAPTER---"
- type: think - type: think
system: | system: |
EXTRACTION MODE — DO NOT CREATE FICTION. EXTRACTION MODE — DO NOT CREATE FICTION.
Your ONLY task is to extract factual state from the chapter you just wrote. Your ONLY task is to extract factual state from the chapter you just wrote.
You are NOT writing the story. You are NOT continuing the narrative. You are NOT writing the story. You are NOT continuing the narrative.
Characters who are DEAD are DEAD. You may NOT invent a living version of them. Characters who are DEAD are DEAD. You may NOT invent a living version of them.
KAELEN IS DEAD. HE DIED IN CHAPTER 4. DO NOT WRITE KAELEN AS ALIVE. KAELEN IS DEAD. HE DIED IN CHAPTER 4. DO NOT WRITE KAELEN AS ALIVE.
If you write a "Location:" or "Physical:" or "Emotional:" field for Kaelen, that is WRONG. If you write a "Location:" or "Physical:" or "Emotional:" field for Kaelen, that is WRONG.
hint: | hint: |
PASS 3 -- CHARACTER + WORLD STATE EXTRACTION PASS 3 -- CHARACTER + WORLD STATE EXTRACTION
══ STEP 0: FIND THE CORRECT CHAPTER TEXT (DO THIS FIRST) ══ ══ STEP 0: FIND THE CORRECT CHAPTER TEXT (DO THIS FIRST) ══
This conversation has multiple text sources. You must extract from the RIGHT one. This conversation has multiple text sources. You must extract from the RIGHT one.
YOUR CONVERSATION HISTORY (in order): YOUR CONVERSATION HISTORY (in order):
Turn 1 → You received PASS 0 context (deliverables, outline, bible). Turn 1 → You received PASS 0 context (deliverables, outline, bible).
Deliverables include files like [Chapter_1_draft.md], [Chapter_3_draft.md], Deliverables include files like [Chapter_1_draft.md], [Chapter_3_draft.md],
[Chapter_10_draft.md], etc. THESE ARE HISTORICAL. NOT the current chapter. [Chapter_10_draft.md], etc. THESE ARE HISTORICAL. NOT the current chapter.
Turn 2 → You wrote Chapter {chapter_number} in PASS 1 (~4000-word narrative prose). Turn 2 → You wrote Chapter {chapter_number} in PASS 1 (~4000-word narrative prose).
THIS IS THE CHAPTER YOU ARE ANALYZING. THIS IS THE CHAPTER YOU ARE ANALYZING.
Turn 3 → You performed SELF-CHECK (editorial notes, not chapter prose). Turn 3 → You performed SELF-CHECK (editorial notes, not chapter prose).
Turn 4 → THIS MESSAGE (PASS 3 extract). Turn 4 → THIS MESSAGE (PASS 3 extract).
THE CHAPTER = YOUR PASS 1 RESPONSE (Turn 2). It starts immediately after the line THE CHAPTER = YOUR PASS 1 RESPONSE (Turn 2). It starts immediately after the line
"PASS 1 — WRITE THE DRAFT" and ends before the SELF-CHECK. "PASS 1 — WRITE THE DRAFT" and ends before the SELF-CHECK.
⚠ ANCHOR TEST — before writing any Location field, ask yourself: ⚠ ANCHOR TEST — before writing any Location field, ask yourself:
"Did I write this location in my PASS 1 narrative, or is it from a deliverable file?" "Did I write this location in my PASS 1 narrative, or is it from a deliverable file?"
If it is from any [Chapter_N_draft.md] or from the PRE-PASS-1 context — REJECT IT. If it is from any [Chapter_N_draft.md] or from the PRE-PASS-1 context — REJECT IT.
Use ONLY what your PASS 1 narrative says. Use ONLY what your PASS 1 narrative says.
══ MANDATORY CHECK — DECEASED CHARACTERS ══ ══ MANDATORY CHECK — DECEASED CHARACTERS ══
STEP 1: Check PASS 0 above. Find every character listed as "(DECEASED)" or "†" or "DEAD". STEP 1: Check PASS 0 above. Find every character listed as "(DECEASED)" or "†" or "DEAD".
STEP 2: For each such character, use ONLY the short DECEASED format below. STEP 2: For each such character, use ONLY the short DECEASED format below.
You MAY NOT give them a Location, Physical, Emotional, or Arc field. You MAY NOT give them a Location, Physical, Emotional, or Arc field.
They are DEAD. Dead characters do not have locations. They do not have arcs. They are DEAD. Dead characters do not have locations. They do not have arcs.
STEP 3: If Kaelen appears in your output with a Location field — DELETE IT. STEP 3: If Kaelen appears in your output with a Location field — DELETE IT.
If Kaelen appears with an Emotional field — DELETE IT. If Kaelen appears with an Emotional field — DELETE IT.
Write ONLY: ## Kaelen — DECEASED (Ch04) Write ONLY: ## Kaelen — DECEASED (Ch04)
══ DECEASED FORMAT (two lines only) ══ ══ DECEASED FORMAT (two lines only) ══
## [Name] — DECEASED (Ch[N]) ## [Name] — DECEASED (Ch[N])
Established: [one sentence: how they died] Established: [one sentence: how they died]
Legacy: [one sentence: how their death affected this chapter] Legacy: [one sentence: how their death affected this chapter]
══ LIVING CHARACTER FORMAT ══ ══ LIVING CHARACTER FORMAT ══
# Character State: {chapter_ref} # Character State: {chapter_ref}
## [Character Name] ## [Character Name]
Location: [specific location -- building, floor, city, planet] Location: [specific location -- building, floor, city, planet]
Physical: [injuries, fatigue, notable physical state, or "no injuries"] Physical: [injuries, fatigue, notable physical state, or "no injuries"]
Emotional: [dominant emotion at chapter end] Emotional: [dominant emotion at chapter end]
Active obligations: [format: "owes [person] [what] (Ch[N]) -- UNPAID/PAID"] Active obligations: [format: "owes [person] [what] (Ch[N]) -- UNPAID/PAID"]
Open loops: [format: "[parties] [issue] (Ch[N]) -- UNRESOLVED/RESOLVED"] Open loops: [format: "[parties] [issue] (Ch[N]) -- UNRESOLVED/RESOLVED"]
Known secrets: [format: "knows [what] -- [who does NOT know]"] Known secrets: [format: "knows [what] -- [who does NOT know]"]
Arc: [XX%] -- [one sentence: what permanently changed this chapter] Arc: [XX%] -- [one sentence: what permanently changed this chapter]
Permanent: [YES/NO] Permanent: [YES/NO]
(Repeat for EVERY named character who appeared. Deceased = short form only.) (Repeat for EVERY named character who appeared. Deceased = short form only.)
# World State: {chapter_ref} # World State: {chapter_ref}
## NPC Memory ## NPC Memory
- [NPC Name] ([faction/location]): [ATTITUDE] -- [what happened] -- [consequence] - [NPC Name] ([faction/location]): [ATTITUDE] -- [what happened] -- [consequence]
## Faction Attitudes ## Faction Attitudes
- [Faction name]: [attitude] -- [reason] - [Faction name]: [attitude] -- [reason]
## Active World Events ## Active World Events
- [Event]: [status and timeline] - [Event]: [status and timeline]
══ SECRET CARRY-FORWARD RULE ══ ══ SECRET CARRY-FORWARD RULE ══
Before submitting, check the PASS 0 context for any "Known secrets:" fields or Before submitting, check the PASS 0 context for any "Known secrets:" fields or
"CARRIED SECRET" markers from the PREVIOUS character-state file. "CARRIED SECRET" markers from the PREVIOUS character-state file.
For each secret that was NOT resolved or revealed in THIS chapter's PASS 1 prose: For each secret that was NOT resolved or revealed in THIS chapter's PASS 1 prose:
→ Copy it forward unchanged into the character's "Known secrets:" field. → Copy it forward unchanged into the character's "Known secrets:" field.
→ Prefix it: "CARRIED (Ch[N]—unresolved): [secret]" → Prefix it: "CARRIED (Ch[N]—unresolved): [secret]"
This ensures multi-chapter secrets are NOT silently dropped between chapters. This ensures multi-chapter secrets are NOT silently dropped between chapters.
FINAL SELF-CHECK before submitting: Scan your output for Kaelen's name. ══ DEATH-FORWARD RULE ══
If he has a Location, Physical, or Emotional field — delete them. He is dead. Before submitting, scan the PASS 1 prose for any character death events.
If any other character is noted as DECEASED in PASS 0 — apply the same rule. For EACH character who DIES in this chapter's prose OR who was already marked
DECEASED in the previous character-state:
CRITICAL: Keep total output under 3500 characters. NO prose — structured data only. → Set their Status field to: DECEASED (Ch[N] — [cause])
→ Set Location to: [place of death or burial], not a living location
- type: rag_write → Remove Active obligations and Open loops (replace with Legacy:)
asset_id: "character-state" → Legacy field: one sentence on how their death affects surviving characters
source_step: 4 # PASS 3 character-state extraction; explicit to avoid last_text() falling back to chapter text → Set Permanent: YES (deceased)
max_chars: 4000 NEVER give a deceased character a living Location, Physical, or Emotional field.
NEVER assign a deceased character future obligations or arcs.
- type: document If a character was DECEASED in the previous state, copy their entry forward unchanged.
filename: "character-state-{chapter_ref}"
CRITICAL: Keep total output under 3500 characters. NO prose — structured data only.
- type: package
source_step: 4 # PASS 3 — character-state extraction (compact, describes permanent changes) - type: rag_write
max_tokens: 4000 asset_id: "character-state"
hint: | source_step: 4 # PASS 3 character-state extraction; explicit to avoid last_text() falling back to chapter text
The draft chapter has been written, self-checked, and committed. max_chars: 4000
The character-state from PASS 3 is provided above.
- type: document
Summarize the character state changes for {chapter_ref} in the `chapter_state` field filename: "character-state-{chapter_ref}"
(2-3 sentences max). This is used for bookkeeping — the chapter text itself is passed
to reviewers directly. - type: package
source_step: 4 # PASS 3 — character-state extraction (compact, describes permanent changes)
NEW CHARACTER DETECTION: max_tokens: 4000
For each NEW character introduced this chapter (not previously known), emit one hint: |
create_task action using task_type: character_sheet. The draft chapter has been written, self-checked, and committed.
The character-state from PASS 3 is provided above.
PERMANENT CHANGE DETECTION (butterfly effect):
For any character with "Permanent: YES" in the state, emit a create_task action Summarize the character state changes for {chapter_ref} in the `chapter_state` field
using task_type: character_update to record the change in the character sheet. (2-3 sentences max). This is used for bookkeeping — the chapter text itself is passed
to reviewers directly.
Now confirm the chapter is ready for review.
schema: NEW CHARACTER DETECTION:
chapter_state: string For each NEW character introduced this chapter (not previously known), emit one
spawn: create_task action using task_type: character_sheet.
- task_type: chapter_review
task_name: "Review (Devon): {chapter_ref}" PERMANENT CHANGE DETECTION (butterfly effect):
agent_name: Devon For any character with "Permanent: YES" in the state, emit a create_task action
priority: 6 using task_type: character_update to record the change in the character sheet.
_if: "not meta.is_locked"
context: Now confirm the chapter is ready for review.
chapter_text: "{steps[1].text}" schema:
review_focus: developmental chapter_state: string
genre_name: "{genre_name}" spawn:
genre_audience: "{genre_audience}" - task_type: chapter_review
chapter_ref: "{chapter_ref}" task_name: "Review (Devon): {chapter_ref}"
chapter_number: "{chapter_number}" agent_name: Devon
review_letter: "a" priority: 6
character_profiles: "{character_profiles}" _if: "not meta.is_locked"
context:
- task_type: chapter_review chapter_text: "{steps[1].text}"
task_name: "Review (Lane): {chapter_ref}" review_focus: developmental
agent_name: Lane genre_name: "{genre_name}"
priority: 6 genre_audience: "{genre_audience}"
_if: "not meta.is_locked" chapter_ref: "{chapter_ref}"
context: chapter_number: "{chapter_number}"
chapter_text: "{steps[1].text}" review_letter: "a"
review_focus: line character_profiles: "{character_profiles}"
genre_name: "{genre_name}"
genre_audience: "{genre_audience}" - task_type: chapter_review
chapter_ref: "{chapter_ref}" task_name: "Review (Lane): {chapter_ref}"
chapter_number: "{chapter_number}" agent_name: Lane
review_letter: "b" priority: 6
character_profiles: "{character_profiles}" _if: "not meta.is_locked"
context:
- task_type: chapter_review chapter_text: "{steps[1].text}"
task_name: "Review (Cora): {chapter_ref}" review_focus: line
agent_name: Cora genre_name: "{genre_name}"
priority: 6 genre_audience: "{genre_audience}"
_if: "not meta.is_locked" chapter_ref: "{chapter_ref}"
context: chapter_number: "{chapter_number}"
chapter_text: "{steps[1].text}" review_letter: "b"
review_focus: continuity character_profiles: "{character_profiles}"
genre_name: "{genre_name}"
genre_audience: "{genre_audience}" - task_type: chapter_review
chapter_ref: "{chapter_ref}" task_name: "Review (Cora): {chapter_ref}"
chapter_number: "{chapter_number}" agent_name: Cora
review_letter: "c" priority: 6
character_profiles: "{character_profiles}" _if: "not meta.is_locked"
context:
- task_type: chapter_roundtable chapter_text: "{steps[1].text}"
task_name: "Roundtable: {chapter_ref}" review_focus: continuity
agents: genre_name: "{genre_name}"
- Devon genre_audience: "{genre_audience}"
- Lane chapter_ref: "{chapter_ref}"
- Cora chapter_number: "{chapter_number}"
priority: 7 review_letter: "c"
_if: "not meta.is_locked" character_profiles: "{character_profiles}"
context:
chapter_text: "{steps[1].text}" - task_type: chapter_roundtable
genre_name: "{genre_name}" task_name: "Roundtable: {chapter_ref}"
genre_audience: "{genre_audience}" agents:
chapter_ref: "{chapter_ref}" - Devon
chapter_target_words: "{chapter_target_words}" - Lane
character_profiles: "{character_profiles}" - Cora
depends_on: priority: 7
- "Review (Devon): {chapter_ref}" _if: "not meta.is_locked"
- "Review (Lane): {chapter_ref}" context:
- "Review (Cora): {chapter_ref}" chapter_text: "{steps[1].text}"
genre_name: "{genre_name}"
- type: close genre_audience: "{genre_audience}"
rag_update: true chapter_ref: "{chapter_ref}"
chapter_target_words: "{chapter_target_words}"
adjudication: character_profiles: "{character_profiles}"
enabled: true depends_on:
pass_threshold: 80 - "Review (Devon): {chapter_ref}"
deliverable_type: consumer - "Review (Lane): {chapter_ref}"
criteria: - "Review (Cora): {chapter_ref}"
word_count:
weight: 30 - type: close
description: "Chapter meets the {chapter_target_words}-word minimum; under-length chapters fail" rag_update: true
narrative_flow:
weight: 25 adjudication:
description: "Story progresses naturally with good pacing" enabled: true
character_voice: pass_threshold: 80
weight: 20 deliverable_type: consumer
description: "Characters are distinct and consistent" criteria:
prose_quality: word_count:
weight: 15 weight: 30
description: "Writing is clear and readable; voice is consistent with {prose_style}" description: "Chapter meets the {chapter_target_words}-word minimum; under-length chapters fail"
continuity: narrative_flow:
weight: 10 weight: 25
description: "Consistent with prior chapters and canon" description: "Story progresses naturally with good pacing"
character_voice:
weight: 20
description: "Characters are distinct and consistent"
prose_quality:
weight: 15
description: "Writing is clear and readable; voice is consistent with {prose_style}"
continuity:
weight: 10
description: "Consistent with prior chapters and canon"