Reorder shared D&D extraction prompt messages
This commit is contained in:
@@ -98,6 +98,18 @@ D&D prompt content. `internal/framework/promptfs` provides the domain-neutral
|
||||
filesystem composition helper used to combine module-owned files with shared
|
||||
domain prompt fragments.
|
||||
|
||||
The D&D spell, NPC, and combat-turn extractors each declare an ordered prompt
|
||||
asset manifest. The manifest lists the package-owned YAML and Markdown files,
|
||||
then the exact shared fragments rendered by that prompt; the same ordered list
|
||||
drives both filesystem mounting and the prompt fingerprint. Shared extraction
|
||||
evidence and in-world identity messages precede the cacheable transcript and
|
||||
campaign-reference messages. Spell and combat prompts then render immediate
|
||||
resolution and the cacheable NPC registry before their lane-specific material;
|
||||
the NPC prompt renders its task and instructions instead. The identity,
|
||||
transcript, and campaign-reference messages are ephemeral in all three prompts,
|
||||
and the NPC registry is ephemeral where it is used by spell and combat prompts.
|
||||
Unused shared assets are neither mounted nor fingerprinted.
|
||||
|
||||
Schema helpers load embedded JSON Schema with identity and digest metadata,
|
||||
return defensive copies, and expose a diagnostics map that omits schema bytes.
|
||||
The small framework registry contains only generic test schemas; production
|
||||
@@ -113,8 +125,8 @@ input and an optional `application/json` `npcs` input. The extractor generates
|
||||
the catalog input from its prepared
|
||||
effective catalog as `{"spell_names":[...]}` using sorted canonical names only.
|
||||
The shared D&D prompt assets include a generic NPC grounding fragment directly
|
||||
after the campaign reference message for both extractors. When an NPC registry
|
||||
is bound, the
|
||||
after the campaign reference message for spell and combat prompts. When an NPC
|
||||
registry is bound, the
|
||||
domain registry boundary strictly decodes and identity-validates one durable
|
||||
artifact, re-encodes canonical JSON, and generates a semantic digest over
|
||||
those bytes. The unbound input is exactly `{"npcs":[]}`. Input digests cover
|
||||
|
||||
@@ -47,9 +47,16 @@ LLM-backed extensions own their prompt definitions and response schemas under
|
||||
package-local embedded assets. Shared filesystem composition belongs in
|
||||
`internal/framework/promptfs`; reusable D&D prompt fragments, reference
|
||||
declarations, prompt-input assembly, and source-unit helpers belong in
|
||||
`internal/modules/dnd/shared`, which also owns bounded D&D diagnostics. Stage
|
||||
contracts expose only Notarius structured-
|
||||
completion types, not Scriptorium public types.
|
||||
`internal/modules/dnd/shared`, which also owns bounded D&D diagnostics. The
|
||||
spell, NPC, and combat-turn extractors use ordered package-local prompt
|
||||
manifests for both rendering and prompt fingerprinting, so only the shared
|
||||
fragments each prompt actually renders participate in either operation. Their
|
||||
common prompt order is system, extraction evidence, in-world identity,
|
||||
transcript, and campaign references, with ephemeral cache control on identity,
|
||||
transcript, and references. Spell and combat prompts append immediate
|
||||
resolution and an ephemeral NPC registry before lane-specific material; the
|
||||
NPC prompt appends its task and instructions. Stage contracts expose only
|
||||
Notarius structured-completion types, not Scriptorium public types.
|
||||
|
||||
Reference material may inform a module or prompt but must not become source
|
||||
evidence. The resolver and materializer behavior is described in
|
||||
@@ -182,15 +189,14 @@ source evidence.
|
||||
|
||||
The prompt limits each cast to its declaration and immediate resolution; it
|
||||
does not follow summoned creatures, persistent effects, or other downstream
|
||||
consequences through the scene. Source references must collectively support all
|
||||
reported facts, using separate narrow ranges when immediate evidence is
|
||||
non-contiguous. The prompt grounds caster names in in-world identities, using
|
||||
the player and party references to disambiguate transcript speakers without
|
||||
treating those references as event evidence. Effects describe the session as
|
||||
played: model rules knowledge cannot supplement or correct the transcript, and
|
||||
nonstandard adjudication is attributed to the GM or table rather than stated as
|
||||
a universal rule. Structural source validation remains deterministic; semantic
|
||||
claim completeness is enforced through extraction policy and evaluation.
|
||||
consequences through the scene. Shared extraction-evidence and identity rules
|
||||
require transcript-supported factual claims and the most specific in-world
|
||||
caster identity, while campaign references only disambiguate source text.
|
||||
Effects describe the session as played: model rules knowledge cannot supplement
|
||||
or correct the transcript, and nonstandard adjudication is attributed to the GM
|
||||
or table rather than stated as a universal rule. Structural source validation
|
||||
remains deterministic; semantic claim completeness is enforced through
|
||||
extraction policy and evaluation.
|
||||
|
||||
Both the extractor and deterministic catalog validator expose
|
||||
the effective base-plus-overlay semantic digest as scoped prepared-component
|
||||
@@ -223,12 +229,16 @@ The NPC extractor maps private model output to the canonical `dnd.NPCList`,
|
||||
assigns source identity and deterministic NPC IDs, and preserves source
|
||||
references for deterministic validation. It uses the shared campaign
|
||||
references only for disambiguation and does not consume the optional NPC
|
||||
registry slot. Its prompt and private response schema are package-owned.
|
||||
registry slot. Its prompt and private response schema are package-owned. The
|
||||
prompt uses the common evidence, identity, transcript, and campaign-reference
|
||||
messages, then the NPC-specific task and instructions; only the identity,
|
||||
transcript, and campaign-reference messages carry ephemeral cache control.
|
||||
|
||||
### `internal/modules/dnd/extract/combatturns`
|
||||
|
||||
The combat extractor prepares one structured request per supplied chunk using
|
||||
the shared transcript, campaign-reference, and NPC-grounding prompt inputs. It
|
||||
the shared extraction-evidence, identity, transcript, campaign-reference,
|
||||
immediate-resolution, and NPC-grounding prompt inputs. It
|
||||
maps the private response to `dnd.CombatTurnList`, assigns the current source
|
||||
identity, removes exact duplicate source ranges, and orders turns by valid
|
||||
source-document position while preserving malformed candidate fields for
|
||||
@@ -236,8 +246,11 @@ deterministic validators. Its package-owned private response schema enforces
|
||||
only the structural JSON envelope; semantic artifact constraints remain with
|
||||
the validator chain. Its prepared metadata and checkpoint fingerprints contain
|
||||
only prompt/schema/mapping identities plus an optional NPC registry digest.
|
||||
The package exposes typed registration and is included in the production D&D
|
||||
registrar with the default combat extraction chain.
|
||||
The prompt renders immediate resolution and the NPC registry before the
|
||||
combat-specific task and instructions; identity, transcript, campaign
|
||||
references, and the NPC registry use ephemeral cache control. The package
|
||||
exposes typed registration and is included in the production D&D registrar with
|
||||
the default combat extraction chain.
|
||||
|
||||
The combat normalizer accepts only the optional structured NPC registry.
|
||||
Campaign references remain extractor-only LLM context and are not materialized
|
||||
|
||||
Reference in New Issue
Block a user