Skip to content

Safe mutation rules

write_context

Every mutation must include:

{
  "resource": "https://mcp.heyaira.eu/mcp",
  "instance_id": "<operator-selected instance>",
  "project_id": "<authenticated project UUID>"
}

The instance value is supplied by the selected client connection profile. It must not be learned by echoing an untrusted server response into a write.

The server rejects a missing or mismatched resource, instance, or project before changing domain state. A rejection may create a redacted audit event, but it must not create a memory entry, task, or work receipt.

Optimistic locking

Every task_update uses the version from the latest task_get as expected_version. A conflict is a normal concurrency result. Re-read the task and decide whether the work should continue; never overwrite another session’s state.

Idempotency

Use one stable idempotency key for one logical memory_add or task_create. If the same request is retried, HeyAira returns the original result. A changed payload with the same key is rejected.

Receipts

The (task_id, session_ref) identity prevents duplicate work receipts. Task updates and their receipts are atomic: a rejected update cannot leave a receipt behind.