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

28 KiB

ConfigKit, PromptKit, And CommandKit Upgrades

Status And Recommendation

Proposed. Revised 2026-11-22 to incorporate the selected native-workflow direction, including ConfigKit's configured secrets bootstrap. The code review baseline is Scriptorium commit 857c0bae201bb5f9b5ffdcb20c4f5a0bddb00114. This is an upgrade recommendation, not an implementation plan or a record of implemented behavior.

Adopt the latest released versions together, using ConfigKit's completed result as the handoff to PromptKit and CommandKit's native integrations for operator interfaces. Adopt native upstream workflows by default; retain an application-specific workflow where a concrete Scriptorium requirement warrants it. Use a clean configuration migration, including configured secrets bootstrap, in place of the separate framework-loading architecture. Expose native CLI token/cost reporting and preserve new definition features without building parallel application machinery.

The shared-load configuration cutover and native secrets bootstrap are the selected direction. They change the application format, startup behavior, and inspection boundary, not just dependencies. Additional HTTP reporting is deferred; this upgrade retains the current HTTP response and execution-report shapes.

Reviewed Releases And Sources

Published tags were checked directly against each repository's origin using git ls-remote --tags. The adjacent clean checkouts supplied release notes, consumer contracts, public APIs, and change history. The newly published ckprompt v0.12.0 tag was fetched and its released module metadata checked; recommendations do not rely on the older checkout's draft dependency selection. The web reader could not access the forge; Git supplied the release evidence.

Module Current Recommended Full released source commit
go.maximumdirect.net/configkit v1.2.1 v1.4.0 4a7ae664a6287d71cba20f59c7c5b37b6f05b0a3
go.maximumdirect.net/promptkit v0.23.3 v0.25.0 207677e9948dc5699073a4d6620d21139033c72d
go.maximumdirect.net/commandkit v0.7.0 v0.8.0 0b53a63648c536afe50c46f948159116f776adae
go.maximumdirect.net/ckconfig v0.9.0 v0.11.0 cd5cf483a46caeff7ca0a91fb4747d57188a3888
go.maximumdirect.net/ckprompt v0.10.0 v0.12.0 2422ccf02d6b55756b07f21e66a581202a09fc3f

Review covers both intervening ConfigKit releases (v1.3.0 and v1.4.0), both PromptKit releases (v0.24.0 and v0.25.0), CommandKit v0.8.0, and the corresponding integration changes. Released ckprompt v0.12.0 already requires the four other recommended versions. No unpublished API or local replacement is needed. All retain Go 1.27.0 as their consumer minimum; Scriptorium's selected release toolchain need not change solely for these upgrades.

Primary release records:

Current Baseline

internal/config loads a strict application document through ConfigKit. Its promptkit section currently selects an external configuration file and a cwd-relative schema_dir; it does not contain PromptKit definitions. Runtime conversion produces application settings, and the CLI adapter constructs an engine through a second, PromptKit-owned load. Bundled OpenRouter definitions are enabled by that constructor.

Native config commands expose the application result and the separate engine inspection. The CLI maintains application-acquisition evidence and decorators to distinguish those two loads. Application-only inspection currently avoids framework acquisition. Each comparison side loads independently.

CLI execution submits one native RunResult to CommandKit; text writes exact artifact bytes, structured output exposes upstream results, and an optional separate report uses independent native formatting. HTTP uses application DTOs and an opt-in terminal-event projection in internal/report. Those projections currently omit the new reasoning and cost fields. The server constructs one engine and shares its backend capacity accounting across requests.

The accepted definition-support boundary, ConfigKit boundary, and native operator-interface decision support this upgrade direction. They do not require adopting workflow APIs or every public library capability.

Upstream Changes And Adoption Assessment

ConfigKit

v1.3.0 adds explicit secrets-directory startup helpers, main-file config.secrets_dir / config.secrets_overwrite, and overwrite options. Configured bootstrap returns a captured main source for the subsequent load, preserving its filesystem context. It writes process environment variables; partial writes survive a later failure. Ordinary loading consumes the controls but never performs bootstrap itself. Scriptorium must explicitly invoke the helper to make the native configured-startup workflow available; operators opt into file provisioning by declaring the main-file controls.

