Skip to main content

Module reports

Module reports 

Source
Expand description

The named reports and the rollup behind warden query.

Every report in here is a pure consumer of crate::store::Scanner — none of them opens an event file itself. A report’s whole job is to turn a window of events into a Report; whether that reaches a terminal or a harness is crate::output’s problem.

Three honesty rules are enforced here rather than in each report:

  • A figure warden cannot derive is Cell::Unsupported, never 0.
  • An absent token count means “not applicable on this record”, because usage is logged once per request and repeated on no sibling. Summing treats it as contributing nothing, and Notes says how many records carried usage.
  • Anything that would make a number differ from what a user sees elsewhere — sidechain events, unpriced models, skipped lines — becomes a note.

Modules§

compare
warden report compare — this period against the one immediately before it.
files
warden report filesattributed tokens per file.
models
warden report models — usage split by model.
projects
warden report projects — tokens and est. cost per project.
query
warden query — a general rollup over named dimensions.
sessions
warden report sessions — the longest and most expensive sessions.
summary
warden report summary — totals for the period, broken down by day.
tools
warden report tools — tool call frequency, and the failure rate warden deliberately refuses to invent.

Structs§

Cost
Running cost for one bucket.
Notes
The observations that become a report’s notes.
ReportCtx
Everything a report is given besides the scanner.
Scanned
A completed scan, with the observations every report turns into notes.
Totals
Everything summed for one bucket of events.

Enums§

ReportError

Constants§

NAMES
The named reports, in their documented order.
NO_PROJECT
The label for a bucket whose events recorded no working directory. Those events are still real spend, so they get a row rather than being dropped — under one spelling, because projects explains it in a note and sessions prints it.
SYNTHETIC_MODEL
The model name Claude Code writes for records it synthesized itself. It is not a model anyone is billed for, so it is counted in volume and excluded from cost (see Cost::add).

Functions§

by_weight_desc
Heaviest bucket first, ties broken by key so output is deterministic.
count
A count cell, saturating rather than wrapping on an implausible total.
day_of
2026-08-04 in UTC. The store is UTC throughout, so days are too.
desc
Descending float compare. Ordering::Equal for a NaN — a weight that cannot be compared must not reorder the rows around it.
event_cost
What one event cost, priced from the current config.
format_span
1h12m, 4m, 12s — a wall-clock span, for sessions.
resolve
Resolve a report name, listing the valid ones when it is not one.
rollup
Bucket events by a key. None from key drops the event from the rollup.
round_money
Money is compared and diffed as a float but published at cent precision.
run
Build a named report end to end.
scan
Read the window through the one shared scanner.
short_id
Long ids are unreadable in a table; JSON keeps them whole.

Type Aliases§

Builder
A report by name.