Remove completed shared schema plans

This commit is contained in:
2026-11-29 18:46:09 +00:00
parent 41a5c43561
commit 822e050010
2 changed files with 0 additions and 878 deletions

View File

@@ -1,494 +0,0 @@
# Shared Domain Schemas Implementation Plan
## Scope And Execution
Implement [Shared Domain Schema Adoption](shared-domain-schemas.md). That roadmap
owns the target state, intent, and approved input cutover. This document owns the
ordered implementation tasks. The planning baseline is `ea163dd`; application
code still uses the private spell overlay and text party/glossary references.
Each numbered stage is one Luna implementation prompt. Execute in order during
one end-to-end sprint. Intermediate stages may leave callers or tests broken;
do not build temporary compatibility layers merely to make a stage compile.
Record deferred wiring accurately and complete it in its assigned later stage.
Final acceptance requires the whole implemented workflow, not just isolated
reader tests. Follow `docs/development.md` and its applicable policy guide;
commit completed units according to Agent Policy.
Only planning documents change while preparing this plan. The instructions below
authorize future implementation, not implementation during the planning pass.
## Resolved Design Details
- Adopt `glossary@0.2.0` and `rpg/party@0.2.0` from published schemas distribution
`2026.11.1`, commit `f7e3cedeca11ed903311cdf29ca4d81fb1f216b7`.
The respective document markers remain `maximumdirect.glossary.v1` and
`maximumdirect.rpg.party.v1`; unchanged markers do not imply old decoding
behavior. No publication wait or historical-version compatibility reader is
needed.
- Bundle content under `assets/shared-domain/`, retaining upstream paths
`glossary/v0.2.0/` and `rpg/party/v0.2.0/`. Include
schema files, adjacent semantics, and a small source/version record. Link
upstream manuals rather than copying them. Keep the single assets Go file
content-only; extend its embed declaration as necessary.
- Put a small native-load/schema-validation integration in
`internal/integrations/domainrefs`. Use ConfigKit `v1.4.0`'s public
`Load[map[string]any](configkit.Bytes(label, content))` for both JSON and YAML.
Pass `Result.Config` directly to JSON Schema validation. Keep that resolved
mapping as the document; build narrow D&D projections in
`internal/modules/dnd/shared` and recognition views in the spell catalog.
No custom parser, generic document SDK, or upstream internal-package import.
- Use a single-source native load with no enabled imports, selected overlay,
defaults, application resolver, overrides, or secrets bootstrap. Native
structural behavior still applies, including `extends` and source-root `config`
controls. Do not pre-parse, disable, or reinterpret native reserved controls.
Retain wrapped native causes instead of reconstructing parser diagnostics.
This is a reference-document load, not another load of application settings.
- Keep native dynamic number binding (`int64`/finite `float64`) and native value
limits. Retain supported resolved extensions, not exact authored numeric
spelling/precision or consumed controls. Do not create serialization/forwarding
APIs or marshal/reload documents merely to construct typed views. Existing
reference items retain original bytes independently where needed.
- External reference objects gain `collections: [name, ...]`. Omission or null
means slot defaults. Explicit `[]` selects no collections. Preserve this
distinction through conversion, cloning, resolution, and inspection. Use
ordinary ConfigKit-bound nullable fields and its native presence/inspection
behavior, then a runtime nil-versus-empty slice; do not add a presence tracker or
collapse an explicit empty slice with `append(nil, values...)`.
- Collection names compare exactly, without trimming or case folding. Empty
names cannot identify a valid upstream collection and are input errors.
Repeated selections are harmless: deduplicate exact names. Selection is a set,
not precedence; sort selected names for deterministic projection. Do not add
count limits, name grammars, or uniqueness restrictions beyond the contracts.
- A bound `spell_catalog` defaults to required `spells`; a bound `glossary`
defaults to whichever of `campaign` and `setting` exist. Explicit names must
exist. Empty valid collections and explicit empty selection contribute no
vocabulary. No binding means no external vocabulary, not a missing-input error.
- Configuration-local overrides select the surviving reference object using
existing precedence. An omitted selection on that object uses defaults; it
does not implicitly inherit selection from a replaced lower-scope object.
CLI path overrides are deliberately path-only: retain each concrete target's
effective configured selection. CLI-only bindings use defaults. Unbinding
removes the binding and its selection. Generated artifacts remain unchanged;
`collections` is an external-file selection, not a new artifact selector.
- `party` and existing accepted `roster` aliases consume shared party documents;
`glossary` consumes shared glossary documents. Retain current party-over-roster
precedence and per-module alias availability. `players` stays optional text.
Roster player relationships appear in party context; no second authored player
file or derived glossary is required.
- General context projects names, aliases, categories, descriptions, and plural
forms when supplied. Party context projects names, aliases, player relationships,
and classes/levels when supplied. Sort roster keys for presentation but omit
those IDs from model content. Preserve distinct same-name roster entries.
Ordinary extensions remain native resolved data, not model instructions;
these task views omit them. Native reserved controls keep their upstream meaning.
- Spell context projects canonical names/aliases only. Embedded vocabulary keeps
display precedence. For new external names, traverse collections and entries
in exact collection-name/entry-ID order so map/list order does not select the
display spelling. Use existing lookup normalization; trim surrounding whitespace
in the recognition view without changing the resolved document. A name/alias that
becomes unusable after normalization is a task suitability error. Preserve
existing same-spell alias augmentation and cross-spell collision rejection.
- Structured media types are `application/json`, `application/yaml`, and
`application/x-yaml`, matching existing file-extension materialization. JSON
media requires JSON syntax via a standard `json.Valid` check, followed by the
same native load used for YAML. Neither serialization bypasses native limits.
Keep current byte bounds rather than adding new ones. Do not infer old text or
overlay formats, require optional provenance/rulesets, or add a campaign reader.
- Validate completed documents before task selection. Configuration composition
remains ConfigKit-owned. Validate external typed references in module
construction shared by run and explicit preflight, before domain inference.
Keep ordinary offline pipeline validation free of reference-file reads.
## Stage 1 — Bundle The Pinned Aligned Contracts
**Status:** Complete.
**Goal:** Make the selected released contracts available offline without
behavioral asset registration.
**Inspect:** `assets/package.go`, schemas tag/catalog and selected version
directories in `../schemas`, `docs/policy/oss.md`, and current attribution.
**Work:**
1. Read the pinned `2026.11.1` catalog and glossary/party `0.2.0` semantics from
commit `f7e3cedeca11ed903311cdf29ca4d81fb1f216b7`. Use these exact versions,
not an automatic highest-version selection or older contracts with the same
`.v1` markers. Campaign support remains deferred.
2. Record distribution, full source commit, versions, document markers, and
canonical IDs in a small asset source record. The IDs are
`https://schemas.maximumdirect.net/glossary/v0.2.0/schema.json` and
`https://schemas.maximumdirect.net/rpg/party/v0.2.0/schema.json`.
No runtime release discovery or inventory framework.
3. Copy only the selected schema files and adjacent semantics, plus exact schema
dependencies if any, into the asset subtree. Keep schema files verbatim; link
nonbundled documentation targets to the selected upstream revision and record
any navigation adaptations. Do not copy upstream parser manuals, full example
archives, or a catalog advertising unbundled campaign support.
4. Extend the existing embed declaration. Update asset-package commentary to
recognize shared input contracts as well as LLM content.
5. Add the incorporated material's attribution and applicable license text using
the selected release's actual terms, existing OSS conventions, and pinned links.
**Acceptance:** The packaged filesystem contains the pinned `0.2.0` schemas and
semantics; `assets` still has no business logic or kit dependency. Source/license
records describe only incorporated material.
**Validation:** `go test ./assets`; inspect copied files against `git show` at the
selected upstream commit, and `git diff --check`.
## Stage 2 — Load Shared References Through ConfigKit
**Status:** Complete.
**Goal:** Delegate parsing and resolution for both serializations to ConfigKit.
**Inspect:** ConfigKit's pinned public `Load`, `Bytes`, and dynamic-value contracts;
the aligned schemas' semantics; existing reference byte/media-type transport.
**Work:**
1. Create a small shared-reference loader in `internal/integrations/domainrefs`
that accepts already-materialized bytes, media type, and a useful diagnostic
label. For JSON media, use only `json.Valid` to enforce JSON syntax. Then call
the public native byte-source load for either media type.
2. Return the native resolved mapping for subsequent schema/domain validation.
Do not recreate a raw/typed document hierarchy, custom JSON token walker,
direct YAML-library decoder, numeric adapter, or generic conversion API.
3. Use the single-source selections above. Native parsing, structural resolution,
scalar binding, limits, and error details remain authoritative. Wrap failures
with reference context and retain their causes; do not create an error taxonomy.
4. Add a few public-API integration tests: ordinary equivalent YAML/JSON input,
one representative native rejection, resolved numeric/extension values, and
native reserved-control handling. Do not reproduce ConfigKit's parser matrix.
An `instruction` extension remains ordinary data. JSON receives no fallback
path when ConfigKit rejects a syntactically valid document.
**Acceptance:** Both serializations use one native loading boundary. No exact
numeric-preservation guarantee, independent parser, or configuration reconstruction
has been introduced. ConfigKit failures remain distinguishable from later schema
and domain checks without reimplementing native error semantics.
**Validation:** `go test ./internal/integrations/domainrefs`; no network, engine,
or credentials.
## Stage 3 — Validate Resolved Shared Documents
**Status:** Complete.
**Goal:** Separate shared conformance from consumer requirements.
**Inspect:** Bundled schemas/semantics and `assets.FS()`.
**Work:**
1. Register the two local schemas under their canonical IDs using the existing
jsonschema library. Compile once with safe shared reuse; configure unresolved
resource loads to fail locally. Do not enumerate unrelated schemas or query
canonical URLs at runtime.
Schema resource JSON remains owned by the schema engine's resource loader,
preserving exact numeric constraints; it is not a domain document to load
through ConfigKit.
2. Validate the Stage 2 native mapping directly. Check the complete resolved
envelope, all known fields, and all collections, not only selected entries.
Do not decode a second typed copy or marshal/reload subtrees. Add narrow typed
accessors/projections only where needed by the concrete consumers.
3. Check glossary entry-ID uniqueness within each collection using exact strings.
Do not add name uniqueness, global ID uniqueness, required player/classes, or
cross-document reference checks.
4. Implement exact collection selection with the presence/default rules above;
keep slot-specific default choice in D&D code. Report absent selected names
as task errors, not upstream schema errors.
5. Cover omitted/null/empty aliases, permitted extensions at all relevant levels,
invalid optional-field types, empty collections/rosters, shared IDs across
collections, and duplicate IDs within a collection. Retain supported resolved
extensions in the mapping without inventing a forwarding subsystem.
**Acceptance:** The native resolved mapping is validated offline against the exact
aligned contracts. Domain checks add no new authoring format or decoding path.
**Validation:** `go test ./internal/integrations/domainrefs`.
## Stage 4 — Carry Collection Selection Through Configuration
**Status:** Complete. CLI path overrides and materialization are wired separately below.
**Goal:** Preserve binding selection and its presence through normal configuration
resolution without changing ConfigKit ownership.
**Inspect:** `internal/core/config/{document.go,pipeline_document.go,loaded_config.go,document_paths.go,config.go}`;
`internal/framework/pipeline/profile.go` and copy helpers; reference contract types
in `internal/framework/contracts/contracts.go`.
**Work:**
1. Add the presence-aware `collections` field to external reference documents,
runtime `ReferenceSource`, and resolved `ReferenceBinding`. Extend existing
external-source constructors as needed; avoid duplicate legacy source types.
Use ordinary typed ConfigKit binding and inspection. Do not create another
presence index, source tracker, configuration merge, or cloning framework.
2. Keep the reference source union explicit: collection selection accompanies
`path`, not `artifact`. Reject wrong selection types and empty names; preserve
null/omitted versus explicit empty according to the resolved design.
3. Carry selection through pipeline, step, lane, and stage maps, runtime
conversion, effective resolution/digests, and clone helpers. Deep-copy slices
and retain nil/empty distinctions. Do not alter source-relative path handling.
4. Treat configured local source replacement as replacement of the whole
external reference object. Leave field composition before that point to
ConfigKit; do not add a second inheritance algorithm.
**Acceptance:** ConfigKit inspection and detached runtime settings reflect the
operator's selection. Changing a detached selection cannot mutate its source;
explicit `[]` does not turn into defaults.
**Validation:** Focused configuration and pipeline reference/copy tests with
`go test ./internal/core/config ./internal/framework/pipeline`. Temporary failures
from later wiring must be identified, not hidden with compatibility scaffolding.
## Stage 5 — Preserve Selections Through CLI And Materialization
**Status:** Complete.
**Goal:** Deliver selected input views consistently to consumers.
**Inspect:** `internal/cli/reference_selectors.go`, framework reference resolution
in `profile.go`, `references.go`, reference clone/marshal helpers, and existing
CLI reference contract tests.
**Work:**
1. Carry selection from each resolved binding into its materialized
`ReferenceItem` (and its clone/evidence serialization as applicable), alongside
unchanged complete bytes, origin, raw-content digest, and media type.
2. Apply CLI path overrides after configured scope resolution while retaining
each concrete target's surviving configured selection. A broad CLI selector
may therefore replace paths on targets with different selections. Preserve
current specificity, unbind, required-slot, and generated-handoff behavior.
3. Keep readers out of generic materialization. Collection names are opaque
metadata here; D&D consumers perform glossary interpretation. Collection
selection on a non-collection D&D slot should receive a useful task error
rather than being silently interpreted as something else.
4. Test configured pipeline/local precedence, explicit empty selections, broad
and narrow CLI overrides, CLI-only defaults, unbinding, and clone isolation.
Keep file byte limits and raw reference digests unchanged.
**Acceptance:** The final selected target has the right path and selection;
materialization retains the full shared document for validation. No new CLI flag
or configuration composition mechanism is introduced.
**Validation:** Focused tests in `./internal/framework/pipeline` and
`./internal/cli` for reference handling.
## Stage 6 — Cut Spell Recognition Over To Shared Glossaries
**Status:** Complete. Maintained example files are migrated in the documentation unit below.
**Goal:** Replace the private overlay format across the whole spell family.
**Inspect:** `internal/modules/dnd/spells/catalog/effective.go`, extraction and
normalization constructors, `internal/modules/dnd/validate/spells/catalog`, and
CLI spell catalog identity/correction contract tests.
**Work:**
1. Replace overlay decoding with the shared glossary reader/selector. Accept the
three structured media types. Retain the existing optional reference and byte
bound; empty selected collections retain embedded-only recognition.
2. Feed names and aliases into existing effective vocabulary construction using
the deterministic traversal and recognition-view normalization above. Retain
embedded display precedence, same-spell alias augmentation, and cross-spell
collision diagnostics with selected collection/entry context.
3. Remove private overlay wire types, marker, parser, and obsolete metadata
requirements. Adapt internal digest/metadata helpers where still needed;
do not turn them into new accepted-result cache-key inputs.
4. Ensure extractor, normalizer, and validator construction all use the same
selected reference semantics. Keep model catalog material name/alias-only.
5. Replace affected fixtures/helpers with shared documents. Test a custom spell,
an embedded spell alias, collisions, optional/null aliases and provenance,
arbitrary categories, explicit selection, and unusable normalized names.
**Acceptance:** One shared glossary serves recognition and normalization with no
overlay conversion. Old envelopes are not accepted as an alternative format;
no durable spell shape or evidence rule changes.
**Validation:** `go test ./internal/modules/dnd/spells/... ./internal/modules/dnd/extract/spells ./internal/modules/dnd/normalize/spells ./internal/modules/dnd/validate/spells/...`
and focused CLI spell-catalog tests after their fixture migration.
## Stage 7 — Prepare Shared Context For Scenes And Registry Lanes
**Status:** Complete. Remaining context consumers are migrated in the next unit.
**Goal:** Establish one reusable context preparation path and migrate its first
coherent consumer group.
**Inspect:** `internal/modules/dnd/shared/{references.go,prompt_inputs.go}`,
`chunk/scenes`, extractors for item/NPC/location registries and scene descriptions,
and `assets/dnd/shared/prompts/common-dnd-references.md`.
**Work:**
1. Add a constructor-time shared context preparer using Stage 3's validated native
mappings and narrow task views.
Prepare fixed party/glossary/player material and combine it with each operation's
current transcript material. Keep generated references separate and dynamic.
2. Change party/roster/glossary declarations to structured media; retain text
acceptance for `players`. Validate every supplied typed slot, including a
bound roster alias even if canonical party context takes presentation precedence.
3. Implement deterministic projections described above. Keep IDs and provenance
in internal data, not the body the model must interpret. Roster relationships
live in party material; the independent players material stays supplemental.
4. Store immutable prepared context in the scene chunker and four selected
extractors. Update constructors, builders, and request assembly; invalid
references must fail construction, not wait for a chunk or cache miss.
5. Adjust shared prompt labels/instructions only as necessary for the new
contextual material. Preserve shared-asset use, message ordering/cache controls,
native correction, and the reference-versus-transcript evidence distinction.
**Acceptance:** These consumers use the same projection without per-chunk parsing;
missing optional context is supported and same-name roster members remain distinct.
**Validation:** Shared projection tests plus scene chunker and four migrated
extractor package tests. Update obsolete text fixtures for these consumers.
## Stage 8 — Migrate All Remaining D&D Context Consumers
**Status:** Complete.
**Goal:** Complete context cutover without leaving a text-input bypass.
**Inspect:** Remaining extraction constructors/builders for spells, combat turns,
item/NPC/location occurrences, and enemy events. Inspect direct prompt material
calls and grounding helpers, including enemy-event material assembly.
**Work:**
1. Migrate these six extractors to the Stage 7 prepared context facility. Keep
their generated registry/scene/combat handoffs and operation-local inputs intact.
2. Audit production calls to `shared.PromptInputs`, `ReferencePromptMaterial`,
and `ReferencePromptInput`. Remove the obsolete party/glossary raw-text path;
preserve generic text handling still needed by supplemental players or other
unrelated context.
3. Update constructors and registration builders consistently. Do not modify
deterministic normalizers to consume party context they do not currently use.
4. Migrate affected package/integration fixtures and assert representative contextual
names/aliases/relationships, rather than snapshotting whole prompts. Retain
correction and generated-reference behavior coverage.
**Acceptance:** All ten extractors and the scene chunker validate/prepare their
declared shared inputs consistently. No stage-scoped typed binding escapes
validation simply because no chunks execute or accepted artifacts are cached.
**Validation:** `go test ./internal/modules/dnd/... ./internal/modules/integration`.
## Stage 9 — Verify Assembled Run And Preflight Behavior
**Status:** Complete. Focused assembled checks, the preflight and framework
pipeline suites, and the broader CLI suite pass after the example migration.
**Goal:** Prove the public workflow through real internal collaborators and fake
provider boundaries.
**Inspect:** `internal/cli/pipeline_invocation.go`, `pipeline_preflight.go`,
`internal/framework/pipeline/prepare.go`, CLI preflight/reference tests, and
`internal/preflight/preflight.go`'s separate offline boundary.
**Work:**
1. Add focused assembled tests supplying shared YAML/JSON references through CLI
paths and scoped configuration. Check selection survives into actual prepared
model input and spell normalization/catalog validation.
2. Prove run and explicit preflight reject malformed party/glossary documents,
duplicate IDs, absent explicit collections, and spell collisions before any
fake domain inference/provider smoke call. Use representative cases rather
than rerunning ConfigKit's parser matrix in CLI tests.
3. Prove valid shared inputs reach the expected tasks; use a controlled empty
model extraction with populated references to verify the application does not
synthesize reference-only events. Do not assert live model quality guarantees.
4. Verify construction occurs before accepted-result reuse, and offline pipeline
validation still works with nonexistent reference paths. Keep ordinary run free
of preflight probes and keep reports/cancellation/generated handoffs unchanged.
5. Fix missing wiring at its owner, using existing preparation rather than a
second CLI-specific reader or a domain-dependent generic framework hook.
**Acceptance:** Input and suitability checks have one behavior for run/preflight;
the final ordinary pipeline remains usable with optional references omitted.
**Validation:** `go test ./internal/cli ./internal/preflight ./internal/framework/pipeline`.
## Stage 10 — Migrate Maintained Examples And Canonical Documentation
**Status:** Complete.
**Goal:** Make the supported workflow discoverable without duplicating upstream
schema manuals.
**Inspect:** `examples/dnd-complete/`, CLI example contract tests,
`docs/config.md`, integration docs, D&D consumer guide, relevant internal guides,
and the documentation/OSS policies.
**Work:**
1. Replace `party.txt`, `glossary.txt`, and `spell-catalog.json` with synthetic
`party.yml` and multi-collection `glossary.yml`. Bind the latter to general
glossary and spell-catalog roles, including both spell extract and normalize
where currently configured. Preserve imports, development overlay, all ten
lanes, ordered handoffs, and auxiliaries. Keep the minimal example minimal.
2. Update example tests to validate shared references and exercise one maintained
full pipeline with fake model responses. Do not require a sibling checkout.
3. Create `docs/integrations/shared-domain-inputs.md` owning supported versions,
serializations and Notarius task adaptations; link pinned upstream semantics
for the format. Retire the private overlay contract and update inbound links.
4. Update config reference fields/defaults, CLI path-override semantics, D&D
subprocess examples, and relevant internal ownership docs. Include a concise
migration section: new envelopes, existing slot names, collection selection,
nullable aliases, optional provenance, and roster-derived player relationships.
Link native loading, numeric binding, limits, and reserved controls to the
pinned ConfigKit documentation rather than maintaining a second manual.
5. Recheck attribution and copied content. Do not publish a release, preselect a
version, or claim other applications already support the shared format.
**Acceptance:** A caller can follow maintained docs to supply one roster and one
shared glossary through the CLI with no duplicate spell/player authoring. Current
docs describe the implemented cutover, not legacy support or future campaigns.
**Validation:** `go test ./internal/cli -run 'TestMaintained|TestCompleteDNDSharedCLIReferences'`;
local link checks and searches for retired example paths/overlay marker. Intentional
migration explanations are not stale references to delete.
## Stage 11 — Final Contract And Regression Pass
**Status:** Complete. Repository-wide tests, vet, and build passed. Maintained
example configurations and documentation links were checked; optional live and
cross-application evaluation was not run.
**Goal:** Finish the end-to-end sprint with all target behavior verified.
**Work:**
1. Review each feature-roadmap acceptance item against current implementation and
tests. Check explicit-empty/default selection, multi-target CLI overrides,
supported decoded extension retention, all context consumers, schema offline use,
spell collision/display policy, and preflight/run agreement.
2. Check for accidental extra requirements: mandatory context/player/classes,
trimmed authored strings, extra name/ID uniqueness, extension rejection,
ruleset/provenance requirements, custom composition, new caps or retries.
Confirm no parallel parser, scalar adapter, subtree conversion round trip,
generic document/forwarding SDK, or copied upstream parser suite remains.
Native reserved controls and dynamic-value limits are upstream behavior, not
locally reimplemented restrictions or guarantees.
Check durable outputs, session identity, native reports and cache policy remain
unchanged. Remove temporary migration scaffolding and obsolete fixtures.
3. Run `gofmt` on modified Go files, then `go test ./...`, `go vet ./...`, and
`go build -o /tmp/notarius-shared-schemas-check ./cmd/notarius`.
Run `git diff --check` and verify documentation links/examples. No API key or
paid request is required. Optional cross-application/live model evaluation is
separate from completion of deterministic acceptance.
4. Record results and any real remaining gaps. Do not mark the feature complete
based only on isolated reader tests or compilation. Commit the completed unit
according to repository policy; release/tag/push needs separate authorization.
**Acceptance:** All stages' outcomes and the feature-roadmap acceptance criteria
are satisfied; repository-wide checks pass and no compatibility reader or
duplicated authoring workflow remains. No blocking product decision or schema
publication prerequisite remains.

