Current

IntegrateWise — Customer Zero and External Product Split Specification

Status: Current
Date: 2026-07-29
Authority: HERMES.md, ROUND_EXECUTION_SEQUENCE.md, IW_SPINE_NETWORK_PLUGIN_AND_MCP_MARKETPLACE_CONTRACT.md


1. Purpose

This document defines the canonical three runtime profiles for IntegrateWise:

  1. Dev Internal
  2. Customer Zero
  3. External Product

It specifies:

  • The three runtime profiles inside one codebase
  • The two frontend activation modes inside one app
  • The two marketplace lanes: Plugin marketplace vs MCP marketplace
  • How the platform repo maps to all profiles

2. Canonical Runtime Profiles

PathAudienceIsolationPurpose
Dev InternalIW engineersLocal workstation, full DB access, seed dataBuild, debug, prove end-to-end
Customer ZeroIW’s own production tenant (iw-customer-zero)Isolated tenant, isolated operational partitionProve the exact runtime shape external users will receive
Product to Users / External GTMExternal customersTenant-isolated shared Platform or dedicated deploymentPublic install/connect via Vercel/Cursor/MCP Directory/ChatGPT

Rule: The platform repo is the single source of truth for all three profiles. The split is runtime-context-driven, not branch-driven. Customer Zero is not a separate product; it is the reference activation profile. External users receive the same software, parameterized by tenant.


3. Repository Split Strategy

One repository, integratewise-live, serves all three profiles. The split is tenant/runtime-context-driven, not branch-driven.

integratewise-live/
├── services/
│   ├── gateway/
│   ├── spine/
│   ├── mcp-connector/
│   └── ...
├── apps/web/
├── packages/
├── marketplace/
├── docs/
└── migrations/

Rule: Every commit must be valid for all three profiles unless explicitly gated by tenant/context headers.

3.1 Single Codebase, Three Runtime Profiles

ProfileHow selectedTenantDataDeployment
Dev InternalLocal env / seed authLocal dev tenantLocal Neon or Docker Postgres; seed data allowedLocal Workers / turbo dev
Customer ZeroHeader x-tenant-id: iw-customer-zero or dedicated host customer-zero.integratewise.aiiw-customer-zeroReal isolated operational partition; real providers, real audit, real queuesCloudflare Workers + dedicated Neon database
External ProductHeader x-tenant-id: <external-tenant> or marketplace installation JWT<tenant-slug> generated at install/activationTenant-isolated data in shared schema; strict row-level isolationCloudflare Workers shared stateless deployment + shared Neon with RLS, or dedicated physical deployment if approved isolation policy requires

3.2 Feature/Config Gating

IF profile == Dev Internal
  → allow local seed data, local DB, full diagnostic routes, internal pool access
  → skip production-only gates
ELSE IF tenant == 'iw-customer-zero'
  → enable internal telemetry, raw diagnostic routes, debug surfaces, seed tools
  → allow internal-only connector bindings
ELSE IF profile == External Product
  → disable diagnostic routes
  → enforce 19-tool public contract only
  → enforce scoped OAuth
  → enforce approval-required governance

Implementation: Gate by tenant_id + request.origin + JWT aud. Do not branch code.


4. Frontend Split Strategy

apps/web is a single Next.js application with two runtime contexts.

4.1 Single App, Two Activation Modes

ModeTriggerURL patternBehavior
Customer ZeroLogin with @integratewise.ai email or x-tenant-id: iw-customer-zero/app/platformFull admin surfaces, internal connector tray, raw audit, seed data controls, 55-tool internal MCP pool visibility
External ProductMarketplace installation JWT or external email domain/app/platformReduced 19-tool surface, no internal diagnostics, no raw pool visibility, tenant-scoped projections only

4.2 Frontend Boundary Rules

  • Customer Zero frontend may call the full Gateway surface, including internal diagnostics, because the operator is IW itself.
  • External Product frontend must call only NEXT_PUBLIC_IW_API_URL and must never:
    • call databases directly
    • call providers directly
    • call Hermes directly
    • call the internal MCP Pool directly
    • infer architecture or reconstruct tenant state from URL/client hints
  • Both modes share the same PlatformShell.tsx, PlatformNav.tsx, and component tree. Differences are rendered by server-resolved identity/roles in /api/v1/workspace/discovery.

