# Automatic Usage Reporting Review Status: two open findings: documentation R1 and integration R2. Production code is unchanged by these reviews. ## Scope and evidence Reviewed implementation commit `b7467c5` against all eight stages of [the implementation plan](implementation.md) and the agreed [target state](automatic-usage-reporting.md). | Stages | Review result | | --- | --- | | 1–2: capture, installation, parsing and discovery | Captured feature handles, prospective-registry validation, rollback, separate flag values, aliases, help and completion follow the selected design. | | 3–4: lifecycle, reporting and public assembly | Startup follows successful command input checking; builtin exclusions, context composition, invocation isolation, quiet rendering, finalization order and presentation failures follow the selected contracts. | | 5–6: upstream adoption and reports | Published PromptKit v0.25.0 supplies observation/accounting; native reasoning, ratio, cost, zero/unknown/incomplete states and smoke separation survive adaptation. R1 concerns the operator documentation. | | 7: consumer evidence | Normal integration installation enables the offline application pipeline without accounting code in its handler. | | 8: documentation and validation | Workspace and isolated-source checks pass. R1 remains in the canonical CLI reference. Published-dependency alignment remains the explicitly planned release follow-up. | The initial stage-oriented review identified no production correctness defect, missing architectural capability, or inadvertently strengthened contract. The subsequent interaction review below identifies the help-fallback integration defect R2. Validation used Go 1.27.4: - All three workspace `go test` suites passed. - Independent root and ckconfig `GOWORK=off` suites passed. - Isolated ckprompt `go test -count=1 ./...` passed using a temporary modfile replacing only core and ckconfig with local sources. PromptKit remained the published v0.25.0. This does not establish compatibility with newly published core/ckconfig releases, which have not been selected for this checkout. - The offline pipeline returned valid JSON on stdout and the expected two-prompt, 28-token, USD 0.0025 summary on diagnostics. Quiet suppressed both streams. - The offline `text_inference` smoke command retained its own nonzero token/ratio evidence while the ordinary execution summary remained zero and carried the smoke-separation note. - Core dependency inspection found no optional integration/domain modules; formatting and diff checks passed. ## R1: Complete the canonical smoke-report documentation **Priority:** P3. **Status:** open. **Plan coverage:** Stages 5 and 8. **Relevant material:** the smoke `--format` row in [the CLI reference](../cli.md#smoke-test-flags), the [smoke report fields and example](../cli.md#smoke-report-fields), and the new [usage-reporting description](../cli.md#promptkit-usage-reporting). Compare [the smoke report DTO and templates](../../integrations/ckprompt/smoke_report.go) and [their installation in smoke commands](../../integrations/ckprompt/smoke_command.go). **Expected:** the canonical operator reference should consistently describe the implemented text-template default and the added structured usage evidence. Both attempt and aggregate usage now include `reasoning_tokens` and `cache_hit_ratio`. The ratio is a nullable numeric fraction in JSON/YAML, including a present zero; text additionally presents available ratios as percentages with one decimal place. **Actual:** the new usage-reporting section says smoke reports default to text, but the smoke flag table retains the earlier description that automatic/text output uses YAML for structured reports. The current text template does retain the YAML evidence and append percentage comments, so the table should describe that selected template rather than imply the old generic fallback. The smoke field description and sample also omit the two added usage fields and do not explain the numeric ratio's units or unavailable/null representation. **Impact:** readers get inconsistent format guidance and an outdated example of the emitted usage shape. In particular, the structured ratio's `0.2` means 20%, not 0.2%; the canonical reference currently leaves that distinction unexplained. The implementation and existing projection tests retain the correct evidence. **Remediation:** update the smoke format row, usage-field description, and sample in `docs/cli.md` to match the implemented reports. Include reasoning count state and nullable fractional cache-hit ratio at the attempt/aggregate boundary; explain the text percentage presentation and keep provider/accounting semantics linked upstream. Verify the sample against the current DTO or offline consumer. This requires documentation updates, not a production behavior change or a new upstream-domain test suite. ## R2: Honor ckconfig's help-only fallback before starting invocation features **Priority:** P2. **Status:** open. **Plan coverage:** Stages 2–4 and 7–8. **Relevant code and contracts:** - [prepareConfigOperation](../../integrations/ckconfig/input.go) records a help-only plan when `config explain` has neither `--path` nor `--list`. - [runConfigOperation](../../integrations/ckconfig/operations.go) returns `Invocation.Help()` for that plan before initializing state or acquiring data. - [App.Execute and prepareFeatures](../../execute.go) enforce required feature flags before the command's input check reveals that help-only plan. - [typedCommand.prepare](../../command.go) starts features after successful `CheckInput`, before ckconfig's `Run` can delegate to help. - The [existing explain contract](../cli.md#explain-a-configuration-path) defines the invocation without either mode as help. The new [invocation-scope target](automatic-usage-reporting.md#invocation-scope) excludes help from observation and usage summaries. **Failure condition:** install ckconfig alongside a nonempty ckprompt family, or alongside another invocation feature, then enter `config explain` without a mode. The existing integration represents this help path inside its handler rather than as a generated builtin or a parser-level help request. The new lifecycle recognizes only the latter forms before starting features. **Expected:** this documented help-only invocation should have the same feature exemption as explicit help: no usage summary or feature startup, no acquisition, and no requirement to supply execution-only invocation flags. Ordinary inspection commands without model executions should still receive the selected zero summary. Validation failures inside an actual `Run` remain execution as already agreed. **Actual and reproduction:** from the repository root, with the maintained offline consumer and Go 1.27.4: ```sh go run ./integrations/ckprompt/examples/composed config explain --show-tokens go run ./integrations/ckprompt/examples/composed config explain --help --show-tokens ``` Both return status 0 and display help. The first additionally emits the standard zero-token/zero-cost usage summary; the explicit-help invocation emits none. A temporary external consumer further confirmed the generic feature interaction: install `ckconfig.AppCommand` with a loader counter and an invocation feature having a required Boolean flag and a `Start` counter. `config explain` returns status 2 with `required flag --feature-required was not supplied`, while `config explain --help` returns status 0. Supplying `--feature-required` returns status 0 but calls `Start` once before displaying help. The loader remains uncalled in all three cases. The temporary consumer did not modify repository sources. **Consequence:** equivalent help paths have different output and eligibility rules. Invocation features can execute callbacks on this help path or prevent the help display altogether. This is an interaction with an established standard integration, not a request to reinterpret arbitrary application validation. **Remediation approach:** provide a narrow, library-neutral way to communicate a known help-only preflight disposition to core, and have ckconfig expose its existing `plan.help` decision through it. Honor that disposition before enforcing execution-only feature requiredness and before feature input construction/startup. Keep supplied-value syntax checking and existing main help rendering in the shared CLI machinery. Preserve requested summaries for real executions, including empty groups and returned validation/acquisition failures. A report-output heuristic or blanket suppression of zero summaries would miss the callback/requiredness defect and discard intentionally supported empty-execution reports. **Regression coverage:** exercise ckconfig's implicit explain help and explicit `--help`, both with normal ckprompt installation and with a generic required invocation feature. Verify successful help, zero feature-start/provider calls, and no invocation summary in both paths. Include a real explain operation and an ordinary non-model command to verify that their requested zero summaries and execution-only required flags still work. Cover an alias to the help-only command through the same dispatch behavior. ## Follow-up interaction audit evidence The interaction review used source baseline `b7467c5`, with R1 already recorded at `70cd68f`. It revisited the eight stages through their existing collaborators: registry/alias installation, local and shared flag parsing, discovery, reporting, configuration preflight, native observation, smoke reporting, and consumer wiring. All three workspace suites passed afresh with `go test -count=1` on Go 1.27.4. A temporary external consumer also passed checks combining a late-installed feature with local shared-debug input, local and feature repeatable values, scoped/global flag aliases, an alias-only help prefix, operands after `--`, version, and completion. R2 was reproduced separately despite those passing suites. No other new interaction defect requiring remediation was identified.