type: think
hint: |
  PASS 0 -- BIBLE, CONTINUITY, AND DRAFT PROMPT

  GENRE: {genre_name}  |  AUDIENCE: {genre_audience}
  PROSE STYLE GUIDE: {prose_style}
  TARGET CHAPTER LENGTH: ~{chapter_target_words} words
  THIS CHAPTER: {chapter_number} ({chapter_ref})

  GENRE GUIDE: Your skills section contains exactly the guide for {genre_name}. Apply it fully.

  +==================================================================+
  |  THE READER KNOWS RULE -- CRITICAL, NON-NEGOTIABLE               |
  |  You are the Scribe entering chapter {chapter_number}.           |
  |  You may only use information the READER already knows --         |
  |  i.e. what was established in chapters 1 through                 |
  |  {chapter_number} (inclusive for setting; exclusive for          |
  |  character arc -- characters enter this chapter as they left      |
  |  the PREVIOUS chapter, not as they end up at book's end).        |
  |                                                                  |
  |  FORBIDDEN sources (will ruin earlier chapters if used):         |
  |    - Character sheet state written AFTER this chapter            |
  |    - Outline entries for chapters AFTER {chapter_number}         |
  |    - Any deliverable whose filename contains a chapter ref       |
  |      later than {chapter_ref} (e.g. chapter-ch-08 when          |
  |      writing ch-03)                                              |
  |    - Editorial reviews, polish drafts, roundtable summaries      |
  |      from ANY chapter (they reflect post-writing analysis)       |
  +==================================================================+

  STEP 1 -- READ THE OUTLINE (chapters 1 through {chapter_number} ONLY):
    Look at PROJECT DELIVERABLES for the outline file.
    [WARNING] READ ONLY the outline entries for chapters 1 through {chapter_number}.
    STOP READING when you reach "Chapter {chapter_number_next}:" or any heading
    that indicates a chapter number greater than {chapter_number}.
    Do NOT read, record, or reason from any future chapter entry.

    From the portion you are allowed to read, extract and record:
      - Protagonist: exact name, voice description, age (if fiction)
      - Love interest and supporting characters: exact names and roles (if fiction)
      - World rules / constraints established so far (if paranormal or speculative)
      - THIS chapter's summary, emotional beat, and closing hook ONLY
    If no outline/bible is available, use the character names and project details
    from the task description above -- be CONSISTENT throughout the book.

  STEP 2 -- CHARACTER STATE (enter chapter {chapter_number} as they LEFT chapter {chapter_number_prev}):
    Character sheets show the FINAL state of each character (end of book).
    You must NOT use that final state for early chapters.

    Instead, use the following sources IN THIS PRIORITY ORDER:
      1. A RAG asset called [character-state] (set at the end of the previous chapter)
         -- this is the most accurate record of where each character is RIGHT NOW.
         Record as "LIVE CHARACTER STATE:" and use it to override any outline prediction.
      2. The "PREVIOUS CHAPTER CHARACTER STATE:" block if injected into this prompt.
      3. The character's entry in the outline up to chapter {chapter_number_prev}.
         Use only their established traits, history, and emotional state AS OF that point.
         Ignore any arc resolution or growth that happens in later chapters.

    LOCATION CONTINUITY CHECK (if [character-state] is present):
      Does this chapter's outline place any character at a location inconsistent
      with their Location field in [character-state]?
        Example conflict: character-state says "Earth hospital" but outline opens on Mars.
      If conflict found -- FLAG before drafting:
        "LOCATION CONFLICT: [char] is at [state-location] per last chapter but outline
        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.
        Do NOT silently teleport the character."

    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
    this chapter should behave according to their recorded attitude.

  STEP 3 -- FIND THE PREVIOUS CHAPTER:
    Look at PROJECT DELIVERABLES for the chapter that comes BEFORE this one
    (filename: chapter-{chapter_ref_prev} or similar).
    If no previous chapter exists (this IS Chapter 1), skip to STEP 5.

  STEP 4 -- QUOTE THE ENDING:
    Copy the LAST 2-3 sentences of the previous chapter here, word for word.
    Label them: "PREVIOUS CHAPTER ENDED WITH: ..."
    Your new chapter MUST pick up from this exact moment.

  STEP 5 -- BUILD THE DRAFT PROMPT:
    Write the exact drafting prompt for the next pass. That prompt must include:
      - CHAPTER: Exact chapter number and title (from the task message)
      - POV CHARACTER: Whose perspective are we in?
      - FIRST LINE: The exact opening sentence, continuing from the previous ending
      - EMOTIONAL ARC: What does the protagonist feel at start vs end OF THIS CHAPTER?
        (Not the end of the book -- only what changes in these pages.)
      - CHAPTER GOAL: What plot event MUST happen here?
      - KEY BEATS: 3-5 numbered scene beats that will form the chapter
      - CLOSING HOOK: Exact last image or line that makes readers continue
      - Reminders about continuity, prose style, and target length
      - CHARACTER VOICE PROFILES (pre-extracted):
        {character_profiles}
        If this block is empty, fall back to searching PROJECT DELIVERABLES for a file
        containing "## Voice Signatures" and copy it here. Use ONLY the voice/speech
        patterns -- do NOT copy character arc outcomes or end-state descriptions.
        PASS 1 must write every character to their profile.

  EDITORIAL OVERRIDES -- apply these BEFORE writing any KEY BEATS:
    {author_intent}
    ^ 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]"
      PASS 1 must satisfy this intent completely.
    {closing_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]"

  Stop here. Output ONLY the draft prompt. Do NOT write chapter prose yet.
