Unclassified

Platform, Product, Data and Projection Reference

Status: Derived implementation reference — verification checkpoint, not a new architecture authority

Date: 2026-07-28
Authority: ARCHITECTURE_LOCK.md, as implemented by IMPLEMENTATION_CONTRACT_v1.1.md. Where this document conflicts with either, the canonical documents win.

1. Purpose and checkpoint

This is the single traceability reference for the question: do we have the tables, entity mappings, tenant/person model, connector expansion, storage split, projections, Product-to-Platform calls, and Workbench views required to operate IntegrateWise?

StateMeaning
DefinedFrozen or approved contract exists.
Implemented in repositoryMigration, package, route, or test is present.
Live verifiedApplied to the intended environment and proven by tenant-isolated acceptance tests.

The repository establishes much of the first two states. It does not prove that migration 035 has been applied to Neon, that all bindings are live, or that the complete flow has passed production acceptance. Those remain go-live gates. A static review also found that the migration creates governance_policies but later seeds spine_governance_policies; that name mismatch must be corrected and the full migration run in a disposable Neon-compatible database before it is treated as deployable.

2. The one data path

flowchart LR
    P["Product: Onboarding and Workbench"] -->|"Clerk session + semantic request"| G["Gateway"]
    G --> C["Configuration / Integration / Activation"]
    C --> X["Provider connector credential wall"]
    X --> L["Pipeline: load, normalize, promote"]
    L --> N["Neon Fortress: canonical Spine truth"]
    L --> R["R2: raw payloads, files, immutable evidence"]
    N --> PE["Projection Engine"]
    R --> PE
    PE --> D["D1 / KV: bounded runtime and cache"]
    PE -->|"SharedWorkbench contract"| G
    G --> P
    P -->|"intent only"| G
    G --> GOV["Governance → approval token → Hermes"]
    GOV --> X

The browser never uses a provider token, queries a provider model, or writes Neon directly. The Pipeline is the sole canonical Spine writer; Projection Engine is the sole SharedWorkbench composer.

3. Database and storage split

Store / boundaryWhat belongs thereAccess rule
Neon Fortress (canonical)Tenant identity/membership, connector metadata and connection records, canonical entities, relationships, provenance, work, governance, activation, events, sync, projection definitions and snapshots, audit, promoted outcomes.Gateway and internal Platform services only; canonical writes only through Pipeline promotion.
R2 evidence storeProvider raw payloads, uploads, attachments, documents, immutable evidence, large transcripts.References/hashes are held in Neon; access is policy-checked through Platform.
Vectorize / AI SearchEmbeddings and retrieval indexes.Retrieval aid only; never canonical truth.
D1 operational stateIdempotency, active context, edge-operational indexes, runtime state and bounded projection snapshots.Reconstructable from canonical services; never a business system of record.
KVShort-lived projection cache, sessions, connector health/status, invalidation keys.Time-bounded and invalidatable; never truth.
Provider / Nango credential wallTenant-scoped OAuth authorisation and secrets.Opaque reference only in Platform records; no credential reaches Product, MCP public tools, or AI prompts.

There is no separate customer database schema per tenant in the canonical design. Tenant-owned rows carry tenant_id, are resolved from the Clerk session by Gateway, and must be scoped in every query, write, cache key, event, and evidence reference.

3.1 Three clean environments

These are separate environments with separate credentials, bindings, data and
release controls. They are not three names for the same database or deployment.

EnvironmentPurposeAllowed data and identitiesPlatform and Product rule
DevelopmentEngineering build, local development, automated tests and disposable integration testing.Synthetic/test tenants, test provider applications and test credentials only.Engineers may use selected fixed development infrastructure. Product builds may be local, preview, Vercel or Netlify, but always call the Development Gateway—not a live data store.
Customer ZeroIntegrateWise's own real operational tenant; the first production-shaped operating environment.IntegrateWise people, work, consented real connections and real operational data under tenant iw-customer-zero.Uses the same production Platform contracts as customers, but its own tenant-scoped records, credentials, connector bindings, evidence and audit. It is never a shared test tenant and never a source of demo fallback.
Customer ProductionEach external customer's live operating environment.Only that customer's verified members, consented provider connections, canonical Spine data, evidence and governed actions.Customer chooses connectors and permitted capabilities through the tray. The customer does not choose or access Platform infrastructure, another tenant's data, Customer Zero credentials or development resources.

