From 1515acdd4adeea5968b23e52ea426b2f7c3b7d31 Mon Sep 17 00:00:00 2001 From: Eric Rakestraw Date: Tue, 26 May 2026 19:47:13 -0500 Subject: [PATCH] Added a scene_map prompt and corrsponding schema --- .../openrouter/openrouter-gemma-4-31b.yml | 2 +- .../analyze/scene_map/scene_map.system.md | 7 + .../analyze/scene_map/scene_map.user.md | 119 +++++++++++++++ .../analyze/scene_map/scene_map.yml | 26 ++++ .../{ => session_recap}/recap.system.md | 0 .../analyze/{ => session_recap}/recap.user.md | 0 .../analyze/{ => session_recap}/recap.yml | 0 .../analyze/scene_map.schema.json | 135 ++++++++++++++++++ 8 files changed, 288 insertions(+), 1 deletion(-) create mode 100644 prompts/automation-pipeline-dnd/analyze/scene_map/scene_map.system.md create mode 100644 prompts/automation-pipeline-dnd/analyze/scene_map/scene_map.user.md create mode 100644 prompts/automation-pipeline-dnd/analyze/scene_map/scene_map.yml rename prompts/automation-pipeline-dnd/analyze/{ => session_recap}/recap.system.md (100%) rename prompts/automation-pipeline-dnd/analyze/{ => session_recap}/recap.user.md (100%) rename prompts/automation-pipeline-dnd/analyze/{ => session_recap}/recap.yml (100%) create mode 100644 schemas/automation-pipeline-dnd/analyze/scene_map.schema.json diff --git a/profiles/openrouter/openrouter-gemma-4-31b.yml b/profiles/openrouter/openrouter-gemma-4-31b.yml index 6faf9dc..d3b33a6 100644 --- a/profiles/openrouter/openrouter-gemma-4-31b.yml +++ b/profiles/openrouter/openrouter-gemma-4-31b.yml @@ -1,6 +1,6 @@ id: openrouter-gemma4-31b endpoint: https://openrouter.ai/api/v1 -model: google/gemma-4-31b-it +model: google/gemma-4-31b-it:exacto temperature: 0.15 reasoning_effort: high top_p: 0.98 diff --git a/prompts/automation-pipeline-dnd/analyze/scene_map/scene_map.system.md b/prompts/automation-pipeline-dnd/analyze/scene_map/scene_map.system.md new file mode 100644 index 0000000..068a042 --- /dev/null +++ b/prompts/automation-pipeline-dnd/analyze/scene_map/scene_map.system.md @@ -0,0 +1,7 @@ +You are a careful transcript segmentation assistant. + +Your job is to divide a D&D session transcript into coherent scenes for downstream analysis. + +Follow the user’s instructions exactly. Use only the provided transcript and metadata. Do not invent facts, infer campaign history, analyze character performance, or produce a narrative recap. + +Return only valid JSON that conforms to the requested schema. Do not include Markdown, comments, explanations, or text outside the JSON object. \ No newline at end of file diff --git a/prompts/automation-pipeline-dnd/analyze/scene_map/scene_map.user.md b/prompts/automation-pipeline-dnd/analyze/scene_map/scene_map.user.md new file mode 100644 index 0000000..3bd53dd --- /dev/null +++ b/prompts/automation-pipeline-dnd/analyze/scene_map/scene_map.user.md @@ -0,0 +1,119 @@ +Generate a structured scene map for the provided D&D session transcript. + +This is an intermediate artifact for an automated analysis pipeline. Your task is only to divide the transcript into coherent scenes. Do not produce a session recap, character analysis, tactical analysis, continuity analysis, or recommendations. + +Use the transcript as the source of truth. Optional metadata, character roster, and glossary are provided only to help identify speakers, characters, places, factions, spells, items, and proper nouns. + +Return only valid JSON matching the provided JSON Schema. + +Use the following party roster to resolve speakers and character references: + +- Mike Brown: DM +- Eric Rakestraw: Player (Hrank Greenfield, Nature Cleric of Chauntea) +- Adam Rakestraw: Player (Alan Hohey, Druid) +- Zach Anthony: Player (Svend Balderk, Barbarian) +- Clint Twellman: Player (Popov, Paladin) + +Task: + +Divide the transcript into sequential, contiguous, non-overlapping scenes. + +A scene is a coherent unit of play. A new scene should usually begin when there is a meaningful change in location, objective, threat, activity, encounter, or mode of play. + +Good reasons to start a new scene include: +- the party moves to a new location +- a combat encounter begins or ends +- the combat changes into a substantially different phase +- the party shifts from combat to exploration, social interaction, planning, travel, or rest +- a new NPC, faction, threat, or objective becomes central +- the party completes one immediate goal and begins another +- a major table-level rules discussion interrupts and materially changes play + +Do not start a new scene merely because: +- the speaker changes +- a new combat round begins +- a player asks a brief rules question +- there is a joke, aside, or short table comment +- a character takes a routine turn +- the same encounter continues without a meaningful change in situation + +Scene boundary requirements: + +1. Cover the transcript from the first relevant segment to the last relevant segment. +2. Do not leave gaps between scenes. +3. Do not overlap scenes. +4. Preserve transcript order. +5. Use exact segment IDs from the transcript. +6. Each scene must have a start_segment_id and end_segment_id. +7. Scene IDs must be sequential: SCN-001, SCN-002, SCN-003, and so on. +8. Prefer coherent scenes over excessive fragmentation. +9. Do not merge unrelated scenes just to keep the scene count low. +10. If a boundary is uncertain, choose the most practical boundary and explain the uncertainty in boundary_note. + +For each scene: + +- short_title should be brief and factual. +- primary_mode must use one of the allowed schema values. +- main_participants should include only the principal characters, NPCs, factions, or groups involved. +- summary should be factual and compact, usually one to three sentences. +- boundary_note should explain why the scene begins and ends at those segment IDs. +- boundary_confidence should be High, Medium, or Low. + +Primary mode guidance: + +Use Recap / Setup for opening recap, initiative setup, session framing, or immediate continuation from prior events. + +Use Combat when active combat or combat-resolution mechanics dominate. + +Use Social when conversation, negotiation, persuasion, interrogation, or NPC interaction dominates. + +Use Exploration when the party is investigating, scouting, navigating, searching, or probing the environment. + +Use Travel when movement between locations is the main activity. + +Use Planning when the party is primarily discussing options or choosing a course of action. + +Use Rest / Recovery when resting, healing, resource recovery, or post-encounter recovery dominates. + +Use Rules / Table Discussion only when table-level rules, mechanics, or adjudication dominate enough to form their own scene. + +Use Mixed only when no single mode clearly dominates. + +Session scope requirements: + +In session_scope.source_description, briefly describe the transcript reviewed. + +In session_scope.first_segment_id, provide the first segment ID covered by the scene map. + +In session_scope.last_segment_id, provide the last segment ID covered by the scene map. + +In session_scope.limitations, list any limitations that affect scene segmentation, such as: +- missing prior-session context +- unclear speaker attribution +- overlapping speech +- map-dependent positioning +- visual tabletop references not visible in the transcript +- ambiguous transitions +- uncertain proper nouns + +Boundary caveats: + +In boundary_caveats, list any overall caveats about the scene divisions. Include scenes that could reasonably be split differently, combat phases that were kept together, gradual transitions, or places where map context would have helped. + +Important restrictions: + +- Do not invent missing events. +- Do not include comments. +- Do not include explanatory text outside the JSON object. +- Do not wrap the JSON in a code block. +- Return exactly one JSON object. + +Before finalizing, check: + +- The first scene starts at the first covered transcript segment. +- The final scene ends at the last covered transcript segment. +- Scene ranges are sequential and non-overlapping. +- Every scene has a start_segment_id and end_segment_id. +- Every summary is factual and compact. +- Boundary uncertainty is noted rather than hidden. +- The output is valid JSON and conforms to the schema. \ No newline at end of file diff --git a/prompts/automation-pipeline-dnd/analyze/scene_map/scene_map.yml b/prompts/automation-pipeline-dnd/analyze/scene_map/scene_map.yml new file mode 100644 index 0000000..472c867 --- /dev/null +++ b/prompts/automation-pipeline-dnd/analyze/scene_map/scene_map.yml @@ -0,0 +1,26 @@ +id: dnd.scene_map +version: "1.0.0" +default_profile: openrouter-gemma-4-31b +description: Generates a D&D session scene map, using a transcript as input. +inputs: + - name: transcript + required: true + content_type: application/json + description: Structured recap source transcript +messages: + - role: system + content_file: ./scene_map.system.md + - role: user + content_file: ./scene_map.user.md + - role: user + content: | + <<>> +output: + format: json + validation_mode: json_schema + schema_path: automation-pipeline-dnd/analyze/scene_map.schema.json + repair_attempts: 0 \ No newline at end of file diff --git a/prompts/automation-pipeline-dnd/analyze/recap.system.md b/prompts/automation-pipeline-dnd/analyze/session_recap/recap.system.md similarity index 100% rename from prompts/automation-pipeline-dnd/analyze/recap.system.md rename to prompts/automation-pipeline-dnd/analyze/session_recap/recap.system.md diff --git a/prompts/automation-pipeline-dnd/analyze/recap.user.md b/prompts/automation-pipeline-dnd/analyze/session_recap/recap.user.md similarity index 100% rename from prompts/automation-pipeline-dnd/analyze/recap.user.md rename to prompts/automation-pipeline-dnd/analyze/session_recap/recap.user.md diff --git a/prompts/automation-pipeline-dnd/analyze/recap.yml b/prompts/automation-pipeline-dnd/analyze/session_recap/recap.yml similarity index 100% rename from prompts/automation-pipeline-dnd/analyze/recap.yml rename to prompts/automation-pipeline-dnd/analyze/session_recap/recap.yml diff --git a/schemas/automation-pipeline-dnd/analyze/scene_map.schema.json b/schemas/automation-pipeline-dnd/analyze/scene_map.schema.json new file mode 100644 index 0000000..0f1fc7b --- /dev/null +++ b/schemas/automation-pipeline-dnd/analyze/scene_map.schema.json @@ -0,0 +1,135 @@ +{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "title": "D&D Session Scene Map", + "description": "Structured scene segmentation for a D&D session transcript.", + "type": "object", + "additionalProperties": false, + "required": [ + "artifact_type", + "session_scope", + "scenes", + "boundary_caveats" + ], + "properties": { + "artifact_type": { + "type": "string", + "const": "current_session_scene_map" + }, + "session_scope": { + "type": "object", + "additionalProperties": false, + "required": [ + "source_description", + "first_segment_id", + "last_segment_id", + "limitations" + ], + "properties": { + "source_description": { + "type": "string", + "description": "Brief description of the transcript or source material reviewed." + }, + "first_segment_id": { + "type": "string", + "description": "The first transcript segment covered by the scene map." + }, + "last_segment_id": { + "type": "string", + "description": "The final transcript segment covered by the scene map." + }, + "limitations": { + "type": "array", + "description": "Known limitations affecting scene segmentation.", + "items": { + "type": "string" + } + } + } + }, + "scenes": { + "type": "array", + "description": "Sequential, contiguous, non-overlapping scene divisions covering the transcript.", + "minItems": 1, + "items": { + "type": "object", + "additionalProperties": false, + "required": [ + "scene_id", + "start_segment_id", + "end_segment_id", + "short_title", + "primary_mode", + "main_participants", + "summary", + "boundary_note", + "boundary_confidence" + ], + "properties": { + "scene_id": { + "type": "string", + "description": "Stable sequential scene identifier, such as SCN-001.", + "pattern": "^SCN-[0-9]{3}$" + }, + "start_segment_id": { + "type": "string", + "description": "Exact segment ID where this scene begins." + }, + "end_segment_id": { + "type": "string", + "description": "Exact segment ID where this scene ends." + }, + "short_title": { + "type": "string", + "description": "Compact descriptive title for the scene." + }, + "primary_mode": { + "type": "string", + "enum": [ + "Recap / Setup", + "Combat", + "Social", + "Exploration", + "Travel", + "Planning", + "Rest / Recovery", + "Rules / Table Discussion", + "Mixed" + ], + "description": "The dominant mode of play in the scene." + }, + "main_participants": { + "type": "array", + "description": "Principal player characters, NPCs, factions, or groups involved in the scene.", + "items": { + "type": "string" + } + }, + "summary": { + "type": "string", + "description": "One- to three-sentence factual summary of what happened in the scene." + }, + "boundary_note": { + "type": "string", + "description": "Brief explanation of why the scene starts and ends at these segment boundaries." + }, + "boundary_confidence": { + "type": "string", + "enum": [ + "High", + "Medium", + "Low" + ], + "description": "Confidence that the chosen scene boundaries are natural and useful." + } + } + } + }, + "boundary_caveats": { + "type": "array", + "description": "Overall caveats about scene segmentation, ambiguous transitions, map-dependent context, or alternative reasonable divisions.", + "items": { + "type": "string" + } + } + } +} \ No newline at end of file