From a0274e154b3286a5bdff47614f95f467e49d91ce Mon Sep 17 00:00:00 2001 From: Eric Rakestraw Date: Sat, 21 Nov 2026 22:52:46 +0000 Subject: [PATCH] Declare embedded prompts profiles and schemas with native kit resources --- assets/dnd/combat-turns/prompts/prompt.yaml | 88 +++++----- assets/dnd/enemy-events/prompts/prompt.yaml | 104 ++++++------ .../dnd/item-occurrences/prompts/prompt.yaml | 88 +++++----- .../item-registry/extract/prompts/prompt.yaml | 78 +++++---- .../normalize/prompts/prompt.yaml | 58 +++---- .../location-occurrences/prompts/prompt.yaml | 88 +++++----- .../extract/prompts/prompt.yaml | 78 +++++---- .../normalize/prompts/prompt.yaml | 58 +++---- .../dnd/npc-occurrences/prompts/prompt.yaml | 88 +++++----- .../npc-registry/extract/prompts/prompt.yaml | 78 +++++---- .../normalize/prompts/prompt.yaml | 58 +++---- assets/dnd/profiles/dnd-extraction.yaml | 2 +- .../scene-descriptions/prompts/prompt.yaml | 78 +++++---- .../combat-semantics/prompts/prompt.yaml | 44 +++-- assets/dnd/scenes/prompts/prompt.yaml | 66 ++++---- assets/dnd/spells/prompts/prompt.yaml | 98 ++++++----- .../deduplication/prompts/prompt.yaml | 52 +++--- assets/notarius.yml | 57 +++++++ assets/package.go | 2 +- assets/package_test.go | 159 ++++++++++++++++++ docs/roadmap/implementation.md | 10 ++ 21 files changed, 813 insertions(+), 619 deletions(-) create mode 100644 assets/notarius.yml create mode 100644 assets/package_test.go diff --git a/assets/dnd/combat-turns/prompts/prompt.yaml b/assets/dnd/combat-turns/prompts/prompt.yaml index c230a5ba..c8313796 100644 --- a/assets/dnd/combat-turns/prompts/prompt.yaml +++ b/assets/dnd/combat-turns/prompts/prompt.yaml @@ -1,46 +1,44 @@ prompts: - dnd.combat_turns: - v1: - default_profile: dnd-extraction - inputs: - - name: transcript - required: true - content_type: application/json - - name: players - required: false - content_type: text/plain - - name: party - required: false - content_type: text/plain - - name: glossary - required: false - content_type: text/plain - - name: npc_registry - required: false - content_type: application/json - messages: - - role: system - content_file: ./sharedassets/common-dnd-system.md - - role: user - content_file: ./sharedassets/common-dnd-identity.md - - role: user - content_file: ./sharedassets/common-dnd-references.md - cache_control: - type: ephemeral - - role: user - content_file: ./sharedassets/common-dnd-transcript-chunk.md - cache_control: - type: ephemeral - - role: user - content_file: ./sharedassets/common-dnd-extraction-evidence.md - - role: user - content_file: ./sharedassets/common-dnd-npc-registry.md - - role: user - content_file: ./instructions.md - cache_control: - type: ephemeral - output: - format: json - validation_mode: json_schema - schema_path: dnd_combat_turns_llm.v1.json - repair_attempts: 1 + - id: dnd.combat_turns + default_profile: notarius/dnd-extraction + inputs: + - name: transcript + required: true + content_type: application/json + - name: players + required: false + content_type: text/plain + - name: party + required: false + content_type: text/plain + - name: glossary + required: false + content_type: text/plain + - name: npc_registry + required: false + content_type: application/json + messages: + - role: system + content_file: ../../shared/prompts/common-dnd-system.md + - role: user + content_file: ../../shared/prompts/common-dnd-identity.md + - role: user + content_file: ../../shared/prompts/common-dnd-references.md + cache_control: + type: ephemeral + - role: user + content_file: ../../shared/prompts/common-dnd-transcript-chunk.md + cache_control: + type: ephemeral + - role: user + content_file: ../../shared/prompts/common-dnd-extraction-evidence.md + - role: user + content_file: ../../shared/prompts/common-dnd-npc-registry.md + - role: user + content_file: ./instructions.md + cache_control: + type: ephemeral + output: + format: json + validation_mode: json_schema + schema_path: dnd/combat-turns/schemas/dnd_combat_turns_llm.v1.json diff --git a/assets/dnd/enemy-events/prompts/prompt.yaml b/assets/dnd/enemy-events/prompts/prompt.yaml index 9314fe58..08d2e4d4 100644 --- a/assets/dnd/enemy-events/prompts/prompt.yaml +++ b/assets/dnd/enemy-events/prompts/prompt.yaml @@ -1,54 +1,52 @@ prompts: - dnd.enemy_events: - v1: - default_profile: dnd-extraction - inputs: - - name: transcript - required: true - content_type: application/json - - name: players - required: false - content_type: text/plain - - name: party - required: false - content_type: text/plain - - name: glossary - required: false - content_type: text/plain - - name: npc_registry - required: true - content_type: application/json - - name: combat_turns - required: true - content_type: application/json - - name: npc_occurrences - required: true - content_type: application/json - messages: - - role: system - content_file: ./sharedassets/common-dnd-system.md - - role: user - content_file: ./sharedassets/common-dnd-identity.md - - role: user - content_file: ./sharedassets/common-dnd-references.md - cache_control: - type: ephemeral - - role: user - content_file: ./sharedassets/common-dnd-transcript-chunk.md - cache_control: - type: ephemeral - - role: user - content_file: ./sharedassets/common-dnd-extraction-evidence.md - - role: user - content_file: ./sharedassets/common-dnd-npc-registry.md - - role: user - content_file: ./combat-grounding.md - - role: user - content_file: ./instructions.md - cache_control: - type: ephemeral - output: - format: json - validation_mode: json_schema - schema_path: dnd_enemy_events_llm.v1.json - repair_attempts: 1 + - id: dnd.enemy_events + default_profile: notarius/dnd-extraction + inputs: + - name: transcript + required: true + content_type: application/json + - name: players + required: false + content_type: text/plain + - name: party + required: false + content_type: text/plain + - name: glossary + required: false + content_type: text/plain + - name: npc_registry + required: true + content_type: application/json + - name: combat_turns + required: true + content_type: application/json + - name: npc_occurrences + required: true + content_type: application/json + messages: + - role: system + content_file: ../../shared/prompts/common-dnd-system.md + - role: user + content_file: ../../shared/prompts/common-dnd-identity.md + - role: user + content_file: ../../shared/prompts/common-dnd-references.md + cache_control: + type: ephemeral + - role: user + content_file: ../../shared/prompts/common-dnd-transcript-chunk.md + cache_control: + type: ephemeral + - role: user + content_file: ../../shared/prompts/common-dnd-extraction-evidence.md + - role: user + content_file: ../../shared/prompts/common-dnd-npc-registry.md + - role: user + content_file: ./combat-grounding.md + - role: user + content_file: ./instructions.md + cache_control: + type: ephemeral + output: + format: json + validation_mode: json_schema + schema_path: dnd/enemy-events/schemas/dnd_enemy_events_llm.v1.json diff --git a/assets/dnd/item-occurrences/prompts/prompt.yaml b/assets/dnd/item-occurrences/prompts/prompt.yaml index b36840be..93a13b5d 100644 --- a/assets/dnd/item-occurrences/prompts/prompt.yaml +++ b/assets/dnd/item-occurrences/prompts/prompt.yaml @@ -1,46 +1,44 @@ prompts: - dnd.item_occurrences: - v1: - default_profile: dnd-extraction - inputs: - - name: transcript - required: true - content_type: application/json - - name: players - required: false - content_type: text/plain - - name: party - required: false - content_type: text/plain - - name: glossary - required: false - content_type: text/plain - - name: item_registry - required: true - content_type: application/json - messages: - - role: system - content_file: ./sharedassets/common-dnd-system.md - - role: user - content_file: ./sharedassets/common-dnd-identity.md - - role: user - content_file: ./sharedassets/common-dnd-references.md - cache_control: - type: ephemeral - - role: user - content_file: ./sharedassets/common-dnd-transcript-chunk.md - cache_control: - type: ephemeral - - role: user - content_file: ./sharedassets/common-dnd-extraction-evidence.md - - role: user - content_file: ./item-registry.md - - role: user - content_file: ./instructions.md - cache_control: - type: ephemeral - output: - format: json - validation_mode: json_schema - schema_path: dnd_item_occurrences_llm.v1.json - repair_attempts: 1 + - id: dnd.item_occurrences + default_profile: notarius/dnd-extraction + inputs: + - name: transcript + required: true + content_type: application/json + - name: players + required: false + content_type: text/plain + - name: party + required: false + content_type: text/plain + - name: glossary + required: false + content_type: text/plain + - name: item_registry + required: true + content_type: application/json + messages: + - role: system + content_file: ../../shared/prompts/common-dnd-system.md + - role: user + content_file: ../../shared/prompts/common-dnd-identity.md + - role: user + content_file: ../../shared/prompts/common-dnd-references.md + cache_control: + type: ephemeral + - role: user + content_file: ../../shared/prompts/common-dnd-transcript-chunk.md + cache_control: + type: ephemeral + - role: user + content_file: ../../shared/prompts/common-dnd-extraction-evidence.md + - role: user + content_file: ./item-registry.md + - role: user + content_file: ./instructions.md + cache_control: + type: ephemeral + output: + format: json + validation_mode: json_schema + schema_path: dnd/item-occurrences/schemas/dnd_item_occurrences_llm.v1.json diff --git a/assets/dnd/item-registry/extract/prompts/prompt.yaml b/assets/dnd/item-registry/extract/prompts/prompt.yaml index 873c8217..a8bd4d80 100644 --- a/assets/dnd/item-registry/extract/prompts/prompt.yaml +++ b/assets/dnd/item-registry/extract/prompts/prompt.yaml @@ -1,41 +1,39 @@ prompts: - dnd.item_registry: - v1: - default_profile: dnd-extraction - inputs: - - name: transcript - required: true - content_type: application/json - - name: players - required: false - content_type: text/plain - - name: party - required: false - content_type: text/plain - - name: glossary - required: false - content_type: text/plain - messages: - - role: system - content_file: ./sharedassets/common-dnd-system.md - - role: user - content_file: ./sharedassets/common-dnd-identity.md - - role: user - content_file: ./sharedassets/common-dnd-references.md - cache_control: - type: ephemeral - - role: user - content_file: ./sharedassets/common-dnd-transcript-chunk.md - cache_control: - type: ephemeral - - role: user - content_file: ./sharedassets/common-dnd-extraction-evidence.md - - role: user - content_file: ./instructions.md - cache_control: - type: ephemeral - output: - format: json - validation_mode: json_schema - schema_path: dnd_item_registry_llm.v1.json - repair_attempts: 1 + - id: dnd.item_registry + default_profile: notarius/dnd-extraction + inputs: + - name: transcript + required: true + content_type: application/json + - name: players + required: false + content_type: text/plain + - name: party + required: false + content_type: text/plain + - name: glossary + required: false + content_type: text/plain + messages: + - role: system + content_file: ../../../shared/prompts/common-dnd-system.md + - role: user + content_file: ../../../shared/prompts/common-dnd-identity.md + - role: user + content_file: ../../../shared/prompts/common-dnd-references.md + cache_control: + type: ephemeral + - role: user + content_file: ../../../shared/prompts/common-dnd-transcript-chunk.md + cache_control: + type: ephemeral + - role: user + content_file: ../../../shared/prompts/common-dnd-extraction-evidence.md + - role: user + content_file: ./instructions.md + cache_control: + type: ephemeral + output: + format: json + validation_mode: json_schema + schema_path: dnd/item-registry/extract/schemas/dnd_item_registry_llm.v1.json diff --git a/assets/dnd/item-registry/normalize/prompts/prompt.yaml b/assets/dnd/item-registry/normalize/prompts/prompt.yaml index 1d95f859..4a2b0b02 100644 --- a/assets/dnd/item-registry/normalize/prompts/prompt.yaml +++ b/assets/dnd/item-registry/normalize/prompts/prompt.yaml @@ -1,31 +1,29 @@ prompts: - dnd.item_registry.normalize: - v1: - default_profile: dnd-extraction - inputs: - - name: candidates - required: true - content_type: application/json - - name: transcript - required: true - content_type: application/json - messages: - - role: system - content_file: ./sharedassets/common-dnd-system.md - - role: user - content_file: ./sharedassets/protocol.md - - role: user - content_file: ./instructions.md - cache_control: - type: ephemeral - - role: user - content_file: ./sharedassets/candidates.md - - role: user - content_file: ./sharedassets/transcript-windows.md - cache_control: - type: ephemeral - output: - format: json - validation_mode: json_schema - schema_path: semantic_reconciliation_llm.v1.json - repair_attempts: 1 + - id: dnd.item_registry.normalize + default_profile: notarius/dnd-extraction + inputs: + - name: candidates + required: true + content_type: application/json + - name: transcript + required: true + content_type: application/json + messages: + - role: system + content_file: ../../../shared/prompts/common-dnd-system.md + - role: user + content_file: ../../../../generic/normalize/deduplication/prompts/protocol.md + - role: user + content_file: ./instructions.md + cache_control: + type: ephemeral + - role: user + content_file: ../../../../generic/normalize/deduplication/prompts/candidates.md + - role: user + content_file: ../../../../generic/normalize/deduplication/prompts/transcript-windows.md + cache_control: + type: ephemeral + output: + format: json + validation_mode: json_schema + schema_path: generic/normalize/deduplication/schemas/semantic_reconciliation_llm.v1.json diff --git a/assets/dnd/location-occurrences/prompts/prompt.yaml b/assets/dnd/location-occurrences/prompts/prompt.yaml index 8d7bf9b5..b7476aff 100644 --- a/assets/dnd/location-occurrences/prompts/prompt.yaml +++ b/assets/dnd/location-occurrences/prompts/prompt.yaml @@ -1,46 +1,44 @@ prompts: - dnd.location_occurrences: - v1: - default_profile: dnd-extraction - inputs: - - name: transcript - required: true - content_type: application/json - - name: players - required: false - content_type: text/plain - - name: party - required: false - content_type: text/plain - - name: glossary - required: false - content_type: text/plain - - name: location_registry - required: true - content_type: application/json - messages: - - role: system - content_file: ./sharedassets/common-dnd-system.md - - role: user - content_file: ./sharedassets/common-dnd-identity.md - - role: user - content_file: ./sharedassets/common-dnd-references.md - cache_control: - type: ephemeral - - role: user - content_file: ./sharedassets/common-dnd-transcript-chunk.md - cache_control: - type: ephemeral - - role: user - content_file: ./sharedassets/common-dnd-extraction-evidence.md - - role: user - content_file: ./location-registry.md - - role: user - content_file: ./instructions.md - cache_control: - type: ephemeral - output: - format: json - validation_mode: json_schema - schema_path: dnd_location_occurrences_llm.v1.json - repair_attempts: 1 + - id: dnd.location_occurrences + default_profile: notarius/dnd-extraction + inputs: + - name: transcript + required: true + content_type: application/json + - name: players + required: false + content_type: text/plain + - name: party + required: false + content_type: text/plain + - name: glossary + required: false + content_type: text/plain + - name: location_registry + required: true + content_type: application/json + messages: + - role: system + content_file: ../../shared/prompts/common-dnd-system.md + - role: user + content_file: ../../shared/prompts/common-dnd-identity.md + - role: user + content_file: ../../shared/prompts/common-dnd-references.md + cache_control: + type: ephemeral + - role: user + content_file: ../../shared/prompts/common-dnd-transcript-chunk.md + cache_control: + type: ephemeral + - role: user + content_file: ../../shared/prompts/common-dnd-extraction-evidence.md + - role: user + content_file: ./location-registry.md + - role: user + content_file: ./instructions.md + cache_control: + type: ephemeral + output: + format: json + validation_mode: json_schema + schema_path: dnd/location-occurrences/schemas/dnd_location_occurrences_llm.v1.json diff --git a/assets/dnd/location-registry/extract/prompts/prompt.yaml b/assets/dnd/location-registry/extract/prompts/prompt.yaml index 92837de5..af80929f 100644 --- a/assets/dnd/location-registry/extract/prompts/prompt.yaml +++ b/assets/dnd/location-registry/extract/prompts/prompt.yaml @@ -1,41 +1,39 @@ prompts: - dnd.location_registry: - v1: - default_profile: dnd-extraction - inputs: - - name: transcript - required: true - content_type: application/json - - name: players - required: false - content_type: text/plain - - name: party - required: false - content_type: text/plain - - name: glossary - required: false - content_type: text/plain - messages: - - role: system - content_file: ./sharedassets/common-dnd-system.md - - role: user - content_file: ./sharedassets/common-dnd-identity.md - - role: user - content_file: ./sharedassets/common-dnd-references.md - cache_control: - type: ephemeral - - role: user - content_file: ./sharedassets/common-dnd-transcript-chunk.md - cache_control: - type: ephemeral - - role: user - content_file: ./sharedassets/common-dnd-extraction-evidence.md - - role: user - content_file: ./instructions.md - cache_control: - type: ephemeral - output: - format: json - validation_mode: json_schema - schema_path: dnd_location_registry_llm.v1.json - repair_attempts: 1 + - id: dnd.location_registry + default_profile: notarius/dnd-extraction + inputs: + - name: transcript + required: true + content_type: application/json + - name: players + required: false + content_type: text/plain + - name: party + required: false + content_type: text/plain + - name: glossary + required: false + content_type: text/plain + messages: + - role: system + content_file: ../../../shared/prompts/common-dnd-system.md + - role: user + content_file: ../../../shared/prompts/common-dnd-identity.md + - role: user + content_file: ../../../shared/prompts/common-dnd-references.md + cache_control: + type: ephemeral + - role: user + content_file: ../../../shared/prompts/common-dnd-transcript-chunk.md + cache_control: + type: ephemeral + - role: user + content_file: ../../../shared/prompts/common-dnd-extraction-evidence.md + - role: user + content_file: ./instructions.md + cache_control: + type: ephemeral + output: + format: json + validation_mode: json_schema + schema_path: dnd/location-registry/extract/schemas/dnd_location_registry_llm.v1.json diff --git a/assets/dnd/location-registry/normalize/prompts/prompt.yaml b/assets/dnd/location-registry/normalize/prompts/prompt.yaml index 5811aa04..9f361245 100644 --- a/assets/dnd/location-registry/normalize/prompts/prompt.yaml +++ b/assets/dnd/location-registry/normalize/prompts/prompt.yaml @@ -1,31 +1,29 @@ prompts: - dnd.location_registry.normalize: - v1: - default_profile: dnd-extraction - inputs: - - name: candidates - required: true - content_type: application/json - - name: transcript - required: true - content_type: application/json - messages: - - role: system - content_file: ./sharedassets/common-dnd-system.md - - role: user - content_file: ./sharedassets/protocol.md - - role: user - content_file: ./instructions.md - cache_control: - type: ephemeral - - role: user - content_file: ./sharedassets/candidates.md - - role: user - content_file: ./sharedassets/transcript-windows.md - cache_control: - type: ephemeral - output: - format: json - validation_mode: json_schema - schema_path: semantic_reconciliation_llm.v1.json - repair_attempts: 1 + - id: dnd.location_registry.normalize + default_profile: notarius/dnd-extraction + inputs: + - name: candidates + required: true + content_type: application/json + - name: transcript + required: true + content_type: application/json + messages: + - role: system + content_file: ../../../shared/prompts/common-dnd-system.md + - role: user + content_file: ../../../../generic/normalize/deduplication/prompts/protocol.md + - role: user + content_file: ./instructions.md + cache_control: + type: ephemeral + - role: user + content_file: ../../../../generic/normalize/deduplication/prompts/candidates.md + - role: user + content_file: ../../../../generic/normalize/deduplication/prompts/transcript-windows.md + cache_control: + type: ephemeral + output: + format: json + validation_mode: json_schema + schema_path: generic/normalize/deduplication/schemas/semantic_reconciliation_llm.v1.json diff --git a/assets/dnd/npc-occurrences/prompts/prompt.yaml b/assets/dnd/npc-occurrences/prompts/prompt.yaml index b1eaeff9..27695658 100644 --- a/assets/dnd/npc-occurrences/prompts/prompt.yaml +++ b/assets/dnd/npc-occurrences/prompts/prompt.yaml @@ -1,46 +1,44 @@ prompts: - dnd.npc_occurrences: - v1: - default_profile: dnd-extraction - inputs: - - name: transcript - required: true - content_type: application/json - - name: players - required: false - content_type: text/plain - - name: party - required: false - content_type: text/plain - - name: glossary - required: false - content_type: text/plain - - name: npc_registry - required: true - content_type: application/json - messages: - - role: system - content_file: ./sharedassets/common-dnd-system.md - - role: user - content_file: ./sharedassets/common-dnd-identity.md - - role: user - content_file: ./sharedassets/common-dnd-references.md - cache_control: - type: ephemeral - - role: user - content_file: ./sharedassets/common-dnd-transcript-chunk.md - cache_control: - type: ephemeral - - role: user - content_file: ./sharedassets/common-dnd-extraction-evidence.md - - role: user - content_file: ./sharedassets/common-dnd-npc-registry.md - - role: user - content_file: ./instructions.md - cache_control: - type: ephemeral - output: - format: json - validation_mode: json_schema - schema_path: dnd_npc_occurrences_llm.v1.json - repair_attempts: 1 + - id: dnd.npc_occurrences + default_profile: notarius/dnd-extraction + inputs: + - name: transcript + required: true + content_type: application/json + - name: players + required: false + content_type: text/plain + - name: party + required: false + content_type: text/plain + - name: glossary + required: false + content_type: text/plain + - name: npc_registry + required: true + content_type: application/json + messages: + - role: system + content_file: ../../shared/prompts/common-dnd-system.md + - role: user + content_file: ../../shared/prompts/common-dnd-identity.md + - role: user + content_file: ../../shared/prompts/common-dnd-references.md + cache_control: + type: ephemeral + - role: user + content_file: ../../shared/prompts/common-dnd-transcript-chunk.md + cache_control: + type: ephemeral + - role: user + content_file: ../../shared/prompts/common-dnd-extraction-evidence.md + - role: user + content_file: ../../shared/prompts/common-dnd-npc-registry.md + - role: user + content_file: ./instructions.md + cache_control: + type: ephemeral + output: + format: json + validation_mode: json_schema + schema_path: dnd/npc-occurrences/schemas/dnd_npc_occurrences_llm.v1.json diff --git a/assets/dnd/npc-registry/extract/prompts/prompt.yaml b/assets/dnd/npc-registry/extract/prompts/prompt.yaml index 849140a2..1b209d1c 100644 --- a/assets/dnd/npc-registry/extract/prompts/prompt.yaml +++ b/assets/dnd/npc-registry/extract/prompts/prompt.yaml @@ -1,41 +1,39 @@ prompts: - dnd.npc_registry: - v1: - default_profile: dnd-extraction - inputs: - - name: transcript - required: true - content_type: application/json - - name: players - required: false - content_type: text/plain - - name: party - required: false - content_type: text/plain - - name: glossary - required: false - content_type: text/plain - messages: - - role: system - content_file: ./sharedassets/common-dnd-system.md - - role: user - content_file: ./sharedassets/common-dnd-identity.md - - role: user - content_file: ./sharedassets/common-dnd-references.md - cache_control: - type: ephemeral - - role: user - content_file: ./sharedassets/common-dnd-transcript-chunk.md - cache_control: - type: ephemeral - - role: user - content_file: ./sharedassets/common-dnd-extraction-evidence.md - - role: user - content_file: ./instructions.md - cache_control: - type: ephemeral - output: - format: json - validation_mode: json_schema - schema_path: dnd_npc_registry_llm.v1.json - repair_attempts: 1 + - id: dnd.npc_registry + default_profile: notarius/dnd-extraction + inputs: + - name: transcript + required: true + content_type: application/json + - name: players + required: false + content_type: text/plain + - name: party + required: false + content_type: text/plain + - name: glossary + required: false + content_type: text/plain + messages: + - role: system + content_file: ../../../shared/prompts/common-dnd-system.md + - role: user + content_file: ../../../shared/prompts/common-dnd-identity.md + - role: user + content_file: ../../../shared/prompts/common-dnd-references.md + cache_control: + type: ephemeral + - role: user + content_file: ../../../shared/prompts/common-dnd-transcript-chunk.md + cache_control: + type: ephemeral + - role: user + content_file: ../../../shared/prompts/common-dnd-extraction-evidence.md + - role: user + content_file: ./instructions.md + cache_control: + type: ephemeral + output: + format: json + validation_mode: json_schema + schema_path: dnd/npc-registry/extract/schemas/dnd_npc_registry_llm.v1.json diff --git a/assets/dnd/npc-registry/normalize/prompts/prompt.yaml b/assets/dnd/npc-registry/normalize/prompts/prompt.yaml index bd9f9cbc..9ec3d8c1 100644 --- a/assets/dnd/npc-registry/normalize/prompts/prompt.yaml +++ b/assets/dnd/npc-registry/normalize/prompts/prompt.yaml @@ -1,31 +1,29 @@ prompts: - dnd.npc_registry.normalize: - v1: - default_profile: dnd-extraction - inputs: - - name: candidates - required: true - content_type: application/json - - name: transcript - required: true - content_type: application/json - messages: - - role: system - content_file: ./sharedassets/common-dnd-system.md - - role: user - content_file: ./sharedassets/protocol.md - - role: user - content_file: ./instructions.md - cache_control: - type: ephemeral - - role: user - content_file: ./sharedassets/candidates.md - - role: user - content_file: ./sharedassets/transcript-windows.md - cache_control: - type: ephemeral - output: - format: json - validation_mode: json_schema - schema_path: semantic_reconciliation_llm.v1.json - repair_attempts: 1 + - id: dnd.npc_registry.normalize + default_profile: notarius/dnd-extraction + inputs: + - name: candidates + required: true + content_type: application/json + - name: transcript + required: true + content_type: application/json + messages: + - role: system + content_file: ../../../shared/prompts/common-dnd-system.md + - role: user + content_file: ../../../../generic/normalize/deduplication/prompts/protocol.md + - role: user + content_file: ./instructions.md + cache_control: + type: ephemeral + - role: user + content_file: ../../../../generic/normalize/deduplication/prompts/candidates.md + - role: user + content_file: ../../../../generic/normalize/deduplication/prompts/transcript-windows.md + cache_control: + type: ephemeral + output: + format: json + validation_mode: json_schema + schema_path: generic/normalize/deduplication/schemas/semantic_reconciliation_llm.v1.json diff --git a/assets/dnd/profiles/dnd-extraction.yaml b/assets/dnd/profiles/dnd-extraction.yaml index 75e5c76a..1466f8f6 100644 --- a/assets/dnd/profiles/dnd-extraction.yaml +++ b/assets/dnd/profiles/dnd-extraction.yaml @@ -1,5 +1,5 @@ profiles: - dnd-extraction: + - id: dnd-extraction backend: openrouter model: openai/gpt-5.6-luna timeout_seconds: 240 diff --git a/assets/dnd/scene-descriptions/prompts/prompt.yaml b/assets/dnd/scene-descriptions/prompts/prompt.yaml index df0272a7..c5c60c8b 100644 --- a/assets/dnd/scene-descriptions/prompts/prompt.yaml +++ b/assets/dnd/scene-descriptions/prompts/prompt.yaml @@ -1,41 +1,39 @@ prompts: - dnd.scene_descriptions: - v1: - default_profile: dnd-extraction - inputs: - - name: transcript - required: true - content_type: application/json - - name: players - required: false - content_type: text/plain - - name: party - required: false - content_type: text/plain - - name: glossary - required: false - content_type: text/plain - messages: - - role: system - content_file: ./sharedassets/common-dnd-system.md - - role: user - content_file: ./sharedassets/common-dnd-identity.md - - role: user - content_file: ./sharedassets/common-dnd-references.md - cache_control: - type: ephemeral - - role: user - content_file: ./sharedassets/common-dnd-transcript-chunk.md - cache_control: - type: ephemeral - - role: user - content_file: ./sharedassets/common-dnd-scene-combat-policy.md - - role: user - content_file: ./instructions.md - cache_control: - type: ephemeral - output: - format: json - validation_mode: json_schema - schema_path: dnd_scene_descriptions_llm.v1.json - repair_attempts: 1 + - id: dnd.scene_descriptions + default_profile: notarius/dnd-extraction + inputs: + - name: transcript + required: true + content_type: application/json + - name: players + required: false + content_type: text/plain + - name: party + required: false + content_type: text/plain + - name: glossary + required: false + content_type: text/plain + messages: + - role: system + content_file: ../../shared/prompts/common-dnd-system.md + - role: user + content_file: ../../shared/prompts/common-dnd-identity.md + - role: user + content_file: ../../shared/prompts/common-dnd-references.md + cache_control: + type: ephemeral + - role: user + content_file: ../../shared/prompts/common-dnd-transcript-chunk.md + cache_control: + type: ephemeral + - role: user + content_file: ../../shared/prompts/common-dnd-scene-combat-policy.md + - role: user + content_file: ./instructions.md + cache_control: + type: ephemeral + output: + format: json + validation_mode: json_schema + schema_path: dnd/scene-descriptions/schemas/dnd_scene_descriptions_llm.v1.json diff --git a/assets/dnd/scene-descriptions/validate/combat-semantics/prompts/prompt.yaml b/assets/dnd/scene-descriptions/validate/combat-semantics/prompts/prompt.yaml index a59b1fe9..7edddade 100644 --- a/assets/dnd/scene-descriptions/validate/combat-semantics/prompts/prompt.yaml +++ b/assets/dnd/scene-descriptions/validate/combat-semantics/prompts/prompt.yaml @@ -1,24 +1,22 @@ prompts: - dnd.scene_descriptions.validate_combat: - v1: - default_profile: dnd-extraction - inputs: - - name: transcript - required: true - content_type: application/json - messages: - - role: system - content_file: ./sharedassets/common-dnd-system.md - - role: user - content_file: ./sharedassets/common-dnd-scene-combat-policy.md - - role: user - content_file: ./instructions.md - - role: user - content_file: ./sharedassets/common-dnd-transcript-chunk.md - cache_control: - type: ephemeral - output: - format: json - validation_mode: json_schema - schema_path: dnd_scene_combat_semantics_llm.v1.json - repair_attempts: 1 + - id: dnd.scene_descriptions.validate_combat + default_profile: notarius/dnd-extraction + inputs: + - name: transcript + required: true + content_type: application/json + messages: + - role: system + content_file: ../../../../shared/prompts/common-dnd-system.md + - role: user + content_file: ../../../../shared/prompts/common-dnd-scene-combat-policy.md + - role: user + content_file: ./instructions.md + - role: user + content_file: ../../../../shared/prompts/common-dnd-transcript-chunk.md + cache_control: + type: ephemeral + output: + format: json + validation_mode: json_schema + schema_path: dnd/scene-descriptions/validate/combat-semantics/schemas/dnd_scene_combat_semantics_llm.v1.json diff --git a/assets/dnd/scenes/prompts/prompt.yaml b/assets/dnd/scenes/prompts/prompt.yaml index 4280771c..8116b52e 100644 --- a/assets/dnd/scenes/prompts/prompt.yaml +++ b/assets/dnd/scenes/prompts/prompt.yaml @@ -1,35 +1,33 @@ prompts: - dnd.scenes: - v1: - default_profile: dnd-extraction - inputs: - - name: transcript - required: true - content_type: application/json - - name: players - required: false - content_type: text/plain - - name: party - required: false - content_type: text/plain - - name: glossary - required: false - content_type: text/plain - messages: - - role: system - content_file: ./sharedassets/common-dnd-system.md - - role: user - content_file: ./sharedassets/common-dnd-references.md - cache_control: - type: ephemeral - - role: user - content_file: ./instructions.md - - role: user - content_file: ./sharedassets/common-dnd-transcript-full.md - cache_control: - type: ephemeral - output: - format: json - validation_mode: json_schema - schema_path: dnd_scenes_llm.v1.json - repair_attempts: 1 + - id: dnd.scenes + default_profile: notarius/dnd-extraction + inputs: + - name: transcript + required: true + content_type: application/json + - name: players + required: false + content_type: text/plain + - name: party + required: false + content_type: text/plain + - name: glossary + required: false + content_type: text/plain + messages: + - role: system + content_file: ../../shared/prompts/common-dnd-system.md + - role: user + content_file: ../../shared/prompts/common-dnd-references.md + cache_control: + type: ephemeral + - role: user + content_file: ./instructions.md + - role: user + content_file: ../../shared/prompts/common-dnd-transcript-full.md + cache_control: + type: ephemeral + output: + format: json + validation_mode: json_schema + schema_path: dnd/scenes/schemas/dnd_scenes_llm.v1.json diff --git a/assets/dnd/spells/prompts/prompt.yaml b/assets/dnd/spells/prompts/prompt.yaml index e62bb138..f62a2bb9 100644 --- a/assets/dnd/spells/prompts/prompt.yaml +++ b/assets/dnd/spells/prompts/prompt.yaml @@ -1,51 +1,49 @@ prompts: - dnd.spells: - v1: - default_profile: dnd-extraction - inputs: - - name: transcript - required: true - content_type: application/json - - name: spell_catalog - required: true - content_type: application/json - - name: players - required: false - content_type: text/plain - - name: party - required: false - content_type: text/plain - - name: glossary - required: false - content_type: text/plain - - name: npc_registry - required: false - content_type: application/json - messages: - - role: system - content_file: ./sharedassets/common-dnd-system.md - - role: user - content_file: ./sharedassets/common-dnd-identity.md - - role: user - content_file: ./sharedassets/common-dnd-references.md - cache_control: - type: ephemeral - - role: user - content_file: ./sharedassets/common-dnd-transcript-chunk.md - cache_control: - type: ephemeral - - role: user - content_file: ./sharedassets/common-dnd-extraction-evidence.md - - role: user - content_file: ./sharedassets/common-dnd-npc-registry.md - - role: user - content_file: ./spell-catalog.md - - role: user - content_file: ./instructions.md - cache_control: - type: ephemeral - output: - format: json - validation_mode: json_schema - schema_path: dnd_spells_llm.v1.json - repair_attempts: 1 + - id: dnd.spells + default_profile: notarius/dnd-extraction + inputs: + - name: transcript + required: true + content_type: application/json + - name: spell_catalog + required: true + content_type: application/json + - name: players + required: false + content_type: text/plain + - name: party + required: false + content_type: text/plain + - name: glossary + required: false + content_type: text/plain + - name: npc_registry + required: false + content_type: application/json + messages: + - role: system + content_file: ../../shared/prompts/common-dnd-system.md + - role: user + content_file: ../../shared/prompts/common-dnd-identity.md + - role: user + content_file: ../../shared/prompts/common-dnd-references.md + cache_control: + type: ephemeral + - role: user + content_file: ../../shared/prompts/common-dnd-transcript-chunk.md + cache_control: + type: ephemeral + - role: user + content_file: ../../shared/prompts/common-dnd-extraction-evidence.md + - role: user + content_file: ../../shared/prompts/common-dnd-npc-registry.md + - role: user + content_file: ./spell-catalog.md + - role: user + content_file: ./instructions.md + cache_control: + type: ephemeral + output: + format: json + validation_mode: json_schema + schema_path: dnd/spells/schemas/dnd_spells_llm.v1.json diff --git a/assets/generic/normalize/deduplication/prompts/prompt.yaml b/assets/generic/normalize/deduplication/prompts/prompt.yaml index 1b93fcf3..36f5554b 100644 --- a/assets/generic/normalize/deduplication/prompts/prompt.yaml +++ b/assets/generic/normalize/deduplication/prompts/prompt.yaml @@ -1,28 +1,26 @@ prompts: - generic.semantic_reconciliation: - v1: - inputs: - - name: candidates - required: true - content_type: application/json - - name: transcript - required: true - content_type: application/json - messages: - - role: system - content_file: ./system.md - - role: user - content_file: ./protocol.md - - role: user - content_file: ./instructions.md - cache_control: - type: ephemeral - - role: user - content_file: ./candidates.md - - role: user - content_file: ./transcript-windows.md - output: - format: json - validation_mode: json_schema - schema_path: semantic_reconciliation_llm.v1.json - repair_attempts: 1 + - id: generic.semantic_reconciliation + inputs: + - name: candidates + required: true + content_type: application/json + - name: transcript + required: true + content_type: application/json + messages: + - role: system + content_file: ./system.md + - role: user + content_file: ./protocol.md + - role: user + content_file: ./instructions.md + cache_control: + type: ephemeral + - role: user + content_file: ./candidates.md + - role: user + content_file: ./transcript-windows.md + output: + format: json + validation_mode: json_schema + schema_path: generic/normalize/deduplication/schemas/semantic_reconciliation_llm.v1.json diff --git a/assets/notarius.yml b/assets/notarius.yml new file mode 100644 index 00000000..fee15fd0 --- /dev/null +++ b/assets/notarius.yml @@ -0,0 +1,57 @@ +config: + imports: + - path: dnd/combat-turns/prompts/prompt.yaml + destination: [promptkit, collections, notarius] + required: true + - path: dnd/enemy-events/prompts/prompt.yaml + destination: [promptkit, collections, notarius] + required: true + - path: dnd/item-occurrences/prompts/prompt.yaml + destination: [promptkit, collections, notarius] + required: true + - path: dnd/item-registry/extract/prompts/prompt.yaml + destination: [promptkit, collections, notarius] + required: true + - path: dnd/item-registry/normalize/prompts/prompt.yaml + destination: [promptkit, collections, notarius] + required: true + - path: dnd/location-occurrences/prompts/prompt.yaml + destination: [promptkit, collections, notarius] + required: true + - path: dnd/location-registry/extract/prompts/prompt.yaml + destination: [promptkit, collections, notarius] + required: true + - path: dnd/location-registry/normalize/prompts/prompt.yaml + destination: [promptkit, collections, notarius] + required: true + - path: dnd/npc-occurrences/prompts/prompt.yaml + destination: [promptkit, collections, notarius] + required: true + - path: dnd/npc-registry/extract/prompts/prompt.yaml + destination: [promptkit, collections, notarius] + required: true + - path: dnd/npc-registry/normalize/prompts/prompt.yaml + destination: [promptkit, collections, notarius] + required: true + - path: dnd/scene-descriptions/prompts/prompt.yaml + destination: [promptkit, collections, notarius] + required: true + - path: dnd/scene-descriptions/validate/combat-semantics/prompts/prompt.yaml + destination: [promptkit, collections, notarius] + required: true + - path: dnd/scenes/prompts/prompt.yaml + destination: [promptkit, collections, notarius] + required: true + - path: dnd/spells/prompts/prompt.yaml + destination: [promptkit, collections, notarius] + required: true + - path: generic/normalize/deduplication/prompts/prompt.yaml + destination: [promptkit, collections, notarius] + required: true + - path: dnd/profiles/dnd-extraction.yaml + destination: [promptkit, collections, notarius] + required: true +promptkit: + collections: + notarius: + schema_root: . diff --git a/assets/package.go b/assets/package.go index 5f6838fd..772440ac 100644 --- a/assets/package.go +++ b/assets/package.go @@ -6,7 +6,7 @@ import ( "io/fs" ) -//go:embed dnd generic +//go:embed notarius.yml dnd generic var embedded embed.FS // FS returns the embedded read-only asset filesystem. diff --git a/assets/package_test.go b/assets/package_test.go new file mode 100644 index 00000000..14bbb684 --- /dev/null +++ b/assets/package_test.go @@ -0,0 +1,159 @@ +package assets_test + +import ( + "context" + "encoding/json" + "errors" + "fmt" + "io/fs" + "path" + "reflect" + "strings" + "testing" + + "gitea.maximumdirect.net/eric/notarius/assets" + "go.maximumdirect.net/configkit" + "go.maximumdirect.net/promptkit" + "go.yaml.in/yaml/v4" +) + +type assetSettings struct { + PromptKit promptkit.Settings `yaml:"promptkit"` +} + +type noGeneration struct{ t *testing.T } + +func (client noGeneration) Generate(context.Context, promptkit.GenerateRequest) (*promptkit.GenerateResponse, error) { + client.t.Error("resource preparation unexpectedly invoked generation") + return nil, fmt.Errorf("unexpected generation") +} + +func loadNativeAssets(t *testing.T) (*configkit.Result[assetSettings], *promptkit.Engine) { + t.Helper() + filesystem := configkit.NewFilesystem("Notarius assets", assets.FS()) + definition := promptkit.Configure(configkit.Definition[assetSettings]{}, func(value *assetSettings) *promptkit.Settings { return &value.PromptKit }) + result, err := configkit.LoadLayered(configkit.Input{Source: configkit.NoSource()}, configkit.LayeredOptions[assetSettings]{ + Definition: definition, + Underlays: []configkit.Underlay{ + promptkit.BundledOpenRouterUnderlay(), + {Inputs: []configkit.Input{{ + Source: filesystem.File("notarius.yml"), Imports: true, + Filesystem: &configkit.FilesystemContext{FS: &filesystem, Root: "."}, + }}}, + }, + }) + if err != nil { + var loadError *configkit.LoadError + if errors.As(err, &loadError) { + for _, diagnostic := range loadError.Diagnostics() { + t.Logf("%+v", diagnostic) + } + } + t.Fatal(err) + } + engine, err := promptkit.NewFromConfig(result, promptkit.RuntimeConfig{}, promptkit.WithLLMClient(noGeneration{t})) + if err != nil { + t.Fatal(err) + } + return result, engine +} + +func TestEmbeddedPromptsPrepareWithNativeContracts(t *testing.T) { + t.Parallel() + _, engine := loadNativeAssets(t) + // Discover the actual declarations as well as the composed inventory, so an + // accidentally omitted import cannot silently remove a module's coverage. + err := fs.WalkDir(assets.FS(), ".", func(file string, entry fs.DirEntry, err error) error { + if err != nil { + return err + } + if entry.IsDir() || path.Base(file) != "prompt.yaml" { + return nil + } + data, err := fs.ReadFile(assets.FS(), file) + if err != nil { + return err + } + var declared struct { + Prompts []promptkit.PromptSettings `yaml:"prompts"` + } + if err := yaml.Unmarshal(data, &declared); err != nil { + return err + } + if len(declared.Prompts) == 0 { + return fmt.Errorf("%s has no native prompts", file) + } + for _, prompt := range declared.Prompts { + t.Run(prompt.ID, func(t *testing.T) { + inputs := make(map[string]promptkit.ArtifactRef) + for _, input := range prompt.Inputs { + inputs[input.Name] = promptkit.Inline(input.Name + "-fixture") + } + request := promptkit.RunRequest{PromptID: "notarius/" + prompt.ID, Inputs: inputs, APIKey: "fixture-key"} + if prompt.DefaultProfile == nil { + request.ProfileID = "notarius/dnd-extraction" + } + prepared, err := engine.PrepareExecution(context.Background(), request) + if err != nil { + t.Fatal(err) + } + defer prepared.Discard() + details := prepared.Details() + if details.OutputContract.Format != promptkit.FormatJSON || details.OutputContract.ValidationMode != promptkit.ValidationJSONSchema || details.StructuredOutput == nil || details.StructuredOutput.JSONSchema == nil { + t.Fatalf("missing native schema contract: %#v", details.OutputContract) + } + // Preparation must load the real self-contained schema, not merely retain + // a filename or use a separate application schema registry. + schemaBytes, err := fs.ReadFile(assets.FS(), details.OutputContract.SchemaPath) + if err != nil { + t.Fatal(err) + } + var expected any + if err := json.Unmarshal(schemaBytes, &expected); err != nil { + t.Fatal(err) + } + actualBytes, err := json.Marshal(details.StructuredOutput.JSONSchema.Schema) + if err != nil { + t.Fatal(err) + } + var actual any + if err := json.Unmarshal(actualBytes, &actual); err != nil { + t.Fatal(err) + } + if !reflect.DeepEqual(actual, expected) { + t.Fatal("prepared schema differs from the owned asset") + } + first := prompt.Messages[0] + if first.ContentFile == nil { + t.Fatal("expected a source-relative initial message") + } + content, err := fs.ReadFile(assets.FS(), path.Join(path.Dir(file), *first.ContentFile)) + if err != nil { + t.Fatal(err) + } + if len(details.Messages) == 0 || details.Messages[0].Role != "system" || strings.TrimSpace(details.Messages[0].Content) != strings.TrimSpace(string(content)) { + t.Fatal("shared initial system context was not preserved") + } + }) + } + return nil + }) + if err != nil { + t.Fatal(err) + } +} + +func TestEmbeddedProfileRetainsSelectedExecutionDefaults(t *testing.T) { + t.Parallel() + _, engine := loadNativeAssets(t) + profile, err := engine.InspectProfile(context.Background(), "notarius/dnd-extraction") + if err != nil { + t.Fatal(err) + } + if profile.Backend == nil || *profile.Backend != "openrouter" || + profile.Model == nil || *profile.Model != "openai/gpt-5.6-luna" || + profile.TimeoutSeconds == nil || *profile.TimeoutSeconds != 240 || + profile.ServiceTier == nil || *profile.ServiceTier != "flex" || profile.ReasoningEffort != nil { + t.Fatalf("changed extraction defaults: %#v", profile) + } +} diff --git a/docs/roadmap/implementation.md b/docs/roadmap/implementation.md index f9a094a0..aee184b6 100644 --- a/docs/roadmap/implementation.md +++ b/docs/roadmap/implementation.md @@ -214,6 +214,16 @@ worker positivity, and explicit-empty path behavior. ## Stage 4: Convert Embedded Initial Resources And Schema Declarations +**Status:** Complete. Converted all 16 initial/validator/reconciliation prompt +declarations and the extraction profile to native identified lists. The embedded +`assets/notarius.yml` imports them into the `notarius` collection with its own +filesystem-rooted schemas. Real shared-file paths replace virtual mounts; schema +bytes, prose, message order, and cache hints are unchanged. Native offline loading +and preparation of every declaration pass in `GOWORK=off go test ./assets`, +including exact loaded-schema comparisons and selected profile defaults. +`git diff --check` passed. Module caller/manifest migration remains in its assigned +later stages; no intermediate whole-tree compilation claim is made. + **Goal:** native declarations become the only default prompt/schema assembly. **Inspect/change:** existing `assets/**/prompts/prompt.yaml`,