Skip to content

stats

Roadmap entry 109: Arthur keeps the tokens, cost and time of every job run and of every coordinator turn, in two append-only files of its own folder, <home>/stats/. It calls no model. Every cost is omp’s at list price, what the tokens would cost on the API, not money paid on a subscription.

Roadmap entry 111: the views of these files. arthur stats prints the spend of a span, the last 7 days by default, by role, project, model, day and ticket, with filters; /stats answers its total, by role and top 3 tickets on a channel; the morning report’s Spend section is the first two lines of arthur stats --since 1d (arthur stats --help).

Roadmap entry 110: the merged tickets’ report, which came with manage (61), is this plugin’s: arthur stats tickets prints it (arthur stats tickets --help), and the provided name stats.tickets, (project, since?) to the same report of the tickets merged at since or later, gives manage’s audit and retro prompts their ### Stats section (packages/manage/docs/manage.md).

Roadmap entry 112: arthur stats windows puts each usage window of the account, which the models plugin reads from the agent’s report and gives as models.windows, beside what Arthur spent at list price on that provider’s models in the window’s span, by role, each role’s part of the window an estimate marked ≈ and an upper bound, since the account’s use outside Arthur counts in the window too (arthur stats windows --help). Without the models plugin it says so in one line.

AR0739: arthur stats budget prints, per kind of ticket, what the workers of a project’s merged tickets cost, the median and the cost 9 in 10 stayed within, from the - Cost: line of each ticket’s outcome.md: the figure a worker’s budget is picked from (arthur stats budget --help).

plugins: [orchestration({}), stats()],

It has no options but enabled; any other is refused at load (stats.<key>: unknown option; stats has no options but enabled).

One line per job-ended, what that run added to the job’s record (arthur jobs --help, the record’s cost, usage and ran):

{"seq":812,"time":"2026-11-06T10:42:07.120Z","job":"2026-11-06-worker-0a1b2c3d","kind":"worker","project":"acme","tickets":["AC0012"],"machine":"local","state":"ended","reason":"finished","seconds":1260.5,"cost":3.4215,"usage":{"anthropic/claude-opus-5-5":{"messages":41,"input":120,"output":18200,"cacheRead":2100000,"cacheWrite":95000,"cost":3.4215}}}
  • seq and time are the event’s; tickets the ids of the tickets its task names on Ticket:; seconds the time in the run, cost USD, usage per <provider>/<model> its messages, tokens and USD. A local model’s tokens come with a cost of 0.
  • Each number is the record’s total now less the job’s earlier lines: a continued job’s second run counts what it added, on the day it ran, and a second end of the same run (blocked, then stopped) adds 0.
  • Only arthur run writes, once its plugins started. An end heard before (the replay of the event log at the start) waits for the start; a command’s process (arthur stop) hears its own job-ended and writes nothing. An end whose seq is not above the highest one written is skipped, so a replay after a crash writes nothing twice.
  • A job whose record is already gone when its end is read (pruned while arthur run was down) gets a line with "missing": true, its numbers 0: unknown, not free.
  • The first start, with no runs.jsonl yet, writes one "backfill": true line, without seq, its time the record’s since, for every record arthur jobs still holds whose run is over: its cost, seconds and tokens, the tokens only when its record has usage (entry 108). A job then in a run gets its whole spend at its end. A job pruned before is not counted.

Coordinator turns: sessions/<session>.jsonl

Section titled “Coordinator turns: sessions/<session>.jsonl”

The plugin gives orchestration an OMP extension, packages/stats/src/session-extension.ts, which the coordinator’s agent and each project agent’s load (arthur coordinator --help, coordinator.extension) with ARTHUR_STATS_FOLDER naming the plugin’s folder. At each real end of a turn (agent_end that does not go on) it appends one line to sessions/<session>.jsonl, the session being what ARTHUR_ORCHESTRATION_SESSION names, agent:<project> in a project agent’s (sessions/agent:shop.jsonl), else coordinator (sessions/coordinator.jsonl):