Non-negotiable separation

  1. Separate Cloudflare accounts/namespaces or explicitly isolated bindings for
    D1, KV, R2, queues, Vectorize, Durable Objects and Worker environment
    variables; no shared mutable test/production binding.
  2. Separate Neon databases or projects and separate migration ledgers for
    Development, Customer Zero and Customer Production. Customer Production may
    use one canonical production database only when tenant isolation is enforced
    end-to-end; it is still logically and operationally separate from Customer
    Zero.
  3. Separate Clerk instances/keys or clearly separate environments, OAuth
    provider applications/redirects, Nango connections, secret stores, webhook
    endpoints and DNS routes. A credential or webhook from one environment must
    be rejected by the others.
  4. Promotion direction is one-way: Development → Customer Zero validation →
    Customer Production release
    . Production data, credentials and connector
    bindings never flow back to Development.
  5. Product frontends can be deployed independently in Development and preview
    environments, but every environment targets only its matching Gateway. The
    Platform Fortress, Gateway, Spine, governance and credential wall remain
    Platform-owned services.

3.2 Published product name and packages

The public distribution identity is IW-Spine-Network.

The naming hierarchy is deliberately not a rename of the product:

IntegrateWise                         = product and company brand
IntegrateWise Workbench               = the user’s one operational surface
IW-Spine-Network                      = public distribution identity
IW-Spine-Network Plugin               = plugin marketplace/directory package
IW-Spine-Network MCP                  = MCP marketplace/registry package
IW Spine Tools                        = the public MCP technical interface
Continuity                            = a Workbench module and outcome

In product language: “IntegrateWise Workbench runs on
IW-Spine-Network.”
This preserves the frozen product name while giving both
distribution lanes one identity.

NameUse it forDo not use it for
IntegrateWiseCompany and full product brand.An internal engine-only or connector-only label.
IntegrateWise WorkbenchThe user-facing operational product surface.A distinct product that competes with or replaces IntegrateWise.
IW-Spine-Network PluginPlugin marketplace/directory listing that packages an MCP-backed app, focused interactive UI, workflow skills and optional templates.A claim that the plugin inherits every other host-app credential.
IW-Spine-Network MCPMCP marketplace/registry listing for the remote server, optional focused MCP App UI and browser Workbench launch.The internal MCP Pool.
IW Spine ToolsThe exact public, OAuth-protected 19-tool semantic MCP interface behind both packages.The marketplace artifact name or the 55-tool internal Pool.
ContinuityA Workbench product module and user outcome: retained, governed work context.The plugin or company/product name.
IW Continuity BridgeHistorical/superseded terminology only.Any new marketplace listing, UI label, endpoint, package or documentation title.

The marketplace listing should therefore read:

Plugin listing: IW-Spine-Network Plugin
Plugin experience: Embedded host control surface over the IW MCP app
MCP listing: IW-Spine-Network MCP
MCP experience: Remote 19-tool server + Open Workbench browser action
Technical interface: IW Spine Tools
Technical identifier: iw-spine-network

Plugin installation applies the Customer Zero-proven reference activation
profile to an isolated customer tenant. It does not share or copy the Customer
Zero tenant. The AI host can compose applications only when it exposes them and
the user/admin grants authority; persistent discovery requires an explicit host
delegation or IW connector binding.

4. Actual Neon Fortress schema inventory

migrations/035_canonical_spine_schema_fortress.sql contains 114 CREATE TABLE IF NOT EXISTS statements. It is the main consolidated schema candidate and defines the following functional groups.

