# Outbound hold

An email, chat message or comment reaches people who asked the Agent nothing. With the hold on, each such call waits as a draft the user approves, in every permission mode.

## Which calls are held

`mcp/adapter.py` (`sends_on_behalf`) decides once per MCP tool, at registration, and stores `_sends_on_behalf` on the AgentTool. The raw name is split on punctuation and camelCase.

| Check, in order | Result |
| --- | --- |
| Server declares `readOnlyHint: true` | Not sending |
| First word is `get` `list` `read` `search` `fetch` `find` `query` `view` `describe` `count` `check` `lookup` | Not sending |
| Any word is `send` `reply` `respond` `post` `publish` `forward` `invite` `share` `comment` `tweet` `broadcast` `notify` `dm` | Sending |
| First word is `create` `add` `new` `write` `compose`, and a later word is message, email, mail, comment, reply, post, tweet, invite, invitation or dm (plurals of message, email, comment, post included) | Sending |
| Anything else | Not sending |

- **Held**: `send_email`, `chat.postMessage`, `create_comment`
- **Not held**: `list_messages`, `get_posts`, `create_draft`
- **Not used**: `openWorldHint`: it defaults to true and most servers leave it unset, so it does not separate a send from a read
- **Built-in tools**: Never held. `chat_send` speaks in the conversation's own chat; `send_message` talks to other OpenProgram sessions.

## Where the hold applies

| Aspect | Behaviour |
| --- | --- |
| Order | In `permission_decision`, after deny rules, Plan's refusal and ask rules; before allow rules and the mode. See [Permission decision and refusals](https://fzkuji.github.io/OpenProgram/docs/reference/design/runtime/security/permission-decision.html). |
| Outcome | `ask` with `RULE_OUTBOUND_HOLD`, whatever the mode and even with an allow rule. A turn that cannot approve gets `NO_ONE_TO_APPROVE`. |
| Which Agent | The turn's `req.agent_id`, `main` when absent. An unknown Agent does not hold. A turn with a `profile_snapshot`, such as a trial of an unsaved draft, also holds when the snapshot has the hold on; a snapshot never lifts a hold the saved Agent has. |
| Approval | `one_shot_approval` covers every sending tool, held or not: never "always", never an allow rule. Each message is approved alone. |
| The draft | The approval card's tool name and full arguments; `approval._approval_detail` does not truncate one-shot calls. |
| Deny with a note | The note returns to the model as the tool result. Its next call is a new draft that asks again. |

## Configuration

- **`hold_outbound`**: A top-level boolean in `agent.json`, set by the last checkbox on the Agent's Always-on tab and accepted by `PATCH /api/agents/{id}`
- **On**: Only an explicit `true`; `AgentSpec.hold_outbound` defaults to `false`
- **Off**: The call follows the conversation's mode and rules like any other tool
- **Stored values**: A one-time worker migration rewrites stored `true` values, which came from an earlier default, to `false`

## Implementation status

| State | Parts |
| --- | --- |
| Implemented | MCP tool classification, the hold in every mode, one-shot approvals, the per-Agent setting through the Always-on tab, `agent.json` and the HTTP API |
| Not implemented | Holding actions done through computer use or the browser: a click on a page's Send button is not recognizable as a send from the call. |
