jmz-claude-fleet (0.1.0)
Installation
pip install --index-url jmz-claude-fleetAbout this package
Cross-machine overview of Claude Code sessions
claude-fleet
A terminal dashboard for triaging Claude Code
sessions across all your machines. Each host periodically reports its
~/.claude/projects sessions to a shared cache; claude-fleet merges those
per-host reports into one scrollable board so you can see what's running
everywhere, filter/search/classify it, and jump straight back into (or clean
up) any session — without SSHing around to check each machine by hand.
Claude Code's own session view is local-only; this is the cross-machine view.
How it works
each host shared cache this machine
┌───────────┐ report + push ┌─────────────────┐ pull ┌─────────────┐
│ reporter │ ─────────────────▶ │ <host>.json ×N │ ───────▶ │ claude-fleet │
│ (per host)│ (rsync / ssh) │ (a dir, e.g. a │ │ TUI │
└───────────┘ │ NAS over SSH) │ └─────────────┘
- Reporter (
claude-fleet-report) — a dependency-free scanner. Reads~/.claude/projects, writes<host>.json(host, project, topic, git branch, message count, first/last activity, live/idle/stale status, a short transcript tail, the claude.ai session id, and for running sessions how they run — background job id or interactive, the tmux pane (session:window.pane), busy/idle, name — from~/.claude/sessionsandtmux list-panes -a), and rsyncs it to the shared cache. Runs on a timer on every host. - Cache — just a directory of
<host>.jsonfiles. Any shared location works (a NAS over SSH, a synced folder, …). - TUI (
claude-fleet) — reads the merged cache (no SSH on the read path) and renders the board. Reading the overview never touches your hosts.
Install
There are two parts, and most hosts need only the first.
Reporter (every host)
Pure stdlib, runs on any python3 ≥ 3.9. It ships as a zipapp, so hosts need
nothing installed:
./scripts/build-reporter-zipapp.sh # -> dist/claude-fleet-report.pyz
python3 dist/claude-fleet-report.pyz report --help
TUI (the machine you look at the board on)
The package is jmz-claude-fleet (the import package and the commands are
claude_fleet / claude-fleet). Never install a bare claude-fleet: that name
on PyPI is an unrelated project, and pip or uv would install it. A pip
virtualenv from before the rename still holds the old claude-fleet
distribution: pip uninstall claude-fleet there before installing
jmz-claude-fleet (uv's --reinstall rebuilds the tool's environment anyway).
Needs python ≥ 3.11 and the tui extra: Textual, rapidfuzz and jmz-ktui, a
small shared TUI library. jmz-ktui is not on PyPI. It is published on a
Forgejo package index that needs no login, and its source is public:
- index:
https://git.mirus-tech.com/api/packages/jmz/pypi/simple - source:
https://git.mirus-tech.com/public/ktui
So an install names that index next to PyPI, and must take jmz-ktui from it
only: if a look-alike jmz-ktui ever appears on PyPI, an install that asks
both indexes for it may pick the impostor (dependency confusion). With
uv:
uv tool install --no-sources --index-strategy first-index \
--index https://git.mirus-tech.com/api/packages/jmz/pypi/simple \
"jmz-claude-fleet[tui] @ git+https://git.mirus-tech.com/jmz/claude-fleet"
uv searches --index before PyPI and, with first-index (uv's default,
spelled out so a config file cannot switch it to unsafe-best-match), takes a
package from the first index that has it, never from PyPI as well.
With pip (a virtualenv of its own), install jmz-ktui alone from the index
first; the second install then finds it satisfied and never asks PyPI for it:
python3 -m venv ~/.local/share/claude-fleet
~/.local/share/claude-fleet/bin/pip install --no-deps \
--index-url https://git.mirus-tech.com/api/packages/jmz/pypi/simple "jmz-ktui>=0.1.3,<0.2"
~/.local/share/claude-fleet/bin/pip install \
"jmz-claude-fleet[tui] @ git+https://git.mirus-tech.com/jmz/claude-fleet"
Do not use pip --extra-index-url (or pipx --pip-args="--extra-index-url …")
for this: pip treats the extra index as an equal of PyPI and takes the highest
version it finds on either.
uv puts claude-fleet and claude-fleet-report on your PATH; with pip, link
or call them from ~/.local/share/claude-fleet/bin/. To upgrade, run the uv
command again with --reinstall, or the second pip command with --upgrade
(add jmz-ktui to it only together with --index-url).
--no-sources(uv) is required:pyproject.tomlpointsjmz-ktuiat an editable../ktuicheckout for the author's local dev, which does not exist in a tool install. (With that checkout beside a clone, a plainuv tool install ".[tui]"from the clone uses it and asks no index forjmz-ktuiat all.)- From a clone or a built wheel, replace the
git+https://…part with the path:"jmz-claude-fleet[tui] @ /path/to/claude-fleet"or"/path/to/jmz_claude_fleet-0.1.0-py3-none-any.whl[tui]". - The claude-fleet repository itself needs read access (it is not public yet), and the Forgejo host is not reachable from every network.
- Without the
tuiextra,claude-fleetprints which extra is missing;claude-fleet list,claude-fleet attachand the reporter work without it.
./scripts/check-wheel.sh builds the wheel and checks both installs in clean
virtualenvs; CI runs it on every push.
The optional completion classifier (label sessions done / follow-up /
waiting via Claude Haiku) and session summaries (S) need the classify
extra and an Anthropic API key — see Completion classifier
and Session summary below.
Quick start (single machine)
# 1. generate this machine's report into a local cache dir
uv run claude-fleet-report report --out-dir ~/.cache/claude-fleet --no-push
# 2. open the board
uv run claude-fleet
For a real fleet, run the reporter on each host on a timer and point them at a shared cache — see Setting up a fleet.
Commands
claude-fleet [--kill-key PATH]— launch the TUI (the session board).--kill-keynames the private key for remote kill and prune (see Kill).claude-fleet list [--cache DIR] [--stale N]— headless listing to stdout (no Textual import), for scripts/cron.--stale 30prints only sessions idle 30+ days.claude-fleet attach [--host H] [--transport et|ssh] [query]— continue a session in the very process that runs it, on whichever host that is (see Attach). No query lists the live sessions.claude-fleet summarize [--host H] [--refresh] [--json] <query>— print a 5–10 line summary of one session (see Session summary); the query is a UUID (or a >= 6-char prefix), claude.ai link or id, job id or part of the name, as forattach.--jsonprints one object (host,session_id,title,header,cached,summary) instead.- New session on a host (library only, used by
fleet sessions new):claude_fleet.attach.new_plan(host, dir, local_host=…, settings=…)builds the terminal argv that opens a new window runningclaudein tmux sessionfleeton that host, indirthere (relative to the home directory; plain path characters only,commands.check_dir), and attaches to it. claude-fleet-report [--projects DIR] [--out-dir DIR] [--host NAME] [--nas DEST] [--key PATH] [--no-push]— the per-host reporter.claude-fleet-report.pyz remote— the host side of remote kill and remote prune, run as an ssh forced command (see Kill).
Keys
Navigation is vim-style: j/k move, g/G jump to top/bottom,
ctrl-d/ctrl-u/ctrl-f/ctrl-b page.
| Key | Action |
|---|---|
enter |
attach the highlighted session where it runs — live: its background job or its very tmux window/pane (switch-client when you already sit in that host's tmux); exited: resumed in tmux session fleet on its host (see Attach) |
i |
info pop-up — every field (with the first line of a cached summary); j/k flips through sessions; r/o/p/S/y act on the shown one; i/esc/q closes |
p / P |
peek the transcript tail / re-read it fresh first |
o |
open a shell in the session's directory (local, or over et/ssh remote) |
y |
copy the equivalent command (claude-fleet attach --host H <uuid>) to the clipboard |
C |
classify visible sessions (done / follow-up / waiting) — see below |
S |
summarize the highlighted session in 5–10 lines (scrollable pop-up: y copies, r summarizes again) — see Session summary |
f |
filter (modal: host · status · completion · time ranges) |
/ · \ |
fuzzy search topic · whole row (host/project/topic) |
s |
cycle sort (age / host / status / project / started / state) |
c |
clear all filters and search |
A |
show/hide automated (headless/SDK) sessions |
x |
prune the highlighted session (confirm; archives the transcript) — see Prune |
X |
archive all currently-visible sessions (filter first, then bulk-clear) |
K |
kill a live session (SIGTERM its process, to reclaim RAM; confirm first); on other hosts it needs the kill key — see Kill |
u |
toggle auto-refresh (reload the cache every 60s) |
r / R |
sync now (regenerate this host + pull the cache) / reload from disk |
t |
cycle theme |
? · q |
help · quit |
Any action's key can be remapped — see Configuration.
Attach (enter / claude-fleet attach)
Enter (or claude-fleet attach) never starts a second claude on a session
that is still running. It first asks the session's host what the session is
doing, then opens a terminal to exactly that:
| On the host the session is… | you get |
|---|---|
a live background job (kind: bg in ~/.claude/sessions/<pid>.json) |
claude attach <job id> |
| live in a tmux pane (found by walking the process's parents up to a pane) | that tmux pane (tmux attach; switch-client when you already sit in that host's tmux) |
| live, but in neither | an error — there is no terminal to attach to |
| exited | claude --resume in a new window of tmux session fleet on that host (created detached if missing, in the session's directory), then that session is attached — so it keeps running after you disconnect |
The reporter records the same pane for each live interactive session
(tmux_pane/tmux_target in <host>.json), so the info pop-up and claude-fleet attach show where a session runs without asking its host. Enter still asks the
host at attach time: the cached pane can be minutes old.
The lookup is claude_fleet/locate.py: stdlib-only, it is piped to the host as
ssh -T host python3 - (so the host needs only python3, not claude-fleet, and
the call reuses your ssh ControlMaster). On this machine it runs in-process. It
prints the one command to run on stdout, messages on stderr, and exits 0
found, 1 not found, 2 ambiguous, 3 listing.
claude-fleet attach # live sessions in the fleet cache (coloured)
claude-fleet attach fix-auth # name part, UUID / ≥6-char prefix, job id …
claude-fleet attach https://claude.ai/code/session_01… # … or the claude.ai link from a PR footer
claude-fleet attach --host pi # list the live sessions on pi (needn't be in the cache)
claude-fleet attach --host pi 3f2a9c # look it up on pi directly
Without --host the query is resolved against the cached sessions of all
hosts (UUID or prefix, job id, name; a claude.ai id against the reported
bridge_session_id). Several matches print a list and exit 2; one match is
looked up on its host by UUID. A claude.ai id that several transcripts on one
host share (a conversation continued in a new transcript) goes to that host
as-is: the live process wins, else the newest transcript is resumed.
Every reporter key can write the shared cache, so its values are treated as
untrusted: a record whose host name is not plain ([A-Za-z0-9][A-Za-z0-9._-]*),
whose host differs from its report file (<host>.json), whose session/job
id is not [A-Za-z0-9][A-Za-z0-9_-]*, or whose fields have the wrong type (a
string mtime, "live": "no") is skipped with a warning. Every ssh/et
command builder checks again, and puts the host after -- (ssh) or last (et).
Text from other hosts (cache values, a host's error message) is shown as plain
text, never as markup, with control characters replaced.
Rows are keyed by host + session id, and nothing one report says can hide
another host's rows: the same id from two hosts (a transcript copied over, a
host that reported under an older name) shows twice. A report file older than
two days (LIVE_REPORT_MAX_AGE_DAYS, by file mtime) is stale: its reporter has
stopped or its host has been renamed (an old DHCP hostname). Its rows are never
live and show their host as host?, dimmed (i says why), and the board warns
about each such file. Delete stale files by hand: the mba's pull does not
delete, so remove them on the cache host and in ~/.cache/claude-fleet/.
Transport
The terminal runs over Eternal Terminal (et)
when it can — it survives sleep and network changes — and ssh -t otherwise:
et is used only when it is installed here and a quick TCP probe (1.5 s) of the
host's etserver port answers, on the address ssh -G <host> resolves. The agent
is forwarded (et --forward-ssh-agent) when ssh -G reports ForwardAgent (yes with
$SSH_AUTH_SOCK set, or a socket path, passed as --ssh-socket). et
bootstraps through your ssh and its ~/.ssh/config aliases, so a
ControlMaster spares a second hardware-key touch. The lookup itself always uses
ssh -T. Colour follows the terminal and NO_COLOR.
Kill (K)
K sends SIGTERM (never anything stronger) to a live session's process, after a
confirm prompt that names the host and pid. The pid always comes from the
session's own host, never from the cache:
- The TUI asks the host for the pid its
~/.claude/sessionsregistry lists for that session id (this host: in-process; other hosts: over ssh). - You confirm
Kill live session … on <host> (pid N)?. - The host re-reads its registry and signals
Nonly if the registry still listsN, alive, for that session id, the process is still the one that registered (see below), runs aclaudecommand line and belongs to the same user. Anything else is refused with the reason.
A pid can be reused after its process exits, so the host checks the start
time: the registry's procStart against /proc/<pid>/stat on Linux; where
either is missing (macOS, older Claude Code), the registry's startedAt
against the process's start on the wall clock (/proc, else ps -o etime=).
A process that started after the session registered is another process. If
neither check can be made, K is refused rather than sent on trust.
The kill key
Other hosts are reached with a dedicated kill key and nothing else. It is not the reporter key: every reporting host carries the reporter key, so if it could kill, one compromised host could ask all the others to end their sessions. The kill key lives only on the machine that runs the TUI.
Name its private half in one of (first match wins):
| Where | |
|---|---|
claude-fleet --kill-key PATH |
this run only |
CLAUDE_FLEET_KILL_KEY=PATH |
environment |
[settings] kill_key = "PATH" |
claude-fleet.toml |
There is no default path and no fallback. Without a kill key, remote K says
"remote kill is not set up" and sends nothing (remote prune then uses your own
ssh login, see Prune). The same happens when the path
is not absolute (~/ is fine), when the file is missing, or when it names the
reporter key ([settings] key), a symlink or copy of it, or a file with the
same public half. Killing a session on this machine needs no key at all.
Create the key on the TUI host (once; no passphrase, since the TUI runs it
with BatchMode):
ssh-keygen -t ed25519 -N "" -C claude-fleet-kill@$(hostname -s) -f ~/.ssh/claude-fleet-kill
[settings]
kill_key = "~/.ssh/claude-fleet-kill"
The call is ssh -F /dev/null -i <kill key> -o IdentitiesOnly=yes -o IdentityAgent=none -o BatchMode=yes, taking HostName/User/Port (plus
HostKeyAlias, UserKnownHostsFile and IPQoS) from ssh -G <host>, so no Host *
key or agent can stand in. The request is one fixed-grammar line
(claude-fleet-kill pid <id> / claude-fleet-kill term <id> <pid>); session
ids and pids are validated on both ends and never reach a shell.
On each host: a forced command
A host accepts a kill request only through an ssh forced command. Add the kill
key's public half to the authorized_keys of the user that runs Claude
there, as exactly this shape (one line):
restrict,from="<TUI host tailnet IP>",command="<path>/claude-fleet-report.pyz remote" ssh-ed25519 AAAA… claude-fleet-kill@<TUI host>
restrictturns off the pty, all forwarding and~/.ssh/rc.from=pins the key to the TUI host's address: a copy of the key is useless from anywhere else. Leave neither option out.command=is the reporter zipapp the host already runs, e.g./home/<user>/.local/lib/claude-fleet/claude-fleet-report.pyz. If the file is not executable, orpython3is not on sshd's defaultPATH(NixOS), name the interpreter:command="/path/to/python3 <path>/claude-fleet-report.pyz remote".
remote takes its request from $SSH_ORIGINAL_COMMAND only, which sshd sets
for a forced command. Run by hand, or with a request on its own command line,
it refuses. So the key can do nothing but the two requests above and the
archive request of Prune, and each term is re-checked against
the host's registry as described.
Without that entry K says remote kill is not set up on that host. A host whose
reporter zipapp predates remote needs the zipapp redeployed first.
Prune (x / X)
Pruning archives a transcript: ~/.claude/projects/<project>/<id>.jsonl moves
to ~/.claude/projects-archive/<project>/. Nothing is deleted, and moving the
file back restores the session. x does it for the highlighted session after a
confirm, X for every visible row.
On this machine the file is moved directly. On another host there are two ways, and neither uses the reporter key (no session host authorizes it):
kill_key |
How the transcript is archived on the host |
|---|---|
| set | The host's forced-command helper, with the kill key: one request line claude-fleet-prune archive <id> <project>. The host checks both names again (the project must be a plain directory name, the transcript a regular file, no symlinks) and refuses a session that still has a live claude process there — kill it first. No shell is involved. If the key is unusable or the host has no entry, the prune fails with the reason; it does not switch to the other way. |
| not set | ssh <host> 'mkdir -p … && mv …' with your own ssh login: whatever ssh <host> uses (your key, agent or an open ControlMaster). The host and id are validated and the path is quoted, but the host does no check of its own, so a live session's transcript is moved too. |
The helper only archives. It has no delete request.
Completion classifier (C)
Press C to label the visible sessions done / follow-up / waiting
(with a one-line reason) using Claude Haiku over each session's cached transcript
tail. It runs on this machine only (the one hosting the TUI) — one API key, no
per-host keys — and caches results by (host + session id, message-count) in
classify.json in the state dir, so an unchanged session is
never re-classified. A new STATE column and a
completion filter facet (f) let you see, e.g., only the sessions waiting
on you, or bulk-archive everything done.
Setup:
uv pip install anthropic # the `classify` extra
export ANTHROPIC_API_KEY=sk-ant-… # an Anthropic API key (billed per token, ~cents/day)
It's pay-as-you-go API usage (separate from a Claude subscription); Haiku makes
this a few dollars once and pennies/day thereafter. Without a key, C just
shows a hint instead of erroring.
Session summary (S / claude-fleet summarize)
S on a row (or in the info pop-up) asks Claude for a 5–10 line summary of
that session: what it was about, what was done or decided, what is open or
next, and the PRs, files and hosts it names. It opens in a scrollable pop-up;
y copies it, r makes a fresh one. claude-fleet summarize <query> [--host H]
prints the same on the command line (summary on stdout, its source line on
stderr).
Like the classifier it runs on this machine only, with the same classify
extra and the same Anthropic API key, and it caches by (host + session id, message count) in summary.json in the state dir. Each
entry also holds a SHA-256 of the text it was made from, checked against the
session's current text before it is shown: reopening is instant, and a session
that has grown or changed since gets a fresh summary.
What it reads, and the header says which:
| Session | Source |
|---|---|
| on this host | its transcript file (~/.claude/projects/…/<id>.jsonl): user and assistant text plus a one-line hint of each tool call (tool results are left out). A long transcript is sampled: its start (a quarter of the budget) and its end, at most ~160k characters (~40k tokens); the header says how many messages it has, how many were left out and roughly how many tokens were sent. |
| on another host | the transcript tail in that host's report: the last ~10 messages, each cut to 500 characters. The header says "summary from the last N messages only". The TUI host does not fetch other hosts' transcripts: peek (p/P) shows this same tail, and the kill key's forced command answers kill and prune requests only. For a full summary of another host's session, run claude-fleet summarize on that host (it needs the classify extra and a key there too). |
Another host's text is treated as hostile data: it goes into the prompt inside a boundary tag with a random nonce, marked as data that gives no instructions; the request has no tools; and the answer is shown as plain text (control characters replaced, nothing parsed as markup), capped at 20 lines.
The model is claude-haiku-4-5 (as for C); set [settings] summary_model
to change it. A summary costs about one Haiku request over up to ~40k input
tokens.
Configuration
~/.config/claude-fleet/claude-fleet.toml (override with CLAUDE_FLEET_CONFIG):
[settings]
nas = "myhost:/path/to/reports" # push/pull target for the shared cache
hosts = ["laptop", "server", "pi"]
stale_days = 30
# key = "~/.ssh/claude-fleet" # reporter key: SSH key for the cache host (default)
# kill_key = "~/.ssh/claude-fleet-kill" # remote kill (K) and prune (x/X); no default, never the reporter key
# cache_dir = "~/.cache/claude-fleet"
# summary_model = "claude-haiku-4-5" # model for S / `claude-fleet summarize`
# state_dir = "~/.local/state/claude-fleet" # this host's classify.json + summary.json (default: $XDG_STATE_HOME/claude-fleet)
transport = "et" # terminal transport for attach/shell: "et" (default) or "ssh"
et_port = 2022 # etserver port (default 2022)
[transport] # per-host override of `transport`
oldbox = "ssh"
[keymap]
resume = "enter" # remap any action by name (see the Keys table)
[theme]
primary = "#7aa2f7" # override theme tokens
The state dir holds what only this machine writes: classify.json (C)
and summary.json (S). It is never the cache dir: the cache dir is filled
from the shared hub, which every reporter key can write, so a file there must
not be able to stand in for this machine's own state. The cache loader skips
those two names, the mba sync excludes them from the pull, and a
classify.json that older versions kept in the cache dir is copied to the
state dir once.
Remappable action names: resume, info, peek, peek_refresh, shell,
yank, classify, summarize, filter, search_topic, search_all, cycle_sort,
clear_filters, toggle_automated, prune, bulk_prune, kill,
toggle_auto, refresh, reload, theme, help, quit.
Setting up a fleet
deploy/ holds the author's real deployment as a reference — systemd timers
(Linux), a launchd job (macOS), a NixOS module, plus scripts to provision the
shared-cache host and roll the reporter out to each machine. They encode the
author's own hostnames, tailnet IPs, and paths (deploy/README.md explains the
model); adapt those values to your own fleet rather than running them as-is.
The essentials any deployment needs:
- A shared directory reachable by every host (the examples use
rsyncover SSH to a NAS, confined by anrrsyncforced command + a dedicated key). - The reporter on a timer per host (
claude-fleet-report report), pushing to that directory. - The TUI host pulling the merged cache and reading it.
Retention: Claude Code auto-deletes transcripts after
cleanupPeriodDays(default 30) — the very sessions this board surfaces. Raise it in~/.claude/settings.jsonon each host (deploy/set-retention.shis the author's helper).
Development
uv sync # with a ../ktui checkout beside this repo (see [tool.uv.sources])
uv run pytest -q
uv run ruff check .
Without a ../ktui checkout, take jmz-ktui from the package index instead:
uv venv
uv pip install --no-sources --index-strategy first-index \
--index https://git.mirus-tech.com/api/packages/jmz/pypi/simple -e ".[dev,tui]"
.venv/bin/pytest -q && .venv/bin/ruff check .
CI (.forgejo/workflows/check.yml) runs the same tests + lint, and a wheel
job that builds the wheel and installs it into clean virtualenvs
(scripts/check-wheel.sh).
Releasing
.forgejo/workflows/publish.yml publishes the wheel to the same Forgejo index
as jmz-ktui when a v<version> tag is pushed (the tag must match
pyproject.toml's version; bump that first). It needs the secrets
REGISTRY_USER (the token's owner) and REGISTRY_TOKEN (package write
access). The index is readable without a login, although this repository is
private: a release makes the wheel (the claude_fleet package and this README)
public. Only the wheel is uploaded, never an sdist, which would carry deploy/.
The distribution is jmz-claude-fleet because claude-fleet on PyPI belongs to
an unrelated project. jmz-claude-fleet is not on PyPI either; until a
placeholder holds that name there, anyone could register it.
License
MIT, see LICENSE.