DomainPrincipal tablesWhy they matter
Identity and tenancyspine_organizations, spine_workspaces, spine_users, spine_memberships, roles, permissions, role bindings, consent grants, API-key referencesSeparates person identity, membership, organisation, workspace and authority.
Configuration and activationplatform_config_layers, compiled configs, feature flags, entitlements, activation runs/steps, hydration plansMakes configuration and activation explicit Platform records.
Connector networkspine_connector_catalog, versions, installations, integration_connections, connection health, provider schemas, schema mappings, cursors, webhook endpointsHolds catalog-to-tenant installation-to-connection-to-schema lineage.
Canonical Spinetyped entity tables from 037_pure_entity_spine_tables.sql (spine_persons, spine_projects, spine_tasks, etc.), compatibility spine_entities, entity versions, spine_external_identities, relationships, relationship versions, provenance, evidence linksPure entity-family tables are the forward canonical model; spine_entities remains a compatibility path during cutover.
Schema expansionschema modules, versions, field definitions, relationship definitions, lifecycle definitions/transitionsEnables additive domain/entity expansion without hard-coding provider models into Product.
Work and operationswork items, decisions, approvals, notifications, timeline, calendar, meetings, calls, messages, threadsHolds tenant operational activity and governed decisions.
Projection and Workbenchprojection definitions, versions, bindings, field rules, view rules, capability bindings, snapshots, tuning profiles/eventsStores governed projection contracts and cached snapshot references—not UI-owned truth.
Capability and governancecapabilities, versions, provider/policy bindings, runs/steps/outcomes, policies, decisions, tokens, auditEnforces the approval-to-Hermes execution path.
Event, continuity and syncevent types/events/subscriptions/delivery, continuity, sync runs/mutations/conflicts/verificationsSupports the repeat and reconciliation portions of the pipeline.
Knowledge, memory, marketplace and MCPmemory, knowledge/evidence records, marketplace/MCP server and install recordsHolds policy-controlled references rather than exposing raw credentials or direct provider tables.

Person and entity rules

  • A product user is spine_users.user_id, linked to identity_subject (the Clerk subject), and gains tenant scope through spine_memberships.
  • A business person/contact/customer belongs in spine_persons, not as a second browser-user account. spine_entities may continue to mirror or bridge legacy runtime paths until typed-table cutover completes.
  • A provider record maps through spine_external_identities using the unique (connection_id, provider_object_type, external_id) identity. This prevents one provider object from being mistaken for a new entity on later syncs.
  • Canonical entity uniqueness is scoped by (tenant_id, workspace_id, entity_type, canonical_key). Relationships are tenant-scoped and point to canonical entity IDs.
  • Per-person and per-role views are projections, not copies of person data. A user’s membership, role, policy, permitted entities and current context determine the response.

5. Connector mapping and expansion algorithm

The catalog is global and read-only. A tenant obtains an operational connector only after the following resolution succeeds:

catalog connector
→ installation for tenant/workspace
→ provider consent and opaque credential reference
→ integration connection
→ provider-schema discovery
→ approved schema mapping to Spine entity types
→ initial sync and Pipeline normalization
→ canonical entity / relationship / provenance promotion
→ projection invalidation and activation
MappingCurrent implementation evidenceRequired semantics
Catalog → versionspine_connector_catalog, spine_connector_versionsProvider-neutral connector capability and compatibility contract.
Tenant/workspace → installspine_connector_installationsInstalled state and tenant-owned configuration.
Install → credential-backed connectionintegration_connectionsTenant, workspace, connector, external account and opaque credential-vault reference.
Connection → discovered object modelintegration_provider_schemasProvider object schema/version discovered under that connection.
Provider object → canonical entityintegration_schema_mappingsField transform and target Spine entity type.
Connection/object → cursor/webhook/synccursors, webhook endpoints, sync runs/mutations/conflictsIncremental change, provenance, reconciliation and health.

