diff --git a/docs/roadmap/automatic-usage-reporting.md b/docs/roadmap/automatic-usage-reporting.md index 7cd29d0..d07061b 100644 --- a/docs/roadmap/automatic-usage-reporting.md +++ b/docs/roadmap/automatic-usage-reporting.md @@ -1,368 +1,293 @@ # Automatic PromptKit Usage Reporting -Status: adoption goal agreed; upstream v0.25.0 reviewed and available; -OD-1 through OD-6 selected; implementation not started. +Status: target state agreed; PromptKit v0.25.0 reviewed and available; +implementation not started. -## Goal +## Purpose -Normal ckprompt installation should make an optional usage-reporting flag -available to application-owned commands as well as the PromptKit command family. -When an operator selects the flag, CommandKit should collect and present usage -for PromptKit executions in that invocation automatically. +Normal ckprompt installation will make optional invocation-wide token and cost +reporting available to application-owned commands and the PromptKit command +family. Operators will be able to request a summary of a review or pipeline run +without applications implementing their own accounting infrastructure. -Applications must not need to declare the flag on each command, attach observers -to individual requests, create accounting groups, wrap execution methods, take -snapshots, or add final reporting callbacks. Importing ckprompt alone continues -to install nothing; the integration participates through ordinary application -assembly. Merely exposing a report adapter would not meet this goal. +Applications will continue to pass `Invocation.Context` through their work and +wait for work they own before returning. They will not need per-command usage +flags, request observers, accounting groups, execution wrappers, snapshots, or +final reporting callbacks. Audita review commands and Notarius pipelines +motivate the feature; their domain execution remains application-owned. -Audita review commands and Notarius pipelines motivate the feature. Their domain -execution remains application-owned. Applications continue to pass -`Invocation.Context` through their work and wait for work they own before -returning. PromptKit calls using unrelated contexts are outside the observation -scope. No engine-construction adapter or particular engine instance is required. +This roadmap describes the agreed end state and the work needed to reach it. +It does not describe implemented behavior. A subsequent implementation plan will +define the concrete Go API and organize the work into discrete ordered stages. -This roadmap records the adoption strategy and open decisions. It is not an -implementation plan or a current CLI/API contract. +## Target Behavior -## Upstream Dependency +### Installation and flag selection -Target `go.maximumdirect.net/promptkit v0.25.0`, released at commit -`207677e9948dc5699073a4d6620d21139033c72d`. Its annotated tag was verified against -the upstream remote. The [release notes][promptkit-release] and tagged public API -replace the earlier upstream proposal as the adoption baseline. The upstream -availability dependency is resolved; CommandKit's module selection remains -v0.24.0 until implementation. +Both `ckprompt.Command` and `ckprompt.Declarations` will automatically install +usage support for ordinary nonempty suites. The capability will apply to +application-owned commands regardless of whether they are registered before or +after the integration. Consumers will use normal application assembly without +a special usage-enabled factory or a wrapper around `App.Execute`. Preserve +existing factory signatures where practical and assess source compatibility +before any signature change. -### Released observation and accounting API +Importing ckprompt alone will install nothing. An empty suite will continue to +install no command, namespace claim, or usage capability. Usage support will not +depend on an engine-loader wrapper or a particular inspection callback. -The [observation API][promptkit-observations] provides: +The invocation-wide flag will be `--show-tokens`, a Boolean defaulting to false, +with no shorthand. Explicit `--show-tokens=false` will be supported; the last +supplied value will win when repeated. It will use the existing typed parsing, +help, and completion conventions. Its help text will be: -```go -func WithExecutionObserver(ctx context.Context, observer ExecutionObserver) context.Context -``` +> Show token usage and available cost information after execution. -ckprompt can associate an existing `ExecutionGroup` with the invocation context. -Ordinary runs, nested and concurrent calls, multiple engines, prepared executions, -and coordinated continuations participate through upstream execution boundaries. -Explicit request observers run before contextual observers, which compose in -registration order; a nil contextual observer leaves the context unchanged. -Prepared handles retain explicit request observers but select contextual -observers when executed. No per-engine installation is needed. +Installation will make reporting available; a summary will be produced only +when requested. -The released [group API][promptkit-groups] supplies `Observe(ExecutionEvent)` and -`Snapshot() ExecutionGroupSummary`. The detached snapshot exposes `Members`, -`TerminalCoverageComplete`, `Attempts`, `TransientRetries`, `RepairCalls`, `Usage`, -and `CostUSD`. It counts each run's first terminal event once. Coverage of members -and completeness of their reported usage/cost are separate facts. Use this -snapshot as the summary source, including after a returned failure; do not add -per-attempt, per-result, or terminal totals together locally. +### Invocation scope -`ObservedTokenUsage` includes `ReasoningTokens` in addition to the existing token -categories. Reasoning is a subset of completion tokens, and cache reads/writes -do not add to token totals. Its `CacheHitRatio() (float64, bool)` derives the -ratio from complete, consistent input/cache-read counts; use that native helper -if the selected presentation includes a ratio. +For an enabled invocation, ckprompt will create one native PromptKit +`ExecutionGroup` and attach its observer through `WithExecutionObserver` to the +invocation context. This will happen after successful input/preflight validation +and before execution-time initialization, acquisition callbacks, and the handler. +PromptKit work during acquisition will therefore participate alongside handler +work. -[Cost metadata][promptkit-cost] uses `ObservedCost` with `Value float64`, `Known`, -`Complete`, and `Source`. It appears as `CostUSD` on execution events, group -summaries, and successful `RunResult` values; injected clients may supply -`GenerateResponse.CostUSD` as `*float64`. Cost sources distinguish provider or -injected-client reports, configured-zero fallback, mixed contributions, and no -sourced contribution. Retain those distinctions rather than labeling every known -amount as a provider charge. Result cost is available without observation; -invocation accounting should still use the group because errors return no partial -result and `RunResult.Usage` has different successful-generation accounting. +Calls using that context will participate through PromptKit's public observation +boundaries, including nested and concurrent calls, multiple engines, prepared +executions, and coordinated continuations. No particular engine instance or +construction adapter will be required. Calls using unrelated contexts will +remain outside the scope. Existing explicit request observers will continue to +compose according to the upstream contract. -PromptKit owns event generation, observation scope, aggregation, duplicate -accounting, token presence/completeness, and cost interpretation. Reuse its public -contracts without adding local accounting, provider decoding, or pricing logic. -Sibling checkouts are review evidence, not build dependencies. - -### Released configuration and compatibility changes - -The final release expands the original proposal. Its -[backend settings][promptkit-backends] select provider conventions explicitly: -`provider` supports `openai-compatible`, `openrouter`, and `vllm`. Omitted, null, -or blank selects generic OpenAI-compatible behavior. Backend names and endpoint -hostnames do not select provider conventions. The bundled OpenRouter definition -already selects `openrouter`; application-defined OpenRouter backends must select -it explicitly for provider-specific usage, cost, and authentication defaults. - -Optional `zero_cost: true` supplies an upstream zero fallback when no usable -charge is reported. A usable reported amount, including zero, takes precedence. -Do not add a ckprompt default that declares local or otherwise unreported work -free. Present configured-zero evidence with its native source attribution. - -Provider selection also controls native reasoning/cache-field mappings and -authentication defaults. OpenRouter defaults to `openrouter_key`, vLLM to the new -`vllm_models` adapter, and generic backends have no authentication default. -Omitted/null authentication configuration uses the provider default; `kind: none` -declares authentication inapplicable. These diagnostics still run only when -explicitly requested. Forward selections and native findings without implementing -provider policy in CommandKit. - -The Go consumer minimum remains 1.27.0 and upstream dependencies, including -ConfigKit v1.4.0, are unchanged from v0.24.0. Public structs gained fields and native -JSON adds cost and reasoning usage. Review positional literals and strict result -decoders, and document applicable report/configuration changes during adoption. - -## Current CommandKit Baseline - -- Core v0.7.0 owns dispatch, typed input, reporting, and outcomes. Its - [execution path](../../execute.go) finalizes reporting internally and exposes - no public invocation extension for this use case. -- [Invocation](../../identity.go) already carries the execution context. -- ckprompt v0.11.0 installs inspection and smoke-test commands through - [Command and Declarations](../../integrations/ckprompt/command.go). The family - does not currently add observation to application-owned commands. -- [Suite](../../integrations/ckprompt/adapters.go) capabilities can be narrowed; - an empty suite currently yields an absent command. Existing construction, - registration, namespace, and absence contracts must be considered deliberately. -- Core [reporting](../cli.md#reporting) separates command results from diagnostics - and preserves application outcomes when presentation fails. - -The existing ckprompt independent suite passed against released PromptKit v0.25.0 -using temporary module files and the other published dependencies. Tracked module -files were unchanged. This is a baseline compatibility check, not verification -of the planned usage integration, which does not yet exist. - -## Adoption Strategy - -### Core invocation integration - -Add a narrow, library-neutral capability sufficient for ckprompt to register an -invocation-wide flag, decorate the context before execution work begins, retain -private invocation state, and submit final presentation before reporting closes. -Choose its public shape under OD-2 below. Core must not import PromptKit or ckprompt, -including through its tests, examples, tools, or module requirements. - -Capture this behavior through supported installation contracts. Validate it with -the installation batch so a failed registration does not partially install flags -or lifecycle behavior. Apply it to applicable application commands regardless of -their registration order. Preserve help, completion, aliases, typed bindings, -and ordinary installation collision handling through the existing CLI machinery. -Do not parse raw arguments again inside ckprompt or require consumer wrappers -around `App.Execute`. - -Keep the mechanism proportionate to this need rather than introducing a general -application runtime, dependency-injection system, or plugin framework. - -### ckprompt observation and final reporting - -Normal installation registers the usage capability automatically. When the flag -is enabled, ckprompt creates one native `ExecutionGroup` for that invocation and -decorates its context with the upstream helper. Create the scope early enough -for application initialization and acquisition callbacks reached during command -execution to receive it, as well as the main handler. Do not invoke engine -loaders or providers merely to install the capability or display help. - -On ordinary command completion, including returned failure or cancellation, -snapshot the group and submit the selected summary through core reporting before -the reporter closes. The collection does not require a successful `RunResult`. -Keep each invocation's group separate; do not retain a process-wide history or -cache a group on a reused engine or suite. - -Delegate composition, concurrency within the pipeline, and accounting to -PromptKit. Do not accumulate attempt and terminal usage locally or discover and -intercept arbitrary engine calls. This work does not establish concurrent -`App.Execute` support or change panic recovery and process-lifetime contracts. - -### Report content and delivery - -Expose the upstream token categories and available USD cost, keeping unknown -values, reported or configured zero, cost sources, incomplete subtotals, and -terminal coverage distinct. Select presentation under OD-3 through OD-6. Describe -these facts neutrally using the adopted upstream meaning; no local pricing inference or -billing guarantee is needed. Do not round cost during adaptation; any text -display precision is a presentation choice. - -The summary supplements the application result. Preserve its outcome, explanation, -and supported error identity. Report output failures through the existing -presentation-failure model, including when the command already failed. Do not -append prose to an application's JSON result or write directly to process stderr -outside the application's selected streams and core reporting lifecycle. - -### Existing report adaptation - -Backend inspection already forwards native `BackendInspection`; preserve its new -`Provider` and `ZeroCost` declarations, including explicit false, without -manufacturing runtime defaults in inspection reports. Configuration inspection -continues to expose upstream safe evidence and history. No new provider-selection -CLI flags or loader wrappers are needed for this adoption. - -The explicit [smoke usage projection](../../integrations/ckprompt/smoke_report.go) -currently lists five token fields. Extend it to retain native `ReasoningTokens` -in attempt and aggregate reports rather than silently dropping that added field. -Use OD-6 to decide cache-ratio presentation consistently across usage reports. - -Smoke diagnostics retain their separate upstream reporting model and are not -enrolled in ordinary context observation. Do not add their reported usage to an -execution group or imply that an empty ordinary group measures smoke-test usage. -v0.25.0's `SmokeTestReport` has no cost field; do not fabricate one from an -execution summary or attempt to infer it from token counts. Existing authentication -diagnostics should continue to expose native support and applicability findings, -including the new vLLM adapter, through the current smoke command. - -## Decisions - -OD-1 through OD-6 are selected below. Prepare a concrete implementation plan -against these decisions so implementation can proceed through that plan without -intermediate design gates. - -### OD-1: Flag name and selection — selected - -Use `--show-tokens` as a Boolean flag, defaulting to false, with no shorthand. -Support `--show-tokens=false`; the last supplied value wins when repeated. -Use the existing typed parsing and help/completion conventions. Help text: -"Show token usage and available cost information after execution." -Automatic availability does not mean printing a summary when the operator has -not requested it. - -### OD-2: Installation API and capability availability — selected - -Both `ckprompt.Command` and `ckprompt.Declarations` automatically install usage -support for the PromptKit family and application-owned commands. Consumers need -no special factory or execution wrapper. Preserve existing factory signatures -where practical; assess source compatibility before any signature change. - -Core supplies a small, library-neutral composition mechanism for invocation-wide -flags, context decoration, and final reporting. ckprompt owns PromptKit observation -and summary content. The mechanism must not depend on wrapping the engine loader -or on enabling a particular inspection callback. - -Preserve empty-suite absence behavior: an empty suite installs no command, -namespace claim, or usage capability. Defer a separate usage-only installation -API until there is a concrete need. Automatic usage support applies to ordinary -nonempty installations. - -### OD-3: Output destination, visibility, and finalization order — selected - -Present the requested summary on the application's diagnostic destination, -normally stderr, preserving the result stream for application output. Show it in -ordinary, verbose, and debug modes without requiring another flag. Use a small, -generic core reporting capability: an ordinary Info message is insufficient -because it is hidden without verbose mode. ckprompt supplies the summary content -through that capability. - -Active quiet mode suppresses the summary regardless of the position of -`--show-tokens`, consistent with the existing explicit-progress behavior. -Present the summary after normal command output and deferred messages, but -before any terminal failure explanation. - -Still report observed usage after returned errors or cancellation. Route summary -delivery failures through core's existing presentation-failure handling, -preserving the application outcome. Commands that do not reach execution and -empty observation scopes remain subject to OD-5. - -### OD-4: Text and structured summary access — selected - -The initial summary is text on the diagnostic stream selected under OD-3. -`--show-tokens` produces the same concise text summary regardless of `--format`; -that flag continues to govern the command's main result. Usage reporting leaves -application result shapes and stdout unchanged. ckprompt supplies the summary -content and text template; core handles rendering and delivery. - -Defer a machine-readable usage-output interface until a concrete consumer needs -it. Such an interface needs an explicit destination and framing, because the -diagnostic stream may also contain other messages. A separate report file is a -possible future approach, not a selected interface. - -### OD-5: No observations and commands that do not execute models — selected - -When execution begins but no ordinary execution events are observed, present the -standard summary using PromptKit's native empty-group values: zero runs, attempts, -tokens, and cost, preserving the absence of a cost source. Do not substitute a -special no-executions message. Derived values such as cache-hit ratio remain -unavailable when upstream supplies no value. Observed executions with unknown -usage retain their native unknown state rather than being converted to zeros. +On command completion, including returned failure or cancellation, ckprompt will +snapshot the group and submit its summary before reporting closes. Observation +will not require a successful `RunResult`. Groups will remain private to their +invocations rather than being cached on reused engines or suites or retained in +process-wide history. Help, completion, version, routing errors, parsing errors, and input/preflight -validation failures produce no usage summary and perform no acquisition for -reporting. Attach the observer after successful input/preflight validation and -before execution-time initialization, acquisition callbacks, and the handler, -so PromptKit work during acquisition participates. +validation failures will produce no usage summary and perform no acquisition for +reporting. Installation and help will not invoke engine loaders or providers. +Application startup, context propagation, and waiting for application-owned work +remain application responsibilities. This feature does not change panic recovery, +process-lifetime behavior, or concurrent `App.Execute` support. -After returned errors or cancellation, report the native group's observed data; -an empty group uses the same standard zero summary. Active quiet mode suppresses -the summary as selected under OD-3. +### Summary delivery -### OD-6: Initial summary detail — selected +The requested summary will be concise text on the application's diagnostic +destination, normally stderr. It will be visible in ordinary, verbose, and debug +modes without another flag. Active quiet mode will suppress it regardless of the +position of `--show-tokens`, consistent with explicit progress reporting. -Present aggregate prompt, completion, reasoning, total, cached, and cache-write -token counts. Present reasoning and cache figures as details, not additions to -total tokens. Clearly identify unknown values, incomplete subtotals, and -incomplete terminal coverage; preserve known zeros. +The summary will follow normal command output and deferred messages and precede +any terminal failure explanation. It will supplement the application result, +preserving its outcome, explanation, and supported error identity. Summary +rendering and delivery failures will use the existing core +[presentation-failure model](../cli.md#output-failures), including when the +command has already failed. -For execution counts, present the total number of prompts, using the native -group's observed run count. Show repair calls as a detail beneath that total only -when nonzero. Do not separately display attempt or transient-retry counts, or -count those attempts as additional prompts. +Usage text will be independent of `--format`, which will continue to govern the +command's main result. Application result shapes and stdout will remain +unchanged. ckprompt will supply summary content and its text template; core will +handle rendering, visibility, delivery, and finalization through the application's +selected streams. -Include available USD cost automatically with its native source, including -configured-zero evidence, without a separate accounting opt-in. Display cost -with six significant digits; preserve the unrounded upstream value during -adaptation. +### Summary content -Use native `Usage.CacheHitRatio()` when available, displaying it as a percentage -with one decimal place in both invocation summaries and smoke reports. Use the -native aggregate helper rather than averaging per-run ratios or independently -deriving the value. +The summary will present native invocation totals with the following detail: -Defer per-model breakdowns, event traces, and persistent history. The native -group summary supplies the initial invocation totals; PromptKit retains -ownership of accounting and interpretation. +| Content | Presentation | +| --- | --- | +| Prompts | Total number of prompts, using the native group's observed run count. | +| Repair calls | A detail beneath the prompt total, shown only when nonzero. | +| Tokens | Aggregate prompt, completion, and total tokens, with reasoning, cached, and cache-write tokens as details. | +| Cache-hit ratio | The native `Usage.CacheHitRatio()` result when available, displayed as a percentage with one decimal place. | +| Cost | Available USD cost with its native source, displayed with six significant digits. | +| Availability and completeness | Clear indications of unknown values, incomplete subtotals, and incomplete terminal coverage. | -## Delivery Sequence +Attempts and transient retries will not be separate display counts or additional +prompts. Reasoning and cache figures will not be added to total tokens. Cache-hit +ratio will use the native aggregate helper rather than an average of per-run +ratios or an independently derived value. -1. Prepare the implementation plan from the selected OD-1 through OD-6 decisions - and reviewed PromptKit v0.25.0 API. Upstream implementation and release are - complete; no upstream feature work remains a prerequisite. -2. Implement and verify the neutral core installation, flag, context, and - finalization support. Preserve existing reporting and assembly contracts. -3. Adopt PromptKit v0.25.0 in ckprompt and attach observation and summary - presentation through normal installation. Cover both current assembly paths - and application commands registered separately from the standard family. - Carry new native fields through existing reports and review maintained backend - fixtures for intended provider and authentication conventions. -4. Extend the maintained composed consumer to demonstrate the CommandKit-specific - benefit: an application-owned command receives the flag and final summary - without accounting code in its handler. Use offline injected-client evidence. -5. Update owning GoDoc, the CLI reference, consumer guidance, and internal - inventory as implementation lands. Review dependency alignment and attribution. - Retire this roadmap after completion, preserving any deferred scope separately. +Cost will appear automatically when available, without a separate accounting +opt-in. Preserve provider/injected-client reports, configured-zero evidence, +mixed sources, and the absence of a sourced contribution according to the native +API. Preserve the unrounded upstream value during adaptation; six significant +digits is a text presentation choice. No local pricing inference or billing +guarantee will be added. -This work is expected to require a core release as well as ckprompt. Follow the -[downstream alignment policy](../policy/release.md#commandkit-downstream-dependency-alignment): -release core, align and release ckconfig, then align and release ckprompt against -the published core and ckconfig versions. ckconfig need not acquire usage -functionality. Exact versions and publication remain separate release work. +An invocation with no observed executions will receive the same standard report, +using native empty-group zero totals for prompts, tokens, and cost and preserving +the absence of a cost source. Derived values such as cache-hit ratio will remain +unavailable when upstream supplies no value. Observed executions with unknown +usage will retain their unknown state rather than being converted to zeros. +Known zeros, incomplete subtotals, and terminal coverage will retain their +distinct meanings after failures as well as successes. -## Verification And Completion +## Upstream and Current Baseline -The decisive consumer check is a normally installed ckprompt integration plus -an application-owned pipeline command. Selecting the usage flag must produce its -summary without request observers, accounting state, or a final reporting step -in application code. Verify the alternate assembly path and later registration -so automatic behavior does not depend on a particular declaration layout. +The target dependency is `go.maximumdirect.net/promptkit v0.25.0`, released at +commit `207677e9948dc5699073a4d6620d21139033c72d`. Its annotated tag was verified +against the upstream remote. The [release notes][promptkit-release] and tagged +public API are the adoption baseline; no upstream feature work remains a +prerequisite. Sibling checkouts are review evidence, not build dependencies. -Use focused core tests for installation, flag forwarding, context decoration, -finalization timing, visibility, invocation isolation, and writer failures. Use -integration tests to establish that ckprompt passes the scoped context to the -native API and faithfully presents returned summary values, including reasoning, -cost sources, unknown/reported-zero/configured-zero/incomplete evidence, and -available data after failure. Verify the new reasoning field survives smoke -projection and explicit provider/zero-cost declarations survive backend inspection. -Exercise a representative multi-call consumer with the real upstream engine as -useful; PromptKit retains tests for its accounting, retries, repairs, and provider decoder. -Do not duplicate those upstream domain suites in CommandKit. +The released APIs supply the accounting needed for this feature: -Validate help/completion without acquisition, existing explicit observer -coexistence, preserved application outcomes, and the selected empty-scope and -quiet-mode behavior. Keep checks offline. Run affected core and nested-module -suites using the developer guide, including independent builds against released -dependencies before release. No live inference, performance benchmark, or new -concurrent-dispatch guarantee is needed. +- [Contextual observation][promptkit-observations] supplies + `WithExecutionObserver(context.Context, ExecutionObserver) context.Context`. + Prepared executions select contextual observers when run, while explicit + request observers remain intact. +- [Execution groups][promptkit-groups] supply `Observe(ExecutionEvent)` and + `Snapshot() ExecutionGroupSummary`. The detached summary supplies members, + terminal coverage, execution counts, token usage, and cost. PromptKit owns + aggregation and duplicate accounting; ckprompt will use the snapshot rather + than summing attempt, result, and terminal totals locally. +- `ObservedTokenUsage` includes `ReasoningTokens` and the native cache-hit-ratio + helper. [Cost metadata][promptkit-cost] supplies `ObservedCost` with `Value`, + `Known`, `Complete`, and `Source`. Group accounting remains the invocation + source because failed calls return no partial result and `RunResult.Usage` + uses different successful-generation accounting. + +CommandKit currently selects PromptKit v0.24.0. Core v0.7.0 carries context in +[Invocation](../../identity.go), but its [execution path](../../execute.go) +finalizes reporting internally without a public extension for this capability. +ckprompt v0.11.0 installs inspection and smoke commands through +[Command](../../integrations/ckprompt/command.go) and +[Declarations](../../integrations/ckprompt/declarations.go); neither currently +adds observation to application-owned commands. + +The existing independent ckprompt suite previously passed against released +PromptKit v0.25.0 using temporary module files and other published dependencies. +Tracked module files were unchanged. That establishes a compatibility baseline, +not verification of the unimplemented usage feature. + +## Required Work + +### Core composition and reporting + +Add the narrow, library-neutral public composition capability needed to capture +invocation-wide flags, decorate context at the selected execution boundary, +retain private invocation state, and submit final presentation before reporting +closes. Include the generic reporting support needed for requested summaries to +be visible in ordinary mode; ordinary Info messages are hidden without verbose +mode and cannot provide the selected behavior alone. + +Validate captured flags and lifecycle behavior with the installation batch so a +failed registration leaves no partial installation. Apply the capability to +application commands in either registration order. Preserve aliases, help, +completion, typed bindings, and existing installation collision handling through +the normal CLI machinery. + +Keep the mechanism proportionate to this use case. Core must remain independent +of PromptKit and ckprompt in public signatures, implementation, tests, examples, +tools, and module requirements. The integration will not parse raw arguments +again or introduce a separate rendering pipeline, general application runtime, +dependency-injection system, or plugin framework. + +### ckprompt adoption and report adaptation + +Adopt PromptKit v0.25.0 and connect both ordinary installation paths to the core +capability. Implement invocation-scoped observation and the agreed summary using +the native group, token, ratio, and cost APIs. PromptKit will retain ownership of +event generation, observer composition, accounting, provider decoding, and cost +interpretation; CommandKit will own CLI coordination and faithful presentation. + +The release also changes native [backend settings][promptkit-backends]. Forward +`BackendInspection.Provider` and `ZeroCost` declarations, including explicit +false, without manufacturing defaults in inspection reports. Provider selection +is explicit and controls upstream usage/cost decoding and authentication +conventions. Preserve native support and applicability findings, including the +vLLM authentication adapter. Configuration inspection will continue to expose +upstream safe evidence and history. No new provider-selection CLI flags, loader +wrappers, or local zero-cost defaults are needed. + +Review maintained backend fixtures and adoption guidance against the released +provider and authentication conventions. Application-defined OpenRouter +backends must explicitly select `provider: openrouter` to use those conventions; +backend names and endpoint hostnames do not select them. Native `zero_cost` +fallback and reported-cost precedence remain upstream behavior. The Go consumer +minimum remains 1.27.0, and upstream dependencies, including ConfigKit v1.4.0, are +unchanged from v0.24.0. Review positional struct literals and strict result +decoders for added fields and native JSON cost/reasoning data. + +Extend the existing [smoke usage projection](../../integrations/ckprompt/smoke_report.go) +to preserve native `ReasoningTokens` in attempt and aggregate reports. Include +cache-hit ratio through the same native helper and percentage presentation used +for invocation summaries, retaining native values in adaptation. + +Smoke diagnostics will retain their separate upstream reporting model; ordinary +context observation does not enroll them. Do not add their usage to an execution +group or interpret an empty ordinary group as a measurement of smoke usage. +PromptKit v0.25.0's `SmokeTestReport` has no cost field; the adoption will not +fabricate one from group summaries or token counts. + +### Consumer evidence, documentation, and release alignment + +Extend the maintained [composed consumer](../../integrations/ckprompt/examples/composed) +with an application-owned pipeline command demonstrating automatic flag +availability and final usage reporting without accounting code in its handler. +Use offline injected-client evidence to demonstrate CommandKit's contribution. + +As implementation lands, update owning GoDoc, the [CLI reference](../cli.md), +[consumer guidance](../consumers/guide.md), and [internal inventory](../internal/overview.md). +Document the chosen CLI behavior, public composition contract, context lifecycle, +report changes, and applicable upstream adoption effects in their canonical +owners. Review dependency alignment and [attribution](../oss/attribution.md). + +Core changes will require a core release and downstream integration releases +under the [dependency alignment policy](../policy/release.md#commandkit-downstream-dependency-alignment). +Publication follows the [release order](../release.md#scope-and-release-order) +with integrations selecting the published dependencies. ckconfig needs alignment, +not usage functionality. Exact release versions and publication are separate +release work. + +## Completion Evidence + +Completion will require a normally installed ckprompt integration and an +application-owned pipeline command whose requested summary needs no per-request +observers, local accounting state, or final reporting callback. Verify both +assembly paths and commands registered before and after the integration. + +Focused core checks will cover atomic installation, typed Boolean selection, +context decoration at the selected boundary, invocation isolation, finalization +order, mode visibility, and rendering/delivery failures. Integration checks will +cover context forwarding and faithful summary presentation: prompt counts, +conditional repair details, token fields, cost sources and precision, ratio +presentation, empty groups, unknown/incomplete evidence, and available data after +failure or cancellation. Verify preserved application outcomes and supported +error identity. + +Verify help, completion, version, and routing/parsing/preflight failures without +usage summaries or acquisition for reporting. Verify explicit-observer +coexistence, smoke reasoning and ratio adaptation, and preservation of explicit +provider/zero-cost inspection evidence. + +Keep checks offline and test CommandKit-owned integration behavior. A real +upstream engine can support representative consumer evidence; PromptKit retains +tests for its accounting, retries, repairs, and provider decoding. Run affected +core and nested-module suites using the [developer guide](../development.md), +including independent builds against released dependencies before release. +Live inference, benchmarks, and a new concurrent-dispatch guarantee are not +required. + +After completion, retire this roadmap and preserve unfinished scope in +[future work](future.md). + +## Deferred Scope + +A machine-readable usage-output interface is deferred until a concrete consumer +needs it. It will require an explicit destination and framing because the +diagnostic stream may contain other messages. No additional JSON/YAML document +or modification of arbitrary application result shapes is part of this feature. + +A separate usage-only installation API, per-model breakdowns, event traces, and +persistent history are also deferred. The initial feature will use normal +nonempty ckprompt installation and the native invocation summary. [promptkit-release]: https://forge.maximumdirect.net/base-layer/promptkit/src/tag/v0.25.0/docs/releases/v0.25.0.md [promptkit-observations]: https://forge.maximumdirect.net/base-layer/promptkit/src/tag/v0.25.0/observations.go diff --git a/docs/roadmap/future.md b/docs/roadmap/future.md index 4e9f14c..4d95075 100644 --- a/docs/roadmap/future.md +++ b/docs/roadmap/future.md @@ -6,8 +6,8 @@ No delivery dates are selected here. ## Active roadmap [Automatic PromptKit usage reporting](automatic-usage-reporting.md) records the -goal of invocation-wide usage reporting through normal ckprompt installation, -the upstream dependency, and open design decisions. +agreed target state for invocation-wide usage reporting through normal ckprompt +installation, the released upstream API, and the required adoption work. ## Purpose and authority