v1.4.0 supplies the key integration enablers:

  • Result.Value(path) returns current typed values without root-type knowledge, conversion, or revalidation. Maps, slices, and pointers can alias the result.
  • Result.InspectSubtree(path) exposes non-generic, frozen inspection with redaction, historical paths, explanations, source catalogs, and resource contexts. It can represent an absent scope.
  • Inspection.Diff compares matching scopes, including across different root types, using native snapshot comparison and paired redaction. Ancestor differences remain possible; sequences remain atomic.

These are additive APIs. Use them through PromptKit and ckconfig rather than creating a Scriptorium configuration projection or provenance merger. Keep resolved settings consistent with frozen evidence until engine handoff; this requires ordinary ownership discipline, not a new generic deep-copy layer.

Recommendation: adopt v1.4.0 and integrate LoadSecretsIntoEnvironmentFromConfig into the common configuration-loading path. Preserve its native source capture, overwrite policy, reports, and failure semantics. This populates the environment before configuration loading; PromptKit still resolves api_key_env at its native preparation/execution lifecycle. Converting those names to ConfigKit Secret fields would change that lifecycle and is not needed for this upgrade.

PromptKit

v0.24.0 changes the configuration and schema boundary:

  • Public Settings can be embedded at application YAML key promptkit. Configure composes native rules with application callbacks, defaults, sensitivity, version policy, and sequence registrations. NewFromConfig captures resources from the whole completed ConfigKit result without loading again. Bundled defaults must be selected before that application load.
  • Complete documents move resources and schema_root under promptkit. SettingsInput and CollectionInput mount wrapperless fragments at their native destinations. Discovery helpers themselves remain root-mounted.
  • Output contracts support inline schema, source-relative schema_file, and explicit-root schema_path; collections can own schema roots. Global Config.SchemaDir, WithSchemaFS, and WithSchemaFile are removed. Schemas are read during preparation and retained by prepared execution.
  • RunRequest.Validation uses *OutputContractInput, whose pointer repair budget distinguishes omission from zero. Enabled validation defaults to one repair; none defaults to zero. Inspection returns a resolved integer budget.
  • Prepared reports add opaque message_content_hash for ordered message roles and exact text, independent of session/cache metadata. The existing rendered-prompt hash is unchanged.
  • Native configuration inspection focuses on /promptkit and exposes HistoricalPaths, while retaining whole-load evidence and explicit queries.
  • PromptKit no longer imposes resource-version policy. It retains extension fields at settings, collection, backend, profile, and prompt boundaries; nested PromptKit-owned objects remain strict. Input requirements inherited from application defaults are now retained correctly. Capture and schema handling also avoid unnecessary copying and provenance expansion.

v0.25.0 adds execution and provider capabilities:

  • WithExecutionObserver carries invocation-scoped observation in context, composing with explicit request observers. Prepared execution selects contextual observers when executed, not when prepared.
  • Backend provider explicitly selects openai-compatible, openrouter, or vllm; blank/omitted uses the generic provider. IDs and endpoints do not select conventions. Declared zero_cost: true is an optional fallback, never an inferred property of local endpoints.
  • Usage includes reasoning tokens and provider-specific cache fields, with native presence-aware cache-hit ratios. Reasoning is included in completion tokens; cache activity does not add to total tokens.
  • RunResult.CostUSD and observations retain available USD subtotals, completeness, and provider/configured-zero/mixed source information. Costs include dispatched retries and repairs; result usage still sums successful generation responses. Failure observations can retain cost without a result.
  • Authentication diagnostics can use provider defaults, including vllm_models. An endpoint-only authentication object is now valid; kind: none disables authentication testing. Probes remain explicitly requested operations.

Recommendation: adopt both releases' definition semantics and shared-load API. Use native results/inspection for the new fields; do not write a local schema resolver, cost estimator, repair controller, or provider-name heuristic.

CommandKit And Integrations

Core v0.8.0 adds captured invocation features: application-wide flags, context decoration, and final diagnostic reports. Features start after successful input checks and finish after deferred messages, including on returned failure or cancellation. Help, version, completion, and input failures skip startup. ErrHelpRequested also supports help-only input checks. Registry validation accounts for feature flag/alias collisions; invocation flag processing avoids repeated owner partitioning and duplicated lookup maps.

