sync-and-widgets

A set of project decisions for cross-device synchronization, widgets, and Shortcuts in an Apple app. It describes how hosts and secrets are synchronized and how widgets and Shortcuts interact with the app.

In plain words
What is it for?
Use it when implementing or reviewing iCloud Keychain host sync, widget updates, Shortcuts, app lifecycle refreshes, and related background activity.
Why use it?
It keeps sensitive data and device state consistent while preventing widgets from adding their own background network work.

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/sync-and-widgets
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 996 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.00996
Opus 5 $0.00000 $0.00498
Sonnet 5 $0.00000 $0.00199
Haiku 4.5 $0.00000 $0.00100

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

Security

Grade A, and why

sync-and-widgets 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/sync-and-widgets.md · 66 lines

How it starts

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

Cross-device sync, widgets & Shortcuts

Load-bearing decisions split from AGENTS.md.

  • Cross-device sync rides iCloud Keychain, nothing else (E2E-encrypted, no entitlement/CloudKit): secrets AND a JSON host record per host are synchronizable items (services app.multiplexterm.multiplex / ….multiplex.hosts). Every keychain query must pass kSecAttrSynchronizable(Any) — omitting it silently matches only device-local items. HostSync.merge (pure, tested): last writer wins by Host.updatedAt; a locally-persisted mirrored-IDs set distinguishes "new local → publish" from "peer deleted → drop". No change notification exists — deck and terminal roots re-merge on scenePhase .active.
  • Widgets/Shortcuts add no background execution and must stay that way: they declare no background mode of their own and must not grow one (the app's single fetch mode belongs to the agent-alert refresh — see the keep-alive entries in lifecycle-and-attention.md; widgets never connect at all); intents are openAppWhenRun; widget timelines are .never with app-pushed, hash-gated reloads; probe loops gate network work through BackgroundActivity (see the keep-alive entry in lifecycle-and-attention.md — still no background mode, and a host that never opted in keeps the old .active-only behaviour). The Shortcuts host picker and widget config read SharedStateStore; Open Agent's dependent pickers re-resolve against the live HostStore. Configured working-dir paths ride widget state for the widget's own directory picker; setup-script names and bodies never do. Directory stays a String for variables (unset = host default, "~" = Home); Open File likewise keeps its remote path as a String, carries an optional positive line number, and recognizes a path:10-15 range in that path, registering the in-memory viewer before its route opens; the setup-script String is validated DEFAULT/NONE/UUID; the Model String is gated by normalizedLaunchModel. SharedStateTests locks intent/widget/ExternalActionURL formats in lockstep (the widget target compiles only Multiplex/Shared — never import Host/Tmux/Agent types there). XcodeGen quirk: the widget target's deployment floors need explicit IPHONEOS_DEPLOYMENT_TARGET/XROS_DEPLOYMENT_TARGET (target-level deploymentTarget is ignored for multi-destination targets). E2E without widgets: xcrun simctl openurl <UDID> "multiplex://open?host=devbox&action=shell"; the App Group file lands under simctl get_app_container … groups. iOS 26 confirms the FIRST simctl-originated open per install. The failure alert presents from the mode root (ExternalActionHost) — never the deck pane, which the expanded shell clips to zero width.
  • A widget's featured session is the last one OPENED, not the newest created (WidgetHostState.featuredSession, pure + tested): the Host widget's own Session setting first (an explicit Backend is strict; Host Default tries the host's default namespace, then wherever the name lives, because the picker lists both backends' names), then the host's lastAttached, then mostRecentSession (creation date, kept as the final fallback; the bare shell deep link's router fallback follows the same last-opened → newest order). Creation order was the old rule and is meaningless on herdr — HerdrProbe synthesizes near-epoch dates from list order, so a mixed host featured a tmux session forever. HostStore.recentSessions (device-local UserDefaults beside tile order; never synced) is written from ONE place, TerminalWindowUIKit's active-tab chokepoint (first appearance, tab switch, deck/notification reveal) — never from TerminalWorkspace's controller getter, which runs for every restored tab in array order. The deck observes it like hosts and republishes; the ref rides the snapshot name-only on single-backend hosts and backend-qualified on mixed ones (the row convention); a stale name falls through, never blanks.

Read the full file on GitHub · 66 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 · 66 lines · 0 tokens per session scan A a2340da9f6e8

Subscribe to this mod's changes

sync-and-widgets 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 996 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.