herdr with nfltr
herdr keeps your terminals and agents alive. nfltr decides who reaches which machine or which pane, end to end encrypted, and takes it back while a session is open.
What it is for
You run long-lived coding agents on a machine that stays on: a desk at home, a cloud VM, a build box. You want to steer them from a laptop or a phone, let a teammate look at one of them, and take that access back when you are done.
herdr is an independent open-source
terminal workspace that keeps terminals and agents running in named panes.
herdr-core (hc) runs programs in terminals that stay alive, on this
machine or on machines it reaches over SSH. Both are separate projects, not
part of nfltr. Everything here uses them unmodified, tested with herdr
v0.9.5 and hc 0.1.23, with the released nfltr v2.1.106. Their authors have
not reviewed this guide.
The two divide the work:
- herdr and hc keep things alive. Terminals and agents keep running when you disconnect, and you attach again later from anywhere.
- nfltr decides who gets in. Each service is end to end encrypted, the machine serving it admits only a machine named by a rule your organisation's root signed, and removing the rule or revoking the machine ends open sessions.
A runnable version of everything in Setup is the herdr-over-nfltr example. Its test runs it end to end against a relay on loopback and fails on any broken expectation.
Setup
You need an organisation with three machines
in it: desk runs herdr, laptop runs hc, teammate looks at one pane.
The root's machine signs the rules.
1. On desk: herdr, a loopback SSH server, nfltr up
Run herdr (herdr, or herdr server on a machine with no screen) with two
panes, w1:p1 and w1:p2. Run an SSH server that listens on
127.0.0.1:2222 only, with keys only and forwarding off; the example's
sshd_config is one. hc and herdr need no tty and no forwarding over
SSH. Then serve both with one up file:
# desk.yaml
agent: desk
services:
ssh: { tcp: 2222, e2ee: true }
pane1: { exec: [herdr, terminal, session, control, "w1:p1"], e2ee: true }
pane2: { exec: [herdr, terminal, session, control, "w1:p2"], e2ee: true }
watch1: { exec: [herdr, terminal, session, observe, "w1:p1"], e2ee: true }
nfltr up -c desk.yaml
For each admitted session to pane1, nfltr up runs
herdr terminal session control w1:p1 with the session as its input and
output, and ends it when the session ends. watch1 serves the same pane
with herdr's observe, which draws it and does not act on input.
2. On the root's machine: one rule per machine and service
nfltr access allow laptop desk/ssh
nfltr access allow teammate desk/pane1
nfltr access allow teammate desk/watch1
Before these rules, desk refuses both machines: the teammate's
nfltr pipe desk/pane1 exits 10 (e2ee_client_refused), and the laptop's
ssh connection is closed before SSH starts.
3. On the laptop: hc over ssh through nfltr
nfltr forward gives ssh a port on the laptop's loopback, and hc reaches
desk with that ssh:
nfltr forward desk/ssh --listen 127.0.0.1:2200
# ssh_config on the laptop
Host desk
HostName 127.0.0.1
Port 2200
HostKeyAlias desk
IdentityFile ~/.ssh/id_ed25519
StrictHostKeyChecking yes
BatchMode yes
hc machine add --via "ssh -F ssh_config desk" --name desk
hc run --on desk "echo hello from desk"
hc run --on desk --name ticker --bg "while :; do date; sleep 1; done"
hc ls
hc attach desk/ticker
hc keeps one ssh connection to desk open through the forward, and runs
herdr-core connect there, so herdr-core must be on the PATH of a
non-interactive shell on desk, or in ~/.local/bin there.
4. On the teammate's machine: one pane
nfltr pipe desk/pane1 | ./pane-view
nfltr pipe desk/watch1 | ./pane-view
pane-view draws
the pane from herdr's stream; --type sends your keys too. Through
watch1, what the teammate types does not reach the pane (the example
checks it). desk/pane2 still refuses this machine (exit 10): no rule
names it.
5. Taking it back
nfltr access remove laptop desk/ssh
nfltr machines revoke teammate
In the example's runs on a Mac and on a Linux VM, relay on loopback,
removing the rule ended hc's open ssh connection within 0.6 s of the
command starting and no later than 0.12 s after it returned; new ssh and
hc run --on desk failed. Revoking the teammate's machine ended its open
pane session within 0.3 s of the command starting and no later than
0.03 s after it returned; its nfltr pipe exited 6 (reset), and a new
session was refused. herdr, its
panes and their programs kept running on desk. See Bounds for
what these numbers do and do not show.
From your phone
The herdr Android app reaches a machine over SSH and runs herdr there. The nfltr Android app, a preview, joins your organisation as a machine of its own and keeps forwards running on the phone's loopback. Together they are the same path as the laptop's:
herdr app ──ssh──> 127.0.0.1:2222 on the phone (nfltr app's forward of desk/ssh)
══ end to end encrypted, through the relay ══>
desk: nfltr up ──> sshd on 127.0.0.1:2222 ──> herdr-core
- On a machine of your organisation, make a code for the phone:
nfltr machines add phone --group <group>. Join with it in the nfltr app. - On the root's machine:
nfltr access allow phone desk/ssh. - In the nfltr app, turn on the forward of
desk/sshon port 2222. - In the herdr app, add a host: address
127.0.0.1, port2222, your user on desk, and the app's key (put its public key in desk'sauthorized_keys).
We ran this path on 2 December 2026. To take it back, revoke the phone
with nfltr machines revoke phone and remove its key from desk's
authorized_keys: the revoke ends the phone's sessions, the key stays
valid for anyone who can reach desk's SSH server another way.
Topologies
The same pieces give several arrangements. In each, every service is one
pane or one SSH server, and every rule names one machine and one service
(desk/* names every service of desk). The example's test runs every
topology below on one host against a relay on loopback, judged by exit
codes: the first with a laptop (the phone path was run by hand, see
From your phone), the second with one person per pane (not the
time-boxed grant of pane3), the third with three machines, the fourth
with a stub program in place of an agent, and the fifth, sixth and
seventh as written.
1. You and your own machines
laptop ──┐
├── desk/ssh ──> herdr-core and herdr on a home server or cloud VM
phone ──┘
How: desk serves its SSH server as desk/ssh; one rule each for
laptop and phone. hc and the herdr apps use ssh through nfltr forward.
Why: your agents run on the machine with the power, the data and the
uptime, and you pick them up from whatever you have with you. desk opens
no inbound port, and a lost phone is one nfltr machines revoke phone
away from being cut off.
2. One machine, several people
desk: pane1 <── alice's laptop (rule: alice-laptop desk/pane1)
pane2 <── bob's laptop (rule: bob-laptop desk/pane2)
pane3 <── a reviewer, 4 hours (grant: nfltr access request ... --for 4h)
How: one exec: service per pane and one rule per machine and pane.
For a time-boxed reviewer, the reviewer's machine asks with
nfltr access request desk/pane3 --for 4h, and an approver the root named
grants it with nfltr access approve <request>.
Why: each person reaches the pane they work in and nothing else on the machine. Rules name machines, so someone with two machines needs two rules. A grant ends by itself; a rule stays until you remove it.
3. A fleet with one lead
lead (a person or a lead agent)
/ | \
build-1/pane1 build-2/pane1 gpu-1/pane1 <- one rule each
How: each machine runs herdr with its agents and serves the panes the lead needs. The root signs one rule per machine for the lead's machine.
Why: one place steers many agents. Revoking the coordinating machine
with nfltr machines revoke cuts all of its sessions, on every machine,
as the revocation list reaches each of them. In the example (desk1..3, hc
on the coordinating machine, coord, with one connection to each),
nfltr machines revoke coord ended all three connections within 0.43 s of the command starting
on a Mac and within 0.2 s on a Linux VM, and hc run then failed on each.
4. Agents to agents
reviewer-box ──rule A──> coder-box/pane1
coder-box ──rule B──> reviewer-box/pane1 (only if you sign it)
How: an agent's machine gets a rule for one pane on another machine. Each direction is its own rule.
Why: a reviewer agent can read and steer a coder agent's pane without
the coder reaching back: in the example, desk1 types into desk2's pane
with nfltr access allow desk1 desk2/pane1, and desk2, with no rule for
desk1's pane, is refused (exit 10). Treat what one agent reads from another's pane
as untrusted input: a control session reads and writes, and text in a
pane can try to instruct the agent reading it.
5. Narrow services next to panes
services:
pane1: { exec: [herdr, terminal, session, control, "w1:p1"], e2ee: true }
watch1: { exec: [herdr, terminal, session, observe, "w1:p1"], e2ee: true }
How: serve the same pane a second time with herdr's observe, as in
Setup, and give watchers a rule for watch1 only.
Why: people and agents can follow progress without being able to
steer. Watching through control with pane-view's default is a habit,
not a boundary; observe is the boundary.
6. Someone outside your organisation
nfltr serve watch1 --agent desk-share --exec --address --address-file watch1.addr -- herdr terminal session observe w1:p1
How: an nf1 address opens one service to whoever holds it, with no
account, end to end encrypted. They run
nfltr pipe --address-file watch1.addr with the address in a file only
they can read. --agent gives it its own agent name: on desk, nfltr up
already holds the agent desk, and nfltr serve refuses to take it over
without --replace. One session at a time, each ended after 60 s, unless
you pass --max-sessions and --session-timeout. Serve again with
--new-address to replace it. The example checks each of these: a machine
with no nfltr account reaches the pane, a second session while one is open
does not, an 8s timeout ends the session, the old address is refused
after --new-address, and a revoked machine of the organisation that kept
a copy of the address still gets in until then.
Why: a deliberate, short share with a person who is not in your
organisation, such as a contractor's first look at a failing run. Keep it
short and rotate the address afterwards: rules and revokes do not cover an
address, and anyone who has a copy can use it until you replace it. Share
observe this way, not control.
7. A vendor engineer inside a customer's network
vendor's engineer ──grant from the customer──> customer-box/pane1
(inside the customer's network)
How: the customer runs your software and herdr on its own machine, in
its own organisation; your engineer's machine is a member of yours. The
customer's root names an approver of the pane
(nfltr access approvers customer-box/pane1 <email>) and gives you its
organisation id (nfltr org status --json). Your engineer asks for one
pane with
nfltr access request customer-box/pane1 --for 4h --org <customer org id>;
the approver grants it with nfltr access approve <request>, and can
revoke it at any time with nfltr access revoke <grant>. Every session
is recorded on the customer's machine, and the customer's nfltr access log names the grant, its
approver and your organisation. In the example, the approver's revoke
ended the engineer's open pane session within 0.31 s of the command
starting (Mac; 0.06 s on a Linux VM). See Your software in customer networks.
Why: support reaches the one pane where the problem is, for a few hours, under the customer's own revocable decision, with no VPN and no inbound port on the customer's side.
Bounds
- Rule changes take seconds to about 30 s.
nfltr accesssays it when a rule is signed: "Machines learn it within 30 seconds, within 10 minutes if the relay withholds the push, and within 1 hour if a relay replays an older status (clients from v2.1.104; earlier clients up to 24 hours)." The sub-second times above are from a relay on the same machine that delivered at once. - A revoke depends on delivery.
nfltr machines revokesays members end the machine's sessions "within seconds when the relay delivers the CRL; a relay that withholds it delays that up to the CRL's life (24 h)". - A revoke ends sessions, not what they did. herdr, its panes and their agents keep running, and an edit an agent made stays made.
- SSH keys outlive rules.
desk/sshadmits a machine to the SSH server; the SSH key is what logs in. Remove keys you no longer trust fromauthorized_keys. - A copied nf1 address is not covered by revoke. Only a new address ends it.
Safety
- A pane grant is a shell grant. Whoever can type into a pane steers its
agent, with the rights of the user who runs herdr and
nfltr up. Agent CLIs can often run shell commands from their prompt whatever their tool settings say. - One rule per pane, not per machine. A rule for
desk/sshordesk/*gives far more than one pane. Give each person and agent only the pane it needs. - Serve panes as a dedicated low-privilege user, with only the files those agents should touch.
- Keep rules short-lived. Remove a rule when the work is done, or use a time-limited grant.
- Never serve panes from the machine that holds your organisation's root key. A typist there works as the user who holds the key that signs every rule.