Minimize D&D NPC extraction contracts
This commit is contained in:
@@ -172,7 +172,9 @@ The selectable lane uses extractor and normalizer key `dnd/combat-turns`,
|
||||
reference contributes raw-file provenance to the run manifest. A generated
|
||||
binding contributes artifact kind, schema identity, media type, canonical
|
||||
digest, size, and bounded producer provenance. Consumer metadata and checkpoint
|
||||
fingerprints contain no registry names, aliases, content, paths, or NPC source
|
||||
ranges. The normalized lane is emitted as `lanes/<lane-id>.json` by the JSON
|
||||
fingerprints contain no registry names, content, paths, or NPC source ranges.
|
||||
The component-local registry fingerprint covers only the names projected to the
|
||||
consumer, while manifest provenance retains the full artifact digest. The
|
||||
normalized lane is emitted as `lanes/<lane-id>.json` by the JSON
|
||||
output module, and warnings and rejection summaries remain in their shared
|
||||
companion files.
|
||||
|
||||
@@ -41,13 +41,9 @@ Each NPC contains exactly these required fields:
|
||||
|
||||
- `id`: `npc:sha256:` followed by 64 lowercase hexadecimal characters;
|
||||
- `name`: the canonical display name;
|
||||
- `aliases`: an array of alternate display names, which may be empty;
|
||||
- `description`: a concise description;
|
||||
- `relationships`: an array of target/relationship objects, which may be empty;
|
||||
- `source_refs`: at least one source reference supporting the NPC record.
|
||||
|
||||
Each relationship contains required `target` and `relationship` strings. Each
|
||||
source reference contains required `source_id`, `start_unit_id`, and
|
||||
Each source reference contains required `source_id`, `start_unit_id`, and
|
||||
`end_unit_id`; unit IDs are positive integers. Source document identity, unit
|
||||
existence, and range ordering are validated by the source-reference validator
|
||||
when the artifact is used by a pipeline.
|
||||
@@ -76,25 +72,28 @@ The production identities are:
|
||||
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.
|
||||
only when their normalized canonical names match, preserves the first record's
|
||||
display and output position, unions exact evidence, and validates the retained
|
||||
registry's identity. No LLM is used for consolidation.
|
||||
|
||||
The extraction prompt asks only for individually identifiable NPC names backed
|
||||
by source evidence. Groups, generic roles, invented labels, and descriptive or
|
||||
relationship enrichment are outside the contract.
|
||||
|
||||
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
|
||||
checks. Relatedness emits bounded warnings when an NPC canonical name is not
|
||||
present near its cited transcript text; opaque campaign
|
||||
references may explain such a warning but do not become evidence.
|
||||
|
||||
## Manifest And Artifact Handoff
|
||||
|
||||
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
|
||||
codec records only `npc_count`; raw names, source references, and payload bytes
|
||||
stay in the lane file rather than manifest
|
||||
metadata. The normalized lane can be consumed by a later ordered step through
|
||||
the registered canonical codec:
|
||||
|
||||
@@ -124,9 +123,16 @@ The framework hands only an accepted normalized artifact across the barrier. It
|
||||
validates the canonical bytes against each consumer slot and clones the
|
||||
operation-time reference for the spell and combat consumers. Generated
|
||||
provenance records the artifact kind, schema identity, media type, canonical
|
||||
digest, size, and producer step/lane/module, but not names, aliases, source
|
||||
digest, size, and producer step/lane/module, but not names, source
|
||||
ranges, or payload bytes. External normalized files remain supported as
|
||||
explicit references and retain their file provenance.
|
||||
|
||||
NPC source references are registry provenance and are never accepted as spell
|
||||
or combat evidence. Current transcript units remain the only event evidence.
|
||||
|
||||
Consumers receive a separate names-only projection in normalized registry
|
||||
order, for example `{"npcs":[{"name":"Mira Thorn"}]}`. The projection omits
|
||||
IDs and evidence. Its digest covers the exact projected bytes and is used for
|
||||
consumer-local checkpoint identity, while the full durable artifact digest
|
||||
remains the manifest and generated-reference provenance identity. The unbound
|
||||
projection is exactly `{"npcs":[]}` and also has a projection digest.
|
||||
|
||||
@@ -102,17 +102,17 @@ The `dnd/spells` extractor accepts an optional `npcs` reference containing one
|
||||
normalized NPC artifact as `application/json`, up to 1 MiB. An external file is
|
||||
validated during preparation; an ordered generated binding is validated at the
|
||||
step handoff. Both paths use the approved NPC codec and identity policy,
|
||||
re-encode canonical durable JSON, and supply that JSON as an operation-time
|
||||
spell prompt input. It helps the model prefer canonical caster names and
|
||||
recognize aliases; it does not establish that a spell was cast.
|
||||
re-encode canonical durable JSON for registry provenance, and supply only the
|
||||
registry's ordered names as the operation-time spell prompt input. It helps the model prefer canonical
|
||||
caster names; it does not establish that a spell was cast.
|
||||
|
||||
NPC source references may identify the run that produced the registry or any
|
||||
other session. They remain registry provenance and are never copied into a
|
||||
spell cast's `source_refs`; every spell evidence range must still identify the
|
||||
current transcript. Generated provenance records producer and canonical
|
||||
artifact identity without payload content or a path. When the slot is absent,
|
||||
the prompt receives exactly `{"npcs":[]}` and the run has no NPC reference
|
||||
provenance or NPC checkpoint fingerprint.
|
||||
the prompt receives exactly `{"npcs":[]}` with its projection digest, and the
|
||||
run has no NPC reference provenance.
|
||||
|
||||
## Normalization Behavior
|
||||
|
||||
@@ -196,7 +196,7 @@ provenance; see the [JSON output contract](json-output.md#manifestjson).
|
||||
|
||||
The `npc_registry_digest` and `npc_count` fields in the example are present for
|
||||
an external NPC registry when the extractor publishes its prepared module
|
||||
metadata. They contain no NPC names, aliases, source references, paths, or raw
|
||||
metadata. They contain no NPC names, source references, paths, or raw
|
||||
bytes. A generated registry's identity is instead represented by the framework
|
||||
handoff provenance and dependency fingerprint, so the consumer module metadata
|
||||
does not duplicate it.
|
||||
|
||||
Reference in New Issue
Block a user