ckconfig v0.10.0 adds FromConfigKitSubtree and native path discovery through View.Paths. v0.11.0 adopts core's help-only exemption for bare config explain. Loading and validation cover the whole result even when rendering is focused.

ckprompt v0.11.0 adopts shared loading, focused inspection, schema selections, repair inputs, and message hashes. v0.12.0 installs native --show-tokens through ordinary nonempty Command / Declarations assembly. It observes the invocation context and produces a text token/cost summary on diagnostics, independently of main --format; quiet suppresses it. It also forwards provider declarations, reasoning/cache evidence, and changes automatic smoke output to a native text template. Explicit JSON/YAML remain structured; smoke usage is separate from ordinary run observation and its report does not acquire a cost field.

Recommendation: retain existing native assembly and expose this capability without wrapping App.Execute, installing a second accounting observer, or adding a duplicate application flag. Preserve invocation context in PromptKit calls. No selected-main-format accessor is needed for current output delivery.

One Application-Owned Configuration Load

Replace the acquisition-only PromptKitDocument with public promptkit.Settings at Document.PromptKit. Compose the existing application definition with promptkit.Configure. Prepare the existing selected file/search source through ConfigKit's configured secrets helper, as described below, then load through configkit.LoadLayered using the returned captured source as main, imports and overlay selection, existing override records, and promptkit.BundledOpenRouterUnderlay() as the lowest-priority underlay. Defaults-only startup remains supported.

Pass the successful whole result to promptkit.NewFromConfig, supplying the existing optional transient-retry setting through RuntimeConfig and the HTTP artifact reader through its existing public option. Engine construction remains the point where message-file content is captured; configuration inspection need not construct an engine or read those messages.

Retire promptkit.configuration, promptkit.schema_dir, the schema-directory default, and their cwd-path normalization and runtime fields. External definition files remain supported through native ConfigKit imports, with declared destinations/placement for wrapperless fragments. This removes a special Scriptorium source-selection mechanism; it does not require putting every definition inline or flattening collection checkouts.

Preserve source-relative context for imported message/schema references. Do not rebase native resource references against cwd, widen filesystem roots, or copy imports into generated temporary files. Preserve server-setting normalization, HTTP limits, artifact-reader policy, namespace behavior, and shared engine pools.

Apply a hard cutover with migration guidance, not dual loading or format aliases. Because PromptKit retains extension fields, make retired acquisition selectors clearly diagnosable during migration rather than silently claiming they still load resources. Keep any such check narrowly about those retired selectors. Retain ordinary upstream extension fields and existing credential restrictions; do not introduce a blanket unknown-field ban within PromptKit's extension points. In particular, api_key in a backend/profile extension is not an upstream credential field and is not automatically protected: preserve Scriptorium's existing raw-key boundary through application validation using public settings. Do not redact extra_params as a whole or invent a new version requirement.

Native Configured Secrets Startup

Use configkit.LoadSecretsIntoEnvironmentFromConfig before each reached application configuration load: execution, server startup, native configuration inspection/comparison, and PromptKit commands all use the common acquisition path. Pass its successful returned source directly to the layered main input; this retains the selected main's captured contents and filesystem context without rediscovery, rereading, or a second bootstrap during the load. Help, version, static completion, and scope discovery remain acquisition-free.

The main file's root config.secrets_dir and config.secrets_overwrite are the operator controls. Use native defaults rather than an application overwrite override: existing variables, including empty ones, win unless the main file selects overwrite. A main without a secrets directory remains valid, and optional search exhaustion still permits defaults-only loading. Let ConfigKit own directory resolution, containment, eligible entries, whitespace, limits, and which source may declare these controls. Bootstrap all native eligible entries, including environment names not referenced by PromptKit. No extra CLI flag, custom secret-file parser, or new raw-key configuration field is needed.

Retain the returned SecretsReport on success and failure and expose its native safe rendering through CommandKit's diagnostics, separately from the later configuration report and main stdout. Preserve visibility of blocked/failed entries and typed LoadError / SecretsError diagnostics without logging credential contents or inventing source/provenance records for environment writes. Thin forwarding of this explicit report is application integration, not a replacement configuration-inspection workflow.

