get_token_savings
Show cumulative token savings from Clean's compact result format versus raw JSON.
get_token_savings reports how many tokens Clean has saved by returning compact tiered/TOON-formatted results instead of full JSON. On every search, Clean formats the results twice — the compact summary it actually sends, and a full-JSON baseline — and banks the character-count difference (divided by four) as an estimated token saving.
Inputs
| Name | Type | Required | Default | Description |
|---|---|---|---|---|
reset | boolean | false | Reset all statistics to zero instead of printing them. |
Example
Returns a formatted report: total searches, JSON vs compact character counts, estimated tokens saved, average savings percent, and a per-session breakdown.
To clear the counters:
How the number is measured
The headline figure is a concrete per-search measurement, not a marketing estimate — it's the literal character-count difference between what was sent and what a naive server would have sent (a full-JSON dump including every entity's complete source), divided by four. The local edition persists lifetime totals to ~/.clean/stats.json; session counters reset each time the server starts.
See How Clean reduces cost for the full accounting model.