From 892cff808849f691a3b968223eac10b8e0b1a046 Mon Sep 17 00:00:00 2001 From: Eric Rakestraw Date: Thu, 26 Nov 2026 15:26:19 +0000 Subject: [PATCH] Plan runtime glossary inputs and overlay recipes --- docs/roadmap/runtime-glossary-inputs.md | 278 ++++++++++++++++++++++++ 1 file changed, 278 insertions(+) create mode 100644 docs/roadmap/runtime-glossary-inputs.md diff --git a/docs/roadmap/runtime-glossary-inputs.md b/docs/roadmap/runtime-glossary-inputs.md new file mode 100644 index 0000000..7465237 --- /dev/null +++ b/docs/roadmap/runtime-glossary-inputs.md @@ -0,0 +1,278 @@ +# Runtime Glossary Inputs and Overlay Recipes + +Status: Core approach agreed; recipe decisions open. Implementation has not begun. + +This roadmap records Audita's response to Narratio's runtime glossary input +request. It targets a supported handoff for prepared session vocabulary while +retaining Audita configuration as the owner of transcript processing behavior. + +## Current Baseline + +Audita v4.1 uses version 3 application configuration and ConfigKit v1.4.0. +Named `glossary_collections` already support root and per-stage selections, +independent protected-term selections, entry identities, and additional entry +fields. Automatic wrapperless `glossary.yml` and recursive `glossary/` companions +are anchored to the selected main configuration. See the +[configuration contract](../config.md) and +[input contract](../integrations/transcript-glossary-files.md). + +The shared loader in `internal/appconfig` performs main-source secrets bootstrap +and composes application and PromptKit settings. Processing and native inspection +use this shared configuration path. Processing preflight checks resolved glossary +selections and execution readiness separately from inspection. + +The CLI can select collections but cannot accept glossary files at invocation +time. Narratio still uses the former standalone glossary flag and format. Its +adapter also has other legacy CLI assumptions, including optional `--modules`; +adding this feature alone will not complete Narratio's migration. + +ConfigKit supports native file composition below the main configuration and +typed CLI overrides above the main and selected overlay. It does not directly +support high-priority file inputs with full source composition. The agreed +approach uses those existing APIs in two steps; it does not depend on an upstream +feature request or library upgrade. + +ConfigKit's [v1.4.0 configuration reference](https://forge.maximumdirect.net/base-layer/configkit/src/tag/v1.4.0/docs/config.md) +owns native loading, collection, and CLI override semantics. The sections below +define Audita's integration of those capabilities. + +## Targeted End State + +Narratio selects Audita's main configuration and an optional named overlay, +then supplies one or more prepared files of named glossary collections. Audita +loads those inputs, applies their resolved values at CLI precedence, and executes +the configured pipeline. The same inputs are available to native configuration +inspection. + +Use existing `--overlay` selection for named processing recipes. Without that +selection, the main configuration's effective pipeline applies. This feature +adds no separate `--pipeline` selector or pipeline registry. + +An illustrative target invocation is: + +```sh +audita process transcript.json \ + --config audita.yml \ + --overlay dnd \ + --glossary-file session-glossaries.yml \ + --output polished.json +``` + +The new flag and D&D recipe are planned behavior. Recipe delivery and its initial +contents remain open below. + +### Ownership + +- Audita owns glossary interpretation, processing, validation, and the mechanisms + for configuring recipes. A recipe defines its glossary roles and selections, + stage order, prompts, profiles, and protection behavior. +- Operators select and configure recipes, deployment settings, and reference + vocabulary. A recipe may be distributed by Audita or maintained locally. +- Narratio owns preparing session inputs, including projecting a campaign party + roster into Audita's native glossary format. It supplies those collections and + selects the configuration or overlay; it need not reproduce processing stages. +- ConfigKit owns parsing, imports, composition, inheritance, CLI assignment, + recorded resolution, and configuration evidence within each load. + +Logical collection roles are independent of filenames. A file can contain +several collections, and several files can contribute to one collection through +native composition. Extra collections remain permitted and only affect a stage +when selected. This is a general runtime input feature, with D&D as its initial +consumer workflow. + +### Runtime Input Surface + +Add repeatable `--glossary-file PATH`. Each argument names a required local file +in the existing wrapperless companion shape: collection names at the root, each +with its `entries`. Use the existing entry model, including extension fields; +there is no legacy-format conversion or Narratio roster parser in Audita. + +Resolve relative CLI paths from the invocation working directory. Imports in +these files use ConfigKit's native source-relative behavior. These paths do not +change the main configuration's identity, companion discovery, selected-overlay +context, or secrets-bootstrap source. + +Supplying definitions does not automatically select them. Existing +`--glossaries`, `--protected-terms`, and configured root and stage selections +continue to determine their use. An invocation without glossary-file arguments +retains its current configuration acquisition behavior. + +### Two-Step ConfigKit Integration + +1. Compose supplied glossary files in a preliminary ConfigKit load, with one + precedence layer per CLI argument, in argument order. Enable native imports + and register the existing collection entry identity, `id`, at the appropriate + glossary paths. Use native mappings as the handoff representation rather than + serializing and reparsing YAML. Later files have higher precedence; imports + within an input remain native peers. +2. Submit the resolved collection mapping as one `ck.Override` at + `/glossary_collections`, attributed to `--glossary-file`, in the normal shared + application load. This avoids duplicate or overlapping override records for + successive files. Application resolution and final validation see the + overridden values before processing preflight. + +The preliminary load uses native collection operations. With registered identity +and no explicit mode, matching entries are replaced as whole records, unmatched +entries survive, and new identities are appended. Native explicit collection +modes remain available. Audita does not implement an alternative merge policy. + +The final handoff uses **CLI semantics**, not collection upsert semantics: +mapping values combine recursively, while supplied sequences replace configured +sequences. Thus an incoming `party.entries` replaces the configured entry list +even if the configured collection has additional entry IDs. Other collections +remain available unless the supplied values explicitly replace or clear them +under native rules. Empty sequences, nulls, and omitted values follow ConfigKit's +rules and Audita's existing resolved-value interpretation and validation. + +For example, if configured `party` contains an old roster and configured `spells` +contains reference terms, supplying a new `party.entries` replaces the old roster +and retains `spells`. If two CLI files first contribute to `party`, ConfigKit +composes those files before that replacement occurs. + +The resulting glossary override has higher precedence than automatic companions, +the main configuration and its imports, and the selected overlay. Existing CLI +selection flags operate on different settings and continue to apply normally. +No custom ordering mechanism for hypothetical overlapping flags is needed. + +### Inheritance, Inspection, and Errors + +Inheritance in the preliminary load resolves among the supplied files and their +imports. It cannot inherit from the separately loaded application configuration. +Application structural inheritance is resolved before CLI assignment and does +not rerun afterward. Existing application resolution still derives stage settings +from the effective configuration using its normal rules. + +Expose the same glossary-file acquisition through the shared configuration path +used by processing and native inspection, including effective values, explanation, +and comparison. Apply the invocation's supplied files to each normal comparison +acquisition; this feature does not add side-specific file selectors. + +The final application result records the CLI override origin. Original file and +import provenance belongs to the preliminary load and is not transferred into +the final result. Accept this boundary; no custom provenance reconstruction or +additional inspection framework is needed. Errors from preliminary loading should +retain ConfigKit's available source diagnostics. + +Run ordinary application configuration validation and processing preflight on +the final values. Missing files, malformed input, unusable collections, and +invalid selections should flow through the existing input-error handling with +useful diagnostics. Native inspection remains independent of processing readiness. +The override does not bypass earlier ConfigKit parsing, inheritance, or decoding +failures. Empty collections remain valid configuration; glossary processing +stages still require at least one selected entry under existing preflight rules. + +## Work to Reach the Target + +### 1. Add the Runtime Input Bridge + +- Extend shared acquisition inputs to carry the ordered glossary file arguments. + Keep CLI parsing in the CLI layer and ConfigKit composition in the configuration + adapter; keep modules and validators unaware of the new source mechanism. +- Implement the preliminary native load and single override handoff, sharing + existing glossary identity definitions where useful. Leave domain validation + with the existing final configuration and preflight owners rather than creating + a second glossary validation policy. +- Preserve the main-source bootstrap path and normal cancellation/error handling. + Keep any preliminary-load bookkeeping local to acquisition; the application + and PromptKit still consume the final shared application result. +- Connect the repeatable flag to processing and native configuration-consuming + inspection. Help and version should remain free of configuration acquisition. +- Include acquired glossary files and imports in existing input/output collision + protections where applicable, using native source records rather than scanning + import declarations independently. + +### 2. Define and Demonstrate the Recipe Contract + +- Resolve the two recipe decisions below and provide a maintained overlay example + with prepared vocabulary and an invocation suitable for Narratio. +- Document logical roles independently of file layout. Show session-specific + collections alongside configured reusable references, plus a caller supplying + all collections. +- State which collections the recipe selects and how empty definitions interact + with its actual stages. Do not add a global requirement that every defined + collection be selected or nonempty. +- Keep stage sequencing and prompt tuning changeable without requiring Narratio + to encode those details. Reevaluate recipe quality empirically rather than + treating the initial module sequence as a permanent invariant. + +### 3. Validate the Integration + +Use real ConfigKit collaborators and a small set of behavioral tests under the +[testing policy](../policy/testing.md): + +- Prove that supplied entries override both main and overlay entries, while + unrelated configured collections remain and existing selection flags work. +- Exercise repeated files with matching identities, an import, and final entry + list replacement to protect the two composition boundaries. +- Verify equivalent effective values through processing and inspection, with + native CLI-origin evidence and useful file-load errors. +- Cover representative invalid-input and preflight failures before model work, + and preservation of the selected main's companion/bootstrap context when the + invocation directory differs. +- Exercise the maintained recipe with controlled model responses where needed + to prove the end-to-end handoff. Reuse existing tests for unchanged domain rules. + +Do not duplicate ConfigKit's full composition test matrix or lock prompt wording, +incidental formatting, or private helper structure into tests. Run focused tests +and the repository's normal build/full-suite checks when implementation lands. + +### 4. Document and Coordinate Adoption + +Update the canonical CLI, configuration, input, and subprocess integration +documents as the behavior lands. Put complete copyable artifacts in `examples/`. +Document the two composition boundaries, path bases, accepted file shape, role +selections, and available inspection evidence. Link upstream for native semantics. + +Coordinate Narratio's adapter migration separately: replace the legacy glossary +handoff with native collections, select the operator's configuration/overlay, and +review its remaining CLI and output assumptions against current Audita contracts. +Audita need not restore legacy flags to support that migration. Release notes +should describe the delivered feature; this roadmap does not select a release +number or extend any earlier one-time versioning exception. + +## Open Decisions + +### 1. How should Audita distribute the D&D recipe? + +**Recommendation:** Ship a maintained, copyable example configuration bundle +containing `overlays/dnd.yml` and its supporting examples. Operators deploy it +beside their selected main configuration and Narratio selects `--overlay dnd`. +This gives Audita ownership of a usable reference recipe through the existing +overlay mechanism, with no new embedded-overlay discovery or fallback behavior. +The tradeoff is an explicit deployment/update step for operators. + +**Alternative:** Bundle a built-in D&D recipe with automatic availability. This +reduces deployment steps and makes the recipe available with the executable, but +requires designing how it participates in native overlay selection and how +operator replacements take precedence. That is additional integration work beyond +the runtime glossary bridge; assess it before promising automatic availability. + +An operator-only recipe is also viable and keeps Audita's maintained surface +small, but leaves Narratio deployments to establish their own shared vocabulary +contract without a maintained reference. + +### 2. What is the initial D&D role and processing contract? + +**Recommendation:** Use the logical names `party`, `campaign`, `setting`, and +`spells`. Define empty defaults in the recipe for roles without supplied content, +select the four roles at the root, and initially reuse Audita's normal module +sequence and protection behavior. Narratio can replace session-specific entry +lists while configuration supplies reusable ones. Existing glossary-stage +preflight requires nonempty selected content in aggregate; do not additionally +require every role to contain entries. This accommodates campaigns with different +available vocabulary and avoids empty dedicated passes. Its tradeoff is that +initial glossary passes see combined context rather than specialized subsets. + +Document the role meanings: player characters and aliases for `party`; +campaign-specific entities and terminology for `campaign`; reusable world +vocabulary for `setting`; and spell vocabulary for `spells`. These are proposed +recipe names, not application-wide reserved names or a ban on extra collections. + +**Alternative:** Define focused stages, such as `party` plus `campaign` followed +by `setting` plus `spells`, with explicit protected-term selections. This exploits +the existing stage-specific context model and may improve corrections for larger +catalogs, but each glossary stage needs nonempty selected content. Deployments +without those inputs would need a different configured stage selection; this +alternative does not imply automatic skipping or conditional-stage machinery. +Choose the initial sequence based on representative workloads rather than +assuming that either combined or focused passes always produce better results.