# Plan — parallel completion of the remaining buildable fleet work

Date: 2026-06-09 (late evening). Follows
[20260609_fleet-engine-title-refiner.md](./20260609_fleet-engine-title-refiner.md).
Execution model: four agents in parallel, each owning ONE new module + its
tests in `governor/src/fleet/` — zero shared-file edits between tracks; the
coordinating session pre-plumbed shared types (`mediaRoot` on
`FleetHost`/`FleetDeviceOverride`) and does all `cli.ts`/`index.ts` wiring,
integration testing, and docs afterward.

| Track | Module | Delivers |
|---|---|---|
| A | `actuate.ts` (+ may append exports to `transmission.ts`) | re-pin execution (rsync holder→target over ssh, dry-run default), recorded holdings (`~/.local/state/tv-anarchy/fleet-holdings.json`), research-feed (torrent-search invocation from a dead torrent's cleaned name) |
| B | `daemon.ts` | periodic fleet tick for launchd: duties Δ-log → floor check → reaper (+safe nudges when enabled), injectable deps, own state file (`fleet-daemon-state.json`) |
| C | `serve.ts` | HTTP service: `/registry` `/custody` `/reaper` `/peers_for/<hash>` `/health`, optional bearer token — the broadcast-host service, runnable on any node today |
| D | `probe.ts` | ssh `df` disk probes + EWMA uptime score (`fleet-probe-state.json`), pure merge into host capacity (feeds custody eligibility) |

Constraints all tracks share: Bun + strict tsc (`bunx tsc --noEmit` must stay
clean), `bun:test` tests in `governor/test/fleet/`, pure logic separated from
I/O, read-only by default / mutation behind explicit flags, no edits to
existing files (exception: track A may append to `transmission.ts`).

Still blocked regardless of parallelism (unchanged): WG fabric plane 1 (the
`10.9.0.4` decision), seedbox provisioning, friend-mesh, private trackers,
Discord planes.

Completion criteria: all four modules merged, CLI wired
(`fleet repin|daemon|serve|probe`), full `bun test` + typecheck green, docs
(operations/roadmap/fleet README) updated, results appended here.

---

## Result — COMPLETE (same evening)

All four agents delivered; integration done by the coordinating session.

- **Tests:** 131 pass / 0 fail across 9 files (was 45/5 before the team);
  `bunx tsc --noEmit` clean. New: actuate 35, daemon 13, serve 16, probe 22.
- **CLI wired:** `fleet repin [--apply]`, `fleet probe`, `fleet daemon
  [--apply-nudges] [--interval-min=N]`, `fleet serve [--port=N] [--token=T]`;
  `status`/`custody`/`repin` now use probed capacity (`withProbedCapacity`);
  `gatherHoldings` merges recorded re-pin holdings (`fleet-holdings.json`).
- **Live-verified:** `fleet probe` → black reachable, 50.7 GB free, EWMA
  scores persisted; `fleet status` shows capacity lines; `fleet repin`
  dry-run → 254 plans with honest skip reasons (no surviving copy / target
  lacks ssh); `fleet serve --token` → /health open, /registry 401 without →
  200 with bearer token; server killed cleanly (no orphan, port closed).
- **Agent notes worth keeping:** repin runs rsync ON the target pulling from
  the source (`ssh target rsync -a -s --partial --inplace source:path/ dest/`),
  `--append-verify` excluded and asserted absent in tests; mcp search shape is
  `bun run src/cli.ts search "<query>" [limit]` (JSON array of
  {filename,source,size,seeders,leechers,magnet}); probe merge rule = probe
  wins over registry for disk AND uptime (documented in probe.ts); serve
  returns 405 for non-GET (deliberate deviation from "404 for everything").
- **To make repin executable for real:** give targets `ssh` + `mediaRoot` via
  fleet.json (apricot advertises transmission but has no `user@host` service
  detail today — add one, or an object-form override).
- Docs updated: operations (full subcommand table + state files), roadmap
  (stage 1 fully shipped; serve noted on stage 3), fleet/README.