Bootstrap failure stops that acquisition; its returned source is unusable. Already applied environment writes remain, including when a later load fails. Each reached comparison side prepares its own selected source in native load order, but both use the process environment as it exists at that point. In preservation mode, a variable supplied while preparing an earlier side can win over a later side's file; overwrite mode can replace it. Document these native effects rather than promising environment-isolated comparisons or adding snapshot/restore, rollback, or subprocess machinery. Configuration diffs still compare native frozen configuration values, not secret-file contents or provider credentials resolved later.

For serve, complete startup bootstrap and loading before accepting concurrent requests. Keep bootstrap out of HTTP request handling and retain the shared engine lifecycle. Native bootstrap precedes concurrent application work; adopting it creates no hot-reload or environment-isolation guarantee. The upstream startup contract and public helper own these semantics.

Native Views Of The Same Result

Keep config's app scope as the complete application result using FromConfigKit. Expose the promptkit scope with FromConfigKitSubtree at configkit.Keys("promptkit"), using the same loader, without requiring an engine. Continue to use native ckprompt resource/preparation commands for engine-derived information. Native --set may then address embedded PromptKit settings wherever the scope's existing override capability permits it; do not reintroduce application-specific inspection selector flags.

Remove acquisition evidence transport/decorators that exist only to reconcile the former two loads. Preserve native typed errors, findings, source catalogs, and left/right comparison context. Emit diagnostics once for their real load, not as independently generated application and framework evidence. Retain only the thin integration needed to carry the distinct native bootstrap report and its diagnostics to the operator; this does not justify keeping two-load reconciliation or merging bootstrap entries into configuration provenance.

The intentional operator change is that app inspection includes PromptKit settings and validates the whole document. Invalid PromptKit settings can fail an application inspection. The focused scope retains whole-load diagnostics and explicit native queries, including outside /promptkit; ancestor differences can survive focused comparison. Neither scope promises isolation. Each reached comparison side still loads independently from its own selection, without sharing mutable results or inheriting the other side's options. That source and option independence does not isolate process-global environment effects from native secrets bootstrap.

Definition, Example, And Repair Migration

Migrate maintained complete framework documents to /promptkit; adapt import destinations for wrapperless fragments and collection entrypoints. Audit examples/, test fixtures, preview scripts, overlays, and consumer guidance together. Existing IDs, references, inheritance, and namespace selections keep their upstream meanings; mounting does not rewrite references.

Replace the old application schema base with explicit definition-owned roots or source-relative files; prefer schema_file for independently portable prompts, inline schemas when appropriate, and schema_path for deliberately shared roots. All three modes and collection-specific roots must work through Scriptorium. Do not install an implicit cwd root or local fallback search. Update any Go request/fixture using the changed output-contract input type and use keyed upstream struct literals where expanded structs affect compilation.

Adopt upstream repair defaults rather than silently injecting zero. Explicit repair_attempts: 0 in existing maintained definitions continues to mean no repair. Explain that omitted/null enabled budgets can add a generation, latency, and cost and still return invalid output. Request replacements, where already exposed upstream, resolve their own defaults. Existing CLI domain outcome versus operational failure and HTTP completed-validation semantics remain distinct.

Migrate application-defined OpenRouter backends to provider: openrouter when those conventions are intended; do not infer that choice from endpoints. Allow native zero_cost and vLLM declarations without app-side defaults or provider allowlists. Update inspection paths to include /promptkit and allow the native prepared message hash/schema evidence through unchanged.

Native CLI Usage And HTTP Scope

Adopt ckprompt's --show-tokens with its native defaults, ordering, quiet and help behavior. Preserve artifact-only CLI text output, native structured results, and the independently formatted separate report; structured results acquire native reasoning/cost fields without a Scriptorium report wrapper. Document the changed automatic smoke representation and explicit structured alternatives.

Keep the existing HTTP response DTOs and opt-in terminal-report projection for this upgrade, adapting their integration only as needed for the new library versions. New reasoning, cost, and cache-ratio evidence remains available through native CLI reports, but adding it to HTTP is deferred. Preserve existing result-usage versus presence-aware terminal-usage semantics, request-scoped observation, status mapping, transport limits, and shared-engine capacity behavior. This deferral concerns additional reporting, not HTTP support for the upgraded configuration and valid PromptKit definitions.

