# Fleetlayer An open framework for running AI agents securely and at scale. Fleetlayer connects the Claude Code and Codex sessions you already run in [herdr](https://herdr.dev/), on your laptop, a home server or a VPS. Any agent can message any other agent, webhooks can be routed to specific agents, and each agent gets its own access rules. Open source under Apache 2.0, early, built in public: https://github.com/fleetlayer/fleetlayer ## Claude Code is awesome… …when you have one Claude account and run it on one machine. Add a second account, a server or another agent, and this starts happening: - claude.ai artifacts say “access denied” unless you’re signed in to the right account. - A session on your server can’t message one on your laptop. - You keep signing in and out of the Claude in Chrome extension. - An agent on your server can’t use the browser on your Mac. - An agent on your server can’t reach the Downloads or Screenshots folders on your Mac. - Codex and Gemini agents can’t make claude.ai artifacts at all. - You find out an account is out of usage when a session stops. ## Fleetlayer solves all of this, and much more - **Fleetlayer Pages and Apps.** Claude, Codex and Gemini agents write pages and interactive apps as plain folders, and Fleetlayer hosts them behind one sign-in. [How](https://fleetlayer.ai/guides/pages/) - **Messages between any two agents.** Claude or Codex, on the same machine or another one: `fleetlayer msg send --to api@laptop`. [How](https://fleetlayer.ai/guides/day-to-day/) - **Any agent can control your browser.** Agents on any machine and any Claude account can use the Chrome on your Mac, signed in as you (via Playwright MCP). [How](https://fleetlayer.ai/guides/browser/) - **Every account in one place.** Year-long sign-ins on every machine, and every account's usage shared with every session. [How](https://fleetlayer.ai/guides/claude-accounts/) ## How it fits A node on each machine, or each Unix user, keeps one outbound connection to the control plane, so it works behind NAT with no ports to open. It attaches to herdr without taking it over: your apps and terminals keep working beside it. Plugins are separate processes in any language, speaking the Agent Client Protocol plus Fleetlayer's extensions. The pieces: `fleetlayer-node` (one per machine or Unix user), plugins (herdr, Claude Code, summaries, Claude accounts, pages), `fleetlayer-control` (the control plane: machines, sessions, messages, webhooks, access rules; it holds no credentials) and `fleetlayer` (the command line). ## What you get - **Every session in one list**: every machine and session, with a one-line summary of what each agent is doing and a searchable record of what it did. `fleetlayer attach api@laptop` watches or drives a session's terminal from anywhere. - **Agents that message each other**: `fleetlayer msg send --to api@laptop "the staging deploy is done"`, on one machine or across machines, delivered through the agent's own channel and labelled with who sent it. - **Webhooks that find the right agent**: a CI failure goes to the session that wrote the branch. - **Many Claude accounts, many machines**: usage across all your accounts, shared with every session; year-long tokens reach each machine sealed to its own key; sign-ins stay on a machine you control. - **Separate users, separate rules**: run several nodes and herdr instances on the same machine or VM, each under its own Unix user. The access policy limits whom each agent may message and what it may use. - **Tools that live on one machine**: your signed-in browser on a laptop, used by an agent on a server with `fleetlayer mcp browser@laptop`. ## A foundation for your own agent workflows Fleetlayer started inside Quietdeck. Once we saw how useful that layer was on its own, we pulled it out into its own project and refined it. It gives you the primitives to build your own apps and layers on top: sessions at `tab@node`, messages, webhooks and channels, access rules, approvals, an audit log, plugins in any language, shared MCP tools, and pages and apps. Built on Fleetlayer: [Quietdeck](https://quietdeck.ai/). An agent triages your email and proposes what to do, and you approve. Quietdeck runs on Fleetlayer and uses its features to: - forward emails and notifications to the agent that owns the work through Fleetlayer’s messaging - know what all your agents are doing from Fleetlayer’s session summaries, and route each message to the right agent - start an isolated email triage agent on its own Unix user, connected through its own Fleetlayer node, with access rules that limit whom it may message ## One system, many parts Fleetlayer is the layer between your agents and the tools around them. Each part does one job and can be replaced. - **Agents:** Claude Code, Codex - **Sessions:** herdr (https://herdr.dev) - **Fleetlayer:** cross-agent messaging, webhooks, single sign-on, access rules, approvals, audit log, AI account management, session summaries, remote terminals, shared MCP tools, file sync, pages and apps - **Browser:** Playwright MCP - **Files:** Syncthing, Obsidian Sync, Obsidian LiveSync, or any file syncing solution - **Network:** Tailscale, Cloudflare Tunnel - **Services:** Gatus for health checks, Traefik for addresses - **Backups:** restic (https://fleetlayer.ai/guides/backups.md) - **Mobile:** herdr relay ## Start small, replace any component as you go Begin with everything on your laptop. When you outgrow it, move one piece to a home server or a VPS, or swap it for the tool you'd rather use. Each piece keeps its state in one folder and speaks open protocols. Ask your agent: "Set up Fleetlayer on this machine. The docs are at https://fleetlayer.ai/llms.txt". What it runs: ```sh curl -fsSL https://raw.githubusercontent.com/fleetlayer/fleetlayer/main/install.sh | sh fleetlayer up # everything on this machine; status page at http://fleetlayer.localhost:7680 fleetlayer sessions ``` Next: https://fleetlayer.ai/guides/laptop.md ## No vendor lock-in Your own stack instead of a vendor's cloud, made of separate pieces that work with the tools you already use. Keep using Anthropic's and OpenAI's own features for as long as they serve you; when you outgrow them, you give nothing up, and you can still change models and harnesses whenever you like. ## Who it's for It's for people who run many agents side by side (errands, email triage, product work, infrastructure, workers), each with its own machine or Unix user and permissions, and for people whose work and life share the same agents. ## Where it is today Runs now: the node, the control plane and the command line; plugins for herdr, Claude Code, session summaries, Claude accounts and pages; everything on one laptop with `fleetlayer up`; access rules with an audit log; releases that update every node themselves. Being built: one sign-in for every service, the phone, moving a piece with one command, and a server setup an agent can build for you. Expect breaking changes. --- # Getting started Fleetlayer is early. Expect breaking changes. The docs are written for your agent as much as for you. To have it set Fleetlayer up, ask it to, and point it at https://fleetlayer.ai/llms.txt (every page, as Markdown). This page is what it does, step by step. A few steps are yours alone, such as approving a prompt on a Mac or pasting a secret; the guides mark them. ## Install ```sh curl -fsSL https://raw.githubusercontent.com/fleetlayer/fleetlayer/main/install.sh | sh ``` It installs the latest release's binaries for Linux or macOS into `~/.local/lib/fleetlayer//`, checked against the release's checksums, with symlinks in `~/.local/bin`. A node installed this way updates itself from later releases (`update: {mode: auto | notify | off}` in node.yaml); one installed any other way only logs that a release is out. Or build from source: `cargo build --release`, and put `target/release/fleetlayer*` on your `PATH`. ## Everything on one machine `fleetlayer up` starts the control plane, a node, the Claude sign-in hub, pages and the gateway on this machine, each at `http://.localhost:7680`, with a status page at `http://fleetlayer.localhost:7680`. See [Start on your laptop](https://fleetlayer.ai/guides/laptop.md). The rest of this page sets each piece up by hand. ## A node on one machine `~/.config/fleetlayer/node.yaml`: ```yaml name: laptop plugins: - name: herdr command: fleetlayer-herdr - name: claude-code command: fleetlayer-claude-code ``` ```sh fleetlayer-node install # a systemd user service on Linux, a launchd agent on macOS fleetlayer status fleetlayer sessions fleetlayer msg send --to planning "the migration is done" ``` From inside an agent session, `fleetlayer msg send` names the sending session, so the receiver knows who wrote and how to reply. Claude Code sessions running in bypass-permissions mode hold incoming messages for your approval unless `~/.claude/settings.json` has `"crossSessionInbound": "accept"`. That setting also accepts messages from any process of your user that can read the session's key file; decide whether that's right for your machine. ## A control plane, for several machines ```sh fleetlayer-control --db /var/lib/fleetlayer/control.db node add laptop # prints the node's token once fleetlayer-control --db /var/lib/fleetlayer/control.db node add server fleetlayer-control --db /var/lib/fleetlayer/control.db serve --listen 0.0.0.0:7600 --hooks-listen 127.0.0.1:7601 ``` On each node, save its token to a file (mode 0600) and add: ```yaml control: url: wss://control.example.com/v1/link # ws:// only on a private network token_file: ~/.config/fleetlayer/node-token ``` Then `fleetlayer fleet` shows every machine and session, and `fleetlayer msg send --to planning@server "…"` reaches a session on another machine. ## Webhooks into the session that owns the work ```sh fleetlayer-control endpoint add --label github --channel ci # prints /hooks// ``` Expose only the hooks listener to the internet (a Cloudflare Tunnel to port 7601, say) and give GitHub the URL. Then, from the session working on a branch: ```sh fleetlayer subscribe ci --subject your-org/your-repo@your-branch ``` CI results for that branch arrive in that session. `fleetlayer-control fallback ci @` names where events go when nobody subscribes. ## Using a tool on another machine A node can share a stdio tool, for example an MCP server driving your own signed-in browser on your laptop, with sessions on other machines. On the laptop's node: ```yaml tools: - name: browser # A pinned install (npm install @playwright/mcp@ in a folder of its own), run with node directly: a # service may not have npx on its PATH. command: /opt/homebrew/bin/node args: ["/Users/you/.local/share/browser-mcp/node_modules/@playwright/mcp/cli.js", "--extension", "--profile-dir-name", "Default", "--session-name", "{session}", "--ignore-roots"] # don't let a caller widen file access with its own MCP roots # File arguments (uploads) are confined to the server's working directory: give it an empty one, never your home. # (Without cwd: a tool gets an empty directory of its own, ~/.local/state/fleetlayer/tools/.) cwd: ~/.local/state/fleetlayer/tools/browser env: PLAYWRIGHT_MCP_EXECUTABLE_PATH: "/Applications/Google Chrome.app/Contents/MacOS/Google Chrome" PATH: /opt/homebrew/bin:/usr/bin:/bin env_files: { PLAYWRIGHT_MCP_EXTENSION_TOKEN: ~/.config/browser-mcp/extension-token } # read at start; keep it 0600 allow: ["*@server"] # @ patterns; nobody when empty networks: ["10.5.0.0/16"] # optional: offer it only while this machine is on these networks (at home) tools: deny: [browser_run_code_unsafe] # always on in Playwright MCP: arbitrary code in the server's process # When a session's connection ends, close its tabs one at a time (browser_close only disconnects in extension # mode, leaving the tabs open in a grey group). on_close: [{ name: browser_tabs, arguments: { action: close, index: 0 }, repeat: 50 }] close_with: [browser_close] # from v0.3.9: browser_close only disconnects in extension mode, so it runs the cleanup instead ``` In a session on another machine, the MCP server command is `fleetlayer mcp browser@laptop`. With `networks:` set, the browser is offered only while the laptop's link to the control plane goes out from one of those networks; away from home it's refused with the reason, until its person opts in on purpose with `fleetlayer tools enable browser --for 2h` (at most a day; `fleetlayer tools disable browser` ends it early). Each connection starts its own server, named after the calling session's tab (`{session}`), so each session gets its own tab group. The control plane checks access (`acl` rules on `tool:@`), joins the two nodes' streams and logs every connection (`fleetlayer-control tools`). It never reads what passes through. ## Monitoring the node ```yaml heartbeat: url: https://gatus.example.com/api/v1/endpoints/fleetlayer_laptop/external token_file: ~/.config/fleetlayer/heartbeat-token every: 60 ``` The node reports `success=false` with the reason when a plugin isn't running or the control plane link is down, and stops reporting when it dies, so the monitor alerts either way. --- # How Fleetlayer fits together Fleetlayer is an open framework for running AI agents securely and at scale. It connects the agent sessions you already run, on every machine you use, into one fleet. This page explains the few pieces it's made of, how they talk to each other, and the rules that shape them. [Getting started](https://fleetlayer.ai/getting-started.md) and [Start on your laptop](https://fleetlayer.ai/guides/laptop.md) show how to run them. ## The pieces - **A node** on each machine, or on each Unix user of a shared machine. It starts the plugins, keeps one outbound connection to the control plane, delivers messages into sessions, updates itself from releases, and reports a heartbeat. The `fleetlayer` command line talks to the node on its own machine. - **Plugins**, separate programs the node starts and talks to over JSON-RPC on stdin and stdout. They can be written in any language. A plugin takes one or more roles: a session manager knows where sessions run (`fleetlayer-herdr`); a harness knows one agent program from the inside (`fleetlayer-claude-code` delivers through Claude Code's own messaging socket); others turn outside events into Fleetlayer events, apply files or secrets sent to the machine, write session summaries, or serve pages. The protocol is the [Agent Client Protocol](https://agentclientprotocol.com) plus Fleetlayer's extensions ([the plugin protocol](https://fleetlayer.ai/protocol.md)). - **The control plane**, one per fleet. It knows every node and session, relays messages between nodes, routes webhooks and events to the sessions subscribed to them, and checks every request against the access policy, writing each decision to an audit log. It's a single program with a SQLite database, and you run it yourself: on your laptop to start, on a home server or a VPS later. - **The gateway**, on a laptop. It gives each service its own address (`http://pages.localhost:7680`), checks each one's health, and tells you or an agent when something stops. ## Names Every session has a name of the form `@`: `planning@laptop`, `triage@mail`. The tab is the session's name in its session manager, and it stays the same when the agent restarts. When a tab name is unique in the fleet, the `@` part can be left out. Shared tools are `tool:@` (`tool:browser@laptop`), and a script with no session is `-@`. **A node is the trust boundary.** Every process of a Unix user can claim to be any of that user's sessions, so a rule about one agent holds only if that agent has its own Unix user and node. An agent you trust less, one that reads strangers' email for instance, gets a user of its own ([Run an agent that reads strangers' text](https://fleetlayer.ai/guides/untrusted-input.md)). ## How a message travels `fleetlayer msg send --to infra@home "the migration is done"` goes from the sender's node to the control plane, which checks the access policy and passes it to the node `home`. That node finds the session `infra` and delivers the text through the best channel it has: the agent's own messaging channel when a harness plugin offers one, otherwise typed into its terminal by the session manager. The message is labelled with who sent it and how to reply. If the sender reads untrusted input, the message is also marked as outside data, so the agent that receives it treats it as it would treat the email itself. A session may always answer a session that wrote to it in the last 24 hours. Events work the same way. A webhook (a CI result, say) arrives at the control plane on a channel, and goes to the sessions subscribed to that channel or to one subject on it: the agent that wrote the branch hears that its build failed. A channel can name a fallback session for events nobody subscribed to. ## Secrets stay on your machines The control plane holds no credentials. When a node enrols it makes a keypair, and its private key never leaves it. A plugin that needs to put a secret on other machines (the Claude sign-in hub sending year-long tokens, for example) encrypts it to each target node's public key. The control plane relays the ciphertext without being able to read it, and doesn't store it. Only numbers travel the other way: usage, health and session counts, as readings. ## Start small, move pieces later Each piece keeps all its state in one folder and its settings in one file, and never assumes it shares a machine with another piece. So you can start with everything on your laptop (`fleetlayer up`), then move the control plane, pages or the sign-in hub to an always-on machine when you outgrow it: stop it, copy its folder, start it there, point the others at its new address. A node keeps its key through a move, so secrets sealed to it stay readable. ## Rules that shape the design - **Fleetlayer never replaces your session manager.** It attaches to herdr (and later tmux, T3 Code and others) without taking it over. Your own apps and terminals keep working beside it. - **Plugins are separate processes.** Nothing is compiled into the node, so a plugin can't crash it, and you can write one in any language. - **Open protocols.** ACP for plugins, JSON-RPC over a WebSocket for the node's [link](https://fleetlayer.ai/link.md) to the control plane, age keys for sealed secrets, OpenID Connect for sign-in. - **Everything in the background is monitored.** Every daemon, sync or scheduled job reports a heartbeat or answers a health check, and the check fails when it stops doing its job, not only when it stops running. ## What's being built One sign-in for every service you run, with your company's provider or a simple built-in directory ([Sign-in and SSO](https://fleetlayer.ai/sso.md)); one deployment shared by a household or a team, each person with their own agents and data; reaching every session from your phone with one pairing; moving a piece with one command; and a server setup an agent can build for you on a fresh machine. --- # Start on your laptop Everything Fleetlayer runs can start on one Mac or Linux laptop: the control plane, a node, the Claude sign-in hub, pages, and a small gateway that gives each of them its own address. When you outgrow the laptop, you move one piece at a time to a home server or a VPS, and the rest keeps working. ## One command ```sh curl -fsSL https://raw.githubusercontent.com/fleetlayer/fleetlayer/main/install.sh | sh fleetlayer up ``` `fleetlayer up` prints where everything is: ``` Fleetlayer is running. Status: http://fleetlayer.localhost:7680 claude-hub http://claude-hub.localhost:7680 control http://control.localhost:7680 pages http://pages.localhost:7680 Hub login key: ~/.local/state/fleetlayer/claude-hub-login Pages login key: ~/.local/state/fleetlayer/pages/login Pages go in ~/Fleetlayer/personal/pages/ ``` It also adds your sessions to the fleet: the herdr plugin when [herdr](https://herdr.dev) is installed and the Claude Code plugin when Claude Code is, and says which it added or skipped and why. Then `fleetlayer sessions` lists them, other machines can message them, and `fleetlayer session start` opens new ones. Session summaries stay off, since each one runs Claude Code and spends tokens: `fleetlayer up --summaries` turns them on. Open the status page. It shows each service, whether it's answering, and where alerts go. The hub and pages ask for their login key the first time (the file's contents); Fleetlayer's own sign-in replaces the keys when it ships. Each piece runs as a user service (a launchd agent on macOS, a systemd user service on Linux), so it starts when you log in and restarts if it crashes. On Linux, `loginctl enable-linger "$USER"` keeps them running while you're logged out. `fleetlayer down` stops them all and keeps every file; `fleetlayer up` again starts them where they left off. Useful flags: `--alerts-to planning` (a session that hears when something goes down; on a later `up` it doesn't change an existing gateway.yaml, so set `alerts.session` there), `--no-hub`, `--no-pages`, `--port 7680`, `--summaries`. ## What's running | Piece | Address | Its files | |---|---|---| | Gateway and status page | `http://fleetlayer.localhost:7680` | `~/.config/fleetlayer/gateway.yaml`, `~/.local/state/fleetlayer/gateway/` | | Control plane | `http://control.localhost:7680` | `~/.local/state/fleetlayer/control/` | | Node | (no web page: `fleetlayer status`) | `~/.config/fleetlayer/node.yaml`, `node-key`, `node-token` | | Claude sign-in hub | `http://claude-hub.localhost:7680` | `~/.local/state/fleetlayer/claude-hub/` | | Pages and apps | `http://pages.localhost:7680`, apps at `--.apps.localhost:7680` | `~/Fleetlayer/personal/` | Everything listens on this machine's own addresses only (`127.0.0.1`, and `[::1]` for the gateway, since macOS answers `*.localhost` with `::1` first): nothing is reachable from your network. The hub and pages pick a free port each time they start and tell the node where they are; the gateway follows them. `fleetlayer services` lists every route. **Plain HTTP, on purpose.** Browsers send `*.localhost` to your own machine and treat it as a secure context, so sign-ins and passkeys work without certificates. TLS belongs on a server, in front of whatever you move there. ## When an agent asks first A new fleet asks you before an agent does something sensitive: starting or attaching to a session on another machine (an approval holds 10 minutes), and each agent's first use of a shared tool, a sync, an admin action or a write to a target (it holds 30 days; for a tool or a sync, 30 days from its last use). Sessions on the same machine aren't checked. The agent's request is refused with a request ID until you answer: ```sh fleetlayer-control approvals list # pending requests: id, who, what, to what fleetlayer-control approvals approve # or: approvals deny (it stands for an hour) ``` Then the agent tries again. `--for 1h` on `approve` changes how long it holds. If your agents work on their own and you'd rather not be asked, apply a policy that turns asking off: ```yaml # policy.yaml version: 2 default: allow ask: [] ``` ```sh fleetlayer-control acl apply policy.yaml ``` `fleetlayer-control acl show` prints the policy in force. Who may do what, and how to ask before only some things, is in [Access control](https://fleetlayer.ai/access-control.md). ## When something stops The gateway checks each service's health every 30 seconds and asks the node how it is (its plugins, its link to the control plane). When something goes down or comes back, you get a desktop notification and, with `--alerts-to` (or `alerts.session` in gateway.yaml), a Fleetlayer message to that session, so an agent can look into it. While the node itself is down, the messages wait and go out when it's back. A crash that the service manager or the node fixes within a few seconds isn't an alert. The gateway also takes heartbeats the way [Gatus](https://gatus.io) does on a server (`POST /api/v1/endpoints//external?success=true|false&error=…`), so a scheduled job (a backup, a sync) reports to the laptop and to a server with the same config, only a different address. Name each one in gateway.yaml, and a heartbeat that stops arriving is an alert too: ```yaml heartbeats: backup: { every: 3600, token_file: ~/.config/fleetlayer/backup-heartbeat-token } ``` Who watches the gateway: launchd or systemd restart it, and the node's health includes the gateway's `/healthz`, so `fleetlayer status` prints `unhealthy: …` when it keeps failing (`health` in `fleetlayer status --json`). ## Moving a piece to a server Each piece keeps its state in one folder and its settings in one file, so a move is: stop it, copy the folder, start it on the other machine, point the laptop at its new address. - **Pages, the hub, any plugin:** run it on the server's node, then on the laptop either leave it out of node.yaml or hide it, and route its name to the new address in gateway.yaml: ```yaml services: pages: { url: "http://10.0.0.5:7670", health: /healthz } ``` `http://pages.localhost:7680` keeps working on the laptop, now served from the server. On the server, its own proxy serves it at its real name (below). - **The control plane:** `fleetlayer down`, copy `~/.local/state/fleetlayer/control/` to the server, start `fleetlayer-control serve` there behind TLS, then set `control.url` in each node's node.yaml to `wss://…/v1/link`. Nodes keep their keys and tokens. - **Joining a fleet that already has a control plane:** on the server, `fleetlayer-control node add ` prints a token; on the laptop, save it to a file and run `fleetlayer up --join wss://control.example/v1/link --token-file `. No control plane starts on the laptop. ## On a server: Traefik and Gatus from the same list On a server you already run a proxy and a monitor. The gateway writes their config from the same routes: ```sh fleetlayer-gateway emit traefik --domain home.example --entrypoint websecure --cert-resolver le \ --middleware auth@file --out /etc/traefik/dynamic/fleetlayer.yml --watch fleetlayer-gateway emit gatus --alert matrix > /etc/gatus/fleetlayer.yaml ``` `emit traefik` writes a router and service for each route (and a `HostRegexp` for pages' apps); `--watch` keeps the file current as plugins restart on new ports, for Traefik's file watcher. On a server, give plugins fixed ports (`listen: 127.0.0.1:7670`) if your proxy runs elsewhere. `emit gatus` writes an endpoint for each health check and an external endpoint for each heartbeat, with `${FLEETLAYER_HEARTBEAT__TOKEN}` for Gatus to fill in from its environment. ## Advanced
gateway.yaml, ports and browsers ```yaml domain: localhost # services are . listen: 127.0.0.1:7680 # and [::1]:7680 too; 0.0.0.0 exposes every service to your network, without TLS services: # services that aren't plugins, or that moved to another machine control: { url: "http://127.0.0.1:7600", health: /healthz } # claude-hub: { hidden: true } # no route and no check for a service a plugin announces alerts: session: planning # tab, or tab@node desktop: true heartbeats: {} node: true # follow the services the node's plugins announce ``` - **Port 80**, so addresses have no port: macOS lets any user bind it; on Linux it needs `sysctl net.ipv4.ip_unprivileged_port_start=80`. Set `listen: 127.0.0.1:80`, and pages' `base_url` to match. - **`*.localhost` outside the browser.** Browsers resolve it themselves; other programs ask the system, and not every system answers (Debian 13 does; Ubuntu 22.04 and its curl 7.81 don't). There, use `curl --connect-to ::127.0.0.1:7680 http://pages.localhost:7680/`, and everywhere, have services talk to each other by their backend address, not their `.localhost` one. - **Cookies on plain HTTP:** browsers refuse `Secure` cookies on subdomains of localhost, so pages and sign-in drop `Secure` when their address is `http://…localhost`, and allow plain HTTP only there. - **A second copy beside the first** (to try a new version, or test without touching the fleet you use): give it its own name and folder. Its services get their own names (`dev.fleetlayer.try.node`, `fleetlayer-try-node`) and its node its own socket, and the first copy keeps running untouched: ```sh export FLEETLAYER_INSTANCE=try HOME=~/fleetlayer-try # in this shell only mkdir -p "$HOME" && fleetlayer up # ports 7690 and 7700 for a second copy; --port, --control-port for a third fleetlayer status; fleetlayer down # the same variables pick this copy ```
## Not in this guide TLS on the laptop, file sync between machines, and backups: for backups, see [Backups for a fleet of agents](https://fleetlayer.ai/guides/backups.md). --- # Set up a node that keeps running You've added a second machine to your fleet: a Linux server, a Mac, or a second Unix user on a machine you already use. Running `fleetlayer-node` in a terminal works until you close the terminal, log out, reboot or update. This guide sets the node up as a service that starts at boot, stays up when nobody is logged in, updates itself, and tells a monitor when it stops doing its job. Ask your agent to add the machine. The steps below are what it does, run as the user the node will run as. A few need you in person (a sudo password, a macOS privacy prompt); those are marked **You:**. The shape: - **Installed by the installer**, so it can update itself from later releases. - **Enrolled with a token** from your control plane, kept in a file only its user can read. - **Run by the machine's own service manager** for its user: a systemd user service on Linux, a launchd agent on macOS. `fleetlayer-node install` writes and starts it. - **Watched by a heartbeat** that goes red when a plugin stops or the link to the control plane drops, and stops arriving when the node dies. If everything still lives on one laptop, [`fleetlayer up`](https://fleetlayer.ai/guides/laptop.md) does all of this (and starts the control plane, the gateway and the rest) in one command. This guide is for a node that joins a fleet whose control plane is elsewhere. The examples use `server` for the new node and `control.example.com` for the control plane. ## 1. Install the binaries As the user the node will run as, on the new machine: ```sh curl -fsSL https://raw.githubusercontent.com/fleetlayer/fleetlayer/main/install.sh | sh ``` It puts the latest release in `~/.local/lib/fleetlayer//`, checked against the release's checksums, and links each binary from `~/.local/bin`. If it prints "Add ~/.local/bin to your PATH", do that before step 3: the service remembers the PATH you install it with. ## 2. Enrol it On the machine that runs the control plane: ```sh fleetlayer-control node add server ``` It prints the node's token once. Enrolling the same name again replaces the token. Since v0.3.8 it finds the database `fleetlayer up` made by itself; on a control plane that keeps it elsewhere, add `--db ` (or set `FLEETLAYER_CONTROL_DB`). Back on the new machine, save the token where only this user can read it, without putting it in a command line or shell history (piped over SSH from the control plane's machine, say): ```sh mkdir -p ~/.config/fleetlayer (umask 077; cat > ~/.config/fleetlayer/node-token) # the token on standard input ``` `~/.config/fleetlayer/node.yaml`: ```yaml name: server # the name you enrolled control: url: wss://control.example.com/v1/link # ws:// only on a private network token_file: ~/.config/fleetlayer/node-token plugins: - name: herdr command: fleetlayer-herdr - name: claude-code command: fleetlayer-claude-code ``` Set `name:` to the enrolled name. Without it the node names itself after the machine (plus `-` for a user other than the machine's first), and if that differs, its log says "the control plane knows this node as …". ## 3. Install it as a service ```sh fleetlayer-node install fleetlayer status ``` `install` reads node.yaml first and refuses a broken one, so a typo doesn't become a service that restarts forever. Then it writes the service file and starts it: | | Service file | Logs | |---|---|---| | Linux | `~/.config/systemd/user/fleetlayer-node.service` | `journalctl --user -u fleetlayer-node` | | macOS | `~/Library/LaunchAgents/dev.fleetlayer.node.plist` | `~/Library/Logs/fleetlayer-node.log` | Both restart the node 10 seconds after it exits. The service runs `~/.local/bin/fleetlayer-node` when that's the binary you ran, and it gets the PATH of the shell you ran `install` from, which is where it finds its plugins, herdr and `claude`. So run `fleetlayer-node install` again after you change your PATH, move the binary or edit node.yaml. On macOS it unloads the old copy and loads the new one; on Linux it restarts the service. `fleetlayer status` should say `linked to the control plane` and list each plugin as running. `--no-start` writes the service file without starting it, and `fleetlayer-node uninstall` stops the service and removes its file. ## 4. Keep it running when you log out **On Linux**, a user's systemd services stop when that user's last session ends, and start again only when they log in. Turn on lingering so they start at boot and stay up (`fleetlayer-node install` prints the same reminder): ```sh loginctl enable-linger "$USER" ``` **You:** for another user it takes sudo, `sudo loginctl enable-linger `, so it's yours to type unless your agent already has sudo on that machine. **On macOS**, the node runs as a launchd agent in your own login session, never as a system-wide LaunchDaemon. Plugins such as [claude-auth-manager](https://fleetlayer.ai/plugins/claude-auth-manager.md) write Claude Code's sign-in to your login keychain, and that needs the keychain unlocked. A LaunchDaemon, or an SSH session on a Mac whose keychain is locked, fails with "User interaction is not allowed". ## 5. Updates A node installed by the installer checks for a new release every 6 hours (the first check 5 minutes after it starts). When there is one, it downloads it, checks it against the release's checksums, unpacks it next to the old one, repoints the links in `~/.local/bin`, and exits so the service manager starts the new version. Choose how much of that it does in node.yaml: ```yaml update: mode: auto # auto: install it. notify: only log that it's out. off: don't check. every_hours: 6 ``` The default is `auto` for a node the installer put in `~/.local/lib/fleetlayer/`, and `notify` for one installed any other way (a package, Ansible, a build from source), since whatever installed it should update it. Such a node only logs that a release is out, even with `mode: auto`. Releases are tagged once per set of features, and each one can need a backup or a look at the release notes first. Set `mode: notify` on a machine where you want to choose the moment. **Upgrading by hand.** Rerun the installer, then `fleetlayer-node install`. A node installed before 26 November 2026 wrote the versioned path (`~/.local/lib/fleetlayer//fleetlayer-node`) into its service file, so swapping the links never reached it and it kept running the old binary. Rerunning `install` writes the link instead. **What a self-update relinks.** The node repoints the links for every binary in the release: `fleetlayer`, `fleetlayer-node`, the plugins, and (from v0.3.8) `fleetlayer-control`, `fleetlayer-gateway` and `fleetlayer-pages`. On a machine still running an older node that runs those three, rerun the installer once. **New binaries in a release.** A release can add a binary the old node didn't know, so the update that installed it didn't link it. When the new node starts from the installer's folder, it links any of its release's binaries that have no link in `~/.local/bin` yet. It never replaces a file or link that's already there, so a link you pointed elsewhere stays yours. A node installed some other way doesn't do this: add the new binary to whatever put the others on PATH. ## 6. Monitor it A service manager restarts a node that crashes. It doesn't notice a node that's running but has lost its link, or whose plugin keeps failing. The heartbeat does: ```yaml heartbeat: url: https://gatus.example.com/api/v1/endpoints/fleetlayer_server/external token_file: ~/.config/fleetlayer/heartbeat-token every: 60 ``` From v0.3.8 the node logs an error when it can't read `token_file` (older nodes sent reports without a token, and didn't expand `~` there). A monitor that refuses a report shows in the node's log as `heartbeat: answered `, so check the log once after setting this up. After a minute's grace at start, the node posts `?success=true` every `every` seconds, or `success=false` with the reason when an enabled plugin isn't running or the control plane link is down. When the node dies, the reports stop, and the monitor's own timeout raises the alert. The URL takes the form Gatus external endpoints use; the [laptop gateway](https://fleetlayer.ai/guides/laptop.md#when-something-stops) takes the same heartbeats, if you don't run Gatus. ## A second Unix user on the same machine Each Unix user runs a node of their own, enrolled under its own name. A second user is the way to keep an agent you trust less apart from yours: for one that reads email or other text strangers wrote, follow [Run an agent that reads strangers' text](https://fleetlayer.ai/guides/untrusted-input.md), which adds the access rules. On Linux, turn on lingering for the new user before anything else (`sudo loginctl enable-linger `): it starts that user's systemd instance, which their services need. Then switch to them (**You:** both take sudo, unless your agent has it). `sudo -iu ` gives you a login shell without the variable systemd's user commands look for, so `systemctl --user` (and `fleetlayer-node install`, which runs it) fails with "Failed to connect to bus". Set it yourself: ```sh sudo -iu server export XDG_RUNTIME_DIR=/run/user/$(id -u) fleetlayer-node install fleetlayer status ``` `fleetlayer status` needs it too: the node's socket is under `$XDG_RUNTIME_DIR` when the service runs, and the command looks for it there. ## Test nodes on a machine where people work A node you start by hand to try something (a policy, a plugin) shares the machine with the real node and with people working in their tabs. Three things keep it out of their way. **Turn off typing.** When a session has no messaging socket, the node types the message into the session's terminal through herdr. A test node with only the herdr plugin always falls back to typing, so a test message lands in the middle of what someone is typing in that tab. In the test node's node.yaml: ```yaml typing_fallback: false # such messages fail at once instead ``` **Give it its own instance.** From v0.3.9, `FLEETLAYER_INSTANCE` runs a second node under the same account without touching the real one: its own launchd label or systemd unit (`dev.fleetlayer.test.node`, `fleetlayer-test-node.service`), its own config and state under the `HOME` you give it, and its own socket. Pointing `XDG_CONFIG_HOME` somewhere else isn't enough: `fleetlayer-node install` would replace the real node's service. ```sh export FLEETLAYER_INSTANCE=test HOME=~/fleetlayer-test mkdir -p "$HOME/.config/fleetlayer" cat > "$HOME/.config/fleetlayer/node.yaml" <<'YAML' name: server-test typing_fallback: false YAML fleetlayer-node install fleetlayer status # the same two variables point the command line at the test node ``` Enrol it under its own name if it should link to the control plane. Open a new shell to talk to the real node again; `fleetlayer-node uninstall`, run with both variables set, removes the test node's service. **Stop it carefully.** `pkill -f fleetlayer-node` also matches the shell running that command (its own command line contains the pattern) and kills it. Put a bracket in the pattern so it can't match itself, and never use `pkill -x fleetlayer-node` where the node runs as a service, since that stops the real one too: ```sh pkill -f 'bin/[f]leetlayer-node' ``` ## When it doesn't work - **"No route to host (os error 65)" on a new Mac.** On macOS 15 and later, a program launchd starts that isn't Apple's can't reach addresses on your local network until it's allowed. **You:** accept the prompt on the Mac. The node retries with backoff, so it usually links once you do. If a fresh install keeps failing this way, check System Settings › Privacy & Security › Local Network. - **"Bootstrap failed: 5: Input/output error"** when reinstalling on macOS: `launchctl bootout` returns before launchd has unloaded the service, and loading it again too soon fails. `fleetlayer-node install` waits until the old copy is gone and retries once. If you reload the plist by hand, wait the same way. - **"Failed to connect to bus"** on Linux: `XDG_RUNTIME_DIR` isn't set, or the user has no systemd instance yet. See [A second Unix user](#a-second-unix-user-on-the-same-machine). - **The node stops when you log out** on Linux: `loginctl enable-linger` isn't on for that user. - **A plugin keeps restarting with "couldn't start fleetlayer-herdr: No such file or directory"**: the service's PATH doesn't include where it lives. Fix your PATH (or give the plugin's `command:` a full path) and run `fleetlayer-node install` again. - **"the control plane knows this node as …"**: `name:` in node.yaml doesn't match the name you enrolled. Set it to the name in the message. - **The node keeps running an old version after an upgrade**: its service file names a versioned path. Run `fleetlayer-node install` again. - **A command from a new release isn't found**: see "New binaries in a release" above. Related: [getting started](https://fleetlayer.ai/getting-started.md), [the node's link to the control plane](https://fleetlayer.ai/link.md). --- # A server VM for your agents Agents on a laptop stop when the lid closes. A session halfway through a task waits until morning, mail and messages pile up with nobody to read them, and an update reboot ends every tab. Give the agents a machine that's always on instead: a VM on a home server, a small rented VPS, a spare mini PC. You keep working from the laptop, and its herdr shows the server's tabs next to its own. The shape: - **A Linux VM that stays on**, made by you. - **A login user for the agents, without sudo**, so an agent can't change the system. You keep an admin account for the few things that need root. - **Lingering on**, so that user's services run with nobody logged in. - **SSH in from the laptop**, through Tailscale SSH or plain SSH keys. - **herdr and Claude Code for that user**, with herdr's server running as a user service. - **A Fleetlayer node**, so the server's sessions join the fleet. The examples call the VM `server`, the agents' user `agents`, and your own machine `laptop`. Ask your agent to do the steps on the server once you can SSH in; the ones only you can do are marked **You:**. ## Why not the laptop Anything an always-on agent depends on has to be always on too. A laptop sleeps, travels, changes networks and reboots for updates, and each time it does, the sessions on it stop and anything they serve to other machines goes with them. Keep the laptop for what needs you there: your signed-in browser, a passkey touch, the terminal you type in. Put the agents, and the services they lean on, on the server. ## 1. The machine **You:** create the VM, or rent the server. Two cores, 4 to 8 GB of memory and 40 GB of disk is plenty for a long-lived triage agent and a few more sessions. Install a current Debian or Ubuntu, and make an admin account for yourself with sudo, reachable only with your SSH key. That account is how you get root later. Your provider's or hypervisor's console is the way back in if SSH ever breaks. Install system software as that admin, or through whatever manages the machine (Ansible, cloud-init, a NixOS config). When an agent needs a package or a system setting, it writes the change into that config or asks you for the command. It never gets root itself. ## 2. A user for the agents, without sudo As your admin account: ```sh sudo useradd --create-home --shell /bin/bash agents sudo loginctl enable-linger agents # its services start at boot and run with nobody logged in ``` Don't add `agents` to the `sudo` or `wheel` group. Check that your own home isn't readable by it (`ls -ld ~` shows `drwx------`; if not, `chmod 700 ~`), and keep your admin account's keys and credentials out of the agents' home. Without lingering, a user's systemd services stop when their last session ends and start again only when they log in. herdr's server and the Fleetlayer node are both user services, so lingering is what keeps the tabs alive overnight. ## 3. SSH in from the laptop The laptop's herdr keeps an SSH connection open to the server and reconnects after every sleep, so whatever you use must let it back in without a prompt. Both of these work. ### Tailscale SSH Tailscale gives the server a name on your private network (`server.tail1234.ts.net`) without opening a port to the internet, and its SSH server checks your tailnet policy instead of keys on the machine. As your admin account on the server: ```sh sudo tailscale up --ssh --advertise-tags=tag:agents ``` **You:** open the link it prints and approve the machine in your Tailscale account. Then, in your tailnet policy, let your own devices SSH in as `agents` with `"action": "accept"`: ```json "ssh": [ { "action": "accept", "src": ["autogroup:member"], "dst": ["tag:agents"], "users": ["agents"] } ] ``` The default action, `check`, asks you to sign in again in a browser every so often. herdr's reconnect can't answer that, so the server's tabs drop out of the laptop's herdr until you do. Give `tag:agents` access only to what it needs on the rest of the tailnet. ### Plain SSH keys On a LAN, or a VPS with a public address, ordinary OpenSSH works as well and needs no extra account. Put the laptop's public key in `/home/agents/.ssh/authorized_keys` (mode 600, in a folder of mode 700), and turn off password sign-in in `/etc/ssh/sshd_config`: ```text PasswordAuthentication no KbdInteractiveAuthentication no ``` A VPS's public SSH port gets scanned all day, so keys only, and a firewall that admits only the addresses you connect from if you can. Reaching a home server from outside your home needs a VPN of some kind either way. Whichever you use, check from the laptop that `ssh agents@server` logs straight in. ## 4. herdr and Claude Code **herdr.** Install it system-wide as your admin account (from [herdr.dev](https://herdr.dev)), the same version the laptop runs: the laptop's herdr attaches to this server, and an older server lacks what a newer client asks for. Then, as `agents`, run its server as a user service so the tabs keep running when no laptop is attached. `~/.config/systemd/user/herdr.service`: ```ini [Unit] Description=herdr server [Service] ExecStart=/usr/local/bin/herdr server Restart=on-failure [Install] WantedBy=default.target ``` ```sh systemctl --user enable --now herdr ``` If you switched to `agents` with `sudo -iu agents`, set `export XDG_RUNTIME_DIR=/run/user/$(id -u)` first, or `systemctl --user` fails with "Failed to connect to bus". On the laptop, save the machine once: ```sh herdr machine add agents@server --label server ``` Its tabs now show in the laptop's herdr. Make a tab, start `claude` in a project folder, and check that you can type in it and scroll back. **Claude Code.** Install it for the `agents` user, following Claude Code's own instructions. Sign it in on this machine: run `claude auth login` in a terminal there, and **You:** open the link, sign in and paste the code back. Never copy another machine's sign-in folder: two machines refreshing the same sign-in knock each other out. [Many Claude accounts on many machines](https://fleetlayer.ai/guides/claude-accounts.md) explains why, and sets up year-long setup tokens instead. Start each session in a project or scratch folder, never the home folder: Claude Code asks whether to trust the folder, and never remembers that answer for the home folder, so an unattended session there waits forever. [Agents that run while you're away](https://fleetlayer.ai/guides/unattended-agents.md) covers the other prompts that stop a session nobody watches. ## 5. A Fleetlayer node Install a node as `agents` and run it as a service, following [Set up a node that keeps running](https://fleetlayer.ai/guides/node-services.md). Lingering is already on from step 2. Run `fleetlayer-node install` from a shell whose PATH finds both herdr and `claude`, since the service keeps that PATH. Add the node's heartbeat while you're there, so you hear when it stops doing its job ([monitoring](https://fleetlayer.ai/guides/monitoring.md)). Once it's linked, the server's sessions can message the laptop's and the laptop's can reach them, under your [access policy](https://fleetlayer.ai/access-control.md). ## More users for agents you trust less Every process of a Unix user can act as any of that user's sessions, so all the agents in `agents` trust each other completely. An agent that reads email, web pages or other text strangers wrote belongs in a user of its own, with its own node and rules that limit what it can reach. [Run an agent that reads strangers' text](https://fleetlayer.ai/guides/untrusted-input.md) sets that up on the same server. An agent that must never reach your network needs a VM of its own. ## Builds go somewhere bigger A small VM is right for agents, which mostly wait, and wrong for big builds. A full Rust build or test run keeps every core busy for minutes and fills the disk, and every other agent on the machine slows down with it. Send heavy builds to a build server; [Notes for agents that build software](https://fleetlayer.ai/guides/agents-building-software.md) has a worked example and the traps it avoids. ## Dev servers on a remote machine An agent runs `npm run dev` on the server and gives you a link. Opening it from the laptop goes wrong in two ways. **Vite answers 403.** It answers only requests for host names it knows: `localhost`, names under `.localhost`, IP addresses, and the names you list. Any other name gets a 403 with `Blocked request. This host ("server.tail1234.ts.net") is not allowed.` Add it to `server.allowedHosts` (`preview.allowedHosts` for `vite preview`) in `vite.config.js`: ```js export default { server: { allowedHosts: ['server.tail1234.ts.net'], // or '.tail1234.ts.net' for every name under it }, } ``` Don't set it to `true`: Vite's docs warn that this leaves the dev server open to DNS rebinding. **The page loads, then breaks.** `crypto.randomUUID`, and other browser features kept for secure contexts, exist only on HTTPS pages and on `localhost`. On `http://server:5173` or `http://10.0.0.5:5173` it's undefined, and the app fails with "crypto.randomUUID is not a function" or something stranger. So open the dev server one of two ways: - **A localhost tunnel.** Nothing to set up on the server, and Vite already allows `localhost`. From the laptop: ```sh ssh -N -L 5173:localhost:5173 agents@server ``` Then open `http://localhost:5173`. Vite's default port is 5173; use whatever the agent's server printed. - **The private network's full name over HTTPS.** Use this when a phone or another machine should open it too. On a tailnet, `tailscale serve --bg 5173` serves the dev server at `https://server.tail1234.ts.net/` with a certificate for that name. **You:** turn on HTTPS certificates for your tailnet in its admin console. `tailscale serve` needs root, or a user named with `sudo tailscale set --operator=agents`, which lets that user change everything about the machine's Tailscale, so you may prefer to run it yourself for a fixed port. Then add that name to `server.allowedHosts`. Put the rule in the project's agent instructions (`AGENTS.md` or `CLAUDE.md`): "dev server links use `http://localhost:` through an SSH tunnel, or `https://server.tail1234.ts.net`, never a bare host name or IP address". Then each new session doesn't hand you a link that half works. ## When it doesn't work - **The server's tabs disappear from the laptop's herdr after a while.** Tailscale SSH is on `check`, which wants a fresh browser sign-in. Set the rule for `agents` to `accept`. - **The laptop's herdr can't do something on the server that works locally.** The server's herdr may be older. Install the laptop's version there and restart the service. - **Tabs and the node stop when you log out.** Lingering isn't on: `sudo loginctl enable-linger agents`. - **"Failed to connect to bus"** from `systemctl --user` after `sudo -iu agents`: set `XDG_RUNTIME_DIR=/run/user/$(id -u)`. - **Sessions keep asking for `/login`.** Two machines share one sign-in. Sign this one in on its own, or use setup tokens ([claude-accounts](https://fleetlayer.ai/guides/claude-accounts.md)). - **A session sits at "Do you trust this folder?"** It was started in the home folder or a folder never trusted. Start it in a project folder. - **Vite answers 403 "Blocked request"**, or **`crypto.randomUUID` is not a function**: see [Dev servers on a remote machine](#dev-servers-on-a-remote-machine). Related: [Set up a node that keeps running](https://fleetlayer.ai/guides/node-services.md), [Start on your laptop](https://fleetlayer.ai/guides/laptop.md). --- # Watch, steer and message your agents Once a few machines are linked, the agents spread out. One works on a branch on the laptop, two more run on a server, and a triage agent reads email under its own user. Each runs in its own terminal tab, in its own session manager, and checking on them means remembering where each one lives and logging in to look. You direct the agents and they do the work. Fleetlayer gives both of you the same handful of commands, which work the same from any machine in the fleet: - **`fleetlayer fleet`** lists every machine and session, with a one-line summary of what each is doing. You glance at it; an agent reads it with `--json` to find the session it should talk to. - **`fleetlayer attach @`** shows a session's terminal on yours. This one is for you: watching an agent at work, or stepping in to answer a prompt. - **`fleetlayer msg send`** puts a message in front of a session. Agents use it to report to each other and hand work on; you use it to give an agent its next job without opening its tab. - **`fleetlayer session start`** opens a new agent session on any machine, with its first prompt, and **`fleetlayer session resume`** brings a stored one back. An agent hands a side job to a fresh session this way. - **`fleetlayer summaries`** searches what every session has done, hour by hour. Ask your agent "what happened with the login bug yesterday" and this is what it runs. - **`fleetlayer subscribe`** routes webhooks (CI results, alerts) to the session that owns the work. The agent working on a branch subscribes itself. Steps only you can do, such as approving a request, are marked as such. This guide assumes nodes linked to a control plane, as in [Getting started](https://fleetlayer.ai/getting-started.md) or [Start on your laptop](https://fleetlayer.ai/guides/laptop.md). The examples use `planning@laptop` and `infra@server`. ## 1. See what's running `fleetlayer sessions` lists the sessions on this machine's node: ```sh fleetlayer sessions ``` ```text planning@laptop claude working 3f2a9c1e-… docs@laptop codex done 8b71d0aa-… ``` The columns are the session's address (its tab name in the session manager, then the node), the harness (`claude`, `codex`), its status, `ended` for a session that has stopped (shown only with `--all`), and the session ID. The statuses: - **`working`:** the agent is in the middle of a turn. - **`done`:** it finished a turn and nobody has looked at it yet. - **`idle`:** it's waiting for input, and you've seen its last turn. - **`blocked`:** it's waiting on a person: a permission prompt or a question. - **`unknown`:** the session manager can't tell. `fleetlayer fleet` asks the control plane instead, and shows every node: ```sh fleetlayer fleet ``` ```text laptop (macbook, online) planning@laptop claude working Moving the billing tests onto the new fixtures. server (server, online) infra@server claude blocked Waiting for approval to restart the database. ``` Each node line gives its name, its machine and whether it's linked now. The last column of each session is the one-line summary of its latest activity, written by the summaries plugin (step 4). Without that plugin, it's empty. Both commands take `--json` for the whole record. That's what agents read: tell an agent to find "the session working on billing" and it looks there. `fleetlayer fleet` shows only what this node may read. The access policy's `read` verb covers the fleet view: a node that may read nothing of another node doesn't see it at all. See [access control](https://fleetlayer.ai/access-control.md). ## 2. Watch or drive a session's terminal ```sh fleetlayer attach planning@laptop ``` The session's terminal fills yours, and what you type goes to it, as if you were sitting at its tab. Use it when an agent is `blocked` on a prompt only you can answer, or to see what it's doing before you redirect it. **Ctrl-]** leaves. The session keeps running, and its own tab is untouched: you're one more viewer, alongside the session manager and anyone else attached. To look without any risk of typing into it: ```sh fleetlayer attach --observe infra@server ``` With `--observe`, the node passes nothing you type to the session. A plain `` with no `@` means a session on this node. For a session on another node, the control plane checks the access policy first. Watching needs `read`, and typing needs `attach`. A policy that leaves `ask:` out asks before every `attach` from another node, and the approval holds for 10 minutes. **You approve it yourself**, on the control plane: `fleetlayer-control approvals list`, then `fleetlayer-control approvals approve `. Run from a plain shell rather than inside a session, you count as `-@` in the policy. A session on your own node is connected straight, without the control plane, since every process of your user can reach it anyway. `--why "…"` gives a one-line reason when the policy has a `justify:` rule for `attach`. `--raw` prints the terminal stream's JSON lines instead of drawing them, for a program that wants to read the screen. Attach needs a session manager that can stream terminals. herdr can; the stream is herdr's own `herdr terminal session observe|control`. [The protocol](https://fleetlayer.ai/protocol.md#terminals) describes how a plugin for another session manager would add it. ## 3. Message a session Most messages go between agents: one finishes a job and tells the session waiting on it, or hands it the next step. You send them too, to give an agent work from wherever you are. ```sh fleetlayer msg send --to planning@laptop "the migration is done, rebase on main" ``` `--to` takes `@`, a bare ``, or a session ID. A bare tab name is looked up on this node first, then on the others, and a tab that's unique in the fleet wins. The message arrives in the session as a turn of its own: ```text Message from a shell on laptop via Fleetlayer: the migration is done, rebase on main ``` Nothing is queued. If the session isn't running, the command fails at once and says so, and you can try later or do the work another way. **From inside an agent session**, the same command names the sender and tells the receiver how to answer: ```text Message from infra (server) via Fleetlayer: The database restart is done. Tests can run again. Reply with: fleetlayer msg send --to "infra@server" "…" ``` So when you set an agent to work, tell it which session to report to (`report to planning@laptop when the tests pass`), and it uses `fleetlayer msg send` like any other command. The receiver can answer straight back. **Use tab names, not Claude Code's own names.** Claude Code gives sessions random cross-session names (`-3d`), and they all change when a machine restarts, so agents that wrote each other's names down lose each other. Tab names belong to your session manager and stay the same across restarts. Name tabs for the work (`billing tests`, `infra`) and address them as `@`. **A wrong name gets suggestions.** Send to `triage` when the tab is called `email triage`, and the error suggests up to three running tabs whose names contain what you typed: ```text fleetlayer: no session named 'triage' here or on any other node; did you mean 'email triage@server'? (…) ``` A name that two sessions on a node share is refused, with both session IDs to send to instead. **`--why "…"`** gives a one-line reason when the policy has a `justify:` rule for `message`. It's recorded with the decision in the audit log. There are no `justify:` rules by default. A message from an agent that reads strangers' text (email, issue trackers) arrives marked as outside data. Setting that up is in [Run an agent that reads strangers' text](https://fleetlayer.ai/guides/untrusted-input.md). ## 4. Start or resume a session anywhere Start an agent in a new tab on any machine, with its first prompt: ```sh fleetlayer session start --on server --tab review --cwd /srv/app --prompt "review the open pull request" ``` The tab opens in the background: nobody's focus moves, and nothing is typed into a session already running. The command answers once the agent takes input and the session is listed, so a message sent straight after reaches it. `--harness codex` starts Codex instead of Claude Code. Leave out `--on` to start it on this machine. **Resume** a stored session by its ID, in the folder it worked in: ```sh fleetlayer session resume 45be65c7-… ``` Fleetlayer finds the machine from the fleet's lists (or the summaries, for a session long gone); `--on` says it yourself. The tab gets the session's old name unless you give `--tab`. **What it won't do.** It refuses a tab name a running session already has, a session that's already running, and the home folder. Claude Code asks "Do you trust this folder?" every time in the home folder, and the session would wait there with nobody to answer, so start sessions in a project or scratch folder. In any other folder Fleetlayer marks that exact folder trusted for Claude Code first. **The agent's flags come from the machine it runs on.** A session starts with what that node's `node.yaml` says, never with anything the caller sends: ```yaml harnesses: claude: { args: [--permission-mode, auto] } ``` **The first prompt names who sent it**, as a message does ("Message from planning (laptop) via Fleetlayer: …", with the reply line), unless you typed it in a shell on that same machine. From an agent that reads strangers' text, it arrives marked as outside data. **Across machines it's under the access policy**: the verb is `start`, on `@` (a resume without `--tab` shows the session ID in place of the tab, so write rules on `*@`). By default an agent asks you first, and your approval lasts 10 minutes; `fleetlayer-control approvals approve ` approves, and a policy with `ask: []` turns asking off. `--json` prints `{node, tab, address, sessionId, promptError}` for other programs: `sessionId` is null until the agent reports one, and `promptError` says why when the session started but its prompt didn't go in. ## 5. Search what your agents did The summaries plugin writes a one-liner, a paragraph and a page for each hour of each session's activity, on the node where the transcripts are, and publishes them to the control plane. Setup and costs are in [fleetlayer-summaries](https://fleetlayer.ai/plugins/summaries.md): it runs headless Claude Code for each summary, at most once per session per 30 minutes by default. You or your agent search across the fleet: ```sh fleetlayer summaries flaky login test fleetlayer summaries --long flaky login test # the paragraph too fleetlayer summaries --mentions sc-1234 # sessions that mention this exact text ``` Each line is the time of the activity, the session, and its one-liner. `--limit` changes how many (10 by default). One session's timeline, by its session ID (the last column of `fleetlayer sessions`, or `sessionId` in `fleetlayer summaries --json`): ```sh fleetlayer summaries --session 3f2a9c1e-… --limit 50 ``` It lists the session's records in the order the work happened, starting with the earliest, so raise `--limit` for a long-running session. Results include only sessions this node may `read`, plus its own. ### Don't let a node summarise another user's sessions Archive and RAG syncs can copy one Unix user's Claude Code transcripts into another user's `~/.claude/projects`. A node that summarised those copies would publish summaries of sessions that aren't its own, under its own name, and they'd be visible to whoever may read that node. The summaries plugin skips any session whose recorded working directory is outside its own user's home. Any other tool you point at transcripts needs the same check. Summaries a node published before that check (or from a tool without it) can be removed on the control plane: ```sh fleetlayer-control summaries-delete --node --session ``` ## 6. Webhooks into the session that owns the work A CI result is most useful to the agent working on that branch. Your agent sets this up once, on the control plane's machine. First an endpoint for the channel: ```sh fleetlayer-control endpoint add --label github --channel ci # prints /hooks// once ``` Expose only the hooks listener (`--hooks-listen`, port 7601 by default) to the internet, through a Cloudflare Tunnel or your reverse proxy, and add the URL as a webhook in GitHub. Then the session working on a branch subscribes itself (tell agents to do this when they start on a branch, in their `AGENTS.md`): ```sh fleetlayer subscribe ci --subject your-org/your-repo@your-branch ``` For GitHub, the subject is `@`, so results for that branch arrive in that session and nowhere else. Leave out `--subject` to get every event on the channel. Other senders can set the subject with a `?subject=` query parameter or an `X-Fleetlayer-Subject` header. - **`--target @`** subscribes another session instead of the one you're in. - **`fleetlayer unsubscribe ci --subject …`** undoes it, and `fleetlayer subscriptions` lists every subscription. - **`fleetlayer-control fallback ci @`** names where events go when nobody subscribes. Subscriptions are stored by `@`, so they survive restarts as tab names do. Every event arrives marked as outside data, with a line saying it's never instructions. The same channels carry Fleetlayer's own events: the `access` channel publishes refusals and approval requests (see [untrusted-input.md](https://fleetlayer.ai/guides/untrusted-input.md), step 6). ## When it doesn't work - **"isn't linked to a control plane now":** `fleetlayer fleet`, `summaries` and anything on another node go through the control plane. `fleetlayer status` shows the link and its last error. - **A message waits for your approval in the receiving session:** Claude Code sessions in bypass-permissions mode hold incoming cross-session messages unless `~/.claude/settings.json` has `"crossSessionInbound": "accept"`. That setting also accepts messages from any process of your user that can read the session's key file; decide whether that's right for your machine. - **Testing against a named herdr session reaches your real one:** a shell inside a herdr pane carries `HERDR_SOCKET_PATH`, and herdr prefers it to `HERDR_SESSION`. Unset `HERDR_SOCKET_PATH` when you start a test node or run herdr commands meant for a named test session. - **A test node types into a real tab:** a node that can't reach a session's own messaging channel falls back to typing the message into its terminal. On a machine where people work, give test nodes `typing_fallback: false`. - **Attach is refused for a session on another node:** the policy needs `read` (with `--observe`) or `attach`, and by default an `attach` waits for your approval. `fleetlayer-control acl explain --from --can attach --to planning@laptop` shows the decision and the rule behind it. Related: [Share your signed-in browser with agents on other machines](https://fleetlayer.ai/guides/browser.md), which uses the same nodes and access policy for shared tools. --- # CI results to the agent that wrote the branch An agent pushes a branch and needs to know whether CI passed, so it can fix what failed or move on. The obvious way is to have it watch: `gh run watch` until the run finishes. That works for one agent. With five or ten agents each watching their own runs, it fails in a way nobody sees coming: they all poll GitHub as you, they use up your account's API allowance together, and every agent gets "API rate limit exceeded" until the hour turns over. There are three ways for the result to reach the agent, from simplest to best: - **Polling**, done carefully: fine for a few agents. - **A GitHub webhook routed by Fleetlayer** to the session that subscribed to that branch: no polling at all. - **The notification email**, read by an email triage agent and forwarded to the right session, if you already run one. ## Polling, and what it costs GitHub allows 5,000 API requests an hour per user, and every agent running `gh` as you shares them. `gh run watch` checks every 3 seconds by default, about 1,200 requests an hour for each run being watched, so four or five agents watching at once use up the hour. If agents poll, give them this in their shared instructions: ```sh timeout 1020 gh run watch --interval 60 --exit-status # once per run; never a loop over gh run list ``` `gh api rate_limit` shows what's left and when it resets. A watcher still costs a request a minute and holds a session while it waits; the next way costs nothing. ## A webhook to the session that owns the branch GitHub can call a URL whenever a workflow run finishes. Fleetlayer's control plane receives it, reads which repository and branch it's about, and delivers it to the session subscribed to that branch. The agent that pushed the branch hears about its own build, as a message in its own session, a few seconds after the run ends. **1. An endpoint on the control plane.** Your agent runs, on the control plane's machine: ```sh fleetlayer-control endpoint add --label github --channel ci # prints /hooks//, once ``` The path includes a secret, so treat the whole URL like a password. **2. Expose only the hooks listener.** The control plane listens for webhooks on a port of their own (`--hooks-listen`, 7601 by default), apart from its API. Put just that one behind a public HTTPS address: a Cloudflare Tunnel, or a route on your reverse proxy that sends only `/hooks/` there. Nothing else of the control plane should be public. **3. Add the webhook in GitHub (you).** In the repository (or the organisation) settings, under Webhooks: the public URL with the path from step 1, content type `application/json`, and the events **Workflow runs** (and **Check suites** if you use checks from other apps). GitHub's settings page is yours to click; an agent with an admin token can add it with `gh api` instead. **4. Agents subscribe when they start on a branch.** Put this in their shared instructions (`AGENTS.md`): ```sh fleetlayer subscribe ci --subject your-org/your-repo@your-branch ``` Fleetlayer reads the subject from GitHub's payload as `@`, so a result for that branch reaches that session and nowhere else. The message reads like `workflow_run CI completed failure on your-org/your-repo@fix-login`, and arrives marked as outside data. Subscriptions are kept by `@`, so they survive restarts. **5. A home for the rest.** Results for branches nobody subscribed to (main, a branch whose agent finished) go to a fallback session: ```sh fleetlayer-control fallback ci planning@laptop ``` Then nobody polls, and the API allowance is left for real work. `fleetlayer subscriptions` lists who's listening to what; `fleetlayer unsubscribe ci --subject …` ends one when the branch is merged. More on channels and subscriptions is in [Watch, steer and message your agents](https://fleetlayer.ai/guides/day-to-day.md). ## The notification email, through a triage agent GitHub also emails you when a workflow run fails. If an email triage agent already reads your mail, it can treat those emails the same way: recognise a CI failure, work out which session owns that repository and branch, and forward it there with `fleetlayer msg send`, instead of leaving it in your inbox. This needs no public endpoint and no webhook settings, and it covers repositories where you can't add a webhook. It's slower than a webhook (email takes a minute or two) and depends on the triage agent's judgement for the routing. [Quietdeck](https://quietdeck.ai), a control deck built on Fleetlayer, does this today. Its triage agent reads the CI failure email, judges which session owns that repository or branch (from the sessions' summaries and what it knows), and proposes a card with a forward action; it can also resume an ended session, or start a new one. By default you approve each forward. A rule you make, together with the project's policy allowing forwards, lets routine ones go out automatically, and those still show in the deck's timeline. Nothing in it is CI-specific: you set up a deck, its runner and a triage agent ([getting started](https://quietdeck.ai/getting-started/)). While an agent is fixing CI, a Quietdeck lease can keep the failure emails out of your inbox until it's done ([leases](https://quietdeck.ai/leases/)). A triage agent reads strangers' email, so give it its own Unix user and limit whom it may message: [Run an agent that reads strangers' text](https://fleetlayer.ai/guides/untrusted-input.md). ## Which to use | | Polling | Webhook | Email | |---|---|---|---| | Setup | none | an endpoint, a public hooks address, a webhook per repo or org | a triage agent | | Speed | up to the interval | seconds | a minute or two | | Cost | API requests from every watcher | none | the triage agent's tokens | | Works for repos you don't admin | yes | no | yes | Most fleets end up with webhooks for their own repositories and polling (at 60 seconds) as the fallback where they can't add one. ## When it doesn't work - **"API rate limit exceeded" in every session:** too many watchers. `gh api rate_limit` says when it resets; then move agents to `--interval 60` or to the webhook. - **The webhook fires but no session hears it:** check the subject. `fleetlayer subscriptions` shows what each session subscribed to; it must be exactly `@`. Events nobody subscribed to go to the fallback, if there is one. - **GitHub shows the webhook failing:** its Recent Deliveries tab shows the response. A 404 means the path is wrong; no response means the hooks listener isn't reachable from the internet. - **The same result arrives twice:** it shouldn't: deliveries are de-duplicated by GitHub's delivery ID. If two sessions both subscribed to the branch, both get it. --- # Instructions that follow your agents to every machine Every agent starts each session from its instructions: a global file for everything it does, and the project's own `AGENTS.md` or `CLAUDE.md`. With one machine, one global file is enough. With a laptop, a server and a VM for agents, the same file is mostly right everywhere and slightly wrong on each: the server has no browser, the VM can't use Touch ID, the laptop reaches the others differently. Agents either get told things that aren't true where they run, or you keep several copies that drift apart. This guide covers three habits the author's fleet runs on, each small, each written into the global instructions so every agent follows it without being reminded: - **One shared global file, plus one file per machine** for what holds only there. - **Two scratchpads per agent:** one that's wiped, one that's kept. - **The agent creates the secrets item before you paste a secret in**, so your part takes seconds. ## 1. A shared global file and a per-machine file Keep the global instructions in one place and sync them to every machine (see [Keep notes, skills and instructions the same on every machine](https://fleetlayer.ai/guides/sync.md)). Next to them, each machine has its own file that the sync leaves out. For Claude Code, that's `~/.claude/CLAUDE.md` everywhere, and `~/.claude/CLAUDE.this-machine.md` on each machine. The global file pulls the machine's file in with Claude Code's import syntax, at the end: ```markdown # This machine Instructions that hold only on the machine you're running on: @~/.claude/CLAUDE.this-machine.md ``` Leave the per-machine file out of the sync. With Syncthing, that's a line in the folder's `.stignore`: ```text CLAUDE.this-machine.md ``` What goes in the per-machine file is whatever an agent would otherwise get wrong there: - **What the machine can't do:** no browser, no Touch ID or keychain, no GUI; a small machine where builds go elsewhere ([Notes for agents that build software](https://fleetlayer.ai/guides/agents-building-software.md)). - **How to reach the rest of the fleet from here:** the node's name, which sessions are on this machine and which are reached with `fleetlayer msg send --to "@"`. - **Where things live here:** the notes vault, the shared folders, the secrets the machine may read. - **Who to ask for what only a person can do:** on a server with no screen, a sign-in or a key touch becomes a task for the person, or a message to a session on their laptop. Write the global file so it never names one machine. When a rule holds only somewhere, it goes in that machine's file. ## 2. Two scratchpads per agent Agents produce two kinds of files that aren't part of a project: intermediate files (a downloaded release, a test database, screenshots before they're picked) and working notes worth keeping (an investigation log, research, a checklist for a long job). Mixing them loses one or the other. - **The wiped one:** `/tmp`, or the session's own scratch folder if the harness gives one. Anything there may be gone after a reboot, and that's fine. - **The kept one:** a folder in your synced notes vault, named after the agent's role (`Agents/triage/`, `Agents/docs/`), or after its session's name when it has no role. It syncs to your other machines and your phone, survives reboots, and is there for the next session that takes the role over. Agents create it when they first need it. Put both in the global instructions, with the rule for choosing: intermediate files go in the wiped one; anything the agent, its successor or you would want next week goes in the kept one. Decisions and anything the team needs still belong where the team looks (the repository, the issue tracker, the pull request), not in an agent's scratchpad. ## 3. Secrets you paste in: the agent makes the item first Some secrets only a person can get: a token generated on a vendor's page, an API key from a dashboard. The slow part is rarely the copy. It's opening the secrets manager, choosing the vault, creating the item, picking its type, naming it and finding the right field, and then telling the agent where it went. Have the agent do all of that first, with an empty field, and then tell you the item's name. With 1Password's command line: ```sh op item create --vault agents --category "API Credential" \ --title cloudflare-site-deploy-token 'credential[concealed]=' \ 'notesPlain=Deploy token for the site (GitHub Actions secret CLOUDFLARE_API_TOKEN). Scope: Workers deploys only.' ``` A new item sits at the top of the vault's list, so you open it, press Edit and paste. The vault, the name and the field are exactly what the agent's code reads, and the notes say what it's for and how narrow it should be. The rules to give agents: - **Create the item, then ask.** Never ask the person to create it, and never ask for the secret in chat. - **Kebab-case names** that say what and where (`cloudflare-site-deploy-token`, not `token2`). - **The right vault:** the one the agent's service account can read, so it can use the secret afterwards without asking again. - **Ask once, with everything:** where to get the secret, what scope to give it, and the item's name. When the agent's own credentials can make the secret (a token with permission to create narrower tokens), it should make it itself, scoped as tightly as the job allows, and save it straight into the item without printing it. ## When it doesn't work - **An agent on the server tries to open a browser or asks for Touch ID:** the per-machine file is missing that machine's limits, or the global file states something only true on the laptop. Move the rule into the right file. - **A change to one machine's file appears on all of them:** the sync isn't leaving it out. Check the ignore list, and that the file's name matches it exactly. - **Notes an agent needed are gone after a reboot:** it wrote them to the wiped scratchpad. Say in the global instructions which kind of file goes where. --- # Keep notes, skills and instructions the same on every machine An agent is only as useful as what it knows about you: the instructions you gave it, the skills you wrote, the notes it reads and the working notes it left itself last week. When all of that lives on your laptop, an agent on your home server or a second laptop starts from nothing. It repeats mistakes you already corrected and asks questions you already answered. Copying files by hand works for a day, then the copies drift and nobody can say which one is current. This guide sets up sync so every machine sees the same notes, skills and instructions, and each kind of file is synced the way that suits it. You decide what is shared and which machine is the source of truth for each thing; your agents set it up and keep it working. The steps are written so an agent can follow them, and the few that need you are marked. This uses `laptop` and `server` for machines and nodes. Change them to yours. ## The shape Three kinds of files, three answers: | What | How it syncs | Why | |---|---|---| | A notes vault you and your agents both edit | Two-way and live (Syncthing or similar) | Anyone may write anywhere | | Skills and shared instructions | One-way from one source (the files plugin) | One place to edit | | Sign-ins, per-machine settings, build output | Never | Secret, per machine, or rebuilt | Under all of it sits a backup with history ([Backups](https://fleetlayer.ai/guides/backups.md)). Sync copies a bad edit or a deletion to every machine just as faithfully as a good one, so it isn't a backup. ## What goes where **Two-way, in the vault:** - your notes, if agents read or write them; - each agent's kept scratchpad, a folder per agent named after its role; - pages and reports agents write for you ([Pages](https://fleetlayer.ai/guides/pages.md)). **One-way, published from one source:** - skills (`~/.claude/skills/`); - the shared instructions, one `AGENTS.md` for every machine; - subagent definitions and other configuration kept as text. **Never synced:** - **Sign-ins:** `~/.claude/.credentials.json`, extra account folders, the macOS Keychain, `gh` and cloud CLI tokens. Two machines refreshing the same OAuth token race each other and sign each other out, so sign in on each machine ([Claude accounts](https://fleetlayer.ai/guides/claude-accounts.md) covers Claude's). - **Per-machine state:** `~/.claude.json`, `settings.local.json`, session and cache folders. - **Per-machine instructions** ([step 3](#3-per-machine-instructions)). - **Dependency trees and build caches:** `node_modules`, `.next`, `.turbo`, `.cache`, `target`, `.venv`, `__pycache__`. - **Live session transcripts.** They're large, append-only and written constantly: back them up one way instead. ## 1. The notes vault: two-way sync A vault is edited by you on your phone and laptop and by agents on every machine, so it needs a tool that syncs both ways and keeps running. Pick by what you already run: - **Syncthing** syncs any folder peer to peer, with no server or account, and runs as a daemon on macOS and Linux. Conflicts become `.sync-conflict-*` files that someone cleans up by hand. Turn on file versioning for some history. It copies symlinks as links. - **Obsidian Sync** suits a vault you also use on your phone: encrypted, versioned, nothing to run. It's paid, with a storage cap, needs the Obsidian app or its headless client on each machine, and is built for vaults rather than `~/.claude`. - **Self-hosted LiveSync** (an Obsidian plugin on CouchDB) is the same idea on a server you run. It skips hidden files, the first sync of a big vault is slow, and when two edits touch the same lines the newer one wins. - **A cloud drive** (Google Drive for desktop, `rclone bisync`) reuses storage you already pay for, with version history. There's no official Linux client, so `rclone bisync` runs on a timer instead of live, and the macOS client can keep files online-only, which an agent reads as missing. The steps below use Syncthing, the simplest fit for a folder that agents write. 1. Install Syncthing on each machine and run it as a service of your user, so it starts at login and keeps running. 2. Share the vault folder from the first machine to the others. **You accept each new device and folder** in the other machine's Syncthing, since pairing is a trust decision. 3. Turn on file versioning for the folder on at least one always-on machine. 4. Add an ignore list before the first sync, in `.stignore` at the top of the folder: ```text node_modules .next .turbo .cache target .venv __pycache__ ``` A pattern without a leading `/` matches at any depth. Agents build apps inside synced folders, and one dependency tree is hundreds of thousands of files that sync slowly, churn every backup and can be rebuilt from the lock file. The same names go in your backup excludes ([Backups](https://fleetlayer.ai/guides/backups.md#what-not-to-back-up)). 5. Add the check in [step 4](#4-check-that-sync-is-working) in the same change. ## 2. Skills and instructions: one-way, from one source Skills and shared instructions change less often, and when two machines edit them at once you want one clear answer. So they're edited in one place and published to the rest. Fleetlayer's files plugin (`fleetlayer-files`, bundled with every release) does that: - **The source node watches a folder** and publishes a new version when its contents change (checked every `every_minutes`, 5 by default). - **Each version is sealed** to each target node's own key before it leaves the source, so the control plane relays it without being able to read it, and doesn't store it. - **Each target makes its folder match**: every file written, and files the plugin wrote for an earlier version removed. A file it didn't write is never touched. It keeps its record of what it wrote in `.fleetlayer-files.json` in that folder. - **Text files only**, at most 1 MB each and 20 MB a set. Files and folders whose names start with `.` are left out. Pick the source for each set: the machine where you and your agents edit skills. Make it an always-on machine if you can (see "When it doesn't work"). Here the source is `server` and the target is `laptop`. ### On the source node Add the plugin to the source's `~/.config/fleetlayer/node.yaml`: ```yaml plugins: - name: files command: fleetlayer-files grants: [sync.publish] config: publish: - { set: skills, dir: ~/.claude/skills, to: [laptop], every_minutes: 5 } - { set: instructions, dir: ~/fleet/instructions, to: [laptop] } ``` - `set` names the set. Its bundle is `files/`, which is how access rules name it. - `dir` is the folder to publish. `~` is the node user's home. - `to` lists the target nodes by name. - The `sync.publish` grant lets the plugin publish through the node at all. ### On each target node ```yaml plugins: - name: files command: fleetlayer-files config: apply: - { set: skills, dir: ~/.claude/skills } - { set: instructions, dir: ~/fleet/instructions } ``` The target's `dir` can differ from the source's. Restart each node so it reads the change (`fleetlayer-node install` rewrites the service and restarts it, on Linux and macOS), then check that `fleetlayer status` lists `files` with the role `sync_source` on the source and `sync_target` on each target. ### Remove hand-made copies once A target never overwrites a file it didn't write. If `laptop` already has its own `~/.claude/skills/review/SKILL.md`, the published one is skipped, and the node's log says `leaving … alone: it wasn't written by fleetlayer-files`. Before the first sync, move each target's existing copies aside (or delete the ones the source has too), so the published versions land. ### Only the source may send A target writes whatever arrives for that set into the folder you named, so only the source should be allowed to send it. In your access policy ([Access control](https://fleetlayer.ai/access-control.md)), forbid every other node: ```yaml version: 2 default: allow deny: - who: "*" except: "-@server" # the source node can: [sync] to: ["sync:files/*@*"] ``` A publish is checked as the source node (`-@server`) doing `sync` to `sync:files/@`. Check the rule before you apply it: ```sh fleetlayer-control acl explain --from=-@server --can sync --to sync:files/skills@laptop --policy policy.yaml fleetlayer-control acl explain --from=-@laptop --can sync --to sync:files/skills@server --policy policy.yaml fleetlayer-control acl apply policy.yaml ``` The first should allow, the second deny. **You approve the first sync to each target.** Unless your policy turns asking off (`ask: []`), Fleetlayer asks before a node's first `sync` to each target. List the waiting requests and approve them: ```sh fleetlayer-control approvals list fleetlayer-control approvals approve ``` From v0.3.9 (on the source, the targets and the control plane), the source sends within about 15 seconds of your approval, and the approval renews each time it's used, so it lapses only after 30 days without a sync. A target that hasn't got the latest version is retried with backoff (a minute, doubling to an hour). A refusal by your access rules, or a request you denied, waits for the next version instead. Upgrade targets before sources. ## 3. Per-machine instructions Some instructions hold on one machine only: this one has no browser, that one can't use Touch ID, this is how to reach the others. Keep them in one small file per machine that is never synced, and have each machine's entry point pull in both the shared file and its own. With Claude Code, `~/.claude/CLAUDE.md` on each machine is just two imports: ```text @~/fleet/instructions/AGENTS.md @~/.claude/CLAUDE.this-machine.md ``` The shared file arrives through the `instructions` set; `CLAUDE.this-machine.md` is written by hand on that machine and stays there. If you sync `~/.claude` with a two-way tool instead, put `CLAUDE.this-machine.md` in its ignore list. What goes in each file: [Instructions that follow your agents to every machine](https://fleetlayer.ai/guides/agent-instructions.md). ## 4. Check that sync is working A sync tool that has lost its connection keeps running, so "is the process up" tells you nothing. Check the work: have one machine write a timestamp into the synced folder, and have another machine check that it arrived recently. Then push the result as a heartbeat, so a stall raises an alert ([Monitoring](https://fleetlayer.ai/guides/monitoring.md)). For the instructions set, add a file next to `AGENTS.md` on the source, rewritten every hour by a timer: ```sh date +%s > ~/fleet/instructions/sync-check.txt ``` On each target, an hourly job checks its age and reports it: ```sh #!/bin/sh token=$(cat ~/.config/fleetlayer/instructions-heartbeat-token) url="http://fleetlayer.localhost:7680/api/v1/endpoints/fleetlayer_instructions/external" age=$(( $(date +%s) - $(cat ~/fleet/instructions/sync-check.txt 2>/dev/null || echo 0) )) if [ "$age" -lt 7200 ]; then curl -fsS -X POST -H "Authorization: Bearer $token" "$url?success=true" else curl -fsS -X POST -H "Authorization: Bearer $token" "$url?success=false&error=instructions+not+synced+for+${age}s" fi ``` Name the heartbeat in the target's gateway.yaml, or let Gatus take it on a server (both in [Monitoring](https://fleetlayer.ai/guides/monitoring.md)): ```yaml heartbeats: instructions: { every: 3600, token_file: ~/.config/fleetlayer/instructions-heartbeat-token } ``` Do the same for the vault: each machine writes its own file (`sync-check/laptop.txt`) and checks the others'. One check covers one path, so give each set and each pair of machines you depend on its own. For the files plugin, Fleetlayer also reports on itself (from v0.3.9). Each bundle and target has a `sync.status` reading (its state, the error, and what to do about it, such as the approve command to run), and each set a `files.set` reading (its files, what was skipped and why, its version): ```sh fleetlayer readings sync.status files.set ``` The node's own heartbeat fails when a sync has waited on a person (an approval, a changed key, an access rule) for over an hour, so an alert reaches you without a check of your own. ## Who writes where - **The vault:** anyone, anywhere. Two-way tools handle edits to different files well. Two edits to the same file before they meet give a conflict copy (Syncthing), or the newer edit wins (LiveSync, for the same lines). Agents keep conflicts rare by writing to their own folders: each agent's scratchpad is named after its role, and pages go in the agent's own space. - **Published sets:** only at the source. An edit made on a target is overwritten by the next version and never travels back. Put that in your shared instructions, so an agent on `laptop` that wants to change a skill asks a session on the source machine to do it (`fleetlayer msg send --to skills@server "…"`) instead of editing its copy. - **Per-machine files:** only on that machine. ## Other ways to do it - **git** (a private repo, with a timer that commits and pulls) gives you full history, diffs and review, and suits skills and instructions well if you already review changes that way. It isn't live, a merge conflict stops the timer until someone resolves it, and sign-ins must never be committed. - **rsync on a timer** is a fine one-way copy between machines that reach each other over SSH. It has no record of what it wrote, so `--delete` removes files made by hand on the target, and without `--delete` removed skills linger. - **A cloud drive** works for a vault if you already pay for one; see the list in step 1 for its limits on Linux and with online-only files. - **Syncthing for everything** is simple and many people use it for `~/.claude` too. You trade the files plugin's single source and "never touches files it didn't write" for edits from anywhere and conflict files to clean up. ## When it doesn't work - **A target never gets a skill.** Look in the source node's log (`journalctl --user -u fleetlayer-node` on Linux, `~/Library/Logs/fleetlayer-node.log` on macOS; `fleetlayer status --json` shows each plugin's last 50 log lines). The publish result names each target with an error: offline, no key yet, a changed key, or refused by your access rules. On the target, `leaving … alone` means a hand-made file is in the way. - **Nothing publishes at all.** One file over 1 MB, or a set over 20 MB, stops the whole set, and the source logs `reading : … is over 1 MB` every interval. Move large files out of the set. - **A file is missing on the target.** Files that aren't valid UTF-8 text (images, binaries) are skipped, and anything whose name starts with `.` is left out. A symlink that points inside the folder arrives as the same symlink; one that points outside it, to nothing, or to a hidden file is skipped. So a skills folder made of links into a repository publishes nothing: publish the folder the links point to. The `files.set` reading lists what was skipped and why (older releases skip every symlink without saying so). - **A script in a skill won't run on the target:** the target runs a release older than v0.3.9, which writes plain files and drops the executable bit. Upgrade it, or have the skill call its scripts through their interpreter (`sh script.sh`, `python3 tool.py`). - **Sync stopped and nobody noticed:** on releases up to v0.3.8, an approval held 30 days whether used or not, and a refused version waited for the folder to change. Upgrade the source, the targets and the control plane; the `sync.status` reading then says what each target is waiting for. - **A target waits while its source is offline.** Bundles are sealed to each target and never stored, so a target that comes back gets the latest version only once the source is linked too (from v0.3.9, the control plane asks the source to resend whenever either side links). Keep the source on an always-on machine. - **Something that watches a synced folder misses changes.** Filesystem events (inotify) see only writes made through the local kernel, so a folder written over a network share, or shared into a VM, never fires an event for writes made on the other side. Anything that reacts to new files there has to poll; [Pages](https://fleetlayer.ai/guides/pages.md#when-it-doesnt-work) does. - **A dropped share looks like an empty folder.** A sync target or a service reading a folder that has gone away sees no files rather than an error. Keep a marker file in the folder and fail the check when it's missing, as pages does with `.fleetlayer-space`. - **Project memories don't show up on the other machine.** Claude Code names each project's folder after its absolute path, so `/Users/you/code/app` on a Mac is `-Users-you-code-app` and `/home/you/code/app` on Linux is `-home-you-code-app`. Keep projects at the same path on every machine, or sync the memories through one shared folder and link each machine's `memory/` to it. --- # Many Claude accounts on many machines You run agents on a laptop, a home server and maybe a VPS, and one Claude subscription stopped being enough, so you have two or three. Then the trouble starts. Sessions ask for `/login` in the middle of their work. One account runs out while another sits unused. Signing every account in on every machine takes an afternoon, and a month later the sign-ins expire and you do it again. This guide explains why that happens and sets up what the author runs instead: one sign-in hub on an always-on machine that holds the sign-ins, a year-long setup token per account sent to every machine, and usage shared across the fleet so an account rotator moves sessions before an account runs out. The hub is early: it works and the author's fleet runs on it, and it will be redesigned. ## Why sign-ins break when they're shared A normal claude.ai sign-in (`/login`, `claude auth login`) holds an access token that lasts about 8 hours and a refresh token that's used once. Each refresh returns a new refresh token and revokes the old one, and the sign-in ends after 30 days however often it's refreshed. That works for one person in one terminal. Two holders of the same sign-in knock each other out: two machines, a copied `.credentials.json`, or many sessions on one machine. Whichever refreshes second gets `invalid_grant`, sometimes writes blank tokens over the winner's, and every session on that account asks for `/login` (Claude Code issues #21765, #24317, #88583 and #108871 describe it). So every machine needs its own sign-in for every account, redone every month: with 3 accounts and 4 machines, that's 12 sign-ins a month. The same race signs remote OAuth MCP servers out daily when dozens of sessions share one token entry. A setup token avoids all of it. `claude setup-token` makes a token that lasts a year and never refreshes, so any number of machines and sessions can hold the same one. You make one per account, once a year. ## What you give up with setup tokens A setup token has only the inference scope. Sessions run Claude normally, but the features tied to a claude.ai account go away: claude.ai connectors disappear from `claude mcp list`, and very likely artifacts, Remote Control and cloud sessions too, since the profile endpoint refuses the token. Several accounts already break those features on their own. Connectors belong to one claude.ai account, so each account has its own set, set up by hand, and each connector holds one identity (one Google account per Gmail or Calendar connector). A session that a rotator moves to another account gets that account's connectors, or none, in the middle of its work. Claude in Chrome answers only the account its extension is signed in to, so a moved session gets "signed in to a different account", and `/login` doesn't fix it. What replaces each one: - **Connectors:** one MCP gateway that holds the sign-ins for every remote MCP server, used by every session on every account. - **Claude in Chrome:** your own Chrome shared through Fleetlayer with Playwright MCP. See [Share your signed-in browser with agents on other machines](https://fleetlayer.ai/guides/browser.md). - **Remote Control:** a relay to your phone for your session manager. - **Artifacts:** pages you host yourself (Fleetlayer's [pages](https://fleetlayer.ai/plugins/pages.md)). If you run one account on one machine and use these features every day, stay on a normal sign-in. This guide is for the fleet that has outgrown that. ## How it fits together - **The hub** is Fleetlayer's claude-auth-manager plugin with `role: hub`, on an always-on machine under a Unix user of its own. It holds each account's normal sign-in, which it uses only to read usage and identity, and each account's setup token. It serves a small web page where you do every sign-in from your own browser. - **Every machine's node** gets the setup tokens in a sealed bundle. The hub's node seals the bundle to each target node's key, and the control plane relays it without being able to read it. Each node writes the tokens into Claude Code's account slots and checks that each one works. - **Usage is shared as readings.** Sessions report the five-hour and seven-day figures from response headers as they work, and the hub polls each account every five minutes. Every node sees the newest figures for every account. - **The account rotator** reads those figures through the coordinator the plugin serves on each node, and moves a session to another account before the one it's on runs out. Account numbers are the same everywhere: account 1 is each machine's default sign-in (`~/.claude`), and 2 and up are the rotator's slots (`~/.claude/accounts/`). Keep the hub off the laptop. The agents on servers depend on it, and it can't poll usage while the lid is closed. `fleetlayer up` starts a hub on the laptop to begin with (see [Start on your laptop](https://fleetlayer.ai/guides/laptop.md)); move it to a server before the server's agents rely on it. The steps below use `server` for the always-on machine, `claudehub` for the hub's Unix user (so its node is `server-claudehub`, the default name for a second user on a machine), and `laptop` and `server` for the nodes whose agents use the tokens. Ask your agent to do steps 1 to 4 and 6; step 5 is yours. ## 1. A Unix user for the hub On the server, as root: ```sh useradd --create-home --shell /bin/bash claudehub loginctl enable-linger claudehub # its services run without anyone logged in ``` The hub's folder holds every account's normal sign-in. With its own user, the agent users on the same machine can't read it. Whoever is root on the machine still can, so put the hub on a machine you administer. ## 2. Its node Enrol it on the control plane (`--db ` if the control plane keeps its database elsewhere): ```sh fleetlayer-control node add server-claudehub ``` As `claudehub`, install Fleetlayer, save the token it printed to `~/.config/fleetlayer/node-token` (mode 0600), and make a login key for the hub's page: ```sh (umask 077; mkdir -p ~/.config/fleetlayer && head -c 32 /dev/urandom | base64 > ~/.config/fleetlayer/claude-hub-login) ``` Then `~/.config/fleetlayer/node.yaml`: ```yaml control: url: wss://control.example/v1/link token_file: ~/.config/fleetlayer/node-token plugins: - name: claude-auth-manager command: fleetlayer-claude-auth-manager grants: [sync.publish, reading.publish] config: role: hub targets: [laptop, server] # the nodes that get the tokens hub: listen: 10.0.0.5:7660 # behind a private HTTPS proxy, never the internet login_file: ~/.config/fleetlayer/claude-hub-login trusted_proxies: [10.0.0.2] # the proxy's address heartbeat: # optional: a Gatus external endpoint url: https://status.example/api/v1/endpoints/claude-hub/external token_file: ~/.config/fleetlayer/claude-hub-heartbeat-token ``` ```sh fleetlayer-node install fleetlayer status ``` Put the page behind your private HTTPS proxy (`fleetlayer-gateway emit traefik` writes the route for it, see [Start on your laptop](https://fleetlayer.ai/guides/laptop.md#on-a-server-traefik-and-gatus-from-the-same-list)) and firewall the port so only the proxy reaches it. Set `trusted_proxies`: the page locks a client address out for 15 minutes after five wrong logins, and behind a proxy every visitor shares the proxy's address unless the hub believes its `X-Forwarded-For`. From v0.3.9 the page can sign people in with Fleetlayer's own sign-in (passkeys, one sign-in for every service) instead of the login key: see the `signin` keys under [The hub](https://fleetlayer.ai/plugins/claude-auth-manager.md#the-hub), and [Sign-in](https://fleetlayer.ai/plugins/signin.md) for the other side. Its state lives in `~/.local/state/fleetlayer/claude-hub` (0700). Leave that folder out of backups. Losing it costs a few minutes of signing in again, and the tokens already on the nodes keep working for up to a year. ## 3. Monitor it Add an uptime check on the page's `/healthz` and an external endpoint for the heartbeat in your monitor. The hub pushes the heartbeat after every five-minute round, with `success=false` and the reasons when an account couldn't be polled or refreshed, or a token belongs to the wrong account. A hub that's running but no longer working alerts too. ## 4. The node half on every machine that runs agents On `laptop` and `server` (each agent user's node), add the plugin with its default role: ```yaml plugins: - name: claude-auth-manager command: fleetlayer-claude-auth-manager grants: [reading.publish, reading.subscribe] ``` Restart the node. When a bundle arrives, the plugin writes each account's token into its slot, removes slots for accounts that left the bundle, and replaces any sign-in someone made by hand in a slot it manages (a hand sign-in expires in a month). `default_slot: false` in its `config:` leaves `~/.claude` alone. Then it runs one small `claude -p` from each slot and publishes the result as a `claude.token_health` reading. - **macOS:** the tokens go into the login keychain, so the node must run as a per-user LaunchAgent, which is what `fleetlayer-node install` sets up. A LaunchDaemon, or an SSH session on a Mac whose keychain is locked, fails with "User interaction is not allowed". The items are `Claude Code-credentials` for account 1 and `Claude Code-credentials-` for the others, the names Claude Code itself reads. - **Linux:** `/.credentials.json`, mode 0600. A LaunchAgent's PATH doesn't include `~/.local/bin`, where Claude Code's installer puts `claude`. The plugin looks there and in the other install places itself; if yours is somewhere else, set `claude: /path/to/claude` in its `config:`. ## 5. Sign each account in (yours) This step is the person's. Open the hub's page in your browser and log in with the key from step 2. For each account: 1. **Press Add account, then Set up.** The page shows Claude Code's sign-in link. 2. **Sign in to claude.ai as that account** in your browser first. A setup token belongs to whichever account the browser is signed in as, and nothing in the token says which. 3. **Open the link, approve, and copy the code** the page shows. It has a `#` in the middle: copy all of it. The hub refuses a code without a `#` before sending it, since `claude setup-token` would fail on a short one and need a new link. 4. **Paste it back** into the hub's page. Set up runs the normal sign-in and then the setup token, so you go through the link twice. The dialog closes by itself when the account is done. The hub runs Claude Code's own `claude auth login --claudeai` and `claude setup-token` for each step, and never calls Anthropic's sign-in endpoints itself. It checks each new token with one request and compares the token's organization with the account's. A token made for the wrong account is refused ("That token is for a different Claude account…"). The hub warns before anything expires: from day 25 for a normal sign-in (which only the hub uses, for usage), and a month ahead for a setup token. The page then offers **Sign in** or **Make token** for that account. ## 6. Use the accounts The hub publishes the bundle whenever a token changes. Check on any machine: ```sh fleetlayer readings claude.token_health claude.usage ``` Each line is a reading's kind, account, node, time and data. `claude.token_health` with `"ok": true` means that node's check passed; `claude.usage` shows the five-hour and seven-day figures, and the hub's polls add each model's own week. For sessions to switch accounts as they fill, install [the many-sessions fork of the Claude account rotator](https://github.com/ndbroadbent/claude-account-rotator), version 0.7.7 or later, in Claude Code. Its sessions find the coordinator the plugin serves and use it. The rotator's panel then says the sign-ins come from the auth hub and offers no Sign in, Add or Remove: those happen on the hub's page. To run one command from a slot by hand (a script, a test), set `CLAUDE_SECURESTORAGE_CONFIG_DIR` to the slot, which is where Claude Code reads the token, and `CLAUDE_CONFIG_DIR` to a scratch folder, so Claude Code leaves its own files there and not in the slot. Unset `ANTHROPIC_API_KEY` and `CLAUDE_CODE_OAUTH_TOKEN`, which would override it. ## Every account in the menu bar [CodexBar](https://github.com/steipete/CodexBar), a macOS menu bar app for AI usage limits, can show several Claude accounts from a program that prints claude-swap's account list. `fleetlayer-claude-accounts` prints the hub's accounts in that format, with the newest usage from any node, so every account shows on every Mac whether or not that Mac holds a sign-in. In CodexBar: Settings › Providers › Claude, turn on "Read accounts from claude-swap", put the full path to `fleetlayer-claude-accounts` (for example `/Users/you/.local/bin/fleetlayer-claude-accounts`) in "claude-swap executable", and leave Source on claude-swap. It needs the Mac's node running and linked, and that node allowed to `read` the hub's node. An account shows `token_expired` when this machine's token check fails or its year is up, `relogin_required` when the hub can't poll it, and `unavailable` until a usage reading exists. CodexBar can't switch accounts through it: the rotator picks each session's account. ## Other ways to run several accounts Four tools solve parts of this, and the right one depends on how many sessions and machines you run. - **[claude-swap](https://github.com/realiti4/claude-swap)** (MIT): a command line that keeps several accounts, switches the machine's active account by hand or automatically before a limit, shows a usage dashboard and a menu bar app, and launches one terminal as another account (`cswap run 2`) for parallel work. It takes setup tokens too (`cswap add-token`), reading their usage from a one-token request when you opt in. It's the most complete tool for one machine, and its account list format is the one CodexBar reads. - **[claude-account-rotator](https://github.com/ivokund/claude-account-rotator)** (MIT): a Claude Code mod that shows each account's usage under the prompt and moves each session to another account before its account runs out, per session rather than machine-wide. It keeps Claude in Chrome connected as the session's account. - **[The many-sessions fork](https://github.com/ndbroadbent/claude-account-rotator)** (MIT): the same mod with one coordinator process per user that reads every account's sign-in and polls usage for all sessions, built for 40 to 60 sessions on one machine. - **Fleetlayer's claude-auth-manager:** the sign-ins live on one always-on hub, every machine gets year-long setup tokens sealed to its key, and usage is shared across the fleet. It runs the fork's coordinator on each node and needs the fork for switching. One machine and a few sessions: claude-swap or the original rotator. Many sessions on one machine: the fork. Many machines: claude-auth-manager with the fork. The design notes are in [claude-auth-manager](https://fleetlayer.ai/plugins/claude-auth-manager.md). ## Limit who can send tokens A node that could publish the tokens bundle could put its own tokens in your slots. Allow only the hub's node, in your [access policy](https://fleetlayer.ai/access-control.md): ```yaml version: 2 default: allow deny: - who: "*" can: [sync] to: ["sync:claude-auth-manager/tokens@*"] except: ["-@server-claudehub"] why: Only the hub's node sends Claude tokens. ask: # replaces the default, which also asks before each first sync - who: "*" can: [start, attach] to: ["*"] for: 10m ``` Keep `sync` out of your `ask:` rules, or write an `ask:` of your own as above. Fleetlayer's default `ask:`, used when no policy is applied or a policy leaves it out, holds each target's first bundle for your approval, and the approval lasts 30 days from the last bundle sent, so it lapses only if the hub stops publishing for a month. While a bundle waits, the hub's node reports it (a `sync.status` reading with the command that approves it) and tries again once you approve, without a restart. `fleetlayer-control acl explain --from=-@server-claudehub --can sync --to sync:claude-auth-manager/tokens@laptop` shows the decision. ## When it doesn't work - **The plugin waits and never serves the coordinator:** one coordinator runs per user, held by `coordinator.lock` in `~/.claude/account-rotator`. A rotator's own coordinator is asked to step down, and the `claude.coordinator` reading says who holds the lock. Sessions need rotator 0.7.6 or later to leave the plugin's coordinator alone. - **"User interaction is not allowed"** on a Mac: the node runs as a LaunchDaemon or over SSH with the keychain locked. Run it as a LaunchAgent (`fleetlayer-node install` as that user, logged in). - **"No such file or directory"** from the token checks on a Mac: the LaunchAgent can't find `claude`. Set `claude:` in the plugin's config. - **"That doesn't look like the full code"** when signing in: the copy lost the part after the `#`. Copy the whole code again. - **"Wrong account"** on an account: its setup token was made while claude.ai was signed in as another account. Sign in to claude.ai as the right account in your browser and press **Make token** again. The hub leaves such a token out of the bundle and fails its heartbeat until then. - **Everyone is locked out of the page after one person's typos:** `trusted_proxies` isn't set, so every visitor shares the proxy's address. - **Nothing reaches a node:** look in the hub's node log for a refused sync (your policy) or a target whose key changed. The hub's node pins each target's key the first time it seals to it, in `~/.local/state/fleetlayer/known-keys.json`, and refuses a changed key until you remove the old pin. - **CodexBar shows nothing:** run `fleetlayer-claude-accounts --list --json` in a terminal. It prints the reason (`NodeUnreachable`, `NoAccounts` when this node may not read the hub's readings, `HubTooOld`). --- # Share your signed-in browser with agents on other machines If you use Claude Code, you may already use Claude in Chrome: Anthropic's Chrome extension that lets a Claude Code session drive your own Chrome, signed in to your own sites. It works very well. An agent can check a deploy in your real admin panel, fill in a form you'd otherwise fill in by hand, or click through the page it just changed, and you can watch it happen. It breaks down in two places, and both come with running more than one agent: - **More than one Claude account.** The extension is signed in to one claude.ai account and answers only that account. A session on a second account (or one an account rotator moved there mid-task) gets "signed in to a different account", and `/login` doesn't fix it. Year-long setup tokens, the practical way to sign many machines in, don't get claude.ai features like Claude in Chrome at all. - **A session on another machine.** The extension talks to Claude Code on the same computer. An agent on your home server or a VPS can't use the browser on your laptop, which is the one that's signed in to everything. This guide sets up the replacement the author uses every day: your own Chrome on your laptop, shared through Fleetlayer with the agents you choose, on any machine, whatever account or model they run on. ## How it works - **[Playwright MCP](https://github.com/microsoft/playwright-mcp)**, Microsoft's browser MCP server, in its extension mode: its Chrome extension connects it to your real Chrome profile, with your sign-ins, instead of a fresh browser. - **The laptop's Fleetlayer node shares it as a tool.** Each session that connects gets its own Playwright MCP process and its own tab group, named after the session. - **A session anywhere uses it** with `fleetlayer mcp browser@laptop` as its MCP server command. The control plane checks it may, joins the two nodes and logs the connection, and never reads what passes through. The laptop has to be awake and online. While it's asleep, sessions elsewhere are refused. ## 1. Playwright MCP on the laptop Install a pinned version in a folder of its own (the version here is the one this guide was tested with): ```sh mkdir -p ~/.local/share/browser-mcp && cd ~/.local/share/browser-mcp npm install @playwright/mcp@0.0.86 ``` Install the Playwright MCP Bridge extension in Chrome (linked from the Playwright MCP README). Its page shows a token that lets connections in without a prompt each time. Save it where only you can read it: ```sh mkdir -p ~/.config/browser-mcp (umask 077; pbpaste > ~/.config/browser-mcp/extension-token) # after copying the token ``` ## 2. Share it from the laptop's node Add a `tools:` section to the laptop's `~/.config/fleetlayer/node.yaml`: ```yaml tools: - name: browser # Run node directly: a launchd or systemd service may not have npx on its PATH. command: /opt/homebrew/bin/node args: ["/Users/you/.local/share/browser-mcp/node_modules/@playwright/mcp/cli.js", "--extension", "--profile-dir-name", "Default", "--session-name", "{session}", "--ignore-roots"] cwd: ~/.local/state/fleetlayer/tools/browser # an empty folder: uploads are confined to it env: PLAYWRIGHT_MCP_EXECUTABLE_PATH: "/Applications/Google Chrome.app/Contents/MacOS/Google Chrome" PATH: /opt/homebrew/bin:/usr/bin:/bin env_files: { PLAYWRIGHT_MCP_EXTENSION_TOKEN: ~/.config/browser-mcp/extension-token } allow: ["*@server"] # which sessions may connect: @ patterns networks: ["192.168.1.0/24"] # optional: offer it only while the laptop is on your home network tools: deny: [browser_run_code_unsafe] # always on in Playwright MCP: arbitrary code in the server's process on_close: [{ name: browser_tabs, arguments: { action: close, index: 0 }, repeat: 50 }] close_with: [browser_close] # from v0.3.9: browser_close only disconnects in extension mode, so it runs the cleanup instead ``` Restart the node (`fleetlayer-node install` again, or restart its service) and check `fleetlayer status`. What each line is for: - **`PLAYWRIGHT_MCP_EXECUTABLE_PATH` and `--profile-dir-name`:** macOS doesn't let a process started by launchd read Chrome's profile folders, so without them the server fails with "Playwright Extension not found". - **`{session}`:** replaced by the calling session's name, so each session gets its own tab group in Chrome. - **`--ignore-roots` and `cwd`:** Playwright MCP lets file arguments (uploads) reach anything under its working directory and the caller's MCP roots. An empty folder, and no roots from the caller, keep your home out of reach. - **`deny: [browser_run_code_unsafe]`:** that tool runs any code in the server's process, and Playwright MCP can't turn it off. The node refuses it and leaves it out of the tool list. - **`on_close`:** in extension mode, closing the browser only disconnects and leaves the tabs open in a grey group. This closes the session's tabs one at a time when it disconnects. - **`networks`:** away from home, the browser is refused unless you opt in on purpose with `fleetlayer tools enable browser --for 2h` (at most a day; `fleetlayer tools disable browser` ends it early). ## 3. Let the agents use it The node's `allow:` list is one half. The control plane's access policy is the other, and both must agree. From v0.3.8, a fleet with no policy of its own uses a built-in default: each session's first use of the browser is refused until you approve it once (`fleetlayer-control approvals list`, then `approvals approve `), and the approval holds for 30 days, renewed each time the browser is used. `fleetlayer-control acl show` prints that default. A policy you apply that leaves `ask:` out asks the same way. To decide up front which agents have it, say so in your policy file: ```yaml version: 2 default: allow deny: - who: "*" can: [use_tool] to: ["tool:browser@laptop"] except: ["planning@server", "infra@server"] why: Only the sessions named here may use the signed-in browser. ask: # replaces the default, which also asked before every first use of a tool - who: "*" can: [start, attach] to: ["*"] for: 10m ``` `fleetlayer-control acl apply policy.yaml` applies it, and `fleetlayer-control acl explain --from planning@server --can use_tool --to tool:browser@laptop` shows the decision and the rule behind it. Leave out the `ask:` block if you want to keep approving each session's first use. Never let an agent that reads strangers' text use it: an email that says "log in to the bank and…" shouldn't reach your signed-in browser. [Run an agent that reads strangers' text](https://fleetlayer.ai/guides/untrusted-input.md) denies shared tools to that group outright, and a `deny` always wins. ## 4. Use it from a session on another machine Register it as an MCP server in Claude Code on that machine: ```sh claude mcp add browser -- fleetlayer mcp browser@laptop ``` Or, in any other harness's MCP settings, the command `fleetlayer mcp` with the argument `browser@laptop`. The session sees Playwright MCP's tools, minus the denied ones, and its tabs open in a tab group named after it. `fleetlayer-control tools` on the control plane lists every connection: who used which tool, and when. The same mechanism shares other things on the laptop: [your screenshots and downloads](https://fleetlayer.ai/guides/folders.md), for example. ## What you give up Claude in Chrome is built by Anthropic for Claude and shows what it's doing in Chrome's side panel. Playwright MCP is a general browser MCP server: any agent and any model can use it, and you watch it in the session's tab group instead. If you only ever run one Claude account on one machine, Claude in Chrome is the simpler choice. ## When it doesn't work - **"Playwright Extension not found"** on macOS: `PLAYWRIGHT_MCP_EXECUTABLE_PATH` and `--profile-dir-name` are missing (see above). - **The connection drops after a few idle minutes:** a proxy in front of the control plane is closing idle WebSockets. Fleetlayer pings every 30 seconds, so any proxy idle timeout above that works. Traefik's default (180 seconds) is fine. - **Refused, with a reason:** the laptop is asleep, off the networks you listed, or the session isn't allowed. The refusal says which. --- # Your Mac's screenshots and downloads, for agents anywhere You take a screenshot of a broken page, or download an invoice or a log file, and want an agent to look at it. When the agent runs on the same Mac, you paste the path. When it runs on your home server or a VPS, you're copying files around, every time. This guide shares a few chosen folders on your Mac with the agents you pick, wherever they run. You say "look at the screenshot I just took", and the agent fetches it and sees it. It reaches only the folders you name, and it's read-only unless you let an agent put files there or tidy up (section 5). ## How it works - **`fleetlayer-folders`**, which ships with Fleetlayer, is a small MCP server that lists and reads the folders it's given ([reference](https://fleetlayer.ai/plugins/folders.md)). - **The Mac's node shares it as a tool**, like [the shared browser](https://fleetlayer.ai/guides/browser.md). Each session that connects gets its own copy. - **An agent anywhere uses it** with `fleetlayer mcp folders@laptop` as its MCP server command. The control plane checks it may, joins the two nodes and logs the connection, and never reads the files that pass through. The Mac has to be awake and online. ## 1. Pick the folders macOS saves screenshots to the Desktop unless you change it. A folder of their own is tidier, and macOS doesn't protect it, so it needs no permission: press Shift-Command-5, open **Options**, choose **Other Location...** and make `~/Screenshots`. Downloads works too, after one permission step (section 3). It's also where files from strangers and your private documents land, so think about which agents should see it (section 4). ## 2. Share them from the Mac's node Add a `tools:` entry to `~/.config/fleetlayer/node.yaml` on the Mac: ```yaml tools: - name: folders command: /Users/you/.local/bin/fleetlayer-folders # the full path: launchd's PATH is short args: ["--folder", "screenshots=~/Screenshots", "--folder", "downloads=~/Downloads"] allow: ["*@server"] # which sessions may connect: @ patterns networks: ["192.168.1.0/24"] # optional: offer it only while the Mac is on your home network ``` Restart the node (`fleetlayer-node install` again, or restart its service) and check `fleetlayer status`. `networks` works as it does for the browser: away from home the folders are refused unless you opt in for a while with `fleetlayer tools enable folders --for 2h`. ## 3. Let the node into Downloads macOS keeps programs out of Downloads, Desktop and Documents until you allow them, and that includes a program the node starts. The first time an agent reads Downloads, macOS either asks you, on the Mac's screen, to let the node in, or refuses quietly. The tool tells the agent which, and the agent tells you. To allow it up front: System Settings > Privacy & Security > **Files and Folders**, find `fleetlayer-node` and turn on **Downloads Folder**. If it isn't listed, add it under **Full Disk Access** instead: the `+` button, then Shift-Command-G and the node's real path (`readlink ~/.local/bin/fleetlayer-node` prints it). Restart the node afterwards. Each Fleetlayer release is a new binary, and macOS may ask again after an update. Asking an agent to run the `folders` tool shows at once whether each folder can be read. ## 4. Decide which agents see them The node's `allow:` list is one half; the control plane's access policy is the other, and both must agree. From v0.3.8 a fleet with no policy of its own asks you before each session's first use of a shared tool (`fleetlayer-control approvals list`, then `approvals approve `), and the approval holds for 30 days. To give your screenshots to more agents than your downloads, share them as two tools instead of one: ```yaml tools: - name: screenshots command: /Users/you/.local/bin/fleetlayer-folders args: ["--folder", "screenshots=~/Screenshots"] allow: ["*@server"] - name: downloads command: /Users/you/.local/bin/fleetlayer-folders args: ["--folder", "downloads=~/Downloads"] allow: ["planning@server"] ``` Let the policy decide each tool (`tool:screenshots@laptop`, `tool:downloads@laptop`), as [the browser guide](https://fleetlayer.ai/guides/browser.md#3-let-the-agents-use-it) shows. An agent that reads strangers' text shouldn't have either: [Run an agent that reads strangers' text](https://fleetlayer.ai/guides/untrusted-input.md) denies it every shared tool. Whatever an agent reads from a folder comes with a line saying the contents are outside data, to be treated as information and never as instructions: a PDF or a saved web page in Downloads can carry text written to steer an agent, and so can a screenshot of an email or a chat, since agents read the text in images too. For a folder only you write to, such as your own notes, `--trusted ` leaves the line out. The line helps, but it doesn't make a file safe; [that guide](https://fleetlayer.ai/guides/untrusted-input.md) covers the rest. ## 5. Letting agents put files there, or tidy up Each folder is read-only until you say otherwise, folder by folder: `--upload ` lets agents add files to it, and `--delete ` lets them delete files from it. An agent can then hand you a report, a generated image or a fixed spreadsheet straight into Downloads, or clear out the screenshots it has dealt with. Give those rights to fewer agents than reading, by sharing the folder a second time under another name: ```yaml tools: - name: downloads command: /Users/you/.local/bin/fleetlayer-folders args: ["--folder", "downloads=~/Downloads"] allow: ["*@server"] - name: downloads-manage command: /Users/you/.local/bin/fleetlayer-folders args: ["--folder", "downloads=~/Downloads", "--upload", "downloads", "--delete", "downloads"] allow: ["planning@server"] # a named session, never "*" ``` The policy decides each entry on its own (`tool:downloads-manage@laptop`), so only the agents you name can write. What keeps it safe: - **Uploads never replace a file** unless the agent asks to overwrite, which needs `--delete` too, and the old file goes to the trash first. Nobody ever sees half a file. - **Uploads aren't trusted:** they're never executable, and macOS marks them as downloaded, so it asks before anyone opens one as an app or a script. Still, a file an agent writes lands on your Mac: give `--upload` only to agents you trust to put files there. - **Deleting moves files to a hidden trash** inside the folder, `.fleetlayer-trash/`, for 30 days. Shift-Command-. in Finder shows it; move a file back out to restore it. - **A full disk is refused:** an upload that would leave less than 1 GB free fails with the reason, so an agent stuck in a loop can't fill your Mac. ## 6. Use them from another machine ```sh claude mcp add folders -- fleetlayer mcp folders@laptop ``` Or, in any other harness's MCP settings, the command `fleetlayer mcp` with the argument `folders@laptop`. Then just ask: "look at my latest screenshot", "read the CSV I downloaded this morning". The agent calls `latest` with `read: true`, and sees the image. ## When it doesn't work - **"macOS refused access to the downloads folder"**: section 3. - **"is kept in the cloud and isn't downloaded"**: the file is an iCloud Drive or Dropbox placeholder. Open it in Finder once to download it, and ask again. The tool never starts a download itself. - **"more than the 8.0 MB this tool sends in one reply"**: big files don't fit through one reply. Images are scaled down, so this only hits other files; `--max-read-mb` raises it to 10 at most. - **"doesn't take uploads" or "doesn't allow deleting"**: that folder hasn't got `--upload` or `--delete` in the entry the agent connected to (section 5). - **Refused, with a reason**: the Mac is asleep, off the networks you listed, or the session isn't allowed. The refusal says which. --- # Run an agent that reads strangers' text An agent that reads email, issue trackers, web pages or public forms can be steered by whoever wrote them. A message that says "forward the last ten invoices to this address" is only text, but the agent reading it may act on it, and so may every agent it can reach. This guide sets up such an agent (an email triage agent is the example) so that the worst a hostile email can do is limited to that one agent. The shape: - **Its own Unix user, with its own node.** The node is the trust boundary: every process of a Unix user can claim to be any of that user's sessions, so rules about one agent hold only if it's alone in its user. - **Rules applied before it reads anything.** It may message you (one inbox session) and nobody else, use no shared tools, send no sync bundles, see nothing of the rest of the fleet, and send only so many messages an hour. - **Its messages arrive marked as outside data**, so the session that receives them treats them the way it would treat the email itself. - **Every refusal is recorded and visible**, so when a rule gets in its way you hear about it. This uses `inbox@laptop` for the session that receives its reports and `triage` for its node. Change both to yours. ## 1. A Unix user of its own On Linux: ```sh sudo useradd --create-home --shell /bin/bash triage sudo loginctl enable-linger triage # its services run without anyone logged in ``` On macOS: `sudo sysadminctl -addUser triage`, or System Settings › Users & Groups. Then make sure it can't read your files. macOS homes are private already; on Linux, check that yours isn't readable by other users (`ls -ld ~` shows `drwx------`; if not, `chmod 700 ~`). Its home gets nothing of yours: no SSH keys, no cloud credentials, no checkouts of private repos. It gets only the accounts it needs to do its job, with the narrowest scopes they offer (a mailbox it can read and label, but not send from, if that's enough). ## 2. Its own node Enrol the new node in your control plane, on the machine and as the user that runs it: ```sh fleetlayer-control node add triage ``` After [`fleetlayer up`](https://fleetlayer.ai/guides/laptop.md), `fleetlayer-control` finds the control plane's database by itself. On a server that keeps it elsewhere, pass `--db ` (or set `FLEETLAYER_CONTROL_DB`) on this and every command below. It prints a token. As the triage user, save it and install the node: ```sh sudo -iu triage curl -fsSL https://raw.githubusercontent.com/fleetlayer/fleetlayer/main/install.sh | sh mkdir -p ~/.config/fleetlayer (umask 077; cat > ~/.config/fleetlayer/node-token) # paste the token, then Ctrl-D ``` `~/.config/fleetlayer/node.yaml` for the triage user: ```yaml name: triage control: url: ws://127.0.0.1:7600/v1/link # wss://… when the control plane is on another machine token_file: ~/.config/fleetlayer/node-token plugins: - name: herdr command: fleetlayer-herdr - name: claude-code command: fleetlayer-claude-code ``` On Linux, a shell opened with `sudo -iu` has no `XDG_RUNTIME_DIR`, so `systemctl --user` (which the install runs) fails with "Failed to connect to bus" and `fleetlayer status` can't find the node. Set it first: ```sh export XDG_RUNTIME_DIR=/run/user/$(id -u) # Linux, in the sudo -iu shell fleetlayer-node install fleetlayer status # "linked to the control plane" ``` ## 3. The rules, before it reads anything A new control plane allows every message, and asks you before each agent's first use of a shared tool or sync, which suits a fleet of agents you trust. Add the rules before the triage agent starts. `policy.yaml`, kept in git where the agents it limits can't change it: ```yaml version: 2 default: allow # everyone else keeps working as before groups: untrusted-input: ["*@triage"] # every agent that reads text strangers wrote deny: - who: group:untrusted-input can: [use_tool, sync, start, attach] why: Reads strangers' email. No shared tools, no secrets or skills sent, no sessions started or typed into. only: - who: group:untrusted-input can: [message] to: ["inbox@laptop"] why: Reports to the inbox session only. - who: group:untrusted-input can: [read] to: [] # no fleet view, no summaries or catch-ups of other sessions untrusted: [group:untrusted-input] limits: - who: group:untrusted-input messages_per_hour: 60 distinct_recipients_per_hour: 3 ``` ```sh fleetlayer-control acl apply policy.yaml ``` A `deny` can't be undone by a broader rule anywhere else in the file, so a later `allow` for `"*"` doesn't reopen the browser to it. Any session it messages may still reply, and the triage agent may answer that reply within 24 hours. ## 4. Check the rules Ask the control plane what it would decide, and why: ```sh fleetlayer-control acl explain \ --from triage@triage --can use_tool --to tool:browser@laptop ``` Then write down what you expect, so a later change to the policy can't quietly break it. `policy-tests.yaml`: ```yaml - { from: triage@triage, can: message, to: inbox@laptop, expect: allow } - { from: triage@triage, can: message, to: infra@home, expect: deny } - { from: triage@triage, can: use_tool, to: "tool:browser@laptop", expect: deny } - { from: triage@triage, can: read, to: infra@home, expect: deny } - { from: inbox@laptop, can: message, to: triage@triage, expect: allow } ``` ```sh fleetlayer-control acl test policy-tests.yaml --policy policy.yaml ``` It runs offline and exits non-zero on any mismatch, so it belongs in the CI of the repo that holds the policy. ## 5. What the inbox session sees A message from the triage agent arrives labelled as outside data. The inbox session should treat a summary the same way it treats the email it summarises: as information to weigh, never as instructions. Say so in the inbox session's own instructions (its `AGENTS.md` or `CLAUDE.md`): it acts on what you ask, and on what the triage agent reports only once you've agreed. ## 6. Hear about refusals Every refusal names the rule, and the agent that hit it is told to report it rather than work around it. To see them: ```sh fleetlayer-control acl log ``` To have a session hear about them as they happen, subscribe it to the `access` channel, where each one is published as an `access.denied` event: ```sh fleetlayer subscribe access --target inbox@laptop ``` A rule that keeps getting in the way of the job is worth changing, in the policy file, by you. Don't let an agent change it. ## What this doesn't cover Fleetlayer controls what crosses the fleet: messages, shared tools, sync, the fleet view. It doesn't control what the triage user can do on its own machine. It can still reach the network, read anything on the machine that's readable by every user, and use any credentials in its home. Keep those small, and give an agent that must never reach your network a VM of its own instead of a Unix user. Related: [access control](https://fleetlayer.ai/access-control.md), the full policy language. --- # Agents that run while you're away You leave a Claude Code session working on a server overnight. In the morning it has done ten minutes of work and then spent seven hours waiting on a question nobody was there to answer. Bypass mode was on, so you didn't expect any questions at all. Bypass mode skips most prompts. A few still get through, and a session nobody watches waits on them forever. This guide covers the ones the author has hit running a fleet of unattended sessions, and how to get past each one: - **Messages from other sessions** are held for approval in bypass mode, until you change one setting. - **Deleting a path built from a variable** asks even in bypass mode. An undocumented switch lifts it, and a hook of your own takes over the check. - **A node started by launchd can't find `claude`**, because launchd's PATH is short. - **Sessions lose each other's names after a restart**, so they need a name that stays put. Everything about Claude Code here was tested on Claude Code 2.1.332 on Linux. Two of the fixes rely on behaviour Anthropic doesn't document, and a later version can change or remove it. Check again after you upgrade. ## 1. Run in bypass mode Start each session with `claude --dangerously-skip-permissions`, or set it as the default in `~/.claude/settings.json`: ```json { "permissions": { "defaultMode": "bypassPermissions" } } ``` Bypass mode lets the agent run any tool without asking. Use it only for agents you'd trust with your user account, on a machine where that's acceptable. An agent that reads strangers' text (email, issues, web pages) needs more than this: see [Run an agent that reads strangers' text](https://fleetlayer.ai/guides/untrusted-input.md). ## 2. Let messages from other sessions through Fleetlayer delivers a message to a Claude Code session through Claude Code's own messaging socket, so the agent sees who wrote and nothing is typed into your terminal. In bypass mode, Claude Code holds every message that arrives this way until you approve it in the session's tab. An unattended session never sees them. To deliver them straight away, add this to `~/.claude/settings.json` on the machine that runs the sessions: ```json { "crossSessionInbound": "accept" } ``` Know what you're accepting. With this setting, Claude Code also accepts unattested messages from any process of your user that can read the session's key file (it sits beside the session's registration in `~/.claude/sessions/`). On a machine where everything running as your user is yours, that changes little. Where other programs run as your user and you'd rather they couldn't put words in an agent's mouth, leave it off and approve messages by hand, or move those programs to a user of their own. The choice is yours. ## 3. The prompt bypass mode can't skip Claude Code checks Bash commands for one shape on its own: `rm` or `rmdir` on a path built from a variable that might be empty. That includes variables inside command substitutions and variables derived from other ones. The prompt reads "Dangerous rm operation on possibly-empty variable path". It asks even under `--dangerously-skip-permissions`, and it "cannot be auto-allowed by permission rules". The check has a good reason: `rm -rf "$DIR/"*` with `DIR` empty deletes far more than anyone meant. It also catches plenty of safe commands. In the author's fleet, a worker agent sat all night on `rm -f $C/$ID.json`, where `$C` came from a sourced file, inside a forked subagent. There are two parts to the fix. A switch turns Claude Code's check off, and a hook of yours puts a check back. Do both, or neither: the switch alone means nothing checks deletes at all. ### The switch `CLAUDE_CODE_EVEN_MORE_DANGEROUSLY_SKIP_PERMISSIONS=1` lifts these prompts. It isn't documented anywhere; it was found by reading the Claude Code binary. It takes effect only when all of these hold: - The session runs in bypass mode (`--dangerously-skip-permissions`, or `defaultMode: bypassPermissions`). - The session isn't a child session (Claude Code marks those with `CLAUDE_CODE_CHILD_SESSION`). - No `ask` or `deny` permission rule touches removals. - No `PermissionRequest` hook is configured. - No managed settings are in force. When one of them fails, Claude Code logs that the variable "has no effect" and keeps asking. Set it in the real environment of the process that starts `claude`, which for unattended sessions is usually the session manager's service unit. For a systemd user service: ```ini [Service] Environment=CLAUDE_CODE_EVEN_MORE_DANGEROUSLY_SKIP_PERMISSIONS=1 ``` Setting it in the `env` block of `settings.json` doesn't work: Claude Code drops it from the environment it gives children. Restart every session after the change, then check that a running session really has it: ```sh tr '\0' '\n' < /proc//environ | grep EVEN_MORE ``` ### The guard hook With the switch on, a `PreToolUse` hook on Bash takes over the check. It reads the command Claude Code is about to run, and when it refuses, it exits with status 2 and writes the reason to stderr. Claude Code shows that reason to the agent, which can retry with a fixed command. The rules that work in the author's setup refuse the shapes that go wrong without anyone meaning it: - A path that comes from a command substitution (`rm -rf "$(pwd)/build"`). - An unquoted variable (`rm -f $C/x`). - A variable that may be empty. A variable counts as safe when it's a `${NAME:?}` guard, when it's set to a literal earlier in the same command, or when it's `HOME` or `TMPDIR`. `${C:-/tmp}` isn't a guard: it hides the empty case instead of stopping on it. - A relative path after a `cd` the hook can't follow. - `xargs rm -r`, which takes its paths from another command. - A floor nobody means: `/`, the home directory, any top-level directory, or a glob of one (`/*`, `~/*`). - Over `ssh`, any variable in a recursive delete (it expands on the other host), and the same floor. Every other literal or guarded path runs. Don't go further and confine recursive deletes to the session's own folder and `/tmp`. The author tried that, and it refused a checked literal path to a build folder in another repository that the person wanted gone. Two rules matter more than the rest: - **The hook must be at least as strict as Claude Code's check** on the same command shapes. With the switch on, the hook is the only check, so a looser hook lets through deletes Claude Code would have stopped. Without the switch (an upgrade that removed it, or a condition above that stopped holding), the cases the hook lets through fall back to Claude Code's prompt, and the session hangs again. - **The hook answers fast and never asks.** A hook that waits for input is the same problem in a new place. The author's takes about 18 ms a call, run with `python3 -I` and only the standard library. Make the refusal say how to fix the command, for example: Rewrite it with a guard on every variable, e.g. `"${C:?}"/"${ID:?}".json`, or use a literal path. The agent then retries at once instead of giving up. Here is a skeleton to start from. It covers command substitutions, unquoted variables, unguarded variables, `xargs rm` and the floor. It doesn't follow `cd` or look inside `ssh` commands, and it splits commands with regular expressions rather than a shell parser. Treat it as a starting point and test it against the commands your agents really run before you rely on it. ```python #!/usr/bin/env python3 # A starting point, not a finished guard: test it against the commands your agents really run. import json import re import sys ALWAYS_SET = {"HOME", "TMPDIR"} VAR = re.compile(r"\$(?:\{([A-Za-z_]\w*)([^}]*)\}|([A-Za-z_]\w*))") RM = re.compile(r"(?:^|[\s;&|(])(rm|rmdir)\s+([^;&|\n]*)") FLOOR = re.compile(r"""^["']?(/|~|\$HOME|\$\{HOME\}|/[^/\s"']+)/?\*?["']?$""") FIX = 'Rewrite it with a guard on every variable, e.g. "${C:?}"/"${ID:?}".json, or use a literal path.' def refuse(why): print(f"Refused by the rm guard: {why} {FIX}", file=sys.stderr) sys.exit(2) def set_earlier(cmd, name, before): return re.search(rf"(?:^|[\s;&]){name}=[^\s;&|$`]+", cmd[:before]) is not None def in_double_quotes(text, pos): return text[:pos].count('"') % 2 == 1 def check(cmd): if re.search(r"\bxargs\b[^;&|]*\brm\b", cmd): refuse("xargs rm takes its paths from another command.") for m in RM.finditer(cmd): args = m.group(2) if "$(" in args or "`" in args: refuse("a path comes from a command substitution.") for word in args.split(): if not word.startswith("-") and FLOOR.match(word): refuse(f"{word} is a top-level or home directory.") for v in VAR.finditer(args): name = v.group(1) or v.group(3) if not in_double_quotes(args, v.start()): refuse(f"${name} is unquoted.") guarded = v.group(1) and v.group(2).startswith(":?") if not (guarded or name in ALWAYS_SET or set_earlier(cmd, name, m.start())): refuse(f"${name} may be empty.") event = json.load(sys.stdin) if event.get("tool_name") == "Bash": check(event.get("tool_input", {}).get("command", "")) sys.exit(0) ``` Save it as `~/.claude/hooks/rm-guard.py` and register it in `~/.claude/settings.json`: ```json { "hooks": { "PreToolUse": [ { "matcher": "Bash", "hooks": [{ "type": "command", "command": "python3 -I ~/.claude/hooks/rm-guard.py" }] } ] } } ``` It refuses `rm -f $C/$ID.json` and `rm -f "$C/$ID.json"`, and lets `rm -f "${C:?}/${ID:?}.json"` and `D=/tmp/x; rm -rf "$D"` run. ## 4. Give the node a PATH that has `claude` On macOS, `fleetlayer-node install` runs the node as a launchd agent. launchd gives its agents a short PATH without `~/.local/bin`, which is where Claude Code's installer puts `claude`. Anything the node runs that calls `claude` then fails with "No such file or directory". `fleetlayer-node install` writes the PATH of the shell you run it from into the service file (the launchd agent on macOS, the systemd user service on Linux). Run it from a shell where `which claude` finds Claude Code, and run it again whenever you move `claude` or change your PATH: ```sh which claude # should print a path, such as ~/.local/bin/claude fleetlayer-node install ``` The claude-auth-manager plugin looks further by itself: on PATH, then in the installers' usual places (`~/.local/bin`, `~/.claude/local`, and Homebrew's `/opt/homebrew/bin` and `/usr/local/bin`). You can also name the binary in its config: ```yaml plugins: - name: claude-auth-manager command: fleetlayer-claude-auth-manager config: claude: ~/.local/bin/claude ``` A plugin or script of your own that runs `claude` needs the same care. ## 5. Address sessions by a name that survives a restart Claude Code gives each session a random name for its own messaging between sessions, such as `-3d`. Every name changes when the machine restarts, so agents that wrote down each other's names can't find each other in the morning. Address sessions by their session manager's tab name instead, which you choose and which stays the same. Fleetlayer names every session `@`: ```sh fleetlayer fleet # every node and session, from the control plane fleetlayer msg send --to "planning@server" "the migration is done" ``` `--to` also takes a bare `` for a session on the same node, or a session ID. Sent from inside an agent session, the message names the sending session, so the receiver knows who wrote and how to reply. A send to a session that isn't running fails at once and isn't kept for later, so an agent learns straight away that it needs another plan. Put the tab names your agents use in your project's instructions (an `AGENTS.md`, for example), so a session started after a restart knows them too. ## When it doesn't work - **A session still waits on a message from another session:** `crossSessionInbound` is missing from the settings file on the machine that runs the session, or the session started before you added it. - **The "possibly-empty variable" prompt still appears:** one of the switch's conditions failed. Look for the "has no effect" line in Claude Code's log, check `/proc//environ` for the variable, and check that the prompt didn't come from a child session. Then restart the session. - **The agent keeps retrying a delete the hook refuses:** the refusal doesn't say how to fix the command. Make the message name the rewrite it should use. - **The hook lets through a delete Claude Code would have asked about:** it's looser than Claude Code's check. Add the shape to the hook. Without the switch, that same gap shows up as a hang instead. - **The node's plugins fail with "No such file or directory":** the service's PATH doesn't include `claude`. Run `fleetlayer-node install` again from a shell that finds it. - **`fleetlayer msg send` says the session isn't running:** check the name with `fleetlayer fleet`. The tab may have been renamed, or the session may have ended. --- # Pages for people instead of vendor artifacts Your agents make things for you to look at: QA screenshots of every screen in light and dark, a report on last night's failures, a mock-up of a settings page, a comparison of three options with a recommendation. Vendor artifacts are the easy way to show them, and they work well while you run one agent on one account. Claude's artifacts open for the account that published them, and other vendors' hosted previews belong to that vendor. Once you run several accounts, or Codex and Gemini next to Claude, every agent publishes somewhere different, and a page made by one session may not open for you at all. This guide sets up the alternative the author uses: plain folders in a synced vault, written by any agent, and hosted by Fleetlayer's pages plugin behind one sign-in. ## The shape - **A page is a folder.** `index.md` (or `index.html` for a mock-up) and its images, in a folder named after the date and a short name. Any agent or script that can write files makes one: Claude, Codex, Gemini, a shell script. - **A space is a folder of pages.** Each agent writes into its own space's folder in a synced, backed-up vault. An agent you trust less gets only its own space's folder, so the filesystem keeps it out of the others. - **`fleetlayer-pages` hosts whatever is there.** There's no publish step and nothing to build. A page's address follows from its path (`///`), so the agent that wrote it knows its link, and an open page reloads by itself when its files change. - **People sign in once and read the spaces they're allowed.** Today that's one login key that reads every space; with Fleetlayer's single sign-on, each person reads the spaces the access policy gives them. The same service hosts **apps**: interactive HTML and JavaScript, each on a subdomain of its own. Pages have no scripts at all; anything interactive is an app. The page format, the config and the security model are in [Pages](https://fleetlayer.ai/plugins/pages.md) and [Apps](https://fleetlayer.ai/plugins/apps.md). This guide covers the path through them and what goes wrong. ## 1. Try it on your laptop [Start on your laptop](https://fleetlayer.ai/guides/laptop.md) sets up pages with everything else: ```sh fleetlayer up ``` It makes one space, `personal`, with its pages in `~/Fleetlayer/personal/pages/` and its apps in `~/Fleetlayer/personal/apps/`, and prints where the login key is (`~/.local/state/fleetlayer/pages/login`). Write a page by hand to see the format: ```sh mkdir -p ~/Fleetlayer/personal/pages/2026-11-27-first-page cat > ~/Fleetlayer/personal/pages/2026-11-27-first-page/index.md <<'EOF' # First page A page to check that pages work: this paragraph is its summary in the list. > [!NOTE] > Images on consecutive lines make a gallery. EOF ``` Open `http://pages.localhost:7680/personal/2026-11-27-first-page/` and paste the login key. Edit the file and the open page updates within about a second. If something on the page is wrong (no title, a missing image, raw HTML), the page shows a box at the top listing it. Agents check their own work the same way: they fetch the page and look for the box, which has `id="problems"`. ## 2. Tell your agents Agents use pages only if they know about them. Add the snippet from [Pages: the AGENTS.md snippet](https://fleetlayer.ai/plugins/pages.md#for-agents-the-agentsmd-snippet) to the `AGENTS.md` your agents read, with your own folder, address and space in place of the placeholders (on a laptop set up by `fleetlayer up`, the folder is `~/Fleetlayer/personal/pages/` and the address `http://pages.localhost:7680/personal//`). For more than a few lines of instructions, install the two skills that ship with the plugin: `plugins/pages/skill/SKILL.md` (pages) and `plugins/pages/apps-skill/SKILL.md` (apps). They tell an agent to use a page wherever it would have published an artifact, how to lay out screenshots, and what an app may and may not contain. ## 3. A space for each agent One space is enough to start. Add more when you want to keep agents apart, or share some pages with other people and not others. Spaces are entries in the plugin's config in `node.yaml`: ```yaml spaces: personal: { dir: /srv/pages/personal, apps: /srv/apps/personal, owner: "person:alice" } triage: { dir: /srv/pages/triage, apps: /srv/apps/triage, untrusted: true } ``` - **Every space folder needs a `.fleetlayer-space` marker file** (an empty file is enough), and so does every apps folder. `fleetlayer up` makes them for `personal`; make them yourself for each new space. The health check fails without one (see "When it doesn't work"). - **An agent with a Unix user of its own** gets only its own space: mount or sync that one folder into its home, and nothing else of the vault. It can't write into another space because it can't see it. - **`untrusted: true`** is for a space whose agent reads outside input, such as email (see [Run an agent that reads strangers' text](https://fleetlayer.ai/guides/untrusted-input.md)). Its apps can't reach other sites, and opening one shows a notice first saying which space made it. ## 4. Move it to an always-on machine A laptop that's asleep serves nothing, and agents on other machines can't write into its folders. When you want pages for agents elsewhere, move the plugin to a home server or a VPS: [Pages: moving it](https://fleetlayer.ai/plugins/pages.md#moving-it) lists the steps, and [Start on your laptop](https://fleetlayer.ai/guides/laptop.md#moving-a-piece-to-a-server) shows how the laptop's address keeps working afterwards. On the server it sits behind your HTTPS proxy, never on the internet: - **`base_url`** is the site's `https://` address. Plain `http://` is allowed only for `localhost` addresses. - **`apps_domain`** is where apps live (`--.`). The proxy sends every name under it to the service with the Host header intact, and the certificate must cover them (see the wildcard footgun below). - **`trusted_proxies`** lists the proxy's address, so failed-login lockouts apply to the real client. - **`heartbeat`** pushes Gatus-style every minute, failing when a space's folder or marker can't be read. Point it at your uptime checker, and send its alerts where an agent listens. The vault folders move with the share, not with the service: the server mounts or syncs the same folders, with their markers. ## When it doesn't work - **An open page stops updating when another machine writes to it.** Filesystem events (inotify) only see changes made through the local kernel. A vault shared into a virtual machine, an SMB or NFS mount, or a folder another machine writes over a network share never fires an event for writes made on the other side. Pages polls instead: the files of an open page every second and a space's list every five seconds. Anything else you build that reacts to new files in a shared folder needs to poll too. - **A space suddenly has no pages.** A synced or mounted folder that goes away looks like an empty folder, not an error, and a service reading it happily shows an empty list. That's what the `.fleetlayer-space` marker is for: while it's missing, `/healthz` answers 503 naming the space and the heartbeat reports a failure. Remount the share rather than recreating the marker in an empty folder. - **Sync and backups crawl after an agent builds an app.** A `node_modules` tree is hundreds of thousands of files that sync slowly, churn every backup and can be rebuilt from the lock file. Exclude it on every share and every backup, with the usual build caches: `node_modules`, `.next`, `.turbo`, `.cache`, `target`, `.venv`, `__pycache__`. In Syncthing that's the folder's `.stignore`; see [Backups](https://fleetlayer.ai/guides/backups.md#what-not-to-back-up) for the backup side. Pages never serves `node_modules` from an app either way. - **App sign-in works on the server and silently fails on the laptop.** Browsers treat `http://localhost` as secure enough for a `Secure` cookie, but not a subdomain such as `http://recipes--personal.apps.localhost`. Pages drops the `__Host-` prefix and `Secure` when its address is plain HTTP, and allows plain HTTP only for localhost. If you put another sign-in in front of apps on a laptop, it has to do the same. - **The certificate doesn't cover your apps.** A wildcard certificate covers one level: `*.home.example` covers `pages.home.example` but not `recipes--personal.apps.home.example`. Either get a wildcard for the apps domain (`*.apps.home.example`), or put apps directly under the wildcard you have (`apps_domain: home.example`, so apps are `recipes--personal.home.example`). - **A mock-up's CSS and images don't load behind the login.** A mock-up (`index.html`) is shown in a sandboxed frame. A frame with `sandbox` and no `allow-same-origin` gets an opaque origin, so its own CSS and images are requested cross-site and the SameSite=Strict session cookie isn't sent. Pages frames mock-ups with `sandbox="allow-same-origin"` and no `allow-scripts`, and serves the files with a policy that forbids scripts, so nothing on the page can use that origin. Any sandboxed frame you build behind a login needs the same pair. - **An agent's app shows a blank screen.** Agents often write inline `