Metrics rollup

In the interactive relay shell, run /metrics for a rollup of token counts, estimated dollar cost, and wall time across your sessions:

text
/metrics

It walks the local session store under .agent-relay/sessions/ with no network calls and no telemetry.

Synopsis

In the relay shell, with no flags, /metrics prints the most recent session. Use --all for a cross-session rollup:

text
/metrics [session-id] [flags]

From another terminal, agent-relay metrics takes the same arguments:

terminal
agent-relay metrics [session-id] [flags]

Options

FlagTypeDefaultDescription
--allflagfalseAggregate across every session in the repo.
--sincedatenoneLower bound on session start, such as 2026-04-01.
--agentnamenoneFilter to one or more agent keys. Repeatable.
--jsonflagfalseEmit JSON instead of the formatted table.
--quiet, -qflagfalsePrint a minimal output format.
--repopathcurrent directoryRepository path.

Sample output

text
session                              agent        turns   tokens     cost     wall
─────────────────────────────────── ──────────── ─────── ───────── ──────── ──────
01J9X3M7K5VBHQEN6T2F4D8RPZ          claude-code     14    187,420   $1.41    12m
01J9X9N7Q2C5VFGMP4HTSXKDBE          codex            9    102,840   $0.78     6m
01J9XAEYR3D2BHQEN8T2F4D8RX          claude-code     17    214,950   $1.62    14m
─────────────────────────────────── ──────────── ─────── ───────── ──────── ──────
total                                                505,210   $3.81    32m

Cost is estimated from each provider's published per-token rates as of the time each session ran. The rate table ships inside agent-relay-tool and refreshes only on agent-relay-tool upgrades — metrics never hits the network.

Examples

These are slash commands in the relay shell. The same arguments work on agent-relay metrics from another terminal.

text
/metrics

Metrics for the latest session in .agent-relay/sessions/.

Exit codes

CodeMeaning
0Rollup printed successfully.
1Metrics could not be read or rendered.
2No sessions matched the filters.