Reorder shared D&D extraction prompt messages

This commit is contained in:
2026-07-21 14:22:46 +00:00
parent 1c9819f08e
commit 3a8a82ebc9
18 changed files with 147 additions and 99 deletions

View File

@@ -20,6 +20,12 @@ inputs:
messages:
- role: system
content_file: ./sharedassets/common-dnd-system.md
- role: user
content_file: ./sharedassets/common-dnd-extraction-evidence.md
- role: user
content_file: ./sharedassets/common-dnd-identity.md
cache_control:
type: ephemeral
- role: user
content_file: ./sharedassets/common-dnd-transcript.md
cache_control:
@@ -28,8 +34,12 @@ messages:
content_file: ./sharedassets/common-dnd-references.md
cache_control:
type: ephemeral
- role: user
content_file: ./sharedassets/common-dnd-immediate-resolution.md
- role: user
content_file: ./sharedassets/common-dnd-npcs.md
cache_control:
type: ephemeral
- role: user
content_file: ./task.md
- role: user

View File

@@ -1,12 +1,5 @@
Return exactly one JSON object and no explanatory text.
Return the combat_turns array even when no combat turn is established. Return
one or more actions for every turn. Use one of the supported turn_kind and
action category values. Set round to null when the transcript does not state
an explicit or unambiguous positive round number. Set resolution to null when
the transcript establishes the declaration but not an immediate resolution.
Every source reference must contain start_unit_id and end_unit_id from the
provided transcript. Do not add source_id; the extraction mapper assigns the
current source identity. Do not include fields not defined by the response
schema.
action category values. Set round to null when the transcript does not state an
explicit or unambiguous positive round number. Set resolution to null when the
transcript establishes the declaration but not an immediate resolution.

View File

@@ -5,26 +5,15 @@ participant takes a combat turn or performs a discrete interrupting combat
event. Reactions, legendary actions, lair actions, and other out-of-turn events
belong at the point where they occur in transcript chronology.
Report only the declaration and its immediate observed resolution. Immediate
resolution may include directly associated rolls, damage, healing, movement,
conditions, target outcomes, or an interruption. Do not follow consequences
that occur on later turns or elsewhere in the scene.
Exclude initiative setup without a turn or combat event, tactical planning,
table talk, rules lookup, hypothetical actions, abandoned declarations, recap
of combat outside the current passage, and downstream consequences.
Use only the supplied transcript as evidence. Do not infer a round, target,
roll, amount, condition, outcome, or action classification from D&D rules
knowledge. Preserve the session as played; attribute relevant nonstandard
rulings to the GM or table.
Do not infer a round, target, roll, amount, condition, outcome, or action
classification from D&D rules knowledge. Preserve the session as played;
attribute relevant nonstandard rulings to the GM or table.
The actor must be the in-world character or creature, not a player, transcript
speaker, or GM. Use player, party, glossary, and NPC reference material only
to disambiguate identities. Reference material is context, never combat
evidence. Unmatched actors and targets remain permitted.
Unmatched actors and targets remain permitted.
For every factual detail in a turn, cite all supporting transcript units in the
turn-level source_refs collection. Use narrow ranges when evidence is
non-contiguous. Numeric source-unit IDs identify transcript units; they do not
establish chronology outside the supplied transcript.
turn-level source_refs collection.

View File

@@ -20,8 +20,11 @@ var promptAssetManifest = shared.PromptAssetManifest{
},
SharedFiles: []string{
"common-dnd-system.md",
"common-dnd-extraction-evidence.md",
"common-dnd-identity.md",
"common-dnd-transcript.md",
"common-dnd-references.md",
"common-dnd-immediate-resolution.md",
"common-dnd-npcs.md",
},
}

View File

@@ -17,6 +17,12 @@ inputs:
messages:
- role: system
content_file: ./sharedassets/common-dnd-system.md
- role: user
content_file: ./sharedassets/common-dnd-extraction-evidence.md
- role: user
content_file: ./sharedassets/common-dnd-identity.md
cache_control:
type: ephemeral
- role: user
content_file: ./sharedassets/common-dnd-transcript.md
cache_control:

View File

@@ -1,18 +1,5 @@
Return exactly one JSON object and no explanatory text.
For every NPC record, cite one or more transcript source-unit ranges that
collectively support the canonical name, every alias, the description, and
every relationship. Use integer start_unit_id and end_unit_id values from the
transcript. Do not provide source_id; the extractor assigns it automatically.
Use narrow ranges when evidence is not contiguous and do not bridge unrelated
conversation with a broad range.
A canonical name must be the most specific in-world identity supported by the
transcript. Never use a human player, transcript speaker, or GM name when an
associated in-world character or creature is identified. Player, party, and
glossary references may disambiguate identities, but they are not transcript
evidence and cannot establish that an NPC appeared, acted, or was discussed.
Do not return a person or entity mentioned only in those references.
For every NPC record, cite transcript units that support the canonical name,
every alias, the description, and every relationship.
Descriptions must be short session records, not biographies, statistics,
alignment, motivations, or lore inferred from general D&D knowledge. Do not

View File

@@ -5,12 +5,11 @@ Include an in-world non-PC participant when the transcript establishes that it
appears, acts, speaks, or is materially discussed and gives it a proper name,
a stable alias or title, or an individually useful distinguishing description.
Exclude human players, transcript speakers, the GM as an out-of-world person,
Exclude human players, transcript speakers, and the GM as out-of-world people,
player characters identified by the player or party references, incidental or
hypothetical name drops, corrected transcription mistakes, characters mentioned
only by reference material, indistinguishable crowds or groups, and temporary
summoned creatures or spell effects without a persistent individual identity.
Return canonical in-world names rather than player names or transcript speaker
names. Keep each description concise and limited to facts established by the
Keep each description concise and limited to facts established by the
transcript. Include only explicitly supported aliases and relationships.

