# ed usage machines

> Counts the agents running on your SSH machines alongside the ones on this Mac. ed usage machines on its own runs ls.

- Canonical URL: https://getedith.pro/docs/cli/usage/machines
- Updated: 2026-12-02

Counts the agents running on your SSH machines alongside the ones on this Mac.
`ed usage machines` on its own runs `ls`.

The collector Edith runs here is piped to the machine and run against that
machine's home directory, and the numbers come back into the same `usage.json`
the dashboard reads. The collected file keeps local source names such as `cli`
and `codex`. When the refresh pipeline folds it into the fleet document, each
one becomes `machine:<lowercase-machine-uuid>:<agent>`. The UUID is stable
across a rename, so `ed usage summary` does not double count a renamed machine
and `--machine` keeps selecting the same agents.

Removing and re-adding a machine with the same unique name reconnects its saved
usage history and collection choice on the next refresh. Collection uses the new
SSH registration and checks that the remote hostname matches the saved history
before updating it. The usage UUID stays unchanged, so chart selections and
historical totals are preserved. Ambiguous names are not automatically linked.
Every refresh records, per machine, when collection was last attempted, when it
last succeeded and why the latest attempt failed. A machine is due again 20
minutes after its last successful collection, so the 15 minute background
refresh never skips it. The dashboard marks a machine stale once its last
successful collection is more than 40 minutes old and shows the failure reason
next to it, for example that the Machines extension is not running. When the Machines extension
starts or updates, the Mac wakes or the network comes back, Usage collects any
due machines again without waiting for the next scheduled refresh.

Whatever the collector needs and cannot find there, jq, bun and ccusage, is
installed under `~/.cache/edith` on that machine. That is why collecting waits
to be asked rather than happening for every machine you have configured, and why
the first run on a machine can take minutes.

The matching controls under Edith's Agent Usage settings use the same selection,
collection and forget operations as these commands. Enabling or disabling a
machine in either place is visible in the other, and both collection paths obey
the same single-round lock and successful-machine signup rule.

## `ed usage machines ls`

Lists every configured machine, whether it is counted, and what it has given.

```
ed usage machines ls [--json]
```

| Name | Type / values | Default | What it does |
| --- | --- | --- | --- |
| `--json` | flag | off | Emit JSON on stdout |

`--json` shape, an array with one object per configured machine, whether or not
it has ever been collected:

```json
[
  {
    "collectedAt": "2026-08-08T16:14:51Z",
    "cost": 249.81,
    "counted": true,
    "days": 81,
    "host": "devbox",
    "id": "1F0A9C22-4E64-4C63-9E0B-2F5A1E7D2C10",
    "machine": "Devbox",
    "refreshAttemptedAt": "2026-08-08T16:14:51Z",
    "refreshFailure": null,
    "refreshSucceededAt": "2026-08-08T16:14:51Z",
    "sources": ["cli"],
    "tokens": 321812580
  }
]
```

A machine that has never been collected still appears, with `collectedAt`,
`host` and the `refresh` fields as `null`, `sources` empty, and `days`, `cost`
and `tokens` at zero. The human table writes `-` in those columns instead. The
`REFRESH` column reads `ok` or `failed`, and a failed machine is followed by a
note with `refreshFailure`.

```
$ ed usage machines
MACHINE     COUNTED  COLLECTED             REFRESH  SOURCES  COST    TOKENS
Devbox  yes      2026-08-08T16:14:51Z  ok       1        249.81  321812580
```

Reads only, mutates nothing, needs no app. With no machines configured at all it
exits 3 with `no machines are configured`.

## `ed usage machines collect`

Runs the collector on a machine over the shared SSH connection and folds the
result in.

```
ed usage machines collect [<machine>] [--once] [--verbose] [--timeout <seconds>] [--json]
```

| Name | Type / values | Default | What it does |
| --- | --- | --- | --- |
| `<machine>` | machine name, ssh alias or id | every machine already taking part | Which machine to collect. Naming one also signs it up for later refreshes unless `--once` is passed |
| `--once` | flag | off | Collect without signing the machine up, so later refreshes skip it |
| `--verbose` | flag | off | Print everything the collector said on the machine, on stderr |
| `--timeout` | integer seconds, greater than 0 | `900` | Give up on a machine after this long |
| `--json` | flag | off | Emit JSON on stdout |

`--json` shape:

```json
{
  "collected": [
    {
      "cost": 249.81,
      "days": 81,
      "id": "1F0A9C22-4E64-4C63-9E0B-2F5A1E7D2C10",
      "machine": "Devbox",
      "sources": ["cli"],
      "tokens": 321812580
    }
  ],
  "failed": [],
  "merged": true
}
```

