Skip to content

Nacre connectors

Reference connectors that keep a source in sync with a Nacre index: a document the source has is in the index, a document the source changed is changed, a document the source dropped is removed. Each is one container, built from this repository, configured entirely through its environment.

They are a simplification, not the way in. Nacre takes documents pushed over its API, MCP, SDK or CLI, and the customer owns the sync; a connector is that sync written once for a source many customers have. Apache 2.0, like the core.

connector source image
git the text files of a git repository, a path rule per layer ghcr.io/nacre-work/connectors/git
s3 the objects of a bucket — AWS, MinIO or any S3-compatible store — a key rule per layer, files as files ghcr.io/nacre-work/connectors/s3
sql the rows a query returns — Postgres, MySQL or MariaDB — a template over the columns per layer, a watermark or the row's hash as its version ghcr.io/nacre-work/connectors/sql
drive a Google Drive folder, recursively, or a shared drive — a path rule per layer, native files as files, a Google Doc as the Word file it exports to ghcr.io/nacre-work/connectors/drive
mongo the documents a filter matches in a MongoDB collection, a template over the document's fields per layer, text only ghcr.io/nacre-work/connectors/mongo
imap the messages of a mailbox folder, a template over the headers per layer, attachments as files ghcr.io/nacre-work/connectors/imap

Every image is also on Docker Hub as nacrecontextlayer/connector-<name>, pushed by the same build at the same version. ghcr.io is the canonical address — Docker Hub rate-limits pulls by account, and nothing here reads the mirror back.

Every connector

Reads these, whatever its source. Refuses to start on a missing or malformed one, naming it — a connector that syncs nothing and reports success is the failure every rule here is against.

variable meaning default
NACRE_URL The API's base URL, e.g. https://nacre.example.com required
NACRE_TOKEN A service account key holding write on every layer the connector maps to. write does not imply read, and the connector needs no read: it never searches required
CONNECTOR_STATE The SQLite file remembering what was sent, in a volume /state/connector.sqlite
SYNC_INTERVAL Seconds between sweeps, at least 10 300
SYNC_ONCE true runs one sweep and exits; the exit code is the sweep's verdict — 0 when everything went, 1 when the listing broke off or a document failed, 75 when the index asked to wait (below). A source that leaves a connection open after the sweep does not keep the process alive: five seconds after the verdict it logs exiting with handles still open and exits with that verdict false
PORT Where /healthz, /status and /metrics answer 9400

A sweep is a complete listing of the source. What it lists is added or changed as its content hash decides; what a complete listing did not contain is removed. A listing that breaks off removes nothing — the half it never reached has not been called gone. That is the one property the state exists to hold, and it is the first thing the suite checks.

When the index has no room, a document is held back rather than failed. The core limits how fast a caller and an organization may send — 600 documents an hour per organization by default — and answers past that with 429 and how long until there is room. A first sync of a large source meets it every time. A wait of a minute or less is sat through and the same document is sent again; a longer one pauses sending for the rest of the sweep. The listing still runs to the end, so removal is still decided by a complete listing, and a document already in the index whose change was held back is kept rather than removed. Nothing about a held-back document is remembered, so the next sweep sends it — or this one does, if the wait runs out before the listing does. The sweep's log line says deferred and resume_at, /status and /metrics count it apart from failed, and a one-shot run exits 75 (EX_TEMPFAIL, "try again later"): not 0, because the index is not yet what the source says, and not 1, because nothing is wrong. The fix for a sync that keeps deferring is a higher limit for the organization, which is the operator's to set, or patience.

Every document carries metadata.connector and metadata.source, so a search can be narrowed to what one connector brought, and a layer's directory can say where a document came from.

Observing one

GET /status is a versioned contract — contract: 2 — with the last sweep's counts, running totals, the layers touched and the source with its credential stripped. 2 added deferred and resumeAt to the sweep and deferred to the totals; every key 1 carried is still there under its name. GET /metrics is the same in Prometheus's shape, every name prefixed nacre_connector_. Both are unauthenticated on purpose: nothing in them is a secret and the port is the operator's network. There is no dashboard here; a Grafana over /metrics is the intended one, and a fleet view is a separate product's.

Developing

pnpm install
pnpm build && pnpm typecheck && pnpm lint && pnpm test
pnpm lint:cla         # CLA.md and the cla gate are the core's, byte for byte
pnpm lint:config      # every variable read is documented, every one documented is read
pnpm lint:core-pin    # the live stack runs the core the kit's SDK is written against
pnpm lint:images      # every connector has an image, a README, and is in the release
pnpm lint:workflows   # the aggregate and the workflows run the same gates
bash scripts/ci/live.sh git   # the three verbs against a real Nacre, in Docker

The unit suite proves the engine's arithmetic against a fake index. The live run proves what the real index does with it — a connector is not written until live.sh has watched its add, its change and its removal arrive in a search.

Contributing

Apache 2.0, and contributions are covered by the same Contributor License Agreement as the core — CLA.md, signed by a pull request adding you to .github/cla/signatures.json. CONTRIBUTING.md has the procedure.

Releases

Packages

Used by

Contributors

Languages