version: 4
promptkit:
  profile_file: ./examples/profiles/dnd-extraction.yml
concurrency:
  total_llm: 2
  stage_workers:
    extract: 2
output:
  directory: ./notarius-output
cache:
  chunk_plans:
    mode: auto
    directory: ./notarius-cache/chunk-plans
  checkpoints:
    enabled: true
    directory: ./notarius-cache/checkpoints
debug:
  directory: ./notarius-debug
pipelines:
  dnd-session:
    llm_profile: dnd-extraction
    input: seriatim
    # Stable campaign context is shared by every module that accepts these slots.
    references:
      party: ./dnd-party.txt
      glossary: ./dnd-glossary.txt
    chunk:
      module: dnd/scenes
      retries: 2
    output:
      module: json
      options:
        include_chunk_map: true
        evidence_context:
          enabled: true
          window_units: 3
          lanes:
            - item-occurrences
            - item-registry
            - location-registry
            - location-occurrences
            - npc-registry
            - spells
            - combat-turns
            - npc-occurrences
            - enemy-events
    steps:
      # Establish session-wide reference artifacts before their consumers.
      - id: describe-session
        artifacts:
          item-registry:
            extract:
              module: dnd/item-registry
              retries: 2
            merge: appendorder
            normalize: dnd/item-registry
          npc-registry:
            extract:
              module: dnd/npc-registry
              retries: 2
            merge: appendorder
            normalize:
              module: dnd/npc-registry
              retries: 2
          location-registry:
            extract:
              module: dnd/location-registry
              retries: 2
            merge: appendorder
            normalize:
              module: dnd/location-registry
              retries: 2
          scene-descriptions:
            extract:
              module: dnd/scene-descriptions
              retries: 2
            merge: appendorder
            normalize: dnd/scene-descriptions
      - id: extract-events
        # Accepted registry artifacts and scene-description eligibility artifacts
        # are supplied in memory to their compatible consumers in this step.
        references:
          location_registry:
            artifact:
              step: describe-session
              lane: location-registry
          npc_registry:
            artifact:
              step: describe-session
              lane: npc-registry
          scene_descriptions:
            artifact:
              step: describe-session
              lane: scene-descriptions
          item_registry:
            artifact:
              step: describe-session
              lane: item-registry
        artifacts:
          item-occurrences:
            extract:
              module: dnd/item-occurrences
              retries: 2
            merge: appendorder
            normalize: dnd/item-occurrences
          spells:
            extract:
              module: dnd/spells
              retries: 2
              references:
                spell_catalog: ./dnd-spell-catalog.json
            merge: appendorder
            # Stage-local file references are intentionally bound at each stage.
            normalize:
              module: dnd/spells
              references:
                spell_catalog: ./dnd-spell-catalog.json
          combat-turns:
            extract:
              module: dnd/combat-turns
              retries: 2
            merge: appendorder
            normalize: dnd/combat-turns
          npc-occurrences:
            extract:
              module: dnd/npc-occurrences
              retries: 2
            merge: appendorder
            normalize: dnd/npc-occurrences
          location-occurrences:
            extract:
              module: dnd/location-occurrences
              retries: 2
            merge: appendorder
            normalize: dnd/location-occurrences
      - id: track-enemies
        references:
          npc_registry:
            artifact:
              step: describe-session
              lane: npc-registry
          scene_descriptions:
            artifact:
              step: describe-session
              lane: scene-descriptions
          combat_turns:
            artifact:
              step: extract-events
              lane: combat-turns
          npc_occurrences:
            artifact:
              step: extract-events
              lane: npc-occurrences
        artifacts:
          enemy-events:
            extract:
              module: dnd/enemy-events
              retries: 2
            merge: appendorder
            normalize: dnd/enemy-events
