# Effects and retries

> Which operations only read, which are transient, which persist or discard, and what is safe to send again.

Use **Effects** to decide which calls an agent may run without asking. Use **Retries** when a response is lost and you need to know whether resending is safe.

## Effects

| Kind | Desk effect | Survives restart | Can discard data | Examples |
| --- | --- | --- | --- | --- |
| **Read** | Inspects state without changing the desk | No | No | `residents.list`, `resident.describe`, `inbox.watch` |
| **Transient** | Plays expression, run state, or prepares drafts | No (see exceptions) | No | `message.send`, `resident.status`, `resident.emote` |
| **Persistent** | Adds or updates desk state | Yes | No | `resident.ensure`, `resident.place`, `resident.set` |
| **Persistent, destructive** | Replaces, removes, or quits | Yes | Yes | `resident.stow`, `settings.set`, `app.quit` |

<details>
<summary>Full operation breakdown by effect</summary>

**Read**

- **Discovery and inspection**: `capabilities.get`, `residents.list`, `zukan.list`, `resident.describe`, `resident.sketch`, `resident.pixels`
- **Conversation and inbox**: `conversation.read`, `inbox.watch`, `inbox.read` (records read state), `question.result` (records answer handover)
- **Sequences, notes, settings, and graph**: `sequence.get`, `sequence.list`, `note.get`, `settings.get`, `group.list`, `group.members`, `relation.list`, `relation.links`

**Transient**

- **Messages and questions**: `message.send`, `question.ask`, `question.cancel`, and `resident.requestClose` (until the user answers yes, which stows)
- **Signals and states**: `resident.emote`, `resident.glow`, `resident.bounce`, `resident.status` (plus `status` on `message.send` and `question.ask`), `relation.fire`
- **Sequences and drafts**: `sequence.start` with `commit: restore`, `sequence.cancel`, `import.prepare`
- **Exceptions**: A resident's conversation (your messages, letters, and the user's answers) is kept locally until the resident is stowed, including across restarts. `message.send` with `to: auto` on an empty desk summons a resident and saves it.

**Persistent**

- **Residents**: `resident.ensure`, `place`, `set`, `throw` (landing position), `summon`, `duplicate`, `desktopVisibility`
- **Sequences and graph**: `sequence.start` with `onSuccess`, `group.create`, `group.add`, `relation.define`, `relation.link`

**Persistent, destructive**

- **Residents, notes, and settings**: `resident.stow`, `note.set`, `settings.set`, `import.adopt` (when replacing), `app.quit`
- **Saved looks and sequences**: `sequence.save` (same name), `sequence.delete`, `status.define` (same name or `remove`)
- **Groups and relations**: `group.rename`, `group.delete`, `group.remove`, `relation.update`, `relation.delete`, `relation.unlink`
- These calls can discard a placed resident and its settings, a note, a saved sequence or status look, an adopted resident, an app setting, or saved group and relation data. `app.quit` quits Pixling.

</details>

> [!NOTE]
> **MCP tool annotations and default policy**
> The effect kinds above and MCP tool annotations are separate:
>
> - `inbox.read` is a Read operation, but it saves read state so it reports `readOnlyHint: false`. Transient expression and drafts are also writes.
> - `destructiveHint` is `true` only for **Persistent, destructive** operations that can discard existing state.
> - Exact annotation values for each tool, including `idempotentHint`, appear in `tools/list`.
>
> Your host's permission settings decide what runs without asking. Server instructions state one default policy: **unless the user or host decides otherwise, make persistent changes only when asked**. Your skill or client settings can override it.

## Retries after a lost response

Pass a unique `requestID` (such as a UUID) on calls that support it so you can resend the exact payload safely if the response drops:

```json title="Safe retry pattern — pixling_message_send"
{
  "to": "client:my-agent/conversation-1",
  "requestID": "b7e2c1a0-4f3a-4c8d-9e12-000000000001",
  "text": "Migration finished",
  "author": "My Agent"
}
```

| Operation | Resend with same arguments | Run again on purpose |
| --- | --- | --- |
| `resident.ensure` | Reuses the `namespace`/`key` binding; ignores initial values. | Use a new `key` for a different resident. |
| `question.ask` | Reuses matching requester, `requestID`, and content while recorded. | Use a new `requestID` for a new question. |
| `sequence.start` | Reuses active run receipt for matching requester, `requestID`, and content. | Cancel first or wait until done, then use a new `requestID`. |
| `message.send` | With `requestID`, returns original receipts (last 64 accepted calls). | Use a new `requestID`, or omit it. |
| `resident.duplicate` | **Not deduplicated.** Do not resend an accepted duplicate. | Each call creates a new duplicate. |
| `inbox.read` | Safe to repeat; returns the message text even after it was read. | Fetch new IDs with `inbox.watch`. |

### Message deduplication rules

- With a `requestID`, resending the same requester, `requestID`, and content returns the original receipts without showing the message or summoning a resident again.
- The desk remembers the latest **64** calls that produced an accepted receipt, until Pixling quits.
- Reusing a `requestID` with different content fails with `conflict`.
- All MCP callers share one key space, so generate a unique key per message (such as a UUID). Calls without `requestID` are not deduplicated.

### Binding conflicts and sequence runs

- **`resident.ensure`**: Passing a different `assetID` or `name` than the first call fails as a conflict. Initial values are never re-applied to an existing binding.
- **`sequence.start`**: Sending different content with an active run's `requestID` fails with `requestConflict`. Once a run ends, the same `requestID` starts a new run; to replace an active run, call `sequence.cancel` first and use a new `requestID`.
- **No restart history for sequences**: Sequence run data does not survive an app restart. `sequence.get` returns only active runs and the latest finished result per requester and resident. Getting `notFound` for an old `runID` means the result is no longer kept, not that you should repeat the motion.

### Recover a lost question answer

After a settled answer is handed over, resending `question.ask` with the same `requestID` can create a new question.

> [!CAUTION]
> **Do not infer a decision from null**
> A `null` from `question.result` does **not** mean unanswered, canceled, or agreed. Pixling keeps no history separating an unknown ID from one already handed over or moved to your resident's inbox.
>
> To recover an answer for your bound resident:
>
> 1. Call `inbox.watch` once.
> 2. Read each returned ID with `inbox.read`.
> 3. Match entries with `kind: answer` by `answer.promptID` and treat `answer.outcome` as authoritative.
>
> If you cannot recover the answer, leave the decision unresolved.

## Next steps

- [Read refusals](/docs/connect/errors/): Inspect error payloads, failure codes, and CLI exit codes.
- [Operations reference](/docs/reference/operations/): Full list of failure codes and operation behavior.
- [MCP tools](/docs/reference/mcp-tools/): Tool catalog, groups, and annotation details.
- [What stays](/docs/use/what-stays/): See what survives hide, stow, restarts, and ended sessions.
