fix: use prompt snapshots for live context diagnostics

This commit is contained in:
Peter Steinberger
2026-04-25 20:25:36 +01:00
parent b732f21a86
commit 30325f567c
6 changed files with 205 additions and 12 deletions

View File

@@ -101,6 +101,13 @@ Assistant transcript entries persist the same normalized usage shape, including
returns usage metadata. This gives `/usage cost` and transcript-backed session
status a stable source even after the live runtime state is gone.
OpenClaw keeps provider usage accounting separate from the current context
snapshot. Provider `usage.total` can include cached input, output, and multiple
tool-loop model calls, so it is useful for cost and telemetry but can overstate
the live context window. Context displays and diagnostics use the latest prompt
snapshot (`promptTokens`, or the last model call when no prompt snapshot is
available) for `context.used`.
## Cost estimation (when shown)
Costs are estimated from your model pricing config: