Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion docs/net/threat-model.md
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,18 @@ An agent can start a subagent on another of the user's computers (`delegate_task
- The thread there runs in the narrowest of the parent thread's mode, the parent's run and the limit that computer set for this one (it refuses a mode above that limit, so the service narrows to it first). A follow-up (`continue_subagent`) runs no looser than the run that sends it and the mode the subagent was started with. No fixed mode caps it (issue #1160): when that computer's limit for this one is Full access and the parent runs in Full access, the subagent runs in Full access there, so an agent on this computer can run commands on that one without anyone being asked. That limit starts at Auto-accept edits, so this happens only after a person on that computer raised it for this one. A task that is read-only here (`workspace: 'shared'`, or a plan ceiling) is sent in Plan mode.
- A thread another device started (a remote subagent's thread, or one a phone or another computer started) cannot start remote subagents, so a chain is one computer deep.

What the other computer sees is unchanged: a person on this computer. Its switch for other computers, the block, the device's highest permission mode, the first-use notice and the audit apply, and its thread is marked "from <computer>". It cannot tell that an agent asked, so the controls above are this computer's alone, as for the router. A person on that computer can still raise the thread's mode up to the device limit; the subagent's questions and approvals wait there for them. Each task has a time limit (`maxMinutes`, six hours by default) after which it is stopped there, so an approval nobody answers does not hold its parent for ever.
Where the other computer knows the agent mark (below), every call that changes a thread there carries it: `threads.create`, `threads.setModel`, `threads.setPermissionMode`, `orchestrator.send` and `orchestrator.abort`. That computer then handles them as an agent's, not a person's. An older computer gets them unmarked and sees a person on this computer, as before. Which form a subagent's calls take is decided by its first call and kept on its rows (`remote_subagents.marked`): the owner's replay ledger is keyed by method, so a task that changed form mid-flight could be sent twice. Either way the other computer's switch for other computers, the block, the device's highest permission mode, the first-use notice and the audit apply, and its thread is marked "from <computer>". A person on that computer can still raise the thread's mode up to the device limit; the subagent's questions and approvals wait there for them. Each task has a time limit (`maxMinutes`, six hours by default) after which it is stopped there, so an approval nobody answers does not hold its parent for ever.

#### Calls marked as an agent's (issue #1160)

Seven routed rows take a key `agent: { thread, run, title, hops, mode }`: `threads.create`, `threads.setModel`, `threads.setPermissionMode`, `orchestrator.send`, `orchestrator.steer`, `queue.enqueue` and `orchestrator.abort` (`ROUTED_AGENT_KEY` in `src/shared/bridge/routed.ts`). Today only remote subagents send it.

- **Who sets it.** Only the calling computer's daemon service. The router refuses it from a window (`invalid_params`; the key is in the rows, so it would otherwise pass through), and a phone's `threads.create` takes exact keys and the backend refuses the key outright. The key is never dropped for an older owner: the caller refuses to send a key the owner's version of the row does not know (`computer_outdated`), so an agent's message is never delivered as a person's. Any change to the key's shape or meaning raises the version of all seven rows. Its fields avoid `…Id`, so the id rewriting leaves them alone.
- **What the owner does with it** (`src/mms/bridge/routed/remoteAgent.ts`). The calling computer comes from the authenticated link and its name from the owner's own pairing record, never from the call. The call runs through a remote agent actor (`AgentActor.remote`) that carries the sender's mode and hop count, so nothing is looked up as if the sender were local (a lookup would find no run and fall back to the profile default, which can be Full access). Compared with the same call from a person on that device, a marked call runs as source `mcp` (no "Always" rules, no `person_turn`), in the narrowest of the mode it carried, the device limit and, for a message into an existing thread, the thread's own mode; its text is never read for `/skill` or workflow commands; it is refused while a question or approval waits (`questions_pending`); a steer into a run looser than the sender is refused (`ceiling_exceeded`); the owner builds the envelope itself (the sender's title cut to 80 characters with control, direction and zero-width characters removed, both envelope markers defused in the title and the body) and the body is at most 16,000 characters (`agent_message_too_long`); the thread, the run and a queued item record the calling computer (`sentFrom`, `run.sent_from`), so blocking the device takes the agent's work away too; and the audit row says `actor: agent` (`bridge_audit.actor`).
- **The owner's own limits**, each refused with its own code: agent messages in a row (the larger of the carried count and the owner's own count from the thread's latest run; `agent_hops_exceeded`), queued agent messages and repeats (the rules every agent's message has, on one computer or two: three waiting per sender and ten in all, `agent_queue_full_per_sender` and `agent_queue_full`, and the same text from the same sender within two minutes, `duplicate_message`, refused with the reason, never dropped; a sender on another computer is counted by its computer and thread), 20 messages per device and thread in 10 minutes (`agent_rate_limited`), and 200 agent-started runs per device a day (`agent_daily_budget`). The rate limit and the budget are counted from the audit, so a restart does not reset them. A follow-up from the agent that started the thread adds none of the owner's own count, as a follow-up to a subagent does on one computer.
- **Agent reach** (`net_node_policy.agent_reach`): which threads a device's agents may change, `none`, `launched` (default: threads they started here, from the owner's own `startedFrom`) or `all`, decided at each call. A marked Stop ends only runs an agent of that device started and leaves a thread a person took over. There is no setting in the app yet.
- **Threads they start.** A marked `threads.create` records `startedFrom.agent { thread, title, mode }` and holds the thread to that mode from its first write, so a launch cut off later has already left a thread no wider than its launcher. `createdByThreadId` stays unset: a foreign id there would be rewritten to a thread of the owner that does not exist. A marked `threads.setPermissionMode` above that mode is refused (`agent_mode_above_thread`), and such a thread cannot start subagents on a third computer. The stored sender of a message is `origin.from { node, thread, run, title }` with no `origin.threadId`; the id rewriting leaves `from` unchanged on every computer.
- **A policy, not a boundary.** The owner cannot verify that a marked call came from an agent, so the mark only narrows: a marked call may do strictly less than the same call unmarked, and a caller that lies about it gains nothing. A process that controls the calling computer can still send unmarked calls, which the owner handles as a person's. The device limit, the block and the audit remain the controls against a computer that is not trusted.

#### Lists of other computers

Expand Down
Loading
Loading