name: character_sheet
description: "Extract and build a structured character sheet from outline or description. Produces a voice-signature-ready profile for pipeline injection."
debug: true
system: agent_prompt

agent_prompt:
  - "= identity.md"
  - "agent.rag.json"

sections:
  - agent
  - project
  - rag
  - deliverables
  - message
  - instructions

steps:
  - type: think
    hint: |
      Build a structured character sheet for {character_name} based on available project
      context (outline, prior chapters, project description, RAG).

      Output the COMPLETE character sheet in this exact format:

      # Character Sheet: {character_name}

      ## Identity
      - Full name: [exact canonical name]
      - Age: [if known]
      - Role: [protagonist / love_interest / antagonist / supporting]
      - Faction/School: [magic school, faction, or group alignment — if applicable]

      ## Voice Signature
      (REQUIRED — this section is injected into every chapter to enforce consistent voice.)
      - Stress expression scale: [mild phrase] = minor | [mid] = upset | [strong] = furious
      - Verbal tic: [what they say in a specific context, e.g., "says 'obviously' sarcastically when meaning the opposite"]
      - Sentence length pattern: [e.g., "short declaratives when focused, run-ons when arguing"]
      - What they REACH FOR: [tactile / visual / analytical / emotional — how they sense the world]
      - What they NEVER say: [phrase or construction they would never use]
      - Imperfection signature: [what breaks in their speech when emotional — trailing off, wrong word, etc.]
      - One example line of their dialogue that could not belong to any other character:
        "[example line]"

      ## Magic / Power / Special Ability
      (Complete this section only if the project involves paranormal / fantasy / speculative elements.)
      - School/Discipline: [name of power type or magic system]
      - Core principle: [the underlying philosophy of their power]
      - Signature move or approach: [how they typically use it]
      - Limitation: [what they can't do; the cost or restriction]
      - Shared uncertainty: [the epistemological question their power raises]

      ## Arc
      - Want: [what they think they need — the surface goal]
      - Need: [what they actually need to grow — the deeper truth]
      - Fatal flaw: [the trait that creates conflict and prevents getting what they need]
      - Wound: [backstory that created the flaw — the originating event]
      - Transformation: [where they need to end up — the arc endpoint]

      ## Relationships
      For each major character in the project:
      - [Character 2 name]: [relationship type + dynamic in one sentence]
      - [Character 3 name]: [relationship type + dynamic in one sentence]
      (Include at minimum: protagonist ↔ love_interest, protagonist ↔ antagonist)

      ## Notes for Writers
      5 bullet points a chapter writer MUST know that are NOT captured in the sections above.
      Focus on the most easily-missed or frequently-wrong details — the things that make this
      character feel real versus generic. Include:
      - At least one physical habit or tell
      - At least one speech quirk specific to this character
      - At least one thing readers must NEVER see this character do or say

  - type: document
    filename: "character-{character_name_slug}"

  - type: rag_write
    asset_id: "voice-sig-{character_name_slug}"
    hint: |
      Extract ONLY the voice signature entry for {character_name} in this exact format.
      Do NOT include any other sections. Do NOT paraphrase — copy directly from the
      Voice Signature section of the character sheet you just wrote.

      ### {character_name} — Voice Signature
      - Role: [from ## Identity: Role field]
      - Voice tone: [from ## Voice Signature: stress scale value]
      - Speech pattern: [from ## Voice Signature: sentence length pattern]
      - What they NEVER say: [from ## Voice Signature: never-say entry]
      - Verbal tic: [from ## Voice Signature: tic/catchphrase entry]
      - Notes: [first 2 bullets from ## Notes for Writers]

  - type: close
    rag_update: true

adjudication:
  enabled: true
  pass_threshold: 75
  deliverable_type: reference
  criteria:
    voice_signature_completeness:
      weight: 35
      description: "Voice Signature section is fully populated with specific, usable identifiers — not vague descriptions"
    arc_clarity:
      weight: 25
      description: "Want vs Need are distinct; Fatal Flaw and Wound are specific and connected"
    writer_notes_specificity:
      weight: 25
      description: "Notes for Writers contains actionable, non-obvious details — not generic craft advice"
    grounding_in_source:
      weight: 15
      description: "Character details are consistent with the project outline and prior deliverables"
