Finalize D&D prompt integration and documentation

This commit is contained in:
2026-07-21 14:58:26 +00:00
parent b344d16dc1
commit 3ba2bfd7f6
8 changed files with 105 additions and 236 deletions

View File

@@ -98,30 +98,36 @@ 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.
The D&D scene chunker and 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.
The three extraction prompts share system, extraction evidence, in-world
identity, transcript, and campaign-reference messages. Spell and combat prompts
then render immediate resolution and the ephemeral NPC registry before their
lane-specific material; the NPC prompt renders its task and instructions
instead. The scene prompt uses system, transcript, and campaign-reference
messages before its task and instructions. Identity, transcript, and
campaign-reference messages are ephemeral in the extraction prompts; the scene
prompt marks transcript and campaign references ephemeral, and the NPC registry
is ephemeral where spell and combat prompts use it. 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
schemas remain package-owned.
The spell and combat extractors' package-owned prompts declare their structured
JSON inputs and private response schemas. The combat private schema owns the
transport envelope—required fields, JSON types, nullability, and unknown-field
rejection—while its deterministic validators own semantic constraints such as
enum membership, non-empty values and collections, and positive numbers. The
spell extractor's prompt declares a required `application/json` `spell_catalog`
input and an optional `application/json` `npcs` input. The extractor generates
The spell, NPC, and combat extractors' package-owned prompts declare their
structured JSON inputs and private response schemas. Each private response
schema remains separate from its durable artifact codec schema; this work does
not use shared schema fragments or schema generation. The combat private schema
owns the transport envelope—required fields, JSON types, nullability, and
unknown-field rejection—while its deterministic validators own semantic
constraints such as enum membership, non-empty values and collections, and
positive numbers. The spell extractor's prompt declares a required
`application/json` `spell_catalog` 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

View File

@@ -48,15 +48,18 @@ 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/citation helpers belong in
`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.
D&D scene chunker and 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. The three extraction prompts share the order 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. The
scene prompt uses system, transcript, and campaign references before its
lane-specific task and instructions, with ephemeral cache control on transcript
and references. Stage contracts expose only Notarius structured-completion
types, not Scriptorium public types.
The shared `ChunkPromptMaterial` helper owns common transcript material
preparation for the spell, NPC, and combat-turn extractors. It clones supplied
@@ -361,8 +364,9 @@ reject the complete result with bounded, stable index/name diagnostics. The
source-reference validator defers malformed shapes, validates every cited
range, and reports all range defects through a bounded aggregate while
preserving `invalid_source_refs`. The relatedness validator resolves all cited
ranges through the shared document-order traversal, then warns when a
case-insensitive spell name is absent from the cited source text. Invalid shape
ranges through the shared document-order traversal, then warns when a normalized
consecutive spell-name token sequence is absent from the cited source text.
Invalid shape
or cited ranges produce no relatedness warnings; the shape and source-reference
validators own those defects.
@@ -416,7 +420,9 @@ that order, then exposes the matching catalog for resolution. The generic and
Seriatim registrars own their production leaf registrations. The D&D registrar
owns D&D leaf registrations, typed spell, NPC, and combat default-validator
chains, typed append-order specializations, and D&D prompt/schema asset
collection.
collection. Its registration helpers group module, validator, prompt-asset, and
chain composition while retaining artifact-specific merge and clone behavior in
the registrar.
Concrete implementation packages do not import generic implementation
packages directly. A concrete family's `register` package is its composition