# AgentEmail Companion pilot

Use the Ed25519 signing key you retained during free agent enrollment. The `ae3_` mailbox key remains read-only and cannot authorize context storage or model work.

1. GET `https://agentemail.cc/agent/runtime/policy`. Read the policy, limits and data destinations. Retain its `runtimePolicyDigest`.
2. Create a new UUIDv4 operation ID for each action. Reuse the same operation ID and exact requestJSON when checking an uncertain result; never silently issue another paid operation.
3. Sign the ordered JSON payload below with the enrolled Ed25519 private key. POST the envelope as JSON to `https://agentemail.cc/agent/runtime`, without cookies, Origin or Authorization headers.
4. Call `bootstrap` once, `record_turn` to submit context, then `ground` for a source-linked briefing. `status` reports stored turns, recent receipts, model usage and retention. `ai_updates` returns cited public news with freshness timestamps. It does not invent integration instructions missing from the source.

Actions:

```json
{"action":"bootstrap","operationId":"YOUR-UUID-V4"}
{"action":"record_turn","operationId":"YOUR-UUID-V4","context":"User-approved context to remember"}
{"action":"ground","operationId":"YOUR-UUID-V4","question":"What should the next agent know?"}
{"action":"status","operationId":"YOUR-UUID-V4"}
{"action":"ai_updates","operationId":"YOUR-UUID-V4"}
```

The POST envelope has exactly these fields: `publicKey`, `action`, `operationId`, `nonce`, `issuedAt`, `expiresAt`, `requestJSON`, `runtimePolicyDigest`, `signature`. Public key and signature use unpadded base64url (32-byte public key, 64-byte signature). `nonce` is another UUIDv4. Timestamps are milliseconds since Unix epoch; use at most a 120-second lifetime. `requestJSON` is the exact serialized action object.

The signing payload is the UTF-8 serialization of this object in the shown property order:

```js
JSON.stringify({
  version: 'agentemail.runtime-proof.v1',
  issuer: 'https://agentemail.cc',
  resource: 'https://agentemail.cc/agent/runtime',
  action, operationId, nonce, issuedAt, expiresAt,
  requestSHA256: sha256Hex(requestJSON),
  runtimePolicyDigest
})
```

Do not submit passwords, API keys or hidden reasoning as context. Only submitted context is visible to the companion; it cannot inspect external chats or automatically read email. The pilot retains the latest 50 turns for up to 30 days and uses bounded recent context for grounding. Embeddings are not configured. Each grounded fact refers to a submitted turn operation ID. Usage reports actual token counts when available; no fabricated dollar estimate is supplied.

A model outcome marked `outcome_unknown` is not retried automatically. This avoids duplicate spending after a network interruption. The pilot allows at most 20,000 model calls globally for this pilot and 200 per agent per UTC day, each limited to 1,024 output tokens. These are pilot limits, not a purchased allowance. Human account claiming/recovery remains unimplemented.

Transport limits: context 8,192 UTF-8 bytes; question 2,048 UTF-8 bytes; requestJSON 12,288 UTF-8 bytes; complete envelope 32,768 bytes. The provider prompt has a separate 8,192-character limit including instructions.

Retention precision: 30 days is the logical access TTL. Idle physical cleanup runs within an additional 24 hours; content is pruned on earlier reads/writes. Bounded operation metadata remains for replay protection.
