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

384 lines
21 KiB
Markdown

# Runtime Glossary Inputs and Overlay Recipes
Status: Runtime input design, collection instructions, repository separation, and
initial recipe contracts agreed. Ready for implementation planning; these features
and overlays are not yet implemented. The external repository has development
scaffolding.
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).
Collections currently contain entries but no collection-level instruction field.
Stage preparation flattens 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 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 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.
## 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. Carry Instructions into Proposal Context
- Extend the collection configuration model with the optional string field and
retain it through normal configuration and runtime-file acquisition.
- Preserve collection names and their resolved instructions while constructing
the stage's flattened glossary entries. Prepare the instruction block with the
shared stage context, using the stage's glossary selection order.
- Expose the block as an additional proposal template variable and include it in
bundled proposal definitions. Keep the existing glossary entry payload usable
by operator prompt definitions. Use an empty default for the new variable in
ordinary previews that omit instructions.
- Reuse the existing repair conversation; no separate repair instruction loader
or validator-context expansion is part of this change.
### 3. Coordinate the External Recipe Contract
- Implement the agreed recipe contracts 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.
### 4. 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.
- Verify instruction selection, ordering, collection labels, omission of empty
instructions, and exclusion of protection-only collections through shared prompt
preparation. Cover entries-only CLI replacement retaining configured instructions.
Check that the repair conversation retains supplied guidance, without asserting
exact bundled prose or expanding validator-context tests for deferred behavior.
- 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.
### 5. 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. Document collection instructions
in the input/configuration owners and their proposal/repair use in the prompt
integration documentation. 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.
## 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.