5. Marketplace Lane Definitions

5.1 Plugin Marketplace Lane

AttributeValue
Lane namePlugin marketplace / directory
Host environmentChatGPT, Codex, compatible AI hosts
Publication artifactNot a separate package
User experienceUser installs IW-Spine-Network from the MCP marketplace; ChatGPT renders a thin IW-created overlay UI inside ChatGPT
Control modelChatGPT is the operator; IW is the governed interface
Capability discoveryHost-composed + host-delegated + IW-direct, through supported host contracts
Credential inheritanceNever automatic; only explicit host delegation or direct IW connector binding
UI surfaceThin overlay widgets: active work/context, Spine status, approval confirmation, execution progress, Open Workbench
FallbackText/JSON if host does not support MCP App widgets

Rule: There is no IW-Spine-Network Plugin package published separately. The plugin-lane description in old docs is superseded.

5.2 MCP Marketplace Lane

AttributeValue
Lane nameMCP marketplace / registry / directory
Host environmentAny MCP-compatible client: Cursor, Windsurf, Claude Desktop, Vercel Agent Tools, custom clients
Publication artifactIW-Spine-Network MCP
User experienceUser connects the remote MCP server; browser Workbench launches for full control
Control modelUser operates through IW Workbench or host MCP client; IW governs all actions
Capability discoveryiw_direct primary; host composition/delegation if supported
Credential inheritanceNever; only explicit IW connector bindings
UI surfaceFull standalone browser Workbench
FallbackText/JSON guaranteed

Rule: This is the only published marketplace artifact.

5.3 MCP Marketplace → ChatGPT Special Case

When the MCP marketplace install flow appears inside ChatGPT:

  • ChatGPT remains the conversational controller
  • ChatGPT may render an IW-hosted overlay widget inside its sandbox
  • That widget is thin: evidence display, approval confirmation, progress
  • ChatGPT uses the widget to call IW tools; ChatGPT does not receive IW credentials, internal pools, or provider access
  • The underlying publication is still IW-Spine-Network MCP

6. Customer Zero Implementation

6.1 Definition

Customer Zero is IntegrateWise’s own production tenant, identified by tenant_id = iw-customer-zero. It is not a test tenant. It is not shared. It is the reference activation profile.

6.2 What Runs in Customer Zero

  • Full Cloudflare Worker stack: Gateway, Spine, MCP Connector, Intelligence, Knowledge, Hermes, Pipeline, Governance State, MCP Pool
  • Dedicated/isolated Neon operational data
  • Real provider connectors (initial set: GitHub, Notion, Slack, Salesforce, HubSpot, Jira, Confluence, Coda, Google Calendar, Google Drive, Asana, Monday, Zendesk, Intercom, Stripe, Snowflake, BigQuery, Postgres, MySQL, GitLab, OpenAI, Anthropic, Perplexity)
  • Real OAuth + Clerk identity
  • Real queue/DLQ/audit
  • Full 19-tool public MCP surface
  • Internal diagnostic surfaces exposed only to @integratewise.ai identities

6.3 Customer Zero Platform Repo Mapping

