mosh

Technical decisions for using mosh, a network protocol for keeping interactive terminal sessions usable over changing or unreliable connections, in the Multiplex app. SSH remains the control connection while mosh carries the live terminal stream.

In plain words
What is it for?
They guide work on mosh connection setup, SSH bootstrapping, UDP streaming, encryption, compression, packet fragments, session state, and protocol tests.
Why use it?
They prevent different parts of the app from implementing the connection setup and encrypted data exchange inconsistently.

Agent

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add agents/multiplex-term/multiplex/mosh
Clone the repo
git clone --depth 1 https://github.com/multiplex-term/Multiplex
Per session 0 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 811 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00000 $0.00811
Opus 5 $0.00000 $0.00405
Sonnet 5 $0.00000 $0.00162
Haiku 4.5 $0.00000 $0.00081

Measured yesterday against content hash 4f18f5117d97, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

mosh scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured yesterday.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

docs/agents/mosh.md · 51 lines

What it actually says

mosh transport

Load-bearing decisions split from AGENTS.md.

  • mosh is a second transport; SSH stays the control plane (Services/Mosh/, Host.useMosh): probing, capture-pane, SFTP, and the bootstrap all ride SSHConnection.exec; only the interactive stream moves to UDP. The bootstrap resolves the hostname and pins the SSH to the literal IP so mosh-server -s binds the address the UDP session dials; route.moshRemoteCommand drops the exec prefix (mosh-server execvps its argv, no shell). The wire stack is clean-room from protocol facts (mosh is GPLv3 — never translate its source), pure + unit-tested: AES-128-OCB3 (RFC 7253 vectors, 12-byte nonce = 0x00000000 ‖ BE64(dir<<63|seq)), zlib-wrapped DEFLATE, a minimal proto2 codec, a 10-byte-header fragmenter, and a faithful TransportSender/receiver port (paced diffs, prospective resend, heartbeats, the new_num = UInt64.max shutdown). Never let a sent state number reach .max on a non-shutdown path — the shutdown override must win before last.num + 1 overflows (regression-tested; the interop harness caught it). Receiver is head-state-only: diff from head applies, diff from state 0 applies after a reset, anything else drops (server re-bases within an RTO); a desync valve turns pathology into a reconnect. MoshSession re-creates the socket on failure/better-path/silence (mosh's port hop + roaming); .active nudges a heartbeat. The two tmux split rows use the SSH control plane on every transport — the tab's live control connection on SSH, a short-lived one on mosh — resolving tmux's active pane id before split-window: iPad can intermittently lose Ctrl-B from the stock-prefix burst and type the shifted % into the pane on either transport. A direct command MUST outrank the split's documented bindingInput; -c '#{pane_current_path}' keeps the binding's working-directory semantics. Other non-destructive shortcut rows still ride the ordered terminal pump. mosh tabs have no exec surface: FILE is hidden and pane drops are refused with a message, never silently dropped.
  • A mosh tab has NO local scrollback (TerminalSessionController.localScrollbackLines answers nil for mosh — a transport capability, owned beside the transport choice — and SwiftTermView.installTerminal applies it), faithful to mosh itself. mosh's server-side emulator syncs ONE live screen and flattens the alternate screen away, so full-screen TUIs (herdr) run in the client's primary buffer — where scroll-op diffs, resync resets, and keyboard-cycle resizes all archived stale frame rows as junk "scrollback": duplicated herdr frames in a growing scroll area, and every overlay anchored in content coordinates drifting by the accumulated offset (~one keyboard height per cycle; both reported on iPhone 2026-08-10, pinned by TerminalMoshScreenTests). Do not re-enable scrollback for mosh tabs without solving all three junk sources; a speculative fork resize patch (screenAnchoredResize) was built and REVERTED in favor of this — upstream's resize archive/un-archive is symmetric and was not the dominant leak.
Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. yesterday First seen · 51 lines · 0 tokens per session scan A 4f18f5117d97

Subscribe to this mod's changes

mosh is an agent published in the GitHub repository multiplex-term/Multiplex (10 stars, last pushed 5d ago), licensed Apache-2.0. It costs nothing until one of its globs matches a file; then it loads 811 tokens. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.