diff --git a/docs/roadmap/future.md b/docs/roadmap/future.md index 791ccce..42c6ad6 100644 --- a/docs/roadmap/future.md +++ b/docs/roadmap/future.md @@ -1,5 +1,9 @@ # Future Work +The completed native library upgrade roadmap, implementation plan, and remediation +record remain available in +[Git history](https://forge.maximumdirect.net/eric/scriptorium/src/commit/dbf62718d2d2c73dd5d5fdc88f5df6e268784b39/docs/roadmap). + The completed CommandKit adoption, implementation plan, Narratio request, and earlier adoption/policy roadmaps remain available in [Git history](https://forge.maximumdirect.net/eric/scriptorium/src/commit/f5573f7c8f2ddf0d69414a05c978c8d6cfe291e7/docs/roadmap). @@ -11,7 +15,7 @@ Current behavior belongs to the [CLI](../cli.md), [configuration](../config.md), - **HTTP design review:** separate work before v1.0; CommandKit adoption retained the existing HTTP interface and execution-report representation. - **Additional HTTP accounting:** reasoning, cost, and cache-ratio reporting is - deferred from the [library upgrade roadmap](library-upgrades.md#deferred-work). + deferred from the [library upgrade roadmap](https://forge.maximumdirect.net/eric/scriptorium/src/commit/dbf62718d2d2c73dd5d5fdc88f5df6e268784b39/docs/roadmap/library-upgrades.md#deferred-work). The upgrade retains current HTTP report shapes while adopting native CLI reporting. - **Dynamic resource completion:** possible enhancement beyond native command, diff --git a/docs/roadmap/implementation.md b/docs/roadmap/implementation.md deleted file mode 100644 index 2ee1b31..0000000 --- a/docs/roadmap/implementation.md +++ /dev/null @@ -1,673 +0,0 @@ -# Native Library Upgrade Implementation Plan - -## Scope And Execution - -Implement the target in [the library upgrade roadmap](library-upgrades.md), -reviewed at Scriptorium commit `882bdb4bdb0de3b04c7a9b393024ed7557b4ef3c`. -The roadmap owns product intent, selected upstream releases and source revisions, -boundaries, and deferred work. This document owns implementation order and tasks. -It is written for a Luna coding agent executing one stage per implementation -prompt, in sequential order. - -This is one end-to-end sprint. Intermediate stages may fail to compile or have -failing tests. Do not introduce temporary compatibility loaders, duplicate types, -adapters, or alternate execution paths to make an intermediate stage green. -Record incomplete validation accurately and carry it forward. Focused checks -below run when their dependencies are available; Stage 12 verifies the complete -end state. Follow the local commit policy for completed units without treating -each stage as an independently releasable product. - -Before work, read `docs/development.md` and the applicable adopted policies. -In particular, follow agents, architecture, testing, documentation, and OSS -policy for the changes below. Keep documentation policy v1.13's upstream-owner -rule; link library contracts rather than rewriting them. Use the public APIs of -the selected tags, not sibling-checkout HEAD assumptions or internal packages. - -### Decisions That Apply Throughout - -- The application document embeds `promptkit.Settings` at `promptkit`. - `promptkit.Configure` composes library rules with application callbacks. -- Each acquisition prepares its selected main with native secrets bootstrap, - performs one typed ConfigKit layered load, and returns the actual completed - result. Engine construction passes that whole result to `NewFromConfig`. - There is no second framework load, projection/redecode, or post-load resolver. -- Native all-scope/comparison operations may reach multiple independent loader - callbacks. Each reached callback follows that sequence; this does not promise - one load for an entire invocation or add a configuration/engine cache. -- Both native configuration scopes allow overrides. Paths remain native - application-root paths, including `/promptkit`; scopes do not rebase them. -- ConfigKit owns secret-file processing and process-environment effects. - Preserve native sequential comparison effects, not isolated environments. -- Keep the bundled OpenRouter underlay, application retry setting, server - settings/defaults/normalization, source-root selection, request presence, - artifact policy, and process lifecycle unless this plan expressly changes them. -- Adopt upstream repair/schema/provider semantics and native CLI usage reporting. - Keep application-specific output and error/status choices. Additional HTTP - reporting, workflow APIs, hot reload, and selected-format accessors are outside - this sprint. HTTP's existing wire contract remains unchanged. -- Preserve raw-key restrictions with narrow application validation. Do not - reject ordinary PromptKit extension fields, invent a version requirement, - redact whole `extra_params` maps, or introduce a generalized legacy detector. -- Tests protect adoption and application boundaries. Remove obsolete two-load - assertions rather than rebuilding their machinery; retain distinct HTTP, - delivery, cancellation, and concurrency protections. - -## Stage 1 — Select The Released Dependency Set And Update Attribution - -**Status: Complete.** Selected all five releases and verified their module-origin -commits against the upgrade roadmap. Updated the corresponding attribution links; -the selected upstream license texts match the previous releases. Module selection -retains Go 1.27.0 without replacements. Source migration, module tidiness, runtime -attribution review, and full offline validation remain for later stages; the -intermediate application may not compile against the new APIs. - -**Files:** `go.mod`, `go.sum`, `docs/oss/attribution.md`, and license texts only -if the selected runtime graph actually requires a change. - -1. Select these releases together: - - ```sh - GOWORK=off go get go.maximumdirect.net/configkit@v1.4.0 go.maximumdirect.net/promptkit@v0.25.0 go.maximumdirect.net/commandkit@v0.8.0 go.maximumdirect.net/ckconfig@v0.11.0 go.maximumdirect.net/ckprompt@v0.12.0 - ``` - - Keep the module path and `go 1.27.0`. Keep the selected release toolchain - Go 1.27.4; no toolchain/CI upgrade is needed for this dependency set. -2. Check the selected modules against the roadmap's full source revisions. - ckprompt v0.12.0 is released and selects the other four target versions. - Do not use replacements, a committed workspace, vendoring, or sibling source - changes. Prepare dependencies separately from offline validation. -3. Update the five existing attribution entries to those versions and exact - source/COPYRIGHT/LICENSE commit links. Preserve the separate policy-material - attribution and mixed policy baselines. The reviewed library grants/texts - are unchanged; reuse local standard texts after checking the selected sources. -4. Inspect module selection now; finish tidying and runtime-graph review after - source migration. Graph-only upstream maintainer tools do not by themselves - require runtime attribution. Do not add release scanners or publication gates. - -**Check:** selected module versions and attribution links agree with the roadmap. -Build failures from removed schema APIs or old fixtures are expected at this point. - -## Stage 2 — Replace The Configuration Schema And Loader - -**Status: Complete.** Embedded native PromptKit settings and composed its -definition with application validation and normalization. Configuration loading -now bootstraps the selected source once, retains its native report and typed -errors, and performs one layered load with the bundled underlay. Retired fields -and raw backend/profile keys are rejected at their effective paths; native -sensitivity is composed with the application raw-key boundary. - -The offline configuration package tests pass on Go 1.27.4, covering native -extensions, diagnostics, discovery, overrides, server normalization, and -configured bootstrap preservation, overwrite, exhaustion, and failure effects. -The old conversion and callers remain temporarily for the next stage, so the -assembled application is not yet expected to compile or pass its full suite. - -**Files:** `internal/config/document.go`, `load.go`, their tests, -`internal/defaults/defaults.go`; remove obsolete settings definitions when callers -are migrated in Stage 3. - -1. Replace `PromptKitDocument` with `promptkit.Settings` in `Document.PromptKit`. - Keep `TransientRetries` and `Server` as application fields. Remove framework - acquisition/path defaults and normalization; retain recorded application - server/address/artifact-root normalization and existing numeric validation. -2. Return the application definition composed with `promptkit.Configure`, - selecting `&document.PromptKit`. Keep existing defaults and domain callbacks - in the supported definition flow. Do not clone the framework schema, normalize - native resources locally, or add a root inline map to relax application decoding. -3. In application validation, use public settings' extension maps to reject - the exact retired `promptkit.configuration` and `promptkit.schema_dir` keys - when present, including null. Report their native paths and a value-free - migration message. This checks effective fields, not every historical source. -4. Preserve the raw-key boundary by rejecting `api_key` in root and collection - backend/profile extension maps. Use actual list-index/collection paths and - value-free diagnostics. Preserve all other native extension data. Classify - these exact forbidden API-key field positions as sensitive through the - application definition so native diagnostic/history rendering cannot print - their rejected contents. Compose, rather than replace, PromptKit's native - sensitivity predicate. Do not recursively police arbitrary application data. -5. Change `Load` to return - `(*configkit.Result[Document], *configkit.SecretsReport, error)`. - Keep `LoadOptions`' explicit selection, overlay, and override records. Choose - the existing host `File` or `SearchConfig("scriptorium", applicationSearch)`; - call `LoadSecretsIntoEnvironmentFromConfig` with native default options. -6. Return the native report on every path. On bootstrap failure, stop and retain - the typed cause; never pass the unusable returned source to a loader. On - success, use the captured source in an import-enabled layered main input. - Call `LoadLayered` once, with the composed definition, existing overlay and - override selections, and `BundledOpenRouterUnderlay()` as the lowest tier. - Do not rediscover/reopen the main, call bootstrap again, or set a mismatched - filesystem context. Preserve report access if the later load fails. -7. Return the native completed result unmodified. Error context may wrap with - `%w`, preserving both `LoadError` and `SecretsError`. Do not convert failures - into a synthetic ConfigKit result or attach secret-file entries as sources. -8. Migrate configuration tests. Add focused cases for shared resource decoding, - effective retired-key rejection, ordinary extension acceptance, raw-key - diagnostics/redaction, omitted/null/zero retries, recorded server normalization, - and typed native errors. Revise source assertions to account for the bundled - underlay instead of requiring the old single-source count. -9. Cover native bootstrap handoff using temp files and controlled environment: - preservation including an existing empty variable, explicit YAML overwrite, - no directory, optional discovery exhaustion, bootstrap failure and its report, - and a later validation failure retaining a successful bootstrap report/effect. - Reuse upstream coverage for entry parsing and directory limits. Use - `t.Setenv`/cleanup; environment-mutating tests must not run in parallel. - -**Check when available:** `go test ./internal/config`. Defaults-only loading -still includes the selected bundle; configuration inspection performs no -PromptKit provider-credential lookup or message-file reads. Native bootstrap -still provisions the environment when configured. PromptKit's own settings -validation participates in the load. - -## Stage 3 — Wire Shared Acquisition, Engine Handoff, And Bootstrap Diagnostics - -**Status: Complete.** CLI acquisition forwards native bootstrap reports through -an invocation-local reporting feature, and run/server construct engines directly -from the completed application result. Server settings are consumed directly; -obsolete conversion types and schema defaults are removed. The process and HTTP -behavior remain unchanged. The former prompt/config adapter evidence machinery -is still present until its replacement in the next stage. - -Go 1.27.4 offline build and configuration tests pass. Focused tests against the -production CLI files verify a controlled provider receives a bootstrapped dummy -credential without exposing it, and server bootstrap occurs before listening -and is not repeated for requests. Full CLI test compilation remains deferred -until old two-load fixtures are migrated as planned. - -**Files:** `internal/adapter/cli/app.go`, `selection.go`, `engine.go`, -`native_run.go`, `server.go`, `outcomes.go`; a small CLI bootstrap-report helper. - -1. Keep `loadApplication` as the common native-adapter loader. Map selectors and - presence-aware server overrides to `LoadOptions`, call the new loader once, - forward its bootstrap report, and return the actual result and typed error. - Retain context checks at acquisition boundaries; do not claim interruption - of synchronous upstream work that ignores context. -2. Use a small `commandkit.NewInvocationFeature` with `struct{}` input, no flags, - and no final report producer to provide the invocation's reporter to this - common acquisition path. Attach its handle once, with `WithInvocationFeature` - on the always-installed configuration declaration. `Start` decorates the - incoming context with a private-key report-sink callback and returns that - context. This is a reporting bridge, not an acquisition hook: it never loads - configuration, mutates environment, or creates an accounting group. -3. The CLI loader obtains that callback from its context and passes it the - returned `SecretsReport` and load error. The sink queues native `WriteTo` - rendering through `Reporter.AtEnd`: Info for nonempty successful bootstrap - reports, Warn for failed/blocked entries. For `SecretsError`, use its safe - diagnostics through `ckconfig.AdaptDiagnostics` and the diagnostic Details; - do not render raw wrapped host errors. Ordinary `LoadError` evidence remains - the native adapter's responsibility, without duplicate rendering by the sink. - Message visibility follows native verbose/debug/quiet behavior. Even if - report detail is suppressed, a bootstrap failure still returns a failed - native outcome. Rendering/writer errors remain native presentation failures. -4. Keep this sink invocation-local, with a no-op when no reporter is installed - (for direct loader tests). Queue report callbacks as each acquisition occurs; - do not recreate an acquisition journal, generic report envelope, global - reporter, per-selector cache, environment snapshot, or callback-per-resource - evidence reconciliation. Do not wrap `App.Execute` to intercept output. -5. Replace `newEngine(AppSettings, ...)` with direct `NewFromConfig(result, - RuntimeConfig{TransientRetries: result.Config.TransientRetries}, options...)`. - A small helper taking the actual result is acceptable if shared by run/serve; - it must not resolve/load anything or invent a second runtime settings model. -6. Update `runPrompt` to use the shared acquisition and native namespace view, - then call `Engine.Run` with the supplied invocation context and existing - request mapping. Adapt the one load's diagnostics once, from the completed - result or typed `LoadError`. Drop the application-vs-framework failure branch - and duplicate configuration inspection solely used for evidence reconciliation. -7. Update server startup to use `result.Config.Server` directly, inject the - existing restricted artifact reader, and construct one shared engine from - the same result before opening the listener. Keep timeout/limit values, - listener injection, cancellation/connection close behavior, and status mapping. - Do not bootstrap/load per HTTP request or attach server-global CLI accounting. -8. Remove `AppSettings`, `Settings`, `settings.go`, `SchemaDirDefault`, and their - conversion-only tests once callers use resolved application fields directly. - Remove old source-selection construction in `engine.go`; retain genuine - application discovery/flag mapping rather than deleting necessary integration. -9. Keep `ckconfig.ClassifyConfigurationError` authoritative for native errors. - `SecretsError` is an operational failure under that classifier; do not add a - local code/message classifier. Keep existing application domain status 4, - timeout behavior, and safe terminal explanations. - -**Check:** a loopback-provider run can use a bootstrapped dummy credential without -emitting it. A server loads/bootstrap once at startup. Bootstrap report text is -diagnostic output, never part of an artifact, structured result, or HTTP response. - -## Stage 4 — Replace The Native Configuration And Prompt Adapter Assembly - -**Status: Complete.** Both native configuration scopes now use the common typed -loader, including subtree inspection and overrides on each scope. PromptKit -commands use the same loader and direct engine handoff with native callbacks; -the obsolete evidence state, decorators, and sentinel are removed. The upstream -invocation feature supplies token reporting without an application duplicate. - -The application builds offline with Go 1.27.4. Focused native composition tests -pass for acquisition-free help, scope listing and shell completion, bare explain -help, shared loading and overrides in both scopes, and the bootstrap run/server -checks. Broader fixture and integration migration remains scheduled below. - -**Files:** `internal/adapter/cli/native_config.go`, `native_prompt.go`, -`acquisition.go`, and related generic callback types/callers. - -1. Assemble config with `Suite[applicationInput, struct{}]`. Use - `FromConfigKit("app", ..., loadApplication)` and - `FromConfigKitSubtree("promptkit", ..., configkit.Keys("promptkit"), loadApplication)`. - Set `Features.Overrides = true` on both scopes. Preserve app as the default - scope and native operations/path discovery; do not narrow the scope's native - explicit-path behavior or silently prefix `--set` paths. -2. Delete `frameworkConfigurationScope`'s engine-backed `ConfigScope` wrapper. - Neither config scope constructs an engine. Let the native adapters supply - configuration findings, path enumeration, redaction, and independent comparison - sides, including native whole-load/ancestor evidence in a focused view. -3. Assemble prompt commands with `ckprompt.FromEngine(loadEngine)` and the - existing request validation, preparation, smoke, namespace, and declaration - integrations, using `struct{}` for otherwise unused state. Keep all twelve - callbacks, existing bindings/aliases, and nil default request builders. - `loadEngine` calls the common loader and then `NewFromConfig`, returning - original typed acquisition errors; no sentinel masking is necessary. -4. Delete `acquisitionState`, `applicationAcquisition`, `errApplicationAcquisition`, - `attachApplicationEvidence`, `withApplicationEvidence`, and associated - mark/replay logic. Remove `acquisition.go` if empty. Do not retain dead helpers - or two-load tests as a compatibility option. The Stage 3 bootstrap sink is - separate and carries only native bootstrap report/diagnostic presentation. -5. Keep native `ckprompt.Declarations` installation. Its released integration - installs `--show-tokens` application-wide. Preserve its decorated invocation - context through every engine execution. Do not declare another flag, - observer/group, usage formatter, or final summary callback in Scriptorium. -6. Retain current run/serve application flags and output effects. Do not add - main `--output`, raw API-key flags, generalized config convenience flags, - or a selected-format accessor dependency. - -**Check when fixtures are migrated:** help/version/completion and config scope -listing are acquisition-free; `config explain` with no path/list shows native -help without bootstrap or feature reports. Both scopes accept native overrides. - -## Stage 5 — Migrate Maintained Configuration And Collection Examples - -**Status: Complete.** Maintained application entrypoints now import native -framework documents, wrapperless fragments mount under `promptkit`, and the -collection checkouts declare their namespaces and sequence destinations. Added -source-relative structured schemas and a synthetic configured-secrets example; -the collection overlay retains the local GPU profile selection. - -Validated every maintained application configuration in both native scopes, -the standalone collection/GPU entry, both provider-free preview scripts, -structured schema previews, and the collection overlay using the built CLI. -The isolated example bootstrap test passes and restores its environment. The -full maintained-test package remains deferred until old CLI fixtures are migrated. - -**Files:** application/definition YAML under `examples/`, maintained preview -scripts, representative collection resources, and example-loading tests. - -1. Keep existing example entrypoint filenames usable. Replace all application - acquisition selectors with native root `config.imports`, preserving each - example's selected bundle of definitions, server choices, and overlay intent. - Migrate `config.yml`, `config.full.yml`, composed/collections/inheritance/ - discovery variants, `config-fragments/sources.yml`, and application overlays. -2. Use a consistent placement convention: application files import complete - framework entry documents at root. Entry documents such as `promptkit.yml`, - `inheritance.yml`, and `collections.yml` place their wrapperless settings - imports at `[promptkit]`. Descendant wrapperless fragments inherit that mount. - Whole application/framework entries import at root without a second prefix. - Update the collection/GPU and inheritance chains accordingly. Preserve - peer-conflict and whole-record replacement behavior through native imports. -3. Keep standalone prompt/profile/backend fragments wrapperless where explicitly - mounted. Keep source-local `content_file` references and exact resource IDs. - Convert `generic.structured_events` to source-relative - `schema_file: ../schemas/structured_events.schema.json` and remove the old - application schema directory. Retain existing explicit zero repair budgets. -4. Keep `config.discovery.yml` importing `discovery/framework.yml`. Its optional - glob imports still discover both collection entry spellings. Collection - entry documents self-declare their namespace under `promptkit.collections` - and place standalone records using native sequence-item destinations such as - `[promptkit, collections, support, prompts]`. Keep relative checkout imports; - do not derive namespace IDs from directory names or load arbitrary checkout YAML. -5. Add a small source-relative schema example to the support checkout: a - `structured` prompt with an inline message and `schema_file` pointing to a - sibling schema, imported by the collection entry. Keep the existing answer/ - summarize prompts' behavior unchanged. This complements the existing - source-relative answer message and proves checkout-local resource context. -6. Add `examples/config.secrets.yml` and a native directory containing only - clearly synthetic fixture text under a dedicated example environment name. - The main file imports the maintained definitions and declares native bootstrap - controls; no custom secret schema/CLI flag is introduced. Link upstream for - standalone provisioning instructions. Ensure example tests restore environment - and never rely on real credentials or contact a provider. -7. Update maintained preview scripts only as needed for these paths/formats. - Keep their provider-free behavior. Do not turn examples into a comprehensive - tutorial/test matrix for upstream features. - -**Check when available:** `go test ./internal/adapter/cli -run 'TestMaintained'`; -run `bash examples/render-markdown-summary.sh` and -`bash examples/render-v0.9-features.sh` with cached dependencies/offline Go -settings. Validate both scopes for every maintained application example and -prepare the structured/schema examples without model calls. - -## Stage 6 — Migrate CLI Acquisition, Inspection, And Source-Context Tests - -**Status: Complete.** Migrated shared-load fixtures, native root paths, and -checkout discovery; removed obsolete two-load-only tests. Focused offline CLI -tests pass for whole-document inspection, native diagnostics and comparison -sides, both-scope and all-scope overrides, conflict handling, redaction, -sequential secrets effects, discovery/preview/smoke, and source-relative -resources. Schema preparation covers inline, source-relative, and collection -root selections, including a missing-root failure. The checkout test exercises -the new schema after installation and on subsequent invocations. - -**Files:** CLI `selection_test.go`, `native_config_test.go`, `native_prompt_test.go`, -`discovery_test.go`, `examples_test.go`, and small related fixture helpers. - -1. Rewrite native fixture helpers to create one complete application source plus - native imported definitions, not an app file pointing at a second framework - load. Update expected configuration paths to `/promptkit/...`. Use keyed - expanded upstream structs and public input APIs where needed. -2. Replace `TestNativeApplicationScopeDoesNotLoadFramework` with the new boundary: - app scope sees and validates the complete document, including framework - settings, but no config scope captures message files, performs PromptKit - provider-credential lookup, reads schemas, or contacts a provider. Native - configured secrets bootstrap still runs. Missing resource files can - therefore permit config inspection yet fail later engine capture/preparation. -3. Replace old promptkit-scope override-rejection tests with positive override - cases in both scopes, including all-scope operation, independent - `--against-set`, changed framework values, and native overlap/conflict handling. - Keep rejection of Scriptorium-only server/source convenience flags where those - flags are not installed. Do not add a focused-scope override-path restriction. -4. Replace application-vs-framework evidence assertions with original-load - provenance, typed failures, native diagnostics without duplication, and native - left/right context. Keep redaction/history checks and ordinary `extra_params` - visibility. Verify a non-framework application setting can be explicitly - explained from the focused native view; it is not an isolation boundary. -5. Protect independent comparison source/overlay/override selection and the - selected bootstrap behavior: sequential sides share environment, preservation - keeps an earlier value, overwrite can replace it, and no restoration occurs. - Native diff still compares configuration, not secret-file bytes. Use unique - controlled environment variables and nonparallel tests. -6. Retain representative discovery/requirements/preview/smoke integration coverage - with real libraries. Verify captured message contexts and all three schema - modes through representative preparations: inline, source-relative file, and - explicit-root path with a collection root overriding the application root. - Missing explicit roots use native failure behavior, not a cwd fallback. -7. Extend the checkout workflow for the Stage 5 schema resource and fresh - invocations after installing a checkout. Retain both entry spellings, - namespace declarations, multiple records, relative imports, and provider-free - requirement discovery. Do not duplicate exhaustive ConfigKit grammar tests. - -**Check:** focused native config/prompt/discovery/selection tests. Delete tests -whose only owner was the removed reconciliation machinery, not the regressions -protecting retained behavior. - -## Stage 7 — Verify CLI Generation, Native Usage, And Delivery - -**Status: Complete.** Migrated remaining CLI execution fixtures and retained -delivery, presence, cancellation, timeout, and finalization protection. Added -controlled-provider checks for native usage/cost reporting and suppression, -structured results/reports, failed-generation cost, zero-execution and help, -omitted versus zero repair budgets, vLLM metadata and authentication, and safe -bootstrap failure/presentation handling. The offline CLI package suite passes -on Go 1.27.4 without external inference or credentials. - -**Files:** CLI `native_run_test.go`, `delivery_test.go`, `lifecycle_test.go`, -`app_test.go`, and a focused native usage integration test file if helpful. - -1. Migrate remaining run/delivery/lifecycle fixture YAML and removed schema/input - APIs. Preserve artifact bytes, request presence (including zero and cleared - reasoning), timeout layering, namespace selection, explicit report formatting, - file failures, quiet-mode file delivery, and native finalization/status tests. -2. Use a controlled loopback provider with native OpenRouter `provider` metadata - and reported usage/cost to verify `run --show-tokens`: unchanged artifact - stdout, text summary only on diagnostics, native reasoning/cache/cost facts, - and native full result fields in structured stdout/separate reports. Check - semantic fragments or decoded fields, not whole upstream formatting snapshots. -3. Cover omitted/false/quiet suppression, repeated native flag selection through - one representative case, an operational failure/cancellation retaining an - available summary, and a zero-execution command. Verify explicit help and - bare config-explain help neither bootstrap nor produce a usage summary. - Keep smoke usage separate from ordinary execution summaries; use explicit - structured format where existing tests decode smoke output. -4. Add representative adoption coverage for omitted versus explicit zero repair - budgets using a provider that returns invalid then valid output. Let PromptKit - perform repairs; retain domain status 4 on exhausted invalid content and - operational status on schema/generation failures. Check attempt/terminal/result - facts without computing an application-owned accounting total. -5. Verify backend `provider` and explicit `zero_cost` fields appear in native - inspection and accept native vLLM metadata/default authentication selection. - A small local diagnostic fixture suffices; do not add real provider probes, - provider inference heuristics, or a parallel pricing/provider abstraction. -6. Exercise bootstrap-report forwarding via run/config/prompt entrypoints with - verbose diagnostics, a failed bootstrap, and a later load failure. Canary - credential contents must not appear in stdout, diagnostics, or reports. - Verify diagnostic-writer failure remains a native presentation failure. - -**Check when available:** `go test ./internal/adapter/cli`. Native usage is -installed through ckprompt, not reimplemented to satisfy these tests. - -## Stage 8 — Migrate HTTP, Report, And Process Fixtures Without Wire Expansion - -**Status: Complete.** Mounted wrapperless HTTP/report fixtures at the native -settings path and migrated the signal-process fixture to shared imports. Added -checks that new native reasoning, cost, ratio, and hash fields do not expand -the existing HTTP/report projections. The HTTP, report, and entrypoint package -tests pass offline on Go 1.27.4, including existing capacity, cancellation, -artifact policy, and process-signal coverage. Production HTTP code is unchanged. - -**Files:** `internal/adapter/http/*_test.go`, `internal/report/*_test.go`, -`cmd/scriptorium/*_test.go`, and test fixtures/helpers reached by those tests. - -1. Migrate root framework fixtures to `/promptkit`, explicit fragment mounts, - source-relative/explicit-root schemas, and current public input types. Simple - isolated upstream-engine test fixtures may still use supported `NewEngine`; - production Scriptorium acquisition uses the shared application load. Do not - create a shared test framework facade or convert unrelated fakes unnecessarily. -2. Keep HTTP request/response field sets, optional raw output and terminal report, - status/error mapping, strict decoding, and response-size fallback behavior. - In particular, do not automatically marshal the enlarged native RunResult - or ObservedTokenUsage into these DTOs: added reasoning, cost, ratio, and - prepared-hash fields are not new HTTP fields in this sprint. -3. Reuse HTTP/report tests to prove unchanged projection on success, invalid - output, and operational failure, and isolation across concurrent requests. - Internal simplification is allowed when it preserves that wire contract; - there is no requirement to freeze the current collector type permanently. -4. Retain transport/artifact limits, lexical containment and documented symlink - behavior, shared backend concurrency/capacity, request timeout/retry presence, - and parent cancellation protections. Bootstrap remains server startup work. -5. Migrate process identity/status/signal fixtures and preserve the current - main entrypoint and release identity injection. Do not add shutdown-drain, - durable state, or process-wide environment isolation guarantees. - -**Check:** `go test ./internal/adapter/http ./internal/report ./cmd/scriptorium`. -Existing HTTP consumers need no reporting-schema migration for this work. - -## Stage 9 — Consolidate Public And Operator Documentation Around Upstream Owners - -**Status: Complete.** Updated the README, CLI, configuration, operations, and -HTTP references for shared acquisition, native scopes and bootstrap while -retaining application-specific process, delivery, limits, and HTTP wire -contracts. Library-owned detail now links to the selected upstream versions. -Both maintained provider-free preview scripts pass offline, and incoming local -anchors to the revised references were checked. Broader link and upstream-target -verification remains part of the final audit. - -**Files:** `README.md`, `docs/cli.md`, `docs/config.md`, `docs/operations.md`, -`docs/api.md`; maintained example links. - -1. Apply the roadmap's documentation ownership table, not a mechanical version - replacement. Identify adopted libraries and link the pinned canonical sources - there; use relevant sections. Preserve one application quickstart and navigation. -2. In CLI docs retain installed entrypoints, application-selected bindings/aliases, - run/serve application flags, artifact/file effects, and application outcome - mappings. Replace repeated native family, reusable-flag, parser, formatter, - requirements, smoke, and finalization reference material with upstream links. -3. In config docs retain the application fields and selected discovery preset - order/underlay, embedded settings location, common bootstrap acquisition, and - final result handoff. Delegate filenames/preset expansion, composition, - imports/inheritance/overlays/override rules, sensitivity, secret-file processing, - and schema/repair/provider contracts upstream. Remove retired selector tables. -4. In operations retain Scriptorium deployment, restart, output retention, - service/reader policy, limits, and recovery responsibilities. Describe local - startup integration briefly and link native startup/comparison semantics; - do not write a second bootstrap or model-execution manual. -5. Keep the full application HTTP wire contract. Remove duplicated framework - semantic explanations in favor of selected-version links while preserving - DTO definitions, presence mapping, error/status mapping, and local effects. - Do not document deferred reporting fields as current or change wire behavior - to make documentation cleanup easier. -6. Check changed application examples/commands against the actual implementation; - run only provider-free examples by default. Fix links/anchors removed by - consolidation, including README and contributor navigation. - -**Check:** local docs explain application selections/effects; adopted native -behavior has an upstream owner instead of a new local reference table. - -## Stage 10 — Simplify Consumer And Migration Guidance - -**Status: Complete.** Consumer navigation now points to the selected PromptKit -contracts. The CLI migration guide explains shared imports, both inspection -scopes, override paths, and bootstrap effects. Historical Go migration and -PromptKit upgrade guidance are condensed to application boundaries and upstream -owners. Subprocess guidance retains process, delivery, and recovery responsibilities. -Incoming links to changed migration headings were checked; full link validation -remains in the final audit. - -**Files:** `docs/consumers/api.md`, `upgrading-cli.md`, `upgrading-promptkit.md`, -`migrating-to-promptkit.md`, and `docs/integrations/subprocess.md`. - -1. Keep concise executable-interface selection and process/stream/file - responsibilities, linking CLI/HTTP local owners and native upstream contracts. -2. Make `upgrading-cli.md` the application-specific migration owner for this - cutover: replace acquisition selectors with native imports/embedded settings, - note changed configuration inspection boundaries and enabled scope overrides, - and link the selected upstream migration/release guides for native changes. -3. Condense `upgrading-promptkit.md` to upstream format/API migration navigation - plus necessary Scriptorium-specific deployment pointers. Remove duplicated - before/after framework definitions, catalogs, inheritance/schema tutorials, - and obsolete acquisition advice. Do not retain a legacy loader. -4. Condense `migrating-to-promptkit.md` to the historical application/framework - split and destination guidance. Preserve the fact that v0.11.1 was the final - Scriptorium Go framework release; use upstream docs for its library successors - rather than maintaining an obsolete multihop library tutorial. -5. Preserve subprocess invocation/capture, application file-delivery, cancellation, - result availability and recovery choices without repeating native flags, - result schemas, retry/default rules, or feature descriptions. Repair incoming - links to removed headings. Keep published release records unchanged. - -**Check:** migration remains actionable for Scriptorium callers and delegates -library migrations to their owners. New guidance does not imply compatibility -aliases, new HTTP fields, or new library feature guarantees. - -## Stage 11 — Align Contributor And Internal Documentation With The Final Structure - -**Status: Complete.** Updated contributor dependency links and routing, internal -component and source flows, and architecture's implemented inspection boundary. -Removed the delivered embedded-configuration direction from future work while -preserving independent deferred directions. Accepted ADRs and policy provenance -remain unchanged. Final cross-document and upstream link checks follow below. - -**Files:** `docs/development.md`, `docs/internal/{overview,adapters,sources}.md`, -`docs/policy/architecture.md`, and `docs/roadmap/future.md`. - -1. Update contributor version links and task routing for the selected dependencies. - Keep selective policy reading and baseline validation. Route native-feature - questions to upstream, local integration questions to focused local documents. -2. Replace two-load inventories/mechanics with the actual typed shared load, - bootstrap-report bridge, native config scopes, and direct engine handoff. - Remove obsolete package/helper descriptions and copied upstream lifecycle - explanations. Keep local adapter/process/HTTP implementation detail. -3. Update architecture's implemented version/boundary descriptions and links, - including the shared configuration's native inspection/sensitivity boundary. - Preserve deliberately selected application constraints. Do not elevate the - bootstrap sink, current report collector, or intermediate package choices - into architectural invariants. Retain policy provenance and update its local - last-updated date for actual edits; accepted ADR decision text is immutable. -4. Documentation policy v1.13 is already adopted: apply its Upstream Dependencies - section without another local policy rewrite or upstream policy refresh. -5. In future work, remove the now-delivered embedded-framework-configuration - direction once implementation is complete. Preserve HTTP redesign/accounting, - dynamic completion, optional format access, and other independently deferred - directions. Keep this feature roadmap as target/rationale and this plan as - execution record until deliberately retired; do not prematurely remove them - or erase deferred work. - -**Check:** architecture/internal docs describe the landed implementation, all -local links/anchors resolve, and library contracts are linked rather than copied. - -## Stage 12 — Audit The Complete Cutover And Validate The Sprint - -**Status: Complete.** Audited the assembled shared-load cutover against this -plan and the library upgrade roadmap. Go 1.27.4 offline checks passed with -`GOWORK=off`, `GOTOOLCHAIN=local`, `GOPROXY=off`, `GOSUMDB=off`, and read-only -modules: `go test ./...`, `go test -race ./...`, `go vet ./...`, and -`go build ./cmd/scriptorium`. A subsequent focused normal/race check covers -rejected raw-key diagnostic redaction. Formatting and whitespace checks pass; -`go mod tidy` removed only obsolete checksums and its diff is clean. - -Both maintained preview scripts, application/scope validation, structured -schema preparation, generated help, and bash/zsh/fish completion were exercised. -The local link audit checked 48 Markdown files with no broken local links or -anchors; selected upstream documentation and license paths were checked against -cached tagged modules. Runtime dependency inspection agrees with attribution; -no workspace, replacement, or vendored sources were introduced. - -The five selected releases and full source commits are recorded in the -[upgrade roadmap](library-upgrades.md#reviewed-releases-and-sources). Production -uses one native secrets preparation and layered load per reached acquisition, -direct `NewFromConfig` handoff, native scopes and usage, with no reconciliation -state or second loader. HTTP/report code, accepted ADRs, and historical releases -remain unchanged. No release, tag, or push was performed. - -1. Review all changes against the feature roadmap and this plan. Confirm: - - - the five selected releases and their attributions agree; - - native bootstrap feeds one completed application load into PromptKit; - - all entrypoints use that acquisition path, with no production `NewEngine` - fallback, raw YAML reconstructor, second loader, or stale settings conversion; - - config scopes use the same loader and native whole/focused views, both with - overrides, while comparisons keep independent selections and native - process-environment effects; - - the old reconciliation state/decorators/sentinels and obsolete-only tests - are gone; remaining bootstrap forwarding is narrowly scoped; - - definitions, source-relative resources, native repair/schema/provider - behavior, prepared hashes, and native CLI accounting work end to end; - - generation bytes, independent reports, lifecycle/statuses, HTTP wire shape, - limits/reader policy, and shared capacity remain protected; - - documentation consolidation is complete rather than just version-bumped, - and HTTP reporting and other deferred work have not slipped into scope. - -2. Run `gofmt` on changed Go files, finish `go mod tidy`, and inspect the actual - runtime graph with `go list -deps ./cmd/scriptorium` against attribution. - Do not copy graph-only tool dependencies into runtime notices automatically. -3. Use the selected Go 1.27.4 with a prepared module cache, `GOWORK=off`, - `GOTOOLCHAIN=local`, read-only modules, and offline dependency settings for - the final repository checks: - - ```sh - go test ./... - go test -race ./... - go vet ./... - go build ./cmd/scriptorium - git diff --check - ``` - - Run affected provider-free preview scripts and the maintained discovery/schema - example checks. Review generated help and bash/zsh/fish completion for native - composition and the new usage flag. Tests use temp files, synthetic credentials, - and controlled providers, never real inference or credential services. -4. Inspect doc links and pinned upstream targets, attribution/license links, - changed examples, and the full diff. Reuse successful checks for unchanged - content rather than rerunning them solely for another reporting phase. - Remove only generated scratch artifacts created by this sprint. -5. Follow the repository commit policy, leaving the completed implementation - accurately recorded. Report actual checks, any failures, and remaining work. - Leave no committed workspace/vendor tree, module replacement workaround, or - unrelated sprint changes. Preserve unrelated local files rather than treating - a clean Git status as permission for broader cleanup. - -This is implementation completion, not release publication. No version number, -release note, tag, push, CI polling, artifact verification gate, or new release -automation is required by this plan. The later breaking pre-v1 release should -use a new minor version under the existing release policy. - -## Open Questions - -None remain that require a product or architecture decision before this sprint. -The selected native shared-load/bootstrap path, both scopes' override support, -upstream documentation ownership, and HTTP-reporting deferral are settled. -Implementation mechanics selected above use released public APIs and preserve -their native behavior. Report a concrete newly discovered API/scope blocker -before changing the selected target. diff --git a/docs/roadmap/library-upgrades.md b/docs/roadmap/library-upgrades.md deleted file mode 100644 index ba7a552..0000000 --- a/docs/roadmap/library-upgrades.md +++ /dev/null @@ -1,411 +0,0 @@ -# ConfigKit, PromptKit, And CommandKit Upgrades - -## Status And Recommendation - -Implemented and verified; see the [implementation plan](implementation.md) for -the execution record. 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 roadmap records the selected direction and rationale; current behavior -belongs to the linked application and upstream contracts. - -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. -Documentation adopts upstream ownership too: acknowledge the libraries and link -their canonical documentation; retain local reference material for Scriptorium's -own interfaces and integration choices. - -## 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: - -- ConfigKit [v1.3.0][ck130] and [v1.4.0][ck140]. -- PromptKit [v0.24.0][pk240] and [v0.25.0][pk250]. -- CommandKit [v0.8.0][cmd080], ckconfig [v0.10.0][cc100] and - [v0.11.0][cc110], and ckprompt [v0.11.0][cp110] and [v0.12.0][cp120]. - -## 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](../adr/0004-definition-boundary.md), -[ConfigKit boundary](../adr/0005-configkit-boundary.md), and -[native operator-interface decision](../adr/0006-adopt-commandkit-native-operator-interfaces.md) -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. - -## Target State - -The [implementation plan](implementation.md) owns staged tasks, concrete file -changes, and verification steps. The following describes the selected end state -and application choices, not an implementation sequence. - -### Shared Configuration And Engine Handoff - -Scriptorium embeds public `promptkit.Settings` at `Document.PromptKit`, with -`promptkit.Configure` supplying native rules alongside application defaults, -normalization, validation, and sensitivity declarations. The application retains -its retry setting and server settings; it no longer has a separate framework -acquisition/settings model. - -Each acquisition prepares its selected host file/search source with ConfigKit's -configured secrets helper and performs one typed layered load. The main uses -the captured source, native imports/overlay/override selections, and the bundled -OpenRouter underlay. PromptKit receives the whole successful result through -`NewFromConfig`, without reloading, projecting/redecoding, or redefining -effective configuration. - -The acquired result is authoritative. Genuine application choices remain local: -discovery preset selection/order, server settings and validation, request -mapping, process behavior, and HTTP artifact policy. Source-relative message -and schema resources keep native contexts. A server constructs one shared -engine before accepting requests; namespace views share its operational state. - -The cutover removes `promptkit.configuration`, `promptkit.schema_dir`, the -schema-directory default, and the former two-load conversions, selectors, -evidence state/decorators, sentinels, and obsolete-only tests. Narrow validation -diagnoses the two retired fields instead of silently using them or building a -general legacy/migration subsystem. There is no legacy loader or format alias. - -Valid native settings and root/collection definition extension points remain -usable. Existing raw-key restrictions are enforced through public application -validation and safe native diagnostic rendering, including backend/profile -`api_key` extension fields. Native sensitivity remains intact; ordinary -`extra_params` data is not redacted as a whole. No new resource-version policy -or general extension-field ban is selected. - -### Native Configured Secrets Startup - -Configured secrets bootstrap is part of the common acquisition path used by -execution, server startup, configuration inspection/comparison, and PromptKit -commands. ConfigKit owns its main-file controls, directory processing, -filesystem rules, overwrite behavior, reports, and failure semantics under the -[upstream startup contract][secrets-contract] and [public helper][secrets-api]. -No additional application bootstrap opt-in, secret-file parser, or raw-key -configuration field is selected. - -Native bootstrap reports are available on success and failure and forwarded -safely to CommandKit diagnostics, separately from the configuration result and -main output. Thin presentation integration remains justified; it does not -recreate configuration evidence reconciliation or invent sources for -environment writes. Failed acquisition remains a failure. - -The process environment retains native effects, including partial writes and -effects across sequential comparison sides. Source/option independence does -not imply environment isolation, rollback, or secret-file-content comparison. -Bootstrap precedes server concurrency and is not performed per HTTP request. -Help, version, static completion, and scope discovery remain acquisition-free. -PromptKit's own credential lookup lifecycle is unchanged. - -### Native Configuration Views And Overrides - -The native `app` scope reports the complete application result through -`FromConfigKit`; `promptkit` focuses the same kind of result at `/promptkit` -through `FromConfigKitSubtree`. Neither config scope needs an engine. -Both enable native override capabilities, including independent comparison -overrides. Paths and conflict semantics remain native, not scope-rebased. - -Application inspection now includes PromptKit settings and whole-document -validation. Focused inspection retains native whole-load evidence and explicit -queries outside the focus; it is not an isolation boundary. Each reached -comparison side uses its own selections. Multiple native acquisitions within -an invocation do not create an application cache or a cross-acquisition snapshot -guarantee. - -Native prompt/resource/requirements/preparation/smoke commands remain installed. -Their engine acquisitions use the same common load and result handoff, with -original typed errors and native diagnostic evidence rather than masked errors -and reconstructed explanation trees. - -### Definitions, Resources, And Native CLI Reporting - -Complete definitions use PromptKit's `/promptkit` format; wrapperless fragments -and collection resources use native mounts and imports. Existing IDs/references -keep their upstream meaning. All valid native schema forms and collection roots -work through Scriptorium, without an implicit cwd schema root or local fallback. - -Maintained examples retain the application quickstart and representative -collection discovery: an application file, both glob-discovered entry spellings, -self-declared namespaces, relative imports, and source-relative message/schema -resources. They demonstrate the application integration rather than duplicate -standalone library tutorials. - -Repair defaults, optional budget presence, provider conventions, explicit -zero-cost declarations, prepared message hashes, and native inspection/report -fields follow the selected PromptKit release. Existing explicit zero budgets -remain explicit; no application override silently restores an older default. -Native `--show-tokens` is supplied by ckprompt's ordinary declaration -installation, with invocation context propagated to PromptKit. Scriptorium has -no separate accounting group, usage serializer, pricing estimator, or duplicate -usage flag. Native behavior is documented upstream. - -Application delivery choices remain: artifact-only text stdout, native -structured results, independently formatted optional report files, and the -whole-run timeout passed to PromptKit. Library rendering/execution/finalization -remains native. Existing application domain and operational outcomes stay -distinct; the selected-format accessor is not a prerequisite. - -### HTTP Boundary And Other Local Responsibilities - -The current HTTP wire contract, including its opt-in terminal report, remains -unchanged. Native reasoning/cost/cache facts are available through CLI reports; -additional HTTP reporting is [deferred](#deferred-work). Internal HTTP/report -simplification is allowed without committing to the present collector or -projection implementation permanently. - -HTTP DTOs, transport limits, status mapping, restricted artifact reading, -request-scoped report projection, and shared engine/capacity behavior implement -Scriptorium's service boundary; CommandKit is not an HTTP transport. Application -discovery selection, domain callbacks, process lifecycle, file effects, and -safe bootstrap-report forwarding are integration responsibilities, not parallel -implementations of native library workflows. Shared configuration/bootstrap has -no identified application-specific requirement that warrants a legacy path. - -### Documentation Ownership And Migration - -The [adopted documentation policy](../policy/documentation.md#upstream-dependencies) -already contains upstream v1.13's ownership rule. Maintained documentation -identifies the adopted libraries and links canonical documentation applicable to -the imported versions: [ConfigKit][configkit-contract], [PromptKit formats][promptkit-formats], -[consumer][promptkit-consumer] and [migration][promptkit-migration] guidance, -and [CommandKit CLI][commandkit-cli] and [integration][commandkit-consumer] -guidance. It does not maintain another library manual. - -Local references cover Scriptorium's installed interfaces, selected configuration -and source integration, application settings/bindings, file/process effects, -HTTP wire contract, deployment choices, and migration from its former interfaces. -Upstream rules, feature tables, and tutorials are linked rather than reproduced. - -| Documentation group | Target ownership | -| --- | --- | -| `README.md`, `docs/development.md` | Application orientation, minimal quickstart, selective reading, and native upstream navigation. | -| `docs/cli.md`, `docs/config.md` | Application entrypoints/bindings/settings/effects and selected integration, with native contracts delegated upstream. | -| `docs/operations.md`, `docs/api.md` | Local deployment/process/retention and unchanged complete HTTP contract, without a duplicate framework manual. | -| `docs/consumers/`, `docs/integrations/subprocess.md` | Executable selection, stream/file responsibilities, application-specific migration, and the historical package-split boundary. | -| `docs/internal/`, `docs/policy/architecture.md` | Landed local structure/constraints and public upstream handoff, without obsolete two-load mechanics or copied library algorithms. | - -Application migration is a hard cutover with upstream format/default migration -guidance linked at its owner. Superseded local intermediary tutorials do not -remain a competing current reference. Accepted ADR decisions and published -release records remain historical. Documentation policy v1.13 is already adopted; -no additional local policy rewrite or general policy-suite refresh is needed. - -### Attribution And Completion Evidence - -The selected dependencies' exact versions and source/notice links are maintained -in the existing attribution document under the adopted OSS policy, using the -reviewed unchanged grants/texts. Actual runtime dependencies are distinguished -from graph-only maintainer tools. - -Completion evidence covers shared-load/bootstrap handoff and failures, native -views/overrides/provenance/redaction, resource contexts and definition support, -native CLI usage and retained delivery/outcomes, and the existing HTTP -wire/reader/concurrency boundaries. Tests remain proportionate, offline, and -credential-free, without duplicating upstream grammar/accounting matrices. - -Current documentation describes the delivered integration and delegates native -semantics upstream. The embedded-configuration future direction is considered -delivered only when implementation lands; other deferred work remains tracked. -No new release gates, live provider checks, publication workflow, or stronger -application guarantees are introduced. A later breaking pre-v1 release requires -a minor version under existing policy, selected during release preparation. - -## 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. - -[ck130]: https://forge.maximumdirect.net/base-layer/configkit/src/commit/652ddb649c60208dbba964f0ef919e36725c12c0/docs/releases/v1.3.0.md -[ck140]: https://forge.maximumdirect.net/base-layer/configkit/src/commit/4a7ae664a6287d71cba20f59c7c5b37b6f05b0a3/docs/releases/v1.4.0.md -[pk240]: https://forge.maximumdirect.net/base-layer/promptkit/src/commit/5ea60e9b96651fd7dfcbc7d05b6f43d131df358f/docs/releases/v0.24.0.md -[pk250]: https://forge.maximumdirect.net/base-layer/promptkit/src/commit/207677e9948dc5699073a4d6620d21139033c72d/docs/releases/v0.25.0.md -[cmd080]: https://forge.maximumdirect.net/base-layer/commandkit/src/commit/0b53a63648c536afe50c46f948159116f776adae/docs/releases/v0.8.0.md -[cc100]: https://forge.maximumdirect.net/base-layer/commandkit/src/commit/eedbd83e7ea7be6a626755a63595f512ccd6fd15/integrations/ckconfig/docs/releases/v0.10.0.md -[cc110]: https://forge.maximumdirect.net/base-layer/commandkit/src/commit/cd5cf483a46caeff7ca0a91fb4747d57188a3888/integrations/ckconfig/docs/releases/v0.11.0.md -[cp110]: https://forge.maximumdirect.net/base-layer/commandkit/src/commit/54e951e38a404b4338c7967ac39c6c01159bf76d/integrations/ckprompt/docs/releases/v0.11.0.md -[cp120]: https://forge.maximumdirect.net/base-layer/commandkit/src/commit/2422ccf02d6b55756b07f21e66a581202a09fc3f/integrations/ckprompt/docs/releases/v0.12.0.md -[secrets-contract]: https://forge.maximumdirect.net/base-layer/configkit/src/commit/4a7ae664a6287d71cba20f59c7c5b37b6f05b0a3/docs/config.md#explicit-secrets-directory-bootstrap -[secrets-api]: https://forge.maximumdirect.net/base-layer/configkit/src/commit/4a7ae664a6287d71cba20f59c7c5b37b6f05b0a3/secrets.go -[configkit-contract]: https://forge.maximumdirect.net/base-layer/configkit/src/commit/4a7ae664a6287d71cba20f59c7c5b37b6f05b0a3/docs/config.md -[promptkit-formats]: https://forge.maximumdirect.net/base-layer/promptkit/src/commit/207677e9948dc5699073a4d6620d21139033c72d/docs/formats.md -[promptkit-consumer]: https://forge.maximumdirect.net/base-layer/promptkit/src/commit/207677e9948dc5699073a4d6620d21139033c72d/docs/consumers/pkg-promptkit.md -[promptkit-migration]: https://forge.maximumdirect.net/base-layer/promptkit/src/commit/207677e9948dc5699073a4d6620d21139033c72d/docs/consumers/configuration-migration.md -[commandkit-cli]: https://forge.maximumdirect.net/base-layer/commandkit/src/commit/0b53a63648c536afe50c46f948159116f776adae/docs/cli.md -[commandkit-consumer]: https://forge.maximumdirect.net/base-layer/commandkit/src/commit/2422ccf02d6b55756b07f21e66a581202a09fc3f/docs/consumers/guide.md diff --git a/docs/roadmap/remediation.md b/docs/roadmap/remediation.md deleted file mode 100644 index 279ef67..0000000 --- a/docs/roadmap/remediation.md +++ /dev/null @@ -1,48 +0,0 @@ -# Native Library Upgrade Review Remediation - -Reviewed implementation Stages 1–12 at commit -`23af6579c31db32addb940005292de179ecee1d0` against the -[implementation plan](implementation.md) and [feature roadmap](library-upgrades.md). - -## Isolate Secrets Bootstrap In The Maintained-Example Test - -**Status: Complete.** The sweep now registers `t.Setenv` cleanup before -unsetting the synthetic variable, exercising provisioning from absence while -restoring the original presence and value after the test. Production bootstrap -and comparison behavior are unchanged. - -Verification passed: a temporary test overlay failed before the fix and now -passes for initially absent and pre-existing values, including three repeated -race runs. Maintained-example/bootstrap tests passed five shuffled race runs; -the full normal and race suites, vet, build, formatting, and whitespace checks -also passed. - -**Location:** `internal/adapter/cli/examples_test.go:20–30`, reached through -`examples/config.secrets.yml` and its synthetic secrets directory. - -The maintained-example sweep automatically selects every `config*.yml` file, -including the newly added secrets example. Both scope validations invoke native -bootstrap in the test process. When `SCRIPTORIUM_EXAMPLE_TOKEN` is initially -absent, the first acquisition sets it and the second sees that existing value. -The sweep does not register environment cleanup, so the variable remains set -after the test finishes. Its behavior therefore depends on inherited process -state and leaves bootstrap state for later tests. - -This was reproduced without modifying repository code: a temporary Go test -overlay ran the existing sweep as a subtest with the variable initially absent, -then confirmed it remained present after the subtest and its cleanup returned. -The separate `TestMaintainedSecretsExample` controls its own environment, but -that cleanup does not cover the sweep. - -Stages 2 and 5 and the [testing policy](../policy/testing.md#test-execution-requirements) -require controlled, restored test environment state. Control the synthetic -variable in the sweep with `t.Setenv` so cleanup restores its original presence -and value. If testing actual provisioning from absence, register that cleanup -before unsetting the variable and invoking the example. Keep this change local -to the test harness: production acquisitions and comparison sides retain native -process-environment effects without rollback. - -**Verification:** run the maintained-example and bootstrap tests repeatedly and -with shuffled ordering. Confirm the sweep restores an initially absent variable -and a pre-existing value when its cleanup finishes. Reuse native bootstrap -coverage rather than adding another secret-file parser or parsing matrix.