Document the library migration and update examples

This commit is contained in:
2026-11-23 04:47:06 +00:00
parent fa5d834f13
commit 752ec676a6
18 changed files with 217 additions and 75 deletions

View File

@@ -3,7 +3,7 @@
Audita uses CommandKit for routing and the ConfigKit and PromptKit integrations Audita uses CommandKit for routing and the ConfigKit and PromptKit integrations
for their standard inspection and request commands. Run `audita --help` or for their standard inspection and request commands. Run `audita --help` or
command-specific `--help` for the installed command inventory. The adopted command-specific `--help` for the installed command inventory. The adopted
[CommandKit consumer guide](https://forge.maximumdirect.net/base-layer/commandkit/src/commit/f369d6a78253b6e6fcb1e023fb2e9c3af1d20ff0/docs/consumers/guide.md) [CommandKit consumer guide](https://forge.maximumdirect.net/base-layer/commandkit/src/tag/v0.8.0/docs/consumers/guide.md)
describes the standard command grammar, inspection, comparison, preview, describes the standard command grammar, inspection, comparison, preview,
validation, smoke tests, and their provider-specific caveats. Help and version validation, smoke tests, and their provider-specific caveats. Help and version
do not load application or model configuration. do not load application or model configuration.
@@ -20,6 +20,12 @@ audita process [flags] transcript.json
messages. Quiet processing requires an output file or `/dev/null`. See messages. Quiet processing requires an output file or `/dev/null`. See
[operations](operations.md) for output and report lifecycle. [operations](operations.md) for output and report lifecycle.
Use `audita process --show-tokens --config config.yml transcript.json` to
request the native execution-usage summary on diagnostics. It works without
debug capture or ordinary reports and follows quiet mode. See the
[ckprompt guide](https://forge.maximumdirect.net/base-layer/commandkit/src/tag/integrations/ckprompt/v0.12.0/docs/consumers/guide.md)
for usage and native command details.
Progress for processing goes to stderr. Use `--progress` to show stage and Progress for processing goes to stderr. Use `--progress` to show stage and
chunk activity, model proposal, validation and repair operations, and observed chunk activity, model proposal, validation and repair operations, and observed
counts as work completes. Debug mode enables progress by default. counts as work completes. Debug mode enables progress by default.
@@ -43,11 +49,15 @@ own configuration and resource scopes and request preparation, validation, and
explicit smoke diagnostics. Inspection does not require a processing-ready explicit smoke diagnostics. Inspection does not require a processing-ready
pipeline or contact a provider. Processing preflight separately checks the selected pipeline or contact a provider. Processing preflight separately checks the selected
profiles and glossary entries. Smoke tests can contact providers and are run profiles and glossary entries. Smoke tests can contact providers and are run
only on explicit request. only on explicit request. Request `--format yaml` or `--format json` for
machine-readable smoke results; their default is text. Shared loading can run
configured secrets bootstrap for inspection as well as processing.
Process stdout contains transcript JSON when no output file is selected. Ordinary Process stdout contains transcript JSON when no output file is selected. Ordinary
reports may record recoverable model failures even when processing completes. reports may record recoverable model failures even when processing completes.
Exit status `0` means success, `1` runtime or output failure, `2` invalid usage Exit status `0` means success, `1` runtime or output failure, `2` invalid usage
or input, and native comparison may return `3` for differences. A missing or input, and native comparison may return `3` for differences. ConfigKit
classifies native configuration diagnostics; bootstrap failures and
cancellation are operational. A missing
processing profile or required glossary selection is an input failure. See the processing profile or required glossary selection is an input failure. See the
[output contract](integrations/output-files.md) and [subprocess contract](integrations/subprocess.md). [output contract](integrations/output-files.md) and [subprocess contract](integrations/subprocess.md).

View File

@@ -1,7 +1,8 @@
# Audita Configuration # Audita Configuration
Audita uses version 3 application configuration. See the [migration guide](migrations/v3.md) Audita uses version 3 application configuration. See the [migration guide](migrations/v3.md)
and [examples](../examples/) for complete projects. Command syntax is owned by and [v4.1 migration guide](migrations/v4.1.md), and [examples](../examples/)
for complete projects. Command syntax is owned by
[the CLI reference](cli.md). [the CLI reference](cli.md).
## Loading and composition ## Loading and composition
@@ -18,16 +19,33 @@ base for an optional `overlays/<name>.yml`, optional `glossary.yml`, and recursi
`glossary/` YAML files. Without a main source, automatic companion files are not `glossary/` YAML files. Without a main source, automatic companion files are not
loaded from the working directory. ConfigKit composes sources, resolves native loaded from the working directory. ConfigKit composes sources, resolves native
inheritance, applies explicit overrides, records derived defaults, and validates inheritance, applies explicit overrides, records derived defaults, and validates
the result. Its [configuration reference](https://forge.maximumdirect.net/base-layer/configkit/src/tag/v1.2.0/docs/config.md) the result. Its [configuration reference](https://forge.maximumdirect.net/base-layer/configkit/src/tag/v1.4.0/docs/config.md)
owns native composition and provenance semantics. owns native composition and provenance semantics.
Before shared configuration loading, Audita runs configured ConfigKit secrets
bootstrap against the selected main source. This can populate the process
environment for processing and native inspection; help and version do not load
configuration. A bootstrap failure stops the acquisition before transcript and
output preparation. See the [ConfigKit secrets documentation](https://forge.maximumdirect.net/base-layer/configkit/src/tag/v1.4.0/docs/config.md)
for directory and overwrite controls.
### PromptKit profiles and operator prompts ### PromptKit profiles and operator prompts
PromptKit loads its default catalog and Audita's embedded prompts, followed by The combined result contains native PromptKit settings under `/promptkit`.
optional `prompts.yml` and recursive `prompts/` YAML files beside the application Audita combines the bundled OpenRouter catalog and its embedded prompts and
main. Native imports, resource collections, inheritance, and replacement apply. schemas with optional wrapperless `prompts.yml` and recursive `prompts/` YAML
files beside the application main. These companions are mounted at `/promptkit`;
a main or overlay may instead contain a `promptkit` section. Native imports,
resource collections, inheritance, and replacement apply.
Profiles, backends, models, credentials, admission, and provider parameters belong Profiles, backends, models, credentials, admission, and provider parameters belong
to PromptKit configuration; see its [format reference](https://forge.maximumdirect.net/base-layer/promptkit/src/tag/v0.23.0/docs/formats.md). to PromptKit configuration; see its [format reference](https://forge.maximumdirect.net/base-layer/promptkit/src/tag/v0.25.0/docs/formats.md).
The selected prompt owns its output contract and structural-repair budget;
operators replacing a prompt must supply a contract compatible with Audita's
expected response. See the [migration guide](migrations/v4.1.md).
Declare `provider: openrouter` for custom OpenRouter backends or `provider: vllm`
for vLLM; an omitted provider remains generic. Neither an endpoint nor a backend
ID implies provider conventions or zero cost. PromptKit owns those settings and
their [usage and cost semantics](https://forge.maximumdirect.net/base-layer/promptkit/src/tag/v0.25.0/docs/integrations/openai-compatible-chat.md).
The engine captures its sources for an invocation. Edit files and run a new The engine captures its sources for an invocation. Edit files and run a new
invocation to pick up changes. Inspection does not require model credentials. invocation to pick up changes. Inspection does not require model credentials.
@@ -74,7 +92,6 @@ specified by the [editorial acceptance boundary](policy/architecture.md#correcti
| `llm.correction_repair_profile` | effective proposal profile | Profile for correction repair; null clears an inherited selection before fallback. | | `llm.correction_repair_profile` | effective proposal profile | Profile for correction repair; null clears an inherited selection before fallback. |
| `llm.correction_repair_attempts` | `1` | Nonnegative repair attempts per correction; zero disables correction repair. | | `llm.correction_repair_attempts` | `1` | Nonnegative repair attempts per correction; zero disables correction repair. |
| `llm.transient_retries` | `2` | Additional transient attempts per generation. | | `llm.transient_retries` | `2` | Additional transient attempts per generation. |
| `llm.repair_attempts` | `2` | Structural repairs, from zero through three. |
| `llm.operation_timeout` | `15m` | Positive duration per logical operation. | | `llm.operation_timeout` | `15m` | Positive duration per logical operation. |
| `validation.max_prompt_tokens` | `2048` | Positive validation batching budget. | | `validation.max_prompt_tokens` | `2048` | Positive validation batching budget. |
| `context.description` | empty | Prompt context; at most 500 bytes after trimming. | | `context.description` | empty | Prompt context; at most 500 bytes after trimming. |

View File

@@ -1,34 +1,22 @@
# OpenAI-Compatible LLM Integration # OpenAI-Compatible LLM Integration
Audita uses the pinned [PromptKit](https://forge.maximumdirect.net/base-layer/promptkit/src/commit/171fb11f4e967a1da3af57843c6467954b14ba09) Audita uses [PromptKit v0.25.0](https://forge.maximumdirect.net/base-layer/promptkit/src/tag/v0.25.0/docs/integrations/openai-compatible-chat.md)
built-in OpenAI-compatible transport. PromptKit owns chat-completions wire framing, for its OpenAI-compatible transport, provider conventions, credentials, retries,
provider envelope parsing, transient retries, per-generation timeouts, and JSON admission, and observed token and cost information. Inspection prepares requests
Schema repair. A backend's configured base endpoint must support the selected without contacting a provider or requiring model credentials.
profile's model and structured JSON-schema responses; local configuration
inspection does not contact the provider.
Audita selects role profiles independently for each pipeline entry and supplies Audita selects a profile for each proposal, validation, and correction-repair
its domain response schema and per-operation budget. PromptKit owns backend and role. The selected prompt supplies the output contract and structural-repair
credential selection, request preparation, transport, retries, repairs, and budget, while Audita retains its operation timeout, transient retry selection,
admission. Audita executes the same prepared handle and retains its own domain semantic correction-repair budget, and domain checks. Operator prompt contracts
validation. Profiles may use native endpoint and credential settings; local must produce the response shapes expected by Audita. See [configuration](../config.md)
inspection does not resolve a credential value or call the provider. and the [migration guide](../migrations/v4.1.md).
`llm.transient_retries` counts additional attempts for eligible transient Exhausted structural validation, an incompatible response JSON, a live-parent
failures; explicit zero makes one attempt. `llm.repair_attempts` counts operation timeout, capacity rejection, transport failure, malformed provider
additional generations for schema-invalid model output. The operation timeout response, or provider HTTP failure is recoverable for the affected operation.
covers preparation, capacity waiting, retries, generation, and repair. Caller Proposal generation contributes no candidates from a failed response; a failed
cancellation or an earlier deadline also applies. See [configuration](../config.md#settings) validation batch makes its candidates unavailable while independent work can
for defaults and the [PromptKit consumer contract](https://forge.maximumdirect.net/base-layer/promptkit/src/tag/v0.23.0/docs/consumers/pkg-promptkit.md) continue. Caller cancellation, broken assets or configuration, and internal
for protocol and retry details. programming failures remain fatal. Ordinary reports use safe reason codes and
counts. Full interaction content is optional [debug evidence](../operations.md#debug-evidence).
A model operation that exhausts structural repair, a live-parent local operation
timeout, capacity rejection, transport failure, malformed provider response,
or provider HTTP failure is recoverable for that operation. Proposal generation
then contributes no candidates from that response; a failed validation batch
marks its candidates unavailable while other batches and later modules can
continue. Caller cancellation, broken assets or configuration, and unknown
internal failures remain fatal and cancel peers. Audita decodes into domain
types only after PromptKit validates the JSON. Ordinary reports use safe reason
codes and counts rather than provider messages. Full request/response content
is written only with `--debug`; see [operations](../operations.md#debug-evidence).

View File

@@ -105,7 +105,9 @@ transcript excerpts or correction lists.
With `--debug`, `correction-ledger.json` contains proposed candidates and With `--debug`, `correction-ledger.json` contains proposed candidates and
their application, rejection, or interruption details. `llm-execution.json` their application, rejection, or interruption details. `llm-execution.json`
holds logical calls and PromptKit execution events. Interaction request/response holds `summary`, `calls`, and `events` with Audita attribution and nested native
PromptKit evidence. Interaction request payloads include the prepared native
contract and message hash when preparation succeeded. Interaction request/response
artifacts and input snapshots are also debug-only. Records carry zero-based artifacts and input snapshots are also debug-only. Records carry zero-based
`stage_index` and optional `stage_id` where an entry is identified. `stage_index` and optional `stage_id` where an entry is identified.
These files are diagnostic evidence, not an alternate ordinary report schema. These files are diagnostic evidence, not an alternate ordinary report schema.

View File

@@ -15,8 +15,9 @@ directory. For stdout output, reports use the effective `reporting.stdout_dir`
override. A config-file or overlay value for `reporting.stdout_dir` alone does override. A config-file or overlay value for `reporting.stdout_dir` alone does
not redirect file-output reports. `--work-dir` selects a debug root, while not redirect file-output reports. `--work-dir` selects a debug root, while
`--debug` enables capture; the path flag alone does not. `--debug` enables capture; the path flag alone does not.
Supplying a configuration path also makes file selection predictable; only Supplying a configuration path also makes file selection predictable. Configured
explicitly referenced credential variables are read from the environment. secrets bootstrap can populate the child environment before the shared load;
see [configuration](../config.md#loading-and-composition).
Choose a trusted configuration bundle. An explicit main path still allows Choose a trusted configuration bundle. An explicit main path still allows
its configured imports and automatic overlay, glossary, and prompt companions. its configured imports and automatic overlay, glossary, and prompt companions.
@@ -41,7 +42,8 @@ Interpret the exit result according to the
Consume transcript/report data through the Consume transcript/report data through the
[output-file contract](output-files.md), and treat stderr as human-readable detail. [output-file contract](output-files.md), and treat stderr as human-readable detail.
Audita loads configuration and parses the input transcript before report Audita loads configuration and parses the input transcript before report
initialization. Early destination failures can also leave no reports. After initialization. Bootstrap failure also occurs before transcript and output
preparation and may leave no reports. Early destination failures can also leave no reports. After
initialization, failed reports can describe partial processing or output initialization, failed reports can describe partial processing or output
failures and use the same report directory as successful runs. failures and use the same report directory as successful runs.
Exit `0` can include recoverable model errors and applied Exit `0` can include recoverable model errors and applied

View File

@@ -6,7 +6,8 @@ CLI wiring, and maintained examples. Definitions of behavior belong to the
## Changing Configuration ## Changing Configuration
1. Update fields, defaults, loading, and validation in `internal/core/config`. 1. Update domain fields, defaults, and validation in `internal/core/config`;
update shared source composition in `internal/appconfig` when needed.
2. Update file, selected overlay, credential reference, and CLI mapping as 2. Update file, selected overlay, credential reference, and CLI mapping as
applicable. Preserve the precedence defined in the applicable. Preserve the precedence defined in the
[configuration contract](../config.md#loading-and-composition), including the [configuration contract](../config.md#loading-and-composition), including the

View File

@@ -60,9 +60,11 @@ prompt content. Execution
position and optional operator ID are carried separately from generated safe position and optional operator ID are carried separately from generated safe
artifact path coordinates. artifact path coordinates.
Execution diagnostics include a native-group invocation summary and per-call Execution diagnostics put native group evidence under `promptkit` in the
summaries. Terminal coverage is separate from usage completeness; unknown usage invocation summary and each logical call, and native events under `promptkit`
is distinct from known zero. Overlapping summaries must not be added together. with Audita's call and context attribution. Prepared interaction payloads retain
the actual native request under the same key. See [PromptKit's execution guide](https://forge.maximumdirect.net/base-layer/promptkit/src/tag/v0.25.0/docs/consumers/pkg-promptkit.md)
for coverage and usage semantics. Overlapping summaries must not be added together.
The collector snapshots after work joins and retains domain labels and stable The collector snapshots after work joins and retains domain labels and stable
presentation order. Prepared evidence comes from `OnPrepared`, so preparation or presentation order. Prepared evidence comes from `OnPrepared`, so preparation or
admission failures may have no request snapshot. Coordinator execution failures admission failures may have no request snapshot. Coordinator execution failures

View File

@@ -1,23 +1,23 @@
# Audita LLM Runtime # Audita LLM Runtime
`llm.NewRuntime` assembles one captured PromptKit engine using its default `internal/appconfig` assembles one shared result and bootstraps configured
catalog, Audita's embedded prompts and schemas, and optional operator sources secrets before loading. `llm.NewRuntime` captures a PromptKit engine from that
anchored to the recorded application main context. Captured host sources and result. Effective host sources and message files are passed to output collision
message files are passed to output collision checks. An embedded-only diagnostic checks. Native errors and source evidence are retained for classification.
construction distinguishes shipped asset failures from operator-source failures;
it never replaces the requested engine.
Each resolved pipeline entry receives role-bound clients with its selected Each resolved pipeline entry receives role-bound clients with its selected
profiles and effective budgets. Clients share engine-local backend admission. profiles and effective budgets. Clients share engine-local backend admission.
The adapter uses ordinary `Run` with `OperationTimeout` and `OnPrepared`, passes The adapter uses ordinary `Run` with `OperationTimeout` and `OnPrepared`, passes
Audita's per-call schema and repair budget, and decodes only validated results. no per-call output override, and decodes the response after the selected prompt's
contract has been applied.
The operation budget includes preparation, admission, retries, and structural The operation budget includes preparation, admission, retries, and structural
repair. An expired parent context stops processing and retains any native cause. repair. An expired parent context stops processing and retains any native cause.
With an active parent, PromptKit's operation deadline remains recoverable even With an active parent, PromptKit's operation deadline remains recoverable even
when a preparation error wraps it. A native transport timeout affects the HTTP when a preparation error wraps it. A native transport timeout affects the HTTP
attempt and is recorded as a transport failure. The prepared notification attempt and is recorded as a transport failure. The prepared notification
supplies prompt metadata to observers. With debug capture enabled, it also supplies prompt metadata to observers. With debug capture enabled, it also
supplies the actual request messages when preparation reaches that point. supplies the native prepared request, including the contract and message hash,
when preparation reaches that point.
PromptKit owns backend and credential selection. When a required credential is absent, PromptKit owns backend and credential selection. When a required credential is absent,
the CLI identifies the role, profile, and environment variable using the native the CLI identifies the role, profile, and environment variable using the native
diagnostic. See the [integration contract](../integrations/openai-compatible-llm.md) diagnostic. See the [integration contract](../integrations/openai-compatible-llm.md)
@@ -28,8 +28,8 @@ and coordinator before submitting proposal work. The proposal call captures a
native immutable PromptKit exchange. Each actionable correction starts an independent native immutable PromptKit exchange. Each actionable correction starts an independent
`Engine.Coordinate` branch from that exchange. PromptKit assembles continuation `Engine.Coordinate` branch from that exchange. PromptKit assembles continuation
history, owns the additional-turn budget, and delivers the last permitted response history, owns the additional-turn budget, and delivers the last permitted response
for assessment. Follow-ups select the repair prompt, profile, and output schema for assessment. Follow-ups select the repair prompt and profile; the prompt owns
directly; Audita does not rerender the original proposal or assemble replay messages. its contract. Audita does not rerender the original proposal or assemble replay messages.
An opaque exchange in the structured-output contract keeps provider state outside An opaque exchange in the structured-output contract keeps provider state outside
modules and validators. The adapter shares request construction, notifications, modules and validators. The adapter shares request construction, notifications,
observers, and once-only completion between ordinary and coordinated calls. observers, and once-only completion between ordinary and coordinated calls.
@@ -51,12 +51,11 @@ The bundled prompts separate durable system principles from the initial user
assignment so later repair instructions can allow acceptable minor cleanup; assignment so later repair instructions can allow acceptable minor cleanup;
see [prompt instruction ownership](prompts.md). see [prompt instruction ownership](prompts.md).
The observation collector tracks logical calls and execution events, and enrolls The optional debug collector tracks logical calls and native execution events,
selected runs in a native `ExecutionGroup`. Proposal, repair, and nested validator and replays selected events into a native `ExecutionGroup`. The invocation
clients explicitly share the invocation observer; history reuse adds no extra run. context also carries ckprompt's optional usage observer through proposal, repair,
Native summaries deduplicate terminal totals by run ID and retain terminal coverage and nested validation. See the [PromptKit execution guide](https://forge.maximumdirect.net/base-layer/promptkit/src/tag/v0.25.0/docs/consumers/pkg-promptkit.md)
separately from usage presence and completeness. Logical calls and run membership for native observation and aggregation semantics.
can differ, especially on failures before execution.
Processing operations retain the failure class, reason, and underlying error. Processing operations retain the failure class, reason, and underlying error.
When a client omits the reason, the operation uses `internal_failure` and keeps When a client omits the reason, the operation uses `internal_failure` and keeps

View File

@@ -45,8 +45,8 @@ Module packages own:
Each stage prepares the encoded glossary context and protected spellings once. Each stage prepares the encoded glossary context and protected spellings once.
Proposal generation adds the selected transcript section and trimmed description Proposal generation adds the selected transcript section and trimmed description
for each request. PromptKit renders the selected definition and validates the for each request. PromptKit renders the selected definition and applies its
correction-set schema before Audita maps proposals. Domain validators still output contract before Audita decodes and maps proposals. Domain validators still
check applicability, protected glossary terms, and replacement check applicability, protected glossary terms, and replacement
policy. Model-facing segment IDs are one-based positions within the proposal policy. Model-facing segment IDs are one-based positions within the proposal
request. Generation and repair map those references back to the current chunk's actual request. Generation and repair map those references back to the current chunk's actual

View File

@@ -11,6 +11,7 @@ baseline commands, see the [contributor guide](../development.md).
Executable and command orchestration: Executable and command orchestration:
- `cmd/audita`: executable entry point. - `cmd/audita`: executable entry point.
- `internal/cli`: argument parsing, config commands, streams, filesystem wiring, and process orchestration. - `internal/cli`: argument parsing, config commands, streams, filesystem wiring, and process orchestration.
- `internal/appconfig`: shared application and PromptKit source composition and secrets bootstrap.
Core deterministic components: Core deterministic components:
- `internal/core/config` - `internal/core/config`
@@ -67,7 +68,7 @@ artifact lifecycle.
## Component Responsibilities ## Component Responsibilities
Core components implement configuration defaults, loading, and validation, Core components implement reusable configuration defaults and validation,
transcript schemas and derived glossary views, normalization and chunking, output encoding, transcript schemas and derived glossary views, normalization and chunking, output encoding,
diagnostics artifact helpers, and public report structures. diagnostics artifact helpers, and public report structures.

View File

@@ -13,8 +13,8 @@ PromptKit composes embedded defaults with operator prompt sources. Shared
instructions come from the embedded fragments in `assets/shared`; the request instructions come from the embedded fragments in `assets/shared`; the request
shared-variable helper fills absent `HardeningPolicy`, `ProposalContract`, shared-variable helper fills absent `HardeningPolicy`, `ProposalContract`,
`RepairContract`, and `ValidationContract` variables. The processing adapter `RepairContract`, and `ValidationContract` variables. The processing adapter
supplies the embedded instruction fragments for those names. Processing supplies supplies the embedded instruction fragments for those names. Each prompt owns
Audita's response-schema contract separately. its output contract and references the shared embedded schema assets.
The operator's prompt definition controls which variables its template uses. The operator's prompt definition controls which variables its template uses.
Proposal focus and validator acceptance intentionally differ: minor editorial Proposal focus and validator acceptance intentionally differ: minor editorial
@@ -46,7 +46,7 @@ includes `original_segment_text`; when the correction is applicable, it includes
not an applied change. An inapplicable correction omits the resulting text and not an applied change. An inapplicable correction omits the resulting text and
retains its findings and available source text. An operator replacement may use retains its findings and available source text. An operator replacement may use
different variables. different variables.
See the [upstream CLI reference](https://forge.maximumdirect.net/base-layer/commandkit/src/commit/f369d6a78253b6e6fcb1e023fb2e9c3af1d20ff0/docs/cli.md) See the [upstream CLI reference](https://forge.maximumdirect.net/base-layer/commandkit/src/tag/v0.8.0/docs/cli.md)
for the standard preview, validation, and smoke commands. for the standard preview, validation, and smoke commands.
The correction-set schema requires a string replacement and accepts an empty The correction-set schema requires a string replacement and accepts an empty

View File

@@ -71,14 +71,14 @@ LLM validators:
- build canonical validation request payloads; - build canonical validation request payloads;
- batch using `validation.max_prompt_tokens` and the existing domain token estimator; - batch using `validation.max_prompt_tokens` and the existing domain token estimator;
- select an embedded prompt ID and pass payload/description variables to the - select an embedded prompt ID and pass payload/description variables to the
role-bound structured client with the validator-decision schema. role-bound structured client; the selected prompt supplies its output contract.
Oversized single inputs are rejected with a consolidated Oversized single inputs are rejected with a consolidated
`validation_input_too_large` operation, without a provider call. Recoverable `validation_input_too_large` operation, without a provider call. Recoverable
model failures make only their batch candidates unavailable while other model failures make only their batch candidates unavailable while other
batches continue. PromptKit validates each complete response against the batches continue. PromptKit applies the selected prompt's output contract before
validator-decision JSON Schema and performs configured structural repair before Audita decodes decisions. Shipped validator prompts select the validator-decision
Audita receives decoded decisions. Each actual batch presents candidates JSON Schema. Each actual batch presents candidates
numbered from 1, independent of their internal proposal indices. Audita then numbered from 1, independent of their internal proposal indices. Audita then
reconciles those local references: one usable entry keeps its reconciles those local references: one usable entry keeps its
approval or editorial rejection; a missing or duplicate requested entry makes approval or editorial rejection; a missing or duplicate requested entry makes

64
docs/migrations/v4.1.md Normal file
View File

@@ -0,0 +1,64 @@
# Migrating to Audita v4.1
Audita v4.1 keeps application configuration version `3` and accepts existing
wrapperless `prompts.yml` and `prompts/` companions. It changes how structural
output contracts, configuration loading, inspection, and debug evidence work.
Review the following changes before upgrading scripts or operator prompts.
## Move structural-repair budgets to prompts
Remove `llm.repair_attempts` from the root and every pipeline entry. Audita no
longer accepts that setting or supplies an output contract at each call. The
selected PromptKit prompt now owns its `output` format, validation mode, schema,
and structural-repair budget. Shipped definitions omit `output.repair_attempts`;
the PromptKit v0.25.0 default for enabled validation is one additional generation,
where Audita previously defaulted to two. Set an explicit budget in a complete
replacement prompt when needed; zero disables structural repair for that prompt.
This is separate from Audita's `llm.correction_repair_attempts`, which controls
semantic correction repair, and from transient retries.
For a working replacement with `output.repair_attempts: 2`, see
[`examples/prompt-edit/prompts.yml`](../../examples/prompt-edit/prompts.yml).
The example retains the complete grammar proposal definition, including its
messages, format, validation mode, and schema path. A same-ID replacement is a
whole record, not a field patch. Former per-entry budgets have no automatic
one-to-one conversion: select or define prompts with budgets appropriate to each
use. See the [PromptKit format reference](https://forge.maximumdirect.net/base-layer/promptkit/src/tag/v0.25.0/docs/formats.md)
for prompt contracts and the [Audita prompt guide](../internal/prompts.md) for
required request variables and response shapes.
Audita no longer replaces an operator prompt's output contract with its own
schema. Make operator proposal, validator, and repair prompts produce the
appropriate Audita response shapes. Responses that pass a weaker contract but
cannot be decoded into the expected JSON types become recoverable invalid-output
failures for that operation; domain validation still applies.
## Update inspection and diagnostics consumers
The shared application configuration includes native settings under `/promptkit`.
Use these paths when inspecting the application scope; the separate PromptKit
scope remains available. Existing wrapperless companions are mounted at that
path, while main files and overlays can use a `promptkit` section. Configuration
inspection now validates the shared result and may run configured secrets
bootstrap. See [configuration](../config.md#loading-and-composition).
Debug `llm-execution.json` retains `summary`, `calls`, and `events`, with native
PromptKit evidence nested under `promptkit`. Prepared interaction request payloads
also include native contract, schema, and message-hash evidence under that key.
Update scripts that read the former projected metric fields; native field names
and duration representations differ. Ordinary reports retain their schemas.
Native smoke reports now default to text; scripts consuming structured output
should request `--format yaml` or `--format json`. See the
[CLI reference](../cli.md#inspection-and-outcomes) and
[debug output contract](../integrations/output-files.md#debug-only-files).
## Review startup failures
Application and PromptKit resources now share configuration loading and
validation. Invalid native configuration can be reported during application
inspection as well as processing; native configuration usage errors are
classified as status `2`, while bootstrap failures are status `1`. A failed
bootstrap occurs before transcript and output preparation. Help, version, and
other help-only paths do not perform the load. See [subprocess integration](../integrations/subprocess.md)
for handling results and [ConfigKit bootstrap documentation](https://forge.maximumdirect.net/base-layer/configkit/src/tag/v1.4.0/docs/config.md)
for the native controls.

View File

@@ -27,6 +27,11 @@ these sources before running with sensitive transcript data. Native inspection
describes the loaded configuration and resources. Processing readiness also describes the loaded configuration and resources. Processing readiness also
depends on the profiles and glossaries selected by the pipeline. See depends on the profiles and glossaries selected by the pipeline. See
[configuration loading](config.md#loading-and-composition) for discovery rules. [configuration loading](config.md#loading-and-composition) for discovery rules.
Configured secrets bootstrap runs before the shared load for processing and
native inspection. If it fails, processing stops before transcript and output
preparation; its safe diagnostic details are reported on stderr. Follow the
[ConfigKit documentation](https://forge.maximumdirect.net/base-layer/configkit/src/tag/v1.4.0/docs/config.md)
for bootstrap configuration and environment effects.
## Outputs and lifecycle ## Outputs and lifecycle
@@ -68,6 +73,8 @@ Use `--progress` to follow stage, chunk, proposal, validation, and repair
activity on stderr. Report and transcript files provide the retained outcome. activity on stderr. Report and transcript files provide the retained outcome.
Debug mode enables live progress by default. Use `--progress=false` to keep Debug mode enables live progress by default. Use `--progress=false` to keep
debug evidence with progress disabled. debug evidence with progress disabled.
The optional native `--show-tokens` report is independent of debug and ordinary
reports; see the [CLI reference](cli.md#processing).
## Debug evidence ## Debug evidence

View File

@@ -467,6 +467,13 @@ prompt's messages or schema. Check affected local links and examples. Readers
can find the imported libraries' canonical docs, while Audita's behavior remains can find the imported libraries' canonical docs, while Audita's behavior remains
understandable without duplicated library manuals. understandable without duplicated library manuals.
**Complete.** Current configuration, CLI, integration, operations, and internal
guidance describe shared loading, prompt-owned contracts, and native evidence,
with versioned upstream links. The v4.1 migration guide and complete prompt-edit
example explain structural-budget conversion. Maintained projects pass their
controlled-provider test, including synthetic secrets bootstrap and native
preparation of the replacement contract; affected local links were checked.
## Stage 9: Refresh Attribution and Prepare v4.1.0 Release Documentation ## Stage 9: Refresh Attribution and Prepare v4.1.0 Release Documentation
**Outcome:** The changed dependency selections and application migration have **Outcome:** The changed dependency selections and application migration have

View File

@@ -59,7 +59,11 @@ audita promptkit show prompt audita/modules.grammar.proposal --config config.yml
Edit its message in `prompts.yml`, repeat the inspection, and run `audita process Edit its message in `prompts.yml`, repeat the inspection, and run `audita process
--config config.yml --output corrected.json transcript.json` against a configured --config config.yml --output corrected.json transcript.json` against a configured
local service. Each invocation captures the files anew. local service. Its complete replacement also selects a structural-repair budget;
see the [v4.1 migration guide](../docs/migrations/v4.1.md). Each invocation captures
the files anew. For native resource formats and commands, see the
[PromptKit documentation](https://forge.maximumdirect.net/base-layer/promptkit/src/tag/v0.25.0/docs/formats.md)
and [ckprompt guide](https://forge.maximumdirect.net/base-layer/commandkit/src/tag/integrations/ckprompt/v0.12.0/docs/consumers/guide.md).
## Shared glossary library ## Shared glossary library

View File

@@ -21,3 +21,4 @@ collections:
format: json format: json
validation_mode: json_schema validation_mode: json_schema
schema_path: correction_set.v1.json schema_path: correction_set.v1.json
repair_attempts: 2

View File

@@ -17,7 +17,9 @@ import (
"gitea.maximumdirect.net/eric/audita/v4/internal/appconfig" "gitea.maximumdirect.net/eric/audita/v4/internal/appconfig"
"gitea.maximumdirect.net/eric/audita/v4/internal/core/schema" "gitea.maximumdirect.net/eric/audita/v4/internal/core/schema"
"gitea.maximumdirect.net/eric/audita/v4/internal/framework/llm" "gitea.maximumdirect.net/eric/audita/v4/internal/framework/llm"
auditaprompts "gitea.maximumdirect.net/eric/audita/v4/internal/prompts"
ck "go.maximumdirect.net/configkit" ck "go.maximumdirect.net/configkit"
pk "go.maximumdirect.net/promptkit"
) )
func TestMaintainedProjectsWithControlledProvider(t *testing.T) { func TestMaintainedProjectsWithControlledProvider(t *testing.T) {
@@ -33,6 +35,32 @@ func TestMaintainedProjectsWithControlledProvider(t *testing.T) {
} { } {
t.Run(tc.dir+"/"+tc.main, func(t *testing.T) { t.Run(tc.dir+"/"+tc.main, func(t *testing.T) {
main := filepath.Join(root, tc.dir, tc.main) main := filepath.Join(root, tc.dir, tc.main)
if tc.dir == "service" {
dir := t.TempDir()
if err := os.Mkdir(filepath.Join(dir, "overlays"), 0700); err != nil {
t.Fatal(err)
}
if err := os.Mkdir(filepath.Join(dir, "secrets"), 0700); err != nil {
t.Fatal(err)
}
for _, name := range []string{"config.yml", "prompts.yml", "overlays/testing.yml"} {
data, err := os.ReadFile(filepath.Join(root, tc.dir, name))
if err != nil {
t.Fatal(err)
}
if name == "config.yml" {
data = append(data, []byte("\nconfig:\n secrets_dir: secrets\n secrets_overwrite: true\n")...)
}
if err := os.WriteFile(filepath.Join(dir, name), data, 0600); err != nil {
t.Fatal(err)
}
}
if err := os.WriteFile(filepath.Join(dir, "secrets", "AUDITA_EXAMPLE_KEY"), []byte("synthetic-bootstrap-key"), 0600); err != nil {
t.Fatal(err)
}
t.Setenv("AUDITA_EXAMPLE_KEY", "")
main = filepath.Join(dir, "config.yml")
}
loaded, _, err := appconfig.Load(context.Background(), ck.Input{Source: ck.File(main)}, tc.overlay) loaded, _, err := appconfig.Load(context.Background(), ck.Input{Source: ck.File(main)}, tc.overlay)
if err != nil { if err != nil {
t.Fatal(err) t.Fatal(err)
@@ -42,6 +70,9 @@ func TestMaintainedProjectsWithControlledProvider(t *testing.T) {
var mu sync.Mutex var mu sync.Mutex
var models, prompts []string var models, prompts []string
transport := controlledTransport(func(r *http.Request) (*http.Response, error) { transport := controlledTransport(func(r *http.Request) (*http.Response, error) {
if tc.dir == "service" && r.Header.Get("Authorization") != "Bearer synthetic-bootstrap-key" {
t.Errorf("bootstrap credential was not supplied")
}
calls.Add(1) calls.Add(1)
var request struct { var request struct {
Model string `json:"model"` Model string `json:"model"`
@@ -89,6 +120,12 @@ func TestMaintainedProjectsWithControlledProvider(t *testing.T) {
if tc.dir == "service" && (len(models) != 1 || models[0] != "example-testing-model") { if tc.dir == "service" && (len(models) != 1 || models[0] != "example-testing-model") {
t.Fatalf("overlay models=%v", models) t.Fatalf("overlay models=%v", models)
} }
if tc.dir == "prompt-edit" {
prepared, err := engine.Engine.Prepare(context.Background(), pk.RunRequest{PromptID: auditaprompts.PromptIDModuleGrammarProposal, ProfileID: "local", Vars: auditaprompts.WithSharedVariables(map[string]string{"TranscriptDescriptionBlock": "", "GlossaryJSON": "[]", "SectionJSON": "[]"})})
if err != nil || prepared.OutputContract.RepairAttempts != 2 || prepared.StructuredOutput == nil || len(prepared.Messages) != 2 {
t.Fatalf("replacement contract: %+v, error=%v", prepared, err)
}
}
if tc.dir == "campaigns" && tc.main == "first.yml" { if tc.dir == "campaigns" && tc.main == "first.yml" {
if len(prompts) != 3 || !strings.Contains(prompts[0], `"name": "Lyra"`) || strings.Contains(prompts[0], `"name": "Shield"`) || !strings.Contains(prompts[1], `"name": "Shield"`) || strings.Contains(prompts[1], `"name": "Lyra"`) { if len(prompts) != 3 || !strings.Contains(prompts[0], `"name": "Lyra"`) || strings.Contains(prompts[0], `"name": "Shield"`) || !strings.Contains(prompts[1], `"name": "Shield"`) || strings.Contains(prompts[1], `"name": "Lyra"`) {
t.Fatalf("campaign glossary selections: %v", prompts) t.Fatalf("campaign glossary selections: %v", prompts)