swarmy 0.2.12

Real-time analytics dashboard for coding agents (Claude Code, Antigravity, Codex): live swarm, history, API-equivalent spend, weekly limits, and a vault for OAuth logins
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
# swarmy

**A real-time analytics dashboard for your coding agents: Claude Code, Antigravity and Codex,
together, in your terminal.**

[![CI](https://github.com/koorchik/swarmy/actions/workflows/ci.yml/badge.svg?branch=main)](https://github.com/koorchik/swarmy/actions/workflows/ci.yml)
[![Release](https://img.shields.io/github/v/release/koorchik/swarmy?sort=semver)](https://github.com/koorchik/swarmy/releases/latest)
[![License: MIT OR Apache-2.0](https://img.shields.io/badge/license-MIT%20OR%20Apache--2.0-blue)](#license)
[![Platforms](https://img.shields.io/badge/platforms-Linux%20%7C%20macOS%20%7C%20Windows%20%7C%20Raspberry%20Pi-lightgrey)](#platforms)

You run several coding agents at once, each with a crowd of subagents, maybe from more than one
client. swarmy puts all of them on one screen and keeps the numbers behind them:

- **Live.** Every agent and subagent of every session, whichever client runs it: what it does
  right now, what it costs, and the moment one needs you (with a key that takes you there).
- **History.** Every request is kept in a local index and outlives the clients' own 30-day
  transcript retention: days, weeks and months to compare, rolled up so it stays small.
- **Analytics across clients, together.** Spend at API prices, weekly limits, models, projects,
  worktrees, agent types, tools and waiting time, for Claude Code, Antigravity and Codex in the
  same tables: one repository is one project whichever client worked on it, and every number can
  be split by client when you want to compare them.

swarmy is an observer, not a launcher: it never starts, prompts or controls an agent. Keep running
your agents the way you do now (plain terminals, tmux, [herdr](#how-it-compares), claude-squad,
worktrees) and put swarmy in a spare terminal next to them.

<p align="center">
  <img src="docs/img/boot.gif" width="812" alt="swarmy starting up: the swarm assembles into the dashboard">
</p>

```sh
curl -fsSL https://raw.githubusercontent.com/koorchik/swarmy/main/install.sh | sh   # Linux, macOS
swarmy demo     # try it on a made-up world, no agents or accounts needed
```

Homebrew, cargo, Nix, mise, `.deb`/`.rpm` and Windows: [Quick start](#quick-start).

## What you get

- **Every agent of every session, live.** One tree across all your Claude Code config dirs: what
  each agent is doing right now (thinking, running `cargo test`, waiting for its own agents,
  stalled), for how long, its model and effort, context fill, cost, and a 30-minute activity lane.
- **The moment one needs you, and a key to get there.** A permission prompt, a question or a plan
  to approve blinks in the tree, rings the terminal bell and goes to the top of ATTENTION. `J`
  jumps straight to that Claude Code's pane or window (tmux, Zellij, kitty, WezTerm, iTerm2, Warp);
  `swarmy jump` does the same from a key binding.
- **Where the weekly limit went, and when it runs out.** Per account: the week used, the share
  each project took, and the time it runs out at the current pace. Early limit resets and logins
  moved between config dirs are followed.
- **Spend at API prices.** By project, account, model, effort, agent type, session, agent and day,
  with trends against the previous period, the model mix, cache hits and thinking.
- **Worktrees and branches.** Each session shows the checkout it works in (`shop/fix-1` for a git
  worktree) and its branch; `⇄2` warns when two live sessions edit the same checkout. Spend per
  worktree and per branch, and how much of each project's work ran in worktrees.
- **Three clients, one picture.** Claude Code, Google Antigravity (`agy`) and OpenAI Codex sit in
  the same tree, panels and reports; Claude, Gemini and GPT models priced at their makers' list
  prices; PROJECTS shows which clients worked on each repository (`cc+agy+cdx`), MODELS which
  client ran each model, BURN today's split; `--harness` and `--by harness` compare them.
- **A status line inside Claude Code.** Who needs you in your other sessions, this session's
  agents, the exact week used and when it runs out.
- **A vault for several accounts.** Save each config dir's login, put another account's login in
  when a limit runs out, and switch back; one login can serve several seats, and agy's Google
  logins switch the same way. A switch never loses a token.
- **Offline, read-only, light.** No network, no telemetry. It reads what the clients already
  write. About 2 CPU-seconds a minute with 20 live agents on a 4K terminal. One static binary
  with SQLite built in.

<p align="center">
  <img src="docs/img/demo.gif" width="974" alt="the dashboard: an agent asks for permission, ATTENTION lists it first, the AGENT panel shows what it waits for">
  <br><sub>A session asks for permission: it is marked in the tree, comes first in ATTENTION and fills the AGENT panel. (All media is from <code>swarmy demo</code>: made-up data.)</sub>
</p>

## How it compares

People who run many agents usually also use one of two other kinds of tool. swarmy sits between
them and works alongside either.

- **Launchers and multiplexers**: [herdr]https://herdr.dev,
  [claude-squad]https://github.com/smtg-ai/claude-squad,
  [ccmanager]https://github.com/kbwo/ccmanager, [Conductor]https://www.conductor.build. They
  start your agents, own their terminals, give each one a worktree, keep sessions across restarts
  and let you prompt them. herdr in particular is a full terminal workspace for agents that also
  marks each pane as working, blocked or done.
- **Usage counters**: [ccusage]https://github.com/ccusage/ccusage,
  [Claude Code Usage Monitor]https://github.com/Maciek-roboblog/Claude-Code-Usage-Monitor. They
  turn the transcripts into tokens and dollars, and ccusage reads many more agent CLIs than swarmy.

What swarmy adds:

- **One live view of every agent, subagents included,** across all your Claude Code config dirs,
  Antigravity and Codex, whoever started them: a launcher sees the panes it owns, not the twenty
  subagents working inside one session.
- **History and analytics across clients.** Claude Code, Antigravity and Codex in one index
  that keeps every request for good (rolled up), so a repository's work from all three clients
  adds up in one place and can be compared day by day, model by model, client by client.
- **Money and limits next to the agents.** What each agent and session costs as it runs, where each
  account's weekly limit went by project, and when it runs out at the current pace.
- **Several accounts.** Every config dir is found on its own; a vault moves OAuth logins between
  them without losing a token.
- **Local only.** One binary on your machine: no server, no account to sign up for, no cloud
  relay, no telemetry, no network calls at all. Your transcripts, spend and logins never leave
  the machine.
- **Hands off.** No hooks or wrappers around the agents unless you turn on the
  [limit guard]#the-limit-guard, and no automation that types into them. It only reads what
  Claude Code, Antigravity and Codex already write to disk, so nothing changes in how you run them.

| | swarmy | launchers (herdr, claude-squad, …) | usage counters (ccusage, …) |
|---|---|---|---|
| starts, prompts, keeps agents | no | yes | no |
| several clients in one view and history | yes (Claude Code, Antigravity, Codex) | many CLIs, live only | ccusage: many CLIs, reports |
| worktree per agent | shows them | creates them | no |
| live state of every agent | yes, with subagents | yes, per pane | no |
| cost at API prices | live and in reports | no | in reports |
| weekly limit per account and project | yes | no | partly (5-hour blocks) |
| several accounts and config dirs | yes, with a login vault | no | merged or separate |
| servers, accounts, network | none | varies (remote and cloud options) | none |

What the others do better: a launcher runs the work (sessions that survive a reboot, worktrees on
demand, remote machines), and ccusage covers far more agent CLIs. `J` jumps into tmux, Zellij,
kitty, WezTerm, iTerm2 and Warp panes; herdr's own panes are not among them yet.

## Quick start

### 1. Install

Pick your system; the first line is the one we recommend. Every way installs the same release.

**macOS** (Apple silicon and Intel, signed and notarized)

| Way | Install | Update |
|---|---|---|
| **Homebrew** (recommended) | `brew install koorchik/tap/swarmy` | `brew upgrade swarmy`, or with everything on `brew upgrade` |
| Install script | `curl -fsSL https://raw.githubusercontent.com/koorchik/swarmy/main/install.sh \| sh` | run the same line again |
| cargo binstall | `cargo binstall swarmy` | `cargo binstall swarmy` again |
| cargo, from source | `cargo install --locked swarmy` | the same command again |
| Nix | `nix profile install github:koorchik/swarmy` | `nix profile upgrade swarmy` |
| mise | `mise use -g github:koorchik/swarmy` | `mise upgrade`, with your other tools |

**Linux** (any distribution, x86_64 and ARM, Raspberry Pi included)

| Way | Install | Update |
|---|---|---|
| **Install script** (recommended) | `curl -fsSL https://raw.githubusercontent.com/koorchik/swarmy/main/install.sh \| sh` | run the same line again |
| Homebrew | `brew install koorchik/tap/swarmy` | `brew upgrade swarmy`, or with everything on `brew upgrade` |
| Debian, Ubuntu, Raspberry Pi OS | the `.deb` from [Releases], then `sudo apt install ./swarmy_*.deb` | the new `.deb`, installed the same way |
| Fedora, RHEL, openSUSE | the `.rpm` from [Releases], then `sudo dnf install ./swarmy-*.rpm` | the new `.rpm`, installed the same way |
| cargo binstall | `cargo binstall swarmy` | `cargo binstall swarmy` again |
| cargo, from source | `cargo install --locked swarmy` | the same command again |
| Nix | `nix profile install github:koorchik/swarmy` | `nix profile upgrade swarmy` |
| mise | `mise use -g github:koorchik/swarmy` | `mise upgrade`, with your other tools |

**Windows** (x86_64)

| Way | Install | Update |
|---|---|---|
| **Zip** (recommended) | the `.zip` from [Releases]: put `swarmy.exe` on your `PATH` | replace `swarmy.exe` with the one from the new `.zip` |
| cargo binstall | `cargo binstall swarmy` | `cargo binstall swarmy` again |
| cargo, from source | `cargo install --locked swarmy` | the same command again |

[Releases]: https://github.com/koorchik/swarmy/releases/latest

The install script downloads the release binary for your machine, checks its SHA-256 and puts it
in `~/.local/bin`; no sudo, nothing else is changed ([the script](install.sh)). Nix builds from
`main`, so it can be ahead of the latest release; mise learns of a release up to a day late;
[cargo-update] updates every cargo-installed crate at once.

**Updates are yours to start**: swarmy never checks for new versions (it makes no network calls).
To hear about a release, use *Watch → Custom → Releases* on GitHub. A dashboard that is open keeps
running the old version: quit it (`q`) and start `swarmy` again. The status line needs nothing,
Claude Code starts it anew after each response. The index, the vault and the config carry over.

[cargo-update]: https://github.com/nabijaczleweli/cargo-update

<details>
<summary>Download by hand, Raspberry Pi and other targets</summary>

Every [release](https://github.com/koorchik/swarmy/releases/latest) has one static binary per
platform, with the man page and shell completions; `SHA256SUMS` covers every file.

```sh
V=0.2.12 T=x86_64-unknown-linux-musl     # T from the table below
curl -fLO https://github.com/koorchik/swarmy/releases/download/v$V/swarmy-$V-$T.tar.gz
tar xzf swarmy-$V-$T.tar.gz && install -m 755 swarmy-$V-$T/swarmy ~/.local/bin/
```

| Machine | `T` | Packages |
|---|---|---|
| x86_64 PC or server | `x86_64-unknown-linux-musl` | `_amd64.deb`, `.x86_64.rpm` |
| 64-bit ARM: Raspberry Pi 3/4/5 on a 64-bit OS, ARM servers | `aarch64-unknown-linux-musl` | `_arm64.deb`, `.aarch64.rpm` |
| Raspberry Pi 2–5 on 32-bit Raspberry Pi OS | `armv7-unknown-linux-musleabihf` | `_armhf.deb`, `.armv7hl.rpm` |
| Raspberry Pi Zero, Zero W, 1 (ARMv6) | `arm-unknown-linux-musleabihf` | `_armhf.deb` |
| Mac, Apple silicon or Intel | `universal-apple-darwin` | Homebrew |
| Windows x86_64 | `x86_64-pc-windows-msvc` (`.zip`) | |

The Linux binaries are linked statically against musl, so one file runs on every distribution,
old or new; the `.deb` and `.rpm` packages wrap the same binary (the single `armhf` `.deb`
carries the ARMv6 build, which runs on every 32-bit Raspberry Pi). The macOS binary is signed
with a Developer ID and notarized by Apple.

`install.sh` takes `SWARMY_VERSION` (a version instead of the latest) and `SWARMY_INSTALL_DIR`
(instead of `~/.local/bin`).

</details>

<details>
<summary>Build from source</summary>

With a recent stable Rust and a C compiler (SQLite is built in):

```sh
cargo install --locked --git https://github.com/koorchik/swarmy    # the latest main
```

Without Rust, with Docker: the static Linux binaries, archives and packages land in `dist/`;
run the binary on the host. More in [Building from source](#building-from-source).

```sh
git clone https://github.com/koorchik/swarmy && cd swarmy
docker build --output dist .
```

</details>

### 2. Run

```sh
swarmy demo      # try it on a made-up world first; nothing of yours is read
swarmy           # the live dashboard
swarmy doctor    # what it found: config dirs, transcripts, index, limits
swarmy setup     # optional: the status line (exact limits) and saved logins
```

swarmy finds `~/.claude`, every `~/.claude-*` and the `CLAUDE_CONFIG_DIR` of running `claude`
processes on its own; other config dirs go into the [configuration](#configuration).

## Screens

On a big terminal everything is on one wall; nothing hides behind tabs.

![the whole wall on a 4K terminal (326×81)](docs/img/wall.png)

The layout follows the terminal: a **wall** from 180×45, a **column** from 110×40, **tabs** below
that (`L` switches by hand). Every panel can be zoomed (`z`).

| | |
|---|---|
| ![a 200×60 terminal]docs/img/wall-small.png **200×60** — the same wall, the bottom panels in two rows | ![half a 4K screen]docs/img/column.png **160×81** — the panels stacked in a column |
| ![a laptop terminal]docs/img/tabs.png **140×34** — a laptop terminal: five tabs | ![LIMITS zoomed]docs/img/limits.png **LIMITS · SEATS zoomed** — the week per account and where it went |

| Panel | What it shows |
|---|---|
| **1 SWARM** | live agents grouped by session, each with its state, activity, context and cost and a 30-minute activity lane (`v`: spend per 15 minutes instead); each session's checkout (`shop/fix-1` in a worktree), branch, and `⇄N` when sessions share a checkout; what finished recently |
| **2 LIMITS · SEATS** | each account's week used, 5-hour window, reset and "runs out in …"; seats and saved logins; the week as a curve per account with the projection to the reset; where each account's week went by project |
| **3 BURN** | dollars per hour and what burns them: the rate of each model over the last hour, and its spend per minute |
| **4 ATTENTION** | needs you, stalled, a limit about to run out, two agents editing one file, logins not saved or about to expire; the event log |
| **5 AGENT** | the selected agent: card, last message, cost of each request, context growth, compactions, tool timeline |
| **6 PROJECTS** | which clients worked on it (`cc+agy`), live agents, $/hour, today, the period with ▲▼ against the previous one, the share made in worktrees, share of the week |
| **7 MODELS** | spend and trends per model, cache hits, thinking, effort, project × model |
| **8 HISTORY** | 14 days stacked by model (`←→` picks a day), a weekday × hour heat map |
| **9 EFFICIENCY** | where agent time goes (tools, slowest commands), how long agents waited for you, what a prompt costs, cache savings, agent types, fleet size, rate limits, file conflicts, what a subscription is worth |
| **0 SYSTEM** | Claude Code processes with their CPU, RAM and disk; the size of swarmy's index |

## Keys

| Key | Action |
|---|---|
| `Tab` `Shift-Tab` · `1`–`9` `0` | next / previous panel · focus a panel by number (again: zoom); in tabs, `1`–`5` switch tabs |
| `↑↓` `PgUp` `PgDn` · `Enter` | move in the focused panel · open: agent → details, alert → go to it, project → its agents, seat → pick a login |
| `n` `N` | next / previous thing that needs attention |
| `J` | jump to the selected agent's Claude Code (tmux, Zellij, kitty, WezTerm, iTerm2, Warp) |
| `/` | filter: words, `p:project`, `m:model`, `s:seat`, `state:needs` |
| `:` | commands: `switch <seat> <login>`, `capture <seat>`, `period 7d`, `layout wall` |
| `t` · `g` · `v` | period (today, 7d, 30d, all) · spend grouping · SWARM lanes ↔ spend |
| `z` · `Esc` | zoom the focused panel · back (closes dialogs, zoom, filter) |
| `m` · `p` · `T` · `L` | mask names · pause animations · theme · layout |
| `.` | LIMITS · SEATS: show / hide the seats of a client that were never used (`hidden:` line) |
| `?` · `q` | keys and a legend of every glyph, number, colour and word · quit |

The mouse works too: a click focuses a panel or selects an agent, the wheel scrolls.

### On the command line

```sh
swarmy limits                         # weekly / 5-hour limits: shares per project, when they run out
swarmy report --by project            # spend; --by worktree|branch|account|seat|harness|model|effort|agent-type|session|agent|day|hour|weekday
swarmy report --by project --checkout worktrees   # only the work done in git worktrees (main: the rest)
swarmy report -p 30d --by day --format csv
swarmy models -p 7d                   # per model: cost, cache hits, thinking, effort mix, substitutions
swarmy accounts                       # seats, saved logins and the limit left on each
swarmy prices                         # the price in force for every model and where it comes from
swarmy jump                           # jump to the Claude Code that has waited for you longest
swarmy limits --seat current --format json   # for an agent: the limits of the account it runs on
```

Periods: `today`, `yesterday`, `week` (the current limit window, the default), `month`, `all`,
`24h`, `7d`, `YYYY-MM-DD`, `FROM..TO`. Reports take `--account`, `--seat`, `--harness`,
`--project`, `--model` and `--checkout` filters. `report`, `models`, `prices` and `limits` take
`--format table|json|csv`. Every command takes `--mask`. `swarmy help <command>` lists a
command's options; `swarmy man` and `swarmy completions <shell>` print the man page and shell
completions.

`swarmy limits --format json` gives, per account, the seats holding it and its saved logins, and
per window the reading, the estimate now, its `level` (`ok`, `warn`, `bad`, `reached`),
`runs_out_at`, `at_reset` (where it ends at this pace) and the guard's line and state.
`--seat current` keeps only the account of the Claude Code running the command
(`CLAUDE_CONFIG_DIR`, else `~/.claude`), so an agent can watch its own limit. The
[limit guard](#the-limit-guard) does the watching for it.

## The status line

![the swarmy status line under a Claude Code prompt](docs/img/statusline.png)

`swarmy setup` adds swarmy's status line to Claude Code. It is optional: the dashboard works
without it. Claude Code then shows under its prompt:

- **▲ who needs you** in your *other* sessions, with the way there (`swarmy`, then `n` and `J`,
  or `swarmy jump`; bind it to a tmux key: `bind-key y run-shell "swarmy jump"`, or in kitty:
  `map ctrl+shift+y launch --type=background swarmy jump`);
- **◐ this session's agents** and their states;
- **this account's week**, exact, and when it runs out at the current pace;
- the 5-hour window, context fill, the session's cost and its dollars per hour.

On a narrow terminal the less important pieces go first; "needs you" and the week stay. With the
dashboard running, the status line reads the small summary it writes; without it, it finds the
waiting sessions in Claude Code's session registry. Either way it only reads files and takes a
few milliseconds.

The status line also makes the dashboard's limits exact: Claude Code passes it the real numbers
after every response, and swarmy keeps each reading. A status line you already have is kept and
shown first (`swarmy statusline --then '<your command>'`). Every changed `settings.json` is backed
up next to it first.

```sh
swarmy setup              # asks before each change
swarmy setup --yes        # no questions
swarmy setup --no-vault   # only the status line
swarmy setup --remove     # take it out again (restores the one it wrapped)
swarmy setup --guard      # the limit guard, seat by seat (below)
```

By hand, add this to each config dir's `settings.json`; `swarmy doctor` says which have it:

```json
"statusLine": { "type": "command", "command": "/path/to/swarmy statusline" }
```

## The limit guard

Optional, for long runs: keep part of an account's week for yourself, and have agents stop
before they use it.

```toml
# config.toml
[guard]
week = 85                  # agents stop at 85% of the week, on every account
wrap_up = 5                # and are told to wrap up 5 points before (0: no warning)

[guard.account.personal]   # one account's own line: a saved login's label or email, an
                           # [accounts] name or the account uuid (`swarmy doctor` checks it)
week = 80
five_hour = 95
```

`swarmy setup --guard` asks, seat by seat, whether to add a `PreToolUse` hook to the seat's
`settings.json` (backed up first). Claude Code then runs `swarmy guard` before every tool call
in that seat, in subagents too:

- **below the line minus `wrap_up`** nothing happens;
- **within `wrap_up` of it** the call goes on, and each agent is told once: finish the step you
  are on, leave the work where someone can pick it up, write down what is done and what is left;
- **at the line** the call is refused and the agent is asked for that summary; a tool call in
  its next response ends its turn, and Claude Code shows you why and how to go on.

The guard acts on the exact numbers the [status line](#the-status-line) records after every
response, so a seat needs the status line to be guarded. Seats on one account share its limit:
the newest number from any of them counts. A seat without the hook keeps working, so the rest of
the week stays yours there. The guard reads a few small files and never stands in the way by
mistake: anything it cannot read lets the call go on, and so does a new window. After a vault
switch it waits for the new account's numbers.

```sh
swarmy setup --guard            # add the hook to the seats you pick
swarmy setup --guard --remove   # take it out again
SWARMY_GUARD=off claude         # one Claude Code that the guard lets through
swarmy doctor                   # which seats are guarded, and the line of every account
```

## Limits and accounts

A **seat** is a Claude Code config dir; a **login** is an OAuth sign-in; an **account** is the
Anthropic account behind a login. Seats logged into the same account share one limit, and swarmy
counts it once.

- **Readings.** With the status line, the limit is exact after every response. Without it,
  swarmy reads the utilization Claude Code caches now and then (as `/usage` shows it) and
  estimates in between from your spend; estimates are marked `≈`.
- **Where it went.** Spend inside the window is split by project, and a project's share of the
  week is its share of that spend. Utilization also counts claude.ai, the desktop app and other
  computers, which leave no trace here: when two accounts share a plan, the gap is shown as
  *used elsewhere*.
- **When it runs out** is the current burn rate projected to the reset, drawn as a curve against
  the 100% line.
- **Early resets.** When a limit is reset before its time, utilization falls while the window is
  still open; swarmy sees the fall and counts the window from there.
- **Which account.** Each request is attributed to the account that made it (Claude Code's
  `session-owner` records, else the seat's login history), so moving logins between seats never
  mixes accounts up.

How Anthropic meters limits is not public, so the shares and projections are estimates.

## The vault

![picking a saved login for a seat](docs/img/vault-picker.png)

Two words keep it straight:

- a **seat** is a config dir a client runs in (`~/.claude`, `~/.claude-work`,
  `~/.gemini/antigravity-cli`, `~/.codex`): it holds one login at a time;
- a **saved login** (⚿) is a sign-in the vault keeps. It fits the seats of its own client only (a
  Claude Code login never goes into an Antigravity seat) and may be in several seats at once.

LIMITS · SEATS shows both, per client: a table of seats with the login in each, then a table of
saved logins with the seats each is in (or *free*). When one account's week runs out, put another
account's login into the seat and carry on; switch back after the reset. `Enter` on a seat lists
the saved logins that fit it, the one with the most limit left first; `S` puts that one in
directly. `Enter` on a saved login picks the seats for it.

```sh
swarmy accounts                               # seats and saved logins, per client (--all: empty seats too)
swarmy accounts capture work --label alice    # save the login of seat "work"
swarmy accounts add --label bob               # log into another account in a scratch seat, save it
swarmy accounts add --harness agy --label bob # the same for Antigravity (labels are per client)
swarmy accounts add --harness codex --label bob # and for Codex
swarmy accounts switch work bob               # put bob into seat "work"
swarmy accounts switch work alice             # and back
swarmy accounts import backup.json --label carol
```

What keeps it safe:

- **A switch never loses a token.** It first saves whatever the seat holds; a login not in the
  vault yet is saved under the seat's name.
- **All or nothing.** Both files of the seat are backed up (the last 20 per seat). The login is
  written atomically, keeping the seat's MCP tokens, and only while the file still holds what was
  just saved. `.claude.json` is merged as Claude Code last wrote it, never over a version swarmy
  has not read. If the second write fails, the first is put back.
- **One transaction at a time.** Every change to the vault holds an OS lock and re-reads the
  vault under it, so a dashboard and a command running at once never lose each other's logins.
  The vault's own files are backed up before each change (the last 30).
- **No surprises.** A switch refuses while Claude Code or agy runs in that seat (`--force` to
  insist), and a login only ever goes into seats of its own client.
- **Codex logins stay in one seat.** OpenAI's refresh tokens are single-use, so two seats sharing
  one would sign each other out. Putting a Codex login into another seat moves it: the two seats
  swap their logins (or the one it leaves is left without one, its copy saved). Never while Codex
  runs in either seat.
- **It follows Claude Code.** When Claude Code refreshes a seat's access token, the saved copy
  takes it; a new `/login` is shown as *not saved* instead of overwriting the saved one.

Secrets live in swarmy's data dir in `vault/secrets.json`, readable only by you: the same
protection Claude Code gives the same tokens in `.credentials.json`. On macOS, where Claude Code
keeps the login in the Keychain, the vault cannot switch logins yet.

Use it with your own accounts, within your provider's terms.

## Storage

Claude Code deletes transcripts after 30 days (`cleanupPeriodDays`); after that, swarmy's index
is the only record of them. The index keeps two weeks of per-request detail and quarter-hour
rollups of everything older, with every dimension a report groups by. A heavy user (25,000
requests a day) stays under 0.5 GB after a year instead of about 9 GB; a typical one (5,000 a
day) under 120 MB.

- **No number changes.** Every report, panel and period gives the same totals before and after a
  rollup; `swarmy compact --verify` checks that on a scratch copy of your own index.
- **It runs itself.** The dashboard rolls up what aged out every six hours (a day costs about a
  CPU-second). `swarmy compact` does it by hand: `--dry-run` shows what would move, `--vacuum`
  gives the freed space back to the disk.
- **What goes after two weeks:** an old agent's per-request chart and tool timeline, exact
  request times and API error texts.

`swarmy doctor` and the SYSTEM panel show the index size, its growth per day and where it will be
in a year. The design: [`docs/design/storage.md`](docs/design/storage.md).

### Light on the battery

Only the running sessions' transcripts are read every second, and only the files that changed;
heavier figures refresh every minute to ten minutes; the full process table and the disks are
read only while SYSTEM is open. On a 4K wall with 15–20 live agents the dashboard takes about 2 CPU-seconds a minute
(≈3.4% of one core). On battery (Linux, macOS) or with `--eco` it redraws twice a second and
refreshes every 3 seconds.

## Privacy

- **No network access and no telemetry.** Nothing leaves your machine.
- **Read-only.** swarmy reads Claude Code's directories and writes into them only when you ask:
  a vault switch, and `swarmy setup` (after a yes, with a backup). The limit guard, when you add
  it, only reads; it keeps notes of what it told whom in swarmy's own data dir.
- **Its own data** (the index, the vault, the status-line readings) lives in swarmy's data dir:
  `~/.local/share/swarmy/` on Linux, `~/Library/Application Support/swarmy/` on macOS,
  `%APPDATA%\swarmy\data` on Windows (`SWARMY_DATA_DIR` moves it).
- **Screen sharing.** `--mask` (or `m` in the dashboard) hides emails, names and full paths;
  `SWARMY_MASK=1` does the same for the status line.

## Configuration

Everything is optional. `config.toml` lives in swarmy's config dir (`~/.config/swarmy/` on Linux;
`swarmy doctor` prints the path; `SWARMY_CONFIG_DIR` moves it):

```toml
stall_minutes = 20                 # an unfinished agent with no activity this long is stalled
theme = "ops"                      # ops | phosphor | amber | plain

[[seat]]                           # config dirs that are not ~/.claude or ~/.claude-*
path = "~/agents/cc-work"
label = "work"

[[project]]                        # paths that moved or come from another machine
match = "/home/user/work/old-name"
name = "shop"

[[price]]                          # USD per million tokens, from a date
model = "claude-opus-5-5"
from = "2026-12-01"
input = 4
output = 20

[accounts]                         # display names
"<account uuid>" = "personal"

[subscription]                     # monthly price per account, for "what a subscription is worth"
personal = 200

[statusline]
segments = ["attention", "agents", "week", "five_hour", "context", "cost", "burn"]
lines = 2                          # a second line: model and effort, git branch, session name
refresh_seconds = 10               # written into Claude Code's refreshInterval by `swarmy setup`
reserve = 0                        # columns kept free for Claude Code's own notifications
mask = false                       # hide session names

[guard]                            # the limit guard (`swarmy setup --guard`)
week = 85                          # agents stop at 85% of the week (unset: no line)
five_hour = 100                    # 100: no line on this window
wrap_up = 5                        # told once to wrap up this many points before

[guard.account.personal]           # one account's lines (saved login label or email, or uuid)
week = 80

[storage]
keep_raw_days = 14                 # days of per-request detail; older spend is kept per quarter hour
budget_mb = 1024                   # doctor and SYSTEM warn when the index will pass this in a year
auto_compact = true                # the dashboard rolls up old detail on its own
```

`keep_raw_days` is at least 8 (the weekly window is always read from full detail) and at most two
days less than the shortest transcript retention of your seats. Nothing is ever deleted because of
`budget_mb`.

## How the numbers are made

- **Cost is API-equivalent, not your bill.** Every response's tokens (input, 5-minute and 1-hour
  cache writes, cache reads, output, web searches) times the list price of its model. On a
  subscription this is what the same work would cost through the API.
- **Each response counts once.** Claude Code writes one transcript record per content block, all
  with the same usage, so responses are de-duplicated by message id.
- **Prices are versioned data:** built in, overridden by the price table Claude Code caches,
  overridden by your `config.toml`, each from its date. A model without a price is flagged, never
  counted as $0.
- **What is missing:** background calls Claude Code makes without a transcript record (titles,
  summaries). `swarmy doctor` compares the totals with Claude Code's own counter; they typically
  agree within 1%.
- **Projects are git repositories;** worktrees count towards the repository they belong to, also
  after they are removed.

## Platforms

| | Linux | macOS | Windows |
|---|---|---|---|
| Dashboard, reports, status line | ✓ | ✓ | ✓ |
| Jump to a session (`J`, `swarmy jump`) | ✓ tmux, Zellij, kitty, WezTerm | ✓ tmux, Zellij, kitty, WezTerm, iTerm2, Warp | — |
| Vault: save and switch logins | ✓ | not yet (Keychain) | ✓ |
| Eco mode on battery | ✓ | ✓ | with `--eco` |

Jumping detects where a Claude Code runs (multiplexers take precedence over the outer terminal:
tmux → Zellij → kitty → WezTerm → iTerm2 → Warp). Notes per terminal:
- **tmux**: works inside tmux (`swarmy` switches your client to the target pane).
- **Zellij**: requires Zellij 0.44+ (`action focus-pane-id`) inside the same Zellij session.
- **kitty**: needs `allow_remote_control socket-only` and `listen_on unix:@kitty-{kitty_pid}` in
  `kitty.conf`; without them `J` says so.
- **WezTerm**: works out of the box via `WEZTERM_UNIX_SOCKET`, even from another terminal.
- **iTerm2** (macOS): focuses via AppleScript; macOS prompts once for Automation permission.
- **Warp** (macOS): opens the session's `warp://session/<id>` URL (`WARP_TERMINAL_SESSION_UUID`);
  no setup. For a session that is closed, Warp only comes to the front.

Linux is the main platform. The tests run on Linux, macOS and Windows in CI. Builds: Linux x86_64,
aarch64, ARMv7 and ARMv6 (static musl), macOS universal, Windows x86_64. Release details:
[`packaging/README.md`](packaging/README.md).

## Building from source

```sh
git clone https://github.com/koorchik/swarmy && cd swarmy
cargo build --release              # target/release/swarmy
cargo install --locked --path .    # or install it
```

Rust 2024 edition (a recent stable toolchain) and a C compiler for the bundled SQLite.
Distributions with a system `libsqlite3` can build with `--no-default-features`. The release
archives and packages are made by `tools/release-local.sh` (Linux and Windows) and the tag
workflow; see [`packaging/README.md`](packaging/README.md).

**With Docker only**: the [`Dockerfile`](Dockerfile) holds the release toolchain (Rust, zig,
`cargo-zigbuild`, `cargo-deb`, `cargo-generate-rpm`, the musl targets) at the versions CI uses.

```sh
docker build --output dist .                       # the four static Linux binaries, .deb, .rpm
docker build --build-arg TARGETS=x86_64-unknown-linux-musl \
             --build-arg NO_PACKAGES=1 --output dist .   # one binary, faster
# the toolchain as a shell on your checkout (builds stay in ./target, incremental)
docker build --target toolchain -t swarmy-toolchain .
docker run --rm -it -u "$(id -u):$(id -g)" -v "$PWD:/src" swarmy-toolchain tools/check.sh
```

The binaries are static: run swarmy on the host, not in the container. It watches the agents,
processes and terminals of the machine it runs on, which a container does not see.

## Contributing

Issues and pull requests are welcome. Before a pull request:

```sh
tools/check.sh                 # the gate: cargo fmt --check, clippy -D warnings, every test
tools/perf.sh                  # the battery budget, for changes to the worker, the index reads or the view (needs tmux)
tools/record-readme.sh         # refresh docs/img after visual changes
```

[`AGENTS.md`](AGENTS.md) holds the architecture, the rules and the reasons behind them. Tests use
synthetic data only, and screenshots come only from `swarmy demo`.

## License

MIT OR Apache-2.0, at your option: see [LICENSE-MIT](LICENSE-MIT) and
[LICENSE-APACHE](LICENSE-APACHE).