Expansion algorithm

  1. Gateway resolves Clerk identity, membership, active tenant and role; it never accepts these as an authoritative browser override.
  2. Integration Manager verifies the connector catalog entry and starts provider consent. Provider credentials become an opaque vault/Nango reference.
  3. Configuration Manager applies tenant policy, allowed scopes, selected domains and schema modules; Activation Hub creates the activation and hydration plan.
  4. The connector discovers provider objects and writes provider schemas. A versioned mapping translates provider fields to canonical entity types, fields and relationship definitions.
  5. Pipeline performs load → normalize → validation/triage → identity resolution → canonical promotion. It upserts the canonical entity and external identity, records relationship/provenance/evidence, and writes sync state.
  6. Projection Engine invalidates affected cache keys and recomposes only the permitted role/person/tenant projection. Stale, revoked or ambiguous connections are fail-closed and excluded from projections, Twin context, capability resolution and execution.

Known binding gap

The approved strict operational tuple is:

(user_id, account_id, tenant_id, provider_key, provider_workspace_id,
 connector_binding_id, spine_connection_id, schema_binding_set)

The repository documentation explicitly says that dedicated connector_bindings and connector_schema_bindings runtime migrations are Approved, not Implemented. Migration 035 supplies closely related installation, connection, provider-schema and schema-mapping records, but it does not replace the need to decide and implement the strict binding records before declaring tenant connector activation complete.

6. Projection canvas and product views

The Product is one Workbench. It consumes semantic projections rather than tables. The canonical SharedWorkbench contains tenant/workspace identity, role and domain, permitted entity groups, relationships, timeline, knowledge, signals, capabilities, governance decisions, available actions, Twin context, readiness and provenance.

View / canvasProjection inputsProduct response
Onboarding and activationidentity, organisation/tenant, configuration, connector install/health, hydration plannext required setup action, readiness and explicit failure state.
Role Workbench / operational canvaspermitted entities and relationships, work, timeline, signals, knowledge, readinessone role-specific shared operational surface.
Entity 360a selected canonical entity, its relationships, evidence, timeline, signals and permitted knowledgean evidence-backed person/account/work/entity view.
Organizational Memory / Company Wikipromoted organizational memory, knowledge documents, brainstorming sessions, policies, rituals, decisions, linked entities, evidence, timelinecompany front door and operating handbook surface, rendered as RBAC-scoped document-like pages, linked subpages and embedded views.
Integration Managerglobal catalog plus tenant installation, connection, schema, sync, webhook and health stateconnector tray, connect/reconnect/repair/pause/revoke flows.
Configuration Managerconfig layers, compiled config, policies, schema and role contextvalidated tenant configuration—not direct database editing.
Activation Hubactivation run/steps, hydration plan, connector readiness, schema coverageactivation progress and go/no-go reasons.
Governancedecision, proposal, policy, approval token and audit statereview/approve/reject; no direct provider action.
Network Graphs and Continuitycanonical entities, relationships, events, evidence, permitted memoryscoped graph and history views with provenance.

packages/projection-engine/ is the sole composer. apps/web contains projection consumers and view composition; it must not calculate alternative KPI truth or join provider-specific records in the browser.

7. Product-to-Platform API contract

All product calls go to the Gateway base URL. Current code has a split configuration (NEXT_PUBLIC_API_BASE_URL in the legacy Gateway client and NEXT_PUBLIC_IW_API_URL in the shared environment helper); release closure requires one public Gateway variable and removal of localhost fallback outside local development.

