Document D&D spell normalization behavior

This commit is contained in:
2026-07-20 21:25:02 +00:00
parent ae97adb8b0
commit 3eb68baca6
10 changed files with 257 additions and 73 deletions

View File

@@ -2,14 +2,8 @@
## Status
<<<<<<< HEAD
Proposed as the next D&D pipeline milestone. This feature completes the first
domain-specific normalize stage for the spell pipeline before work begins on
NPC and combat-turn artifacts.
=======
Accepted target state. Implementation details are maintained separately in
`docs/roadmap/implementation.md`.
>>>>>>> 6fbdf6b (Add feature roadmap and implementation plan for D&D spell normalization module)
Implemented deterministic feature. Implementation details are maintained
separately in `docs/roadmap/implementation.md`.
## Objective
@@ -18,13 +12,8 @@ that emits canonical catalog names, removes only clearly identical duplicate
casts, preserves source provenance, and makes every mutation visible through
scoped warnings.
<<<<<<< HEAD
The milestone should improve the consistency of durable spell output without
adding another LLM call or introducing fuzzy repair policy.
=======
The normalizer improves the consistency of durable spell output without adding
another LLM call or introducing fuzzy repair policy.
>>>>>>> 6fbdf6b (Add feature roadmap and implementation plan for D&D spell normalization module)
## Target Behavior
@@ -43,24 +32,16 @@ depend on extractor-private state.
The normalizer contributes its effective catalog digest through
`pipeline.CheckpointFingerprintProvider`. Changing the embedded catalog,
composition policy, or normalize-stage overlay therefore invalidates reusable
<<<<<<< HEAD
normalize checkpoints.
=======
normalize checkpoints. It also records catalog base ID, digest, and overlay IDs
as manifest metadata. Neither identity surface includes catalog contents or
reference paths.
>>>>>>> 6fbdf6b (Add feature roadmap and implementation plan for D&D spell normalization module)
### Canonical spell names
For every spell cast, look up the extracted name using the effective catalog's
existing case, whitespace, apostrophe, and alias rules. Replace a recognized
value with its canonical display name. This is the only spell-name repair in
<<<<<<< HEAD
the initial feature.
=======
this feature.
>>>>>>> 6fbdf6b (Add feature roadmap and implementation plan for D&D spell normalization module)
Do not use edit distance, phonetic matching, model judgment, or another fuzzy
heuristic. If a value does not resolve, retain it unchanged and emit a scoped
@@ -69,12 +50,8 @@ acceptance or rejection.
Emit a warning for each changed spell name. Diagnostics should identify the
artifact index and the original and canonical values without modifying other
<<<<<<< HEAD
fields.
=======
fields. Diagnostics are deterministic and bounded: user-controlled spell names
are truncated to 128 Unicode code points before display.
>>>>>>> 6fbdf6b (Add feature roadmap and implementation plan for D&D spell normalization module)
### Source-reference normalization
@@ -84,12 +61,8 @@ overlapping ranges, because doing so could broaden the evidence attributed to
an event.
The normalizer must not synthesize source references, alter source-unit
<<<<<<< HEAD
boundaries, or use auxiliary references as evidence.
=======
boundaries, or use auxiliary references as evidence. Reordering references or
removing exact duplicates emits a scoped warning for the affected input cast.
>>>>>>> 6fbdf6b (Add feature roadmap and implementation plan for D&D spell normalization module)
### Conservative duplicate collapse
@@ -98,12 +71,8 @@ event only when all of the following match:
- canonical spell name;
- caster after case folding and whitespace normalization; and
<<<<<<< HEAD
- the complete canonical source-reference set.
=======
- the complete canonical source-reference set, which must be non-empty and
valid against the source document.
>>>>>>> 6fbdf6b (Add feature roadmap and implementation plan for D&D spell normalization module)
Collapse each such group into its first occurrence, preserving stable pipeline
order. Retain the first cast's caster, effect, and narrative description. Do
@@ -116,14 +85,11 @@ the removed indices. Casts with different evidence remain distinct even when
their spell and caster match. In particular, adjacency at a chunk or scene
boundary is not sufficient evidence of duplication.
<<<<<<< HEAD
=======
Unknown spell names, empty evidence sets, and invalid source references cannot
establish duplicate identity. They remain in the artifact for the configured
normalize validators to accept or reject. A duplicate warning displays at most
20 removed input indices and reports the exact omitted count.
>>>>>>> 6fbdf6b (Add feature roadmap and implementation plan for D&D spell normalization module)
### Production composition and validation
Register the typed spell normalizer in the D&D family and make it the default
@@ -141,40 +107,34 @@ without a catalog reference.
## Acceptance Criteria
- Base and overlay aliases are written using canonical catalog display names.
- Unknown names are never guessed, deleted, or silently changed.
- Source references are deterministically sorted and exactly deduplicated.
- Only casts with matching canonical spell, normalized caster, and identical
<<<<<<< HEAD
evidence sets collapse; near or adjacent events remain separate.
- Normalization preserves the first cast's non-name fields and stable order.
- Every name change and duplicate collapse emits a scoped warning.
=======
- [x] Base and overlay aliases are written using canonical catalog display names.
- [x] Unknown names are never guessed, deleted, or silently changed.
- [x] Source references are deterministically sorted and exactly deduplicated.
- [x] Only casts with matching canonical spell, normalized caster, and identical
non-empty valid evidence sets collapse; near, invalid, unknown, or adjacent
events remain separate.
- Normalization preserves the first cast's non-name fields and stable order.
- Every name change, unresolved name, source-reference mutation, and duplicate
- [x] Normalization preserves the first cast's non-name fields and stable order.
- [x] Every name change, unresolved name, source-reference mutation, and duplicate
collapse emits a scoped warning.
>>>>>>> 6fbdf6b (Add feature roadmap and implementation plan for D&D spell normalization module)
- Extract, normalize, and catalog-validation catalog identities agree for the
- [x] Extract, normalize, and catalog-validation catalog identities agree for the
same bound references, and catalog changes invalidate normalize checkpoints.
- The maintained production pipeline and current-behavior documentation use
- [x] The maintained production pipeline and current-behavior documentation use
the D&D normalizer without changing the durable artifact schema.
## Evaluation
Maintain a small human-reviewed set of representative spell outputs covering
canonical names, aliases, repeated casts, duplicate model output, and scene
boundaries. Use it to review normalization behavior and warnings, not as a
claim that LLM extraction is deterministically correct.
Status: pending qualitative review. No approved human-reviewed transcript
corpus is available locally under repository policy, so no sensitive transcript
content is committed and no claims about real transcript quality are made.
A compact deterministic fixture set covers canonical names, exact source
reference normalization, repeated casts, duplicate output, and distinct
evidence. It exercises the normalizer contract without requiring paid or
network LLM calls.
Record cases where likely duplicates remain because their evidence differs.
Those examples should inform later LLM-assisted deduplication work rather than
<<<<<<< HEAD
causing this deterministic milestone to adopt broader heuristics.
=======
causing this deterministic feature to adopt broader heuristics.
>>>>>>> 6fbdf6b (Add feature roadmap and implementation plan for D&D spell normalization module)
## Deferred Work
@@ -186,10 +146,6 @@ causing this deterministic feature to adopt broader heuristics.
- Repair-aware extraction retries or LLM-backed semantic validation.
- Changes to the spell artifact schema, including stable cast IDs.
<<<<<<< HEAD
An LLM-backed normalizer is explicitly outside this milestone. If later
=======
An LLM-backed normalizer is explicitly outside this feature. If later
>>>>>>> 6fbdf6b (Add feature roadmap and implementation plan for D&D spell normalization module)
evaluation justifies one, shared spell-catalog prompt material should be
designed at that time around the actual normalization or repair request.

View File

@@ -7,11 +7,8 @@ not as committed release dates.
## Near-Term D&D Pipeline
### Solidify Spell Extraction
### Evaluate Spell Extraction And Normalization
- Implement the deterministic catalog-aware normalizer defined in
[D&D Spell Normalization](dnd-spell-normalization.md), including conservative
exact-evidence duplicate collapse.
- Evaluate ordinary extraction retries and the completed normalization path
against a human-reviewed transcript set before adding repair-aware retries or
an LLM-backed semantic validator.