agent-relay metrics

Walk the local session store and print a rollup of token counts, estimated dollar cost, and wall time. Operates entirely on files in .agent-relay/sessions/ — no network calls, no telemetry.

Synopsis

terminal
agent-relay metrics [flags]

With no flags, prints a per-session table for the current repo's history.

Options

FlagTypeDefaultDescription
--chainsession idnoneOnly include sessions descended from the given start via resume-packet links.
--bysession|agent|daysessionGroup rows by session (default), agent name, or day.
--sinceduration or ISO datenoneWindow the rollup. Accepts 7d, 24h, or 2026-04-01.
--agentnamenoneFilter to a single agent. Repeatable.
--jsonflagfalseEmit JSON instead of the formatted table.
--no-colorflagfalseDisable ANSI colors.

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

terminal
agent-relay metrics

Every session in .agent-relay/sessions/, newest first.

Exit codes

CodeMeaning
0Rollup printed successfully.
1The requested --chain start doesn't exist.
2No sessions matched the filters.