Record the token reporting flag decision

This commit is contained in:
2026-11-22 19:24:35 +00:00
parent 55e0f8c8b0
commit 91ef377bcd

View File

@@ -1,7 +1,6 @@
# Automatic PromptKit Usage Reporting # Automatic PromptKit Usage Reporting
Status: adoption goal agreed; upstream v0.25.0 reviewed and available; CommandKit Status: adoption goal agreed; upstream v0.25.0 reviewed and available; OD-1 selected; OD-2 through OD-6 open; implementation not started.
design decisions open; implementation not started.
## Goal ## Goal
@@ -134,7 +133,7 @@ of the planned usage integration, which does not yet exist.
Add a narrow, library-neutral capability sufficient for ckprompt to register an Add a narrow, library-neutral capability sufficient for ckprompt to register an
invocation-wide flag, decorate the context before execution work begins, retain invocation-wide flag, decorate the context before execution work begins, retain
private invocation state, and submit final presentation before reporting closes. private invocation state, and submit final presentation before reporting closes.
Choose its public shape under D2 below. Core must not import PromptKit or ckprompt, Choose its public shape under OD-2 below. Core must not import PromptKit or ckprompt,
including through its tests, examples, tools, or module requirements. including through its tests, examples, tools, or module requirements.
Capture this behavior through supported installation contracts. Validate it with Capture this behavior through supported installation contracts. Validate it with
@@ -172,8 +171,8 @@ intercept arbitrary engine calls. This work does not establish concurrent
Expose the upstream token categories and available USD cost, keeping unknown Expose the upstream token categories and available USD cost, keeping unknown
values, reported or configured zero, cost sources, incomplete subtotals, and values, reported or configured zero, cost sources, incomplete subtotals, and
terminal coverage distinct. Select presentation under D3-D6. Describe these facts terminal coverage distinct. Select presentation under OD-3 through OD-6. Describe
neutrally using the adopted upstream meaning; no local pricing inference or 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 billing guarantee is needed. Do not round cost during adaptation; any text
display precision is a presentation choice. display precision is a presentation choice.
@@ -194,7 +193,7 @@ CLI flags or loader wrappers are needed for this adoption.
The explicit [smoke usage projection](../../integrations/ckprompt/smoke_report.go) The explicit [smoke usage projection](../../integrations/ckprompt/smoke_report.go)
currently lists five token fields. Extend it to retain native `ReasoningTokens` currently lists five token fields. Extend it to retain native `ReasoningTokens`
in attempt and aggregate reports rather than silently dropping that added field. in attempt and aggregate reports rather than silently dropping that added field.
Use D6 to decide cache-ratio presentation consistently across usage reports. Use OD-6 to decide cache-ratio presentation consistently across usage reports.
Smoke diagnostics retain their separate upstream reporting model and are not Smoke diagnostics retain their separate upstream reporting model and are not
enrolled in ordinary context observation. Do not add their reported usage to an enrolled in ordinary context observation. Do not add their reported usage to an
@@ -204,22 +203,23 @@ execution summary or attempt to infer it from token counts. Existing authenticat
diagnostics should continue to expose native support and applicability findings, diagnostics should continue to expose native support and applicability findings,
including the new vLLM adapter, through the current smoke command. including the new vLLM adapter, through the current smoke command.
## Open Decisions ## Decisions
All recommendations below are proposals, not selected contracts. Resolve these OD-1 is selected below. Recommendations under OD-2 through OD-6 remain proposals,
choices before writing a concrete implementation plan; implementation should not selected contracts. Resolve the remaining choices before writing a concrete
then be able to proceed through that plan without intermediate design gates. implementation plan; implementation should then be able to proceed through that
plan without intermediate design gates.
### D1: Flag name and selection ### OD-1: Flag name and selection — selected
Choose the standard flag name and Boolean occurrence semantics. Recommend Use `--show-tokens` as a Boolean flag, defaulting to false, with no shorthand.
`--usage`, because the summary can include both tokens and cost, disabled unless Support `--show-tokens=false`; the last supplied value wins when repeated.
selected. `--token-usage` is the narrower alternative discussed so far. Use the Use the existing typed parsing and help/completion conventions. Help text:
existing typed parsing and help/completion conventions; explicitly document "Show token usage and available cost information after execution."
repeated occurrences and `=false`. Automatic availability does not mean printing Automatic availability does not mean printing a summary when the operator has
a summary when the operator has not requested it. not requested it.
### D2: Installation API and capability availability ### OD-2: Installation API and capability availability
Choose the smallest public core composition contract and how normal ckprompt Choose the smallest public core composition contract and how normal ckprompt
installation supplies it. Both `Command` and `Declarations` are current public installation supplies it. Both `Command` and `Declarations` are current public
@@ -235,7 +235,7 @@ suite. Usage-only support is not necessary for the ordinary nonempty installatio
goal. The mechanism must not depend on wrapping the engine loader or on enabling goal. The mechanism must not depend on wrapping the engine loader or on enabling
a particular inspection callback. a particular inspection callback.
### D3: Output destination, visibility, and finalization order ### OD-3: Output destination, visibility, and finalization order
Recommend a concise summary on the diagnostic destination, normally stderr, Recommend a concise summary on the diagnostic destination, normally stderr,
shown in ordinary mode when requested. An ordinary Info message alone is shown in ordinary mode when requested. An ordinary Info message alone is
@@ -248,7 +248,7 @@ consistent with successful output suppression, and present it after normal
command reporting but before a terminal failure explanation. Explicitly document command reporting but before a terminal failure explanation. Explicitly document
the chosen precedence between quiet mode and the usage flag. the chosen precedence between quiet mode and the usage flag.
### D4: Text and structured summary access ### OD-4: Text and structured summary access
Choose whether the initial feature is a text diagnostic summary or also exposes Choose whether the initial feature is a text diagnostic summary or also exposes
a separately formatted machine-readable summary. Recommend text on the diagnostic a separately formatted machine-readable summary. Recommend text on the diagnostic
@@ -258,7 +258,7 @@ selection, and interaction with existing results before implementation. Keep
serialization in core; do not alter arbitrary application result shapes or serialization in core; do not alter arbitrary application result shapes or
silently introduce another JSON document on their result stream. silently introduce another JSON document on their result stream.
### D5: No observations and commands that do not execute models ### OD-5: No observations and commands that do not execute models
Decide what an explicitly requested summary shows when no ordinary execution Decide what an explicitly requested summary shows when no ordinary execution
events were observed, including inspection-only commands or early returned events were observed, including inspection-only commands or early returned
@@ -268,7 +268,7 @@ structured representation. Recommend help, completion, and parse-only failures
produce no usage summary and require no acquisition work. Specify the boundary produce no usage summary and require no acquisition work. Specify the boundary
for input/preflight failures when designing the lifecycle hook. for input/preflight failures when designing the lifecycle hook.
### D6: Initial summary detail ### OD-6: Initial summary detail
Choose the initial report fields and text precision. Recommend aggregate prompt, Choose the initial report fields and text precision. Recommend aggregate prompt,
completion, reasoning, total, cached, and cache-write tokens; available USD cost completion, reasoning, total, cached, and cache-write tokens; available USD cost
@@ -288,8 +288,9 @@ availability of the evidence.
## Delivery Sequence ## Delivery Sequence
1. Resolve D1-D6 against the reviewed PromptKit v0.25.0 API. Upstream implementation 1. Resolve OD-2 through OD-6 against the reviewed PromptKit v0.25.0 API. Upstream
and release are complete; no upstream feature work remains a prerequisite. implementation and release are complete; no upstream feature work remains a
prerequisite.
2. Implement and verify the neutral core installation, flag, context, and 2. Implement and verify the neutral core installation, flag, context, and
finalization support. Preserve existing reporting and assembly contracts. finalization support. Preserve existing reporting and assembly contracts.
3. Adopt PromptKit v0.25.0 in ckprompt and attach observation and summary 3. Adopt PromptKit v0.25.0 in ckprompt and attach observation and summary