{"time":"2026-11-06T10:45:00.000Z","session":"coordinator","seconds":38.2,"until":1794480299512,"cost":0.8125,"usage":{"anthropic/claude-opus-5-5":{"messages":3,"input":9,"output":1400,"cacheRead":310000,"cacheWrite":4200,"cost":0.8125}}}
  • The numbers are those of the assistant messages whose timestamp is after until, the last one counted, which the line keeps; at its start the extension reads it from the file’s last line without sub. So a turn that goes on after its agent_end (willContinue) is counted once at its real end, and a restarted coordinator (--continue) counts none of the conversation it already counted.
  • seconds runs from the turn’s first agent_start.
  • A session without a UI, a task subagent, writes its turns to the same file marked "sub": true [INFERENCE: omp loads the coordinator’s extensions into its subagents, as the other extensions’ hasUI guards assume].
  • The coordinator’s spend before the plugin is installed is not imported.
  • Each line is one append ending in a line break. A last line a crash cut gets its line break before the next one, and a reader skips a line it cannot parse.
  • Each file has one writer: runs.jsonl the one arthur run of the home, a session’s file that session’s single omp.
  • Lines hold numbers, ids, kinds and model names, never text. The folder is outside Git, and arthur prune leaves it alone; the files are kept for ever.
  • omp’s own side calls (its compaction, the --smol model) count only when they come as assistant messages, as for a job’s cost.

Usage: arthur stats budget [--project <name>]. Comes with the stats plugin (AR0739). Answered without the model, for one project, the main one unless --project names another; it runs inside a job too.

What the workers of a project’s merged tickets cost, per kind of ticket, so a worker’s budget is picked from what such a ticket cost before, not guessed: a budget at or under the median stops about every second worker of that kind before it is done, and each stop costs the owner a budget question.

Worker cost of the merged tickets of acme, by kind:
feat: 12 tickets, median $5.82, 9 in 10 within $13.62
fix: 7 tickets, median $2.28, 9 in 10 within $9.69
docs: 1 ticket, median $1.53, 9 in 10 within $1.53
Left out: 2 tickets whose outcome.md names no worker cost
  • One line per kind, the kind with the most tickets first, kinds with as many in name order. The kind is the one word of the - Kind: line under the ticket’s ## Goal (arthur ticket --help); a ticket without one, or whose line holds more than a word, counts under no kind.
  • The cost is the workers’ alone, the first amount of the - Cost: line of the ticket’s outcome.md (arthur merge --help): every worker of the ticket and every run of each together, an earlier worker whose branch a fresh one took over included (AR0750); the reviews’ amount is not part of it, as a review has its own budget.
  • median and 9 in 10 within are each the cost of one of those tickets, by the nearest rank: with the costs in order, the one at half of them and the one at nine tenths of them, rounded up. Of 10 tickets they are the fifth and the ninth; of 11, the sixth and the tenth; of one, that ticket’s cost twice.
  • The coordinator’s role takes the 9 in 10 within figure of the ticket’s kind as a worker’s budget, in the approval question and at the spawn, and names it with this command as its source.
  • A merged ticket whose outcome.md is missing, has no - Cost: line, or says n/a for the worker (a worker’s cost file was missing at the merge) is left out and counted on the last line, which is left out when there is none.

With no merged ticket, one line says so: No merged ticket in <project> yet. It reads only: nothing is written. More than nothing after budget prints usage: arthur stats budget [--project <name>] and exits 2; an unknown project exits 1 with the board’s refusal.

Usage: arthur stats tickets [--project <name>]. Comes with the stats plugin (roadmap entry 61, moved from manage in 110, under tickets since 111, when bare arthur stats became the spend view: arthur stats --help). Answered without the model, for one project, the main one unless --project names another; it runs inside a job too. The same report, of the tickets merged since the last audit or retro, is the ### Stats section of their prompts, which manage asks the stats plugin for as stats.tickets (packages/manage/docs/manage.md).