`sources` names the agents as that machine knows them, so `cli` there becomes
`machine:1f0a9c22-4e64-4c63-9e0b-2f5a1e7d2c10:cli` once it has been folded in.

`merged` says whether the numbers reached `usage.json`. The command runs the
merge itself, in this process, so it does not need the app; it is `false` only
when the merge could not run at all, and the numbers then sit on disk until the
next `ed usage refresh`. A refresh already running elsewhere counts as merged,
because that run picks the new files up.

Every machine is collected at the same time, so a round takes as long as its
slowest machine. Machines on this network get 3 seconds to accept the SSH
connection and others get 6, a recoverable connection failure is retried once,
and a machine that is still running after `--timeout` plus two minutes is
stopped and listed in `failed`.

Progress goes to stderr as each machine lands, so stdout stays parseable:

```
  ▸ Devbox  5 days · 1 agent                   7.19s
```

Two collections never run at once. The second stands aside with `another
collection is already running`, whether it came from another `ed`, the menu bar
app's own half-hourly round, or the button in Usage settings.

```
ed usage machines collect "Devbox"
ed usage machines collect devbox --once
ed usage machines collect --timeout 1800 --verbose
ed usage machines collect --json | jq '.collected[].sources'
```

Failures are per machine rather than fatal: a machine that cannot be reached is
listed in `failed` with its error while the others still count. The command only
fails when nothing at all was collected, and then it exits 4 with the first
error. With no machine named and none signed up yet it exits 3 with `no machine
is counted towards usage yet`. A `--timeout` of zero or less exits 2.

Collecting also prunes stored usage for machines that are no longer in the
directory, so removing a machine and collecting again forgets it.

The merge canonicalizes both current UUID-based ids and older slug-based ids.
When history contains a renamed machine or a replaced machine with the same
agent sessions, the current record wins instead of both histories being added.
Unrelated machine UUIDs remain independent.

## `ed usage machines enable`

Signs a machine up so every later refresh collects it.

```
ed usage machines enable <machine> [--json]
```

| Name | Type / values | Default | What it does |
| --- | --- | --- | --- |
| `<machine>` | machine name, ssh alias or id | required | Which machine to count |
| `--json` | flag | off | Emit JSON on stdout |

```json
{
  "counted": true,
  "machine": "Devbox"
}
```

This only changes whether the machine takes part; it collects nothing by itself,
so a machine enabled but never collected still reports nothing until a refresh
runs. A name that matches no machine exits 3.

## `ed usage machines disable`

Stops collecting from a machine while keeping the numbers it already gave.

```
ed usage machines disable <machine> [--json]
```

| Name | Type / values | Default | What it does |
| --- | --- | --- | --- |
| `<machine>` | machine name, ssh alias or id | required | Which machine to stop collecting |
| `--json` | flag | off | Emit JSON on stdout |

```json
{
  "counted": false,
  "machine": "Devbox"
}
```

The machine's existing sources stay in `usage.json` and keep counting towards
every total. Use `forget` to drop them. A name that matches no machine exits 3.

## `ed usage machines forget`

Drops everything a machine gave and stops counting it.

```
ed usage machines forget <machine> [--json]
```

| Name | Type / values | Default | What it does |
| --- | --- | --- | --- |
| `<machine>` | machine name, ssh alias or id | required | Which machine to drop |
| `--json` | flag | off | Emit JSON on stdout |

```json
{
  "dropped": true,
  "machine": "Devbox",
  "merging": true
}
```

`dropped` is `false` when there was nothing stored for that machine, and then
`merging` is `false` too, because the fold only runs when something actually
went away. That fold is the same in-process pipeline `ed usage refresh` runs, so
no app is involved: the numbers leave `usage.json` there and then. A refresh
already running elsewhere counts as merged, since it will pick the change up.
This is the one verb here that accepts a raw id for a machine that is no longer
in the directory, so usage left behind by a deleted machine can still be
cleared.

## Where to go next

- [`ed usage`](https://getedith.pro/docs/cli/usage), the rest of this group
- [All `ed` commands](https://getedith.pro/docs/cli)

## Get Edith

Edith is a native Mac app for macOS 14 or later on Apple silicon with 100+ extensions, the `ed` command line and an MCP server. $35 once for one Mac, plus $7 for each additional Mac, with no subscription and a 30-day refund.

- [Buy Edith](https://getedith.pro/pricing): $35 once for one Mac, plus $7 for each additional Mac
- [Download Edith](https://getedith.pro/download): the installer, or Homebrew
