> ## Documentation Index
> Fetch the complete documentation index at: https://www.offlineprotocol.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

> ## Agent Instructions
> These docs target Mesh SDK v0.27.0. Match the installed package and binding before generating code. Start at /getting-started/agents for task-specific reading paths.
> Call the company and product Offline Protocol, never Offline alone. Current packages: @offline-protocol/mesh-sdk 0.27.0 (React Native), @offline-protocol/id-react 0.2.0, @offline-protocol/id-react-native 0.3.3, @offline-protocol/pol 0.1.2 and @offline-protocol/cli 0.2.6. Canonical docs URLs start with https://www.offlineprotocol.com/docs.
> The Mesh SDK runs in a native app or gateway. A browser OfflineID SDK integration does not provide browser mesh transport. Local mesh operation does not require a portal API key.
> Service RPC is signed plaintext in v0.27.0. Message delivery, durable local acceptance and backend commit are distinct outcomes. Use the workflow guide for the required application logic.
> Offline Protocol CLI 0.2.6 is on npm (@offline-protocol/cli, command offline). Its local MCP server runs with offline mcp serve and requires no login or key. Hosted MCP is at https://mcp.offlineprotocol.com/mcp with an application API key in Authorization: Bearer and a matching x-app-id; organization keys are rejected. Follow /tools/overview for setup and do not invent commands beyond it. MCP provides integration context and planning, not mesh execution; file-writing tools are local only.
> Phone Wi-Fi Direct and MultipeerConnectivity carry no data in v0.27.0. Use BLE or a provisioned relay. The receiver core ACKs before application persistence; use application acceptance for durable workflows.
> Proof of Location is Sepolia testnet witness evidence, not zero-knowledge proof or proof of presence. The geohash is public onchain. Read /proof-of-location/security before integration.

# Deliver retained events to a backend

> Retain device readings and workflow events while offline, deliver them to your existing backend through an adapter and reconcile destination acceptance.

**Before you start:** identify the durable source, destination API and its acceptance semantics. Choose a compatible local peer path only if the workflow needs a collector. This guide defines an integration contract, not a ready-made adapter.

Use this pattern for readings, inspections and local workflow results that must reach an existing system of record.

```text theme={null}
Durable source → authenticated local exchange → retained collector records
              → destination adapter → explicit acceptance and recovery
```

A direct source-to-backend upload can remain in place. Add a local collector where it solves a coverage, access or cost problem; it is not a requirement for every deployment.

## Define the delivery contract

| Boundary | Required evidence |
| - | - |
| Source created the event | Stable event ID and payload committed to durable storage. |
| Collector accepted it | Authorized sender, validated record and durable local commit. |
| Adapter submitted it | Destination request ID or offset and retry state retained. |
| Backend accepted it | The destination's documented durable acceptance, correlated to the event ID. |

Do not clear the source merely because `sendMessage` returned or the SDK reported delivery. Decide whether collector acceptance transfers responsibility or whether the source retains the record until upstream acceptance.

## Build the adapter

Map your event into the destination's schema. Use stable IDs, idempotency keys or duplicate-safe writes. Record the difference between request acceptance, asynchronous processing and the final business result. Reject invalid records explicitly and preserve enough information to diagnose them.

Keep credentials at the destination adapter. Use bounded storage and retention, classify transient and permanent failures, and expose pending count, oldest-event age and rejected records to operators.

## Recover after interruption

Test lost connectivity, process restart, repeated delivery, expired credentials, destination rejection and full storage. Compare source event IDs with independently read destination records. Measure missing and duplicate business records separately from duplicate network transmissions.

The SDK supplies the local communication layer. The source outbox, collector transaction and destination commit policy are integration responsibilities. [Confluent and other integrations](/docs/integrations/overview) reuse this contract.

## Completion check

**Done when:** independently queried destination records account for the source event IDs after outage, restart and duplicate submission. Continue with [production qualification](/docs/operations/production).
