Make prompt definitions own output contracts and repair budgets

This commit is contained in:
2026-11-23 02:41:01 +00:00
parent 4dc461f9c9
commit e144c502f6

View File

@@ -14,8 +14,9 @@ invocation usage reporting. Include ConfigKit's configured secrets bootstrap
to keep startup consistent with other ConfigKit consumers. This reduces
Audita's configuration assembly and reporting responsibilities while retaining
its domain correction and validation behavior, semantic repair, and ordinary
output handling. Structural-repair defaults, debug representation, and startup
failure classification change as specified below.
output handling. Prompt definitions own output contracts and structural-repair
budgets; Audita's separate overrides are removed. Debug representation and
startup failure classification also change as specified below.
Use the shared-load approach because it removes filesystem-context
reconstruction and gives application settings, PromptKit settings, and overlays
@@ -94,7 +95,7 @@ The application configuration includes native `promptkit.Settings` under
`yaml:"promptkit"`. Compose Audita's ConfigKit definition with
`promptkit.Configure`, preserving Audita's application version rule, recorded
domain resolution, glossary identities, and validation. Retain application
defaults except for the structural-repair default changed below. Pass the whole
defaults except for the structural-repair setting removed below. Pass the whole
successful result to `promptkit.NewFromConfig` with the runtime HTTP client.
Compose the bundled OpenRouter catalog, embedded prompts, schema-root input,
@@ -226,42 +227,53 @@ change, and keep help/version and processing-readiness checks at their existing
boundaries. No provider calls or required credentials belong in configuration
inspection.
### Canonical response schemas and repair budgets
### Prompt-owned output contracts and structural-repair budgets
**Agreed decision:** Each proposal, validation, and repair prompt definition owns
its output format, validation mode, schema selection, and structural-repair
budget. Ordinary and coordinated processing select the prompt and leave
`RunRequest.Validation` unset, allowing PromptKit to use that definition's output
contract. Processing and native request previews use the same configured
contract; Audita does not substitute a schema or budget at the call site.
Replace `WithSchemaFS` with a native `SchemaRootSource` input, mounted under
`/promptkit` and anchored to `responseschema.Filesystem()` at its asset root.
`/promptkit` and anchored to the embedded schema filesystem at its asset root
(currently exposed through `responseschema.Filesystem()`).
This preserves the existing shipped `schema_path` references and standalone
request previews without duplicating schema JSON into prompt YAML. PromptKit
also supports inline and source-relative `schema_file` definitions; adopt those
where an operator actually needs them.
For processing requests, construct `OutputContractInput` with the canonical
registry schema as inline JSON and an optional structural-repair budget.
Runtime replacements replace the whole output contract. Passing the schema
inline keeps Audita's domain response contract independent of an
operator's schema-root selection. Keep one embedded schema source of truth.
Keep shared schema assets referenced by prompt definitions rather than copying
schema JSON into every prompt. Remove the adapter's output-contract builder,
per-call schema-selection fields, and schema-key lookup/registry machinery that
no longer serves a purpose. Retain the embedded assets and any necessary loading
support. Execution diagnostics should describe the actual prepared contract,
using native evidence instead of an independently selected registry contract.
**Agreed decision:** Adopt PromptKit's native structural-repair default, currently
one additional generation for enabled validation. Remove Audita's default of two;
leave `OutputContractInput.RepairAttempts` nil when no effective override is
selected so PromptKit resolves the default. Do not replace the old local default
with a hard-coded copy of the upstream value.
Shipped prompt definitions omit `output.repair_attempts` to adopt PromptKit's
native default, currently one additional generation for enabled validation.
Operators customize this field through native prompt configuration, including
explicit zero to disable structural repair. ConfigKit owns composition and
clearing; PromptKit owns contract resolution and structural repair.
Preserve root and stage overrides, stage inheritance, and explicit zero to
disable structural repair. Carry the optional selection through configuration
and request construction without converting an unspecified value to zero.
ConfigKit continues to own presence, composition, and clearing; PromptKit resolves
an unspecified budget at its boundary. A processing request's replacement output
contract resolves independently of the prompt's configured output budget. Native
requests using a prompt's own output definition retain upstream budget resolution.
Remove Audita's root and stage `llm.repair_attempts` setting, its default,
inheritance and validation logic, request plumbing, and any associated CLI
bindings. Do not translate the retired setting into per-call replacements or
retain a compatibility path that copies and modifies prompt contracts. Migration
guidance should move explicit structural budgets into the applicable prompt
definitions and explain that structural budgets are selected by prompt rather
than by Audita stage.
Keep transient retries and semantic correction repair distinct, with their
existing operation deadlines and partial-success behavior. This decision changes
the default recovery opportunity, not schema enforcement or the handling of an
operation that exhausts its repairs. Update ordinary and coordinated requests
together. Document the changed default and the explicit override for workloads
that benefit from two repairs; future workload evidence can justify revisiting
the default locally or upstream.
Operator replacement prompts must supply output contracts compatible with
Audita's expected response shapes. Audita continues decoding responses and
performing domain checks, including proposal identity, applicability, decision
reconciliation, and protection. It does not enforce a second schema selection
over the operator's configured contract. Keep transient retries and Audita's
semantic correction-repair budget (`llm.correction_repair_attempts`) separate,
with their existing operation deadlines and partial-success behavior. Failed
structural validation continues through the existing model-operation failure
handling. Update ordinary and coordinated requests together.
Link to the upstream schema reference for external prompt definitions and file
resolution. Audita's documentation should identify its shipped schema selection
@@ -353,8 +365,9 @@ Replace local explanations of adopted library features with those links.
Keep Audita's selected integration and application-owned behavior local:
configuration discovery and companion locations chosen by Audita, input mounts,
role/profile mappings, explicit processing budgets, domain response schemas,
failure classification, transcript/report handling, and application migration
role/profile mappings, remaining application-owned processing budgets, required
domain response shapes and shipped schema assets, failure classification,
transcript/report handling, and application migration
steps. A concise integration statement should explain where the adopted library
fits and link upstream for its behavior. Planning documents may identify APIs
and migration constraints needed to explain the proposed work; those details
@@ -370,7 +383,7 @@ Align the documentation during this upgrade, including existing duplication:
| Affected material | Required alignment |
| --- | --- |
| [Documentation policy](../policy/documentation.md#upstream-dependencies) | Completed: adopted upstream v1.13's dependency-documentation rule from revision `5b9088601290564647a9e20c13f95c0da9f4cb15`. Apply it to the remaining documentation work below. |
| [Configuration](../config.md) | Retain Audita's schema, source selection, companion mounts, role settings, and overrides. Link to ConfigKit for composition and secrets controls, and to PromptKit for its settings and resource formats; avoid reproducing their field/default references. |
| [Configuration](../config.md) | Retain Audita's schema, source selection, companion mounts, role settings, and remaining overrides. Remove the retired structural-repair setting and link to its migration guidance. Link to ConfigKit for composition and secrets controls, and to PromptKit for output contracts, structural budgets, and resource formats; avoid reproducing their field/default references. |
| [CLI](../cli.md) | Identify the installed CommandKit integrations and link to the upstream command reference. Describe Audita's `process` command and application-specific stream/exit mapping locally. Introduce native usage reporting with a brief workflow example and an upstream link; leave the detailed flag, report layout, and formatting reference upstream. |
| [LLM integration](../integrations/openai-compatible-llm.md) | Reduce the document to Audita's adapter boundary, role/schema/budget choices, and mapping of model failures into processing outcomes. Link upstream for transport, provider conventions, credentials, retry/repair mechanics, admission, and token/cost semantics. |
| [Operations](../operations.md) and [subprocess integration](../integrations/subprocess.md) | Describe when Audita invokes secrets bootstrap and how startup failure affects processing/output preparation. Link to ConfigKit for bootstrap behavior and to CommandKit for native diagnostic reporting; retain Audita-owned output lifecycle and subprocess handling. |
@@ -406,10 +419,11 @@ The implementation should cover the following outcomes:
handling selected in [runtime failure classification](#runtime-failure-classification).
- Bootstrap configured secrets through the upstream helper before loading,
reuse its prepared main, and retain its safe report and native failure facts.
- Adapt embedded-schema installation and explicit request contracts, preserving
canonical domain schemas and explicit configured budgets. Carry unspecified
structural budgets to PromptKit for native default resolution, preserving
stage inheritance and explicit zero.
- Adapt embedded-schema installation and use prompt-defined output contracts
for ordinary and coordinated requests. Remove per-call schema and structural
budget overrides, redundant registry machinery, and the root/stage
`llm.repair_attempts` setting and any CLI bindings. Migrate explicit structural
budgets to native prompt definitions; retain domain decoding and checks.
- Adopt native usage reporting and retain useful new metadata in optional debug
evidence. Preserve cancellation causes, recoverable timeouts, and joined work.
- Remove superseded source assembly, filesystem-context reconstruction, YAML
@@ -432,8 +446,9 @@ The implementation should cover the following outcomes:
Use focused offline tests at Audita's integration boundaries: representative
source selection and mounting with relative resources; shared configuration
handoff; secrets bootstrap with prepared-source reuse and startup failure
reporting; canonical schema and optional repair-budget handoff, including omitted
values, root/stage inheritance, and explicit zero/nonzero overrides; inspection
reporting; prompt-defined contracts for proposal, validation, and repair,
including operator replacements, shared schemas, and native default/explicit
zero/nonzero structural budgets; retained domain checks; inspection
scopes and comparison acquisitions; context propagation and failure
classification; and domain attribution across proposal, validation, and repair.
Check transcript/diagnostic stream separation, quiet/help behavior, and
@@ -466,11 +481,13 @@ described above.
Choose the desired application contract first, then assess migration and release
impact; a smaller release number is not a reason to retain avoidable complexity.
Native fragment mounting should preserve existing valid Audita inputs. An
upstream pre-v1 breaking release does not itself force an Audita major release.
Confirm compatibility against the documented Audita contracts and
representative existing projects before choosing the release version. If the
implementation intentionally requires configuration conversion or breaks an
Audita integration contract, document it and select a major release under the
[release policy](../policy/release.md#versioning-and-compatibility). A compatible
adoption with the added CLI capability is suitable for a minor release.
Native fragment mounting preserves the wrapperless companion shape, but removal
of Audita's structural-repair setting is an intentional configuration migration.
Operator prompts that previously relied on per-call contract replacement must
also provide a compatible output contract. Plan this adoption as a major release
under the [release policy](../policy/release.md#versioning-and-compatibility).
Document the conversion, including root/stage budget removal and the changed
default. Review representative projects and existing integration contracts for
additional migration needs when implementing the agreed debug and failure
classification changes. The breaking application changes, rather than upstream
pre-v1 versioning alone, determine the release impact.