Installs into .claude/skills of the current project.
Sponsors
SSkills DirectorySkills Directory
Know which skills are safe — weekly.
SSkills DirectorySkills Directory
Is that skill safe to install?
Are you the author of Skill?
Add the live security badge to your README. It updates with every re-scan.
[](https://www.skillsdirectory.com/skills/kirchik95-skill)
---
name: remote-hosts
description: "Offload heavy operations (tests, builds, benchmarks, Docker Compose, Playwright, linters, kubectl) to remote SSH worker machines via `fleet`. Use for checking worker load, RAM, or disk, picking a free host, syncing code (`fleet run --sync`), pulling verified artifacts (`fleet pull`), auditing hygiene (`fleet clean`, `fleet gc`), and checking toolchain parity (`fleet doctor`)."
---
# Remote Worker Pool (`fleet`)
Offload heavy operations — tests, builds (`cargo`, `dotnet`, `yarn build`, `rspec`, `pytest`), benchmarks, Docker stacks, and Playwright — to the remote SSH workers configured in `~/.config/fleet/hosts.json`. Keep code editing, `git`, and coding agents on your laptop.
**Transport & sandbox:** `fleet` runs over `ssh` (fast with `ControlMaster`), `rsync`, and optionally `rex` for live background tabs (`--bg`). If your agent sandbox blocks SSH or network sockets, request unsandboxed execution or escalation for `fleet` commands.
## 1. The One-Call Path
Run this from the project directory. It picks a free worker, copies the working tree, runs the command inside the copy, and streams the output:
```bash
fleet run --sync -- <command>
```
| Variant | Use it when |
|---|---|
| `fleet run --sync --tail 40 -- <cmd>` | You need only the result: prints the last 40 log lines and a result line. Saves context on long output. |
| `fleet run --sync --json -- <cmd>` | You parse the result: one JSON object with `exit_code`, `duration_s`, `artifacts_count`, `tail`. |
| `fleet run --sync --pull -- <cmd>` | The command writes reports into `$FLEET_OUT`: downloads them to `./fleet-out/<host>/<job_id>/`. |
| `fleet run --sync --isolated -- <cmd>` | Parallel agents must not share one copy: uses a unique one-off directory. |
| `fleet run --sync --ref HEAD -- <cmd>` | You need a clean committed tree without local edits (implies `--isolated`). |
| `fleet run -- <cmd>` | The command needs no project files. |
How it behaves:
- `--host auto` is the default. `fleet` weighs slots, CPU, RAM, disk, and capabilities. It prefers a worker that already holds a copy of this project, so build caches stay warm.
- `--sync` copies git-tracked and untracked non-ignored files to `~/fleet-work/<name>`. A repeated sync sends only changes and removes files you deleted locally. It never copies `.git`, `.env*`, `*.pem`, `*.key`, or `*.p12`.
- If the chosen worker fills up at the last moment, `fleet` moves to the next free worker by itself.
- The exit code of `fleet run` is the exit code of the remote command.
- `Ctrl-C` stops the remote job. If the client dies for another reason (tool timeout, closed terminal), the job keeps running: continue with `fleet wait --last`.
## 2. Long Jobs
For a job that may outlive your tool timeout, start it in the background and wait:
```bash
fleet run --sync --bg --json -- <command> # returns at once with host and job_id
fleet wait --last --timeout 600 --json # blocks until the job ends
```
- `fleet wait`, `fleet logs`, `fleet kill`, and `fleet pull` accept a bare `<job_id>` or `--last` (the latest job of this agent session). The `<host> <job_id>` form still works.
- On timeout `fleet wait` exits with `124` and the job keeps running. Call `fleet wait` again; never write a `sleep` or `ssh ... tail` loop.
- `fleet logs --last --grep 'FAIL|Error' -n 40` reads only the matching lines.
- `fleet jobs --mine` lists the jobs of the current agent session.
## 3. Host Selection
1. Leave the host on `auto` unless the task needs a specific machine.
2. Add `--need <cap>` only for hard physical constraints (for example `docker`, `heavy-ram`, `linux`, `macos`, `vpn`, `k8s`, `playwright`). Run `fleet hosts` to see every worker, its capabilities, and its protected services.
3. Add `--fast-single` for quick single-threaded checks (linters, `tsc`, unit tests).
4. Pass `--exclusive` for performance benchmarks and for tests that share one database. Pass `--wait-lock 300` to wait for a busy or locked host instead of failing.
5. Keep short commands (under 15–20 s), editing, and `git` on the laptop.
6. Never pass macOS `/Users/...` paths to a Linux worker. Use `~` or `$HOME`.
7. Never run heavy work over raw `ssh` or `rex`: slot accounting and locks will drift. For a quick look at a worker use `fleet exec`.
## 4. Commands
| Command | Purpose |
|---|---|
| `fleet run [--host H] [--sync [DIR]] [--isolated \| --ref REF] [--cwd DIR] [--tail N \| --json] [--pull [DEST]] [--cache] [--exclusive] [--wait-lock SEC] [--label NAME] -- <cmd>` | Tracked foreground run; `$FLEET_OUT` and `$FLEET_JOB_ID` are exported |
| `fleet run ... --bg [--no-rex] --json -- <cmd>` | Detached run (live Rex tab when configured, else a detached process); returns `job_id` |
| `fleet wait [<host>] <job_id> \| --last [--timeout 600] [--tail 20] [--json]` | Block until the job ends; returns exit code, duration, artifact count, log tail |
| `fleet logs [<host>] <job_id> \| --last [-n 80] [-f] [--grep REGEX]` | Read a log; `-f` follows until the job ends |
| `fleet kill [<host>] <job_id> \| --last [--json]` | Stop the whole process group, remove `label=fleet.job=<id>` containers, release locks |
| `fleet pull [<host>] <job_id> \| --last [dest] [--max-mb 500] [--overwrite] [--json]` | Download `$FLEET_OUT` files with SHA-256 verification (skips symlinks) |
| `fleet jobs [hosts] [--mine] [--history 5] [--id-only] [--json]` | Active and recently finished jobs |
| `fleet status [hosts] [--json] [--compact] [--history N] [--rex]` | Live CPU, RAM, disk, slots, Docker containers. With `--json`, Rex tabs are listed only with `--rex` |
| `fleet pick [--need CAP] [--min-ram-gb N] [--fast-single] [--json]` | Show which worker `auto` would choose |
| `fleet exec [--host H] [--cwd DIR] [--timeout 60] [--stdin] -- <cmd>` | Short diagnostic command: no slot, no log, no history entry |
| `fleet hosts [--md] [--json]` | Worker catalog from `hosts.json` (no network) |
| `fleet sync <dir> <host>[:dir] [--isolated] [--git \| --ref REF] [--delete] [--dry-run] [--json]` | Copy a tree without running anything |
| `fleet clean [hosts] [--json]` | Read-only audit: stale containers (>24h), Mutagen conflicts, disk warnings, workspace usage |
| `fleet gc [hosts] [--older-than 7] [--apply]` | Remove old logs, results, artifacts, and one-off work dirs. Dry run unless `--apply` |
| `fleet doctor [hosts] [--json]` | Read-only audit of installed toolchains and version drift |
**Exit codes & JSON:**
- Foreground `fleet run --json` and `fleet wait --json` return the same object: `{"ok", "status": "finished", "host", "job_id", "exit_code", "duration_s", "artifacts_count", "out_dir", "tail", "job"}`. The process exit code equals `exit_code`.
- `fleet run --bg --json` returns `{"ok": true, "host", "job_id", "cwd", "log", "out_dir", "result"}`.
- Exit code `75` with `"status": "busy"`: no free slot, or an exclusive lock is held.
- Exit code `124`: `fleet wait` timed out (`"status": "timeout"`, the job keeps running), or `fleet exec` hit `--timeout`.
- Exit code `130`: you interrupted a foreground run and `fleet` stopped the job.
## 5. Project Profile (`.fleet.json`)
A project can keep its defaults in `.fleet.json` at the repository root. `fleet run` applies them; command-line flags win.
```json
{
"need": ["docker"],
"min_ram_gb": 8,
"cache": true,
"env": {"RAILS_ENV": "test"},
"setup": "bundle install --quiet",
"cwd": "backend",
"sync": {"exclude": ["tmp/", "log/"], "isolated": false}
}
```
- `setup` runs before the command on every `--sync` run, so keep it idempotent and fast. Skip it with `--no-setup`.
- `cache` (or `--cache`) points Bundler, npm, Yarn, uv, pip, and Cargo caches at `~/fleet-cache` on the worker.
- `--no-profile` ignores the file.
## 6. Artifacts, Secrets, Dev Stands
1. **Artifacts:** write reports, screenshots, or dumps into `$FLEET_OUT`. Get them with `--pull` on a foreground run, or with `fleet pull --last` later. Existing local files that differ are kept unless you pass `--overwrite`.
2. **Secrets:** `.env` files are never copied by default. Set `"sync": {"include_env": true}` in `.fleet.json` only for a trusted worker when the task cannot start without them.
3. **Persistent dev stands:** if a repository has `AGENTS.local.md` or `CLAUDE.local.md` with dedicated Mutagen or dev-stand commands, follow it and wrap long runs in `fleet run`.
## 7. Hygiene & Diagnostics
- Tag temporary Docker containers with `--label fleet.job=$FLEET_JOB_ID` so `fleet kill` removes them.
- Never stop or remove the protected services that `fleet hosts` lists for a worker.
- Report `fleet clean` and `fleet gc` findings to the user. Do not run `fleet gc --apply` or delete unknown containers and directories without confirmation.
- Run `fleet doctor` when a build fails on a worker and passes locally: toolchain versions may differ.