diff --git a/docs/roadmap/implementation.md b/docs/roadmap/implementation.md new file mode 100644 index 0000000..16c1877 --- /dev/null +++ b/docs/roadmap/implementation.md @@ -0,0 +1,549 @@ +# 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 + +**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 + +**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 + +**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 + +**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 + +**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 + +**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 + +**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 + +**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 + +**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 + +**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 + +**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 + +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 index 53fd093..42f2beb 100644 --- a/docs/roadmap/library-upgrades.md +++ b/docs/roadmap/library-upgrades.md @@ -202,300 +202,181 @@ 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. -## Recommended Target State And Required Changes +## Target State -### One Application-Owned Configuration Load +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. -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. +### Shared Configuration And Engine Handoff -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. +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. -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. +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. -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. +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. -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. Use direct validation checks for those two fields; do not build -a general legacy-format detector or migration subsystem. -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. +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 -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. +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. -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. +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. -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. +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. -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. Link the native startup -contract for these 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. +### Native Configuration Views And Overrides -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][secrets-contract] and [public helper][secrets-api] -own these semantics. +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. -### Native Views Of The Same Result +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. -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. Enable native override capabilities in both scopes, -passing `--set` and comparison overrides through the common loader with native -path and conflict semantics. Retire the former `promptkit` scope's override -restriction; do not reintroduce application-specific inspection selector flags. +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. -Completion requires removing evidence transport/decorators, acquisition state, -settings conversions, source-selection helpers, and tests that exist solely to -support 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. +### Definitions, Resources, And Native CLI Reporting -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. +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. -### Definition, Example, And Repair Migration +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. -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. +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. -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. +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. -Adopt upstream repair defaults rather than silently injecting zero, retaining -explicit zero budgets in existing maintained definitions. Direct consumers to -the upstream migration/output contract for defaults, request replacements, and -their latency/cost implications rather than maintaining a local explanation. -Existing CLI domain outcome versus operational failure and HTTP -completed-validation semantics remain distinct application contracts. +### HTTP Boundary And Other Local Responsibilities -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. +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. -### Native CLI Usage And HTTP Scope +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. -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. Link the -upstream compatibility guidance for the changed smoke representation and format -selection rather than reproducing it in Scriptorium's CLI reference. +### Documentation Ownership And Migration -Preserve the existing HTTP wire contract, including its opt-in terminal report, -while allowing internal simplification. This upgrade does not commit Scriptorium -to retaining the custom report projection permanently; reconsider its maintenance -cost at the future HTTP design review before adding reporting fields. -New reasoning, cost, and cache-ratio evidence remains available through -native CLI reports, but adding it to HTTP is [deferred](#deferred-work). -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. +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. -### Justified Application-Owned Boundaries +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. -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: Upstream Contracts And Local Integration - -The [adopted documentation policy](../policy/documentation.md#upstream-dependencies), -based on upstream v1.13, now captures canonical upstream ownership. The remaining -documentation cleanup applies that rule to adopted PromptKit, ConfigKit, and -CommandKit features. Scriptorium documents that it imports and adopts each library -and links the relevant upstream owner. Remove local -explanations, reference tables, tutorials, and format/default catalogs that -merely restate those libraries. Upstream behavior discussed in this roadmap -identifies adoption work; it is not a parallel consumer reference to maintain. - -Use the [ConfigKit configuration contract][configkit-contract], -[PromptKit formats][promptkit-formats], [PromptKit consumer guide][promptkit-consumer] -and [migration guide][promptkit-migration], and [CommandKit CLI][commandkit-cli] -and [integration guide][commandkit-consumer] as the canonical destinations. -Link to relevant sections at the adopted release's source revision and update -affected links with dependency upgrades. No local mirror or new documentation -registry is needed. - -Local documentation retains application facts: which capabilities are installed, -selected sources/presets/underlays and scope names, Scriptorium-owned settings -and flags, input/result mappings, file effects, process/server lifecycle, HTTP -wire contracts and deployment policy, and migration from Scriptorium-specific -interfaces. Describe what Scriptorium selects or adds; link upstream for how -the library processes it. For example, note that Scriptorium invokes configured -secrets bootstrap on its common acquisition path and link its upstream contract, -rather than writing another explanation of directory rules, overwrite policy, -reports, or partial writes. - -The documentation pass must cover these current duplication points: - -| Affected files | Required change | +| Documentation group | Target ownership | | --- | --- | -| `README.md`, `docs/development.md` | Identify the three adopted libraries and provide canonical upstream navigation. Keep the application quickstart and task-oriented reading guide; direct native-feature questions upstream. | -| `docs/cli.md` | Replace repeated native command-family, reusable-flag, parsing, formatting, inspection, requirements, smoke-test, and finalization explanations with upstream links. Retain Scriptorium's installed entrypoints, application bindings/aliases, application-owned flags, artifact/file-delivery choices, and application-specific outcome mappings. | -| `docs/config.md` | Retain application schema/settings, selected discovery presets and order, selected underlays/import enablement, embedded PromptKit location, and handoff integration. Replace native preset expansions, filename catalogs, YAML grammar, composition/precedence, inheritance, overlay/override rules, redaction, and bootstrap explanations with their upstream owners. | -| `docs/operations.md` | Keep Scriptorium deployment, server startup/restart, file/stream retention, HTTP limits, and recovery responsibilities. Replace native inspection/preparation/smoke tutorials and credential/retry/repair/bootstrap mechanics with upstream links. | -| `docs/consumers/upgrading-cli.md`, `docs/consumers/upgrading-promptkit.md`, `docs/consumers/migrating-to-promptkit.md` | Keep the necessary Scriptorium interface/configuration migration and historical package-split boundary. Link upstream for library API, definition-format, schema, and default migrations instead of maintaining duplicate walkthroughs and feature lists. Remove or condense superseded intermediary guidance and repair incoming links. | -| `docs/consumers/api.md`, `docs/integrations/subprocess.md`, `docs/api.md` | Preserve application interface selection, process/stream/file responsibilities, and the complete Scriptorium-owned HTTP wire contract. Refer native report schemas and framework semantics upstream instead of reproducing them. HTTP documentation cleanup does not add reporting fields. | -| `docs/internal/overview.md`, `docs/internal/adapters.md`, `docs/internal/sources.md` | Describe local components, wiring, handoff, and adapter effects. Remove repeated library lifecycle/algorithm explanations and link to the native contracts. | -| `docs/policy/documentation.md`, `docs/development.md` | The policy clarification is complete through adoption of upstream documentation policy v1.13. Apply its Upstream Dependencies rule during cleanup and align the contributor reading guide; no additional local policy rewrite or policy-suite refresh is required. | -| `docs/policy/architecture.md` | Update the implemented integration boundary and upstream links when the upgrade lands. Keep application constraints and ownership decisions, with upstream semantics referenced rather than redefined. Accepted ADR decision content remains unchanged. | +| `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. | -Retain the minimal Scriptorium quickstart and maintained examples that exercise -its actual integration. Keep a representative collection-discovery example with -an application file, glob-discovered `collection.yml` / `collection.yaml` -entrypoints, collection-declared namespaces, relative imports, and source-relative -message/schema resources. Point to upstream examples for standalone library -tutorials instead of creating equivalent local examples for every adopted -feature. Adapt maintained application examples to the new configuration and -bootstrap path without building a separate upstream feature showcase. +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. -Migration guidance identifies the Scriptorium-specific cutover and points to -upstream migration/release guidance for native format and behavior changes, -including repair defaults and smoke output. It does not create a compatibility -layer or a second library manual. Published release records remain historical; -this consolidation applies to maintained current documentation and new notes. -Licensing and attribution materials retain their separate adopted requirements. +### Attribution And Completion Evidence -Repair links and anchors affected by consolidation or retirement, and check -that the linked released upstream sections cover the delegated topics. Review -the final documentation for duplicated native explanations, not just stale -version numbers. This adds ordinary documentation work to the upgrade, not a -new publication-time checker or gate. Mark the embedded-configuration direction -in [future work](future.md) as delivered only when implemented; other deferred -directions remain separate. +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. -### Licensing And Verification +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. -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. +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