Add NPC registry grounding for spell extraction
This commit is contained in:
@@ -1,8 +1,9 @@
|
||||
# D&D NPC Artifact
|
||||
|
||||
This document defines the durable D&D NPC-list artifact and its JSON codec.
|
||||
The artifact type and codec are implemented, but no selectable production
|
||||
pipeline currently produces this artifact.
|
||||
This document defines the durable D&D NPC-list artifact, its JSON codec, and
|
||||
the selectable production NPC pipeline. The normalized JSON payload can be
|
||||
passed explicitly to the spell extractor as an optional caster-name registry;
|
||||
it remains a reference, not spell evidence.
|
||||
|
||||
## Identity
|
||||
|
||||
@@ -55,3 +56,51 @@ reference shapes, and the NPC ID pattern.
|
||||
|
||||
Codec metadata contains only `npc_count`. Schema bytes and returned metadata
|
||||
are independent values so callers cannot mutate codec-owned state.
|
||||
|
||||
## Production Pipeline
|
||||
|
||||
The production identities are:
|
||||
|
||||
- extractor: `dnd/npcs`;
|
||||
- artifact kind: `dnd/npc-list`;
|
||||
- normalizer: `dnd/npcs`; and
|
||||
- durable schema: `notarius.dnd.npcs`, version `v1`, media type
|
||||
`application/json`.
|
||||
|
||||
The extractor maps private model records to the current source identity and
|
||||
assigns deterministic IDs. Extraction validation checks shape, source
|
||||
references, and source relatedness. The normalizer then consolidates records
|
||||
by canonical identity or canonical-name/alias matches, preserves the first
|
||||
record's display and output position, unions relationships and exact evidence,
|
||||
rewrites unambiguous relationship targets to canonical names, and validates
|
||||
the retained registry's identity. No LLM is used for consolidation.
|
||||
|
||||
The default extraction chain is `generic/valid_json`,
|
||||
`generic/valid_json_schema`, `extract/dnd/npcs/shape`,
|
||||
`extract/dnd/npcs/source_refs`, and
|
||||
`extract/dnd/npcs/source_relatedness`. The normalize chain adds
|
||||
`normalize/dnd/npcs/identity` before the source-reference and relatedness
|
||||
checks. Relatedness emits bounded warnings when an NPC canonical name or
|
||||
alias is not present near its cited transcript text; opaque campaign
|
||||
references may explain such a warning but do not become evidence.
|
||||
|
||||
## Manifest And Sequential Consumption
|
||||
|
||||
The NPC extractor records prompt and response-schema identities. The durable
|
||||
codec records only `npc_count`; raw names, aliases, descriptions, source
|
||||
references, and payload bytes stay in the lane file rather than manifest
|
||||
metadata. The normalized lane is independently reusable as a file reference:
|
||||
|
||||
```sh
|
||||
go run ./cmd/notarius run dnd-spells \
|
||||
--config examples/dnd-npc-spell-sequential.config.yml \
|
||||
--input examples/seriatim-minimal-transcript.json \
|
||||
--reference spells.extract.npcs=./npc-output/<run-id>/lanes/npcs.json
|
||||
```
|
||||
|
||||
The spell extractor strictly decodes and identity-validates this file, accepts
|
||||
source references belonging to another session as registry provenance, and
|
||||
uses only canonical names and aliases for caster grounding. Those NPC source
|
||||
references are never accepted as spell evidence. The spell run's manifest
|
||||
keeps raw file provenance under `references` and records only the prepared
|
||||
registry's semantic digest and count in extractor metadata.
|
||||
|
||||
Reference in New Issue
Block a user