Skip to content
Edith

Docs

Command reference

ed usage refresh

Re-collects usage data from every agent, on this Mac and on the machines, and rewrites usage.json.

Output
ed usage refresh [--follow] [--machines | --no-machines] [--json]

Machines counted towards usage are collected at the same time as this Mac's own agents, but only the stale ones: a machine collected within the last half hour is left alone, so a refresh on a loop does not open an SSH connection every time. --machines collects from all of them first, regardless of when they were last seen, --no-machines skips them and merges whatever is already on disk. --follow never collects, since it is watching a run that someone else started.

Options

Name Type / values Default What it does
--follow flag off Attach to a refresh that is already running instead of starting one, and fail when there is nothing to watch
--machines flag off Force every counted machine to collect before the local pipeline starts; fail if any machine is busy or fails
--no-machines flag off Skip machine collection and merge the machine snapshots already on disk
--json flag off Emit JSON on stdout

--json shape

JSON
{  "completed": true,  "followed": false,  "phases": [    {      "detail": "cached",      "name": "ccusage",      "seconds": 0.01    },    {      "detail": "27 days",      "name": "cli",      "seconds": 1.47    },    {      "detail": "125311 messages",      "name": "walk",      "seconds": 3    }  ],  "seconds": 9.98,  "summary": {    "machines": "Devbox",    "sources": "cli, codex, commandcode, machine:0b481f65-f946-4636-ab36-e4508eb67e6a:cli",    "spend": "$10876.85 · 378 sessions · 401 KB",    "window": "2026-07-08 to 2026-08-08 · 27 days · 7 models"  }}

completed is always true: reaching the JSON at all means the pipeline finished, because every other outcome is an error. followed says whether this invocation watched a run someone else had started instead of starting its own. seconds is the pipeline's own total, phases carries every phase row in the order they landed, three of the eight above, and summary is the closing block keyed by label.

Examples

Output
ed usage refreshed usage refresh --followed usage refresh --json | jq -r '.summary.spend'ed usage refresh && ed usage summary --range today

Behaviour

This is the only verb in the group that changes anything. ed asks Edith's background services to read your agents' history again, the same way the dashboard's refresh button does, so the two always agree. Only one refresh runs at a time.

Progress goes to stderr and stdout stays clean: one usage refreshed line at the end, or the JSON object. Each phase is printed as it lands, with a spinner on the phase in flight, and the whole display is skipped when --json is passed or stderr is not a terminal, so a pipe sees nothing extra. NO_COLOR and TERM=dumb switch it off too, rather than only dropping the colour.

A run holds a lock on refresh.lock in the data directory, so two of them cannot clobber usage.json. When one is already running, in the app or in another terminal, ed attaches to it instead of starting a second, printing a refresh is already running, attaching to it and reporting that run's phases as they land. --follow asks for that explicitly, and that is the difference between the two: with nothing running it exits 4 with no usage refresh is running, hinted drop --follow to start one, where a plain ed usage refresh would have started one.

A pipeline failure is an error rather than a quiet success. What the collector reported becomes the message, exit 4, hinted at data/refresh.log, which is where the same transcript is written line by line while the run happens. A run that was attached to and then stopped without finishing fails the same way.

The default stale-machine collection is best effort and runs inside the same agent refresh. Every stale machine is collected at once, in parallel with this Mac's collectors, and the pipeline only waits for them at the very end, right before it folds the machine snapshots in. A refresh therefore takes about as long as the slower of the two halves instead of their sum, and a waiting for machines line appears when the machines are the slower half. A machine that is offline, busy, or fails collection does not prevent this Mac from refreshing and merging the last snapshot on disk.

Each machine connects with a timeout sized to where it lives: 3 seconds for a machine on this network (a private, loopback, link-local or .local address) and 6 seconds for anything else. A machine whose connection drops or flaps is retried with a growing pause (1, 2, 4, then every 8 seconds) for as long as this Mac's own collectors are still running, up to two minutes, because those retries cost the refresh nothing. Once the pipeline is ready to fold the machines in, a machine still unreachable keeps its last snapshot. A machine that has not finished within the collector timeout plus two minutes is stopped so it cannot hold the refresh open.

--machines is strict instead: it forces every counted machine regardless of freshness, collects them all before the local pipeline starts, and any busy or failed machine exits 4. Passing both machine flags is invalid.

Output
$ ed usage refresh  EDITH · refresh usage · 2026-08-08 23:57:31  ────────────────────────────────────────────────────  ▸ ccusage    cached                             0.01s  · discovering sources  ▸ cli        27 days                            1.47s  ▸ codex      12 days                            0.83s  ▸ commandcode 1 days                             0.85s  · assembling usage.json  · walking 900 transcript files  ▸ walk       125311 messages                    3.00s  ▸ projects   174 repos                          2.35s  ▸ merge      hours + projects merged            1.32s  ▸ machines   1 folded in                        0.05s  ────────────────────────────────────────────────────  ✓ sources   cli, codex, commandcode, machine:0b481f65-f946-4636-ab36-e4508eb67e6a:cli  ✓ machines  Devbox  ✓ window    2026-07-08 to 2026-08-08 · 27 days · 7 models  ✓ spend     $10876.85 · 378 sessions · 401 KB  ✓ done in 9.98susage refreshed

Where to go next