Agent manual
How a coding agent sets up SyncPilled for an app and manages it, with the CLI or the API. Served as /agents.md.
You are helping a developer add offline-first sync to their app with SyncPilled. Each person's records sync across their devices; the latest edit of a record wins; files sync by content hash.
Get access
- Hosted: the developer runs
syncpilled loginand approves in the console. Never ask for their password. - Self-hosted behind Cloudflare Access: the developer makes a management key in
the console and gives it to you through a file or
SYNCPILLED_KEY. Never print it. - Check with
syncpilled whoami --json.
Add an app
- Find the app's sign-in provider in its code (Firebase, Supabase, Auth0, Clerk, Sign in with Apple, or another issuer).
syncpilled apps create --name "<name>" --firebase <project id> --json(or--supabase,--auth0 <domain> --audience <api>,--clerk,--apple <bundle id>,--issuer <iss> --audience <aud> --jwks-url <url>).- Note the
idit answers. Use separate apps for development and production builds.
Wire the iOS app
- Add the
SyncPilledSwift package: thesyncpilled-swiftfolder of the SyncPilled repository, as a local package. - Create
SyncPilledClient(baseURL:appId:issuerToken:)with the deployment's API address, the app id, and a closure returning a fresh sign-in token. - Write a
SyncDataSource:snapshot()returns every synced record asLocalRecord(collection, stable id, JSON data,updatedAt, files);apply(_:unchanged:)writes incoming records, callingunchangedfor each in the same step as writing it, and returns the keys written. - Call
engine.sync()at launch, on returning to the foreground, and after saves. On sign-out calltry await engine.forget()andawait client.resetSignIn(). - On
SyncPilledError.accountDeleted, forget and erase local data.
Rules to respect
- Collections are lowercase letters, digits and underscores.
- A record is at most 256 KB of JSON by default; a file at most 10 MB. A
larger record fails the whole push with
413, so keep records small. - Do not set per-person limits or allowed collections until the shipped app uses Swift package 0.2 or later: older clients stop syncing at a refusal.
- Deleting an app or a person (
--yes) erases data for good. Ask the developer first, every time.
Check it works
syncpilled stats <app> --json: people and records rise after a device syncs.syncpilled people list <app> --json: the test account appears.
API
Everything the CLI does is in the OpenAPI document at /openapi.json. Errors are
{ "error": { "code", "message" } }; 429 carries Retry-After.