architecture

A technical architecture for a Swift app that manages multiple terminal windows or tabs, remote hosts, and secure connections. It uses UIKit for most windows and keeps SwiftUI only where visionOS requires it.

In plain words
What is it for?
Use it when building or changing the app’s window layout, terminal routing, host discovery, key storage, connection handshake, or encrypted host communication.
Why use it?
It gives the app a defined structure for handling windows, tabs, host records, discovery, and encrypted communication. This reduces the risk of inconsistent behavior between desktop and visionOS interfaces.

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/architecture
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 1,428 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.01428
Opus 5 $0.00000 $0.00714
Sonnet 5 $0.00000 $0.00286
Haiku 4.5 $0.00000 $0.00143

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

Security

Grade A, and why

architecture 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/architecture.md · 109 lines

How it starts

The opening of the file, as written. The whole thing — 109 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Architecture — full component map

UIKit scene runtime (MultiplexSceneDelegate + UIKitSceneRootViewController;
         SwiftUI survives ONLY where visionOS's ornament API needs a View):
         classic Deck window + N Terminal windows, or one adaptive Shell
         (real FleetWall + one ordered TerminalWindowRoute tab set);
         a terminal window/shell = ordered tabs, each tab a TerminalRoute
  BindController     Bind Host: candidates, enrollment, offline-payload key
                     rotation (.shared; the mounted deck attaches HostStore
                     + EntitlementStore)
    BindDiscovery    NWBrowser over _multiplex-bind._tcp while the Bind pane
                     is open — no entitlement, no background socket
    BindClient       one NWConnection running the sealed handshake
    Bind* models     payload/TXT codec, CBOR subset, X25519+HKDF+ChaCha20
                     channel, ed25519 OpenSSH keygen — pure, pinned to the
                     CLI's bytes by vendored vectors
  HostStore          hosts.json local cache; secrets + host records sync via
                     iCloud Keychain (KeychainStore); host records include
                     per-host agent command configuration
  ThemeStore         terminal color schemes (themes.json); device-local
  KeyCommandStore    the app-wide hold-CTRL Key Commands set (.shared;
                     keycommands.json + ONE synchronizable Keychain item,
                     last writer wins by updatedAt); KeyCommand/KeyChord/
                     KeyTextSnippet pure; KeyCommandDispatcher sends through
                     TerminalView.send, chords encoded by the fork at press
                     time (TerminalView.bytes(for:)); the tier's cap rides
                     KeyCommandPlan from the terminal window (which holds
                     EntitlementStore) down to the rail / cluster presenter
  AgentCommandConfiguration  pure per-host Bar/More overrides + ordered
                     custom helpers; shared UUIDs mirror between profiles
  ConnectionHub      one HostConnectionModel per host — the probe connection;
                     ONE exec round-trip per monitored backend carries
                     sessions + a clipped ps table + capture tails, polled
                     ~5s by FleetWall while frontmost (background re-probes
                     never surface .probing)
    SessionKey       (backend, name) — the identity every per-session map
                     keys by; persisted maps use its `storageKey` (pure)
    BackendDiscovery the other backend's rider on the primary probe's own
                     channel: installed? how many sessions? (pure)
    DeckSnapshotStore  last-known wall state per host (device-local) — cold
                     launches paint instantly; attention is never cached
    TmuxProbe        tmux list/capture/ps command builders + parsers (pure)
    AgentSignature   classifies a pane's CLI agent; helper command sets (pure)
  AppLockStore       optional biometric app lock (device-local, free): locks
                     at launch + didEnterBackground (never resign-active);
                     AppLockGate veils every scene root and flips
                     TerminalFocusArbiter.inputSuppressed; a passcode-less
                     device fails OPEN
  EntitlementStore   the Pro gate — StoreKit 2 ownership, purchase/restore,
                     the daily agent-helper meter; injected ProStoreClient
                     keeps commerce state testable
  ExternalActionRouter  one queue for widget deep links (multiplex:// via
                     onOpenURL on every scene root), App Shortcuts, and
                     automation; the mounted DeckWindow attaches a Context
                     and ExternalActionPerformer runs the status-guarded
                     flows (refreshAndWait → connected → focus/attach/create
                     + agent launch). Failures alert on the deck; ASK mode
                     presents AgentPromptSheet; a deckless scene raises the
                     one deck scene to drain.
  SharedStateStore   secret-free App Group projection (widget-state.json)
                     for the widget process; ConnectionHub publishes (2s
                     debounce, content-hash-gated WidgetCenter reloads);
                     DeckWindow republishes on host-list changes
  MultiplexWidgets   WidgetKit target (compiles ONLY Multiplex/Shared):
                     HostWidget + FleetWidget. Widgets never connect, show
                     no tally red / NEEDS YOU, carry a relative SEEN stamp,
                     timeline .never (app pushes reloads). WidgetTheme PINS
                     dark graphite on visionOS (the environment lies about
                     interface style); views draw through the resolved
                     WidgetPalette, and ACCENTED draws white-with-opacity
                     only — the channel the tint remap preserves.
  TerminalWorkspace  tab controllers keyed by tab id — merge/split move
                     tabs across windows, shells stay live; a second map keys
                     one summoned side-panel controller by its HOST tab id
    ViewportController   one per ⌗ viewport tab; owns the WKWebView so
                     moves re-parent the live page; in-memory only
    FileViewerController one per ▤ file-viewer tab; dials its OWN lazy
                     SSHConnection; in-memory only (shares the
                     isAuxiliaryPane rules with the viewport); its
                     Document owns the PDF / audio clip, so a moved tab
                     keeps page and position
  SidePanelViewController one active-window mount around an existing ▤/⌗
                     pane: 30 pt header + iPad seam or visionOS trailing slab;
                     presentation only, never controller lifetime
  TerminalSessionController  one per tab; input pump + TerminalView
    TalkbackDraft        the tab's chat-style message box (text +
                         attachments; pure) beside its observed talkbackOpen
                         — sendTalkback = one paste + CR through the pump,
                         attachTalkbackFiles = the drop path's one upload
                         primitive, held until SEND; rendered by
                         TalkbackComposerViewController (window-docked on
                         iPad/iPhone, an ornament slab on visionOS)
    TerminalTransport    the tab's byte pipe; picked by host.useMosh
                         (exec + SFTP stay SSH-only capabilities)
    SessionResumePolicy  pure: suspension damage vs user-ended session
    SSHConnection (actor)  Citadel → SwiftNIO SSH; exec channel (probe,
                     mosh bootstrap, drops) + PTY shell ⇄ SwiftTerm
    MoshSession (actor)  UDP socket + MoshTransportEngine; bootstrapped
                     over a throwaway SSHConnection
      Mosh/*         clean-room mosh stack, pure + unit-tested against
                     RFC 7253 / real mosh-server
  TerminalFocusArbiter  app-wide single owner of keyboard focus

Read the full file on GitHub · 109 lines

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 · 109 lines · 0 tokens per session scan A 805ef04ed39e

Subscribe to this mod's changes

architecture 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 1,428 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.

Related

Other agents, from other repositories

i18n

Hermex ships one String Catalog, HermesMobile/Resources/Localizable.xcstrings, included in the app, widget, and share-extension targets. Every user-facing literal is already externalized (String(localized:) / LocalizedStringKey), so adding a language is normally translation-only — no Swift edits.

uzairansaruzi/hermex · 0 tokens

feature-gap-index

Thin, always-current classification of upstream Hermes-WebUI API route groups against Hermes-Mobile. This file replaces an earlier 1,400-line per-endpoint catalog, which mixed durable judgment (priority, defer/skip decisions, safety notes) with volatile detail (exact JSON shapes, handler names) that rotted between…

uzairansaruzi/hermex · 0 tokens

issue-tracker

Issues and PRDs for this repo live as GitHub issues. Use the gh CLI for issue operations.

uzairansaruzi/hermex · 0 tokens

layer3-issue-detection

Layer 3 systematically scans ALL entry points from Layer 1 and applies issue detection rules. Unlike Layer 2 (which traces specific flows in depth), Layer 3 does a breadth-first scan to categorize issues across the entire codebase.

Terryc21/workflow-audit · 0 tokens

layer5-data-wiring

Layer 5 verifies that features use real user data instead of mock/hardcoded values, and that model capabilities are fully wired into the features that need them. While Layers 1-4 audit navigation and UX, Layer 5 audits whether the data flowing through those workflows is genuine.

Terryc21/workflow-audit · 0 tokens

layer2-methodology

Layer 2 takes entry points from Layer 1 and traces the complete user journey.

Terryc21/workflow-audit · 0 tokens