View File

@@ -1,384 +0,0 @@
# Shared Domain Schema Adoption
## Purpose
Adopt the Maximum Direct shared domain contracts for D&D reference inputs so
operators can maintain one roster and one set of glossary documents across
Narratio, Notarius, Audita, and relevant Scriptorium prompts. In particular, the
same authored spell glossary should support transcript correction and Notarius
spell recognition without an independently maintained Notarius overlay.
This is Notarius's feature roadmap responding to the
[Narratio feature request](narratio-shared-schemas-feature-request.md). It defines
the target state and required work; the [implementation plan](implementation.md)
defines the execution stages. Collection selection belongs on reference
bindings, and the existing party/glossary slots make a direct structured-input
cutover.
## Current Baseline
Reviewed against Notarius commit
`bff0fb44e86e024f1cb5f0987b2ba583c225a53b`.
- The [reference interface](../config.md#references-and-ordered-handoffs) supports
configured external files, CLI overrides, and ordered generated artifacts.
External bindings currently select a path, not a glossary collection.
- D&D shared prompt inputs treat `party`, `players`, and `glossary` as text.
Some modules also accept the existing `roster` alias. These inputs do not
currently establish conformance to the proposed shared contracts.
- The former [spell-catalog overlay contract](https://forge.maximumdirect.net/eric/notarius/src/commit/bff0fb44e86e024f1cb5f0987b2ba583c225a53b/docs/integrations/dnd-spell-catalog-overlays.md) used the
private `notarius.dnd.spell-catalog-overlay.v1` JSON format. The reader rejects
unknown fields, requires catalog/ruleset/source information, and rejects null
aliases. That reader cannot consume a shared glossary unchanged.
- `internal/modules/dnd/spells/catalog` constructs effective vocabulary from
the embedded D&D 5e 2014 SRD catalog and an optional overlay. Extraction,
normalization, and catalog validation use that resolver. Constructors already
surface determinable spell-catalog problems during pipeline preparation.
- Explicit [preflight](../cli.md#preflight) and run share reference
materialization and module construction through
`internal/cli/pipeline_invocation.go`. Preflight also parses the supplied
source and checks destinations and native provider readiness; it does not run
the extraction pipeline.
- The maintained [complete example](../../examples/dnd-complete/config.yml)
supplies text party/glossary references and a separately authored spell overlay.
The [D&D subprocess guide](../consumers/dnd-pipeline.md) reflects those inputs.
- The repository already imports ConfigKit `v1.4.0` and
`github.com/santhosh-tekuri/jsonschema/v6`. Their public APIs supply native
loading and external JSON Schema validation; no new parser dependency is needed.
## Selected Upstream Baseline
Adopt the shared schemas source distribution
[`2026.11.1`](https://forge.maximumdirect.net/eric/schemas/src/tag/2026.11.1),
whose published remote tag resolves to commit
`f7e3cedeca11ed903311cdf29ca4d81fb1f216b7`. Its
[catalog](https://forge.maximumdirect.net/eric/schemas/src/tag/2026.11.1/catalog.json)
contains the following independently versioned contracts:
| Contract | Selected version | Document identifier | Adoption scope |
| --- | --- | --- | --- |
| [General glossary](https://schemas.maximumdirect.net/glossary/v0.2.0/schema.json) | `0.2.0` | `maximumdirect.glossary.v1` | Structured vocabulary and spell recognition. |
| [RPG party](https://schemas.maximumdirect.net/rpg/party/v0.2.0/schema.json) | `0.2.0` | `maximumdirect.rpg.party.v1` | Structured character roster and player relationships. |
| RPG campaign | `0.2.0` (reviewed only) | `maximumdirect.rpg.campaign.v1` | No new structured consumer in this work set. |
Use the glossary and party definitions with their adjacent semantics from this
exact source revision. Their canonical IDs are the versioned schema URLs linked
above. The release's aligned native-loading contracts are available; schema
publication is no longer a prerequisite for implementation.
The `.v1` markers remain unchanged from the earlier contracts and do not identify
an exact schema version or loading policy. Pin `0.2.0`; do not dispatch between
historical versions based on the marker, select the highest version at runtime,
or add compatibility readers for `0.1.0`.
Use the existing ConfigKit `v1.4.0`
[consumer guide](https://forge.maximumdirect.net/base-layer/configkit/src/tag/v1.4.0/docs/consumers/README.md)
and [native contract](https://forge.maximumdirect.net/base-layer/configkit/src/tag/v1.4.0/docs/config.md)
for loading semantics, as specified by the selected aligned schema contracts.
Repository CalVer, individual schema SemVer, document generation markers, and
canonical schema IDs remain distinct. Record exact selected versions and source
revision; do not discover support from mutable `main` or live URL availability.
## Target End State
### Operator And Caller Workflow
Operators can supply completed shared glossary and party documents as YAML or
equivalent JSON through the established reference interface. A glossary file may
contain several collections; each consuming task uses a documented selection.
Narratio may serialize a shared document or save a selected shared view, but
does not translate entries into a Notarius-specific spell format.
The same glossary file can supply spell recognition and general campaign
vocabulary through separate bindings when useful. Repeating a file binding is
not a requirement to author duplicate data. A spell-only document is sufficient
for a spell-only use; `party`, `campaign`, `setting`, and `spells` are useful
Narratio conventions, not a mandatory collection inventory or schema enumeration.
A shared roster supplies canonical character names, aliases, player
relationships, and relevant optional attributes. The maintained complete
pipeline needs no second operator-maintained player list or party glossary to
repeat those facts. Optional supplemental context remains separate from a
requirement to duplicate roster data.
Retain existing pipeline, lane, and stage reference scopes, configuration-origin
path handling, CLI working-directory path handling, and generated handoffs.
Preflight and run resolve the same bindings and collection selections.
### Binding Roles And Collection Selection
Retain the existing `spell_catalog`, `glossary`, and `party` slot roles. The first
two consume the same shared glossary format for different tasks. Collection
selection belongs on an external reference binding, not in module options;
`collections` is the intended configuration field. A binding selects the input
view, while the consuming domain code owns its interpretation.
When bound without an explicit selection, `spell_catalog` selects `spells`;
`glossary` selects available `campaign` and `setting` collections. Explicit
selections permit other collection names, including `party`. A missing explicitly
selected collection is an error. A missing default `spells` collection is a
spell-task suitability error; absence of default general-context collections
contributes no context. Neither glossary binding is required merely because the
other is supplied.
Selection travels with the binding through pipeline, lane, and stage scopes.
Existing `--reference slot=path` overrides replace the path and retain configured
collection selection; an otherwise unconfigured CLI binding uses the slot's
defaults. Ordinary Narratio invocations need no new CLI syntax. The same file may
be bound to both roles, with its complete content retained for shared validation.
The framework carries selection metadata without interpreting glossary content.
Extraction, normalization, and validators consume their resolved bindings using
the same selection rules, avoiding repeated collection options on individual
modules. Internal transport details belong in the implementation plan.
### Shared Conformance And Task Suitability
Provide one small shared-reference loading/validation integration, with
task-specific projections. Ordinary validation is offline, using
bundled exact-version schemas registered under their canonical IDs. Bundle the
adopted schema files and adjacent semantics without importing the schema
repository's internal Go validation harness or creating a runtime catalog client.
Load already-materialized reference bytes through ConfigKit's public
`Load[map[string]any]` and `Bytes` APIs. YAML and JSON use the same native loading
path. A standard JSON syntax check may enforce the JSON media convention, but
does not provide an alternate decoder. Pass `Result.Config` directly to the
existing JSON Schema engine, then apply shared semantic checks and D&D task
selection. ConfigKit owns parsing, duplicate-key checks, scalar binding,
structural resolution, native limits, and native diagnostic details.
Use a single-source load without enabling import traversal, selecting overlays,
or supplying application defaults, custom resolvers, overrides, or secrets
bootstrap. Native structural behavior still applies: `extends` is structural
input and source-root `config` has native control semantics even when imports
are off. Do not suppress or reinterpret these controls with a pre-parser.
Nested ordinary `config` data follows upstream behavior. This shared-reference
load is separate from the one application-owned configuration result and does
not reconstruct Notarius's application configuration or its engine.
Keep the resolved mapping as the document representation and build only the
small projections consumers need. No separate raw/typed document SDK, generic
subtree converter, serialization round trip, or forwarding API is needed.
Existing reference transport can retain original bytes; resolved values need
not preserve authored spelling, numeric precision, or consumed controls. If a
shared document is forwarded, use its supported resolved values and extensions.
JSON is subject to the same native limits; it is not a universal escape hatch.
Validate the complete resolved document before projecting selected collections.
Enforce the upstream semantic rule that glossary entry IDs are unique within
each collection using exact comparison. Reuse of an ID in another collection is
valid. Do not require globally unique names, aliases, player names, or IDs, or
introduce cross-document referential-integrity checks.
Honor omission, null, empty values, and optional fields exactly where the
selected contract permits them. In particular, omitted/null/empty aliases are
supported, while null is not interchangeable with omission for every optional
field. Shared authored-input schemas are not private LLM response schemas and
do not inherit provider-specific restrictions on optional response properties.
Accept permitted extensions within the native resolved-value boundary.
Task-specific projections may omit irrelevant fields. An ordinary extension
named `instruction` does not become model guidance. Native reserved controls keep
their upstream meaning; additional domain interpretation must be deliberate.
Keep shared conformance separate from task suitability. A valid document may
still lack a selected collection or contain spell-recognition ambiguities.
Report those as task requirements with reference/collection/field context where
practical, rather than redefining the upstream schema. A selected empty spell
collection adds no vocabulary to the embedded catalog; it is not malformed.
ConfigKit retains ownership of loading and composition. Notarius does not add
another authoring merge language or a compatibility parser. Roster, glossary,
and provenance content remain auxiliary context. The current transcript remains
the sole source of event evidence and durable source ranges.
### Spell Recognition
Replace the operator-facing private overlay reader with a shared-glossary reader.
Remove the old envelope parser and legacy overlay fixtures when the cutover
lands; provide migration instructions rather than conversion shims.
Project selected entries into canonical names and aliases for the existing
effective catalog. Keep stable shared entry IDs and optional provenance available
for internal attribution and useful diagnostics, without asking models to copy
those IDs. Spell recognition does not need new required category values or
catalog metadata merely to consume a selected spell collection.
Retain the existing recognition policy unless a separately reviewed change is
needed:
- Start with the embedded D&D 5e 2014 SRD vocabulary.
- Add new canonical spell names and augment known canonical spells with aliases,
retaining the established embedded display spelling for a known spell.
- Apply the existing case, whitespace, and apostrophe lookup normalization to the
task view, without rewriting the authored shared document.
- Accept repeated aliases identifying the same spell; report normalized
canonical/alias collisions identifying different spells. These are recognition
conflicts, not shared-schema failures.
- Use the same resolver and selection semantics for extraction, normalization,
and catalog validation. Deterministic presentation and conflict outcomes must
not depend on YAML mapping order or upstream list order implying precedence.
The existing spell family determines the embedded ruleset. Do not require an
overlay-style `ruleset` or provenance title on the shared glossary, infer a
ruleset from Narratio selectors, or add a ruleset extension solely for parity
with the retired format. A future multi-ruleset workflow can establish its own
explicit selection if needed.
Keep the prompt projection focused on recognition vocabulary. Descriptions and
provenance do not become spell effects, rules, or transcript evidence. No new
spell extraction fields or output schema changes are part of this adoption.
### Party And General Context
Reuse `party` for the shared party contract and `glossary` for the shared glossary
contract, making a documented direct cutover for those slots alongside the
spell-overlay replacement. Existing `roster` aliases, where already accepted,
retain their current slot-alias behavior while consuming the same new party
contract. These slots have one structured contract each, without legacy text
readers, format detection, or parallel structured slot names. Supplying party
and glossary references remains optional where it is optional today.
Keep `players` as optional supplemental text context. Derive ordinary
character/player relationships from the shared roster so the maintained workflow
does not need a separately authored player list. This cutover does not add a
typed campaign input or remove unrelated text interfaces.
Use a deterministic, contextual party projection for the chunker and extraction
families that already accept party context. It can include character names,
aliases, player relationships, and relevant optional attributes without exposing
opaque character IDs for model selection. Missing players or classes remain
valid; the application does not invent them. Equal display names do not merge
distinct roster entries merely because they compare equally.
Project selected general-glossary collections into useful reference vocabulary.
Selection is explicit task policy, not an attempt to parse all unknown domain
extensions or execute collection content. Party-derived vocabulary may be
consumed where useful but is not required alongside a roster containing the same
facts.
Do not add a required campaign file, a typed campaign reference slot, or campaign
locator traversal without a demonstrated task. The shared RPG campaign contract
is reviewed context for this work, not a commitment to interpret it. Existing
ordinary text contexts outside the selected cutover do not need typed interfaces
solely because a campaign schema exists.
### Preparation And Readiness
Resolve and validate the selected external structured references during shared
local pipeline preparation, before chunking or other domain inference. Existing
module construction receives materialized references and already validates spell
catalogs; extend that path for the new shared readers and context projections.
Keep schema/domain interpretation in its owning integration code, not hardcoded
into the CLI or generic pipeline. Reuse prepared data where appropriate rather
than parsing the same roster or glossary for every chunk.
Explicit preflight must catch determinable malformed documents, incompatible
markers, semantic duplicate IDs, unavailable explicitly selected collections,
and spell-recognition conflicts using the same rules as execution. Run checks
its actual supplied documents even when a caller previously ran preflight.
Preserve the existing boundary between offline `pipeline validate` and explicit
preflight: ordinary offline pipeline validation does not start reading reference
bytes. Ordinary execution does not acquire preflight's destination probes or
provider smoke checks. A synthetic transcript establishes readiness only for that
input and its supplied references, not for a future transcript.
Use existing native outcomes/readiness reports and actionable diagnostics. No
new result protocol or warning system is needed. Invalid operator references
are input/preparation errors, not model-quality failures to repair with retries.
## Required Work Areas
| Area | Work needed |
| --- | --- |
| Shared contract assets | Bundle exact adopted schemas and adjacent semantics, source/version identification, and applicable license material in the content-only asset tree. Keep validation logic outside `assets`. |
| Shared input integration | Use one native ConfigKit byte-source load, validate the resolved mapping against bundled schemas, and apply glossary semantic checks. Build only the task projections needed by consumers. |
| Reference binding | Add binding-level `collections` selection and carry it through normal configuration/CLI override resolution without implementing a new composition system. Update reference declarations and accepted media types for affected consumers. |
| Spell family | Replace private overlay parsing in `internal/modules/dnd/spells/catalog`; adapt effective-catalog composition, prompt projection, and useful input diagnostics. Exercise extraction, normalization, and catalog-validator constructors together. |
| D&D context consumers | Update `internal/modules/dnd/shared`, applicable chunk/extract constructors, shared reference prompt content, and any direct reference presentations bypassing those helpers. Derive player context from the roster without requiring duplicate authored data. |
| Shared preparation and preflight | Ensure all selected external typed references receive domain validation during the existing preparation path, for both run and explicit preflight. Cover stage-scoped overrides as well as pipeline defaults. |
| Examples and documentation | Replace private overlay examples; supply synthetic shared party/glossary documents; update configuration, integration, D&D subprocess, and relevant internal documentation with the implemented bindings and cutover. |
This work does not require a general parsed-reference registry, a new public
schema API, or a repository-wide package reorganization. Shared input integration
owns conformance, D&D consumers own interpretation, and the framework transports
binding metadata without interpreting glossary content.
## Documentation, Migration, And Ownership
Create a focused integration document for Notarius's shared-input support. It
owns exact supported versions, accepted serializations, consumer roles,
collection selection, recognition adaptations, and task suitability. Link to
the selected upstream semantics and validation documentation for the shared
formats rather than maintaining a competing format specification. Link native
loading behavior to ConfigKit; do not copy its parser manual or maintain a local
compatibility matrix. Bundle essential schema/semantic content, not copies of
upstream validation manuals or example archives.
Replace or retire `docs/integrations/dnd-spell-catalog-overlays.md` when its reader
is removed, updating inbound links. Update `docs/config.md` for binding fields and
defaults, `docs/consumers/dnd-pipeline.md` for first-class subprocess usage, and
focused internal docs for implemented ownership. Put complete copyable examples
under `examples/dnd-complete/`; leave the minimal configuration minimal.
Document the direct cutover in the release carrying the feature and its migration
guidance. Explain how old names/aliases map to shared entries, which old metadata
is optional provenance or unnecessary, and how replaced text references move
under the approved input design. No legacy overlay reader, automatic conversion,
or dual authoring workflow is required. Do not choose a release number or tag
as part of this planning pass.
Record incorporated schema material under the repository's
[OSS policy](../policy/oss.md), using the selected source revision and its actual
CC0-1.0 grant and notices. Keep `assets` a content-only leaf. This adoption fits
existing architectural ownership boundaries and does not require a new ADR.
## Acceptance And Verification
The implemented feature should demonstrate:
1. A single synthetic shared spell document supplies canonical names and aliases
to Notarius without a private overlay. Validate it against the pinned upstream
contract. Cross-application execution is an interoperability check when the
other consumer has adopted that contract, not a claim about current Audita
compatibility or a dependency of Notarius's offline test suite.
2. A multi-collection file reaches only its selected task views. Unrelated
collections need not exist, explicit missing selections have useful errors,
and empty valid collections remain usable according to their task role.
3. One shared roster supplies character aliases and player relationships to the
maintained pipeline without duplicate player/party-vocabulary authoring.
Optional attributes and duplicate display labels follow the shared contract.
4. Equivalent native-supported YAML and JSON inputs produce equivalent task
material through the same ConfigKit load. A few public-API integration tests
cover successful handoff and representative native failures, without copying
ConfigKit's parser suite or adding precision/serialization guarantees.
Structural and semantic tests cover omission/null/empty behavior,
extensions, per-collection ID uniqueness, and incompatible markers.
5. Recognition tests preserve embedded vocabulary, canonical display, same-spell
alias augmentation, and deterministic collision handling. General glossary
validity is tested separately from recognition suitability.
6. Preflight and run reject the same determinable bad structured references
before domain inference. Fake provider boundaries prove valid projections
reach their intended tasks and reference-only entries do not create events.
7. Bundled schema validation requires no network, schema-repository installation,
or credentials. The native resolved mapping retains supported domain
extensions; model-facing projections omit opaque IDs and do not promote
ordinary extensions to instructions or override native reserved controls.
8. Existing output artifact contracts, generated handoffs, input-based session
identity, native report shape, and cache policy remain intact. Updated prompt
material participates in existing native cache identity; add no separate
schema/provenance cache-key dimension or automatic cache migration.
Use focused package tests for the readers, spell family, shared projections,
reference resolution, and representative CLI preflight/run behavior. Reuse
upstream fixtures selectively for meaningful contract risks rather than copying
the upstream test harness. Avoid prompt prose snapshots and redundant tests of
the same parser behavior in every extractor.
For the implementation, run `go test ./...`, `go vet ./...`, and
`go build ./cmd/notarius`, validate the maintained examples, and check affected
links and stale private-overlay references. Paid/provider tests and coordinated
Narratio/Audita deployment runs are optional follow-up evidence, not default
offline correctness gates.