Files
audita/docs/roadmap/runtime-glossary-inputs.md

333 lines
19 KiB
Markdown
Raw Normal View History

# Runtime Glossary Inputs and Overlay Recipes
Status: Runtime input design and repository separation agreed; external recipe
contracts remain 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-production \
--glossary-file session-glossaries.yml \
--output polished.json
```
The new flag and external D&D overlays are planned behavior. Audita remains
fully domain-agnostic and does not bundle a D&D pipeline. A separate
`audita-pipelines-dnd` repository will contain a short `README.md` and
`overlays/dnd-production.yml` and `overlays/dnd-testing.yml`. Operators install
these overlays beside their selected Audita main configuration and select them
through the existing overlay mechanism.
The external repository owns both overlays and their public contracts. Its README
will document supported Audita versions, glossary roles and required/default
inputs, profile requirements, installation, invocation, and the distinction between
the two recipes. It will link to Audita's native format and CLI documentation.
Production is the normal polishing recipe; testing is a cheaper, shorter
development run, not a candidate production recipe or a promise of equivalent
correction quality. The repository can evolve independently of Audita; Narratio
can target a selected tag or revision of its contracts.
### Ownership
- Audita owns domain-agnostic glossary interpretation, processing, validation,
and configuration mechanisms.
- `audita-pipelines-dnd` owns the D&D glossary role contract, stage selections
and order, and recipe-specific profile, prompt, and protection settings. Its
README is the public contract Narratio follows.
- Operators select and configure recipes, deployment settings, and reference
vocabulary. They can use the external overlays or maintain local recipes.
- 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. Coordinate the External Recipe Contract
- Resolve the external recipe decisions below in `audita-pipelines-dnd`. That
repository owns D&D examples and contracts; this roadmap tracks the integration
dependencies until those contracts have a canonical home there.
- Provide the two overlay files and a short README in that repository. Document
logical roles independently of file layout, with session-specific collections
alongside configured reusable references and a caller supplying all collections.
- State which collections each overlay selects and how empty definitions interact
with its stages. Do not add a global Audita requirement that every defined
collection be selected or nonempty.
- Keep stage sequencing and prompt tuning changeable without requiring Narratio
to encode those details. Reevaluate production quality empirically. Define
testing as a reduced-cost development path, retaining normal validation of the
corrections it proposes.
- The general Audita feature can be implemented independently of the final D&D
recipes. Creating or publishing the external repository is separate work from
this documentation update.
### 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 a domain-neutral overlay fixture with controlled model responses
where needed to prove the end-to-end handoff. Reuse existing tests for unchanged
domain rules. D&D recipe examples and their verification belong to the external
repository.
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 domain-neutral copyable artifacts in Audita
`examples/`; keep D&D artifacts and recipe documentation in `audita-pipelines-dnd`.
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
These decisions belong to the external D&D recipe contracts. They do not block
implementation planning for Audita's general runtime glossary input interface.
Recommendations below are proposals, not additional Audita invariants.
### 1. Which glossary roles and content requirements should both overlays expose?
**Context:** Narratio needs stable logical names to populate. Both overlays can
consume the same prepared vocabulary even when they process it differently.
Missing collection definitions and empty selections have different consequences:
empty definitions are valid, but a glossary stage needs at least one selected
entry in aggregate.
**Recommendation:** Use `party` (player characters and aliases), `campaign`
(campaign-specific entities and terminology), `setting` (reusable world vocabulary),
and `spells` (spell vocabulary) in both overlays. Provide empty defaults where
content is absent, preserving operator-supplied content through native composition.
Do not require every role to contain entries. Require only the content needed by
actual stage selections under existing preflight rules. Additional collections
remain allowed. This keeps one prepared dataset usable for production and testing
and accommodates campaigns with differing available references. The tradeoff is
that absent expected content can be valid rather than signaling an incomplete
Narratio preparation step.
**Alternative:** Make selected roles, such as `party` and `campaign`, required
nonempty inputs to the recipe contract. This gives Narratio a stronger readiness
check but excludes otherwise useful runs with sparse vocabulary. Such a
recipe-specific preparation check would belong with the integration, not a new
D&D validation rule in Audita. Another viable shape is one combined `session`
collection; it simplifies preparation but loses the role boundaries needed for
focused passes and independent replacement.
### 2. What should distinguish the production and testing stage sequences?
**Context:** Testing is agreed to mean a cheaper, shorter development run. The
exact stage sequences and glossary/protection selections have not been chosen.
Production should continue to evolve with observed correction quality.
**Recommendation:** Start production from Audita's current normal module sequence,
with the four roles selected together and existing protection behavior. For testing,
start with one glossary pass followed by grammar cleanup, using the same input
roles and ordinary validators. This exercises vocabulary correction and editorial
cleanup with fewer stages, without introducing a new execution mode. It provides
less coverage than production and does not guarantee a particular cost or duration.
**Alternative:** Use focused production passes, such as `party` plus `campaign`
followed by `setting` plus `spells`, with explicit protection selections. This
may improve results for large catalogs, but every glossary stage must have some
selected content; deployments lacking a group would need adjusted selections.
For testing, retaining the full production sequence with cheaper profiles is also
viable: it exercises all stages but may offer less predictable runtime savings.
Choose exact sequences through representative workload
experience rather than freezing these starting recommendations.
### 3. How should the overlays select model profiles?
**Context:** Fewer stages can reduce testing work, while model selection also
influences cost and turnaround. Recipes need a predictable profile-selection
contract without assuming an operator's credentials or provider deployment.
**Recommendation:** Have each overlay select an operator-defined proposal profile,
with documented names such as `dnd-production` and `dnd-testing`. Leave validation
and correction-repair profiles to existing fallback behavior unless explicitly
configured by the operator. The main configuration supplies native PromptKit
profiles, providers, and credentials; the testing profile can select a cheaper,
faster model. This keeps recipes portable and avoids maintaining provider-specific
catalogs, at the cost of requiring profile setup in each deployment.
**Alternative:** Have both overlays inherit the main configuration's profile
selection, with testing savings coming from fewer stages. This needs less setup
and works with any existing profile names, but overlay selection alone would not
select a cheaper model. Supplying concrete provider/model defaults in the recipe
repository is another viable choice for a turnkey deployment; it reduces setup
but ties the recipe more closely to particular providers and requires ongoing
review as model availability, performance, and prices change.