One link manager per ferret listens to the agent instead of looking at its screen
Protocol first, tmux kept, every send exactly once, and the phone syncs only what changed.
Each ferret gets one link manager that listens to its agent, not its screen
One link manager per ferret, inside the daemon, owns every way of talking to that agent. It costs no extra process per ferret.
Most agents offer a protocol: a structured stream of events they push out, such as "turn started" or "tool finished". Today Ferretry looks at the tmux screen every 2 seconds while a ferret works instead (D).
A channel is one way to talk to a harness: its protocol, its message queue, or typed keys. The manager picks the best channel that is working, and tmux stays open as the fallback.
Status: design only, nothing is built. It is open for review as pull request 2779.
The card shows the manager is a part, not a new service. Next, how it talks to each kind of agent.
Codex and Claude Code each get a protocol channel, and the screen stays open
Different agents offer different protocols. Here is what we plan to use for each, and whether the real screen can share the live session:
| Agent | Protocol channel | Screen shares the session? |
|---|---|---|
| Codex | Its own app-server | Yes (M) |
| Claude Code | Streamed JSON from claude -p | No: a hand-off (D) |
| Dsh, Copilot, Kiro, OpenCode | ACP, a common agent protocol | No (G) |
| Kimi | None: typed keys only | Not applicable |
For Codex, a protocol turn showed up in the real Codex screen, and a prompt typed there streamed back to the protocol client (M). For Claude, two clients on one session lose messages (D). So "open in terminal" becomes a hand-off: the protocol child stops, then the real screen resumes the same session. Kimi's terms say its plan is "interactive use only" (D), so it stays typed.
11 of 11 live protocol tests passed on first try, on real logins. Wherever a meter could be read, they drew from the same plan meter as the screen. Measured
That result comes from the Leaving tmux page. The takeaway here: watching can switch from looking to listening. The pane look drops from every 2 seconds to every 30 seconds (G), about 28 fewer screen captures a minute per working ferret (C).
Every message is sent exactly once, and any doubt is shown, not resent
A message can fail halfway. The design gives each try a written record, and the rule is simple: a message moves to the next channel only when the first channel provably did not take it.
Every message passes these four states in order. If the answer is silence, the state is "unknown", and the daemon looks for evidence instead of guessing. No proof in the window means the person sees "unconfirmed" and decides.
The proof is the agent's own transcript, the file it writes as it works. This rule already exists for typed sends. The design applies it to every channel.
In the design, agents keep working through a daemon restart because tmux holds their pipes
Today, an ACP agent started by the daemon dies when the daemon restarts (D). Panes survive; protocol children do not. How can a child outlive its parent?
1/5The daemon starts the agent inside the ferret's tmux session, on a named pipe and an output file.
In the design, the agent never stops, and the daemon rebuilds its picture from the file. The test for this on Linux and macOS is still to run. The alternative is a small keeper program per ferret. Measured, one costs 71 MB of memory, about 47 MB once shared pages are counted (M). Ten ferrets would cost about 470 MB (C). The tmux way costs 0 MB, but it is untested on macOS, and the keeper is the fallback if it fails.
The phone receives only what changed, using ideas from mosh
Mosh is a remote terminal built for bad links. It sends the latest state, not every byte. In its paper, at 29% loss each way, ordinary SSH averaged 16.8 seconds per keystroke and mosh 0.329 seconds (D).
The design copies the ideas, not the UDP. Its sync stream is one connection per phone that carries numbered changes to the ferret's state, and nothing else. After any drop, the phone says what version it has and gets only the difference.
1/5The phone says: I have turn state 41 and the log up to byte 88,120.
Today every new chat line makes the phone re-read about 53 KB (M, clean link) of history. Resuming by version removes that. Skipping stale in-between states on a slow link comes from mosh too: only the newest text is sent.
True UDP is postponed until a test shows it helps
Mosh uses UDP. Can an iPhone browser do the same? We checked each carrier:
| Carrier | iPhone Safari | Our server | Verdict |
|---|---|---|---|
| WebSocket over TCP | Yes | Works today | Keep |
| WebRTC, reliable | Yes (D) | Embedded | Keep |
| WebRTC, unreliable | Yes (D) | Spike needed | Later, gated |
| WebTransport | Since Safari 26.4 (D) | Bun has none (D) | Not now |
The unreliable WebRTC lane is the only real UDP route, and it needs a crypto change. Two facts matter more than the carrier. iOS suspends a background page within about 10 to 32 seconds, which kills every carrier (secondary source). And peer-to-peer often fails on mobile networks without a relay server (secondary source).
So the sync stream comes first on all carriers. The UDP lane is built only if a rig test shows the slowest link improves by 30% or more (G).
The plan is 16 pull requests, about 15,000 lines, and every guess is labelled
The plan splits into waves, with the biggest win first. Sizes include tests.
| Wave | What lands | Lines (G) |
|---|---|---|
| 1 | Spikes, before-numbers, sync stream, link manager | about 4,500 |
| 2 | Phone streaming for every agent, and Codex protocol | about 4,400 |
| 3 | Restart survival, link policy, fleet rows | about 2,500 |
| 4 | Claude stream mode and hand-off | 1,600 |
| 5 | UDP lane, only if the test passes, and after-numbers | about 2,000 |
Phone gains come first: a new chat line should reach the phone in about 1 second instead of 5 on a slow link, and about 1.8 seconds instead of 16 on the worst one (C). Harness-side gains follow: exact turn boundaries, approvals from the phone, and exact rate limits.
What we did not test is just as important:
- Pane-held pipes on macOS (a spike is planned).
- Claude's hand-off with resume: its 2 to 4 second cost is a guess.
- The unreliable WebRTC lane to a real iPhone.