Build a Custom Memory Connector That Can Recover from Failure

A custom connector needs more than a fetch-and-upload loop. It needs stable source identity, revision ordering, recoverable progress, permission handling, and a deletion path. Those properties determine whether a later retry repairs the pipeline or corrupts its view of the source.
Start with one source collection and a documented acceptance contract. Keep source-specific fetching separate from the memory provider's ingestion adapter.
Define the source envelope
For each record, retain the source system, collection, record ID, revision, relevant timestamps, permitted scope, and content or a fetch reference. The envelope is an application design, not a claim that every provider accepts identical fields.
A source revision and an ingestion attempt ID serve different purposes. The revision identifies the content state; the attempt identifies a delivery. Retrying a delivery should not invent a new source object.
Commit progress after durable acceptance
A sync cursor tells the next run where to continue. Advance it only after the batch reaches the durable checkpoint you have defined. If a worker crashes after advancing the cursor but before recording the writes, the next run can silently skip records.
Keep rejected records visible with reasons. Do not block the entire sync forever on one malformed item, but do not mark that item successfully processed merely because the loop continued.
Reconcile revisions and removals
Reject or ignore late older revisions according to the source's ordering rules. Carry removal events through derived records and caches within the promised lifecycle. If the source loses access to a document, decide whether the connector should remove it or mark it unavailable.
Periodically compare the source inventory with accepted records. Event feeds can have gaps, and a reconciliation path is useful even when ordinary delivery uses webhooks.
Test the unpleasant sequence
Use a fixture containing a duplicate event, an older revision delivered late, a deleted record, a permission change, and a crash between acceptance and cursor commit. Verify the final record set and the ability to resume without manual repair.
Supermemory's document operations define its management interface. Combine them with the ingestion architecture guide, then test one custom source with Supermemory before expanding the connector's scope.