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

@@ -6,7 +6,8 @@ CLI wiring, and maintained examples. Definitions of behavior belong to the
## 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
applicable. Preserve the precedence defined in 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
artifact path coordinates.
Execution diagnostics include a native-group invocation summary and per-call
summaries. Terminal coverage is separate from usage completeness; unknown usage
is distinct from known zero. Overlapping summaries must not be added together.
Execution diagnostics put native group evidence under `promptkit` in the
invocation summary and each logical call, and native events under `promptkit`
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
presentation order. Prepared evidence comes from `OnPrepared`, so preparation or
admission failures may have no request snapshot. Coordinator execution failures

View File

@@ -1,23 +1,23 @@
# Audita LLM Runtime
`llm.NewRuntime` assembles one captured PromptKit engine using its default
catalog, Audita's embedded prompts and schemas, and optional operator sources
anchored to the recorded application main context. Captured host sources and
message files are passed to output collision checks. An embedded-only diagnostic
construction distinguishes shipped asset failures from operator-source failures;
it never replaces the requested engine.
`internal/appconfig` assembles one shared result and bootstraps configured
secrets before loading. `llm.NewRuntime` captures a PromptKit engine from that
result. Effective host sources and message files are passed to output collision
checks. Native errors and source evidence are retained for classification.
Each resolved pipeline entry receives role-bound clients with its selected
profiles and effective budgets. Clients share engine-local backend admission.
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
repair. An expired parent context stops processing and retains any native cause.
With an active parent, PromptKit's operation deadline remains recoverable even
when a preparation error wraps it. A native transport timeout affects the HTTP
attempt and is recorded as a transport failure. The prepared notification
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,
the CLI identifies the role, profile, and environment variable using the native
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
`Engine.Coordinate` branch from that exchange. PromptKit assembles continuation
history, owns the additional-turn budget, and delivers the last permitted response
for assessment. Follow-ups select the repair prompt, profile, and output schema
directly; Audita does not rerender the original proposal or assemble replay messages.
for assessment. Follow-ups select the repair prompt and profile; the prompt owns
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
modules and validators. The adapter shares request construction, notifications,
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;
see [prompt instruction ownership](prompts.md).
The observation collector tracks logical calls and execution events, and enrolls
selected runs in a native `ExecutionGroup`. Proposal, repair, and nested validator
clients explicitly share the invocation observer; history reuse adds no extra run.
Native summaries deduplicate terminal totals by run ID and retain terminal coverage
separately from usage presence and completeness. Logical calls and run membership
can differ, especially on failures before execution.
The optional debug collector tracks logical calls and native execution events,
and replays selected events into a native `ExecutionGroup`. The invocation
context also carries ckprompt's optional usage observer through proposal, repair,
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)
for native observation and aggregation semantics.
Processing operations retain the failure class, reason, and underlying error.
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.
Proposal generation adds the selected transcript section and trimmed description
for each request. PromptKit renders the selected definition and validates the
correction-set schema before Audita maps proposals. Domain validators still
for each request. PromptKit renders the selected definition and applies its
output contract before Audita decodes and maps proposals. Domain validators still
check applicability, protected glossary terms, and replacement
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

View File

@@ -11,6 +11,7 @@ baseline commands, see the [contributor guide](../development.md).
Executable and command orchestration:
- `cmd/audita`: executable entry point.
- `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:
- `internal/core/config`
@@ -67,7 +68,7 @@ artifact lifecycle.
## 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,
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
shared-variable helper fills absent `HardeningPolicy`, `ProposalContract`,
`RepairContract`, and `ValidationContract` variables. The processing adapter
supplies the embedded instruction fragments for those names. Processing supplies
Audita's response-schema contract separately.
supplies the embedded instruction fragments for those names. Each prompt owns
its output contract and references the shared embedded schema assets.
The operator's prompt definition controls which variables its template uses.
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
retains its findings and available source text. An operator replacement may use
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.
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;
- batch using `validation.max_prompt_tokens` and the existing domain token estimator;
- 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
`validation_input_too_large` operation, without a provider call. Recoverable
model failures make only their batch candidates unavailable while other
batches continue. PromptKit validates each complete response against the
validator-decision JSON Schema and performs configured structural repair before
Audita receives decoded decisions. Each actual batch presents candidates
batches continue. PromptKit applies the selected prompt's output contract before
Audita decodes decisions. Shipped validator prompts select the validator-decision
JSON Schema. Each actual batch presents candidates
numbered from 1, independent of their internal proposal indices. Audita then
reconciles those local references: one usable entry keeps its
approval or editorial rejection; a missing or duplicate requested entry makes