View File

@@ -20,6 +20,8 @@ var promptAssetManifest = shared.PromptAssetManifest{
},
SharedFiles: []string{
"common-dnd-system.md",
"common-dnd-extraction-evidence.md",
"common-dnd-identity.md",
"common-dnd-transcript.md",
"common-dnd-references.md",
},

View File

@@ -23,6 +23,12 @@ inputs:
messages:
- role: system
content_file: ./sharedassets/common-dnd-system.md
- role: user
content_file: ./sharedassets/common-dnd-extraction-evidence.md
- role: user
content_file: ./sharedassets/common-dnd-identity.md
cache_control:
type: ephemeral
- role: user
content_file: ./sharedassets/common-dnd-transcript.md
cache_control:
@@ -31,8 +37,12 @@ messages:
content_file: ./sharedassets/common-dnd-references.md
cache_control:
type: ephemeral
- role: user
content_file: ./sharedassets/common-dnd-immediate-resolution.md
- role: user
content_file: ./sharedassets/common-dnd-npcs.md
cache_control:
type: ephemeral
- role: user
content_file: ./catalog.md
- role: user

View File

@@ -1,40 +1,29 @@
Source references must use integer source-unit IDs from the transcript. Provide
start_unit_id and end_unit_id for each source reference; the extractor assigns
source_id automatically.
For each spell cast, source references must collectively support the caster,
spell, effect, and narrative_description. If a detail is not supported by the
cited transcript units, omit that detail or describe only the supported attempt
or declaration.
Report only the casting declaration or action and its immediate resolution.
This may include an immediately resolved target, saving throw, damage, healing,
condition, interruption, or outcome. Do not follow summoned creatures,
persistent effects, or other downstream consequences through the rest of the
scene.
For spells, do not follow summoned creatures, persistent effects, or other
downstream consequences through the rest of the scene.
For every detail you report, cite all supporting transcript units. The source
references for an artifact must collectively support every factual claim in
caster, spell, effect, and narrative_description. When immediate supporting
evidence is non-contiguous, provide multiple narrow source references. Do not
use one broad range merely to bridge unrelated table conversation. If a detail
is not supported by the cited transcript units, omit that detail or describe
only the supported attempt or declaration.
Return only D&D spell-cast artifacts. For each spell cast, identify the
in-world caster, spell name, effect, narrative description, and source
references.
Return only D&D spell-cast artifacts. For each spell cast, identify the in-world
caster, spell name, effect, narrative description, and source references.
The caster must be the canonical in-world character or creature, not the human
player, transcript speaker, or GM. Use the player and party references together
with transcript context to map first-person player speech to the associated
player character and use the canonical character name from the references.
Likewise, attribute a spell narrated by the GM to the in-world creature that
casts it. Never return a player or GM name when the associated in-world caster
can be identified. If the caster cannot be resolved, use only the most specific
in-world identity supported by the transcript; do not invent a name.
Use the player and party references together with transcript context to map
first-person player speech to the associated player character and use the
canonical character name from the references. Likewise, attribute a spell
narrated by the GM to the in-world creature that casts it. If the caster cannot
be resolved, use only the most specific in-world identity supported by the
transcript; do not invent a name.
Use the canonical spell-name catalog to select spell names. Do not return a
spell name absent from that catalog, even when it is suggested by general D&D
knowledge or reference material.
Use player, party, and glossary reference material only to clarify source text;
references are not source evidence for a spell cast. Do not return spells,
casters, or effects that are mentioned only in reference material.
Use player, party, and glossary reference material only to clarify source text.
Do not return spells, casters, or effects that are mentioned only in reference
material.
Effects and narrative descriptions are session records, not rules summaries.
Report only mechanics, explanations, and outcomes established by the cited
@@ -42,5 +31,3 @@ transcript units. Preserve the table's observed resolution without silently
correcting it from general D&D knowledge. If the transcript gives a possibly
nonstandard rationale, use wording such as "the GM rules" or "the table
resolves" rather than asserting that rationale as a universal rule.
Return exactly one JSON object and no explanatory text.

View File

@@ -21,8 +21,11 @@ var promptAssetManifest = shared.PromptAssetManifest{
},
SharedFiles: []string{
"common-dnd-system.md",
"common-dnd-extraction-evidence.md",
"common-dnd-identity.md",
"common-dnd-transcript.md",
"common-dnd-references.md",
"common-dnd-immediate-resolution.md",
"common-dnd-npcs.md",
},
}

View File

@@ -46,9 +46,12 @@ func TestScriptoriumPromptPreparesWithMissingOptionalReferences(t *testing.T) {
transcript := []byte(`{"id":"session-1","segments":[]}`)
prepared := prepareSpellsPrompt(t, transcript, " ", " ", " ")
if !strings.Contains(prepared.Messages[2].Content, " ") {
t.Fatalf("reference message did not include empty optional reference placeholders")
for _, message := range prepared.Messages {
if strings.Contains(message.Content, "Player list reference:") && strings.Contains(message.Content, "Party roster reference:") && strings.Contains(message.Content, "Glossary reference:") {
return
}
}
t.Fatalf("reference message did not render empty optional reference placeholders")
}
func TestScriptoriumPromptDiagnosticsOmitRawMaterials(t *testing.T) {