Open-source manufacturing ERP, MES and QMS. Quoting, MRP, inventory, shop floor, quality and lot/serial traceability on one Postgres schema, with a REST API and MCP server. Self-host or use Carbon Cloud.
TypeScript ai-agentsbill-of-materialserpinventory-managementleanmanufacturingmanufacturing-execution-systemmcp-servermesmrpopen-source-erppostgresqlproduction-planningqmsquality-management-systemreact-routerself-hostedsupabasetraceabilitytypescript
Plaid Bank Feeds — Research Notes (Bank Reconciliation Phase 2)
Date: 2026-07-02 · Feeds spec:
.ai/specs/2026-07-02-plaid-bank-feeds.mdBuilds on.ai/research/bank-reconciliation.md(Part 2 had Plaid facts from model knowledge only — the deep-research verification pass died at a usage limit). This file re-verifies the load-bearing Plaid mechanics directly against plaid.com/docs (fetched 2026-07-02).
Verified Plaid API facts
/transactions/sync — docs
- First call: cursor null/empty → response carries
next_cursor; subsequent calls pass it. Cursor is ≤256 chars base64, valid ≥1 year after the final pagination page. - Response:
added/modified/removedarrays +has_more; loop withnext_cursoruntilhas_more = false. TRANSACTIONS_SYNC_MUTATION_DURING_PAGINATION: if the Item's data mutates mid-pagination, the entire loop must restart from the first cursor of the update — not just the failed page. ⇒ Persist the cursor only after a complete loop; buffer pages in memory (or staging) until then.- Pending:
pending: truerows; posted rows carrypending_transaction_idlinking back; the pending row later appears inremoved. Pending details may change before settlement. - Amount sign: positive = money OUT of the account (debit purchases positive; deposits negative) — invert at ingest for Carbon's positive-=-inflow convention.
transactions.days_requested: default 90, range 1–730 (production minimum 30), and cannot be changed after the Transactions product is active on the Item — the backfill window is fixed at link time.
Webhook verification — docs
- JWT arrives in the
Plaid-Verificationheader (treat header name case-insensitively).algMUST beES256— reject anything else. - Fetch the public key from
/webhook_verification_key/getusing the JWT header'skid; cache keys bykid. - Validate the body via the JWT claim
request_body_sha256against a SHA-256 of the raw body using a constant-time comparison; reject webhooks withiatolder than 5 minutes (replay protection).
Transactions webhooks — docs
SYNC_UPDATES_AVAILABLEis the only webhook a /sync integration needs. Payload:initial_update_complete(≥30 days ready),historical_update_complete(fulldays_requestedhistory ready).- It only starts firing after
/transactions/syncis called at least once on the Item ⇒ prime each Item with an immediate sync right after token exchange. - Legacy webhooks (
INITIAL_UPDATE,HISTORICAL_UPDATE,DEFAULT_UPDATE,TRANSACTIONS_REMOVED) still fire in some paths (e.g./transactions/refresh) — ignore them; act only onSYNC_UPDATES_AVAILABLE+ITEMwebhooks.
Link update mode (re-auth) — docs
- Create a link_token with the
access_tokenparam (noproductsneeded); user re-authenticates in Link. - Triggers:
ITEM_LOGIN_REQUIREDerror/webhook,PENDING_EXPIRATION(consent expires within 7 days),PENDING_DISCONNECT. - The access_token does not change — no re-exchange after update mode completes.
/link/token/create — docs
- Required:
client_name(≤30 chars),language,country_codes(ISO-3166-1 alpha-2),user.products: ["transactions"]. OptionalwebhookURL per Item.transactions.days_requestedset here (see above — immutable later).
Sandbox — docs
- Credentials
user_good/pass_goodat any sandbox institution. /sandbox/public_token/createbypasses the Link UI entirely — ideal for automated tests./sandbox/item/fire_webhooktriggers webhooks on demand (needs a reachable webhook URL)./sandbox/item/reset_loginforcesITEM_LOGIN_REQUIRED(tests the re-auth flow). Sandbox Items also auto-enterITEM_LOGIN_REQUIRED30 days after creation.
Carbon context (verified this session)
- Integration framework:
packages/ee/src/index.tsintegrationsarray; per-integrationconfig.tsx+hooks.server.ts(registered inpackages/ee/src/hooks.server.ts);companyIntegration(PK (id, companyId),metadataJSON,active); OAuth/webhook route precedentsapi+/integrations.xero.*/api+/webhook.xero.ts; Inngestsync-external-accounting+accounting-backfilljob precedents;trigger()mapping inpackages/lib/src/trigger.ts+ typed events inpackages/lib/src/events.ts; env viapackages/envgetEnv(integration hides itself when unset). companyIntegration.idFKs to anintegrationregistry table — check how Xero's row is seeded (migration vs runtime upsert) and mirror forplaid.- Vault: NOT verified. No
vault/pgsodiumreferences anywhere inpackages/database/supabase/migrations/orconfig.toml. The master spec's accepted decision (Plaid tokens in Supabase Vault) needs an environment probe (SELECT 1 FROM vault.secrets LIMIT 0) across local crbn stack, Docker deploy, and cloud before it's real. Fallback: app-layer AES-256-GCM with aPLAID_TOKEN_ENCRYPTION_KEYenv secret, same metadata shape (tokenCiphertextinstead oftokenSecretId). - Local-dev webhook reachability: portless
*.devis local-only — Plaid cannot deliver webhooks to a dev machine. Dev loop = manual "Sync now" + scheduled catch-up; webhook path testable against a deployed env (or tunnel) with/sandbox/item/fire_webhook. - Phase 1 already shipped (or ships) everything the feed lands on:
bankAccount(plaidItemId/plaidAccountId/connectionStatus/lastSyncedAt),bankTransaction(externalId unique per account,pendingExternalId,needsReview, Pending status),bankAccountBalance,run_bank_matchingRPC.
Design takeaways
- Cursor persistence is transactional-per-loop: never store
next_cursorfrom a partial loop (mutation restart rule). - Prime
/transactions/syncimmediately post-exchange or webhooks never fire. - Webhook route = pure verifier + dispatcher (JWT verify, dedupe, fire Inngest event); all real work in the job — Xero webhook precedent already works this way.
- Backfill window is a connect-time, per-Item, irreversible choice — surface it in the connect UI (90 default / 180 / 365 / 730).
- Re-auth = banner → update-mode link token → done (no re-exchange, no remapping).
- Sandbox supports fully automated e2e (public_token/create → exchange → sync → reset_login → update mode) without a browser Link flow.