How the merged tickets went: one line per merged ticket, in the order they were made, then six lines over all of them:

Stats of acme: 3 merged tickets
AC0001 Shop: 2 rounds (FAIL, PASS), $3.50, 2 days
AC0002 Cart: no review, cost unknown, 0 days
AC0003 Fix the total: 1 round (PASS), $0.40, 1 day, autopilot
Mean review rounds: 1.5 over 2 reviewed tickets
First-round PASS: 1 of 2 (50%) reviewed
Autopilot: 1 of 3 (33%) merged
Most expensive: AC0001 $3.50, AC0003 $0.40; cost unknown for 1 ticket
FAIL findings:
- AC0001 review-1: 1. `src/cart.ts:12` - the total ignores the discount.

Where each comes from, all in the ticket’s folder in the project’s checkout (spec/features/<id>-<slug>/):

  • Rounds and verdicts: its review-N.md files, in the order of N, each the verdict of its - Verdict: line, none when it is not PASS or FAIL. A ticket with no review file says no review.
  • Cost: the - Cost: line of its outcome.md (arthur merge --help), the worker’s and the reviews’ amounts added. An outcome.md that is missing, has no such line, or says n/a for either amount (a job’s cost file was missing at the merge) is cost unknown, never $0: it counts in neither the most expensive nor any sum.
  • Days: from the date of its ticket.md’s JSON block, the day it was made, to the day of its last move on the board, to merged, in core.timeZone. Either missing is days unknown.
  • autopilot: its ticket.md holds a - YYYY-MM-DD: Pre-approved by policy: line (arthur coordinator --help, “Autopilot”).

