Files
audita/docs/roadmap/shared-glossary.md

323 lines
19 KiB
Markdown

# Shared Glossary Adoption
**Status:** Proposed; application configuration layout and version remain open below.
## Purpose
Adopt the Maximum Direct shared glossary contract so Narratio can pass prepared
vocabulary directly to Audita, and operators can reuse that vocabulary with
Notarius and relevant Scriptorium prompts. Separate reusable domain data from
Audita's correction instructions without requiring duplicate vocabulary files.
This roadmap responds to the [Narratio feature request](narratio-shared-glossary-feature-request.md).
It defines the target and work areas; a subsequent implementation plan will
specify ordered implementation steps after the open decisions are resolved.
## Current Baseline
The baseline is Audita v4.2.0, with the feature request recorded at repository
commit `4c2b11aa45579d89f04ac2ab4903c7cb036bef72`.
- Application configuration uses version 3. `glossary_collections` contains named
collections with `entries` and an optional executable `instruction` string.
Automatic `glossary.yml` and recursive `glossary/` YAML companions supply
wrapperless collections through ConfigKit imports.
- Repeated `--glossary-file` arguments compose wrapperless YAML mappings in a
preliminary ConfigKit load, in argument order, using native imports,
inheritance, and entry identities. The resolved mapping becomes one CLI
assignment to `glossary_collections` in the application load. Supplied entry
lists replace configured lists at that boundary; unrelated configured
collections and omitted fields remain subject to native assignment semantics.
- Runtime collection instructions currently reach proposal prompts and remain
in correction-repair conversations. Entry extensions are accepted, but the
collection type does not represent arbitrary collection extensions or defined
provenance. There is no shared envelope or shared-schema validation boundary.
- Typed validation checks several glossary values, but does not fully express
shared required-field and null distinctions. Selection also deduplicates
collection/entry identities; that is not a substitute for validating completed
shared inputs.
- Root and per-stage `glossaries` and `protected_terms` select vocabulary
independently. Loading collections does not select them. Glossary correction
requires at least one selected entry at processing readiness; empty collections
remain valid configuration.
- Processing, standalone preflight, and native configuration-consuming commands
share application acquisition. Preflight and processing share local readiness
planning; native inspection does not require a processing-ready pipeline.
The current [input](../integrations/transcript-glossary-files.md),
[configuration](../config.md), and [CLI](../cli.md) documents own the implemented
contracts. Main implementation boundaries are `internal/appconfig`,
`internal/core/config`, `internal/core/glossary`, framework preflight and prompt
context, and CLI acquisition.
## Target Upstream Contract
Target `glossary@0.1.0` from schemas distribution `2026.11.0`, whose tagged
source is commit `1b8430bdcbf04eb98c8d45c98a1cb986a9e6d477`. The operator document
marker is `maximumdirect.glossary.v1`; it is distinct from both version numbers
and from Audita's application configuration version.
Use the versioned schema and semantics together:
- [Canonical schema](https://schemas.maximumdirect.net/glossary/v0.1.0/schema.json)
and [semantics](https://schemas.maximumdirect.net/glossary/v0.1.0/semantics.md).
- [Published source](https://forge.maximumdirect.net/eric/schemas/src/tag/2026.11.0/glossary/v0.1.0),
[inventory](https://forge.maximumdirect.net/eric/schemas/src/tag/2026.11.0/catalog.json),
[validation profile](https://forge.maximumdirect.net/eric/schemas/src/tag/2026.11.0/docs/validation.md),
and [compatibility guidance](https://forge.maximumdirect.net/eric/schemas/src/tag/2026.11.0/docs/compatibility.md).
Bundle the selected glossary schema and adjacent semantic document from that
distribution, with their provenance and applicable licensing material. Register
the schema locally so ordinary validation works offline. No schema-registry
lookup, moving latest inventory, or dependency on the schemas repository's
internal Go validation harness is needed. Audita already imports JSON Schema
and YAML libraries; assess their use at the existing adapter boundary before
adding a dependency. Party and campaign schema adoption is outside this work.
## Targeted End State
### Shared documents and native composition
`--glossary-file PATH` accepts the shared `schema_version` and `collections`
envelope in YAML or equivalent JSON. Preserve repeated arguments, paths relative
to the invocation working directory, and separate collection-selection controls.
Narratio's prepared document needs no envelope removal or field renaming.
ConfigKit continues to own imports, layering, inheritance, entry identities,
presence, overrides, and source evidence. Authoring fragments can contribute to
a completed document without independently satisfying the complete schema.
Validate completed shared documents at the composition boundary, before a typed
projection can erase invalid field types or presence distinctions. Do not fill
missing required shared fields merely to make a supplied document pass.
Retain the existing runtime composition model: compose the ordered runtime
sources and their imports, then apply the resulting shared data through native
application assignment. Preserve native entry-list replacement at that
assignment, unrelated configured collections, and native handling of omitted,
empty, and null values, subject to validity of the resulting document. Runtime
inheritance need not gain access to parents defined only in application
configuration, and application structural inheritance need not rerun after CLI
assignment. Do not introduce a separate Narratio merge or collision policy.
The recommended application layout is a shared envelope under `glossary`, with
shared companion documents mounted there and Audita instructions stored
separately. This layout, including its effect on inline configuration, is the
open decision below. Whichever layout is selected, validate the effective shared
vocabulary before deriving processing views and use the same acquisition path
for all commands accepting runtime glossary files.
### Configuration-owned instructions
Provide an application-owned instruction map keyed by collection name; the
recommended field is `glossary_instructions`. A configuration can attach guidance
to `spells`, for example, without containing or copying any spell entries.
Ordinary ConfigKit configuration, overlays, inheritance, and overrides govern
these settings. The map is independent of shared vocabulary assignment.
Retain existing prompt behavior for configured guidance: selected context
collections contribute their instructions in selection order, protection-only
collections do not contribute instructions, and guidance remains available
during correction repair. Instructions do not become deterministic validation
rules. A configured instruction association alone does not require its collection
to be present or selected; existing task selections determine required vocabulary.
A shared extension named `instruction`, at collection or entry level, is inert
domain data. It cannot supply, replace, or clear configured guidance. Preserve it
where a shared document is retained or forwarded, while allowing prompt-specific
views to omit it. Move existing executable collection instructions into application
configuration as part of migration. This separation does not promise that an LLM
can never misinterpret arbitrary domain text.
### Contract conformance and task readiness
Apply the pinned structural schema, semantic rules, and completed-document
decoding profile. In particular:
- Preserve the contract's required-field, omitted, null, and empty distinctions,
including nullable aliases and plural forms. Do not trim, case-fold, coerce,
or default shared values as a schema-repair step.
- Accept permitted extensions at envelope, collection, provenance, and entry
levels. Preserve them when forwarding a shared document; internal task views
can select only the fields they use. Acceptance does not imply interpretation,
and serialization formatting need not be preserved.
- Reject duplicate entry IDs within a completed collection using exact string
comparison. IDs can repeat across different collections. Do not add uniqueness
requirements for display names, aliases, or categories, or confuse legitimate
native layering of an identity with duplicate final entries.
- Respect the upstream decoding profile, including duplicate mapping-key and
numeric-value handling. Check the actual ConfigKit/parser behavior at the
handoff rather than assuming that using the same YAML library proves
conformance. Resolve any substantive upstream gap explicitly instead of
silently accepting a narrower glossary format or adding a competing loader.
Keep schema validity separate from Audita task readiness. Empty collections and
an empty collection map are valid shared data. A selected glossary-correction
stage still requires at least one selected entry; a selected missing collection
still fails. Loading vocabulary does not select all collections. Preserve root
and stage selection resolution, default protection derivation, and the glossary
stage's active-spelling exemption.
Collections and categories remain domain-defined strings. `party`, `campaign`,
`setting`, and `spells` are Narratio conventions, not mandatory names or a fixed
enumeration. Provenance is source metadata, not transcript evidence or processing
guidance. Notarius-specific spell extensions can be accepted without being used.
Shared-data identity and correction matching have different purposes. Exact ID
validation does not require replacing Audita's existing spelling matching,
protection, or editorial acceptance behavior with exact-string matching.
### Preflight and inspection
Preflight and processing accept the same effective vocabulary, apply the same
collection selections, and detect malformed shared documents, unsupported markers,
missing selections, and determinable task-input failures before correction calls.
Processing still checks its actual transcript and inputs.
Narratio can continue to preflight its real prepared glossary files with a
known-good synthetic transcript through the ordinary command. This adds no
fixture mode or guarantee about a later transcript. Preserve existing provider
smoke checks, local-only preflight, output-readiness behavior, and reporting scope.
Native effective configuration, explanation, comparison, and other commands that
accept glossary files use the shared acquisition semantics. Comparison continues
to apply the same runtime file list to both sides. Inspection validates shared
data but need not meet processing-only readiness requirements or contact a model.
Preserve source paths needed for output collision checks, including imports.
Diagnostics should identify an affected file, collection, or field where practical
through existing native reporting; a new error taxonomy or report protocol is
not part of adoption.
## Work Required
- Incorporate the pinned contract assets and provenance. Add the appropriate
component entry and license material under the [OSS policy](../policy/oss.md)
when copying the upstream assets; the selected original material is CC0-1.0.
- Adapt shared application acquisition, companion mounting, runtime composition,
and native sequence-identity selectors to the selected layout. Add structural
and semantic validation at the completed-document boundaries and carry the
validated data into typed consumer views without losing required distinctions.
- Separate configured instructions from vocabulary and update selected prompt
context and repair wiring. Retain one shared implementation for processing,
preflight, and configuration-consuming native commands.
- Update glossary selection and protection integration for the new representation
while preserving their existing behavior. Preserve source evidence and output
collision protection across the adapted load path.
- Replace maintained wrapperless examples and embedded-instruction examples with
shared inputs and configuration-owned instruction associations. Include a
generic-domain example and a Narratio-style composition without requiring
access to another application's installation.
- Update the canonical [input contract](../integrations/transcript-glossary-files.md),
[configuration](../config.md), [CLI](../cli.md), affected internal guides, and
examples. Link upstream for schema and library definitions; document locally
the Audita-specific mounting, precedence, selection, readiness, and guidance
behavior. Update the deferred Narratio adoption description when this work lands.
- Write migration guidance and release documentation for the intentional cutover.
Retire superseded format handling rather than adding compatibility shims,
automatic legacy conversion, or a second operator-maintained vocabulary.
These are work areas, not implementation stages. No package layout, additional
framework, exact parser sequence, or intermediate compatibility mechanism is
prescribed by this roadmap.
## Verification and Acceptance
Use focused offline tests at the owning boundaries and representative assembled
workflows under the [testing policy](../policy/testing.md). Control any model
boundary; real Narratio, Notarius, or paid providers are not prerequisites.
Evidence should establish that:
1. Equivalent shared YAML and JSON documents are accepted directly, and selected
entries reach correction and protection views. Generic collections work, and
unrelated collections need not exist or be selected.
2. A representative shared spell document can be consumed without an Audita-only
vocabulary copy. Defined provenance and irrelevant permitted extensions are
accepted. This demonstrates Audita's boundary, not completion of another
application's adoption.
3. Required fields, nullable and empty cases, malformed known fields, unsupported
markers, and exact final entry-ID uniqueness follow the adopted contract.
Include representative decoding-profile cases and verify that ordinary
validation needs no network access.
4. Repeated files, imports, inheritance, application vocabulary, overlays, and
CLI assignment follow native composition. Partial contributions can produce
a valid final document; identity layering and invalid duplicate final entries
are tested as distinct cases.
5. Configured instructions survive vocabulary replacement, reach the selected
proposal and repair context, and can be changed through native configuration.
Shared `instruction` extensions neither supply nor clear guidance.
6. Empty shared data can be inspected; processing-only missing or empty glossary
selections fail before correction calls in both preflight and processing.
Native inspection and comparison expose consistent effective inputs, with
permitted extensions retained when exposing a shared document.
7. Maintained examples, supported-contract identification, migration guidance,
and source/attribution records match the delivered interface. Existing
transcript and corrected-output formats remain unchanged by this adoption.
Consolidate coverage where one behavioral test protects multiple cases. Tests
should not freeze incidental loader call order, private Go types, diagnostic
wording, or formatting of preserved data.
## Compatibility and Scope
Plan an intentional breaking release. The recommended application-layout change
breaks existing valid configurations, so a new major release is appropriate under
the [release policy](../policy/release.md). Follow the existing major-module
migration steps in the [release runbook](../release.md) when preparing that release.
The shared document generation does not itself dictate Audita's configuration
version; set any application version change deliberately when finalizing the
layout rather than matching unrelated version numbers.
Migration must explain the shared envelope, retained runtime flag, companion
format and inline configuration changes, instruction relocation, and retained
selection/composition behavior. Narratio's adapter migration and the separate
`audita-pipelines-dnd` recipe updates belong to their own repositories and can
target the resulting released interface.
This work does not change transcript schemas, correction strategy, validator
acceptance, retry or repair budgets, chunk scheduling, report formats, or provider
readiness responsibilities. Forwarding extensions does not require adding a new
export command. These boundaries keep adoption focused; they are not permanent
prohibitions on later features.
## Open Decisions
### Should the shared envelope also become the application vocabulary format?
**Recommendation:** Replace operator-facing `glossary_collections` with a shared
envelope under application `glossary`. Mount automatic shared glossary companions
at that namespace and assign composed runtime shared data there through native
CLI overrides. Keep instructions in the separate `glossary_instructions` map,
and retain root/stage `glossaries` and `protected_terms` as selections. This
provides one vocabulary contract across runtime files, companions, inline
configuration, and effective inspection, preserves envelope-level extensions,
and reduces parallel validation and translation paths. It requires a broader
configuration/example migration, which fits the requested direct cutover.
**Viable alternative:** Adopt the envelope only at external glossary-file
boundaries, project its validated collections into the existing application
vocabulary model, and keep configured instructions isolated from that projection.
This reduces changes to inline application configuration and existing selections.
It also retains two public vocabulary representations and needs explicit handling
for envelope metadata, extension preservation in shared-document views, and
validation differences between inline and shared data. It is viable if minimizing
configuration churn outweighs the maintenance benefit of a unified model; the
unified approach is preferred for long-term consistency.
### Should the recommended layout advance the application configuration version?
**Recommendation:** If the unified layout is selected, advance Audita's
application configuration version from 3 to 4. Update the existing native version
check and migration guidance for the new shape, preserving the current ability
to omit the version and use the current schema. This makes explicitly versioned
old configurations fail with a useful migration diagnostic and gives the
application-format change a clear identity. It adds a small migration step; it
does not require a legacy reader or imply any relationship to the shared marker
or Audita's release major.
**Viable alternative:** Retain application configuration version 3 and document
the new layout as part of the breaking Audita release. This avoids changing
version declarations and is feasible because the application supports one
current configuration shape. However, the same explicit version would describe
incompatible layouts, making wrong-version diagnostics less useful. If adoption
is limited to external files and the application shape remains unchanged, keeping
version 3 is preferable to advancing it solely for a new external document format.