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

328 lines
18 KiB
Markdown

# Runtime Glossary Inputs and Overlay Recipes
Status: The Audita runtime glossary feature is implemented; see the
[implementation plan](implementation.md). The external overlays and Narratio
adapter migration remain separate companion work.
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.
## Baseline Before Implementation
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).
Collections contained entries but no collection-level instruction field.
Stage preparation flattened selected collections into entry context for proposals.
Repair retains the original proposal conversation; validators prepare separate
context from matched entries.
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 could select collections but could not 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 uses the full production
stage sequence with a cheaper model for development; lower cost and turnaround
are the intent, without a fixed runtime or equivalent-quality guarantee. 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.
### Optional Collection Instructions
Add an optional plain-text `instruction` field beside a collection's `entries`.
This is proposal guidance for using that collection, alongside the module's
existing assignment and validation rules. It is distinct from an individual
entry's description and from the transcript-wide description.
For example, a wrapperless glossary document may contain:
```yaml
spells:
instruction: >
This glossary contains spell names that may appear in the transcript.
entries:
- id: fireball
name: Fireball
category: spell
```
For each stage, concatenate nonempty instructions from its selected `glossaries`
in selection order, visibly separating and labeling them with collection names.
Collections selected only through `protected_terms` do not contribute instructions.
Supply the resulting block to proposal generation for any module using that
selected glossary context. Omitted or empty instructions add no block content.
The field participates in ordinary ConfigKit inheritance and precedence, including
CLI-supplied collections. An entries-only CLI contribution preserves a configured
instruction through native recursive mapping assignment. Concatenation occurs
across the final selected collections; it does not concatenate superseded values
from different configuration sources. Keep the text literal: no additional
instruction templating, file references, or custom merge mechanism is needed.
Repair retains this guidance through the existing original proposal conversation.
Validation-context changes are deferred: validators continue to receive their
existing context and use their existing acceptance rules. The field does not add
new deterministic validation rules or alter validator ownership.
Audita owns the generic field and prompt-context plumbing. Domain-specific text,
including D&D instructions, belongs in operator content or `audita-pipelines-dnd`.
### 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.
## Delivery and Acceptance
Audita's delivery includes shared runtime-file acquisition, processing and native
inspection wiring, existing source collision protection for acquired files and
imports, and selected collection instructions in proposal and retained repair
context. Domain validation and processing readiness retain their existing owners.
The [implementation plan](implementation.md) defines the code changes, ordered
stages, focused tests, and documentation work for that application delivery.
Acceptance is based on observable behavior with real ConfigKit composition and
controlled model responses where needed:
- Supplied files override main and overlay entry lists while unrelated configured
collections and existing selection controls continue to work.
- Repeated files, imports, matching identities, and final list replacement respect
the two native composition boundaries. Entries-only contributions retain a
configured instruction.
- Processing and inspection see equivalent effective values; final evidence
identifies CLI assignment, and preliminary load errors retain useful diagnostics.
- Relative file paths use the invocation directory without changing the selected
main's companion, overlay, or bootstrap context. Acquired source files are
covered by the existing input/output collision protections.
- Selected instructions retain their order and collection labels through shared
context preparation and repair. Empty instructions and protection-only
collections do not contribute guidance. Validator context remains unchanged.
- Canonical CLI, configuration, input, subprocess and prompt documentation describes
the delivered interface. Audita's copyable examples are domain-neutral; native
library semantics remain linked to upstream documentation.
The general Audita feature is independently deliverable. The separate
`audita-pipelines-dnd` repository owns the overlays below, their short README,
examples, validation, supported Audita versions and deployment requirements.
Its public contract will describe logical roles independently of file layout,
including prepared session vocabulary alongside configured reusable references
and callers supplying all collections. Narratio follows that repository's selected
contract revision; it does not encode Audita's processing sequence.
Narratio's adapter migration is separate: replace the legacy glossary handoff,
select the operator's configuration/overlay, and review remaining CLI and output
assumptions against current Audita contracts. Audita need not restore legacy
flags. Release notes will describe delivered behavior; this roadmap does not
select a release number or extend any earlier one-time versioning exception.
## Agreed External Recipe Contracts
These contracts belong in `audita-pipelines-dnd` as its overlays are implemented.
They do not add D&D-specific rules to Audita. No significant open design decisions
remain for the current scope.
### Shared Glossary Inputs
Both overlays accept the same named roles:
| Collection | Content |
| --- | --- |
| `party` | Player characters and their aliases. |
| `campaign` | Campaign-specific entities and terminology. |
| `setting` | Reusable world vocabulary. |
| `spells` | Spell vocabulary. |
Provide empty defaults for absent content through native composition, preserving
operator-supplied vocabulary. Each role need not contain entries; normal preflight
requires at least one selected entry for each glossary stage. Additional
collections remain permitted. Narratio can reuse one prepared dataset for both
recipes, with configuration supplying reusable references where desired.
### Production and Testing Sequences
Start both overlays with Audita's current normal sequence: glossary, homophones,
glossary, spoken_word, grammar. Select the four roles together at the root and
use existing protection behavior. Testing retains the full production sequence
and ordinary validation; it achieves its development-cost objective through model
selection rather than removing stages.
Reevaluate production sequencing using observed results, keeping testing aligned
with the production sequence. The initial sequence is not a permanent invariant.
The recipe contract does not guarantee a particular cost, duration, or equivalence
of correction quality between models.
### Native PromptKit Profile Aliases
The external recipe repository supplies these profiles using native inheritance
from Audita's bundled OpenRouter catalog:
| Recipe/profile ID | Bundled parent profile | Reasoning effort |
| --- | --- | --- |
| `dnd-production` | `gpt-terra-latest` | `low` |
| `dnd-testing` | `gpt-luna-latest` | `medium` |
Each overlay selects its corresponding proposal profile. Define the alias with
`extends: {id: gpt-terra-latest}` or `extends: {id: gpt-luna-latest}` and the native
`reasoning_effort` field under the combined configuration's `promptkit.profiles`.
Inherit the backend and model from the bundled profile rather than duplicating
those definitions. This is native profile inheritance, not a new alias mechanism.
Validation and correction-repair profiles keep existing fallback behavior unless
explicitly configured by the operator. Operators supply credentials through the
usual PromptKit/ConfigKit mechanisms and can customize profiles using native
configuration. The recipe README will document the chosen aliases and deployment
requirements; it will not require operators to construct the default aliases
manually. Model catalog and provider behavior remain upstream-owned.