Over all merged tickets:

  • Mean review rounds: the review files per ticket, over the tickets with at least one; a ticket without reviews is left out, not counted as 0.
  • First-round PASS: of the reviewed tickets, those whose review-1 (the lowest N) is PASS.
  • Autopilot: of every merged ticket, those pre-approved by policy.
  • Most expensive: the 3 with the highest known cost, highest first, and how many have none known.
  • FAIL findings: for each FAIL review, <id> review-N: and the first line of each of its findings. The findings are the section under the first heading of its final message that names Findings (## Findings, ## Review Findings, **Findings**, Findings:), up to the next # heading or a bold Notes or Checks; each finding is a line that opens as the section’s first does: a number (1.), a bullet (-, *), or bold (**) after a blank line. A section that opens with plain text is one finding; a review with no such heading gives the first line of its final message.

With no merged ticket, one line says so: No merged ticket in <project> yet., and asked with a time as stats.tickets, No merged ticket in <project> since <YYYY-MM-DD> <HH:MM>. in core.timeZone. It reads only: nothing is written. More than nothing after tickets prints usage: arthur stats tickets [--project <name>] and exits 2; an unknown project exits 1 with the board’s refusal.

Usage: arthur stats windows. Comes with the stats plugin (roadmap entry 112), and needs the models plugin, which reads the account’s usage windows from the agent’s report (arthur usage --help) and gives them to stats as models.windows. Answered without the model; the report is fetched again when the last one is 10 minutes old, as arthur usage does. Every project.

One line per window of the report, beside what Arthur spent at list price (arthur stats --help) on that provider’s models in the window’s span, by role:

Usage windows, each beside Arthur's spend at list price on its provider's models in its span; by role, its share ≈ its part of the window, at most: the account's use outside Arthur counts too.
- anthropic Claude 7 Day 40% used, since 2026-11-07 11:00: $13.00; worker 46% ≈ 18%, coordinator 35% ≈ 14%, review 15% ≈ 6%, plan 4% ≈ 2%
- anthropic Claude 5 Hour 13% used, since 2026-11-13 06:00: $0.00
- anthropic Claude 7 Day (fable) 90% used: the report gives no span
  • The span runs from the window’s reset less its length (durationMs) to now, its start in core.timeZone; a window whose report gives no reset is taken as the span of that length before now; one whose report gives no length has no span, and nothing is compared.
  • The spend in the span is that of the runs and turns of <home>/stats/ whose usage names a model of the window’s provider (anthropic/... for anthropic): only those models’ cost counts. A run whose record had no usage (a backfill line of a record older than roadmap entry 108) or was gone (missing) counts for no window.
  • Each role, the most expensive first, has its share of that spend, then ≈ the window’s used share times it: an estimate, and an upper bound. omp’s report gives one used share per window for the whole account, nothing per session or call, and the owner’s own use of the account outside Arthur counts in the window too, so a role’s real part is at most the figure. The cost is at list price, what the tokens would cost on the API, whatever the account pays.

Without a window to show, one line, exit 0: no usage windows: the models plugin is not loaded; no usage windows: the agent has no usage report (<why>), also when the last fetch failed; no usage windows: no account reports one.

Refused: a word after windows prints usage: arthur stats windows and exits 2. Inside a job, Arthur’s home is hidden from the job’s sandbox: it prints the spend view’s refusal (arthur stats --help, “Refused”) and exits 1.

Usage: arthur stats [--since today|yesterday|<n>d|YYYY-MM-DD] [--project <name>] [--role <role>] [--ticket <id>] [--model <provider/model>], arthur stats tickets [--project <name>], arthur stats budget [--project <name>], or arthur stats windows. Comes with the stats plugin (roadmap entry 111). Answered without the model, from the plugin’s own files, <home>/stats/runs.jsonl and <home>/stats/sessions/*.jsonl (packages/stats/docs/stats.md); it reads only. Every cost is omp’s at list price, what the tokens would cost on the API, not money paid on a subscription.

arthur stats tickets is the merged tickets’ report of one project, which bare arthur stats printed before entry 111: arthur stats tickets --help. arthur stats budget is what the workers of that project’s merged tickets cost, per kind of ticket, by which a worker’s budget is picked (AR0739): arthur stats budget --help. arthur stats windows puts each usage window of the account beside this spend in its span, by role (entry 112): arthur stats windows --help.

By default the last 7 days of every project:

Spend since 2026-11-06 11:00 (7 days), every project: $17.00 at list price, 6 runs (2 failed or stopped), 1 turn, 0h35m
Tokens: 202 in, 2.6K out, 1.2M cache read, 50K cache write
By role:
- worker: $9.00 (53%), 3 runs (1 failed or stopped)
- coordinator: $4.50 (26%), 1 turn
- review: $2.00 (12%), 1 run (0 failed or stopped)
- audit: $1.00 (6%), 1 run (1 failed or stopped)
- plan: $0.50 (3%), 1 run (0 failed or stopped)
By project:
- acme: $11.00 (65%), 4 runs (1 failed or stopped)
- no project: $4.50 (26%), 1 turn
- other: $1.50 (9%), 2 runs (1 failed or stopped)
By model:
- anthropic/claude-opus-5-5: $16.00 (94%), 162 in, 2.6K out, 1.2M cache read, 50K cache write
- not recorded: $1.00 (6%), 0 in, 0 out, 0 cache read, 0 cache write
- ollama/qwen: $0.00 (0%), free, 40 in, 4 out, 0 cache read, 0 cache write
By day:
- 2026-11-10: $1.00 (6%), 1 run (1 failed or stopped)
- 2026-11-11: $3.00 (18%), 1 run (1 failed or stopped)
- 2026-11-12: $13.00 (76%), 4 runs (0 failed or stopped), 1 turn
Most expensive tickets:
- AC0012 (merged): $8.00: worker $6.00, review $2.00
- AC0013 (dropped): $1.50: worker $1.50
- AC0014 (in-progress): $1.50: worker $1.50
- OT0001 (status unknown): $0.50: plan $0.50
Whether it pays:
- on 1 ticket merged since 2026-11-06 11:00 (7 days): $8.00, $8.00 per ticket
- on dropped tickets: $1.50
- on runs that failed or were stopped: $4.00 in 2 runs
- on work with no ticket (the coordinator, audits): $5.50
Unknown: 1 run whose record was gone, 2 lines not read
  • The first two lines are the total: cost, the job runs and how many of them failed or were stopped, the coordinator’s turns, the time, then the tokens. The morning report’s Spend section is these two lines of arthur stats --since 1d.
  • A run is one line of runs.jsonl: what one run of a job added to its record. A turn is one line of a session’s file; a subagent’s turn (sub) adds its cost and tokens to its session’s but is no turn of its own, and its time is inside its session’s.
  • A run’s role is its job’s kind (worker, review, plan, audit, …), a turn’s its session’s name (coordinator). A run failed or was stopped when its reason starts with failed, stopped or limit: (arthur spawn --help).
  • By role, project and model, the most expensive first, each with its share of the total; by day in order, the day in core.timeZone. A turn has no project (no project). A model whose cost is 0 is marked free, its tokens still counted (a local model); not recorded is the cost of runs whose record had no usage (a backfill line of a record older than roadmap entry 108).
  • Most expensive tickets: the 5 with the highest cost, each split by role, with its board status, status unknown when no board of the project list holds it or its board cannot be read. A run that names several tickets gives each an equal share.
  • Whether it pays: the spend on the tickets the board shows merged with their last move in the span, and per such ticket; on tickets the board shows dropped; on the runs that failed or were stopped; on the runs and turns that name no ticket.
  • Unknown: the runs whose record was gone when they ended ("missing": true, numbers unknown, never counted as free), and the lines that are no JSON object or have no time it can read (cut by a crash, edited by hand), which nothing else counts.

With nothing in the span, one line: No job run or coordinator turn since <when>, <scope>., and the Unknown line under it when a line was not read.

  • --since: today and yesterday from that local day’s start in core.timeZone; <n>d, the last n times 24 hours, n from 1 to 99999 (--since 1d the last 24 hours); YYYY-MM-DD, a real date, from that local day’s start. 7 days when left out.
  • --project <name>: only that project’s runs; for this command it narrows, where other commands switch to that project. Turns have none, so they are left out.
  • --role <role>: only that kind’s runs, or that session’s turns.
  • --model <provider/model>: only that model’s share of each run and turn, its cost and tokens; a line with nothing of it is left out.
  • --ticket <id>: that ticket’s runs instead, one per line, the oldest first, under one line of their total:
Runs of AC0013 since 2026-11-06 11:00 (7 days), every project: $1.50 at list price, 1 run
- 2026-11-11 09:00 worker, anthropic/claude-opus-5-5+ollama/qwen, ended: failed: no verdict, $1.50 (its share of $3.00, 2 tickets), 50 in, 104 out, 0 cache read, 0 cache write, 0h10m

The filters combine; each narrows every section, the total too.

/stats [today|yesterday|<n>d|YYYY-MM-DD] [<ticket id>], in either order, on a channel: answered without the model, every project, the last 7 days by default. Without a ticket, the total, by role and the 3 most expensive tickets; with one, its runs as --ticket prints them. Any other words reply usage: /stats [today|yesterday|<n>d|YYYY-MM-DD] [<ticket id>].

  • Wrong usage (an unknown flag, a word after stats but tickets, budget and windows, a flag without its value, a --since none of the above) prints the usage line and exits 2.
  • Inside a job (arthur help --help), Arthur’s home is hidden from the job’s sandbox, the plugin’s folder with it: arthur stats prints arthur stats: the spend is kept in Arthur's home, which a job cannot read; arthur stats tickets and arthur stats budget run here and exits 1, and /stats replies the same, without the prefix. arthur stats tickets and arthur stats budget, which read only the board and the tickets’ folders, run there.