A frontend holds a port
A frontend addresses agents through a Port; a Host owns their launch,
feed and joined end. This is the public boundary between exarch and its
clients, including Synod.
The laws
- P1 — One reach. Frontends name agents by
AgentIdand act only throughPort. The TUI names neitheragent,busnorhost; headless names neitheragentnorbus. The layering test pins this reach rule. - P2 — Folded, not copied. An agent owns its immutable client in
Body.client. The port reads cellStatus, including the mail’s debt andModel::selected(), exposed asAgentRow.selected, never the client. - P3 — Frontends never write a log.
Born.readerpermits TUI catch-up, not append.EmitterandAgentLogare crate-private; model switches are recorded by the agent, not its frontend. - P4 — A port never retains a launch. It holds
Arc<Registry>and a usage meter, notFleetorLaunch. A port retained acrossHost::endcannot keep Synod’s engine factory shared. A weak fleet reference would still retain the launch during an upgraded call racing with end. - P5 — A frontend’s end is observed. After draining to empty, the TUI
may finish when every known root tab has received
Died. All initial births precedetui::run; a later root’s birth precedes its creator’s death; a helper’s death precedes its root’s death because teardown joins helpers first. Thus no producer can remain unseen after that drain.
Boundary and effects
hostexports construction, admission and engine types;portexports operations and signal/command types.agent,bus,boot,cli,enquiry,headless,library,schedule,shell_eval,skillandtuiare crate-private.app,card,clock,config,net_policy,policy,prompt,provider,recordandwalletremain public launch support: hiding them would redesign Synod’s construction, not isolate agents.Command::Model(Pick)asks the owner to build. Success recordsControl::ModelChanged { selected }, then syncs outside the cell before replacing the client. The bureau’s immutableSelectedstamp, not the requestedPick, is installed in the cell’s model fold. Plan-billed accounts discard sampling. A failed build records an error but changes neither client nor model; failed recording ends life and prevents the switch.- The TUI persists a selection only from a live commit’s
ModelChanged, after its inclusive commit number is covered bySignal::Synced, using that record’s account, label, model andvia. Asking saves nothing; replay/catch-up does not change project selection. Login/provider notes are view chrome and do not appear in record-backed exports. - A switch takes effect at the next request, even in the same deliberation.
An in-flight request retains its client; the next reads
Body.clientafresh. Helpers usingenquiry::Selection::Inheritinherit that client. Port::end(agent)ends that agent and its descendants; their owners still join them. There is no port operation to end a fleet. The host owns its single feed and fleet-wide end; the port offers no feed subscription./quitreturns from the TUI without ending agents.tui::runreturnsLeavingafter restoring the terminal;lib::runcallsHost::end, then printsLeaving::reportwith final run usage from its retained port plus recalled usage. Exchanges cut short by quitting are included in that spend.
Amendment and limits
This amends 261029_an-agent-is-a-thread: the immutable client is owner-held,
while recorded selection belongs to the cell’s Model, and P5 replaces
A8’s Host::is_finished completion criterion. The host still joins and collects failures.
The wire, broadcast subscriptions, Port::since/history and idempotent
submission are not implemented here. Resume does not restore the last
ModelChanged as its client. A switch uses the launch’s CLI token cap
wherever the new account admits it.
Amendment — 2026-10-30: the port reads the folds
agents amends P2 and switching above:
AgentRow.selected replaces a published Pick; model, account and tuning
come from the cell, and each agent learns its own window. The TUI labels a
currently available account dynamically, falling back to selected.label
when it cannot find it. Only a live ModelChanged persists a next-launch
choice; birth and reopen do not.
Where
exarch/src/{lib,host,port}.rs,agent/fleet.rs: public boundary, registry ownership, feed, joins and report ordering.exarch/src/agent/{command,attend,deliberate}.rs,bus/mailbox.rs,provider/bureau.rs: normalized selection, recorded switching and attempts.exarch/src/record/{seam,session}.rs,tui/{app,model_picker,scrollback,tabs,tui_loop}.rs: read-only catch-up, record-driven persistence and observed completion.exarch/src/vm.rs(Guest::root),desktop/src/assistant/runtime.rs,desktop/src/window/{state,conversation}.rs: root ids, per-agent end and launch-independent inlets.lint/tests/arch/exarch_layering.rs: DAG and frontend reach checks.