385 lines
24 KiB
Markdown
385 lines
24 KiB
Markdown
# 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.
|
|
- [Spell-catalog overlays](../integrations/dnd-spell-catalog-overlays.md) use 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.
|