Files
audita/docs/roadmap/library-upgrades.md

384 lines
25 KiB
Markdown

# ConfigKit, PromptKit, and CommandKit Upgrade
**Status:** Proposed adoption; implementation has not begun.
**Reviewed:** 2026-11-23, against Audita commit
`da5b8913d1206a8e8f0a784b2322760385548a60` (v4.0.0).
## Recommendation
Upgrade the three libraries and both CommandKit integrations together. Adopt
PromptKit's application-owned configuration handoff and CommandKit's native
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 correction, validation, repair, and output contracts.
Keeping separate loads through `NewEngine` is a viable smaller adaptation,
provided the new input and schema APIs are handled. The shared-load approach is
recommended because it removes filesystem-context reconstruction and gives
application settings, PromptKit settings, and overlays one provenance model.
The tradeoff is broader configuration validation and inspection, described below.
This document records recommendations and the desired outcome. A subsequent
implementation plan can divide the work into bounded units.
## Reviewed Releases
The following are the latest published versions verified against each upstream
repository's remote tags. Full commits identify the source behind each tag;
CommandKit's integrations are independently versioned modules in its repository.
| Module | Audita currently selects | Recommended version | Reviewed release commit |
| --- | --- | --- | --- |
| `go.maximumdirect.net/configkit` | v1.2.1 | [v1.4.0](https://forge.maximumdirect.net/base-layer/configkit/src/tag/v1.4.0/docs/releases/v1.4.0.md) | `4a7ae664a6287d71cba20f59c7c5b37b6f05b0a3` |
| `go.maximumdirect.net/promptkit` | v0.23.2 | [v0.25.0](https://forge.maximumdirect.net/base-layer/promptkit/src/tag/v0.25.0/docs/releases/v0.25.0.md) | `207677e9948dc5699073a4d6620d21139033c72d` |
| `go.maximumdirect.net/commandkit` | v0.7.0 | [v0.8.0](https://forge.maximumdirect.net/base-layer/commandkit/src/tag/v0.8.0/docs/releases/v0.8.0.md) | `0b53a63648c536afe50c46f948159116f776adae` |
| `go.maximumdirect.net/ckconfig` | v0.9.0 | [v0.11.0](https://forge.maximumdirect.net/base-layer/commandkit/src/tag/integrations/ckconfig/v0.11.0/integrations/ckconfig/docs/releases/v0.11.0.md) | `cd5cf483a46caeff7ca0a91fb4747d57188a3888` |
| `go.maximumdirect.net/ckprompt` | v0.10.0 | [v0.12.0](https://forge.maximumdirect.net/base-layer/commandkit/src/tag/integrations/ckprompt/v0.12.0/integrations/ckprompt/docs/releases/v0.12.0.md) | `2422ccf02d6b55756b07f21e66a581202a09fc3f` |
The matched integrations select these ConfigKit, PromptKit, and core versions.
Their Go minimum remains 1.27.0, matching Audita. The reviewed module manifests
require no additional upgrade to Audita's existing YAML, JSON Schema, Cobra,
pflag, or ReleaseKit selections.
The review covered intervening ConfigKit v1.3.0, PromptKit v0.23.3 and v0.24.0,
ckconfig v0.10.0, and ckprompt v0.11.0 as well as the target releases. Upstream
release notes, migration guidance, public APIs, and Audita's consumers were
compared directly.
## Current Baseline
- `internal/core/config.Load` produces an application-only ConfigKit result,
with application defaults, glossary companions, imports, overlays, recorded
resolution, and explicit CLI overrides.
- `internal/framework/llm/runtime.go` separately constructs a PromptKit engine.
It reconstructs the application's main filesystem context to discover prompt
companions, selects the bundled catalog and embedded prompts, and installs
embedded response schemas through `WithSchemaFS`.
- Prompt companions are wrapperless PromptKit fragments. Embedded definitions
contain `collections.audita`; operator fragments can contain profiles,
backends, and collections. Resource identities do not include a configuration
path prefix.
- Processing replaces each prompt's output contract with an Audita-owned schema
and explicit structural-repair budget. Semantic correction repair uses native
exchanges and `Engine.Coordinate`, separately from structural repair.
- The LLM adapter records native execution facts for operation outcomes and
optional detailed debug evidence. Its debug collector projects token fields
into Audita DTOs and uses a native execution group. There is no ordinary
invocation-wide token/cost flag.
- Command assembly already uses `ckconfig` and `ckprompt`. Source collision
checks recover message-file paths by rendering effective PromptKit YAML and
decoding a partial projection with root-relative metadata paths.
A compile-only compatibility probe used a temporary alternate module file with
all five target versions. Audita's module files were unchanged. The unchanged
application does not compile: `WithSchemaFS` is unavailable and
`RunRequest.Validation` now requires `*OutputContractInput` instead of
`*OutputContract`. Prompt registry tests also use the removed schema option.
These are confirmed initial migration points, not an exhaustive runtime check.
## ConfigKit: Share the Completed Load
ConfigKit v1.3.0 adds explicit configured secrets-directory bootstrap and
overwrite selection. v1.4.0 adds `Result.Value` and `Result.InspectSubtree`, which
let a library capture its typed settings and focused inspection from an
application-owned result. The latter is directly useful to Audita's PromptKit
adoption. See the [component handoff guide](https://forge.maximumdirect.net/base-layer/configkit/src/tag/v1.4.0/docs/consumers/README.md#component-handoff).
### Recommended end state
The application configuration includes native `promptkit.Settings` under
`yaml:"promptkit"`. Compose Audita's ConfigKit definition with
`promptkit.Configure`, preserving Audita's defaults, application version rule,
recorded domain resolution, glossary identities, and validation. Pass the whole
successful result to `promptkit.NewFromConfig` with the runtime HTTP client.
Compose the bundled OpenRouter catalog, embedded prompts, schema-root input,
glossary companions, and operator prompt companions as native inputs before the
load. Select `BundledOpenRouterUnderlay` explicitly: `NewFromConfig` does not
add the standalone constructor's default bundle. Main configuration, selected
overlay, and explicit overrides should then operate on the combined document
using ConfigKit's normal precedence.
Use `MainRelative` for companion imports instead of reconstructing host roots
and base directories in the LLM adapter. Keep optional companion discovery
anchored to the selected main source; the absence of a main source should retain
the existing embedded/default behavior. Keep source-local message resolution
and effective origins intact.
One completed result should serve a processing acquisition and its engine.
Comparison still acquires each side independently, including equal selections;
this proposal does not establish a process-global cache or a universal
one-load-per-invocation rule. Native loading and validation remain distinct from
processing readiness and provider execution.
### Inspection and source ownership
Keep the existing `app` and `promptkit` command scopes. The app scope describes
the combined application result; the PromptKit scope uses native focused
inspection at `/promptkit`. Explicit metadata queries retain application-root
paths, and focused comparisons can include ancestor changes. A focused view is
not an isolation or confidentiality boundary.
Use the captured typed settings and recorded source contexts when identifying
consumed message files. Remove the YAML encode/decode projection where the
shared result makes it unnecessary, and update metadata lookups to their native
`/promptkit/...` paths. Preserve the existing output-collision protections.
`FromConfigKitSubtree` is available if another concrete configuration scope is
needed later; this upgrade does not need additional inspection commands.
### Secrets bootstrap
Adopt `LoadSecretsIntoEnvironmentFromConfig` in the common configuration
acquisition path, before the shared `LoadLayered` call and before concurrent
model work. This is an agreed adoption choice for consistency with other
ConfigKit consumers. Use its native main-document controls as defined in the
[upstream bootstrap contract](https://forge.maximumdirect.net/base-layer/configkit/src/tag/v1.4.0/docs/config.md#explicit-secrets-directory-bootstrap).
Pass the selected host `File` or `SearchConfig` source to the helper, then use
its returned prepared source as the layered load's main input. Reuse that
captured main and its filesystem context rather than rediscovering or rereading
the file. Engine construction consumes the completed result without repeating
bootstrap. Missing optional discovery and configurations without `secrets_dir`
retain the native no-op behavior.
Use upstream path resolution, eligible-file handling, overwrite semantics, and
partial-effect behavior. No additional Audita bootstrap flags or environment
precedence rules are needed. Link to the upstream contract for those controls
and their limits.
Retain the returned `SecretsReport` even on failure. Use native safe diagnostics
and the report's names, paths, and statuses for startup reporting, with routine
entry details following existing verbose/debug controls. Bootstrap failure
stops configuration preparation before outputs or provider work. Completed
environment writes remain if a subsequent write or configuration load fails;
follow upstream partial-effect semantics without adding rollback machinery.
Apply this startup path to configuration-consuming processing and inspection
commands; help, version, and completion retain their configuration-free behavior.
Inspection may therefore populate the process environment, while remaining
independent of provider calls and processing readiness. Independent comparison
acquisitions each prepare their selected main, and share the normal process
environment; they do not receive isolated credential environments. Document
Audita's startup integration and link upstream for bootstrap behavior and
credential selection.
## PromptKit: Adapt Configuration and Schema Boundaries
v0.23.3 fixes operation-timeout attribution and cancellation/error identities.
v0.24.0 introduces shared configuration loading, prompt-owned schema selection,
`MessageContentHash`, and a default of one structural repair for enabled
validation modes. It is a breaking upstream release. v0.25.0 adds contextual
execution observers, explicit provider conventions, reasoning/cache usage, and
presence-aware USD costs. Follow the [migration guide](https://forge.maximumdirect.net/base-layer/promptkit/src/tag/v0.25.0/docs/consumers/configuration-migration.md)
and [format contract](https://forge.maximumdirect.net/base-layer/promptkit/src/tag/v0.25.0/docs/formats.md).
### Configuration shape and compatibility
Complete PromptKit documents now require a `promptkit` wrapper. Preserve
Audita's existing wrapperless `prompts.yml` and `prompts/` fragments by mounting
them at `/promptkit`, using `SettingsInput` or equivalent explicit destinations.
Mount embedded fragments consistently. Discovery helpers return root-mounted
inputs; they do not perform this adaptation automatically. Imports and nested
destinations must be checked in the context of their containing fragment.
Keep existing resource IDs, references, and application configuration version 3.
An optional `promptkit` section in the application main and its overlay can
provide native settings without requiring existing companion files to be
rewritten. Full external PromptKit documents use the new upstream wrapper;
document that distinction rather than silently accepting a file at the wrong
mount. PromptKit no longer enforces resource-version fields; retain Audita's
application version rule without inventing resource-version requirements.
Shared loading deliberately makes PromptKit settings part of application
configuration validation and inspection. Invalid PromptKit definitions may now
surface in application inspection as well as engine construction. Explain that
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
Replace `WithSchemaFS` with a native `SchemaRootSource` input, mounted under
`/promptkit` and anchored to `responseschema.Filesystem()` at its asset root.
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 explicit pointer to the resolved Audita
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.
Preserve the current configurable structural budget, including explicit zero
and the default of two. The upstream default of one should apply only where
Audita leaves the budget unspecified, such as native requests using a prompt's
own output definition. Keep transient retries and semantic correction repair
distinct, with their existing operation deadlines and partial-success behavior.
Update ordinary and coordinated request construction together.
Link to the upstream schema reference for external prompt definitions and file
resolution. Audita's documentation should identify its shipped schema selection
and domain requirements. Do not add another schema resolver or introduce
broader schema prohibitions in Audita.
### Providers and execution evidence
Custom OpenRouter backends should explicitly set `provider: openrouter` to
receive its usage, cost, and default authentication conventions. Use
`provider: vllm` for actual vLLM services. An omitted provider retains generic
OpenAI-compatible behavior; an endpoint hostname or backend ID does not select
provider conventions. Keep generic services generic, including the existing
local example unless its server actually uses another supported convention.
Allow native `zero_cost` declarations, but do not infer that a local backend is
free or set zero-cost defaults for operators. Unknown cost remains distinct
from known zero and an incomplete subtotal. PromptKit owns attempt aggregation,
reasoning-token interpretation, cache-hit ratios, cost sources, and terminal
coverage. Costs are observations, not a billing guarantee or budget control.
Carry `MessageContentHash` into existing prepared debug metadata where useful,
and extend debug execution projections to retain reasoning tokens, native cost
facts, and cache-hit information. Preserve their availability/completeness
semantics in both per-call and aggregate paths. Avoid recomputing upstream
metrics or summing overlapping attempt, terminal, and group totals. These facts
belong in optional diagnostics; ordinary errors/recoveries documents continue
to describe processing outcomes.
## CommandKit: Adopt Native Invocation Reporting
Core v0.8.0 provides invocation features for shared flags, context decoration,
and final diagnostic reports. ckconfig v0.11.0 includes native subtree support
and a help-only preflight exemption. ckprompt v0.12.0 installs `--show-tokens`
through the existing nonempty PromptKit family, including application-owned
commands. See the [consumer guide](https://forge.maximumdirect.net/base-layer/commandkit/src/tag/integrations/ckprompt/v0.12.0/docs/consumers/guide.md).
Adopt that built-in flag and presentation. Propagate `Invocation.Context` through
proposal, validator, and coordinated repair work, including derived cancellation
contexts, and continue joining owned work before returning. The integration's
contextual observer then sees executions across nested clients and engines,
including failures. Audita should retain explicit request observers for domain
operation counts and debug attribution without installing the same collector
twice or implementing another CLI total/report callback.
The native summary is opt-in, goes to diagnostics, follows deferred completion
messages, respects quiet, and precedes terminal failure explanations. It does
not require debug artifacts or ordinary reporting. Help, version, completion,
and input errors skip feature startup; bare `config explain` has the same help
exemption. Preserve the current transcript stream and completion behavior.
Adopt native inspection additions and smoke-report changes: backend provider and
explicit zero-cost fields, resolved repair budgets, prepared message hashes,
reasoning usage, and cache-hit ratios. Smoke reports now default to text with
annotated YAML evidence; machine consumers should request `--format yaml` or
`--format json`. Smoke usage is reported separately from ordinary execution
usage, and smoke reports do not gain a cost field. Update affected examples and
tests without promising historical incidental formatting.
## Documentation Ownership and Consolidation
**Agreed documentation direction:** Audita identifies the ConfigKit, PromptKit,
and CommandKit libraries it imports and links to their canonical upstream
documentation. Upstream owns descriptions of its features, configuration
fields, defaults, algorithms, CLI grammar, output formats, and API behavior.
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
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
should not grow into a parallel library reference in the published documentation.
Align the documentation during this upgrade, including existing duplication:
| Affected material | Required alignment |
| --- | --- |
| [Documentation policy](../policy/documentation.md) | Record this application-specific ownership clarification for adopted libraries, retaining the general allocation of Audita's documentation topics. |
| [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. |
| [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 by availability and an upstream link, without a local reference for its flags, report layout, or formatting rules. |
| [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. |
| [LLM runtime](../internal/llm-runtime.md), [prompt registry](../internal/prompts.md), [diagnostics internals](../internal/diagnostics-reporting.md), and [CLI/configuration recipes](../internal/cli-config.md) | Retain Audita's component wiring, call sites, domain attribution, and change recipes. Replace standalone explanations of upstream loading, coordination, observation, schema resolution, and metrics with focused upstream links. |
| [Maintained examples](../../examples/README.md) and [migration guides](../migrations/) | Keep minimal runnable Audita projects, application-specific prompt inputs, and actual Audita conversion steps. Link upstream for general library tutorials and native command syntax rather than expanding local walkthroughs into library manuals. |
Use links to canonical documentation for the selected upstream releases, using
the release identities recorded above. Refresh outdated upstream references as
part of current guidance; migration guides should link to the source or target
release appropriate to the conversion they describe. Link to the owning topic
or section, rather than copying the upstream reference into another local page.
Preserve immutable release records and accepted ADR decisions; this work
concerns maintained documentation. Keep attribution notices in their existing
canonical location.
Completion requires the adopted libraries to be discoverable through brief
adoption statements and canonical upstream links. Apply that approach to the
new secrets, schema, provider, and token/cost capabilities rather than adding
local feature references. Review the affected documents for duplicated library
explanations while checking that Audita-specific choices and workflows remain
understandable. No new library reference pages or recurring documentation gates
are needed.
## Work and Validation
The implementation should cover the following outcomes:
- Select all five target versions in `go.mod` and tidy module metadata. Adapt
changed public types, including affected tests and any positional literals.
- Replace separate PromptKit source assembly with the shared typed load and
native inputs; keep error classification, source evidence, relative resources,
selected overlays, and output protection coherent across both consumers.
- 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 existing configured budgets.
- Adopt native usage reporting and retain useful new metadata in optional debug
evidence. Preserve cancellation causes, recoverable timeouts, and joined work.
- Update canonical configuration, CLI, operations, LLM integration, and internal
documentation plus maintained examples under the ownership and consolidation
direction above. Replace duplicated library guidance with canonical upstream
links. Review old source paths and scripts consuming native reports, and add
migration guidance for actual Audita input or inspection changes.
- Update the five attribution entries and commit-pinned notice/source links.
The reviewed target `COPYRIGHT` and `LICENSE` files are unchanged from the
selected releases, and all five remain `LGPL-3.0-or-later`. Reuse applicable
local standard texts; inspect any newly selected transitive material.
Use focused offline tests for the consequential integration risks: main/import/
companion/overlay precedence and source-relative message resolution; configured
secrets bootstrap, prepared-source reuse, existing and empty environment values,
explicit overwrite, and startup failure reporting; retained
schema validation and explicit zero/nonzero repairs; native inspection paths
and independent comparison acquisitions; timeout/cancellation classification;
and token/cost reporting across proposal, validation, and repair calls. Check
stdout isolation, quiet/help behavior, unknown versus zero usage/cost, and
coexistence with debug capture using controlled clients or HTTP responses.
Keep the existing partial-success and output-lifecycle coverage.
Run the complete offline suite and required Linux builds after implementation.
Do not duplicate upstream's provider-decoding or lifecycle test inventories.
The compile probe in this review establishes incompatibility, not successful
adoption; no runtime validation of the upgraded application has been claimed.
## Scope and Release Impact
This is a coordinated integration change, rather than a version-only update.
It does not require a toolchain increase, a new concurrency scheduler, new
semantic repair policy, pricing estimates, spending limits, or a redesign of
ordinary processing reports. ConfigKit secrets bootstrap is included in the
adoption; additional custom inspection scopes remain an optional future choice.
The recommended fragment mounting should preserve existing valid Audita inputs;
do not presume that an upstream pre-v1 breaking release forces 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.