ComponentService/PathCustomer Zero Behavior
Gatewayservices/gateway/src/index.tsResolves iw-customer-zero tenant from Clerk JWT or trusted x-tenant-id; rewrites to internal Spine/MCP Connector; allows internal diagnostic routes
Spineservices/spine/src/neon-workbench.tsQueries dedicated Customer Zero Neon database; full workbench/activities/entities/knowledge/memories; no row-level tenant restriction beyond single-tenant DB
MCP Connectorservices/mcp-connector/src/continuity-bridge.tsExposes 19 public tools + internal 4 tools; createContinuityBridgeServer called with internal scope; diagnostic /v1/continuity-bridge/* routes active
Web Appapps/webFull admin UI, internal connector tray, raw audit, seed data, 55-tool internal MCP pool visible to IW staff
Platform Shellapps/web/src/components/platform/PlatformShell.tsxRenders all 12 surfaces including Governance with Twin rail, KPI strip, capability actions, full action strips
Marketplace Install/api/v1/marketplace/installations/*Customer Zero is pre-installed; installation state shows active
Workspace Discovery/api/v1/workspace/discoveryReturns Customer Zero workspace: all projections, all capabilities, all connectors, all approvals, all continuity

6.4 Customer Zero Activation Profile

Customer Zero is activated once, manually, by IW founders:

  1. Provision iw-customer-zero tenant in tenants service
  2. Create dedicated Neon database or schema with RLS bypass
  3. Bind Clerk org/team to iw-customer-zero
  4. Apply migration 035 + all subsequent migrations
  5. Seed initial connectors, connectors catalog, connector installations
  6. Enable internal MCP pool routes
  7. Set IW_CUSTOMER_ZERO=true in Worker environment
  8. Verify /api/v1/workspace/discovery returns full Customer Zero projection

After activation, Customer Zero is treated as a first-class production tenant.


7. External Product Implementation

7.1 Definition

External product is the same codebase and same workers, compiled and deployed for external tenants. No code fork. No separate frontend repo.

7.2 How It Differs from Customer Zero

AttributeCustomer ZeroExternal Product
Tenant IDiw-customer-zero (hardcoded allowed, but resolved from auth)Auto-generated at activation (tenant-<slug>)
Neon accessDedicated DB or schema; no RLS neededShared DB with strict RLS; row-level tenant isolation enforced on every query
MCP Connector19 public + 4 internal tools; diagnostic routes enabled19 public tools only; internal 4 tools return 403/404; diagnostic routes disabled
GatewayAllows internal routes; rewrites to internal MCP poolRewrites only to public Spine + public MCP pool; rejects internal paths
Web AppFull surfaces, internal tray, seed dataReduced surfaces; no internal tray; no seed data; no raw pool
MarketplacePre-installed; active stateInstall flow: OAuth → tenant creation → activation → active
DiscoveryReturns everythingReturns only permitted projections, capabilities, connectors, approvals, continuity for that tenant
ApprovalOptional for internal IW actorsMandatory for all governed actions
OAuth scopesFull internal scopes allowedStrict scoped OAuth; mcp:tools is not a blanket grant
TelemetryFull raw logs, internal metricsAggregated anonymized metrics; no internal stack traces

7.3 External Tenant Activation

External user installs IW-Spine-Network MCP from marketplace
→ OAuth handshake with Clerk
→ Gateway creates/activates tenant slug
→ tenants service records tenant, membership, roles
→ Activation applies Customer Zero-proven reference profile (same code path)
→ Spine creates tenant-scoped schema/rows in Neon
→ MCP Connector issues 19-tool scoped catalog
→ Browser Workbench launches at /app/platform
→ Host-compatible clients receive widgets through MCP App metadata

Rule: The same activateCustomerZeroProfile code path runs for external tenants. It is parameterized by tenant_id. Customer Zero just passes a fixed tenant_id.


8. Platform Repo Mapping

The platform repo (integratewise-live) owns all services, migrations, packages, marketplace definitions, and docs. It does not fork per lane.

8.1 Directory Ownership

DirectoryCustomer ZeroExternal Product
services/gateway/Full route table including internal; allows x-tenant-id: iw-customer-zero bypass for inter-service callsPublic route table only; rejects internal paths
services/spine/Full Neon queries; can cross tenant context for internal diagnosticsRow-level tenant isolation enforced in every query helper
services/mcp-connector/19 + 4 tools; diagnostic routes; internal scope map19 tools only; no diagnostics; strict public scope map
services/tenants/Pre-seeded iw-customer-zeroOnboarding API: create/activate/resolve tenant
services/governance-state/Full audit, approval, checkpointSame, scoped to tenant
apps/web/Full 12-surface PlatformShellReduced 12-surface PlatformShell; internal surfaces return 403
marketplace/apps/iw-spine-network.jsonSame manifest; debug metadata includedSame manifest; no debug metadata
docs/Full internal docsPublic docs subset
migrations/Applied once to shared or dedicated DBApplied to shared DB; RLS policies enforced

8.2 Runtime Branching

Branching inside the platform repo must be by tenant_id or request.origin, never by separate code paths.

// Example: gateway route gating
const isInternalTenant = tenantId === "iw-customer-zero";
const isInternalOrigin = request.headers.get("x-origin")?.includes("integratewise.ai");

if (!isInternalTenant && !isInternalOrigin && isInternalRoute(path)) {
  return new Response("Forbidden", { status: 403 });
}
// Example: mcp-connector tool gating
const publicTools = PUBLIC_CONTINUITY_BRIDGE_TOOL_DEFINITIONS; // 19
const internalTools = INTERNAL_CONTINUITY_BRIDGE_TOOL_DEFINITIONS; // 4

if (tenantId === "iw-customer-zero") {
  server.setRequestHandler(ListToolsRequestSchema, () => ({
    tools: [...publicTools, ...internalTools],
  }));
} else {
  server.setRequestHandler(ListToolsRequestSchema, () => ({
    tools: publicTools,
  }));
}

9. Frontend Duality

9.1 Customer Zero Frontend

  • Route: /app/platform
  • Auth: Clerk with @integratewise.ai approved domain
  • Surfaces: all 12 surfaces active
  • Capability actions: full set including internal connectors, seed data, diagnostic actions
  • Projections: full unfiltered
  • Marketplace: shows installation state; can re-activate/reset external tenants
  • Twin panel: full silent Twin surface with internal proposal types
  • Action strip: reply, reply all, archive, compose, assign Twin, store in Spine, propose action, approve action, run diagnostic

9.2 External Product Frontend

  • Route: /app/platform
  • Auth: Clerk with external email domain or marketplace JWT
  • Surfaces: all 12 surfaces present, but internal surfaces return empty or reduced view
  • Capability actions: only permitted capabilities for that tenant
  • Projections: tenant-scoped, RBAC-filtered
  • Marketplace: installation entry point only; no admin controls
  • Twin panel: Ask Your Twin, Assign Your Twin, Review Twin’s Work only
  • Action strip: reply, reply all, archive, compose, propose action (requires approval), approve action (if authorized), store in Spine

9.3 Server-Resolved Identity

The frontend must not infer lane from URL or client hints. It must call /api/v1/workspace/discovery first and let the server return:

{
  "actor": {
    "tenant_id": "acme-corp",
    "user_id": "user_123",
    "email": "user@acme.com",
    "roles": ["admin"],
    "lane": "external_product"
  },
  "workspace": { ... },
  "available_surfaces": ["dashboard","marketplace","governance","twin","continuity"],
  "available_actions": ["reply","reply_all","archive","compose","propose_action","approve_action","store_in_spine"],
  "internal_surfaces": false,
  "internal_actions": false
}

Frontend renders conditionally from available_surfaces, available_actions, internal_surfaces, internal_actions.


10. Deployment Model

10.1 Customer Zero Deployment

  • Workers: dedicated or tagged with IW_CUSTOMER_ZERO=true
  • Database: dedicated Neon database or schema
  • Domains:
    • gateway.integratewise.ai → Customer Zero Gateway
    • workbench.integratewise.ai → Customer Zero Workbench
    • marketplace.integratewise.ai → Customer Zero Marketplace
  • Auth: Clerk production org with @integratewise.ai domain
  • Secrets: Customer Zero secrets in Secret Store under CUSTOMER_ZERO_* namespace

10.2 External Product Deployment

  • Workers: shared stateless Platform Workers
  • Database: shared Neon with strict RLS
  • Domains:
    • gateway.integratewise.ai → public Gateway (routes to shared workers)
    • workbench.integratewise.ai → public Workbench
    • marketplace.integratewise.ai → public Marketplace
  • Auth: Clerk production org with external domains + marketplace JWT
  • Secrets: per-tenant secrets in Secret Store under TENANT_<slug>_*

10.3 Deployment Isolation Matrix

DimensionCustomer ZeroExternal Product
WorkersDedicated or taggedShared stateless
DatabaseDedicatedShared + RLS
Tenant IDiw-customer-zeroAuto-generated
Auth domain@integratewise.aiExternal domains + marketplace
Internal routesExposedHidden
55-tool poolVisibleHidden
Diagnostic APIEnabledDisabled
Seed dataEnabledDisabled
Marketplace statePre-installedInstall → activate

11. Tenant Isolation Enforcement

11.1 Database Isolation

  • Customer Zero: direct connection, no RLS needed
  • External Product: every query includes tenant_id = $1 as the first bind parameter; RLS policy USING (tenant_id = current_setting('app.tenant_id')::text) enforced at database level

11.2 Gateway Isolation

  • Gateway overwrites caller-supplied tenant headers with verified JWT tenant
  • Internal x-tenant-id: iw-customer-zero is accepted only from trusted origins
  • External requests cannot forge Customer Zero identity

11.3 MCP Connector Isolation

  • ContinuityBridgeActor.tenant_id derived from Gateway, never from client
  • Tool scope map enforced per tenant
  • Internal tools require internal profile or iw-customer-zero tenant

11.4 Frontend Isolation

  • Frontend receives tenant context only from /api/v1/workspace/discovery
  • Frontend never stores tenant_id in URL, localStorage, or client state without server round-trip
  • Frontend never infers capabilities from URL or component visibility

12. Capability and Action Surface

12.1 Customer Zero Capabilities

  • Read/write/delete on all entities
  • Internal connector management
  • Diagnostic queries
  • Seed data import/export
  • Raw MCP pool invocation
  • All 19 public tools + 4 internal tools
  • Capability actions: reply, reply all, archive, compose, propose, approve, store_in_spine, project_context, relay_state, handoff_agent, delegate_action, run_diagnostic, reset_tenant, seed_data

12.2 External Product Capabilities

  • Read on permitted entities
  • Write only through governed proposals
  • No raw MCP pool
  • 19 public tools only
  • Capability actions: reply, reply all, archive, compose, propose_action, approve_action, store_in_spine, ask_twin, assign_twin

12.3 Governance

  • Customer Zero: optional human approval for IW founders; internal actors can bypass with internal scope
  • External Product: human approval mandatory for all governed writes; no autonomous execution

13. Plugin Marketplace vs MCP Marketplace Summary

DimensionPlugin MarketplaceMCP Marketplace
Published artifactNot published separatelyIW-Spine-Network MCP
HostChatGPT, CodexAny MCP client + browser Workbench
UIThin overlay widgetsFull standalone browser Workbench
ControlChatGPT operates; IW governsUser operates through IW Workbench
DiscoveryHost composition + host delegation + IW-directIW-direct primary; host composition/delegation if supported
CredentialsNever inherited automaticallyNever inherited automatically
Tools exposed9-tool subset (chatgpt/claude/perplexity profile)19-tool public contract
ApprovalMandatoryMandatory
FallbackText/JSONText/JSON

14. Implementation Order for Claude Code / Claude Cowork

  1. Round 1 — P0 contract/code alignment (current commit: 495a0295)
  2. Round 2 — P0 infrastructure/auth: DNS/Clerk + single auth node + bindings audit
  3. Round 3 — P1 Plugin + MCP + discovery: build both artifacts, implement discovery origins
  4. Round 4 — P1 frontend/platform completion: enforce boundary, deploy discovery, remove direct calls
  5. Round 5 — P1 Customer Zero testing: clean install, clean connect, governed action cycle, Flow A/B/C/D, aging, reconciliation
  6. Round 6 — P2 publication: submit assets, Vercel native package, monitoring

Rule: Do not start Round 3 before Round 2’s auth/config prerequisites are committed. Do not start Round 5 before Round 4 is deployed to Customer Zero.


15. Acceptance Gates

GateEvidence required
P0 contract/codegrep -R "IW-Continuity-Bridge" returns zero hits in code; typecheck + mcp-connector + gateway tests pass
P0 infrastructure/authDNS resolves; Clerk JWT verifies; tenants service resolves iw-customer-zero; D1/KV/R2/secret bindings listed and present
P1 Pluginnpm run build succeeds; plugin OAuth flow completes in test; widget renders in host sandbox
P1 MCPserver.json validates; 19 tools listed; Open Workbench launch contract succeeds
P1 discoveryThree origins return distinct discovery payloads; duplicate detection works; credential scraping prevented
P1 frontend/api/v1/workspace/discovery deployed; no localhost fallback in production build; no direct DB/provider calls in frontend bundle
P1 Customer ZeroClean install into new tenant succeeds; exactly 19 public tools proven; governed action cycle end-to-end; Flow A/B/C/D proven
P2 publicationMarketplace listing live; Vercel native package installed; monitoring dashboard green