Scope: collied on a Mac or Linux machine (a systemd user unit on Linux), Collie.app on the iPhone, the tailnet between them, herdr, herdr-core and Rex as collied's local backends, APNs and the publisher relay. Computer and phone each run their own user-owned embedded Tailscale node, with no OS VPN profile. Tailnet configuration is in tailnet.md, design in architecture.md.
| Asset | Where |
| Control of every shell and agent | herdr socket (0600, its server's peer uid checked, no auth: same UID means full control); the phone reaches it only through collied's allowlist |
| Control of every herdr-core terminal, and of programs and files on the machines the core added | herdr-core socket (0755 in a 0700 folder, no auth: same UID means full control); the phone reaches it only through collied's allowlist: screen reads, agent input and approval decisions, pane.close and task.archive, each on a terminal collied lists as an agent, and task.new, which starts Claude Code or Codex there while herdr is not running or when the app asks for Herdr Core (herdr-core) |
| Control of every Rex terminal, and of what the Rex server's API reaches beyond them (its remote access, Lua, Rex.app's actions, the user's files) | Rex's personal socket (0600 in a 0700 folder, its server's peer uid checked, no auth: same UID means full control); the phone reaches it only through collied's allowlist: screen reads, agent input and approval decisions, pane.close and task.archive, each on a block collied lists as an agent, and task.new, which starts Claude Code or Codex there while neither herdr nor Herdr Core runs or when the app asks for Rex (Rex) |
| Node keys (0700) | Mac: ~/Library/Application Support/collie/tsnet. Linux: <data dir>/tsnet (data dir $XDG_DATA_HOME/collie, else ~/.local/share/collie), a node apart from any system tailscaled. Phone: app container Application Support/collie/tsnet (protection) |
| Machine TLS key | tls-key.json in collied's data dir: P-256 PKCS#8, made on first start, 0600, loaded only as a user-owned regular file with no group or world access, never through a symlink. Pinned in the pairing QR and the phone's machines.json |
| Phone TLS key | Secure Enclave, non-exportable P-256, .privateKeyUsage, AfterFirstUnlockThisDeviceOnly, no user presence (so lock-screen decisions can connect); its Keychain item is in the app's own access group, which no extension holds; the app writes the item in place and makes a new key on its own only when none is stored or the enclave calls the stored one corrupt; any other failure stops the app, which then offers the owner a confirmed reset of both keys, so no pairing is lost silently (architecture.md); collie-core gets a signing callback, never the key. Pinned in peers.json (tls_key) at the confirmed pairing |
| Terminal key (signs terminal grants) | Secure Enclave, non-exportable P-256 apart from the TLS key, .privateKeyUsage, .userPresence, WhenPasscodeSetThisDeviceOnly: each signature needs Face ID or the passcode, and removing the passcode destroys the key. Its Keychain item is in the app's own access group, and the app makes a new key under the TLS key's rule; a stored key the enclave will not rebuild is kept, the shell's card names the cause, and the owner can replace that key alone behind a confirmation, which costs the terminal pairings and leaves the TLS key (architecture.md). Public key in peers.json (terminal_key) and machines.json |
Pairings (StableIDs) and owner user ID | peers.json (0600); optional owner_user_id in collied.toml; the same positive user pin in machines.json |
| Pairing code | QR from collied pair or a desktop bar app; invite URI from collied pair --show-uri. 16 random bytes (handling) |
| Approval nonces | collied memory and the phone session (collie-core only, never handed to Swift); 32 random bytes, single use |
| Terminal challenges and grants | collied memory only, per session: one challenge (32 random bytes, 60 s, single use); grants per terminal, 5 min. Never logged or written to disk |
APNs .p8 key | macOS: login Keychain item dev.rbstp.collied.apns/<key ID> (ACL; legacy: a 0600 file named by key_path). Linux: systemd credential <data dir>/apns/<key ID>.cred (0600) or a 0600 fallback file (APNs key storage on Linux). Both: a backup in the user's password manager |
| Live Activity update tokens | collied's push.json (0600); collie-core memory; with the publisher relay, the phone's relay Keychain item (dev.rbstp.collie.relay, AfterFirstUnlockThisDeviceOnly, the app's own access group) and the relay's route records. Never logged or audited; on the phone, on disk only in that item; redacted in Debug |
| Notification keys (32 bytes per paired machine) | iOS Keychain (dev.rbstp.collie.notify/<machine node ID>, AfterFirstUnlockThisDeviceOnly, shared with ColliePush); a mirror per machine in the App Group container (notify-keys/<node ID>.key, 0600, completeUntilFirstUserAuthentication, excluded from backup) for the Live Activity, which shows the command but has no Keychain access; collied's push.json (0600); collie-core memory. Never logged, audited or written elsewhere; redacted in Debug. The mirror is weaker than the ThisDeviceOnly item against a jailbroken or forensically imaged phone (user decision, 2026-10-03) |
| Terminal content, agent and workspace names | herdr, herdr-core (which also saves each terminal's screen, 0644 in its 0700 state folder), Rex (which also saves each terminal's screen, 0600 in 0700 folders under its state folder), the tailnet session, the phone |
| Agent transcripts (whole conversations, tool output) | The agents' own 0600 files under ~/.claude/projects, ~/.codex/sessions, ~/.copilot/session-state and ~/.gemini/antigravity-cli/brain, and the Antigravity CLI's prompt history history.jsonl beside it (or CLAUDE_CONFIG_DIR, CODEX_HOME, COPILOT_HOME, ANTIGRAVITY_APP_DATA_DIR). collied keeps only derived values in memory, plus token counts, model ids and transcript paths in usage-costs.json (token cost) |
| Plan usage and context window sizes | collied memory and usage.json (0600), from Claude Code's status line input, the local Codex app-server and GitHub through gh: Claude's 5-hour and weekly limits, Codex's monthly credits, Copilot's monthly premium quota and their reset dates, and window sizes for up to 64 Claude session ids. Codex keeps its OAuth token and gh its GitHub login; collied holds neither |
| Attachments (photos and files from the phone) | the phone; the tailnet session; collied's attachments dir for up to 24 h (0700 dirs, 0600 files): macOS ~/Library/Caches/dev.rbstp.collied/attachments, Linux $XDG_CACHE_HOME/collied/attachments, else ~/.cache/collied/attachments |
- Tailnet to collied. collied's tsnet listener (TCP 8457 by default) is the only network entry point. Before the WebSocket upgrade, each connection passes, in order: the whois gate (untagged, not shared in, owned by the positive embedded self user bound before listening, and either a paired
StableID with its paired user and pinned TLS key, or an open pairing window); mutual TLS against the pinned key (any P-256 key in a pairing-only session); the same gate again under the peers, pairing and sessions locks, which must agree, so a pairing or revoke mid-handshake refuses it. A fail-closed method allowlist then rejects unknown methods before decoding params, denies unknown fields and keeps herdr's privileged methods unreachable. Terminal methods, a class of their own, need [terminals] enabled = true (else terminals_disabled) and a grant signed by the phone's terminal key.
- collied to herdr, herdr-core and Rex. Same UID: nothing running as the user is a boundary. collied follows only a personal Rex server, not Rex's shared server or one whose socket other users can reach (Rex). On Linux, the systemd unit's sandboxing is defense in depth, not a boundary against the same UID.
- Machine to phone. The phone shows what a paired machine sends and does not trust it with the phone itself: a machine that was taken over answers with what no collied sends (Compromised paired machine). Screen text is what the app hands to native code, libghostty-vt built for speed. Before it does, the app keeps only what collied's
sanitize_ansi writes (printable text, CR, LF, TAB and SGR sequences) and drops every other control and escape sequence, so only those two paths of the parser face a machine (libghostty-vt in collied).
- App to its extensions. ColliePush and CollieWidgets read what a push sender controls, in processes of their own without CollieCore. A fault in one reaches what they share with the app: the notification keys, in the shared Keychain access group and the App Group mirror, and the rest of the App Group container. It does not reach the phone's TLS key, the terminal key or the relay state with its grants: their Keychain items name the app's own access group, which no extension holds (#805). Builds up to 0.2.3 named no group, which put them in the shared one, where code in an extension could use the TLS key after the first unlock. The builds after it moved them to the app's own group, and the move went once the owner's phone had run it (#869): the app no longer looks in the shared group for them. On an install that never ran the move, the copies an old build left there stay within an extension's reach, and the app, which finds none in its own group, makes new keys that the machines accept only after a new pairing.
- Tailscale control plane. Trusted for node identity: whois and the phone's netmap check both come from it.
- Apple and the publisher relay. They see push metadata, never private display content, which is authenticated ciphertext (Apple sees push payload metadata).
Computer nodes are user-owned, not tag-confined: they get their user's tailnet privileges and normal key expiry, so a compromised daemon can use whatever network access the user's policy permits; Collie's mutual TLS and same-user admission protect only its own sessions. Neither embedded node installs an OS VPN profile or touches a native (for example corporate) Tailscale client's account, state or routes. Still to test before App Store submission, since static source and local control tests do not establish them: pairing on a physical device, reconnect and background recovery, and coexistence with an active corporate VPN.
- built: in the tree and tested today.
| |
| Assets | Paired session (read and control of agents); phone node keys |
| Attack | A thief opens the unlocked app, or unlocks the phone, and drives agents or answers approvals. |
| Mitigations | iOS passcode and data protection on the node state. Revocation: collied peers revoke plus removing the node in the admin console (tailnet.md); node key expiry (Tailscale default 180 days) bounds a forgotten one. Closing a pane or workspace needs confirm: true (else confirm_required), which the phone sets, so it guards only against accidents. Rate limits per paired StableID: frames 20/s, burst 40; attachment.chunk and file.chunk 128/s in their own bucket; approval.decide 1/s, burst 5. The audit log records every method except hello, flock.snapshot, approval.list, usage.costs, file.chunk, file.close, attachment.chunk, attachment.abort and an issued terminal.challenge, and of a run of frames over the limit only the first (as rate_limited). Approval decisions need an iOS unlock on the lock screen, LocalAuthentication in the app (approvals); terminals, off by default, need a grant signed after Face ID or the passcode (terminals). When the app enters the background it covers its windows before iOS takes the app switcher snapshot, which iOS keeps on disk outside the app's control, so the snapshot holds no terminal, chat or opened file. |
| Residual | Until revoked, an unlocked phone drives agents (prompts, keys, new tasks, closes) with no per-action check, and an agent can run any command. Only approvals and terminal grants ask for Face ID or the passcode, so the terminal grant does not make an unlocked phone safer as a whole, and a thief who knows the passcode passes both. The cover comes with the background, not with inactivity (the Face ID sheet makes the app inactive), so the app switcher shows the app's live screen while the app is the one in front. |
| Phase | Revocation and approval authentication: built. An app-level gate for the other drive methods: not planned. |
| |
| Assets | Pairing code; the machine's node name, StableID and TLS key pin (public) |
| Attack | Someone captures the QR or invite URI (--show-uri) from the terminal, a desktop window, scrollback, a screen share or recording, or a herdr pane other same-UID code can read, and pairs their own device. |
| Mitigations | The code alone grants nothing: pairing is offered only to an untagged, not-shared-in node owned by the verified embedded self user (even before the first pairing), while a locally opened window is active. One window at a time, 120 s, burned by the first pair.complete, right or wrong. With the right code, collied shows the candidate's device label, node name, StableID, login name and user ID and asks y/N on the machine (60 s timeout). Both limits run on the wall clock as well as the monotonic one, which stops while the machine sleeps, so time asleep counts against them. The code is compared in constant time, carried in the URI fragment and redacted in Debug. The same-user gate holds even when a broader policy lets other users reach collied's port. A source address holds at most 8 of collied's 64 connections before their sessions start (from the accept to the end of the WebSocket upgrade); a ninth is dropped, so one node that opens connections and leaves them unfinished cannot keep other phones out. |
| Residual | A node logged in as the owner (account compromise) can race the window at any time. Any node admitted to a pairing-only session can burn an open window (denial of pairing only). While a window is open, any untagged node of the owner's user passes the gate and can keep 8 unfinished connections open from each of its tailnet addresses (IPv4 and IPv6), opening new ones as their 10 s deadlines end; the cap is per address, so enough such nodes still fill all 64 and refuse new sessions for as long as they continue (availability only; adding nodes takes the owner's account). The terminal's QR and the --show-uri URI stay in scrollback and recordings; a capture is as good as a scan if used live within the 120 s, and useless once burned or expired. The host name and node ID in the QR are not secret. |
| Phase | Built |
| |
| Assets | Everything on the computer (Mac or Linux); the phone's view of agents and approvals |
| Attack | herdr plugins are unsandboxed code running as the user with the full herdr CLI: a plugin can drive every pane and the control socket, read collied's data dir (node keys, tls-key.json, peers.json, .p8; on Linux, decrypt the APNs credential), and write pane text that collied turns into approval snippets to mislead the phone. |
| Mitigations | None on the computer: same UID is out of scope for file modes. Snippets are capped at 200 characters with controls, bidi and format characters stripped, so they cannot inject escapes into the phone UI. Claude Code's reason for asking gets the same cap with terminal escapes dropped, and stays in the snippet if it carries any other control, bidi or format character. Decisions send only up, down, enter and esc (plus tab and the user's note), never pane text. |
| Residual | Full compromise of the computer (same-UID malware), including a fake but well-formed Claude Code menu that shows the phone a fake approval. |
| Phase | Built as far as it goes (Keychain limits: same-UID malware); otherwise not planned: install only trusted plugins. |
| |
| Assets | Node identity, on which every collie authorization decision rests |
| Attack | The control server (or a stolen admin account) adds a node with its own key, the phone's StableID and the owner's user ID; changes grants and ownership; or points the phone's netmap at a fake machine. |
| Mitigations | Protecting the admin account (IdP, MFA) is up to the user. collied binds the owner to its positive embedded self identity before listening; each side pins the other's StableID, the owner's user ID and untagged, unshared state. These pins stop casual misconfiguration, not a lying control plane; the y/N prompt catches a new device only during pairing. Mutual TLS does not depend on Tailscale keys: the phone pins the machine's TLS key from the QR (out of band), and collied pins the phone's Secure Enclave key from the confirmed pairing, so an injected node with the phone's StableID, or a fake machine in the netmap, fails the handshake. |
| Residual | Low: a lying control plane can still cut or delay traffic and learn which nodes talk, but cannot get a full session without the phone's Secure Enclave key, or pass as a machine without its TLS key. |
| Phase | Built (Phase 6). |
| |
| Assets | Approval decisions |
| Attack | An old push (or a captured approval decision) is replayed to approve something again or something else. |
| Mitigations | The push carries no nonce, only approval_id and node_id as lookup keys; the app validates both and trusts nothing else in it. A lock-screen action fetches the nonce from the pinned, paired machine over the tailnet (approval.list) and decides there. The nonce (32 random bytes; malformed values rejected; redacted in Debug) is compared in constant time and burned by the first attempt past the rate limit, whatever its result; a burned id answers approval_already_resolved. Approvals expire after 10 minutes, and apns-expiration matches. Every attempt within the per-peer frame limit is audited, replays and expired ones included. Decisions bind to a fingerprint and fail as superseded if the prompt changed (Approval TOCTOU). An opaque terminal-derived collapse id makes a reissued alert replace the dead one. |
| Residual | A replayed or stale push shows a notification whose approval_id no longer resolves; acting on it reports that the approval is no longer pending and nothing was sent. While the agent stays blocked, each reissue can bring a fresh alert for the same terminal. |
| Phase | Built |
| |
| Assets | .p8 key (team wide), device tokens |
| Attack | With the key and a device token, an attacker sends arbitrary pushes to Collie (or, since the key is team wide, to any app of the team) to phish the user. |
| Mitigations | A dedicated, revocable key per machine, with its own key ID and never in GitHub (release.md): a leaked one is revoked in the portal without touching the others. collied apns import moves it into the macOS login Keychain, readable without a prompt only by collied signed with the team's Developer ID (just collied-install), or on Linux into a systemd credential or 0600 fallback file (APNs key storage on Linux), then offers to delete the original. collied doctor warns about a key_path config (on Linux, when systemd-creds works) and about a .p8 in collied's apns dir other than the configured key_path. Pushes carry no nonce and cannot create or decide an approval (Replayed notification). |
| Residual | A leaked key can submit its own fallback text if the notification extension does not run; without the notification key it cannot authenticate private display content, and the app rejects unauthenticated decision actions. Sent with a genuine approval's envelope it captured and with the approval category, its text shows over Approve and Deny: the app decides only when the notification carries the mark ColliePush leaves in what it rewrote, or its title, body and category are the ones ColliePush writes from the authenticated display, with no subtitle (ColliePush clears it), so these actions send nothing and only point the app at the approval. A forged background push naming a genuine approval_id (16 random bytes, seen only by Apple, the publisher relay when used, the paired devices and the machine) can remove that alert from the phone; the approval stays pending in the app. Copies outside the Keychain or credential (the download before import, the password manager backup) are protected only by where they sit. |
| Phase | Built |
| |
| Assets | Phone node keys, which pass the whois gate as the paired phone |
| Attack | Keys read from the device (forensic tools, jailbreak, exploit) or a backup, then used from another machine. |
| Mitigations | App sandbox; the state dir is 0700, completeUntilFirstUserAuthentication and excluded from backups; collie-core refuses one with group or world access or another owner. Revocation and key expiry as for a stolen phone. |
| Residual | Code in the app's sandbox can read the node key files after first unlock, but they do not suffice: collied also requires the phone's Secure Enclave TLS key, which cannot leave the device (ThisDeviceOnly, usable after first unlock), though such code on the unlocked phone can use it there. The node keys alone do pass the whois gate: their holder connects from the phone's own tailnet addresses and can leave each connection unfinished until its 10 s deadline. collied drops a ninth unfinished connection from one address, so the holder cannot take all 64 slots and keep other phones out, but it can keep that phone's addresses at their cap, so that phone opens no new session while the holder keeps connecting, until the node is removed from the tailnet or its key expires (availability only: no session, pairing or data). |
| Phase | Secure Enclave TLS key: built (Phase 6). Backup exclusion for the node state: built. |
| |
| Assets | herdr, collied's data dir, the APNs key, the control socket |
| Attack | Any process running as the user controls herdr, reads node keys, tls-key.json and peers.json, and uses the 0600 control socket. |
| Mitigations | None by design for herdr and collied's files: the same UID already owns every shell. The 0700 data dir, the 0600 files and control socket, and the socket's peer UID check stop only other local users. So does the check collied makes on every herdr connection before it writes a request: the peer's uid, read with peer_cred, must be its own, else nothing is sent and collied doctor fails the herdr line. With neither XDG_CONFIG_HOME nor HOME set, collied looks for herdr's socket under the temp dir as herdr does (/tmp/herdr/herdr.sock on Linux), where another user could bind one first and answer as herdr; launchd sets HOME and the systemd unit XDG_CONFIG_HOME, so only a collied run started by hand without both looks there. The macOS APNs key is the exception: its Keychain item's ACL trusts only collied's designated requirement (Developer ID Application, team RM3UT3MMSR, identifier dev.rbstp.collied; the binary is signed with the hardened runtime), so other programs need a Keychain prompt to read it; Linux has no such exception (APNs key storage on Linux). The systemd unit's sandboxing (NoNewPrivileges, ProtectSystem=strict, a system call filter and more) limits a compromised collied, not other same-UID processes, and a user manager skips it where unprivileged user namespaces are unavailable. |
| Residual | Full compromise of the computer side. Malware can replace collied or its keys, edit collied.toml and peers.json (owner, paired StableIDs) and answer the y/N prompt, so the gate protects nothing. Only the tailnet policy, which needs the admin account to change, keeps other users' devices out, and broad grants can admit them: user-owned nodes are not confined service identities. With the node keys and tls-key.json it can impersonate the computer to the phone from anywhere, with fake state or approvals. The control socket's hook request, which an older collied hook sends, is answered and ignored: the tool call an approval and its alert name comes only from the screen read the fingerprint hashes. macOS Keychain limits: malware can raise a prompt the user may accept, or run the signed collied itself (with its own --config or HOME) to push with the key without holding it; anyone with the login password can change the ACL or export the item; a key_path config or an undeleted .p8 gets none of this protection. On Linux, malware reads the key and can push from anywhere until the key is revoked. |
| Phase | Built (Keychain item, systemd credential). Otherwise out of scope. |
| |
| Assets | The tailnet listener and the phone connections: socketpairs libtailscale hands collied, whose other ends its Go side proxies to netstack |
| Attack | A process collied starts (git, whose hooks or fsmonitor daemon can outlive the call, gh, codex app-server, security and others) inherits the listener or a connection and keeps it open, so a close or a revoke delivers no EOF until it exits; a hostile one reads from the listener and takes or corrupts an incoming stream. |
| Mitigations | libtailscale (upstream ac7ed43, #770) makes every fd it hands out close-on-exec: the listener and connection socketpairs, both ends, and each connection fd received over SCM_RIGHTS. Linux sets the flag atomically (SOCK_CLOEXEC, MSG_CMSG_CLOEXEC); macOS has neither, so libtailscale marks each fd right after creating it (under Go's ForkLock) or receiving it. The Go runtime opens its own fds (magicsock UDP, DERP and control connections, state and log files) close-on-exec. An end-to-end test starts a child while holding the listener, a dialed and an accepted connection, and checks by socket identity that the child holds none of them and does hold a socketpair left inheritable on purpose. On macOS that child holds only its stdio, that socketpair and one AF_ROUTE socket per node. The iPhone app starts no child processes. |
| Residual | A child runs as the same user and reaches what same-UID malware does: node keys, tls-key.json, peers.json, the control socket. On macOS it also inherits tailscale.com's netmon routing socket (AF_ROUTE, opened without close-on-exec): it reads routing-table change messages, as any process can on a routing socket of its own, and reaches nothing on the tailnet. Two short-lived tailscale.com sockets are never marked either, so a process started while one is open inherits it: an AF_ROUTE socket for an RTM_GET route lookup (net/netns/netns_darwin.go) and a UDP socket for a utun ioctl (net/netmon/interfaces_darwin.go). On macOS every socket collied or the Go runtime opens is created first and marked close-on-exec afterwards (libtailscale's socketpairs and received connections, Rust's socket and accept, collied's control socket connections included, and Go's magicsock, DERP and control sockets), so a process collied starts on another thread in that instant can still inherit it: ForkLock holds back only Go's own forks, not collied's Rust spawns. Such a child holds one connection, or the listener, until it exits; reading the listener, it sees only mutual TLS ciphertext and cannot pass the pinned-key check. Linux creates them close-on-exec atomically, with no such window. |
| Phase | Built |
| |
| Assets | Every terminal a herdr-core core runs, and what its API reaches beyond them: programs and files on this and every machine the core added (machine.exec, file.*), documents other apps read (doc.*), the core itself (server.stop) |
| Attack | A phone, or collied acting for it, reaches the core's wider API or another machine through it; a socket some other process placed where collied looks speaks for the core; a terminal program's status, title or name misleads the phone; the starter's environment reaches every terminal; a session bound to the wrong terminal shows another conversation in Chat or names another call in an approval. |
| Mitigations | collied never starts a core and finds its socket as hc does, from its own environment; it refuses a socket served by another user (the peer's uid, read with peer_cred, must be its own), which collied doctor reports as a failure. It calls only hello, events.subscribe, terminal.get, terminal.read, terminal.send, terminal.keys, terminal.attach, terminal.run, terminal.kill and terminal.rm (server.status from collied doctor), never machine.*, file.*, doc.*, server.stop, server.restart, terminal.put or a template; the client refuses any other method before it writes. The phone reaches the core through pane.close, which ends and removes only a terminal collied lists as an agent: its address is checked against the followed core's terminals, and workspace.close on the core's group is refused, so no phone call ends every terminal in it. Screen reads (agent.read, pane.read, agent.watch, agent.draft) attach only to a terminal collied lists as an agent, always watch-only (observe), so the core takes no input from the attach and never sizes the terminal to it; collied sends nothing on the stream but credit and close. Input reaches a terminal collied lists as an agent only through the phone calls and checks a herdr agent's input takes (Prompt injection into the terminal): terminal.send for prompts and typed answers, terminal.keys for Key (the core has no Command modifier and refuses cmd), Ctrl+End and a notice digit, and, for the slash token, an approval note and keystrokes typed in the phone's terminal view only, a typing attach at the terminal's current size that writes that text in one frame and closes. An agent with no OSC 7501 status takes no input from the phone, since nothing would tell collied it shows a dialog (Claude Code reports nothing at its folder trust prompt, whose highlighted option a prompt's Enter would pick). The one exception is a Codex that has reported nothing while its startup dialog fills the screen (Codex 0.171.0 reports nothing at its folder trust prompt, #895): it takes the dialog's own keys (arrows, Enter, Esc and one digit) and nothing after the first that can answer it, never letters, a prompt or a typed answer, so one call cannot answer the dialog and then type or submit into the composer behind it; the same screen within 1 s of an answer is refused, so a stale read of the answered dialog lets nothing through. Copilot CLI takes its folder trust box's own keys on the same terms (#897): its own report must name Copilot, its foreground CLI must be Copilot and it must not be blocked, and the box is read only as Copilot draws it, under its tab bar, as wide as the terminal from its first column and with its bottom border on the terminal's last row, so text an agent or a tool writes, which Copilot draws above its own input box, never passes. They are the user's own, as keys to a blocked agent are, and audited as such (blocked keys= with the keys, blocked text without the text); collied picks no option, and the screen read only lets them through. The dialog is read strictly, as Codex draws it alone on the screen (heading first, numbered options under one cursor, the key hint last, nothing else), so agent or tool output above Codex's composer never passes; an error report, a report kept from another program and a report naming Codex over another foreground CLI never pass either, since the exception needs the foreground process to have sent no status at all. Only an agent whose report names Claude Code, Codex, Copilot CLI or Antigravity CLI, the kinds whose reports were checked: they report blocked at their permission and question dialogs, with a matching foreground CLI when one is recognised, takes input: other programs were never checked, and a report naming another CLI than the one leading the terminal is a previous program's. Copilot CLI 1.0.106 and later reports idle at its folder trust prompt and with a picker open (#741), so a Copilot CLI agent that does not report blocked takes a prompt, a typed answer, keys or typed text, in every runtime, herdr included, only while the screen collied reads last before the write shows Copilot's own input box at the bottom, as Copilot 1.0.112 to 1.0.115 draw it, and empty for a write that adds Enter, so a command typed or completed in the box is not run; any other screen, or one collied cannot read, refuses (ADR-0015). It takes one key per call, so a batch cannot open a picker and answer it; Rex's screen is read with a polled format, never a watched stream that can lag; herdr-core's is read only after the core's typing hold on collied's own typed text has passed. A Copilot CLI or Antigravity CLI report gives input only while that program leads the terminal, blocked included, so a report kept after it stopped never makes another program writable. herdr's own status does not cover this: herdr 0.9.5 ruled Copilot 1.0.115's /model picker working. Its emulator answers no query and keeps titles, clipboard writes and links to itself; only SGR reaches the phone, as for herdr. A frame is at most 16 MiB, a read's paint ends within a second of its first bytes, an emulated screen is at most 1000 columns by 500 rows whatever size the core reports, and a watch keeps at most 1000 rows of history. Terminals on other machines (box/t7) are skipped, so no phone call names another machine. Focus on a herdr-core agent is refused before any herdr or herdr-core call. task.new reaches terminal.run only while herdr is not running, or when the app asks for Herdr Core (Start tasks in, #723), behind the gates and checks of a herdr task (Task folders from the phone): the program is the claude, codex, copilot or agy CLI collied finds by absolute path on the machine (never a bare name, which the core would take for a template, and never one the phone names), its arguments are collied's own (a checked session id, the ultracode setting, Codex's --no-daemon), its folder resolves under the roots, and it runs on this machine only, as /usr/bin/env with -u for herdr's six HERDR_* and Claude Code's ten session variables (and Code Mode's variable set to 0 or 1 when the task asks), so the starter's herdr pane identity and Claude Code messaging socket and token never reach it. A worktree task's git worktree add and an archive's git worktree remove --force run in the clone's environment (no prompt, no inherited GIT_*) on a checkout path collied built or checked under the roots; a worktree task's archive ends only that task's terminal, refusing while any other terminal works in the checkout it recorded (a followed Rex's blocks included, read afresh, for the start's one-task-per-checkout check as for the archive; a Rex that does not answer refuses both, named as such), and any other herdr-core agent's archive only closes it, its folder kept. Of the foreground process collied keeps only the basename of argv[0] when it is claude, codex or copilot, never the rest of argv. Status, title and name are the program's own words, shown as text like herdr's titles. So is the kind when the report's app is not claude-code, here and in Rex: the phone draws a kind it has no logo for as text in the agent list, so collied drops the control, bidi and format characters of app and cuts it at 64 characters where it makes the kind, before anything reads it. A blocked report's kind (permission, question) only decides whether collied parses a menu from the screen, as herdr's rule id does; its msg is never read, and options, snippet and fingerprint come from the screen. collied doctor checks that the socket's folder is 0700 and the user's, and warns when the core's holder process holds HERDR_PANE_ID, HERDR_SOCKET_PATH or CLAUDE_CODE_CHILD_SESSION, reading variable names only. Sessions: a Claude Code session comes only from sessions/<pid>.json for the terminal's own foreground pid, opened without following symlinks, size-capped, owned by the user, and trusted only while that pid is alive and started no later than the file says. A Codex session comes from the control socket's session request (same-UID, peer uid checked), kept only for an address the core lists, a plain-UUID session id, and a reporter whose process ancestry reaches that terminal's foreground process through exactly one codex, so a shared Codex app-server reporting with the environment of the terminal that started it is refused; it holds only while that process leads the terminal. Session ids become file names only after the plain-UUID check. |
| Residual | A program's output is parsed in collied's process by alacritty_terminal, as a desktop terminal would parse it. No authentication, as for herdr: any same-UID process can drive the core and every machine it added, or place a socket where collied looks before a core starts and feed it agents to list (another user cannot: the peer uid check refuses it) (Same-UID malware on the Mac). The starter's environment reaches every terminal: a core started inside a herdr pane running Claude Code gives its terminals that pane's HERDR_* identity and the Claude Code session's messaging socket and token, a channel into that session and into herdr speaking for that pane; collied cannot change the core's environment: it strips those variables from the agents it starts, and only doctor reports a core that holds them for the terminals others start. Screens saved by the core outlive their agents on disk. A program can report any status, title or name, so a card can claim blocked or idle falsely: a program reporting idle while it shows a dialog takes a prompt's Enter into it, as a herdr agent whose dialog herdr does not detect, and one reporting blocked with a menu on screen raises an approval, as a screen herdr matches would. Any same-UID process can write a session file for a live Claude Code pid, and any process a terminal's own Codex runs (tool commands, MCP servers, other hooks, a prompt-injected command) sits under its single codex and can report any session id for that terminal, so Chat would show another of the user's conversations; a process outside that tree cannot get under it by naming itself codex. This crosses no boundary. The collie.kind and collie.worktree labels that mark a task and its checkout can be set by any same-UID client of the core, a prompt-injected agent included (through HC_TERMINAL_SOCKET and hc run --label), and archive trusts them: such a terminal can make a checkout under the roots removable, or keep its own folder from being refused, also without crossing a boundary. Phone input follows a report only when it names Claude Code, Codex, Copilot CLI or Antigravity CLI and the foreground CLI, when collied recognises one, is that same kind, and for Copilot CLI only while its input box shows; herdr-core 0.1.16 keeps a status after its program exits, so a report of those kinds left behind still passes under a foreground program collied does not recognise (an npm node, a renamed binary) until that program reports. herdr-core 0.1.19 and later drop the status on exit, and Rex drops a record whose owner is not the foreground process. A worktree task's git worktree add, for Herdr Core and Rex alike, runs what the chosen repository configures, as the user and before any agent starts: its post-checkout, post-index-change and reference-transaction hooks (or those under its core.hooksPath), its core.fsmonitor program, the smudge filters of the files it checks out and, in a partial clone, a fetch of the missing objects with its core.sshCommand and credential helpers. The clone's environment removes prompts and inherited GIT_* variables and holds transports to HTTPS and SSH; it carries none of the overrides of collied's reads (Git reads in an agent's checkout). In herdr the checkout is herdr's own worktree.create, with herdr's git and environment, which collied does not set. Whoever wrote that configuration (the user, or an agent that worked in the repository) already ran as the user, so this crosses no boundary; a phone that starts a worktree task there is what triggers it. |
| Phase | Built: listing, status, sessions, close, screen reads, input and approvals, archive, and task start and resume while herdr is not running or when the app asks for Herdr Core. |
| |
| Assets | Every terminal a Rex server runs, and what its API reaches beyond them: built-in Tailscale and the server's other listeners, the host list, Lua configuration, Rex.app's actions, the user's files (list_dir, upload_begin, download_begin) and the server itself (server.stop) |
| Attack | A phone, or collied acting for it, reaches the server's wider API; Rex's shared server, a socket opened to a group, or a socket another process placed where collied looks speaks for the user's Rex; another machine, or an anonymous caller, types into the same agents through the server's own remote access; a stale status record makes a program that left look like an agent; a program's status or title misleads the phone; the server's environment reaches every block; a process names a block in a session report (REX_BLOCK is the reporter's own claim) to bind a session to an agent it does not run; a program in a watched block prints bytes made to exploit the native parser its stream feeds, or look-alikes of Rex's own stream messages to resize or end what collied follows; the phone types into a Rex shell (#755), or input meant for a shell reaches an agent, or one on another of Rex's hosts; after the server restarts, collied starts an agent's resume (#927) in place of a block the user is using, twice, in the wrong block, as text a shell would parse, or with arguments a program or a file chose. |
| Mitigations | collied never starts a server and finds the socket as the rex CLI does, from its own environment, never from REX_SERVER or the host list. It follows only a personal server: the socket and its folder owned by the user with no group or other bits, and the server's peer uid its own; otherwise it refuses, logs once, and collied doctor says why. The client takes a method enum with no call by string: collied can send only help.all, server.version, server.status, block_creator.list, session.attach_all, session.list, session.attach, session.list_blocks, block.close, block.event, session.create, session.disown_block, session.destroy, session.new_split, data.connect and the terminal methods process, program_status, title, size, format, blob_read and resize, and none before the server lists it; block.event carries only a paste or a key event, the only ones collied builds, never mouse, wheel or focus; server.stop, server.tailscale.*, server.apple.*, hosts.*, client.*, write, own_block, set_theme, list_dir, upload_begin and download_begin cannot be sent, since nothing names them, so reading a screen never changes a block's size or owner. A task's block starts at the size of the tallest terminal collied follows (session.create's options.size, only when larger than 80x24). resize is sent only to a block collied started as a task: on a sync, once per task record, to a recorded block that collied lists as an agent leading the block with no shell above it and that is still 80x24 and was never sized (at its creation, by collied, or by a client that size_changed reported), with the size of the tallest terminal collied follows. A resumed agent's block starts at the size of the restored shell it replaces. Sizes come from Rex's own reads, capped at 65535 (Rex's documented maximum), and a zero size is never sent. Rex applies a resize at once only while no client owns the block; while another client owns it the request only queues, and it is not applied when that client gives the block up or disconnects, since collied never asks to own a block (checked on a scratch server), so it never overrides Rex.app's size for a block Rex.app owns or owned. A block Rex restores under a task's id runs a shell, which is never resized, nor is an agent the user starts in it; one exec'd in the shell's place would lead the block as collied's agent does and could get that one resize. A listener that admits anonymous callers makes collied refuse to follow; built-in Tailscale or a tailnet listener is followed with one log line, a note in collied status and a collied doctor warning that other machines reach the agents collie follows outside its allowlist and audit. Blocks of other hosts are skipped. Focus on a Rex agent is refused before any Rex or herdr call. A record whose owner is not the foreground process, or a shell in front, lists no agent. The phone ends Rex blocks only through pane.close and task.archive, which close only a block collied lists as an agent or a terminal, by its id, with block.close (archive then runs the usual gh poi cleanup in its repository, as for a herdr-core terminal outside a task); workspace.close on a Rex session is refused, so no phone call ends a session that holds anything, short of the race in Residual: session.destroy is sent only by a task's archive, after its block closed, on the session collied recorded creating for that task (by block id in rex-tasks.json), only while the block was in it, and only when a fresh read finds no window and no block left in it; any other session, or one a read leaves unclear, stays. Screens are read with format and blob_read on a listed agent or terminal only, and pass through the emulator and sanitize_ansi, as herdr-core's do. While a phone watches a listed agent, or a listed terminal under its grant, collied opens one data connection to its terminal (#765): data.connect on its own attached connection, then /api/data on the same personal socket, checked as the control connection is, a one-use ticket, messages up to 64 KiB, and nothing sent after the handshake but the WebSocket library's answers to Rex's pings and a close; the stream ends with the last watch. Its bytes are output only: they reach libghostty-vt (libghostty-vt in collied), whose terminal answers no query (it has no way to write back), and a read leaves it only as text, styles and links formatted for collied's own emulator, at most 983,040 bytes a read, so a streamed screen reaches the phone as a polled one does, through the emulator, which drops the links, and sanitize_ansi. Rex's own messages are taken from the stream only with the connection's 64-bit channel nonce, which a program never sees: a look-alike resize or exit a program prints stays output. The snapshot's envelope version is checked before the library reads it, and an unknown one, or a stream that cannot be read, falls back to polling. Input reaches a block only when collied lists it as an agent, through the phone calls and checks a herdr agent's input takes (Prompt injection into the terminal), on collied's own connection: prompts and typed answers as a paste then Enter, text without Enter as a paste, and Key, Ctrl+End and a notice digit as key events. A paste cannot end itself: Rex brackets it when the program asked for bracketed paste and turns an ESC in it into a space, and prompt text carries no control character anyway. Agents with no OSC 7501 status, or whose report does not name Claude Code or Codex with a matching foreground CLI, take no input from the phone, as for herdr-core, a startup dialog's own keys to a Codex or a Copilot CLI aside. Shell input (#755) reaches a block only when collied lists it as a terminal (no agent, and a shell in front or above the program in front), through the terminal calls and every guard of Shell input from the phone: terminals off unless collied.toml turns them on, a grant for that terminal in that session, the block re-read as a terminal with no agent and no approval pending on it right before the write; then, before each event of the call, the block is read again from the model and the send stops once it is no longer listed as a terminal, so a line's Enter does not follow it into an agent whose start Rex reported meanwhile, and agent input never reaches a shell. Only blocks whose host_id is the server's are ever in the model, so no input, an agent's or a shell's, reaches a block on another of Rex's hosts. Keys Rex would send as nothing (cmd, Control with Shift on a character, and the other Control keys herdr-core refuses) or as ESC [ (ctrl+alt+[) are refused before any key of the call is sent. Approval decisions reach a Rex agent as a herdr-core agent's do: only for an approval collied raised from a blocked report whose kind gates the menu, and only after the decision's own screen read finds the approval's seq (from the record's updated_at, which every report sets anew) and fingerprint, so a decision meant for one dialog never answers the next, an identical one included; the keys go as key events on collied's connection, and msg is never read. task.new starts a program in Rex only while neither herdr nor a followed herdr-core answers, or when the app asks for Rex (Start tasks in, #723), behind the gates and checks of a herdr task (Task folders from the phone), and only as herdr-core starts one: the program is the claude, codex, copilot or agy CLI collied finds by absolute path on the machine (never one the phone names), its arguments are collied's own (a checked session id, the ultracode setting, Codex's --no-daemon), its folder resolves under the roots, and the command is /usr/bin/env with -u for each of the same sixteen variables, then, for a task that sets Code Mode, CLAUDE_CODE_EXPERIMENTAL_CODE_MODE as 0 or 1, then the CLI and those arguments. It goes to session.create as options.command, an argument vector that Rex hands to the program unchanged after the user's login shell reads its profile (checked live with spaces, quotes, ;, $(), backticks, a newline, a leading -, $HOME and *: none was interpreted), never as a command line a shell parses; the prompt is never on it, and reaches the agent afterwards as input, through the checks above, once the agent reports idle or done and only if the agent runs in the folder the task asked for (as herdr-core tasks are checked too). Each task gets a session of its own on this machine's server (labelled with the task's label or name), so it never lands in a session of the user's; collied gives the new block up (session.disown_block), so collied owns no block, and records the task by block id in its data folder (rex-tasks.json, 0600): only a checkout recorded there for a block Rex still lists is ever removed by an archive, after that task's block alone is closed, and only while no other block, shell or task, works in it, read afresh from the server for every block, not from events. Sessions keep herdr-core's bar, from the same code: a Claude Code session comes only from sessions/<pid>.json for the pid Rex reports as the block's foreground process, opened without following symlinks, size-capped, owned by the user, naming that pid, and trusted only while that pid is alive and started no later than the file says; it is read on that block's process and status events and once per reconcile tick, never per listing, and holds only while that pid leads the block. A Codex session comes from the control socket's session request (same-UID, peer uid checked) naming rex: and a block, kept only for a block the followed server lists as a Codex agent, a plain-UUID session id, and a reporter whose ancestry (from the connection's peer pid, not from the request) reaches that block's foreground process through exactly one codex; it holds only while that process leads the block. So a process that names a block it does not run under is refused, whatever REX_BLOCK it reports. Resuming after a restart (#927 and #934, ADR-0013, Claude Code, Codex, Copilot CLI and Antigravity CLI, on by default, off with CollieBar's item or rex_resume) never types into a shell. It starts the agent as an argument vector in a new block (session.new_split with options.command, cwd, shell: none and login: false): /usr/bin/env -u with each stripped name, the login shell named by collied's own SHELL, which launchd sets from the account (zsh or bash only, an absolute path with no =; any other, or none, starts nothing), -l -i -c, the script builtin cd -- "$1" && followed by the CLI's bare name and its fixed resume arguments, then collied and the recorded folder as positional arguments, never in the script (--resume ID, resume ID --no-daemon, --resume=ID or --conversation ID), every word only lowercase letters, digits, - and =, with ID a lowercase hyphenated UUID from the conversation collied bound as above (or, for Copilot CLI, the session the block's process holds under an flock); never another flag, a permission flag, or screen text. Only a new server instance (instance_id) whose started_at is less than 90 s old and not in the future is planned, never on a reconnect, and the plan ends 90 s after that start on collied's monotonic clock. A conversation is started once, in place of the block id that ran it, taken off rex-resume.json (0600, flushed, read at most 256 KiB on the checked descriptor, cut to 256 checked entries, written only when it fits, logged by error category only) before anything is created. It is started only while a fresh process read shows that block's shell running nothing, its screen matches collied's first read of it (changes in the 2 s after that read settle the reference; any later change refuses the block for good) and has not changed for 2 s, the recorded folder exists, the conversation's transcript exists, no live process holds it (a Claude Code's pid file, an flock on Codex's writer lock, a held Copilot marker, or Copilot markers collied cannot read, or a held or open Antigravity presence lock), no agent in the live model runs it, and a claim under the toggle's lock finds the option on and the window open. The new block starts beside the restored shell. A known exit (an exit event, or a block collied saw and the server no longer lists) closes neither block (Rex closes the new one as its program exits); a block missing because its reads failed, or while collied is out of sync, never counts as one. The shell is closed only once collied has listed the new block for 3 s as an agent of that kind in the recorded folder with its kind's proof of that conversation (a Claude Code's pid file, the Antigravity CLI's hook report from under the block's process or that process having only that conversation's presence lock open, the block's Codex having its writer lock file and rollout open while that lock is held by some process, or the block's Copilot CLI marking exactly one session, that one), and then, after a last process and screen read of the shell (the only awaits before block.close) show the same idle shell and screen, the model still shows the agent running it there and not exited, and the option is on and the window open; otherwise the shell stays. |
| Residual | A paired phone can start Claude Code or Codex in any folder under the roots while herdr and herdr-core are not running, or whenever it asks for Rex, with the user's login profile and the server's environment less the sixteen names: the same reach a herdr or herdr-core task has. Rex starts a block in the user's home when its folder is not a directory; collied resolved the folder just before, so only a folder removed or replaced in between does that (an archive of a task in that checkout racing an Open of it, say), and the agent then starts in the home folder but gets no prompt: the start fails, naming the block it left running. A block created whose answer was lost, or created but not given up because collied crashed or reconnected in between, stays owned by a client that is gone: it keeps its starting size (80x24 unless collied asked for a larger one) and is not closed when its program exits; collied says an agent may have been started, and archive from the phone still closes it. Rex has no conditional destroy: a block or window added to an archived task's own session after collied's read found it empty and before session.destroy arrives (one round trip on the local socket) ends with it. A block Rex.app is next in line for passes to Rex.app when collied gives it up, as the user's own blocks do. A program can report any status: a false blocked beside a menu-shaped screen raises an approval, as for herdr-core. A blocked agent's screen is read on at most three reconciles of each report while its approval stands, not on every one, so a dialog that changes without a new report after those reads keeps its approval on the phone until a decision's own read refuses it or it expires. Rex has no conditional send: collied checks the agent's status again from the model before each event of a prompt or typed answer, and a blocked agent's dialog by its seq, and stops on a change, but a dialog that opens after that check and before Rex handles the event (one round trip) takes the prompt's Enter, which approves its highlighted option; herdr refuses a blocked agent at the call and herdr-core holds the send to the status seen, so this window is Rex's own. No authentication beyond the peer uid: any same-UID process can drive the server, or place a socket where collied looks before a server starts and feed it agents to list (Same-UID malware on the Mac). Remote access the user turned on in Rex (built-in Tailscale, tailnet listeners, SSH forwards) reaches the same agents outside collie's allowlist and audit: collied warns and still follows. The server's environment reaches every block; doctor reports herdr's and Claude Code's session variables in it, and collied cannot change it. Rex keeps each terminal's screen on disk under its own state folder, readable by the user only. A watched terminal's output, and its snapshot, which carries the whole scrollback, are parsed in collied's process by libghostty-vt, native code with the residual risk below; the rest of a Rex terminal's output, like Herdr Core's, is parsed by alacritty_terminal after Rex's own Ghostty rendered it. A process running under a Rex Codex agent (a command Codex runs, or its hooks) can bind any session id to that agent, as under herdr-core: Chat, context and costs show that conversation, task.sessions leaves it out and task.new refuses to resume it; it reaches no other block and reads nothing the user's processes cannot. A same-UID process can write a pid file for a live Claude Code it does not own, as it can already write transcripts. With terminals on, a granted phone types into the user's Rex shells as into herdr's, and reaches whatever runs in them, the residual of Shell input from the phone; an agent run under a shell that keeps the terminal (sh -c 'cd x && claude') is no agent, since a shell is in front; once its first report has reached collied, the block is a pane hosting an agent while that shell, not a login shell, owns the record or a live owner's record says working or blocked, so shell input stops there, and the terminal's grants are dropped on the phone's next terminal call or an open watch's next tick, not at once as herdr's poll drops them: if the agent's wrapper exits within a grant's lifetime while the phone made no terminal call and held no watch, the shell, listed again, takes input on that grant. Before that first report (Claude Code reports nothing at its folder trust prompt), a line typed there reaches the agent, and a dialog the agent does not report takes the line's Return. A wrapper suspended at idle or done leaves the user's shell in front, which takes the line; after fg, a further call reaches the agent until Rex reports the new foreground, the same race as an agent starting in the shell. An agent CLI collied does not recognize in Rex, with neither a record owned as above nor claude, codex or copilot as its argv0 (another agent, or an npm-wrapped CLI whose foreground is node), is a shell command to collied, as an agent herdr does not detect is in herdr. An agent that starts in a Rex shell gets the event from its exec until Rex reports the new foreground, a delay of Rex's own that was not measured, and one round trip after, as in herdr. A line reaches a Rex shell as a paste, not keystrokes: a program in front that turned bracketed paste on takes it as pasted text. A watched terminal's stream goes on feeding collied's parser while the grant has lapsed; nothing of it reaches the phone until a new grant. Resuming closes the user's restored shell once the agent runs, and these can be closed with it: text typed or a command left at the restored shell's prompt before collied's first read of its screen (the first reconcile tick, each second, on which collied follows the new server and finds the shell running nothing), or in the 2 s after that read, which collied takes as the prompt settling; a program started or text typed between collied's last screen read and block.close, one round trip on the local socket; and a startup file waiting in the builtin read, which looks like a shell running nothing, so its question goes unanswered. A conversation quit less than 15 s before the server stopped gets the agent back. The resumed agent's block closes when the agent exits, unlike the shell it replaced. collied runs the account's login and interactive startup files (.zprofile, .zshrc, .bash_profile and what they source) for each resumed agent, so the user's environment, aliases and functions reach it as in their own terminal: whatever those files run, collied now starts on the user's behalf after a restart, with the same reach as a terminal the user opens (a file that waits for input leaves the agent unconfirmed and both blocks in place). An alias or function named after the CLI decides what runs, as when the user types the name. A resumed agent that exits before it is confirmed loses its block as it exits (Rex closes it), so its error shows only for a moment; its shell stays. A same-UID process can write rex-resume.json to name another block or conversation, or make and lock a Copilot marker naming a resumed agent's pid so it reads as confirmed (the lock check does not say which process holds it), as it can already drive any block. |
| Phase | Built: discovery, the personal-server and listener checks, listing and status, pane.close and archive's close (#704), screens (#705), sessions (#707), input and approvals (#706), task start, resume and archive while neither herdr nor herdr-core answers (#708) or when the app asks for Rex (#723), removing an archived task's own empty session (#727), watched terminals followed as streams (#765), shells listed as terminals and typed into under the terminal guards (#755), agents resumed after a server restart (#927). Not built: focus, which Rex.app does not follow (#709); agent.focus on a Rex agent is refused before any Rex or herdr call. Phone input to Copilot CLI and its tasks are built, its input guarded by its screen (#742, #743). |
| |
| Assets | The invite (pairing code) while its QR is shown; the y/N decision on a candidate phone; collied's state |
| Attack | Another app or a stray click approves a phone; the invite leaks from the app; phone-provided strings disguise the candidate; the app becomes a way in from the network. |
| Mitigations | Only a local client of the 0600, same-UID control socket (pair with its confirm answer, peers_list, a read-only watch, and rex_resume, which reads or sets one audited option); no network listener. Developer ID signed, hardened runtime, no entitlements. The invite is never shown as text, copied, logged or persisted; window restoration is off. Pair is not the default button and is live only 1 s after the candidate appears; one answer per candidate, never automatic; collied refuses after 60 s; closing the window cancels. Candidate strings are escaped like collied::printable (controls, format and bidi characters, combining marks, default-ignorable characters, non-ASCII spaces). First-run Set Up runs only the fixed installed executable in Terminal (a private, self-cleaning command file with a quoted literal path), and the CLI still checks its path and signing identity. Interactive login opens only the exact Tailscale HTTPS login authority, once; the printed URL remains the fallback. |
| Residual | Same-UID code can drive the control socket or the app, and can already answer the y/N prompt (same-UID malware). The QR is on screen for up to 120 s (leaks). |
| Phase | Built |
| |
| Assets | As for the menu bar app |
| Attack | As for the menu bar app (a stray key too), plus: the invite leaks into argv, a file or the shell's log; phone strings render as rich text; the audit log is edited through the viewer. |
| Mitigations | An Omarchy shell plugin and only a local client of the 0600, same-UID control socket, sending CollieBar's requests; no listener, no network access, no change to collied. The invite reaches qrencode only on stdin and is never logged or shown as text. Pair is bound to no key; otherwise pairing works as in the menu bar app (live after 1 s, one answer, refused by collied after 60 s, cancelled by closing the panel). Phone strings are escaped like collied::printable and drawn as plain text. Commands run by argv, never through a shell string. The audit log opens in less with LESSSECURE=1. |
| Residual | Same-UID code can drive the control socket, the shell or the plugin files under ~/.config/omarchy/plugins (same-UID malware), and any other shell plugin runs in the same Quickshell process. The QR is on screen for up to 120 s, and qrencode's output, which encodes the one-time invite, stays in the shell's memory until the next pairing. |
| Phase | Built |
| |
| Assets | The y/N decision on a candidate phone; the launchd agent or systemd user unit; collied.toml and the APNs key |
| Attack | Piped input (yes) confirms a pairing without a human; setup installs an unsigned agent or a service running a build output, leaves the key or config readable, or on Linux logs in a new node over the paired one. |
| Mitigations | Setup refuses to start unless stdin is a terminal and the running binary is the regular file ~/.cargo/bin/collied (on Linux, or the package-owned /usr/bin/collied), on macOS Developer ID signed as dev.rbstp.collied, so the service never runs a build output that the next cargo build replaces unsigned, nor one reached through a symlink. It never confirms a pairing itself: it runs collied pair, whose y follows a tcflush. It installs the service through service install (on Linux a 0644 unit, no secret, UMask=0077) and, with --direct-apns, runs apns import (read back, offer to delete the .p8, key never printed). A new collied.toml is created 0600; an existing one is rewritten atomically, keeping its mode; neither [apns] nor [push.relay] holds a secret. Setup changes no bind, gate or pairing rule, refuses to drop the --config the service runs with, and stops on any doctor fail line, listen included. On Linux it refuses a unit loaded from another file, a collied.service.d drop-in it cannot check, or a unit pinning another XDG_DATA_HOME, so it never logs in a fresh node beside the paired one. |
| Residual | Same-UID code can drive a terminal or the control socket (same-UID malware). |
| Phase | Built |
| |
| Assets | The machine's APNs .p8 key; the systemd host secret /var/lib/systemd/credential.secret |
| Attack | A same-UID process, another local user, root, a polkit admin, or someone with an offline copy of the file or disk reads the key from <data dir>/apns/<key ID>.cred or the fallback file. |
| Mitigations | Import (architecture.md): collied apns import applies the macOS file checks ([apns] ids, no file named for another key ID, a user-owned 0600 regular file opened with O_NOFOLLOW, an ES256 key), encrypts with systemd-creds --user under the name collied-apns-<key ID>, writes the credential itself (0600, O_NOFOLLOW, atomic), verifies it decrypts to the same key before and after storing, then offers to delete the original if it is still the same inode. Seal: AES-256-GCM under a key derived from the host secret (root, 0400), the TPM2 when usable, the uid, user name and machine-id, so a copy of the .cred alone decrypts nothing, and a TPM2 seal also needs that chip. Other unprivileged users cannot decrypt it: decrypting another user's credential takes polkit admin authentication (auth_admin_keep), and collied passes --no-ask-password, so it never raises a polkit prompt. Every decrypt passes the bound name, so a credential made under another name fails. The daemon, collied apns test and doctor decrypt through stdin and stdout, never to a file. Doctor reports the seal, fails on a credential that does not decrypt or has a null key, and warns on an unrecognized seal or on a host-only credential once a TPM2 is usable (import again to bind it). Fallback: where systemd-creds cannot encrypt (no systemd, no systemd-creds.socket, systemd older than 256, a container), import says so and writes a 0600 <data dir>/apns/AuthKey_<key ID>.p8 named by key_path; doctor reports it as protected by its mode only, and warns to import again once systemd-creds works. |
| Residual | No per-application binding: any same-UID process decrypts the credential without a prompt, unlike the macOS Keychain item (same-UID malware). Root, and anyone who passes polkit admin authentication, decrypts it too. An unprivileged caller cannot choose the seal: systemd uses host key and TPM2 when a TPM2 is usable and sealing to it succeeds, else host key only; doctor shows which. Without a usable TPM2 (the dev machine: T2 Mac hardware, where systemd-analyze has-tpm2 reports partial), whoever reads the unlocked disk (host secret, machine-id, credential) can decrypt the key elsewhere. The credential stops decrypting after an OS reinstall, a machine-id, uid or user name change, or a restore to another machine: import again from the backup. The 0600 fallback is protected by its mode only, like key_path on macOS. |
| Phase | Built |
| |
| Assets | Followed agents' status and labels; the update tokens |
| Attack | Someone looks at the locked phone, or a party holding the APNs key and a token pushes fake content. |
| Mitigations | Nothing shows unless the user follows the agent (off by default): then status, labels, elapsed time and the approvals count. While an approval routed to it is pending, and only when enc opens with the approvalId as AAD, it adds Approve, Deny and the command, which the widget decrypts on the phone with the per-machine notification key and marks privacySensitive, so iOS redacts it while the phone is locked or the display dimmed. Unauthenticated state shows neutral Collie content and no buttons. The buttons take the lock-screen path, one decision at a time per approval. Tapping elsewhere only opens the app on that agent, which validates both ids and decides nothing. Tokens (Assets) are bound to the registering device's StableID, so another paired device can neither replace nor end them. They are dropped on revoke, Unregistered or BadDeviceToken, end, when the terminal is gone, and 8 h after first registering (ActivityKit's activity lifetime), so a dead activity stops receiving updates; at most 8 per device, one per terminal. The alert that expands the Dynamic Island is the approval alert itself, under the same rules (a new prompt alerts; the same prompt reissued within 30 s does not), and replaces the approval notification on that device, so a flapping agent cannot make an alert stream. |
| Residual | Anyone who sees the locked phone sees the followed agents' names and workspaces, whether they wait for approval, and the Approve and Deny buttons, but not the command. With the APNs key and a token, an attacker can still interrupt the activity lifecycle, deliver generic alerts and, if the notification extension does not run, supply arbitrary fallback text; private state and working controls need the notification key, and a decision still needs an unlock and the machine's nonce. The encrypted state binds machine, destination key, activity scope and event, so a replay onto another activity or machine shows no private labels or controls; within its own activity a valid old envelope can be replayed, and the live nonce, expiry and fingerprint checks remain the decision authority. |
| Phase | Built; to be verified on device. |
| |
| Assets | The decision on a blocked agent |
| Attack | Someone holding the phone approves or denies from a notification or the app, or a fake alert tricks the owner into an action. |
| Mitigations | Lock-screen Approve and Deny are authenticationRequired on the notification and .requiresAuthentication on the Live Activity's intent: iOS asks for Face ID or the passcode before the app runs, and collie adds no check of its own. A notification action decides only with proof that ColliePush rewrote the notification from the authenticated display: the mark it leaves there (an HMAC of the envelope under the notification key, which no sender holds), or the notification's own title, body and category equal to what ColliePush writes (the body with or without the unreachable note) and no subtitle, which ColliePush clears. Without it the action sends nothing, leaves the app on the approval and says so in a local notification. No Always allow on the lock screen; in the app it is offered, and sent, only from the review sheet directly under the rule Claude Code will save, drawn verbatim and whole from the one option that carries it (collied offers the decision only when that option's label and detail arrive uncut), and not at all when no option or several carry it. In the app, each decision first passes LocalAuthentication deviceOwnerAuthentication with a fresh LAContext, so one unlock never covers a later approval. The background decision is a one-shot session capped at 20 s: no Tailscale login (NeedsLogin fails at once as Unauthorized), current embedded same-user ownership, the pinned machine StableID and TLS key, a paired hello, then the machine's nonce, the fingerprint check and a rate-limited, audited approval.decide. The follow-up notification claims success only on applied. The Face ID or passcode sheet of an in-app decision names the decision, the workspace and the machine, as a terminal grant's does, never the agent's label, which for an agent with no herdr name is the title its program set. |
| Residual | The lock-screen gate is iOS's unlock and nothing more: a device unlocked recently enough for iOS to skip the prompt, or a known passcode, passes it. Legitimate fallback text is generic; private title, body and controls need authenticated decryption. A malicious APNs provider can still show its own fallback text if the extension does not run (Leaked APNs key); an action under it can only open the app, where the approval shows as the machine sent it. |
| Phase | Built; timings to be measured on device. |
| |
| Assets | The decision on a blocked agent; the commands, agent lines and plan usage shown on the watch |
| Attack | Someone wearing or holding the owner's watch approves or denies, a watch message claims to be allowed, or a watch request names an approval or an answer the phone never showed. |
| Mitigations | Watch decisions are off by default; turning them on in the iPhone's Settings needs LocalAuthentication deviceOwnerAuthentication, turning them off needs nothing. On every request the phone re-reads the setting from prefs.json (missing, unreadable or before first unlock: off) and trusts no flag from the watch. It decides only an unexpired approval, with an answer it offered, in the last application context it sent the watch; anything else is refused with nothing sent. Each watch decision first passes deviceOwnerAuthenticationWithWristDetection with a fresh LAContext; the phone then takes the lock-screen path. No Always allow, notes or typed text. The watch gets every text of an approval whole (agent, workspace and machine, command, the agent's reason, output, each option with its detail) under one bound of 4,096 UTF-8 bytes an approval. A prompt over the bound, or with more than 9 options, is cut at a visible ellipsis and marked: the watch shows it read-only, says it is too long and sends the owner to the iPhone, and the phone refuses any decision on an approval it sent cut, so no decision is made under a silent prefix. When the watch app opens, it asks the phone for the current state; a phone out of the foreground fetches each paired machine's approvals over the same one-shot sessions (approval.list, no decision) and sends them as the state the watch may decide on. The watch holds no keys, never links CollieCore and never talks to collied. The reason given to the watch's check names the decision, the workspace and the machine, never the agent's label. A refusal's reply carries the state the phone decides from, with the setting as it reads then, and the watch applies it at once, so it stops offering what the phone will not decide. The reply to a decision collied answered superseded carries that state without the approval collied ended, and the phone sends it as the context it decides from. A phone that has sent no context refuses every decision and has no state to carry: the watch then asks for a refresh. |
| Residual | The phone cannot verify the wrist check, so the setting is the phone-side boundary. Decisions work while the iPhone is locked (after its first unlock); one in flight when the setting turns off completes; switching the iPhone to another watch turns the setting off. Mirrored iPhone alerts: on device, their Approve or Deny on the watch only opened the watch app, which as notification delegate turns any response to an alert naming an approval into opening it, so a decision still takes the watch path. watchOS documents no rule for which app's category a mirrored alert takes (the watch app registers APPROVAL without actions); a response routed to the iPhone instead would take the lock-screen path, under iOS authenticationRequired, not this setting. Refreshes run whatever the setting, so a locked phone hands the watch the pending commands, as the published state already did. Each refresh wakes the phone and dials every paired machine: at most once a minute while the watch app is in front (each wrist raise reactivates it), about every 15 minutes in the background (at most 4 an hour), on every approval alert opened, or received while in front, and after each decision refused by a phone that has sent no context; an unreachable machine keeps its last shown approvals. Commands, agent lines and plan usage reach the watch over WatchConnectivity (encrypted by the system) and stay in the watch app's last received context. |
| Phase | Built; to be verified on device. |
| |
| Assets | Any socket the computer or the phone exposes |
| Attack | Scan and connect to ports on the computer or the phone from the local network. |
| Mitigations | No kernel TCP listener: collied listens only through tsnet and never calls tailscale_loopback (127.0.0.1 SOCKS5 and LocalAPI); the peerapi kernel listener, which upstream binds on every interface in netstack mode, is patched out. An end-to-end test, and collied doctor on the running daemon, check for TCP LISTEN sockets (lsof on macOS, /proc/<pid> socket tables on Linux); any read or parse error, or unexpected lsof stderr, fails the check instead of reading as "no listener". The only real-interface socket is magicsock UDP, which accepts only WireGuard and disco packets authenticated against netmap keys. The control socket is a Unix socket. |
| Residual | magicsock UDP is reachable and parses unauthenticated packets before rejecting them. On the computer, NAT port mapping (UPnP, NAT-PMP, PCP) can expose that port beyond the LAN; the phone's library has no port mapper. Traffic metadata (timing, DERP use) is visible. On the tailnet, any policy rule reaching the owner's devices reaches the user-owned phone node: it opens no listener, but netstack serves Tailscale's peerapi to those peers in-process. On Linux, a system tailscaled on the same machine is a separate node with its own state and listeners, outside this check. |
| Phase | Built |
| |
| Assets | The shells behind herdr panes and herdr-core terminals |
| Attack | A prompt or key sequence sent from the phone, or a compromised phone session, escapes the agent and runs commands in the shell. |
| Mitigations | PromptText rejects ESC and every C0/C1 control except newline and tab, so a prompt cannot embed a paste terminator. Key is one of nineteen listed keys or a checked combination: modifiers from ctrl, alt, shift and cmd, in that order, then one key from a closed set (named keys, f1 to f12, lowercase letters, digits and unshifted punctuation), so each names one key press; a call of up to 16 keys can still type up to 16 characters (letters, digits, punctuation, Shift for capitals), as agent.send_text can type text. [ goes only with Control (ESC in herdr; herdr-core refuses it), so keys alone cannot put a [, digits, ; and a letter after an ESC from Esc, Alt or Control-3 to spell an escape sequence such as ESC[100;5u, the kitty form of Control-D that a program may read even in legacy mode; typed text still can (Residual). Control is refused with d, z, r, j, m, o, t, 4 or \ (EOT, SUSP, reverse search, newline, Return, Claude Code's and Codex's transcript views, QUIT), whatever other modifiers come with it: legacy encoding sends Control-Shift-D as Control-D, and Alt only prefixes ESC. herdr's privileged methods are unreachable. agent.send_text types TypedText as is, with no Enter or bracketed paste: no C0 or C1 control can pass, so it carries no escape sequence and submits nothing in an input box (on a dialog one character can be the answer: Keys and text on a blocked prompt), and it takes the same agent, authorization and scrolled-transcript checks as keys (keystrokes the phone's terminal view sends one batch at a time, with the trust of agent.send_keys and agent.type_text). agent.type_text sends bracketed-paste text and Enter in one ordered write after validating the live agent identity and authorization, and by design accepts approval answers without parsing their prompt (Keys and text on a blocked prompt). Shell input needs enabled terminals and a live grant (Shell input from the phone). Approval notes are one line, typed only into a verified amend field. Narrow writes, which share a lock and recheck authorization: agent.scroll_bottom sends only fixed Ctrl+End bytes to a scrolled-up Claude Code screen; agent.answer_notice sends one listed digit, no Enter, only above an empty input box under the displayed label; agent.slash_draft pastes a bounded slash token, no Enter, only into an unblocked, unscrolled Claude Code input box, then verifies it; draft replacement clears only the exact expected text in a readable, ordinary input box and rechecks that it is empty before prompting. The phone withholds its own Enter, with any modifiers, while Claude Code's box holds a slash command it mirrored from Chat, and drops any such key queued before the mirror; collied no longer refuses them, so a slash command the user types in the Terminal view submits on Return. Agent startup and new folders stay within configured task roots and agent kinds; occupied panes are refused; authorization is checked before every write. |
| Residual | If the agent exits between herdr's foreground-agent check and the queued text and delayed Enter, the shell receives the prompt; closing that gap needs conditional input in herdr upstream. herdr-core has it: a prompt or typed answer to a herdr-core agent the check saw idle or working carries if with that status, so the core types only while the program still reports it, which narrows the gap to the core's own check. if takes no other status, so to a done or error agent the prompt goes without it and only the core's refusal of a blocked program applies. Keys and the typing attach carry no condition, and the core holds a send or keys call until nobody has typed for about 3 s, counting collied's own typing attach (measured 2.8 to 3.3 s on 0.1.16); a held call is delivered whenever the typing pauses, with no bound and even after collied gave up on it: collied waits up to 15 s for a prompt, a typed answer or keys from the key strip, and up to the decide budget (6 s, 9.5 s with a note) for an approval's keys. So a key collied sends right after its own typing attach lands about 3 s after collied's last read: an approval note's Enter therefore waits the hold out and reads the dialog again first (Approval TOCTOU), while the slash mirror's next clear keys (Ctrl+E, Ctrl+U, Backspace, Ctrl+K) are not held back, as none of them answers a dialog. A key held because the user types on the machine lands once the user stops, after collied's checks; the user at the machine is the owner, and the same keys then reach whatever they left on screen. A program that reported a status and exited, or was suspended, leaves it in herdr-core 0.1.16; collied lists no terminal a shell leads, so a shell is never prompted as the agent that left it once the core has seen the shell lead; the core's foreground check lags a few hundred ms (0.38 to 0.49 s after Ctrl+Z, measured), and a write checked within that window still goes to the shell. A state_change_seq condition on terminal.keys, or a way to cancel a held call, would close the key gaps upstream. An Esc key followed by typed text (agent.send_text, terminal.send_text) can still form an escape sequence, such as ESC[100;5u, when both reach the program in one read; this predates key combinations. Text an agent reads from a repository can still steer the agent; that is outside collie. A dialog Claude Code draws between agent.slash_draft's last read and its write receives the token as a paste: the agent.answer_notice gap, narrower because the token starts with /, is never a bare digit and carries no Enter. The iOS keyboard's dictation and paste reach the prompt field like typing, so a dictated or pasted /word can show in the machine's input box; it is never submitted without a send. Return reaches a Claude Code box that starts with / whenever the phone did not mirror it there: a command the user types in the Terminal view, or one left in the box on the machine, runs Claude Code's highlighted match. |
| Phase | Built; herdr conditional input: upstream proposal. |
| |
| Assets | The decision the user meant to make |
| Attack | The question under a still-blocked agent changes (new tool call, different command) between display and decision, so "approve" answers a different question. |
| Mitigations | Fingerprint: SHA-256 of the agent kind, matched rule id (a herdr-core agent's blocked kind), terminal_id, agent session id and the dialog region with its cursor. The region starts under the dialog's top rule: the last horizontal rule that no row between it and the options sits left of, so a row of ─ in a command, which Claude Code draws right of the closing ╌ rule, the question and the header, never starts it and leaves the command's first rows out of the region, context, tool or snippet. Nor does a rule-like row between option 1 and the last option, such as a label wrapped onto a row starting with ─. Inside the option block only Claude Code's own separator, a row of ─ alone indented no deeper than the options around it, is left out of the region; any other rule-like row there, such as an option description the agent wrote starting with ───, stays in that option's label and in every cursor fingerprint. Every row under the last option, up to a blank row or a rule, is in the region too, however many the label wraps onto; the approval shows those indented at least as deep as the option's label, where Claude Code draws a wrapped label, as that option's detail, cut at 300 characters with …, and counts them in the length that withholds approve_always. A row left of the label is not shown as the option's text. It stays bound, the region marking which rows are shown so that a row moved across the label's column supersedes the approval, and under an option that reads as approve_always it withholds that decision: a label can move its own column with spaces inside it, or one row can sit left of it, and the rest of a scope would go unseen. So does any other non-blank row under that option down to the screen's end, past the blank row or the rule where the rows read stop, a footer included; no captured dialog ends on that option. What an option grants is read from its label and detail as the phone shows them, cleaned, so a format character in front of Yes, or wording split onto the row under the last label, reads as it shows. choose never presses a granting option of a menu that holds an option reading as an approval, so a menu left without a decision does not open that option, or a Yes, and switch to auto mode beside it, by index. A command block row is hashed with its indent within the block: only the dialog's margin is taken off (nothing when a row lacks it), so a command that differs only by a row's indent (EOF against EOF) or by a leading │ supersedes the approval, and the context, tool and snippet show that indent, taking off the 2.1.327 │ gutter only when the block has more than one row and every row has it. Only a ╌ row left of the dialog's text margin delimits the command block, as Claude Code draws its own; one in the description the agent writes or in a command delimits nothing. Two Claude Code parts are taken out before the region, cursor fingerprints, snippet and context are read (parsing in architecture.md). (1) The deny countdown, so its ticking does not supersede the approval: only its exact wording (fixed but for the time, so nothing the approver needs), only for agent kind claude, and only where Claude Code draws it, at the dialog's margin (indent of 1 or less) between the command block (or the dialog's top rule) and the question over option 1, or the question's first row when a long file name wraps it. Only Claude Code's own ╌ rules, left of the dialog's margin, say where the block ends: a ╌ row in the description or the command cannot unpair them to keep the countdown in the region and have the approval reissued every second. A copy in output or the command, in a Codex or Copilot dialog, or on a line with anything else stays; its time is never read and changes neither expiry nor alerts. (2) The reason for asking, which the phone shows apart from the command; it is hashed as shown into the fingerprint and cursor fingerprints, so a changed reason supersedes the approval. A reason that only repeats dialog lines, carries unsafe characters or is longer than the 200 characters the phone shows stays in the region: it is never cut, so nothing a reason says is shown short or left unbound. Rows under a ╌ row the agent writes are never read as the reason. Telling a repeat reads at most those 200 characters from each dialog row, so a screen of rows that nearly repeat a long reason cannot stall the read. No row inside the command block is ever dropped: a blank row stays in the region, the tool and the context, and a row is shown with the spaces inside it, so echo safe \ over a blank row and a second command never reads as one continued command, nor rm -- 'a b' as rm -- 'a b'. Whole dialog: Claude Code draws a dialog taller than the terminal from its bottom, so its head and a command's first lines scroll off the screen (2.1.328 says ↑ N more lines under the options). collied answers a numbered menu only when its top is on screen. A question form that tall scrolls its options instead (2.1.329 hides its header and top rule and marks the last option on screen ↓, or the first ↑, when more are hidden past it): it does not read as a menu, whatever rule sits above it, so no option is answered by index or by decision while others are hidden. A numbered row in an option's own text is no option: Claude Code draws an option's number left of all its text, so a row under an option row and set in deeper than its number is that option's text, whatever it reads. Claude Code 2.1.329 draws a description as one paragraph wrapped at the label's column, so one of the right width starts rows with a rule, a header, the question, 1. A and ❯ 2. B; read as options, those rows were a menu with its cursor on B while Claude Code's is on A, where no arrow is sent and Enter picks A. A menu's numbers share one column and a question form's cursor row is at column 0, so such rows are no question form when their option row is off screen either. A menu with a granting option (a label that reads as a decision, No included, or one that starts with Yes) needs its top rule. A menu that grants nothing (a question, a form) needs its top rule or, for a form Claude Code draws without one (the rate limit form), the ▔ border above it: from the last option up, the nearest row that starts at column 0 must start with ▔. Claude Code draws that border at column 0 and every row of the form under it indented, its options included, so a ▔ row a program prints never passes for it: in the form's text it is indented, above the form it has the border under it, and in a question form, whose text starts at column 0, it has the cursor row under it, at column 0 too. A granting menu is never answered under the border alone: the plan prompt is drawn under such a border behind a rule of its own, and could lose the rule and keep the border. Otherwise the approval offers no decision and no choice, says it takes no keys, and names no call (its context is the question line), and it is answered in the terminal, where those rows can be scrolled to. A numbered form that does not read as a menu at all (its option 1 off screen, or more rows under an option than a label wraps onto) says it takes no keys either. A form without numbered options (/memory, /ide, usage credits) takes keys as before: a numbered list above its ▔ border is old output, and under a numbered form's last option an agent writes only that option's own rows, which Claude Code indents, so none passes for the border it draws at column 0. A row of rule characters under the options, which an option's own text can draw, hides no numbered row: the whole screen is read. A choice's label and its detail longer than 300 characters are cut inside that length and end in …, so a cut one never reads as whole. Question forms: a top rule on screen does not make a question form whole: the question's text starts at that rule's column, so a row of ─ in it passes for the rule, and a form taller than the terminal scrolls its options and hides its header. The report of what blocks the agent says which dialog a menu is: under a report of a form (herdr's live_blocked_form, Claude Code's own question on Rex and herdr-core) every menu with no ▔ border is a question, answered only by choosing an option (but the unnumbered folder trust prompt herdr reports so, with its cursor at column 1, where no row the agent writes starts), never by a decision, a note or an Esc an option's label asks for, and under any other report a menu that reads as a question is refused. An option's description, which the agent writes, can draw a whole plan prompt or permission prompt when its option's row is off screen, so the wording never decides between the two. Nor does wording tell a question from another dialog under any report, since the agent writes a question's labels and can word one as an approval, as an amend field or as the plan prompt. So how Claude Code drew the menu decides next, in every state: a menu with its cursor row at column 0, where Claude Code draws AskUserQuestion's form and its review page while it indents its other dialogs, or with an entry it adds to a question's options (Type something., Chat about this), is a question form whatever its labels read, and the agent writes neither mark. A menu drawn otherwise, with no ▔ border, is answered on what the screen says only when it reads as another dialog: a permission prompt, which holds an option that reads as an approval or as the amend field Tab opens on one, or the plan prompt, told by its own wording. A menu that reads as neither is treated as a question, so a form drawn without those marks does not fail open. Any other such menu is answered, by index or by keys, by one of two paths (Question forms in architecture.md). Where the call that asks is in the session's transcript, as for a Code Mode script, the form must draw that call whole. Claude Code 2.1.329 writes a question asked outside Code Mode to the transcript only with its answer, so there the form is held to the screen's own proof, and only while the transcript, read whole, shows an open turn of this session's process with no call pending and no script running, in a session that is not in Code Mode (the read holds no REPL call and no repl-mode record, and starts at the file's start or holds a permission-mode record), its last record a prompt or tool results and none that Claude Code writes as the user's (a compaction summary, a task's notice, a slash command): the report of what blocks the agent calls it a form (for a herdr-core or Rex agent, the kind question in Claude Code's own report, which is not read from the screen); the session's Claude Code is 2.1.329 or later; Claude Code's header or tabs sit directly under the top rule, and the question is one row of at most 80 columns under a rule of more than 80, or rows all behind the gutter under a rule of more than 75 (a question drawn without the gutter has at most 80 characters, too few to hold such a rule, a header and a row that starts with │). 2.1.329 draws any question with a line break, or wider than 80 columns, behind that gutter, where no row is a rule, and a shorter one cannot wrap in a terminal wider than 80 columns, so no row of the question passes for the top rule; a form taller than the terminal hides its top rule and is not a menu. The rest of this entry is the first path. The session is the terminal's by process (the pane's own processes, or the foreground process of a herdr-core or Rex terminal), never by folder or by herdr's id; exactly one live process may claim it, and a pane's process list cut at its cap ties nothing. The call is the only one of the last assistant message without a result, an AskUserQuestion on a line of that session, no older than the process. Every option of one of its questions is on screen in order with its description, followed only by Claude Code's own entries and by no other row; that question's whole text sits between the dialog's first row and option 1; and the options on screen read as those of no other question of the call, by the same test that matches them, so two questions that split the same words differently between label and description are refused. So a form cut or scrolled at any height, a question whose text draws a rule (the rows under it are less than its text), a first question cut so that it draws a second one's tabs and text over the same options, a call a killed session left behind and another session in the same folder all match nothing: the approval then offers no choice and says it takes no keys. What the session waits on is kept in three states. While it waits on a question, a menu that does not draw it gets no decision either, so a question whose labels read Yes and No is not answered as a permission prompt. When it is known to wait on another call or on nothing, a question form offers nothing: a call that is no question does not make the menu that call's dialog, since a transcript written late can still name the call before the question. A decision under way compares the screen with the menu it claimed, so the note it types into Yes, which then reads as no approval, does not turn the prompt into a question. When it is not known (no session tied, a transcript missing, incomplete, still being written or holding a result above its call, several calls pending, a stale call), that is never read as "no question": a question form offers nothing, and permission prompts, the plan prompt, the rate limit form and forms without numbers read as before, so approvals do not depend on the transcript. The session id, the call's id and the question matched are hashed into the fingerprint, and a decision reads the transcript again before any key, so an approval never answers a later call that asks the same question. With Code Mode on, a script calls AskUserQuestion, and the transcript holds nothing of the question but the script's text. The script is the pending call where Claude Code asks before it runs a tool; in auto mode its call is answered at once with a receipt ((dispatched #N), that text whole) and it is running until a poll_events attachment under the receipt names script N. A receipt counts only as the result of a REPL call and an event only in that attachment or as the result of a Poll call, since any tool's output can hold either text. So the read looks for running scripts over its whole length and takes exactly one that names AskUserQuestion: two, or one beside a pending question, are refused, a script older than the process is dead, and once the script's event is written nothing is asked, the instant between the question's own record and its result included. Then the form is matched to the script's string literals, without parsing it. The question's text as drawn and every option's label and description must each be the whole content of a literal, so the rows left of a cut form, which are the end of a question and no literal of their own, match nothing; and when the script holds that end as a literal too, the form is refused because a longer literal ends in the text on screen. The suffix check needs every literal, so a script that may not have been read whole answers nothing: one with a quote left open at a line's end or at its own, as after a quote in a regular expression (comments are read as comments), a template with a substitution, or an escape that is not undone. A question or a label the script builds from pieces offers nothing, and the permission prompts of the script's other calls are decided as the screen reads them. A form refused this way is logged once, as a warning, with its terminal and one of fourteen reasons and none of its text. Tool: the tool call the approval card, the watch and the alert name (tool and the alert context) is read from the same screen read the fingerprint hashes, only from rows of the region (a dialog no rule tops names none), so the approver is never shown a call from another source; a question that a long file name wraps still names its call, its first row looked for no more than two rows above its last and never in the command block or above a blank row, where the agent writes; a Bash prompt's command block leads, so a long description the agent writes no longer pushes the command out of the card's three lines or the watch's 200 characters. Claude Code's permission hook is not used: its report carried no identity of its call, so an earlier harmless call's report could label a later dialog that showed its words (Bash: ls on a dialog whose Approve ran another command). Keys: collied re-reads before any key (same state_change_seq and fingerprint, else superseded). Arrows and Enter are separate calls; Enter goes only if the re-read after the arrows matches the target option's cursor fingerprint. Deny uses esc where the menu labels it (esc) and on the trust prompt, whatever the cursor. The only unnumbered menu answered is Claude Code's folder trust prompt, under the same checks, and only when each option is one aligned line mapping to its own decision under exactly one cursor on a whole dialog. Notes: a note takes the same path (nonce, fingerprint, cursor check, LocalAuthentication), only with Approve or Deny on a prompt showing "Tab to amend", and holds at most 200 characters (a longer one would wrap past what the parser reads back and never confirm). After tab, collied types the note only once the target option's label has turned into the amend wording (typed elsewhere, a note could act as digit shortcuts), and sends Enter only once the option reads Yes, <note> or No, <note>. Each re-read requires the same reason and the rest of the dialog unchanged, the rows under the last option included unless the note goes into that option; before each write the agent must still be blocked with the same state_change_seq and the peer authorized. Any mismatch stops as superseded, without Enter or esc (which would cancel the prompt). The note is never logged. Timing: no key after the 6 s budget; the outcome is applied only if the agent leaves blocked within 3 s, else unconfirmed, and neither the app nor the lock-screen follow-up claims success otherwise. Approvals expire after 10 minutes. Card swap: collied reissues an approval under a new id when its dialog changes or a new prompt follows, and the app draws the new card where the old one was. For half a second after an approval first shows on a terminal that had shown a card, its Approve, Deny, Always allow and option buttons are off and the app asks for no Face ID and sends nothing for it, so a tap aimed at the card before does not answer the new prompt. A terminal's first card is not held. |
| Residual | A Claude Code dialog drawn without ╌ rules (before 2.1.289) has Claude Code's own blank rows around the command, so a blank row there is neither shown nor bound. A question form is held to the session's transcript and to sessions/<pid>.json, files of the user: same-UID malware, or an agent the owner lets write under ~/.claude or run shell commands unasked, can write a pending call that a cut form matches, as it can draw a whole fake menu. Outside Code Mode a question form is answered on the screen's proof alone, read from Claude Code 2.1.329: a later version that drew a question of several lines without its gutter, or let a short one wrap in a wide terminal, would let a row of the question pass for the top rule again until the version check is revised; the check knows only that the version is 2.1.329 or later. It also rests on Claude Code not passing a terminal control sequence in a question's text through to the screen, as every read of a screen does. The transcript says only that a turn is open, which is also true just after a call's result is written, so it does not tie the form to a call, and nothing but the region binds the approval. The review page of several questions, a terminal of 75 columns or fewer, a one-row question in a terminal of 80 or fewer and an older Claude Code offer nothing there. That a session is not in Code Mode is read from records of 2.1.329 (permission-mode, with repl-mode beside it in Code Mode): a version that stopped writing repl-mode would leave only the REPL calls of the last 1 MiB to say so. Rows of an option's text that read as a menu are told by their place under an option row on screen. With that row and Claude Code's own entries off screen they are a menu, and the report decides what it is: under a report of a form it is a question, refused unless it draws the pending call or stands whole. On Rex and herdr-core that report is Claude Code's own and does not rest on the screen; on a herdr pane it is herdr's rule, which herdr reads from the screen, so a description worded until herdr rules the screen a permission prompt or the plan prompt would be read as one. A script's comments are lexed only as // and /* outside a literal and not after a backslash: a / inside a regular expression's character class before / or * reads as a comment's start, and the literals it then hides are not seen by the suffix check. An event in a Poll result counts only where it opens with a nonce the result's first line names, read up to the first word that is no nonce (2.1.329 puts a dash there): a first line without it would make words of its own read as nonces. A question form is told from a permission prompt and from the plan prompt by how Claude Code draws it, read from 2.1.289 to 2.1.329: a version that drew a question with its cursor set in and without Type something. or Chat about this would leave it to wording again, where an option reading as an approval, as an amend field or the plan's wording makes it another dialog when no pending question is known; with ordinary labels it would still offer nothing. The other way, a version that drew a permission prompt or the plan prompt with its cursor at column 0 would lose its answers from the phone in every state, and be answered in the terminal. In Code Mode the match is to quoted text in a script the model wrote, which is not parsed: it defends against a question taller than the terminal and against a transcript that does not ask what the screen shows, and not against a model that writes a decoy literal equal to the rows a cut form shows, in a comment or anywhere, which could as well ask the short question outright; nor, by the literal rule alone, against a script that builds a question from pieces when the rows a cut form shows are exactly one of those pieces ('Continue?' after a warning and a rule, on a terminal that shows only that row). What refuses that form today is the screen: under a rule the question draws, the dialog has no header row and its top is not on screen, and Claude Code 2.1.329 draws a question of several rows behind its gutter, where a rule row is no top. A version that drew such a question at column 0 again, with a script that also made a copy of the header a piece of its own, would be answered: that script is a decoy like the first. A dispatched script is found only in the last 1 MiB of the transcript and only by the name AskUserQuestion in its text: the question of a script that started further back is refused, and a second script that asks without that name in its text, or from further back, is not counted beside the one found, which matters only when its cut form matches the literals of the one found, a decoy again. A script counts as running until its event is written, so in the instant after an answer the transcript still says it runs; the form is then gone from the screen. The transcript is read with the screen before a key, not with the key: the last read and Enter are not atomic, so a form that replaces the matched one inside that gap, with the same option layout, gets the key, as below for every dialog. A decision under way, after its Tab, compares the menu as drawn with the menu it claimed and not the question rule again: the prompt whose Yes became the note is held to the same body and the same other options, not to the transcript. The first row of a matched form (the header or the tabs) is not compared, and a review page's answers are only on screen and in the region. A plan's text is drawn above the plan prompt's top rule, so it is outside the region and the fingerprint: a choice on that prompt is bound only to the prompt's own rows, and a plan that changes under an unchanged prompt does not supersede it. A menu none of whose options reads as an approval is chosen by index, whatever its labels say, in three cases only: as a question matched to its call, as the plan prompt told by its wording, and as a permission prompt left in its amend state. The workflow prompt is none of them: its Yes, run it reads as an approval, that label whole, so it is decided as a permission prompt and its View raw script is never pressed by index. A question that labels an option Yes, run it is still told by how it is drawn. Rows under the last option past a blank row are neither shown nor bound and only withhold approve_always there; where an earlier option's label ends and its detail begins is not bound, a row of ─ alone between two options is dropped as Claude Code's separator, and a form cut until no numbered row is left still says it takes keys. The gap between the last re-read and the final key remains until herdr offers conditional input: a question that replaces the dialog inside it, with the same option layout, gets that key. herdr-core's terminal.keys has no condition either, and the core holds a key until nobody has typed for about 3 s, collied's own note included. For a herdr-core agent collied therefore waits that hold out after typing a note, reads the dialog again and only then sends Enter, so the gap is the one herdr leaves; the decide budget grows by the 3.5 s wait for such a note, which never comes from the lock screen. A key held because someone types on the machine meanwhile still lands whenever they pause, after the last read and even after the decide budget ran out and collied reported the decision superseded or unconfirmed (Prompt injection into the terminal); a state_change_seq condition on terminal.keys, or a way to cancel a held call, would close it upstream. |
| Phase | Built; herdr conditional input: upstream proposal. |
| |
| Assets | The decision on a blocked agent |
| Attack | A paired phone (or a stolen, unlocked one) answers a permission prompt with Enter or y through agent.send_keys or agent.type_text, skipping the approval's nonce, expiry, fingerprint and LocalAuthentication. |
| Mitigations | Manual input checks agent identity (agent.list, agent.get) first and authorization again before the herdr write. Keys are listed keys or checked combinations, as above. Typed answers are capped at 32 KiB, reject unsafe control, bidi and invisible formatting characters (newlines and tabs allowed), and are bracketed-pasted with Enter in one ordered write. Every send is audited without its text. approval.decide actions and notes keep their nonce, fingerprint, expiry and LocalAuthentication checks. Shell panes require terminal authentication. While the agent is not blocked, ordinary Claude Code keys and prompts keep their guard for scrolled transcripts; the phone withholds Enter, with any modifiers, on a slash command it mirrored, and a slash command the user types in the Terminal view submits on Return. agent.answer_notice and agent.slash_draft are refused while the agent is blocked or scrolled up. The phone's paste gesture types nothing while the phone shows the agent waiting for an answer (an approval, the blocked status or an open Codex question): the clipboard is never shown first, and one of its characters could answer the dialog. For the same reason the Terminal view types neither an uploaded file's path (16 random hex characters, so nearly always a digit) nor the app's dictated text there: the file stays attached and the words join Chat's draft, where sending them is the owner's act. Nor does it type a saved prompt picked there, whose list can stay open while a dialog appears and whose new lines go as Return: the prompt joins Chat's draft too. Such text can wait in the phone's queue behind another send, so the phone checks again as it goes out: if it shows a dialog by then, what is left of the text joins Chat's draft, and only the keys the owner typed are sent. |
| Residual | By design, manual keys and text have no approval-specific restriction for Claude Code, Codex or Copilot: every displayed button (Codex's Shift+Left included) and key batches are allowed, with no prompt-rule check, automatic field selection or answer readback. With the paired session as the only gate, an unlocked paired phone can grant permissions, trust folders, accept plans or approve any displayed operation. Input is not tied to the prompt the phone showed: a changed prompt receives it, so the user must pick the intended control and check the live terminal. Until herdr offers conditional input, an agent that exits between collied's check and the write can leave a shell receiving it. A Copilot CLI dialog that opens between collied's screen read and the write, at the terminal or after the phone's own previous key, receives the input: Copilot's status does not change for a picker, so Herdr Core's and Rex's check of the status seen does not catch it. In Herdr Core, typing at the machine after the read holds the write up to 15 s, and a dialog opened in that time receives it. A picker the phone opens takes no further key from the phone and is closed in the terminal. Notice buttons have their own read/write gap: a newly drawn dialog can receive the digit. Off macOS Claude Code draws its replies behind ●, the glyph of its session rating, so a ● row leads a notice only with a survey's own wording ("How is Claude doing this session?" or "How was Claude's recollection?"). A reply that starts with that wording and ends in rows shaped like options (1: ..., 0: Dismiss) directly above an empty input box would still be offered as a notice, and a tap would type its digit, without Enter, into the box. No state was found where a finished reply sits directly above the box, since a turn-duration row comes between them, but this was not checked on Linux. Rating follow-ups or plugin bands can capture later input, and installed plugin actions run under the displayed label without separate LocalAuthentication. Notice answers wait up to one second for the input box to change; a slower fill can still replace a concurrently submitted prompt. Tip-feedback buttons send only their feedback; the disable-tips button fills a slash command that still needs an explicit send, under the ordinary slash-command safeguards. The paste, upload, dictation and saved prompt guards are the app's, not collied's: agent.send_text and agent.send_keys reach a blocked agent as before, since the keyboard answers that way, and the phone learns of a prompt from collied's pushes (about 4 Hz), so a dialog drawn since the last one still receives a paste, a path, dictated words or a saved prompt, new lines as Return. |
| Phase | Built |
| |
| Assets | The computer's disk; files an agent may read; attached files' contents |
| Attack | A paired (or stolen, unlocked) phone fills the disk; writes outside the attachments dir or over a file (crafted name, .., symlink); plants an executable or hidden dotfile; tampers with or hijacks another session's upload; gets file content into logs. |
| Mitigations | agent.prompt gate (paired full session), re-checked on every frame, before begin, each chunk and the commit. Caps: 20 MiB per file (phone, decoder, collied); 32 KiB chunks, in order, never past the declared size; 2 uploads in flight per session; idle uploads dropped after 60 s; 200 MiB stored (each file counted at least at its allocated blocks, plus in-flight reservations); 1000 entries under the root, so one-byte floods cannot use more disk than the byte cap suggests or make the per-begin scan unbounded; chunk frames 128/s per StableID, other frames the shared 20/s bucket. The file name is only a hint: AttachmentName rejects separators, ., .., controls, bidi and format characters; collied keeps [A-Za-z0-9._-], strips leading dots and dashes, caps the length. Each upload: a fresh random 0700 directory (create_dir) under a user-owned 0700 root that is not a symlink; the partial file opened create_new, O_NOFOLLOW, 0600, and renamed only within that directory (no overwrite, nothing executable) once its SHA-256 and size match; a mismatch deletes it. Upload id: 16 random bytes bound to the session and StableID that began it. Files expire after 24 h; a previous run's partials are removed at start. Audit: sanitized name, size, SHA-256 prefix; never content or base64. ChunkData is redacted in Debug. |
| Residual | Up to 200 MiB of phone-chosen bytes stay 24 h, and the path goes into a prompt: a file is as trusted as the phone that sent it, and an agent reading it may follow instructions inside (prompt injection, as with any repository content). Anything running as the user can read the files; at rest only FileVault (macOS) or the Linux machine's disk encryption protects them. The sanitized name is still the phone's choice, shown in the prompt and audit log. |
| Phase | Built |
| |
| Assets | Folder names under the task roots; the disk under the roots |
| Attack | A paired (or stolen, unlocked) phone lists or creates folders outside the roots (.., a symlink, a folder swapped for a symlink between check and use); reads file names, hidden entries or folder contents; sends a name that is a path or renders as something else (bidi, invisible or control characters); floods the disk with folders or collied with listings. |
| Mitigations | task.new gate: paired full session, per-peer token bucket, method allowlist with params that deny unknown fields, authorization re-checked before listing and right before creating, an audit line per request. The path is canonicalized, must lie under a root, and is opened per component from the root's descriptor with O_NOFOLLOW, so a swapped component fails. Below the root, folders starting with a dot or carrying macOS UF_HIDDEN are refused: nothing inside ~/.ssh, a .git folder or ~/Library. Listing reads that descriptor; creation is mkdirat on it (exactly one entry, no symlink followed at the name). FolderName, checked on the phone and in collied: one component of 1 to 255 bytes; no /, \, control, format or other invisible character (Hangul fillers, braille blank, variation selectors); no leading dot (so no ., .. or hidden folder); no surrounding whitespace. Creation: a new name, a path under 1024 bytes, only an empty user-owned 0755 folder (umask applies), its path checked to resolve under the roots to that folder, one op_id (a retry replays). Listing: at most 10,000 entries scanned and 500 valid names returned, of directories or symlinks to a directory under the roots, skipping UF_HIDDEN entries; contents and file names are never read or sent. Listed names never reach the audit or server log; the task.new audit target is <path> (created) or <cwd> new_folder="<name>". |
| Residual | Empty folders can pile up under the base as fast as the shared rate limit lets tasks start (one at a time per session). A folder stays if the agent then fails to start; the error names it. herdr opens the path by name after collied's check, as for any task.new, so a same-user process could swap it in between (Same-UID malware on the Mac). The phone sees folder names directly inside any visible folder under the roots (home by default), which it could already have an agent list. The base folder is a phone setting; collied re-checks every path against the roots. |
| Phase | Built |
| |
| Assets | The user's account on the computer; the disk under the task roots; git and SSH credentials |
| Attack | A paired (or stolen, unlocked) phone sends a clone source git reads as an option (-u, --upload-pack), a local path, another transport (file://, ext::, fd::) or credentials in a URL; a target that escapes the roots or overwrites a folder; relies on the user's insteadOf or protocol.<name>.allow config to reach a dangerous transport; or hangs collied on a credential prompt. |
| Mitigations | task.new gate with new_folder: paired full session, one task at a time, an op_id, authorization re-checked before creating the folder and before cloning, an audit line naming the source. CloneSource admits only owner/repo, https://host[:port]/path and git@host:path in a narrow ASCII alphabet: no leading - in any part, no userinfo, query or ..; owner/repo never reaches git as typed. Source and target follow -- for both git clone and gh repo clone. The target is a new empty folder made with mkdirat under the roots, so an existing one is refused before anything runs. The child gets null stdin, GIT_TERMINAL_PROMPT=0, GH_PROMPT_DISABLED=1, no inherited GIT_*, GH_TOKEN or GITHUB_TOKEN, and command-line config allowing only https and ssh (it outranks the user's config files and applies after URL rewriting); it runs in its own process group with a 75 s timeout and kill_on_drop. Submodules are not cloned. |
| Residual | Otherwise the user's git config applies: url.<base>.insteadOf may redirect to another HTTPS or SSH host the user configured; credential helpers, core.sshCommand and hooks from init.templateDir or core.hooksPath run as configured. A GUI credential helper or SSH askpass can prompt on the machine until the timeout. A timed-out clone leaves its partial folder; the error names it. The clone is untrusted content the agent then works in (prompt injection, as with any repository). |
| Phase | Built |
| |
| Assets | The user's account on the computer; the repository's branches; git and SSH credentials |
| Attack | A paired (or stolen, unlocked) phone sends a pull request number gh reads as something else, or picks a pull request whose head branch git reads as an option or revision expression, maps outside .worktree/, or comes from a fork whose project settings an agent would load; relies on an origin other than the pull request's repository to check out another commit; or makes the fetch hang or prompt. |
| Mitigations | Worktree task.new gate: paired full session, one task at a time, an op_id, authorization re-checked before gh, the fetch and herdr's worktree.create, an audit line with the number. The number is an integer from 1 to 2^32 - 1, checked at parse, passed to gh pr view as decimal digits; gh runs as for linked pull requests. Cross-repository pull requests are refused. The head branch must pass the typed branch rules (ASCII letters, digits, /._-; no .., leading - or trailing /) and git check-ref-format --branch; its checkout folder (the name with / as -) must be a FolderName not yet under .worktree/, and herdr's answer must name that path. The fetch takes only +refs/heads/<branch>:refs/remotes/origin/<branch> after --, no tags, submodules or FETCH_HEAD, in the clone's environment (HTTPS and SSH only, no prompts, no inherited GIT_*, own process group); the gh read, checks and fetch share one 75 s budget. origin/<branch> must then be exactly the head commit gh named. An existing local branch of that name is never moved and must be at that commit, or the task is refused; a missing one is created tracking origin/<branch>. |
| Residual | gh picks the repository from the checkout's remotes and the fetch always uses origin, so a checkout whose origin is a fork of the pull request's repository fails the commit check. The branch is the repository's own code, which the agent then works in (prompt injection, as with any repository). If herdr then fails, the new local branch stays; the error says so. The fetch runs before any agent starts, as the user and with the repository's own configuration: its core.sshCommand, its credential helpers and its reference-transaction hook (or the one under its core.hooksPath) run, and the clone's environment (no prompts, no inherited GIT_*, HTTPS and SSH only) overrides none of them. The tracking branch is then created with hooks off (Git reads in an agent's checkout), and the checkout that follows runs the repository's hooks and filters again: in herdr's own worktree.create, or in collied's git worktree add for Herdr Core and Rex (herdr-core). |
| Phase | Built |
| |
| Assets | The user's account on the computer; what the agent is asked to do |
| Attack | Anyone who can open an issue in the repository (on a public one, anyone) writes a title or body meant to steer the agent, or a title meant to break the phone's list; a paired phone names an issue number gh reads as something else. |
| Mitigations | task.issues is a Drive read of a folder under the roots, audited with the path and the count, with authorization checked again after gh, which runs as for linked pull requests with fixed arguments and --limit 50, without GH_REPO or collied's GIT_* variables (so the folder alone picks the repository), and is killed past 1 MiB on either stream. A failure answers a fixed message, never gh's own text, to the phone and the audit. Titles lose control and format characters and are cut at 200 characters; numbers outside 1 to 2^32 - 1 are dropped. collied never reads an issue's body, and logs and audits no title. Only the number reaches what acts: task.new checks it at parse as for a pull request, the branch is issue-<N>, and the prompt the app fills in is Work on GitHub issue #<N>., which the user sees and can edit before Start; picking another issue is off while dictation rewrites the prompt, so the prompt and the branch name the same issue. |
| Residual | The agent reads the issue with gh itself, so a hostile body reaches it as any repository content does (prompt injection). Titles show on the phone as text. |
| Phase | Built |
| |
| Assets | Agent transcripts; each session's first prompt line; the agent session the user resumes |
| Attack | A paired (or stolen, unlocked) phone lists sessions of a folder outside the roots; sends a session id that reaches a file path or the agent's command line (.., a separator, --fork-session, a leading -); resumes another folder's session, or one running in a pane so two agents write one transcript. Listed prompt lines reach logs, the audit log or a push. |
| Mitigations | task.new gate: paired full session, one task at a time, an op_id, authorization re-checked before the herdr writes; task.sessions and task.new resolve cwd under the roots. SessionId admits only 36 characters of 0-9a-f-, not starting with -, checked at parse and again by collied's is_session_id; collied builds the agent arguments itself, never from the phone. A resume needs the session's transcript in that folder; a session any herdr, Herdr Core or Rex agent reports, a Copilot CLI session any process holds (or whose folder collied cannot read) and an Antigravity CLI conversation whose presence lock is flocked or open in any of the user's processes named agy (or cannot be checked whole) are neither listed nor resumable. The Antigravity CLI's history.jsonl is read only for each entry's conversationId and workspace, at most its last 1 MiB, opened as transcripts are; its prompt text is never kept. Transcripts are read as for summaries (O_NOFOLLOW, O_NONBLOCK, regular files only), bounded in count and bytes; a .jsonl.zst Codex rollout is decoded only to its 256 KiB head, with an 8 MiB decoder window. Prompt lines: at most 160 characters, controls, bidi and format characters dropped, only to the paired phone, as plain text, never logged, audited or pushed. Audit: the folder and count, or the session id for a resume. |
| Residual | First prompt lines can carry secrets the user typed, like the summary's last_prompt. A Claude Code or Codex session open outside herdr, Herdr Core and Rex (a plain terminal, the Codex app) goes undetected, so two processes may append to it, as may an Antigravity CLI one run under another process name. An Antigravity CLI conversation's folder is the one its prompt history names, a file any same-user process can write, as it can a transcript. Claude Code's project folder name is lossy (/a/b-c and /a/b/c share one), so such folders list each other's Claude sessions. Codex sessions started through a symlinked path other than the canonical folder are not listed. |
| Phase | Built |
| |
| Assets | A task's checkout and uncommitted files; merged branches and worktrees in its repository |
| Attack | A paired phone archives another task or removes files outside the configured task roots. A replay repeats cleanup. |
| Mitigations | task.archive requires confirmation, a paired full session and an op_id (one cached outcome). collied finds the terminal and its workspace in a fresh herdr snapshot, checks the linked checkout and repository against the task roots, verifies that herdr associates that checkout with the workspace, and re-checks authorization before worktree.remove. For a regular folder it closes only the pane. For a herdr-core agent, only the checkout collied recorded on a worktree task's terminal when it created or opened it (collie.worktree) is removed (any other task's terminal in it, such as a Resume there, refuses the archive), and only when git (read with collied's untrusted-repository settings) lists it as an unlocked linked worktree of a repository inside the roots, no core terminal without the task label (shells included), no block of a followed Rex (read afresh) and no herdr pane has its start or foreground folder in it (symlinks resolved), and herdr has it open in no workspace; a herdr that runs but does not answer, a core collied no longer follows, or a followed Rex that does not list its blocks refuses the archive, closing nothing, and the error names which. A herdr-core worktree start's one-task-per-checkout check reads the same terminals and Rex blocks. Any other herdr-core agent is only closed, its folder kept. For a Rex task, only the checkout recorded for its block in rex-tasks.json is removed, under the same checks, with a followed core's terminals counting as well. The archive refuses while any terminal other than the archived task's works in the checkout, then ends only that task's terminal, re-checking authorization before the close and before git worktree remove --force, which runs in the clone's environment, and reading the core's terminals again just before the removal. It runs gh poi from a repository inside the roots, without GH_TOKEN, GITHUB_TOKEN or the enterprise token variables, and reports cleanup failures apart from the close or removal. |
| Residual | Archive deliberately forces removal of a linked worktree, uncommitted changes included. gh poi may remove other merged branches and worktrees in the repository, even when archiving from a regular folder. Repository paths can change between the checks and the subprocess under the same user account. For a herdr-core task, a terminal that starts or moves into the checkout between collied's check and the removal is not seen, the same window herdr's own removal leaves. Only herdr and herdr-core terminals are checked: a window in another app (Terminal.app, an IDE, tmux), or a pane in another herdr session or another HC_SESSION core, working in the checkout is not seen, and its files go with the checkout. |
| Phase | Built |
| |
| Assets | Files under the task roots: source, secrets in dotfiles, keys, documents |
| Attack | A paired (or stolen, unlocked) phone reads files outside the roots (absolute path, .., a symlink swapped in between check and open); secrets in hidden files or folders (.env, ~/.ssh, .git, ~/Library; for an agent checkout inside one, see Residual); a FIFO or device that blocks or never ends; a file large enough to tie up collied or the link; another session's open file. Content leaks into the audit log, service log, a cache or a push. A file crafted against the phone that previews it: a PDF whose link annotation, invisible and as large as the page, opens an address of any scheme on a tap; an image small in bytes and huge in pixels, which takes the app's memory when drawn. |
| Mitigations | file.open (revision 29, Read class) needs a paired full session, the per-peer token bucket and the agent named by terminal_id, whose checkout must resolve under the roots; authorization is re-checked after the open. The path is resolved lexically against that checkout, .. refused, and must lie under a root. It is opened per component from the root's descriptor with O_NOFOLLOW, refusing any folder or file starting with a dot or carrying macOS UF_HIDDEN, and the file itself with O_NOFOLLOW and O_NONBLOCK, so a symlink anywhere on the path fails. Only folders of the agent's own checkout path (already accepted by resolve_cwd) may be hidden, and only for a file below that checkout: a worktree under <repo>/.worktree works, .env or .git below it stays refused. Git changes reads untracked files itself and holds them to the same rule: one whose path below the checkout has a component starting with a dot or carrying UF_HIDDEN is listed by name only, with no line count or digest, and agent.diff refuses it ("Hidden files are not shown"). Regular files only, never directory listings. fstat caps apply before any content is sent: 20 MiB before reading, then 1 MiB for text once the first 8 KiB tell text apart. The SHA-256 and the 32 KiB chunks come from the same open descriptor, chunks on the chunk bucket (128/s); a file that shrinks fails the read, one that changes fails the phone's checksum. Download id: 16 random bytes bound to the session and StableID that opened it; at most 2 per session; closed by the phone, at session end or after 60 s idle. Audit: the terminal id and requested path; chunks and content are never audited, logged, written to disk on the machine or pushed. On the phone, the preview opens no link inside a PDF: its PDFView delegate takes every link click and does nothing with it, where PDFKit alone would hand the address to the system. It asks ImageIO for an image at the screen's pixel size instead of decoding it whole: for a one-color PNG of 20000 x 20000 pixels (1.6 MB), measured in the simulator, that took 149 MB at its peak, against 1.5 GB held for the whole image. An interlaced PNG is still decoded whole for its thumbnail, about 4 bytes a pixel (1.6 GB for the same size, 434 MB for 10000 x 10000), so the preview reads the pixel size from the header first and does not decode an image over 100 megapixels. Other formats were not measured; the same limit holds them to that many pixels. |
| Residual | Anything the user can read under the roots outside hidden folders can reach the paired phone, secrets in ordinary files included. An agent whose checkout is, or lies inside, a hidden folder exposes the regular files below that checkout, except hidden files and anything in a hidden folder below it: an agent in ~/.ssh lets the phone open id_ed25519, one under ~/Library the files below it. That includes an agent the phone starts there with task.new, whose cwd goes through resolve_cwd, which has no hidden check. The same phone could already ask that agent to print those files. Git changes still shows a hidden file git tracks: its staged, unstaged, branch and pull request diffs come from git or GitHub, so an .env that is committed, or that an agent stages, reaches the phone, as does the name of an untracked one. The phone keeps the file in memory and a temporary copy (Data Protection complete) until the preview closes, or until the next launch when the app is killed with the preview open; Share and Copy can send it further. |
| Phase | Built |
| |
| Assets | The machine; the user's SSH keys and git credentials |
| Attack | A repository the agent works in, or the agent itself, configures programs that collied's git reads (Git changes, archive and pull request branch checks) would run: an fsmonitor, an external diff, a textconv or clean filter, or, in a partial clone, a lazy fetch that runs remote.<name>.uploadpack, core.sshCommand or a credential helper. A filter can hide in a driver name holding = or in a submodule's own config, and a folder shaped like a bare repository, which a checkout can track as ordinary files, would make git read config the repository's content supplies. |
| Mitigations | One git command builder: null stdin, no inherited GIT_* variables, no prompts, an empty core.fsmonitor= (git before 2.36 runs any other value as the hook, false included), diff.external=, safe.bareRepository=explicit, hooks disabled with core.hooksPath=/dev/null (the one write through this builder is the branch git branch --track creates for a pull request worktree task), --no-ext-diff, --no-textconv, and for diff and status every filter command the listing finds blanked: those the checkout's config lists and those each populated submodule's config lists, nested ones included, read with GIT_DIR=.git as git's own git status in that submodule reads them. The blanks go in --config-env, not -c, which splits a name at its first = (a driver named a.clean=<command> would set filter.a.clean); a submodule collied cannot read, or more than 100, refuses the read. A herdr-core or Rex worktree task's reads of its folder name a bare repository with --git-dir only when no .git lies at or above it, or when the nearest one is a file naming that folder (repo/.git holding gitdir: ./.bare), which a checkout cannot supply: git tracks no path named .git. GIT_NO_LAZY_FETCH=1; for git without that variable, an empty GIT_ALLOW_PROTOCOL refuses every transport whatever the repository's protocol.*.allow says, and a blank fetch.bundleURI makes a missing object fail the read instead of being fetched. |
| Residual | Other git config still applies to these reads. Configuration written between collied's listing and the read that follows (a submodule populated in between, a new driver, a changed include) is not covered, as was already true of the checkout's own config. collied does not check the git version: git before 2.31 refuses --config-env, so a read fails wherever a config git reads there, the user's own included, defines a filter, and git before 2.38 ignores safe.bareRepository. The agent itself runs with the user's privileges, so this only keeps collied from running the repository's programs on its own, and only in these reads: a worktree task's fetch and git worktree add run the repository's hooks, filters and transport configuration (Task on a pull request's branch, herdr-core). |
| Phase | Built |
| |
| Assets | The user's gh login; the repository and branch of each agent's checkout |
| Attack | A crafted checkout or GitHub response makes collied run gh somewhere it should not or with a token it should not use, or makes the phone open a hostile link. |
| Mitigations | collied runs gh pr view only while a phone is connected or a paired phone has "Archive when the PR merges" on (then only for agents it could archive), only in checkouts that resolve inside the task roots: no argument from the checkout, a fixed binary path, GH_PROMPT_DISABLED=1, no GH_TOKEN, GITHUB_TOKEN or enterprise token variables, no GH_REPO or inherited GIT_* variables, at most 1 MiB read of each stream, null stdin, a 30 s timeout, kill_on_drop. Only these reach the phone: number, state, check outcome, an https:// URL without whitespace or control characters, up to 10 failing check names (no control or format characters or quotes, 100 characters each), review and comment counts (counted inside gh by --jq, so no text reaches collied) and whether it conflicts. The phone opens only https links. Prompts the badge menu fills hold only the URL and those check names, and are sent only when the user taps Send. Nothing from gh is logged. |
| Residual | gh reads the checkout's git config and remotes, as gh poi does. A repository whose remote points at another GitHub repository shows that repository's pull request. |
| Phase | Built |
| |
| Assets | The machine; the user's gh login; repositories under the task roots |
| Attack | A worktree entry the agent writes points collied's git reads at another repository; GitHub's answer (file names, sizes, branch names, titles, patches) carries paths that escape the checkout, control characters, or sizes meant to exhaust collied or the phone; the phone names a pull request or file to make gh run something else. |
| Mitigations | Revision 30 reads, Read class, paired full session, the agent's checkout under the roots, authorization re-checked after the read. A worktree is summarized only after the same checks as picking it (resolves to itself under the roots, same Git common directory); summaries use the git command builder above, with --no-show-signature for the commit subject. gh runs in the agent's checkout from a fixed path in the linked pull request read's environment, with one 30 s deadline per pull request read. Only a number (1 to 2^32 - 1, checked at parse) and fixed arguments reach its command line; the file a diff asks for reaches gh's fixed --jq program only as an environment variable, compared as a string. File paths must be plain relative UTF-8 paths, else the file is left out; status maps to a fixed letter; counts over 2^32 - 1 are unknown; branch names with control or format characters, non-https:// URLs and forks are dropped; titles, subjects and branch names shown are stripped of control and format characters and cut at 200 characters. Listings stay at 200 files, gh output over 2 MiB is refused, and answers are cut to the 48 KiB response cap. Feedback on a pull request's files is sent only while the agent's checkout is still the one they were read in, so it cannot name a pull request of another repository. Feedback names its file, and a worktree other than the agent's checkout, as JSON strings: Git stores a file or folder name holding a new line and collied passes it on, and unquoted it would start a line of its own in the owner's message to the agent. Nothing from GitHub is logged. |
| Residual | Patch text from GitHub reaches the phone as it is, like a local diff; it is shown as text, never run. The user's open pull requests in that repository, with titles, are listed whether or not an agent works on them. |
| Phase | Built |
| |
| Assets | The agent's input; the user's gh login |
| Attack | Someone who can comment on, review or run checks on a watched pull request uses the wake to steer the agent, or a crafted answer makes collied type something else into the agent. |
| Mitigations | A watch starts only on an audited paired-phone request, for a Claude Code agent's linked open pull request with a GitHub-shaped URL, at an interval from a fixed list, with gh signed in. The GraphQL query asks for no comment or review body. The prompt holds only the pull request number and URL, check names (controls, format characters and quotes stripped, cut at 100 characters) and https:// comment and review URLs; as a PromptText, it carries no control character into the paste. It goes through Driver::prompt without expected_draft, only to an idle or done agent still on the watched branch, never over text in the input box, which is never cleared. Right before the write, collied checks that the watch still exists and its phone is still paired; revoking that phone ends its watches. Each wake is audited. A watch stops after 10 comment-only wakes or 8 failed reads in a row. |
| Residual | The woken agent may open a review or comment URL and read its untrusted text, as it would if the user asked it to. |
| Phase | Built |
| |
| Assets | The user's agents, folders and repositories on the machine; the scheduled prompt |
| Attack | collied starts an agent with a stored prompt while no phone acts: a tampered store, a revoked phone's task, or text from a screen, transcript or the network ends up typed into an agent; or the prompt leaks through the store, the audit log or an alert. |
| Mitigations | A task is stored only on an audited task.schedule from a paired phone, after the checks task.new makes before creating anything, for at most 24 hours ahead and at most 10 tasks per machine. The stored prompt is the PromptText the phone sent, unchanged; nothing from a screen, transcript or the network is added. The store is a private (0600) file in the data folder, read only when owned by the user with no group or world bits, at most 1 MiB. The start runs task.new's own checks and path again, with an authorization that holds only while the scheduling phone is paired, checked before each write; revoking that phone, online or offline, removes its tasks before they start. A resent request answers its stored task instead of adding another. Tasks are claimed one at a time and saved as starting before each start, so a task starts at most once: one still starting after a restart is reported, never started again, and one more than an hour late when its turn comes is dropped. After a start that stops at a startup prompt, collied removes the prompt from the store. The audit log records each schedule, cancel, start and drop without the prompt; the start's runtime errors reach the debug log without their text, which can quote the prompt; and alerts name only the folder and a fixed reason. |
| Residual | Unlike the pull request watch, which types into an agent the phone already started, this creates folders, worktrees and agents with no phone present at the time; a user who schedules a task and forgets it gets it anyway, within the 24 hours. Same-UID malware can write the store, as it can type into herdr. The prompt waits in plain text in the data folder until the start, like a draft in the Mac's input box. |
| Phase | Built |
| |
| Assets | A worktree task's checkout and its uncommitted or unpushed work; the agents and panes in its workspace; the repository's other worktrees and branches |
| Attack | A merge, a crafted gh answer or a race makes collied remove a checkout that still holds work, a regular folder, or a workspace where an agent, its subagents or the user are still busy, or reach other tasks' worktrees; or a revoked or forgotten phone keeps the automation on. |
| Mitigations | Off by default; on only while a phone that turned it on (task.archive_on_merge, audited, kept by StableID, dropped on revoke or unpair) is still paired, checked again right before removal. Any phone turning it off clears it for all; a phone where the user never set it sends nothing. Only a fresh read finds the merge, and gh pr view is read once more before archiving. Only a linked worktree is archived (a regular folder is refused, never just closed), and only when every pane in a fresh herdr snapshot is an idle or done agent with no running subagent (an incomplete subagent scan counts as running). The checkout needs no uncommitted or untracked file, no dirty submodule or submodule off its recorded commit (--ignore-submodules=none overrides .gitmodules), no assume-unchanged or skip-worktree entry in it or a submodule (git status hides their edits), and a HEAD that is an ancestor of the merged pull request's head commit (a hex id only, so nothing from gh reaches git as an option). The checkout herdr removes must be the one whose pull request was read, and these checks run on it again right before worktree.remove. gh poi never runs automatically, so no other branch or worktree is touched. Each archive is audited and sends one alert, which mute_done silences. |
| Residual | worktree.remove still forces, so it loses a file written between the last check and the removal (milliseconds), anything git ignores and commits a submodule holds on another branch. An agent that starts working in that window is closed. A sparse checkout (skip-worktree entries) is never archived automatically. If gh answers for a repository other than the checkout's (a remote pointing elsewhere), that pull request can archive only a checkout whose HEAD is already in its history. |
| Phase | Built |
| |
| Assets | Every shell herdr runs, and since #755 every shell a followed Rex runs on this host, which is the user's account on the computer |
| Attack | 1. A paired session without the user (an app bug, an instrumented app, a stolen unlocked phone) types commands into a shell. 2. A grant is replayed to another session, terminal or machine. 3. The phone turns the feature on. 4. Commands leak through logs. 5. Input lands in a pane where an agent now runs, answering its permission prompt outside approvals. 6. A compromised app registers a key that signs without Face ID. |
| Mitigations | Off by default; only collied.toml, read at start, turns it on, and no method changes it. While off, the snapshot lists no shells, and every terminal.* request but terminal.lock is refused with terminals_disabled before herdr is called, and audited. pane.read reads agent panes only, whatever the setting. Terminal methods: their own allowlist class, params denying unknown fields, one line of PromptText (no newline, tab, ESC or other control), Key (listed keys and checked combinations, never Control with d, z, r, j, m, o, t, 4 or \, and [ only with Control), and TypedText keystrokes for terminal.send_text (no C0 or C1 control at all, so no escape sequence or Enter; Enter and Tab go as keys). Grant: a 32-byte challenge bound to session and terminal, valid 60 s, burned by any attempt; after Face ID or the passcode (a fresh LAContext each time), the phone's Secure Enclave terminal key signs the domain-separated machine node ID (from its pinned machine record), terminal ID and challenge, checked against the key recorded at the confirmed pairing. The grant lasts 5 min, for that terminal in that session, bound to the verifying key, and is dropped on terminal.lock (sent when the app goes to the background; any other answer closes the session), at session end, on revoke, unpair or re-pairing, and once collied sees an agent on the terminal. terminal.watch reads nothing while its session holds no grant for the terminal under the current key, so output stops with the grant. The phone stops showing it too: when a grant ends there (the lock, its 5 min, a new session or a terminal_locked answer), the session screen drops the shell's text and blanks its terminal under Unlock, and collie-core keeps and serves a shell's screen only under a live grant: it drops its copy on the lock, on a new session, on a terminal_locked answer and at the first read after the 5 min, takes no shell output that arrives without a grant, and starts empty when the same terminal is watched as an agent, so neither a screen collied sent just before the lock nor a session screen opened afterwards shows it. Before every write collied re-checks a fresh snapshot (no agent on the pane, launching ones included), the peer, the sending session's grant (a retry from the next session replays and finds none) and that no approval is pending there (hook-driven approvals know of an agent before herdr detects it). Pairing refuses a terminal key that is not P-256 or is the session's TLS key; the machine's y/N prompt says whether a key is added or replaced, and whether a pairing is replaced. Audit: grants, keys by name (space-separated; since keys include letters, digits and punctuation, a terminal.send_keys line can show up to 16 typed characters), runs and typed keystrokes with terminal and result, never their text; a herdr error from these writes keeps only its code. No push, alert or Live Activity carries terminal text; notification actions and the Live Activity intent never send terminal.*; the terminal key cannot sign while the phone is locked. Program-set shell titles never leave the machine. |
| Residual | The passcode plus the unlocked phone gives 5 min of shell input per grant; within a grant, the session is the only gate, as for prompts. The gate assumes the app was genuine at pairing: an app instrumented then can register a key that signs without Face ID (App Attest is out of scope), and only a pairing confirmed on the machine can swap the key later. Against a compromised app the grant adds nothing overall: approvals ask for Face ID on the phone only, and an agent the phone prompts can run any command, edit collied.toml and restart collied. The opt-in guards the plain-shell path and keeps it off by default; it is no boundary against a phone that drives agents. Agents herdr does not detect (inside ssh or tmux, or with an unknown name) count as shells, as do programs in a Rex shell that neither report OSC 7501 nor run as an agent CLI. An agent starting between collied's check and the write gets the line as a prompt (until herdr has conditional input; in Rex, from the agent's exec until Rex reports it, then one round trip), and since herdr reuses pane ids, a pane closed and recreated in that millisecond window gets the write (Rex never reuses a block id, and stops a call between events once the block is no longer a terminal). Text left on the machine's shell command line joins the phone's line; the phone shows the screen first. The audit log shows that a command ran, not which; the shell's history may show it. Granted output can carry secrets to the phone, as the agent screen does. Once an agent starts in a pane, the shell's scrollback is not confidential: agent.read and agent.watch (any paired session, no grant) read the pane's recent lines, earlier shell commands and output included. A phone paired without a terminal key must pair again to use terminals. |
| Phase | Built |
| |
| Assets | Agent transcripts; the context left, latest reply line and latest prompt derived from them |
| Attack | collied reads files holding whole conversations. A crafted session id from herdr (or a same-UID process reporting one) reaches another file through .. or a separator; a symlink or FIFO in a transcript's place makes collied read another file or hang; derived text reaches logs, the audit log, push.json, a push or an approval; a hostile transcript line (echoed prompt injection, or a same-UID writer) is taken as an instruction. |
| Mitigations | Summaries exist only for a live herdr agent of kind claude or codex whose agent_session is a lowercase UUID (36 characters of 0-9a-f-): the only path part from herdr, beside the working directory mapped to [A-Za-z0-9-]. Every reader in this section opens regular files only, with O_NOFOLLOW and O_NONBLOCK. Summaries read the last 1 MiB, only after a size or mtime change (cached per session id while herdr reports it), for flock.snapshot and for the 1 s reconcile while a paired phone has a session open; collied status reads no transcript. They leave as optional Agent fields (context_left, last_line, last_prompt, last_activity_ms: a percentage, two single lines with controls, bidi and format characters dropped and at most 160 characters, and the file's mtime), only to paired phones in the whois-gated, mutual-TLS session. They are never logged, audited, written to disk by collied, pushed (alerts and Live Activities come from herdr's agent record, not Agent) or used by approvals. The phone shows them as plain text (no Markdown, no links) and acts on none. |
| Residual | Derived lines can carry secrets an agent printed or the user typed (a token pasted into a prompt) to the phone's memory and screen, as the terminal view already does. A same-UID process can write a transcript showing false text, a false context level or a fresh activity time; the inbox and ring are display only. Claude Code's transcript has no context window, so without the status line tap collied infers it from the model name: a session held to 200K (CLAUDE_CODE_DISABLE_1M_CONTEXT, a plan without 1M) shows more context left than it has, and an Opus 4.6 or Sonnet 4 session on the 1M window shows less until it passes 200K. |
| Phase | Built |
The other transcript readers:
- Claude Code subagents (
Agent.subagents): the session's subagents/agent-<id>.jsonl and subagents/workflows/<workflow>/agent-<id>.jsonl with their .meta.json, only through real directories under the session's directory, for ids of letters and digits and workflow names of letters, digits, _ and -. They count only while a Claude Code process of the session lives (its sessions/<pid>.json, at most 64 KiB, names a pid that matches the file name and answers kill(pid, 0)) and only if written since it started; if Claude Code dies without removing that file and its pid is reused, later-written subagents stay listed until they finish. Only while a phone is connected, at most 8 changed files are read per refresh, at most 512 KiB of new data each (else the last 64 KiB), skipping lines over 64 KiB unheld. Type, title and activity are cleaned like summary lines and capped at 64, 120 and 120 characters; without a call description, an activity line can carry a file name, search pattern, URL or a Bash command's first line, text Chat already shows.
- Token cost (
usage.costs, revision 28): every Claude Code, Codex and Copilot CLI transcript modified in the last 32 days under the agents' transcript roots, through real directories only (no symlink followed, names starting with . skipped, at most 5 levels and 20,000 recent files per root), in 1 MiB reads, skipping lines over 8 MiB. A .jsonl.zst Codex rollout is decoded with an 8 MiB window, refused past 512 MiB of output and retried only after it changes. usage-costs.json (0600, data dir) keeps only each transcript's path, token counts, model ids (at most 64 characters of [A-Za-z0-9._:/\[\]-], else unknown), 15-minute slots and hashes of Claude message and request ids; no message text is kept, logged, audited or pushed. The paired phone gets only numbers, model ids, agent names and dates; its request carries its UTC offset, which tells the machine its time zone. Scans run on their own thread, at most every 15 s, on a paired phone's request, so a crafted large transcript costs CPU and disk reads but never delays other requests. A same-UID writer can inflate or hide the counts, as it can rewrite transcripts; the card is display only.
- Pending question (approvals): for a blocked Claude Code agent whose screen reads as a menu, collied reads the last 1 MiB of the transcript of the session its terminal's process claims, under the checks above (a regular file of the user,
O_NOFOLLOW, O_NONBLOCK, a lowercase UUID as the only path part from a session file), each time it reads that screen: about once a second while the approval is pending, and before a decision's keys. It keeps the questions of the one pending AskUserQuestion call only to compare them with the screen and to hash the one matched into the approval's fingerprint. Nothing read there is shown, sent, logged or stored: an approval's text still comes from the screen. The session is found by process as the live session below is, but never from herdr's id, a hand-off or an attach target, and only when exactly one live process claims it.
- Live Claude Code session: herdr's session id is cross-checked against the pane's own processes (pids from herdr's
pane.process_info). collied keeps only their pids and a claude attach target (a job id or session name), never the rest of argv or cmdline, which can hold secrets. A sessions/<pid>.json counts only when it is the user's, its pid matches its name, kill(pid, 0) succeeds, the process's kernel start time is no later than the file's startedAt plus 2 s (so a file left by a since-reused pid fails) and its cwd is the pane's; disagreeing files keep herdr's id. Hand-offs are followed only from the session's own transcript to one in the same project directory, at most 4 hops, never around a loop. A background /resume needs exactly one live, checked kind: bg process of that job and directory; a claude attach target, exactly one whose job id starts with the target or whose name is the target, and a named session must also be the pane's title. A same-UID process could still write a matching file for a live process it does not own, as it can already write transcripts. Ids stay lowercase UUIDs before becoming paths; the mismatch log line carries ids only.
- Live Copilot conversation: subagents and Chat use the conversation collied selects for the pane, never herdr's possibly stale ID, since
/new can leave one process holding several conversations. A candidate needs a held inuse.<pid>.hold lock with matching PID-file contents, a live foreground pane PID whose kernel start is no later than that marker (2 s slack), matching workspace, header and directory IDs, and a unique match of native workspace name or title and cwd; names alone, a global newest timestamp and the model never establish identity. Its session-state/<uuid>/events.jsonl (under COPILOT_HOME or ~/.copilot) must start with a matching session.start, and subagent starts older than the lock are ignored. Per selection: at most 1 MiB of workspace and header reads (64 KiB per file or header), 10,000 directory entries, 16 PID-marker checks per directory and 256 held candidates, in real directories only. Only markerless directories are cached as negative, keyed by device, inode, mtime, ctime and the exact live PID and start-time set; released markers are still probed, and names, identity and positive claims are rechecked on every selection. Missing or ambiguous identity keeps the archive guard busy and Copilot Chat unavailable, and hidden held conversations are checked for running work before the pane closes. Copilot context and reply summaries stay unavailable. The resolver never logs workspace names, cwd, header content or unrelated conversation content.
- Herdr Core and Rex Copilot CLI and Antigravity CLI sessions (#744, ADR-0014): no title or pane process list exists there, so the session is the one the terminal's foreground process holds: for Copilot CLI exactly one held
inuse.<pid>.hold with the checks above, none after /new, an unreadable folder or a listing past its cap; for the Antigravity CLI the presence/<id>.lock files that process has open (device and inode from proc_pidinfo or /proc, at most 4,096 entries, UUID names only) against the hook's pid-checked report, binding nothing when they disagree or when either listing cannot finish (an error, or a cap reached). Files are read on the reconcile tick outside the runtime's lock, and a binding holds only while the same pid leads the terminal, so a pid reused by another process gets nothing. A same-user process could hold or open such files to steer a binding, as it can already write transcripts.
- Codex subagents need held parent and child writer locks, and the child's first rollout metadata must name the child and its exact parent through
source.subagent.thread_spawn; later metadata in inherited history cannot reattribute it. Records before subagent_history_start_ordinal do not affect lifecycle, and inherited history without that boundary is not reported. Finished and interrupted turns disappear. The kernel releases locks even after an unclean exit, so stale lock files prove nothing, and a lock with no rollout or previously verified parent association is no evidence of a child: the shared Codex daemon holds such locks for threads that never received input. A probe takes a non-blocking shared lock on an existing file opened read-only and releases it at once if it gets it; probes never create or rewrite provider files or take an exclusive writer lock. They hold Codex's .coordination.lock shared only while listing and probing writer locks, and defer when a writer owns it, so they cannot race Codex's non-blocking writer-lock acquisition; it is released before rollouts are read. Same-UID writers can still forge metadata or hold locks to show false status, which authorizes nothing.
- Copilot, Codex and Antigravity CLI subagent bounds: real session, brain and dated directories, UUID-only path components, child types, titles and activity cleaned and capped as for Claude Code subagents. Caps: 256 listed lock, descriptor or session-directory entries; 8 changed Codex rollouts or Antigravity child transcripts per refresh, 512 KiB read from each; 16 MiB of Copilot's
events.jsonl per refresh; 64 KiB per record or Antigravity descriptor; 10,000 names per candidate date directory for a new Codex child lookup; 256 cached identities per parent while a registry is incomplete. Antigravity descriptors must live under <session>/.system_generated/subagents/<child>.json with a matching conversationId and state: "SUBAGENT_STATE_ALIVE" before the child's transcript.jsonl is read; killed descriptors are skipped. Child state stays in memory, and a file's results are withheld until the reader catches up, so an unread completion cannot resurrect a child. Metadata caches key on file identity as well as size and mtime, and go when herdr drops the parent. Automatic archiving fails closed: once a rollout establishes the parent, a missing or unreadable file, damaged metadata or a changed parent claim blocks it until trustworthy data returns or the child lock is released (a known foreign file that disappears does not), and so do a first header not yet decodable, an unreadable or catching-up alive Antigravity child, lookup bounds, and registry or probe errors, which count as unknown, not released, and keep cached ownership. The file-only reader cannot identify a wholly unrecorded child, including when Codex warns about failed persistence and continues; no age-based inference, SQLite query or live-daemon mutation fills that gap.
- Chat pages travel over the same authenticated session: at most 2 MiB read per request on a blocking worker, the live agent identity re-checked before replying, cursors bound to session and file; a missing transcript is unavailable, not empty. For Copilot CLI, the file's first
session.start must name the selected conversation, and the selection is repeated from the current title and pane processes before replying, so a /new during the read cannot return the previous conversation. Subagent records appear only under the call that started them, and not at all when that call is outside the read window. The phone renders Markdown and tool text for display only, with no automatic tool execution or remote image fetching; the user can follow a rendered HTTP or HTTPS link with a host and no user or password (https://github.com@evil.example/ opens evil.example), and file URLs and custom schemes are discarded. A link whose visible text is not its address itself, such as [github.com/login](https://github.com.evil.example/login), opens only after a confirmation that shows its host, punycode for a non-ASCII one; the user still has to read that host. Tool content stays plain text behind an explicit disclosure. With Chat as the default view, visible grid cards request only the last two user and two agent text messages (latest, revision 27) under the same reads and caps, and render them as inline Markdown that takes no touches, so their links cannot be followed. The confidentiality and same-UID tampering residuals above apply to Chat too.
Subagent fields, Chat content and search queries go only to the paired phone and never reach logs, the audit log, push storage, notifications or approvals.
| |
| Assets | The plan's usage and reset times; the usage.json collied reads |
| Attack | The status line input holds the working directory, transcript path, session name, costs and PR links, which could reach disk, logs or the phone. A same-UID process feeds the tap or writes usage.json to show false usage, make collied read another file (symlink, FIFO, a huge file) or plant a session id that becomes a path. Two sessions writing at once corrupt the file. |
| Mitigations | collied statusline keeps only the two windows' percentages and reset times and, per lowercase-UUID session id (at most 64), a window size of 1K to 100M and the two windows that session last reported; it writes nothing else from the input, and prints and logs nothing. The data dir must be user-owned 0700; usage.json is written 0600 through an O_EXCL temporary file and rename under an exclusive lock, and read only through peers::load_json (0600, owned, regular file). The daemon opens it with O_NOFOLLOW and O_NONBLOCK, requires a regular file of at most 64 KiB, and rereads it only after a size or mtime change; its session ids are map keys, never paths. The phone gets the usage (Flock.plan_usage, the plan.usage event and the approval.list reply's plan_usage: two percentages, two reset times and when they were recorded, never a session's own windows) only in the whois-gated, mutual-TLS session; it is never logged, audited, pushed, put in a Live Activity or used by approvals. The paired Apple Watch gets only the two percentages (capped at 100), their reset times and when they were recorded, over WatchConnectivity, for the complication and widgets. |
| Residual | A same-UID process can write false usage or a false window size; both are display only (the ring and the usage line), and the phone compares a future recorded_ms without overflowing. Claude Code's input names no account, so two subscriptions on one machine (a second CLAUDE_CONFIG_DIR) merge into one figure. Values are as fresh as this machine's last status line refresh: usage from another machine or claude.ai shows only after the next refresh here, as the age shown on the phone hints. The user adds the tap to the status line script by hand; collied never edits ~/.claude. |
| Phase | Built |
| |
| Assets | The user's gh login; the Copilot account's identity (login, id, tracking id, organizations and enterprises) in GitHub's answer |
| Attack | Reading the quota leaks the token or account identity to logs, disk or the phone; a token from collied's environment replaces the user's login; gh prompts and hangs; a crafted answer shows false usage or makes collied store something else. |
| Mitigations | Every five minutes collied runs gh api --hostname github.com copilot_internal/user with the gh setup of linked pull requests; the token stays inside gh. --jq reduces the answer inside gh to the reset dates, token_based_billing and the premium quota, so no identifier reaches collied. collied keeps only the used and allowed amounts (finite numbers under 10^9), unlimited, token_based_billing and a future reset time, in usage.json and on PlanUsage to the phone, as for the status line tap. Nothing from gh is logged, audited, pushed or put in a Live Activity. The paired Apple Watch gets only the percentage used (capped at 100), whether the seat is unlimited, the reset time and when it was read, over WatchConnectivity, for the complication and widgets. |
| Residual | The request goes to GitHub as the user, which GitHub already sees from Copilot itself. A same-UID process can replace gh or its config and show false usage, which is display only. gh reads the user's GitHub host config; --hostname github.com keeps the request on github.com whatever GH_HOST or the first configured host is. |
| Phase | Built |
| |
| Assets | What the user does at the Mac: when they last typed, whether the screen is locked, which application is in front, what runs under it |
| Attack | Skipping the done alert leaks desktop activity to the phone, the relay, Apple or the logs; reading it trips a privacy prompt or looks like monitoring to endpoint security; a same-UID process fakes "in front" to suppress the alert. |
| Mitigations | Read on macOS only, for a herdr agent whose turn just ended idle (herdr counted it seen), never on a timer: the session dictionary, the idle seconds and the display state from CoreGraphics, the owner pid and layer of the frontmost window (no title, no pixels: no Screen Recording, Accessibility or Input Monitoring permission, no event tap, no AppleScript, no helper process), the names of that process and its descendants and, for those named herdr or sheprd (Herdr.app) only, the kernel's description of each open socket (a network socket's addresses included), of which only a Unix socket's peer address is compared and the rest discarded, through libproc: the child lists and names pass through any process under the application, root-owned ones such as login included, while the socket reads succeed only on the user's own processes; the walk ends unknown at pid 0 or 1 or past 4096 processes, so it cannot stall reconcile. Each later step runs only when the one before allows a skip. Nothing is stored, sent or logged but the decision (an info-level line with the terminal id when the alert is skipped, off at the default level). Any unknown signal sends the alert. |
| Residual | The only effect is a missing done alert; the phone shows the agent idle, since herdr counted the turn seen. A same-UID process that holds a connection to herdr-client.sock under the frontmost application, or that focuses the pane, can suppress the alert; same-UID malware already controls herdr and collied's files and is out of scope (Same-UID malware on the Mac). collied knows the application, not its tabs or windows: herdr's done covers another tab or window only in a terminal that tells herdr when its tab or window loses focus, so in one that does not, the alert is skipped while another of its tabs or windows shows. Whether the lock screen key keeps its undocumented name is not guaranteed; if it went away a locked screen would rely on the 30 s idle bound. |
| Phase | Built (#774) |
| |
| Assets | Agent/workspace/machine labels, session titles and folder names, pull request details, approval context and followed-agent state |
| Attack | Apple, the publisher relay or a holder of an APNs provider key reads a notification payload or substitutes its metadata. |
| Mitigations | Every display producer seals title/body/context and private initial/local/update/end Live Activity state under the per-phone, per-machine notification key; static activity machine/title labels are encrypted too. A versioned ChaCha20-Poly1305 envelope binds kind, node, destination key, opaque thread or random activity scope, and event. ColliePush verifies public lookup fields before restoring text or adding approval controls, the app verifies decision responses again and decides only under the title, body and category of the authenticated display, and widgets verify against immutable activity attributes. Unsupported peers and missing legacy registration markers send no private plaintext. Keys stay in the phone's ThisDeviceOnly Keychain item and protected App Group mirror and in collied's private token store; only the authenticated tailnet registration transfers them. No nonce enters APNs. Shared Rust/Swift vectors and producer-level tests cover wrong keys/bindings/events/kinds, tampering, neutral fallback and payload limits. |
| Residual | Public destinations and opaque node/thread/approval/event/activity IDs reveal relationships. Generic attention/finished wording, categories, urgency, timing, frequency, ciphertext length and activity update/end lifecycle stay visible; there is no padding. A replay within its original scope can show stale authenticated content; the live nonce, expiry and fingerprint checks keep it from deciding a changed or consumed approval. The publisher relay sees this metadata plus source IPs, but no notification keys. Decryption happens on the phone: after first unlock, the operating system and anyone who sees an allowed lock-screen display can see rendered private text; before it, missing keys produce neutral text without controls. Locked and pre-first-unlock display and APNs action behavior still need checking on a real iPhone. A done, wake or archive alert's title is the session's terminal title, which the pane's program sets, as the session page shows it: the agent can word those titles, as it can its screen. An approval alert keeps the herdr name or the agent kind, so the agent cannot word the title above Approve. |
| Phase | Codec and fixtures built; Live Activity relay delivery confirmed on a physical iPhone; locked display validation pending. |
| |
| Assets | The app on the phone: that it starts, and stays usable for the other paired machines. The phone's memory. The phone's device log, which a sysdiagnose carries off the phone |
| Attack | A paired machine that was taken over answers the phone with what no collied sends. The phone dials every paired machine at each launch, so an answer that stops the app stops it at every launch, for every machine: the same terminal id twice in flock.snapshot, or usage times, change counts and diff hunk numbers at the edge of their types. Events without end, each for a new agent or approval or as large as a frame, grow the list the phone holds for that machine until iOS ends the app. An error message as long as a frame (4 MiB), a frame that does not parse, or a machine name of any length at pairing puts text the machine chose in the device log, where the app's lines are public. |
| Mitigations | collie-core keeps the first agent of each terminal id when it takes a snapshot, so the app's lists hold an id once, and the grid's saved order takes a repeated id anyway. The age of a Codex usage reading is compared, never added to; a worktree's added and deleted lines are compared, not summed; a diff hunk header whose numbers do not fit 32 bits is not read as a header, so no line number overflows. collie-core applies an event to a machine's list only while its replay queue takes it, 1024 events and 4 MiB of frames since the last snapshot; past that it asks for a snapshot, which replaces the list, so the list is at most one 4 MiB snapshot frame and 4 MiB of events. collie-core keeps only the first 200 characters, without control or format characters, of the error that becomes a link's last error or the outcome of a lock-screen or watch decision, the errors the log lines carry, and reports a frame that does not parse as serde's category, line and column, not as serde's message, which quotes the frame. The machine's name at pairing must be a label, 1 to 64 characters without control or format characters, or the pairing fails. |
| Residual | The phone shows a paired machine's titles, screens, approvals and Git text as that machine sends them. The values a machine sends were not all checked against the app's arithmetic and lists: if another one stops the app, the machine can be removed while the tailnet is off, when no list arrives. One snapshot frame can list tens of thousands of agents, which the Agents tab then draws. Not bounded yet: an agent.output_patch can keep the whole watched screen and add up to a frame to it, patch after patch; and each flock.changed, or event past the replay queue, makes the phone send a flock.snapshot request that it remembers until the machine answers. The device log still holds, in public lines, each machine's label and up to 200 characters of its last error, and a link's last error longer than that is cut on the Machines screen too. The error a request returns keeps the machine's whole message for the screen that made the request; one line can still log it, the notice shown when an approval fails to open. |
| Phase | Built (#814, #806, #804) |
collied now links libghostty-vt, a C-ABI library built with Zig from Ghostty's release tarballs, through crates/ghostty-vt-sys: hand-written unsafe declarations that the compiler cannot check against the library, so a wrong signature is undefined behavior rather than a build error. They were checked against the pinned release's headers when written, compile-time asserts hold every struct's size and offsets to the headers', and the crate's tests link every declared function and call through them on macOS and Linux.
Since #765 program output reaches it: while a phone watches a Rex agent, the terminal's snapshot and everything its programs print go straight from Rex's data connection into libghostty-vt's snapshot decoder and VT parser, inside collied. alacritty_terminal, which still parses Herdr Core's output and every polled Rex read, is safe Rust; libghostty-vt is Zig built for speed plus two C++ libraries, simdutf and Highway. A memory-safety bug in it is reachable by any program running in a watched Rex terminal (an agent's tool output, a file it cats, a remote host it reaches) and runs with collied's privileges: the tailnet node identity, the pairing and TLS keys, and the approvals it relays. An attacker who can make a watched terminal print bytes gains, through such a bug, what collied holds: a way to act as this machine on the tailnet, to pair or to answer approvals. Only Rex terminals a phone watches are parsed this way, and collied's parser is the first native code to see those bytes: the phone sees only the text and SGR styles collied's emulator lets through. runtime::ghostty, the only caller, keeps the headers' rules in safe Rust: the formatter and a selection's grid references live within one call under a shared borrow of the terminal, empty output (a null pointer) is never made into a slice, the terminal is Send and not Sync, behind a mutex, and the snapshot's envelope is checked before the decoder sees it. collied therefore builds the library in ReleaseSafe (the app keeps ReleaseFast and filters what it parses, as the end of this section says). That turns many such bugs into an abort, which launchd or systemd follows with a restart, instead of memory corruption in the process that holds the keys: slice and array bounds, integer overflow, unreachable and the assertions Ghostty compiles to it (inlineAssert). It leaves others unchecked: indexing through many-item pointers and pointer arithmetic from @ptrFromInt, which the terminal's page storage is built on, use after free and double free (the library allocates with libc's malloc), and the C++ in simdutf and Highway. Ghostty's page integrity checks run only in Debug builds.
What the library can reach beyond the terminal: linked alone with the functions collied calls and dead-stripped, it keeps 107 libc imports on macOS arm64 and 97 on x86_64 Linux, among them openat, unlinkat, realpath, readlink/readlinkat and write/writev, and also process spawning (posix_spawn, fork, execve) and sockets. The macOS linker (-why_live) traces each one checked (openat, unlinkat, readlinkat, posix_spawn) to Zig's default panic handler: a failed ReleaseSafe check calls debug.defaultPanic, which locks stderr through Zig's Io.Threaded interface, and that interface's function table keeps all of its file, directory, process and socket functions linked. At run time the panic path writes the message to stderr, may read collied's own executable to print a stack trace, and aborts (read from Zig's standard library, not run); nothing in the API collied calls hands stream bytes to those functions, which are reached only through that table (inferred from the call graph, not proven). On Linux the stack trace may read more than collied's executable, such as the other loaded objects (not verified). These imports do not bound an exploit: collied itself imports execve, fork, posix_spawnp, socket, connect, unlinkat and getenv and starts processes, so a memory-safety bug that takes control of collied reaches everything collied can do. getenv is not imported on macOS; on Linux, simdutf calls getenv("SIMDUTF_FORCE_IMPLEMENTATION") the first time it runs, to pick its implementation, which reads collied's own environment only.
An abort is not free: it drops every phone session, pending approval, queued push and upload, for every runtime, until launchd or systemd restarts collied. A program that keeps printing what trips a check, or whose trigger sits in the terminal's state and returns with the next snapshot, would abort collied again each time the phone watched that terminal. collied keeps a marker, rex-streaming in its data folder, while any stream is followed, and removes it when the last stream ends and when it stops cleanly; a run that finds it left over removes it and reads every Rex terminal by polling, with one warning in the log (rex.md). The first abort still happens, a kill or an unrelated crash during a stream costs one run of polling, and the marker does nothing for a bug that corrupts memory without aborting; a marker that cannot be written is logged, and streaming goes on without it. A streamed read formats at most 983,040 bytes, what one polled answer holds: a screen whose links would format to more, or a format the library fails, polls instead. A resize or a history trim the library refuses ends the stream, so reads never come from a terminal of the wrong size or an untrimmed one.
The build trusts the release tarballs and the Zig toolchain as pinned in scripts/ghostty/pins.env: each download is checked against its SHA-256, and the tarballs' checksums come from a SHA256SUMS whose minisign signature was checked against Ghostty's release key when pinning. On arm64 macOS and x86_64 Linux, where every release and CI build runs, the build uses only the Zig it downloaded and checked, and trusts an unpacked copy only when the marker written after its verified extraction matches the pin; it never takes a zig from PATH there. On another host it takes a zig on PATH at the pinned version, without a checksum.
The app links the same library, built ReleaseFast so that drawing a screen costs no more, and its reason for ReleaseSafe holds on the phone when the sender is a paired machine that was taken over: such a machine sends any bytes as a screen, and the app holds every other machine's pairing and a handle to its Secure Enclave TLS key. In the grid layout, opening the Agents tab renders every agent's screen, with no tap on one. The app therefore does not rely on what collied sends (#808). Before a screen reaches the library, TerminalScreen.render keeps printable text, CR, LF, TAB and SGR sequences (ESC [, up to 64 digits, ; and :, then m), the grammar sanitize_ansi writes, and drops everything else: every other C0 control and DEL, every C1 control (U+0080 to U+009F), a CSI that is not such an SGR, OSC, DCS, SOS, PM and APC strings up to their end or the end of the screen, and every other escape. Every screen collied's tests capture passes through unchanged. The sequences the app adds itself for wrapping (autowrap on and off, NEL, cursor forward, erase in line) come after the filter and are fixed. The Swift side of the boundary bounds what it asks of the library: at most 500 columns and 2,000 rows, no scrollback, no callback for replies, the clipboard or other effects, and a library built with the render-state feature only. Residual: printable text of any length and SGR sequences still reach a ReleaseFast parser, with the UTF-8 decoding, character widths, combining characters, wrapping and style storage behind them, none of it bounds-checked. No bug in those paths is known; the filter removes the rest of the parser from a machine's reach, not the class.
Before replacing the installed executable or changing its service, the macOS installer requires a strict signature, the expected daemon identifier and publisher team, and Apple's explicit notarized requirement. The standalone executable check forces an online ticket lookup; on failure the existing binary and service stay untouched. App and disk-image policy checks are separate. None of these replaces accepting a quarantined download on a clean Mac with Gatekeeper enabled.
The Worker in relay/, deployed at collie-push.rbstp.dev, accepts only HMAC-authorized, registered destinations and strict generic or encrypted public envelopes. It stores no notification payloads, cannot issue approval decisions and has no enrollment bypass. An hourly cleanup deletes expired relay records within 14 days of the last grant expiry, even at the exact global control and enrollment caps; D1 Time Travel keeps them restorable for 30 days after deletion. Production resource limits rest on measurements and soft controls, not a spending cap; relay.md covers them and the storage, privacy, abuse and deployment constraints.
The relay control path trusts pinned Apple certificate chains and a fixed publisher app/environment policy. App Attest proves app integrity, not a person's identity or token ownership; the phone's confirmed pairing authorizes machine-specific, exact-destination grants. An assertion needs a valid ECDSA signature over the SHA-256 nonce of the authenticator data plus the client-data hash. Accepting a retained AT flag admits no credential bytes and skips no App ID, extension, signature or counter check. HMAC challenges bind canonical operations and the exact prior durable counter/epoch, so even a newly signed higher counter cannot replay one. A D1 trigger failure rolls back counters, quotas and authorization together. A stolen grant can send bounded pushes only to its route until revocation or expiry, and carries no approval or decryption authority; revocation can race an already authorized in-flight attempt.
The phone client pins the publisher's endpoint, refuses redirects and runs its whole control transaction under an explicit FIFO gate across actor awaits. An offline revocation keeps minimal retry credentials and stays pending until it succeeds or expires; local removal cannot guarantee immediate remote denial. A phone whose relay Keychain record is gone enrolls as a new installation and loses the old one's revocation authority with the record: a revocation still pending then never completes, and that machine can send until its grant expires. Only a record that is missing, or that holds another installation than its marker names, starts a new installation; a Keychain that cannot be read (the phone is locked) fails the load, so a fresh state is never saved over credentials the app could not reach. Raw destinations and verified attestation metadata stay in bounded D1 records until retention cleanup, with no notification keys, payloads or sensitive request logs; relay.md has the exact control contract and retention bound. Measured full attestation exceeded the Free plan's CPU budget, hostile invalid-nonce cases included, so the relay runs on Workers Paid with the internal crypto actor below (validation report).
The crypto actor has no HTTP handler; the public Worker reaches it through an internal binding under one fixed object name, forwarding bounded verification inputs only after its admission, body and challenge checks. The actor takes publisher/environment/version policy from trusted bindings and uses its own clock; callers cannot supply other roots or validation context. No destinations, notification plaintext, decryption keys or authorization decisions enter actor storage. Verification stays separate from D1's atomic replay/epoch/quota guard. Unavailable or exhausted compute fails closed, with no expensive inline fallback. Paid validation adds shared control/enrollment limiter keys before D1 or crypto, beside source and installation keys, and a provisional 250 ms script CPU ceiling. Shared limiter counters are local to a Cloudflare location and permissive: distributed attempts still consume billed requests and may reach D1/crypto before committed daily quotas reject them. Neither mechanism is an account spending cap, and shared exhaustion can deny legitimate enrollment or revocation. The singleton is an availability bottleneck; native queuing and platform quota exhaustion can deny legitimate requests. One small guarded Free-account cycle completed within the observed CPU limits; full production CPU distributions, actor duration/capacity and fresh Collie enrollment remain unvalidated (relay.md).
collied takes a fixed HTTPS publisher endpoint from its own push mode (relay and direct APNs are mutually exclusive), never from a phone-supplied URL. It sends only a bounded grant in the sensitive Authorization header and an encrypted or generic public envelope, refuses redirects, and bounds response size and attempt time. No grant, destination or payload reaches logs or doctor output; only the private push.json keeps route grants, each with its exact paired device or activity.
Retries hold at most 64 encrypted pending destinations in memory, with no durable payload queue. Routine updates coalesce to at most one per 60 s for each agent and phone; transient errors and Cloudflare non-JSON limit responses pause attempts with bounded exponential backoff and jitter. Daily quotas stay server-authoritative across all machines. Before every attempt, the sender rechecks pairing, exact token/generation, grant expiry, live approval/expiry and activity replacement. APNs expired/unregistered invalidations remove only the matching old destination generation; configuration errors keep registrations. A genuine OS token registration can authorize a newer generation for the same token through the attested control gate; polls and foreground snapshots cannot force repeated rotations, and late invalidations cannot revoke that replacement or another installation, app or activity route. An ambiguous successful response can duplicate a display but grants no approval authority. Offline revocation and an already authorized in-flight push keep their races (Attested relay control). Push outages do not block authenticated tailnet or local desktop operations.
.github/workflows/ios-test-budget.yml runs on workflow_run, from master, with a token limited to actions: read and pull-requests: write, and comments the iOS test budget on a pull request. The pull request's ci run, which built that pull request's code with a read-only token, produced the ios-test-metrics artifact, so its content is the pull request author's. The workflow never checks out or runs pull request code: it checks out scripts/ios-test-budget.py from master, takes the pull request number and commits from the event, never from the artifact, and passes the artifact's zip to the script as a file. The script reads one named member in memory, at most 64 KiB, and accepts only JSON holding the five known metrics and the four enforced ceilings as finite numbers from 0 to 1,000,000, and at most 100 test names of two to four parts, each at most 200 letters, digits and underscores; anything else posts no comment. Nothing from the artifact reaches a shell command, and the comment holds only those numbers and names. A pull request can still show false numbers in its own comment; the ios job, not the comment, enforces the budget. Pull requests from forks get no comment, since the event names no pull request for them.
The local-only Simulator entry pre-provisions a fresh software key into private, isolated D1 storage, refuses enrollment, fixes sandbox APNs and uses separate send secrets. Its control assertions still pass the production verifier and atomic counter/epoch checks. Production cannot authenticate this key through enrollment or verify the local HMAC grants; never copy development database rows or secrets into production. Swift development import exists only in DEBUG Simulator builds; the daemon loopback switch is debug-only and absent from Release artifacts. Real APNs keys stay locally held operator credentials, never provisioning fixtures. Simulator testing has the exact boundary and limits.
The VM and Simulator harness is a Debug-only trust island: a disposable macOS guest, a separately recorded host Simulator, fresh software identities, synthetic tailnet authorization and a private mock publisher database. Its fixed local control hook needs explicit opt-in plus owned private marker files; unsupported Rust frameworks fail before Swift creates state or identity. No physical-device or Release artifact exposes the hook. Ordinary pairing confirmation, identity pins and mutual TLS still apply.
SSH host keys come through the local VM guest agent and are verified against a private per-run known-hosts file. The harness forwards only fixed loopback endpoints with a task-only key, disables agent forwarding, shares no host directories and refuses occupied test ports. Reset and teardown touch only recorded test resources. VM image tooling and any guest desktop-control permissions belong to the guest; a CI image with SIP or Gatekeeper disabled cannot prove pristine consumer acceptance. Local mock success proves neither genuine App Attest nor Apple APNs acceptance.