diff --git a/docs/roadmap/feature-request-narratio.md b/docs/roadmap/feature-request-narratio.md deleted file mode 100644 index eef6ea2..0000000 --- a/docs/roadmap/feature-request-narratio.md +++ /dev/null @@ -1,110 +0,0 @@ -# Feature Request: Runtime Glossary Inputs for Narratio - -Status: Proposed - -## Summary - -Provide a supported CLI interface for supplying one or more files containing -named native glossary collections to a processing invocation, alongside the -normal Audita configuration and selected overlay. - -Narratio would use this interface to hand Audita prepared campaign and session -data. Audita would own composing those inputs with its configuration, resolving -collection selections, and executing the configured polishing pipeline. - -## Current Baseline - -Audita v4.1 supports named glossary collections, native configuration imports, -and collection selections at the root and individual pipeline entries. These -contracts are described in the [configuration reference](../config.md) and -[input documentation](../integrations/transcript-glossary-files.md). - -The [CLI](../cli.md) can select collection names, but does not provide a runtime -glossary-file input. The former standalone glossary format is no longer a -processing input. Narratio currently passes a prepared session glossary using -the former interface and needs a native replacement for that handoff. - -## Consumer Use Case - -Narratio orchestrates D&D transcript generation and polishing. Operators supply -campaign inputs such as a party roster, campaign-specific names, and reusable -setting or spell references. Narratio prepares session inputs and can derive -tool-specific projections from structured data it already understands. - -A useful Audita invocation could have these logical collections available: - -- `party`: character names and aliases derived from the campaign party roster. -- `campaign`: campaign-specific people, places, organizations, and terminology. -- `forgotten_realms`: reusable setting names. -- `spells`: reusable spell names. - -These are illustrative names and inputs. Different campaigns can supply -different collections. Separate collections let Audita's pipeline select -focused context for different polishing passes. - -For example, Narratio could supply prepared `party` and `campaign` collections, -while operator-maintained Audita configuration imports reusable setting and -spell collections. The configured pipeline would select the collections needed -by each pass. Narratio could also supply all of the collections when that is -more convenient for the deployment. - -## Requested External Behavior - -- Allow a processing caller to supply one or more local files containing named - glossary collections using Audita's native glossary model. -- Make the supplied collections available to the existing root and per-entry - collection selections. Preserve separate collection identities rather than - requiring callers to flatten all entries into one glossary. -- Support runtime glossary inputs alongside the selected main configuration, - overlay, and ordinary companion inputs. The operator's selected configuration - remains the entry point for its usual configuration and secrets-bootstrap - behavior. -- Define how runtime inputs compose with configured collections, including - file ordering where relevant and the treatment of overlapping collection - names and entry identities. Use native configuration semantics where - applicable; Narratio will follow Audita's documented behavior. -- Expose the runtime inputs through a supported configuration-inspection - workflow so operators can inspect the resolved collections, selections, and - available provenance for the invocation. -- Apply Audita's normal configuration validation and processing preflight to - the resulting configuration, with actionable errors for unusable inputs or - selections. - -The exact CLI spelling, accepted native file shape, and composition rules are -for Audita to define. This request specifies consumer-visible capabilities -without prescribing internal implementation. - -## Ownership Boundary - -The operator owns campaign content and reusable reference libraries. Narratio -owns selecting and preparing its session inputs, including projections such as -a glossary derived from a party roster. Its Audita integration produces the -supported native input format. - -Audita owns loading and composing the supplied collections, interpreting them, -and selecting and applying them through its configured pipeline. Operators -continue to define processing order, profiles, prompts, and per-pass collection -selections in Audita configuration. Narratio selects that configuration or an -overlay and supplies the runtime data. - -## Supporting Rationale - -A runtime input interface preserves Narratio's prepared-session handoff: polish -can consume the selected session data rather than independently loading a live -campaign source that may have changed since preparation. It also lets Narratio -reuse a canonical party roster across downstream tools while supplying Audita -with an appropriate projection. - -Without this capability, Narratio would need to generate an Audita entry -configuration that combines operator settings with prepared glossary data. -Changing the selected entry file also affects companion discovery, overlay -locations, and bootstrap context. A supported runtime handoff lets Audita own -those semantics and reduces consumer-maintained configuration machinery. - -## Scope - -This request concerns runtime glossary data and its composition with existing -Audita configuration. It does not request restoration of the legacy glossary -format, direct parsing of Narratio party rosters, or support for a -Narratio-generated processing pipeline. Existing configured glossary workflows -remain useful for standalone Audita users and reusable reference collections. diff --git a/docs/roadmap/future.md b/docs/roadmap/future.md index b0e7eff..0d7baae 100644 --- a/docs/roadmap/future.md +++ b/docs/roadmap/future.md @@ -1,6 +1,6 @@ # Deferred Feature Work -**Last updated:** 2026-11-15 +**Last updated:** 2026-11-26 **Status:** Deferred or exploratory work; not implemented or scheduled. These entries preserve work beyond completed feature and library upgrades. @@ -96,3 +96,89 @@ Broader validator context and combined semantic validation remain exploratory. A proposal to expand context should identify a captured case and the evidence missing from the validator request. See the [current validator context](../internal/validators.md#supplemental-validation-context). + +## D&D Recipes and Narratio Adoption + +Audita's runtime glossary feature is implemented. Its current interface belongs +in the [CLI](../cli.md), [configuration](../config.md), and +[input contracts](../integrations/transcript-glossary-files.md). The companion +work below remains separate from Audita's completed implementation sprint. + +The `audita-pipelines-dnd` repository owns the planned +`overlays/dnd-production.yml` and `overlays/dnd-testing.yml`, domain-specific +collection instructions, synthetic examples, and public recipe contracts. +Preserve the agreed contracts below until that repository owns them canonically. +Its README should document supported Audita versions, roles and default inputs, +profile requirements, installation beside the selected main configuration, +invocation through the existing overlay mechanism, and the distinction between +production and testing. Link to Audita's contracts and native library references. +Update its provisional agent guidance as the recipes land. No custom installer, +loader, pipeline selector, or D&D-specific Audita behavior is needed. + +The recipes should support prepared session collections alongside configured +reusable references and callers supplying all collections. Logical roles are +independent of filenames. Operators can use these overlays or maintain local +recipes; Narratio can target a selected recipe tag or revision without encoding +the stage sequence. Production is the normal polishing recipe, and testing uses +a cheaper model for development. Neither has a fixed runtime, price, or quality +guarantee. Offline recipe checks belong in that repository; empirical quality +evaluation remains separate. Publishing recipes is independent of Audita releases. + +Narratio separately migrates its adapter to supply native runtime glossary files, +select the operator's configuration/overlay, and review its remaining CLI/output +assumptions, including legacy `--modules`. It owns projecting campaign/session +content such as party rosters into native collections. This work does not restore +legacy Audita flags or formats. + +### Shared 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. + +### Initial stage 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. + +### 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. diff --git a/docs/roadmap/implementation.md b/docs/roadmap/implementation.md deleted file mode 100644 index afddaaf..0000000 --- a/docs/roadmap/implementation.md +++ /dev/null @@ -1,335 +0,0 @@ -# Runtime Glossary Inputs: Implementation Plan - -Status: Complete for Audita. Companion deliveries remain separate as described below. - -Implement the target defined in [Runtime Glossary Inputs and Overlay Recipes](runtime-glossary-inputs.md). -That roadmap owns product intent, precedence, instruction semantics, and external -recipe contracts. This document owns the ordered implementation work for a Luna -coding agent. - -## Scope and execution - -Implement the stages in order as one end-to-end Audita sprint. Intermediate -stages may leave callers or tests temporarily uncompilable. Update callers -directly; temporary compatibility wrappers, duplicate loaders, and migration -scaffolding are unnecessary. Run focused checks when the affected path is wired, -and perform final validation in Stage 6. Follow `docs/development.md` and the -applicable agent, architecture, testing, and documentation policies. - -The sprint delivers the domain-neutral Audita feature. D&D overlay implementation -and Narratio's adapter migration are independent companion work, described under -Delivery boundaries below. Do not change sibling repositories in this sprint. -No dependency upgrade, release publication, legacy flag restoration, application -configuration version bump, or new output schema is required. - -Use ConfigKit v1.4.0 for native composition and CLI assignment, CommandKit and -its integrations for typed flag binding, and the existing proposal/repair path. -Do not add a local merge engine, provenance reconstruction, instruction renderer, -validator policy, or additional size limit. Retain existing library limits and -Audita validation rather than inventing restrictions on runtime inputs. - -## Baseline and code map - -The reviewed baseline is `f85a07c14d209b7e1f0c1a6f7a111bcfb148887a`; -subsequent planning commits may change documentation. Recheck the named code -before editing and use the graph-first discovery instructions in `AGENTS.md`. - -| Responsibility | Starting points | -| --- | --- | -| Collection fields, registered entry identities, resolution and validation | `internal/core/config/config.go` and configuration tests | -| Main-source bootstrap, companions and shared native load | `internal/appconfig/config.go`, `glossary_test.go`, `secrets_test.go` | -| Processing flags and acquisition | `internal/cli/process_command.go`, `process_inputs.go` | -| Native application/prompt acquisition and invocation caching | `internal/cli/app_wiring.go`, `bootstrap.go`, `app_wiring_test.go` | -| Stage glossary selection and reuse | `internal/framework/contracts/contracts.go`, `internal/framework/preflight/preflight.go` | -| Shared proposal context and variable construction | `internal/framework/promptcontext/glossary.go`, `internal/framework/proposal_generation/variables.go` | -| Prompt definitions and omitted preview defaults | `internal/prompts/registry.go` and embedded proposal assets | -| Source protection | `internal/framework/llm/source_paths.go`, `internal/cli/process_inputs.go`, existing collision tests | - -## Stage 1: Add collection instructions and retain selected context - -Status: Complete. - -Work: - -1. Add `Instruction string` with YAML key `instruction` to - `config.GlossaryCollection`. Keep application schema version 3 and existing - entry fields, extensions, validation, and identity rules. -2. Extract the existing glossary entry sequence-identity declaration into a - small reusable definition if needed by Stage 2. The application declaration - still identifies `/glossary_collections/*/entries` by `id`; the preliminary - wrapperless load will identify `/*/entries` by the same key. Share this - definition without importing the application lifecycle into a generic loader. -3. In `ResolveModuleRunSpecs`, retain selected collection instructions alongside - the existing flattened entries and protected spellings. A small ordered - collection-name/text representation on `ModuleRunSpec` is sufficient. - Select from the stage's effective `Glossaries`, in their existing order; - definitions selected only for protection contribute no instructions. -4. Include the retained instructions when reusing a prior spec's selected - glossary data. The current `GlossarySelectionKey` already includes ordered - glossary names, protected names, and exemption behavior within one resolved - configuration. Preserve that reuse; no cross-invocation content cache is needed. -5. Add focused configuration/selection coverage for a collection instruction, - ordering, a stage-specific selection, and a protection-only collection. - -Acceptance: - -- Collection instructions survive native decoding and ordinary inheritance. -- Selected instructions remain available even when glossary entries are - flattened or cached; existing glossary and protection behavior is retained. -- No new entry selection, emptiness requirement, instruction validation rule, - or validator-context field is introduced. - -## Stage 2: Implement the shared runtime-file acquisition bridge - -Status: Complete. - -Work: - -1. Extend `internal/appconfig.Load` with a small options value containing the - selected overlay, existing overrides, and ordered glossary file paths. Update - internal callers to the new signature rather than retaining a second API. - Return acquisition bookkeeping containing the final native result and the - preliminary load's host-file paths; retain the separate secrets report/error - channel so existing bootstrap diagnostics work on failure as well as success. - Keep the native `*ck.Result[Config]` available unchanged to its consumers. -2. Preserve the current main-source secrets bootstrap and prepared-main reuse. - Perform preliminary glossary loading after that bootstrap and before the - final shared application load. Do not bootstrap from glossary files or use - them as the application's selected main source. -3. If the file list is empty, skip the preliminary load and glossary override. - Otherwise resolve CLI-relative paths against the invocation working directory - and load each argument as a required local file with native imports enabled. -4. Use `ck.LoadLayered` with a raw `map[string]any` configuration and only the - wrapperless glossary identity registration. Earlier arguments are individual - underlay groups in argument order; the last argument is the main input of - this preliminary load. Each group has one CLI file with its native imports. - This gives each argument a precedence tier while leaving its imports as peers. - Do not use Audita's application defaults, companion discovery, version rule, - domain resolver, or PromptKit catalog for this preliminary load. -5. Use the preliminary result's resolved native mapping directly as the value - of one `ck.Override{Path: ck.Keys("glossary_collections"), - Flag: "--glossary-file"}`. Combine it with the invocation's existing overrides - for the final application load. Do not construct one override per file or - serialize/reparse the mapping. Keep native override conflict handling for any - explicitly overlapping native overrides; add no custom ordering policy. -6. Preserve omission, explicit nulls, empty lists, entry extensions, collection - instructions and resolved native inheritance in the handoff. In particular, - do not decode incoming collections into a typed struct and then manufacture - zero-valued fields: an omitted instruction must remain omitted, allowing an - entries-only contribution to retain its configured instruction. -7. Collect acquired host file paths, including imports, from the preliminary - result's native source records. Return them as acquisition bookkeeping; - do not inject those records into the final result's provenance. Final - explanation records the single CLI override, while preliminary failures retain - the library's available file/source diagnostics. -8. Keep context cancellation checks and error causes consistent with existing - acquisition. Preliminary loading failures use the existing native diagnostic - classification, distinguishing invalid input from operational source failures. - Do not classify every preliminary/application/bootstrap failure as an input error. -9. Add package-level tests with real ConfigKit for both composition boundaries: - two files and an import, matching-ID whole-record replacement, retention of - unmatched entries between CLI files, and final configured-list replacement. - Include configured main/overlay values, an unrelated collection, and an - entries-only contribution retaining an instruction. Add representative - omitted/empty/null cases where they exercise the handoff, without recreating - ConfigKit's complete native test matrix. - -Acceptance: - -- CLI files compose natively first, then replace supplied configured sequences - through CLI assignment; unrelated configured mappings remain available. -- Existing final application resolution, validation and preflight remain the - domain owners. Earlier native parsing/decoding errors are not masked. -- Main selection, companions, overlays, bootstrap and final-result provenance - retain the boundaries specified by the feature roadmap. - -## Stage 3: Connect processing flags and protect acquired source files - -Status: Complete. - -Work: - -1. Add repeatable `--glossary-file PATH` to `processInput`/`processCommand` using - CommandKit's native repeated-string flag. Each occurrence contributes one - path in order; filenames are not JSON lists or comma-separated collection - selectors. Preserve the existing `--glossaries` and `--protected-terms` flags. -2. Introduce a small CLI acquisition input for the ordered paths, shared with - native commands in Stage 4. Centralize selected-main construction, - `appconfig.Load` invocation and bootstrap reporting in one CLI helper. - The native adapter can extract its result, while processing also receives - the acquired glossary source paths. Keep loading out of flag parsing. -3. Route `loadProcessInputs` through that helper. Build the PromptKit runtime - from the final application result, then add preliminary host-file paths to - the existing `ProtectedPaths` set alongside runtime/configuration sources. - Reuse existing collision checking and path comparison; no independent scanner - of import declarations or new filesystem protection system is needed. -4. Test a supplied glossary file and an imported file as conflicting transcript - or report destinations using the existing output-session boundary. Verify - the source remains unchanged and no model work occurs. Exercise a distinct - destination as the successful counterpart without duplicating all collision - combinations already covered by existing tests. -5. Cover a missing/malformed runtime input and an empty selected glossary stage - before model work/output preparation, using native loading classifications - and the existing preflight input-error classification. Preserve quiet-mode - destination validation and cancellation behavior. - -Acceptance: - -- Processing accepts ordered runtime files without automatically selecting - their collections or changing the configured pipeline. -- Acquired files and imports participate in existing output collision protection, - even though their provenance is not copied into the final configuration result. -- Invocations without the new flag continue to use the established acquisition path. - -## Stage 4: Wire native inspection, comparison and prompt commands - -Status: Complete. - -Work: - -1. Replace the currently empty `struct{}` acquisition input in - `app_wiring.go` with the shared typed glossary-file input. Update loader - callbacks, factories, request callbacks and generic type arguments together. - Keep bootstrap wrappers generic and retain the native result/engine adapters. -2. Bind the repeatable selector to both application and PromptKit configuration - scopes using `ckconfig.Suite.Selectors`. Leave `Selector.AgainstName` empty: - both comparison acquisitions receive the invocation's same ordered file list, - and this feature adds no independent right-side glossary-file selector. -3. Bind the same input to configuration-consuming ckprompt resource/request - commands using that suite's native selector support. Preserve existing native - namespaces, request validation/preparation, smoke behavior and bootstrap - reporting. Help, version and discovery that do not acquire configuration - must not open these files. -4. Ensure `capturePromptEngine` reuse is scoped to the acquisition input as well - as the native selection, or otherwise relies explicitly on immutable shared - invocation input. Do not let engine reuse cross different file lists. Keep - independent native configuration comparison acquisitions independent. -5. Add behavioral tests for effective values, CLI-origin explanation, and - comparison applying files to both sides. Exercise the PromptKit configuration - scope and one resource/request path so propagation is not tested only through - the application scope. Use existing native rendering rather than custom output. -6. With a working directory different from the selected main, verify relative - CLI files resolve there, their imports resolve beside their sources, and main - companions/overlay/bootstrap still resolve from the selected main. Reuse the - existing synthetic secrets setup; no real credentials or provider are needed. - -Acceptance: - -- Processing and native inspection obtain equivalent final collections. -- Native inspection remains usable without processing-ready profiles or entries. -- Final explanation shows CLI assignment; load errors retain useful native - diagnostics. Source evidence does not falsely claim imported-file provenance - for the final overridden values. - -## Stage 5: Render instructions in proposals and retain them during repair - -Status: Complete. - -Work: - -1. Extend shared stage glossary variables with an instruction block prepared - from the retained ordered collection-name/text pairs. Label each nonempty - instruction with its collection name and separate blocks visibly. Preserve - the supplied text literally; do not template it, trim its content, interpret - file references, impose a new length cap, or concatenate superseded sources. - Omitted/empty strings contribute no block; the roadmap adds no whitespace-only - rejection rule. The exact separator typography is an implementation detail. -2. Populate the block in `ModuleRunSpec.PrepareGlossary` and preserve it through - `ProcessingPlan`'s prepared-context reuse. Do not change validator - `GlossaryView` or its acceptance logic to consume these instructions. -3. Expose the block through proposal variable construction as - `GlossaryInstructionsBlock`. Keep `GlossaryJSON`, `ProtectedTermsJSON`, - `SectionJSON`, and existing operator prompt expectations usable. -4. Add `GlossaryInstructionsBlock` to the empty preview defaults supplied by - `prompts.WithSharedVariables`, without overwriting a caller-provided value. - Update all four bundled proposal definitions to include the block as - glossary-use guidance alongside their existing assignments and validation - rules. Operators remain free to choose whether replacement templates use it. -5. Retain instructions through the original proposal conversation already used - by correction repair. Inspect the actual retained messages; do not introduce - another instruction load or separately regenerate guidance for repair. -6. Test ordered labeled content, empty omission, protection-only exclusion, and - reuse across repeated stages. At the rendered-message boundary, prove a - supplied instruction reaches a proposal and a subsequent correction-repair - exchange. Reuse a controlled model collaborator. Check preview preparation - when the new variable is omitted and when explicitly supplied. Assert data - visibility and relationships, not exact bundled prose or separator snapshots. - -Acceptance: - -- Every bundled proposal module can receive the selected collection guidance. -- Repairs retain that guidance through existing conversation history. -- Validator context, protection rules, output schemas, and repair budgets remain - unchanged; glossary instructions are generation guidance rather than new rules - for deterministic acceptance. - -## Stage 6: Complete integration evidence and canonical documentation - -Status: Complete. - -Work: - -1. Add a domain-neutral copyable runtime glossary example under `examples/`, - reusing an existing example project/overlay where practical. Demonstrate a - configured reference collection plus an incoming replacement collection and - a collection instruction. Keep data synthetic and credentials absent. -2. Add one end-to-end workflow with controlled provider responses that supplies - runtime files and selects an overlay, inspects the resulting values, runs - processing and verifies the prompt receives the selected data/instruction. - Use the coverage from earlier stages for detailed composition, errors, - collisions and repair; do not repeat the full matrix at subprocess level. -3. Update canonical owners with the delivered behavior: - - `docs/cli.md`: repeatability, commands accepting the flag and shared - comparison inputs; link to native command documentation. - - `docs/config.md`: Audita's two composition boundaries, collection - instruction setting, selection and inheritance boundary. - - `docs/integrations/transcript-glossary-files.md`: wrapperless input shape, - entry extension retention and instruction field; link the complete example. - - `docs/integrations/subprocess.md`: the supported prepared-input handoff, - existing outcomes, and links to the CLI/input owners. - - `docs/internal/prompts.md`: new proposal variable, omitted preview default - and retained repair guidance. Update focused CLI/config internals and the - example guide only where the implementation changes their descriptions. - Keep each contract in its owner; link upstream for ConfigKit/PromptKit features - rather than copying their documentation. Keep D&D examples outside Audita. -4. Run focused package tests as paths become complete, then run `go test ./...` - and `go build -o ./bin/audita ./cmd/audita` with the documented supported Go - toolchain. Keep default tests offline and use no live inference. Run formatting, - affected Markdown link/example checks, and `git diff --check`. Run additional - checks only where a concrete change warrants them; this sprint is not a release. -5. Review the full diff for accidental contract expansion: unchanged entry - eligibility, no automatic selections, no additional file/instruction limits, - no new validator rules, no promises of complete final file provenance, and - no D&D assumptions in application code. Update roadmap status to the actual - implemented Audita boundary, retaining the separate recipe contracts until - companion work owns them canonically. Commit completed work under agent policy. - -Acceptance: - -- The complete offline suite and source build pass for the final sprint state. -- The examples and canonical docs describe actual implemented behavior and the - native-library integration without duplicating upstream reference material. -- The feature roadmap's Audita target is delivered; external work is accurately - distinguished from completed application work. - -## Delivery boundaries - -The separate `audita-pipelines-dnd` checkout currently has scaffolding and stale -provisional descriptions of its recipes. Its subsequent implementation should -use the agreed contracts in the feature roadmap: the four named roles, empty -defaults that preserve supplied vocabulary, both full stage sequences, and the -two native inherited profile aliases with their selected reasoning effort. -Its README and agent guidance should then reflect those agreed contracts and -link to the delivered Audita interface. Its own offline checks and synthetic -examples belong there. Publishing that repository or selecting its release tag -is separate work and is not a gate for completing this Audita sprint. - -Narratio separately replaces its legacy glossary handoff and reviews remaining -CLI/output assumptions, including `--modules`. This plan does not modify its -adapter. No Audita release number is selected here; future release preparation -follows the release policy and does not reuse an earlier versioning exception. - -## Open Questions - -None. The feature roadmap resolves the decisions needed for this Audita sprint; -the companion deliveries above do not require further application design choices. diff --git a/docs/roadmap/remediation.md b/docs/roadmap/remediation.md deleted file mode 100644 index 1df8ef2..0000000 --- a/docs/roadmap/remediation.md +++ /dev/null @@ -1,180 +0,0 @@ -# Runtime Glossary Implementation Review - -Status: All findings remediated. Original review covered -`889ac766a5a95014fd55f811a6aac56c423fc3e3`. - -Scope: The six stages of [the implementation plan](implementation.md), compared -with [the feature roadmap](runtime-glossary-inputs.md), the preceding baseline -`d2c4c63`, and the user's requirements to retain native-library ownership and -avoid stronger contracts than the feature requires. Findings describe the reviewed -baseline; completion entries record the subsequent remediation. - -## R1 — Preserve native operational error classification for preliminary loads - -**Priority:** P2. **Stages:** 2–4. **Status:** Complete. - -**Completion:** Removed the preliminary-load blanket usage classification. -Processing now uses native diagnostic classification, matching inspection. -Regression coverage distinguishes missing sources, invalid YAML, and empty -selected glossaries, retains diagnostics, and checks that transcript/report -files are not prepared. Clarified the planning language. -Validation: `go test ./internal/cli` passed with Go 1.27.4. - -**Locations:** `internal/cli/process.go:35`, -`internal/appconfig/config.go:126`, and -`internal/cli/runtime_glossary_test.go` (`TestProcessRuntimeGlossaryFailures`). - -**Finding:** Processing treats every `ck.LoadError` wrapped in -`GlossaryInputError` as a usage/input failure whenever the parent context is -active. The wrapper marks which load failed; it does not establish that the -failure was caused by invalid user input. ConfigKit can also report operational -source failures or invalid loader options. The new blanket override bypasses -the existing diagnostic classification for those failures. Native configuration -and PromptKit commands still use that classification. - -For example, with a valid main configuration and a nonexistent glossary file, -`process --glossary-file missing.yml` exits `2`, while `config show --scope app`, -`config show --scope promptkit`, and `promptkit list prompts` with the same -argument exit `1`. All preserve the `source.missing` diagnostic. Malformed YAML -exits `2` through all these routes. These outcomes were reproduced with the -built executable. The current process test fixes all preliminary failure cases -at status `2`, including missing sources. - -**Recommended change:** Use the existing native configuration diagnostic -classification for preliminary loading errors as well as final loading errors. -Remove the blanket processing override based solely on `GlossaryInputError`; -retain that wrapper if useful for identifying the failing phase. Update the -affected test to distinguish invalid configuration from native operational -source failures, while preserving diagnostics and failure-before-output behavior. -Clarify the planning documents' general "input-error handling" wording to refer -to existing classification rather than requiring every preliminary failure to -exit `2`. This avoids inventing a new error policy for the feature. - -If a particular runtime-input diagnostic warrants different treatment from -upstream, adopt that narrow application decision explicitly; do not make every -failure in the preliminary phase a usage failure. Preserve cancellation, -bootstrap, and unrelated application error behavior. - -**Acceptance:** Invalid YAML retains input-error classification; native -operational failures retain operational classification and source diagnostics. -The tests protect those distinctions rather than a blanket status for the -preliminary phase. No provider calls or required output preparation occur on -these acquisition failures. - -## R2 — Distinguish collection guidance from reference data during repair - -**Priority:** P2. **Stage:** 5. **Status:** Complete. - -**Completion:** The repair contract now distinguishes reference entries, -descriptions, and extension fields from separately labeled collection guidance. -A controlled offline repair run retained literal guidance in the original -conversation, rejected a blank-segment edit, and successfully validated/applied -a revised correction. Reviewed the captured rendered messages. -Validation: `go test ./internal/framework/llm ./internal/prompts` and a source -build passed with Go 1.27.4. No prompt-wording assertions were added. - -**Location:** `internal/prompts/assets/shared/repair_contract.md:5`, together -with the new `GlossaryInstructionsBlock` in bundled proposal messages. - -**Finding:** The initial proposal now receives explicitly labeled glossary-use -guidance from collection `instruction` fields. That message is correctly -retained for correction repair. However, the subsequent shared repair contract -still says to treat the "glossary" as data, "never as instructions," without -distinguishing glossary entries from the newly supported instruction block. -This creates an ambiguous instruction boundary in the assembled conversation. -The initial hardening fragment already uses the narrower term "glossary -entries," so the ambiguity is specific to the repair wording. - -The retention test proves the guidance remains in the messages; it cannot prove -that a live model will reconcile this wording as intended. No live-model failure -is claimed by this finding. - -**Recommended change:** Narrow the repair reference-data rule to glossary -entries and their descriptive/extension content. Explicitly preserve the -separately labeled collection guidance as guidance for using that reference -material, subject to the existing correction, protection, and validation rules. -Keep transcript text, earlier model output, and validator findings as data. -Reuse the retained conversation; no additional loader, validator context, -instruction precedence system, or broader acceptance rule is needed. - -**Acceptance:** Review a rendered proposal/repair conversation to confirm that -collection guidance has a consistent role while reference-data instructions -remain ineligible to redirect the task. Retain existing message-retention tests; -do not add exact-prose assertions or claim offline tests establish live-model -editorial quality. - -## R3 — Document the two inheritance scopes in the canonical configuration guide - -**Priority:** P2. **Stage:** 6. **Status:** Complete. - -**Completion:** Added the runtime/application inheritance boundary to -`docs/config.md`, including the effect on already-inherited child fields and -the distinct post-assignment root/stage resolution. Controlled offline CLI -probes verified both inheritance consequences and normal stage selection. -Affected local documentation links and whitespace checks passed. - -**Location:** `docs/config.md:25` (runtime glossary loading and composition). - -**Finding:** The canonical documentation describes separate composition and -the CLI handoff, but omits the agreed inheritance boundary. That boundary is -still explained only in the feature roadmap. It is an Audita-specific consequence -of the two loads, so a general link to ConfigKit's native inheritance reference -does not fully describe it. - -Two behaviors were reproduced: a runtime collection using `extends` to name a -parent present only in application configuration fails with -`inheritance.missing`; replacing a configured parent through runtime inputs -does not update a configured child whose inheritance resolved before CLI -assignment. The child keeps its previously inherited entries and instruction. -Both behaviors match the intended design and need no implementation change. - -**Recommended change:** Add a short explanation to `docs/config.md`: runtime -inheritance resolves only among supplied files and their imports, and application -structural inheritance completes before CLI assignment and does not rerun. -Distinguish this from Audita's ordinary post-assignment root/stage resolution, -which still runs on final values. Other documents should link to this canonical -explanation. A compact illustrative example is sufficient if useful; do not -duplicate the upstream inheritance manual. - -**Acceptance:** Operators can discover both inheritance consequences from the -current configuration documentation without consulting a roadmap. Documentation -describes the existing behavior and introduces no new restriction or inheritance -mechanism. - -## Stage Review Summary - -| Stage | Review result | -| --- | --- | -| 1 — Collection instructions and selected context | Implemented. Instructions preserve selected order and remain available through glossary reuse; protection-only selections do not contribute guidance. | -| 2 — Runtime acquisition bridge | Native layered mapping composition and a single final CLI assignment are implemented. Omission, explicit empty/null entries, extensions, source capture, and main bootstrap context are preserved. R1 is complete at the CLI classification boundary. | -| 3 — Processing and source protection | Repeatable file inputs and existing transcript/report collision protection are wired, including imported sources. R1 is complete; no new file limit or automatic glossary selection was found. | -| 4 — Native commands and comparison | Shared inputs reach application/PromptKit inspection and resource commands. Comparison shares the invocation's file list and keeps acquisitions separate. Engine reuse includes the input list. R1 resolved the classification discrepancy. | -| 5 — Proposal and repair guidance | All four bundled proposals receive the variable; previews support omission, and repair retains the original messages. R2 resolved the prompt ambiguity. Validator context, domain rules, and repair budgets remain unchanged. | -| 6 — Integration and documentation | Synthetic example and controlled-provider workflow are present. R3 resolved the documentation omission. External recipes and Narratio migration correctly remain separate work. | - -## Validation Performed - -Using Go 1.27.4 with workspace discovery and module network access disabled: - -- `go test ./...` passed. -- A source build of `./cmd/audita` passed, with its executable kept outside the - repository for controlled CLI probes. -- `go test -race` passed for `internal/cli`, `internal/appconfig`, - `internal/framework/contracts`, `internal/framework/preflight`, - `internal/framework/llm`, and `internal/prompts`. -- Controlled CLI probes confirmed the error outcomes and inheritance behaviors - above, plus native explicit collection replacement and sibling inheritance - within supplied files. No live inference or real credentials were used. -- Changed Markdown local file targets and whitespace checks passed. - -No additional domain restrictions, input/instruction size caps, automatic -collection selections, validator rules, or complete-provenance guarantees were -found in the implementation. R1 identifies an overly broad error classification; -R2 identifies legacy wording that needs to distinguish the new guidance boundary. - -## Final Remediation Validation - -With Go 1.27.4, `go test ./...` and the source build passed after the code and -prompt changes. Controlled offline repair and inheritance probes passed; affected -documentation links, Go formatting, and whitespace checks passed. No live inference -was used. R1, R2, and R3 were completed as separate committed units of work. diff --git a/docs/roadmap/runtime-glossary-inputs.md b/docs/roadmap/runtime-glossary-inputs.md deleted file mode 100644 index 23f49de..0000000 --- a/docs/roadmap/runtime-glossary-inputs.md +++ /dev/null @@ -1,329 +0,0 @@ -# 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 use the existing error handling with useful diagnostics. -Native loading diagnostics distinguish invalid input from operational source -failures; processing preflight retains its input-error classification. -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.