Wakes this session with a [fleet] turn when a watched container settles, as pi's fleet monitor does

Give your coding agent a list of issues and get pull requests back. fleet runs each issue in its own sandbox with its own agent, all at once, and asks you only when a decision is yours.
You only talk to one agent, the host, on your Mac. It starts a sandbox per issue, keeps an eye on all of them and checks the finished work before anything lands. Questions it can't answer come to you. Every command any agent runs passes a tested guard first.
<img alt="Without fleet you watch three terminals, each waiting on you. With fleet you talk to one host agent, and it runs the three sandboxes." src="docs/before-after.svg">
<table> <tr> <td width="50%" valign="top"> <h4><code>1</code> You say what to ship</h4> <img alt="You tell the host agent: ship 12, 14 and 15" src="docs/step-1.svg" width="100%"> </td> <td width="50%" valign="top"> <h4><code>2</code> Each issue gets a sandbox</h4> <img alt="The host starts three sandboxes, one per issue" src="docs/step-2.svg" width="100%"> </td> </tr> <tr> <td width="50%" valign="top"> <h4><code>3</code> It asks only when it has to</h4> <img alt="Sandbox 14 asks which API to use; you answer v2" src="docs/step-3.svg" width="100%"> </td> <td width="50%" valign="top"> <h4><code>4</code> Pull requests come back</h4> <img alt="Three pull requests, each with tests passed and review done" src="docs/step-4.svg" width="100%"> </td> </tr> </table>
You need a Mac with Apple Silicon and zsh, Docker Sandboxes, herdr, Node, Claude Code and pi, and a Claude plan and a model provider for pi (setup step 1 matches the models to what you have).
git clone https://github.com/jaqubowsky/fleet ~/fleet
cd ~/fleet && claude
Then tell your agent: "read SETUP.md and set me up". It checks what you have, asks what it can't know, and ends by starting and stopping one test sandbox.
After setup you work from herdr: open a tab in your repository and run plain claude or pi. The host only wakes for the sandboxes its own herdr tab started. Herdr UI shows the same tabs in a native window, if you prefer one to the terminal.
Rather do it by hand? Follow the same steps yourself: SETUP.md lists them, one file each.
Every sandbox agent follows the same run. It works out the task, cuts it into small tickets and builds each one test first, committing only after the checks pass.
Then a second agent reviews the change whenever it reaches beyond its own feature. It never saw the implementation, so it reads the diff the way a stranger would, for bugs and for code quality. When the change is something users see, the sandbox opens the running app in a real browser and takes one screenshot per acceptance criterion. It records a video walkthrough when you ask for one.
Once the pull request is open, tell the sandbox to babysit it. It answers review comments and fixes red checks, round after round.
<img alt="The sandbox analyzes, cuts tickets, writes tests and code per ticket, gets a review from a fresh agent and checks the running app. It hands the host screenshots, a summary and the diff; the host reads those, not the chat." src="docs/sandbox-to-host.svg">
The host sleeps until a sandbox needs something, then wakes up with what changed.
<img alt="The host wakes when a sandbox finishes, asks a question, stalls or hits the usage limit, and handles each" src="docs/host-watch.svg">
Every tool call an agent makes goes through a policy first. This is what an agent gets back when it tries to rewrite history:
<img alt="An agent runs git push --force origin main and the guard stops it: a force, delete or mirror push rewrites what other people already hold" src="docs/guard-refusal.svg">
| Stopped | Example |
|---|---|
| Rewriting shared history | git push --force, delete and mirror pushes |
| Reading secrets | SSH keys, the keychain, op read, gh auth token |
| Changing its own rules | writes to ~/.claude and ~/.pi |
| Deleting your work | rm -rf on home and project folders |
| Acting on GitHub for you | merging a PR in another repository |
The host agent runs these for you. Each one is listed with what it changes, so nothing happens that you can't look up.
| Command | What it does | What it changes | |
|---|---|---|---|
./sync.sh | shows what --apply would change for each agent whose CLI is on PATH, and names the backup archive it would write | nothing | |
./sync.sh --apply | installs the harness for each agent whose CLI is on PATH and builds its sandbox image | first packs every file it will change into ~/.fleet/backups/<UTC timestamp>.tar.gz; replaces ~/.claude/{rules,refs,skills,agents} and ~/.pi/{skills,agent/refs,agent/agents,agent/themes} of the agents it sets up; writes keys into ~/.claude/settings.json and links the guard hook into ~/.claude/hooks with claude; links fleet and a gh wrapper into ~/.local/bin and herdr's config | |
fleet up <label> --repo <path> | starts a sandbox for a task, its agent waiting in a herdr tab | creates a sandbox with a private clone and your repository's ignored .env files; stores the profile's GitHub token as an sbx secret; adds a task folder under ~/.fleet/tasks/ | |
fleet stop <sandbox> | stops the sandbox, keeping its files and herdr tab | ends guest processes; the tab and watch status show stopped | |
fleet start <sandbox> | restarts in the saved tab with the last saved session when one exists | starts the sandbox and agent; sends no prompt | |
fleet steer <sandbox> "<text>" | sends the sandbox agent its next instruction | nothing outside the sandbox | |
fleet watch | wakes the host when a sandbox settles, with its closing message | nothing | |
fleet ls, fleet peek <sandbox> | list the sandboxes, show what one is doing | nothing | |
fleet diff [<sandbox>] | toggles a live diff beside the current container's terminal | opens or closes its Herdr pane; saves the selected file and scroll position in the host cache; reads Git without changing the checkout | |
fleet artifacts | list task folders | nothing | |
fleet exec <sandbox> -- <command> | runs a command inside a sandbox | whatever that command changes there | |
fleet copy <src> <dst> | copies a file in or out of a sandbox | the destination file | |
fleet land <sandbox> [--push] | brings the finished branch home | moves your local branch; signs commits per profile, which changes their SHAs; --push pushes to GitHub | |
fleet down <sandbox> [--force] | closes the sandbox, keeping its task folder | removes the sandbox; refuses unlanded work, which --force throws away | |
fleet profile [<repo>] [--apply] | shows who may push, open and merge pull requests, per repository | with --apply: the checkout's git config (signing, HTTPS origin, credential helper) and its Linear MCP registration. Every host session start runs this on its own checkout | |
fleet tokens [set <name>] | lists the GitHub tokens the profiles name and marks the ones missing from the macOS keychain; set asks for one and stores it | with set: one keychain item under fleet-gh. Run it yourself; the guard refuses it to agents | |
| `fleet build [--pi\ | --claude]` | rebuilds a sandbox image | the local sbx image |
fleet init <repo> | lays out AGENTS.md and spec/vision.md | adds those files to the repository, never overwriting one | |
fleet render | renders one seat's files | the seat's home, or --out <dir> |
fleet --help lists every flag.
In a container's Herdr tab, press Ctrl+B, then D to toggle its Changes pane. It works with both pi and Claude and leaves focus in the agent terminal. The host needs hunk on PATH. Reload Herdr's configuration after installing the binding with herdr server reload-config. The pane shows the container's changes in hunk, split side by side with the files pane, wrapped lines and the Ayu Mirage theme. hunk's own keys and mouse apply; q closes the pane. Write a note on a line with c and save it with Ctrl+S, then press Ctrl+B, then M to send your notes to the container's agent; the sent notes leave the pane. The pane reads the changes again two seconds after the previous read finishes, and hunk reloads them in place, keeping the file you are reading. Changes compare the working tree to the merge base of HEAD and the container's origin base branch, so rebasing does not include unrelated upstream changes. No fetch runs while viewing. A task with several repositories shows them in one review, each path under its repository's name. New untracked files are included; ignored files are excluded. A stopped or removed container leaves the last changes on screen, without starting the container. Files larger than 4 MiB show only their name.
Use fleet stop to release a sandbox's resources without deleting its work. fleet start restores the saved conversation in the same tab, not an interrupted tool call or app server. fleet ls, fleet peek and the watch leave stopped sandboxes asleep; steer and exec require a start first. Raw sbx exec starts a stopped sandbox, even for a read.
--repo, and one land brings all of them home.fleet profile shows who may push, open and merge pull requests, for the host and for the sandbox.fleet ls shows what each sandbox has spent so far.audit-harness reads a selected session, defaults to the current one, and proposes the smallest environment changes for observed friction and mistakes. Each proposal includes evidence and cost; nothing is edited.Sandboxes never hold your SSH or signing key, and their GitHub token reaches them only through the sandbox proxy. The host agent on your Mac gets a repository's token from the keychain only for the gh command that needs it. A repository's ignored .env files are copied into its sandbox. Three things never happen without you:
auto, since the guard refuses it;The guard matches patterns and doesn't understand the shell, so eval gets past it. A repository's own .claude/settings.json can also switch off user hooks. It stops mistakes. Someone who has read the rules can get around it.
Rules, skills and the guard are written once in this repo and rendered for both Claude Code and pi. To add a skill, drop a SKILL.md into skills/shared, skills/host or skills/container and run sync. It reaches each agent sync sets up, on your Mac, in the sandboxes or both. Edit or delete the bundled skills the same way. Keep them in the repo, because sync replaces ~/.claude/skills on every run.
It is opinionated and built around how I work. Fork it and let your agent bend it to yours.
MIT. The software comes as is, without warranty of any kind, and the authors are not liable for anything it does.
fleet runs AI agents that execute commands on your Mac and in sandboxes, with your GitHub tokens and, where a repository's profile allows, your permission to push and merge. The guard stops known mistakes, not every one (see the trust model above). Read fleet profile for each repository before its first task, scope every token to what that repository needs, and keep your own backups.
Third-party code and its licenses: THIRD_PARTY_NOTICES.md.
hooks/register.tsx 162 lines1import { atom, read, update } from "claude-code";
2import type { EngineInterface, Register } from "claude-code";
3
4type Line = { wake?: string; log?: string; watching?: string };
5
6const WATCH_DESCRIPTION =
7 "Watch containers beyond the ones this session put up, started or steered, which are watched by themselves. A watched container settling wakes this session with a [fleet] <agent>: <state> turn carrying the last message of its session transcript. It also wakes for a container working 20 minutes without settling, unless its last message is new since the last wake, and for each 15 minutes its message stays the same after that; for a sleep of this Mac; and for gone and taken down. Pass the sandbox names fleet ls prints; an empty string watches every container.";
8
9const AGENT_STATUS: Record<string, string> = { working: "yellow", idle: "green", done: "green", blocked: "red", exited: "red", gone: "red" };
10
11const watching = atom({ plugin: "fleet", key: "watching" } as const, "");
12
13const watcher = {
14 stop: undefined as (() => void) | undefined,
15 running: false,
16 held: [] as string[],
17 said: new Set<string>(),
18 session: "",
19 args: [] as string[],
20};
21
22function send($: EngineInterface, text: string) {
23 $.ui.toast(text.split("\n", 1).join(""));
24 void $.prompt.submit({ text });
25}
26
27function heard($: EngineInterface, line: Line) {
28 const containers = line.watching;
29 if (containers !== undefined) void update($, watching, () => containers);
30 if (line.log !== undefined && !watcher.said.has(line.log)) {
31 watcher.said.add(line.log);
32 $.ui.toast(line.log);
33 }
34 if (line.wake === undefined) return;
35 if (watcher.running) watcher.held.push(line.wake);
36 else send($, line.wake);
37}
38
39async function follow($: EngineInterface, args: string[]) {
40 watcher.stop?.();
41 watcher.said.clear();
42 watcher.args = args;
43 watcher.session = await $.session.id();
44 const child = $.process.spawn({
45 argv: ["fleet", "watch", "--json", ...args],
46 env: { CLAUDE_CODE_SESSION_ID: watcher.session },
47 });
48 watcher.stop = () => void child.return(undefined as never);
49 void (async () => {
50 let buffer = "";
51 for await (const { stream, text } of child) {
52 if (stream === "stderr") {
53 $.ui.log(text, { to: "debug" });
54 continue;
55 }
56 buffer += text;
57 for (let nl = buffer.indexOf("\n"); nl >= 0; nl = buffer.indexOf("\n")) {
58 heard($, JSON.parse(buffer.slice(0, nl)) as Line);
59 buffer = buffer.slice(nl + 1);
60 }
61 }
62 })();
63}
64
65async function watch($: EngineInterface, text: string) {
66 const names = text.trim().split(/[\s,]+/).filter(Boolean);
67 await follow($, names.length ? names : ["--every"]);
68 return names.length ? `fleet: watching ${names.join(", ")}` : "fleet: watching every container";
69}
70
71async function unwatch($: EngineInterface) {
72 await follow($, []);
73 return "fleet: stopped";
74}
75
76export const register: Register = (on) => {
77 on("session.start", async ($, e, next) => {
78 const started = await next(e);
79 await follow($, []);
80 await $.tool.register({
81 name: "watch",
82 description: WATCH_DESCRIPTION,
83 inputSchema: {
84 type: "object",
85 properties: {
86 agents: {
87 type: "string",
88 description:
89 "Space- or comma-separated sandbox names as fleet ls prints them. Empty string watches every container",
90 },
91 },
92 required: ["agents"],
93 },
94 });
95 await $.tool.register({
96 name: "unwatch",
97 description: "Stop the watch started by mcp__fleet__watch; the containers this session put up, started or steered stay watched.",
98 });
99 await $.command.register({
100 name: "fleet-watch",
101 description: "Watch containers beyond the ones this session put up, started or steered; no names watches every container",
102 argumentHint: "[sandbox...]",
103 });
104 await $.command.register({
105 name: "fleet-unwatch",
106 description: "Stop the watch started by /fleet-watch",
107 });
108 return started;
109 });
110
111 on("tool.call", { tool: "mcp__fleet__watch" }, async ($, e) => {
112 const text = await watch($, String((e as { agents?: unknown }).agents ?? ""));
113 return { result: text, text };
114 });
115 on("tool.call", { tool: "mcp__fleet__unwatch" }, async ($) => {
116 const text = await unwatch($);
117 return { result: text, text };
118 });
119 on("command.run", { command: "fleet-watch" }, async ($, e) => ({ text: await watch($, e.args) }));
120 on("command.run", { command: "fleet-unwatch" }, async ($) => ({ text: await unwatch($) }));
121
122 on("ui.render", { component: "SessionMode" }, async ($, e, next) => {
123 const drawn = await next(e);
124 const containers = await read($, watching);
125 if (!containers) return drawn;
126 const { Box, Text } = $.ui.resolve(e);
127 return (
128 <Box flexDirection="column">
129 {drawn}
130 <Text>
131 <Text color="yellow">◉ </Text>
132 <Text color="magenta">watching </Text>
133 {containers.split(" · ").map((entry, i) => {
134 const cut = entry.lastIndexOf(" ");
135 const state = entry.slice(cut + 1);
136 return (
137 <Text key={entry}>
138 {i ? <Text dimColor> · </Text> : ""}
139 {`${entry.slice(0, cut)} `}
140 <Text color={AGENT_STATUS[state] ?? "magenta"}>{state}</Text>
141 </Text>
142 );
143 })}
144 </Text>
145 </Box>
146 );
147 });
148
149 on("turn.start", async ($, e, next) => {
150 watcher.running = true;
151 if (watcher.session && (await $.session.id()) !== watcher.session) await follow($, watcher.args);
152 return next(e);
153 });
154 on("turn.complete", async ($, e, next) => {
155 const result = await next(e);
156 if (e.agentId) return result;
157 watcher.running = false;
158 if (watcher.held.length) send($, watcher.held.splice(0).join("\n\n"));
159 return result;
160 });
161};
162types/index.d.ts 8 lines1export type FleetWatching = string;
2
3declare module "claude-code" {
4 interface PluginState {
5 fleet: { watching: FleetWatching };
6 }
7}
8