Report ledger-accumulated session cost in the CLI interactive footer
What problem would this solve?
The CLI cost footer re-estimates cost from the last provider call's Usage on each render (crates/goose-cli/src/session/output.rs), so the displayed session cost can diverge from the accumulated_cost SessionManager already tracks. And there is no visibility into usage beyond the current session, even though the usage_ledger table (PR #10172) already persists per-call created_timestamp, cost, cost_source, is_compaction, and model.
Users on usage-limited subscription plans — weekly and rolling multi-hour windows are now common across providers — have no in-goose way to see where they stand this session, this 5-hour window, or this week, and resort to external statusline scripts polling provider-specific quota endpoints.
What would a good outcome look like?
- The footer reports ledger-accumulated session cost, not a per-call re-estimate.
- One summary — session totals, rolling 5h window, weekly total, context used vs limit, cost split by
cost_source— computed in one place fromusage_ledgerand available to every frontend. - Provider-agnostic: derived from goose's own usage records, not provider quota APIs.
- Window defaults pinned: rolling 5h anchored at query time, UTC calendar week, over all ledger rows.
Possible approaches
UsageSummaryservice (recommended):SessionManager::get_usage_summary()via SQL aggregation overusage_ledger— session totals reuse the existing recursive-CTE scoping, window rollups are a separate cross-session query. No schema change. CLI footer consumes it via a small renderer seam, new lines gated by the existingGOOSE_CLI_SHOW_*flag pattern; both agent-loop and state-machine paths per the migration parity rule.- CLI-only first stage: the same rollups as extra footer lines under a new flag — smallest diff, natural first deliverable.
- Materialized aggregate tables: write-time buckets for analytics — likely overkill; requires schema migration.
Constraints: no schema changes; no provider quota APIs; desktop/ACP exposure deferred and coordinated with PR #12006.
Additional context
Related: #11790. Builds on PRs #10172 (usage ledger), #11220 (config-declared pricing), #11093 (desktop cost display), #12006 (open, ACP usage updates). The existing context-window indicator complements this.
Do not begin implementation until the issue reaches Ready on the Goose Issues board.
Source: aaif-goose/goose