Product intentGateway contract familyPlatform workResponse to Product
Start onboardingPOST /api/v1/workspace/initializeresolve/create tenant-workspace contexttenant/workspace identifiers and next step.
Set role/domainPOST /api/v1/workspace/configure-domain, /configure-rbaccompile configuration and role policyaccepted configuration/version or field-level errors.
Open connector trayGET /api/v1/connectors/catalogread global catalog + tenant eligibilitypermitted connectors and install state.
Connect a providerGET /api/v1/connectors/{provider}/authorize; callbackconsent, credential wall, create connection/bindingredirect/connection state—never a provider credential.
Activate tenantPOST /api/v1/workspace/activate; hydrate connectorscreate activation/hydration work, schedule pipelineactivation state, coverage, readiness, actionable blockers.
Render WorkbenchGET /api/v1/workspace/projection/{department}resolve identity/policy, compose SharedWorkbenchversioned, scoped projection with provenance/freshness/degradation.
Render entity detailGET /api/v1/entity360/{entityId}assemble permitted entity projectionentity view with evidence and state.
Browse integrationsworkspace connector/status endpointsintegration health/schema/sync stateno secret material; repair/reconnect requirements.
Ask/assign Twinsemantic Twin/public MCP contractsread permitted context; draft onlygrounded response/draft; no action executed.
Approve actionapproval/proposal routegovernance → token → Hermes → connectorplan, approval state, execution receipt, then refreshed projection.

Every semantic response must contain (or be tied to) tenant scope, permission scope, version, freshness, provenance/evidence references and a clear partial or degraded state. Failed live access must not become demo/seed content.

8. Verification matrix and release checkpoint

CheckpointDefinedRepository evidenceLive verification still required
Fortress canonical schemaYesmigration 035 (114 tables)Correct the governance_policies / spine_governance_policies seed mismatch, run the full migration in a disposable Neon-compatible database, then apply to Neon and inspect schema/version.
Tenant/person/entity isolationYestenant IDs, membership tables, entity uniqueness and indexesCross-tenant negative tests and Clerk-to-tenant resolution tests.
Connector-to-Spine mappingYescatalog/install/connection/schema/mapping/sync tablesTenant OAuth, schema discovery, cursor/webhook, revocation and reconnection tests.
Strict connector binding tupleApproveddocumentation onlyImplement migrations and Gateway enforcement.
Projection canvasYesProjection Engine, contracts, web projection consumersPermission, freshness, invalidation and partial-evidence acceptance tests.
Product-to-Platform callsYesGateway client/onboarding and projection routesOne production Gateway base URL, auth, error and correlation tests.
DB storage splitYesimplementation contract and service boundariesVerify D1/KV/R2 bindings are isolated per environment and no direct Product DB path exists.
Governed actionsYescapability/governance schema and contractsapproval-token and Hermes-only end-to-end test with a non-destructive connector action.

9. Required evidence before testing-environment event

  1. Correct the migration-035 governance_policies / spine_governance_policies seed mismatch, run it in a disposable Neon-compatible database, then record a migration ledger showing it applied successfully to the named Neon environment with its migration version and table count.
  2. Implement and migrate the strict connector binding/schema-binding model, or explicitly ratify the migration-035 records as its replacement and update the binding decision accordingly. Do not leave both models ambiguous.
  3. Publish a tenant-isolation test report covering user, person entity, connector, projection, cache and evidence access.
  4. Demonstrate one real connector through consent → schema mapping → initial hydration → delta sync → canonical entity and provenance → Workbench projection → revoke/fail-closed.
  5. Demonstrate Product calls only the Gateway in the testing environment, with no localhost fallback, direct provider access or direct Neon path.
  6. Capture the shared Workbench contract and the actual rendered views for at least one role, one person/entity, Integration Manager, Activation Hub and Governance.

10. Primary repository anchors

  • migrations/035_canonical_spine_schema_fortress.sql
  • docs/architecture/IMPLEMENTATION_CONTRACT_v1.1.md
  • docs/wiki/12-connectors-integration-manager-and-spine-network.md
  • docs/wiki/07-projection-engine-and-shared-workbench.md
  • packages/projection-engine/
  • packages/contracts/src/projections/
  • services/gateway/src/projections.ts
  • apps/web/src/lib/onboarding-api.ts
  • apps/web/src/lib/gateway-client.ts