{"slug":"architecture/MCP_ADK_SPINE_CACHE_ARCHITECTURE","title":"MCP + ADK + Spine Cache — Universal Communication Architecture","section":"architecture","sectionLabel":"Architecture","status":"unclassified","type":"document","path":"architecture/MCP_ADK_SPINE_CACHE_ARCHITECTURE.mdx","bytes":26909,"description":null,"updated":null,"source":"integratewise/Integratewise-docs-wiki","content":"\n\n> **Tier C — Historical.** This document is a point-in-time snapshot preserved for reference. For current architecture, see [CANONICAL_PLATFORM_ARCHITECTURE.md](../architecture/CANONICAL_PLATFORM_ARCHITECTURE.md).\n\n## Executive Summary\n\nIntegrateWise provides **three distinct connectivity paths** all converging on the **Spine** (Cloudflare D1 + KV + R2 + Vectorize), enabling universal agent-to-agent communication regardless of runtime location or protocol:\n\n1. **Connector Path** — External tools (HubSpot, Jira, Slack, etc.) through standardized Loader/Normalizer/Spine ingestion\n2. **MCP-to-MCP Path** — Direct protocol communication between MCP-capable systems (AI clients, agents, tools)\n3. **ADK Agent Path** — Agent-to-agent communication via shared Spine Cache + Registry + Log Table\n\nAll three paths enforce the same governance principles: truth in the Spine, proposals before execution, audit everywhere.\n\n---\n\n## Architecture Overview\n\n```\n┌─────────────────────────────────────────────────────────────────────────┐\n│                         CONNECTIVITY LAYER                              │\n├──────────────────────────┬──────────────────────┬─────────────────────────┤\n│  Connector Path          │  MCP-to-MCP Path     │  ADK Agent Path         │\n│  (External Tools)        │  (Direct Protocol)   │  (Spine-based Comms)    │\n├──────────────────────────┼──────────────────────┼─────────────────────────┤\n│ • HubSpot (Nango)        │ • Notion (native MCP)│ • Notion Agent          │\n│ • Jira (Nango)           │ • Claude (MCP client)│ • Cloudflare Agent      │\n│ • Slack (Nango)          │ • ChatGPT (MCP)      │ • Hostinger Agent       │\n│ • Coda, Mintlify, etc.   │ • Direct MCP calls   │ • Custom agents (ADK)   │\n│ • 26+ providers          │   (no transform)     │ • Any runtime + MCP     │\n└────────┬─────────────────┴──────────┬───────────┴────────────┬───────────┘\n         │                           │                        │\n         │ Loader                    │ MCP Protocol           │ Spine Cache\n         ↓ Normalizer               ↓ (register in           ↓ Registry (D1)\n         │ Spine Write              │  Registry)             │ Log Table (D1)\n         │                          │                        │\n         └──────────────┬───────────┴────────────┬───────────┘\n                        ▼\n            ┌────────────────────────────────────┐\n            │         SPINE (Universal Truth)     │\n            ├────────────────────────────────────┤\n            │ D1: Canonical entities, audit logs │\n            │ KV: Spine Cache (shared context)   │\n            │ KV: SIGNAL_CACHE, METRICS          │\n            │ R2: Raw events, artifacts          │\n            │ Vectorize: Semantic search index   │\n            └────────────────────────────────────┘\n                        │\n         ┌──────────────┼──────────────┐\n         │              │              │\n         ▼              ▼              ▼\n    Entity 360      Memory Hydration  ADK Agent Comms\n    (Entity views)  (conversational,  (agent-to-agent\n                     org, personal)    message passing)\n```\n\n---\n\n## Path 1: Connector Path (Nango + API Wrappers)\n\n### Flow\n\n```\nExternal Tool → Nango Connector (OAuth) → API Wrapper → Loader\n    ↓\nNormalizer (8-stage LLM pipeline)\n    ↓ Strip tool-specific schema\n    ↓ Map to canonical business entities\n    ↓\nEntity Resolution (dedup, merge, link)\n    ↓\nSpine Writer (D1 + R2 lineage + KV cache update)\n    ↓\nSpine (canonical truth for that entity)\n```\n\n### Guarantee: \"No Bypass\"\n\n- ALL connectors (Nango providers AND custom API wrappers) MUST route through Loader/Normalizer/Spine\n- Direct writes to Spine bypassing normalization are strictly forbidden\n- Example: HubSpot deal → normalized to \"Opportunity\" entity with source lineage preserved\n\n### Supported Connectors (26+ providers via Nango)\n\n| Provider | Type | Status |\n|----------|------|--------|\n| HubSpot | Nango | ✓ Active |\n| Jira | Nango | ✓ Active |\n| Slack | Nango | ✓ Active |\n| Coda | Nango | ✓ Active |\n| Mintlify | Nango | ✓ Active |\n| Salesforce | Nango | ✓ Active |\n| Notion | Nango + MCP | ✓ Active (dual support) |\n| Linear | Nango | ✓ Active |\n| GitHub | Nango | ✓ Active |\n| Asana | Nango | ✓ Active |\n| Monday.com | Nango | ✓ Active |\n| Stripe | API Wrapper | ✓ Active |\n| Airtable | API Wrapper | ✓ Active |\n| [21+ others] | Mixed | ✓ Active |\n\n### Normalization Pipeline (8 stages)\n\n```\nStage 1: Parse       — Extract raw event schema\nStage 2: Validate    — Check against provider signature\nStage 3: Transform   — Apply provider-specific mappings\nStage 4: Denormalize — Convert to canonical schema\nStage 5: Enrich      — Add computed fields, infer relationships\nStage 6: Validate    — Verify canonical schema compliance\nStage 7: Dedup       — Check for duplicates in Spine\nStage 8: Promote     — Write to D1 with full lineage\n```\n\n### Lineage Tracking\n\nEvery entity preserves its origin:\n\n```json\n{\n  \"entity_id\": \"opp_abc123\",\n  \"entity_type\": \"Opportunity\",\n  \"canonical_value\": { \"name\": \"Acme Deal\", \"value\": 50000 },\n  \"source\": {\n    \"provider\": \"hubspot\",\n    \"event_id\": \"deal_xyz789\",\n    \"connection_id\": \"conn_hubspot_1\",\n    \"timestamp\": \"2026-06-19T14:30:00Z\",\n    \"raw_payload_ref\": \"s3://bucket/raw/hubspot/deal_xyz789.json\"\n  }\n}\n```\n\n---\n\n## Path 2: MCP-to-MCP Path (Direct Protocol Communication)\n\n### What is MCP?\n\n**Model Context Protocol** — Standard protocol for AI systems and tools to communicate structured data and function calls.\n\n- Standardized by Anthropic (open standard)\n- Supported by: Claude, ChatGPT (native), Notion, custom integrations\n- Enables: structured tool discovery, typed schemas, async function calls\n\n### MCP Endpoint in IntegrateWise\n\n**Deployed endpoint:** `https://mcp.integratewise.ai` (live June 9, 2026)\n\n**Authentication:** OAuth 2.0 RS256 JWT (scope-bound)\n\n**18 Exposed Tools:**\n\n| Tool Group | Tools | Access Level |\n|------------|-------|--------------|\n| `kb.*` | kb.search, kb.list, kb.get_context | Read-only |\n| `memory.*` | memory.propose, memory.list, memory.get | Propose-only (write restricted) |\n| `spine.*` | spine.query, spine.entity_360, spine.timeline | Read-only |\n| `signal.*` | signal.emit, signal.list, signal.correlate | Propose-only |\n| `proposal.*` | proposal.create, proposal.list, proposal.get_status | Propose-only (handoff) |\n| `search.*` | search.semantic, search.fulltext, search.entity | Read-only |\n\n### MCP Communication Flow\n\n```\nAI Client (Notion / Claude)\n    │\n    ├─ Discover MCP tools at mcp.integratewise.ai\n    ├─ Authenticate with OAuth JWT\n    └─ Call tool (e.g., kb.search)\n         │\n         ▼\n    IntegrateWise MCP-CONNECTOR Worker\n         │\n         ├─ Verify scope (e.g., \"kb:read\")\n         ├─ Authorize based on tenant + principal\n         └─ Delegate to backend service\n              │\n              ├─ kb.search → KNOWLEDGE service (Vectorize semantic search)\n              ├─ memory.propose → CONTINUITY service (memory write)\n              ├─ spine.query → D1 query (authorized subset)\n              └─ [... route to appropriate service ...]\n              │\n              ▼\n    Return typed response to AI client\n         │\n         └─ MCP-CONNECTOR logs call to Spine Log Table (comms audit)\n```\n\n### Key Property: Direct MCP-to-MCP Calls Bypass Normalizer\n\nWhen both endpoints support MCP natively:\n- ✅ No Loader/Normalizer transformation overhead\n- ✅ Direct protocol call (preserves fidelity)\n- ✅ Still logged in Spine Log Table (for audit + replay)\n- ✅ Still enforces authentication (OAuth JWT)\n- ✅ Still registered in agent Registry (for discovery)\n\nExample: Notion Agent calling Claude via MCP\n```\nNotion Agent\n    ├─ Reads Spine Cache (agent registry)\n    ├─ Discovers: \"Claude endpoint available, MCP-capable\"\n    └─ Direct MCP call → Claude\n         │ (no Loader/Normalizer)\n         │\n         └─ Claude responds with structured tool result\n              │\n              └─ Notion Agent writes outcome to Spine Cache + Log\n```\n\n---\n\n## Path 3: ADK Agent Communication (via Spine)\n\n### What is ADK?\n\n**Agent Development Kit** — Framework for building, deploying, and scaling multi-agent systems on Cloudflare Durable Objects.\n\n**Core components:**\n- Agent Registry (D1 table mapping agents to capabilities)\n- Spine Cache (KV shared context for agent communication)\n- Log Table (D1 communication history for sequencing + replay)\n- Agent Runtime (Cloudflare DO-based agent runtime with memory + tools + policies)\n\n### Agent-to-Agent Communication Substrate\n\nThree agents (Notion, Cloudflare, Hostinger) can coordinate via Spine:\n\n```\nAgent A (Notion)\n    │\n    ├─ Read Spine Cache (shared state)\n    ├─ Query Registry: \"Who handles coda_write?\"\n    ├─ Discover: \"Cloudflare Agent (id: agent_cf_1) handles coda_write\"\n    │\n    ├─ Write to Spine Cache: {\"request_id\": \"req_123\", \"type\": \"coda_write\", \"target\": \"agent_cf_1\"}\n    ├─ Write to Log Table: {sender_id, receiver_id, message_type, payload_ref, status: \"pending\"}\n    │\n    └─ Poll Log Table or subscribe to changes\n         │\n         ▼\nAgent B (Cloudflare)\n    │\n    ├─ Monitor Spine Cache (watch pattern)\n    ├─ Detect: \"New coda_write request in cache\"\n    │\n    ├─ Read full request from Spine Cache\n    ├─ Process (execute coda_write action)\n    │\n    ├─ Write result to Spine Cache: {\"request_id\": \"req_123\", \"result\": {...}, \"status\": \"completed\"}\n    ├─ Update Log Table: {status: \"completed\", result_ref}\n    │\n    └─ Notify Agent A (via cache watcher subscription)\n         │\n         ▼\nAgent A receives result from Spine Cache\n```\n\n### Spine Cache (KV): Shared Operational Context\n\n**What it stores:**\n- Agent state snapshots\n- In-flight request state\n- Shared signals and metrics\n- Capability registrations\n\n**TTL:** Configurable per use case (default: 24 hours)\n\n**Schema:**\n\n```typescript\n// Key pattern: agent:{agent_id}:state\n{\n  \"agent:notion_1:state\": {\n    \"status\": \"idle\",\n    \"last_heartbeat\": \"2026-06-19T14:35:00Z\",\n    \"capabilities\": [\"notion_read\", \"memory_propose\"],\n    \"current_task\": null\n  },\n  \n  // Key pattern: request:{request_id}\n  \"request:req_123\": {\n    \"sender_id\": \"agent_notion_1\",\n    \"receiver_id\": \"agent_cf_1\",\n    \"type\": \"coda_write\",\n    \"payload\": { \"page_id\": \"...\", \"content\": \"...\" },\n    \"status\": \"pending\",\n    \"created_at\": \"2026-06-19T14:30:00Z\",\n    \"result\": null\n  }\n}\n```\n\n### Registry (D1): Agent Routing Table\n\n**Table:** `agent_registry`\n\n```typescript\n{\n  agent_id: \"agent_cf_1\",\n  agent_name: \"Cloudflare Intelligence Agent\",\n  runtime: \"cloudflare_do\",\n  capabilities: [\"coda_write\", \"hubspot_update\", \"memory_propose\"],\n  endpoint: \"https://cf-agent.integratewise.ai/invoke\",\n  status: \"active\",\n  tenant_id: \"tenant_acme\",\n  updated_at: \"2026-06-19T14:35:00Z\",\n  health_check_interval: 60,\n  last_health_check: \"2026-06-19T14:34:00Z\"\n}\n```\n\n**Query patterns:**\n```sql\n-- Agent discovery: find all agents handling \"coda_write\"\nSELECT * FROM agent_registry \nWHERE tenant_id = ? \n  AND capabilities @> '[\"coda_write\"]' \n  AND status = 'active'\n\n-- Agent health: mark offline\nUPDATE agent_registry \nSET status = 'offline' \nWHERE agent_id = ? AND last_health_check < NOW() - INTERVAL 2 MINUTE\n\n-- Agent capability lookup\nSELECT capabilities FROM agent_registry \nWHERE agent_id = ? AND tenant_id = ?\n```\n\n### Log Table (D1): Communication History\n\n**Table:** `agent_communication_log`\n\n```typescript\n{\n  log_id: \"log_abc123\",\n  sender_agent_id: \"agent_notion_1\",\n  receiver_agent_id: \"agent_cf_1\",\n  message_type: \"coda_write\",\n  request_id: \"req_123\",\n  payload_ref: \"s3://bucket/comms/req_123.json\",\n  status: \"completed\",  // pending | completed | failed | timeout\n  result_status: \"success\",\n  tenant_id: \"tenant_acme\",\n  created_at: \"2026-06-19T14:30:00Z\",\n  completed_at: \"2026-06-19T14:30:15Z\",\n  duration_ms: 150,\n  error_message: null,\n  audit_id: \"audit_xyz789\"\n}\n```\n\n**Guarantees:**\n- ✓ Every agent-to-agent message is logged\n- ✓ Enables replay and debugging\n- ✓ Enables sequencing for eventual consistency\n- ✓ Enables SLA tracking (duration_ms)\n\n### Communication Patterns\n\n#### 1. Synchronous (Request-Response via Log Table)\n\n```\nAgent A: Write request to Log Table → status: \"pending\"\nAgent A: Poll Log Table for completion\nAgent B: Read log entry, process request\nAgent B: Update Log Table → status: \"completed\", result\nAgent A: Read updated log entry, get result\n```\n\n**Latency:** <500ms for local agents, <5s for distributed agents\n\n#### 2. Asynchronous (Fire-and-Forget via Spine Cache)\n\n```\nAgent A: Write signal to Spine Cache\nAgent A: Return immediately (no waiting)\nAgent B: Subscribe to Spine Cache pattern\nAgent B: Receive signal, process\nAgent B: Update Spine Cache with result (Agent A can check later)\n```\n\n**Use case:** Non-critical signals, batch processing\n\n#### 3. Pub/Sub (Broadcast via Spine Cache)\n\n```\nAgent A: Publish signal to Spine Cache pattern: \"signals:*\"\nAgent B, C, D: Subscribe to \"signals:*\"\nAll agents: Receive signal simultaneously\nEach agent: Process independently, write result to own state\n```\n\n**Use case:** System-wide signals, multi-agent coordination\n\n---\n\n## MCP Layer Deep Dive\n\n### Endpoint Architecture\n\n```\nExternal AI Client (Claude, ChatGPT, Notion)\n    │\n    └─ Connect to mcp.integratewise.ai\n         │\n         ├─ WebSocket (real-time streaming) OR\n         └─ HTTP/SSE (request-response)\n              │\n              ▼\n         MCP-CONNECTOR Worker (Cloudflare)\n              │\n              ├─ Parse MCP message\n              ├─ Extract tool call (kb.search, memory.propose, etc.)\n              ├─ Verify OAuth JWT token\n              ├─ Check tenant + scopes (authorization)\n              │\n              ├─ Route to appropriate backend service\n              │  ├─ kb.search → KNOWLEDGE (Vectorize semantic)\n              │  ├─ memory.propose → CONTINUITY (write to memory)\n              │  ├─ spine.query → D1 direct query\n              │  ├─ signal.emit → INTELLIGENCE (signal processing)\n              │  ├─ proposal.* → GOVERN (approval gate)\n              │  └─ search.* → KNOWLEDGE (hybrid search)\n              │\n              ├─ Collect response\n              ├─ Log to Spine Log Table (for audit)\n              └─ Return MCP-formatted response\n                   │\n                   └─ Back to AI Client\n```\n\n### Tool Categories\n\n#### Read-Only Tools (kb.*, spine.*, search.*)\n- No side effects\n- Can be called freely (within rate limits)\n- Example: `kb.search(\"How do we handle SaaS pricing?\")` → returns context\n\n#### Propose-Only Tools (memory.*, signal.*, proposal.*)\n- Write side effects but non-executable\n- Create artifacts in Spine (memory records, signals, proposals)\n- Require human-in-loop for execution\n- Example: `memory.propose({\"type\": \"decision\", \"content\": \"...\"})`\n\n#### Governance-Gated Tools (proposal.create via handoff)\n- Require approval before execution\n- Never execute directly; handoff to customer infrastructure\n- Example: `proposal.create({\"action\": \"update_hubspot_deal\"})` → returns approval_url\n\n---\n\n## ADK Layer Deep Dive\n\n### Agent Builder Framework\n\n```typescript\n// ADK Agent definition\nclass MyAgent extends ADKAgent {\n  capabilities = [\"notion_read\", \"memory_propose\", \"signal_emit\"]\n  \n  async initialize(context: AgentContext) {\n    this.registry = context.registry\n    this.spine_cache = context.spine_cache\n    this.memory = context.memory\n  }\n  \n  async execute(request: AgentRequest) {\n    // Read shared context from Spine Cache\n    const sharedState = await this.spine_cache.get(\"shared:state\")\n    \n    // Discover other agents\n    const agents = await this.registry.query({\n      tenant_id: this.tenant_id,\n      capabilities: [\"coda_write\"]\n    })\n    \n    // Invoke another agent via Log Table + Spine Cache\n    const result = await this.invoke_agent(agents[0].agent_id, {\n      type: \"coda_write\",\n      payload: { ... }\n    })\n    \n    // Propose memory (no execution)\n    await this.memory.propose({\n      type: \"decision\",\n      content: \"Selected Cloudflare agent for coda_write\"\n    })\n    \n    // Return proposal (never execute directly)\n    return {\n      action: \"...\",\n      explanation: \"...\",\n      confidence: 0.87\n    }\n  }\n}\n```\n\n### ADK Runtime (Cloudflare DO)\n\n**Lifecycle:**\n\n```\n1. Initialization\n   - Agent reads Registry (discover peers)\n   - Agent reads Spine Cache (load shared state)\n   - Agent registers itself in Registry\n\n2. Idle Loop\n   - Poll Log Table for new messages\n   - Monitor Spine Cache for signals\n   - Health check peer agents (mark offline if no heartbeat)\n\n3. Request Processing\n   - Receive message from Log Table or Spine Cache\n   - Execute agent logic (propose, don't execute)\n   - Write result back to Log Table / Spine Cache\n\n4. Shutdown\n   - Unregister from Registry\n   - Close Spine Cache subscriptions\n```\n\n### Agent Policies\n\n**Before execution, agents evaluate policies:**\n\n```\nPolicy: \"Cloudflare Agent can only invoke Notion Agent for read-only tasks\"\nPolicy: \"Memory proposals require confidence > 0.8\"\nPolicy: \"Signal emission limited to 100 per minute\"\nPolicy: \"Tenant isolation: agent_acme_1 can only access tenant_acme data\"\n```\n\n**Enforcement:** Built into ADK runtime (fail-safe deny by default)\n\n---\n\n## Governance & Execution Flow\n\n### The Hard Gate: \"Propose, Don't Execute\"\n\nAll three communication paths converge on **governance before execution**:\n\n```\nAgent Proposal\n    │\n    ├─ Routing through GOVERN worker\n    │\n    ├─ Evaluation:\n    │  ├─ Risk score calculation\n    │  ├─ Policy matching\n    │  ├─ Scope validation\n    │  └─ Tenant isolation check\n    │\n    ├─ Decision:\n    │  ├─ Auto-approve (low-risk, policy match)\n    │  ├─ HITL (human-in-the-loop required)\n    │  └─ Reject (high-risk, policy violation)\n    │\n    └─ If approved:\n         │\n         └─ Handoff Layer\n              │\n              ├─ Package proposal in canonical contract\n              ├─ Select target adapter (MCP, JSON, Zapier, etc.)\n              └─ Dispatch to customer execution environment\n                   │ (customer infrastructure, not IntegrateWise)\n                   │\n                   └─ Customer executes (they own execution)\n```\n\n**Non-negotiable:** No agent can bypass this gate. TenantBrainDO (per-tenant brain) enforces with 15-min alarm timeout.\n\n---\n\n## Scalability & Performance\n\n### Spine Cache Performance\n\n| Operation | Latency | Scale |\n|-----------|---------|-------|\n| Cache read (KV) | <10ms | 100K+ requests/sec |\n| Cache write (KV) | <10ms | 100K+ requests/sec |\n| Registry query (D1) | <50ms | millions of agents |\n| Log table insert (D1) | <20ms | millions of messages |\n| Semantic search (Vectorize) | <100ms | billions of embeddings |\n\n### Agent Communication SLA\n\n| Pattern | P50 Latency | P99 Latency | Notes |\n|---------|------------|------------|-------|\n| Local agents (same CF region) | <50ms | <200ms | via Spine Cache |\n| Distributed agents (cross-region) | <500ms | <2s | via Log Table + polling |\n| MCP direct call | <100ms | <500ms | no normalizer overhead |\n| Connector path (with normalizer) | <2s | <10s | 8-stage pipeline |\n\n---\n\n## Security & Multi-Tenancy\n\n### Tenant Isolation\n\n**Every query includes tenant_id scoping:**\n\n```\n// Registry lookup (tenant-scoped)\nSELECT * FROM agent_registry \nWHERE tenant_id = ? AND agent_id = ?\n\n// Cache key (tenant-scoped)\nKey: \"{tenant_id}:agent:{agent_id}:state\"\n\n// Log table (tenant-scoped)\nSELECT * FROM agent_communication_log \nWHERE tenant_id = ? AND created_at > ?\n\n// Memory access (RLS in Supabase)\nSELECT * FROM org_memory \nWHERE tenant_id = ? AND org_id = ? -- RLS enforces\n```\n\n### Authentication & Authorization\n\n**OAuth 2.0 RS256 JWT on all MCP calls:**\n\n```\nToken payload:\n{\n  \"sub\": \"user_abc123\",\n  \"aud\": \"mcp.integratewise.ai\",\n  \"scope\": [\"kb:read\", \"memory:propose\"],\n  \"tenant_id\": \"tenant_acme\",\n  \"iat\": 1718819400,\n  \"exp\": 1718823000\n}\n```\n\n**Scope binding:**\n- `kb:read` — Can call kb.search, kb.list, kb.get_context\n- `memory:propose` — Can call memory.propose (write to memory)\n- `spine:read` — Can call spine.query (subset of entities)\n- `signal:emit` — Can call signal.emit (emit signals)\n\n### Audit Trail\n\n**100% cloud-based logging (no local agent state):**\n\n```\n1. Agent communication logged to Log Table (D1)\n2. All MCP calls logged to MCP audit trail\n3. All governance decisions logged with reasoning\n4. All memory writes logged with source + principal\n5. Retention: 2 years (compliant with SOC2)\n```\n\n---\n\n## Deployment & Operations\n\n### Environments\n\n| Environment | Agents | Spine | MCP | Governance |\n|-------------|--------|-------|-----|-----------|\n| **dev** | Local + Cloudflare | D1 dev DB | localhost MCP | Auto-approve |\n| **test** | Cloudflare staging | D1 test DB | test.mcp.integratewise.ai | HITL simulated |\n| **prod** | Cloudflare prod | D1 prod DB | mcp.integratewise.ai | HITL real |\n\n### Monitoring & Observability\n\n**Metrics tracked:**\n\n```\nAgent metrics:\n- Registry query latency (p50, p99)\n- Spine Cache hit rate (%)\n- Log table write latency (p50, p99)\n- Agent health (active/offline/error)\n- Communication success rate (%)\n\nMCP metrics:\n- Tool call latency per tool (ms)\n- Authentication failures (count)\n- Scope violations (count)\n- Rate limit hits (count)\n\nGovernance metrics:\n- Proposal approval rate (%)\n- Average approval time (minutes)\n- Policy violations (count)\n- Execution success rate (%)\n```\n\n---\n\n## Example: Multi-Agent Workflow\n\n### Scenario: \"Automatically update HubSpot based on Coda document changes\"\n\n**Agents involved:**\n1. Notion Agent (reads document changes)\n2. Cloudflare Agent (handles HubSpot integration)\n3. Hostinger Agent (executes on customer infrastructure)\n\n**Flow:**\n\n```\n1. Notion Agent\n   ├─ Receives webhook: Coda document updated\n   ├─ Reads Spine Cache for current opportunities\n   ├─ Queries Registry: \"Who handles hubspot_update?\"\n   └─ Discovers: Cloudflare Agent (agent_cf_1)\n\n2. Notion Agent → Cloudflare Agent (via Log Table)\n   ├─ Write to Log Table: {type: \"hubspot_update\", target_id: \"opp_123\", data: {...}}\n   ├─ Poll Log Table for completion\n\n3. Cloudflare Agent\n   ├─ Monitor Log Table (watch pattern for messages to agent_cf_1)\n   ├─ Read message from Log Table\n   ├─ Prepare HubSpot API call\n   ├─ Create PROPOSAL (not execute yet)\n   └─ Write to Spine Cache: {request_id, proposal, status: \"pending_approval\"}\n\n4. Governance Gate (GOVERN worker)\n   ├─ Evaluate proposal\n   ├─ Decision: HITL (needs human approval)\n   └─ Return approval_url\n\n5. Human in L7 Approval Center\n   ├─ Review proposal with evidence\n   ├─ Click \"Approve\"\n   └─ Governance marks as approved\n\n6. Handoff Layer\n   ├─ Package approved proposal in canonical contract\n   ├─ Select adapter: MCP (Hostinger supports MCP)\n   └─ Dispatch to Hostinger Agent\n\n7. Hostinger Agent (customer infrastructure)\n   ├─ Receive handoff package\n   ├─ Execute HubSpot API call (in their environment)\n   ├─ Capture outcome\n   └─ Send outcome back to IntegrateWise\n\n8. Outcome Ingestion (Return Loop)\n   ├─ Receive: {status: \"success\", hubspot_id: \"deal_456\"}\n   ├─ Update Spine: Mark opportunity as synchronized\n   ├─ Update Memory: Log successful action\n   ├─ Update Graph: Record entity relationship\n   └─ Notify all agents via Spine Cache (broadcast signal)\n\n9. All agents\n   ├─ Subscribe to Spine Cache for outcome signal\n   ├─ Read final state from Spine\n   ├─ Update their models based on new ground truth\n   └─ Ready for next workflow\n```\n\n**Result:** Universal agent coordination with no vendor lock-in, full governance, complete audit trail.\n\n---\n\n## Key Invariants (MCP + ADK + Spine Cache)\n\n1. **One Spine, Many Agents** — All agents share same D1 source of truth\n2. **Registry is the Discovery Mechanism** — Agents find each other via Registry, not hardcoded\n3. **Log Table is the Communication Bus** — Every agent-to-agent message recorded for audit + replay\n4. **Spine Cache is Shared State** — Agents read/write operational state, not private memory\n5. **No Bypass, No Exception** — All proposals flow through governance gate (fail-safe deny)\n6. **Tenant Isolation on Every Query** — Every D1/KV access scoped by tenant_id (no data leakage)\n7. **Audit Everything** — All MCP calls, registry lookups, cache reads/writes logged\n8. **Eventual Consistency** — Agent state converges through polling Log Table + Spine Cache subscriptions\n\n---\n\n## Conclusion\n\n**MCP + ADK + Spine Cache** together enable:\n\n✓ **Universal Communication** — Any agent (Notion, Cloudflare, Hostinger, custom) can communicate with any other  \n✓ **Zero Vendor Lock-in** — Standard protocols (MCP, OAuth) + Spine as neutral ground truth  \n✓ **Full Governance** — All execution gated through HITL approval before reaching customer infrastructure  \n✓ **Complete Observability** — 100% audit trail (no local agent state, everything in cloud)  \n✓ **Scalable Architecture** — Millions of agents, billions of messages, no single point of failure  \n\nThe Spine is the universal substrate. MCP + ADK are the connective tissues. Governance is the hard gate. Together, they enable an open, auditable, secure multi-agent operating system.\n"}