Justified Application-Owned Boundaries

The native-workflow goal removes duplicate source loading, configuration composition, inspection, provider/schema handling, and CLI accounting. The remaining local responsibilities have concrete application purposes:

  • HTTP DTOs, transport limits, restricted artifact reading, and request-scoped report projection implement Scriptorium's service boundary. CommandKit's native CLI reporting is not an HTTP transport. Reuse native PromptKit facts within that boundary, without preserving a second accounting algorithm.
  • Exact artifact stdout, independent report-file delivery, and the whole-run timeout map already selected application execution/delivery choices onto native public APIs; upstream still owns rendering, timeout enforcement, preparation, and execution semantics.
  • Application discovery selection, server settings, domain callbacks, process lifecycle, and safe bootstrap-report forwarding are consumer integration responsibilities, consistent with ADR 0005. ConfigKit and PromptKit continue to determine how selected inputs and requests are processed.

These are scoped reasons for local integration, not a general exception allowing parallel versions of native workflows. Shared loading and native bootstrap have no identified Scriptorium-specific requirement that warrants a legacy path.

Documentation, Licensing, And Verification

Update the canonical configuration, CLI, operations, subprocess/migration, contributor, and internal documents with the implemented changes. Review HTTP compatibility against its existing contract without adding report fields in this work. Update the architecture policy's current integration description and versioned upstream links; accepted ADR decision text remains unchanged. Mark the embedded-configuration direction in future work as delivered only when its implementation lands. Other deferred directions remain separate. Describe configured bootstrap, native overwrite behavior, partial environment effects, and comparison behavior in configuration/operations guidance. Include maintained secret-free provisioning examples when implementation lands.

The five selected components' COPYRIGHT and LICENSE texts are unchanged from their adopted baselines and remain LGPL-3.0-or-later. During implementation, update their entries in docs/oss/attribution.md to the exact released commits above and recheck the resolved runtime dependency graph. Reuse applicable local license texts; graph-only maintainer tools do not become runtime dependencies merely because they occur in upstream module metadata. This review adds no copied third-party implementation or new licensing requirement.

Validate the assembled integration, not upstream internals. Focus coverage on shared-load imports/overlays and independent comparisons, native provenance and redaction, all schema selection forms and collection roots, omitted versus zero repair budgets, provider declarations, and native CLI accounting on success, failure, cancellation, retries, and repairs. Protect stream separation, quiet and help-only behavior, independent report delivery, HTTP limits/reader containment, existing HTTP report shapes, and shared backend capacity using representative real-library integration tests with controlled providers. Reuse existing coverage rather than duplicate upstream format/accounting matrices.

Protect bootstrap integration with representative native-helper tests: selected main capture, absent-directory/defaults-only behavior, environment preservation and explicit overwrite, bootstrap reports on failure, and comparison-side effects. Control process environment in those tests; avoid parallel tests that mutate the same environment. Test that successful bootstrap reaches PromptKit's ordinary credential lookup without leaking values into output. Do not retest the upstream directory-entry and parsing matrix locally.

Run normal repository code validation and affected maintained examples during implementation; default tests remain offline and credential-free. This review did not upgrade modules or compile/test the proposed combination. A green build against the old baseline would not establish upgrade compatibility. No new release gates, live provider checks, tags, or publication are part of this work. The proposed public configuration changes warrant a new Scriptorium minor release under the existing pre-v1 policy; choose its number during release preparation, not in this roadmap.

Deferred Work

HTTP Accounting Additions

The user selected deferral of additional HTTP reporting. A future roadmap may add reasoning tokens to result and terminal usage, native cost availability, completeness and source information to success/terminal reports (including failures with terminal evidence), and a nullable terminal cache-hit ratio using ObservedTokenUsage.CacheHitRatio(). Keep result usage distinct from presence-aware observations; do not infer ratios from unavailable counts or treat unknown cost as zero. This is future work, not an upgrade acceptance requirement or a blocker for native CLI reporting.