Files
ruflo/v3/@claude-flow
Lukas BuckandrUv be9b4d28ec fix(integration): token savings need the baseline the caller has (#3317)
`getCompactContext` reported `tokensSaved` as the query string's length
minus the retrieved prompt's. The query is a search instruction, not the
context the compact prompt replaces, so the subtraction had no valid
baseline: a short query against a longer retrieved prompt reported 0 no
matter how much context the caller then dropped, and a long query against
a short prompt reported a saving with no replaced context behind it.
`getStats` turned the accumulated value into `estimatedMonthlySavings`,
in a module whose header states that no fabricated metrics are reported.

The baseline is the caller's to supply, because this method never sees
it. `options.baselineTokens` names the size of the context being
replaced; savings are measured against that and floored at 0. Without
it the call is reported as unmeasured -- `tokensSaved: null`, nothing
added to the total -- rather than as a saving of 0, so a caller summing
these cannot fold "no saving" and "no measurement" into one number.
`contextsMeasured` says how many calls the total was actually built
from, and the report renders it next to the total.

Co-authored-by: rUv <ruv@ruv.net>
2026-09-16 02:21:17 +00:00
..