{"slug":"internal/operations/INTEGRATEWISE_RECOVERY_PLAN","title":"IntegrateWise Recovery Plan","section":"internal","sectionLabel":"Internal","status":"unclassified","type":"document","path":"internal/operations/INTEGRATEWISE_RECOVERY_PLAN.mdx","bytes":19069,"description":null,"updated":null,"source":"integratewise/Integratewise-docs-wiki","content":"\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## Restore the Human Layer First (June 26, 2026)\n\n---\n\n## Executive Summary\n\nThe product drifted from **human-centric** (Jan 2025) to **AI-centric** (current). The fix: Restore the Human Workbench as the PRIMARY product, with AI as invisible infrastructure underneath.\n\n**Execution Timeline:**\n1. **NOW (Phase 1)**: Deploy restored Human Workbench\n2. **Week 1 (Phase 2)**: Customer Zero connects real tools (Gmail, Slack, GitHub, etc.)\n3. **Week 2 (Phase 3)**: Spine Schema evolves from actual usage patterns\n4. **Week 3 (Phase 4)**: AI Workbench builds its own environment separately\n\n---\n\n## Core Architecture\n\n```\n┌─────────────────────────────────────────────────┐\n│         HUMAN WORKBENCH (PRIMARY)               │\n│  (Dashboard, Contacts, Companies, Tasks, etc.)  │\n│                                                 │\n│    What users spend 8 hours a day in            │\n└─────────────────────────────────────────────────┘\n                       ↑\n            ┌──────────┴──────────┐\n            ↓                     ↓\n    ┌──────────────────┐  ┌──────────────────┐\n    │  AI Workbench    │  │ Collaboration    │\n    │  (Twin's Home)   │  │ Overlay          │\n    │                  │  │ (Questions,      │\n    │ • Observations   │  │  Reviews,        │\n    │ • Memory         │  │  Approvals)      │\n    │ • Routines       │  │                  │\n    │ • Recommendations│  └──────────────────┘\n    └──────────────────┘\n                       ↓\n    ┌─────────────────────────────────────────────────┐\n    │       CONTINUITY ENGINE (Always IW)             │\n    │  • Spine Schema (Canonical Truth)               │\n    │  • Shared Memory (Org, Work, Personal, AI)      │\n    │  • Entity360 (Unified View)                     │\n    │  • Auth & Governance                            │\n    └─────────────────────────────────────────────────┘\n                       ↓\n    ┌─────────────────────────────────────────────────┐\n    │    AI INFRASTRUCTURE (Invisible)                │\n    │  • MCP Routing                                  │\n    │  • ADK (Tool Discovery)                         │\n    │  • Multi-Model Orchestration                    │\n    │  • Reflection & Memory Promotion                │\n    │  • Voice & Multimodal                           │\n    └─────────────────────────────────────────────────┘\n                       ↓\n    ┌─────────────────────────────────────────────────┐\n    │    CONNECTED APPLICATIONS (100+)                │\n    │  Gmail • Slack • GitHub • Figma • Notion •      │\n    │  Salesforce • HubSpot • Linear • Drive •         │\n    │  WhatsApp • Calendar • CRM • and more...        │\n    └─────────────────────────────────────────────────┘\n```\n\n---\n\n## Phase 1: Restore the Human Workbench (IMMEDIATE)\n\n### Current Status\n- ✅ Backend services stable (Auth, Gateway, Intelligence, Knowledge, Connector)\n- ✅ Real Customer Zero infrastructure exists (tenant: `iw-customer-zero`)\n- ✅ Frontend foundation present (shell, L1 domains, L2 overlay)\n- ⚠️ Frontend has experimental files that need cleanup\n- ❌ Human surfaces not the primary focus (currently AI-first)\n\n### Actions (IMMEDIATE)\n\n**1. Clean up v0's Experimental FE Files**\n```bash\n# Remove experimental components that conflict\nrm components/l1/entity-stretch.tsx\nrm -rf components/l1/domains/customer-zero/\nrm pages/Metrics.tsx  # v0's founder ops; flag for Replit reconciliation\n```\n\n**2. Verify Backend Contract**\n```bash\n# All critical backend services present:\n✓ Auth: ALLOW_PASSWORD_AUTH gateway (gateway/src/auth.ts)\n✓ Services: intelligence, connector, knowledge (gateway/wrangler.toml)\n✓ Twin: /v1/chat/completions (intelligence/src/index.ts)\n✓ Knowledge: Queue consumers + hourly cron (knowledge/wrangler.toml)\n```\n\n**3. Deploy to Preview / Production**\n```bash\n# Deploy the cleaned-up Dashboard\n# This is the restored Human Workbench with existing L1/L2 intact\n# URL: https://v0-integrate-wise-operating-system-9gg7ctap4-integratewize.vercel.app/dashboard\n```\n\n**4. TypeScript Verification**\n```bash\ntsc --noEmit\n# Expected: 0 errors (after removing experimental files)\n```\n\n---\n\n## Phase 2: Customer Zero Uses the Workbench (Week 1)\n\n### Customer Zero Initial Setup\n\n**User: Nirmal Prince**\n- Organization: IW Customer Zero\n- Tenant ID: `iw-customer-zero`\n- Role: Founder (full access)\n\n### Surfaces to Activate\n\n**Human Workbench Surfaces** (These exist, ensure they're functional):\n- ✅ Dashboard (overview, metrics, quick actions)\n- ✅ Accounts (contact info, preferences)\n- ✅ Contacts (people, relationships)\n- ✅ Companies (prospects, customers, partners)\n- ✅ Opportunities (deals, pipeline, status)\n- ✅ Tasks (personal, team, recurring)\n- ✅ Calendar (meetings, events, sync)\n- ✅ Notes (quick capture, scratch pad)\n- ✅ Meetings (recording, summary, action items)\n- ✅ Communications (email, messages, history)\n- ✅ Documents (files, shared, versions)\n- ✅ Knowledge (FAQs, processes, learnings)\n- ✅ Goals (quarterly, tracking, alignment)\n- ✅ Values (principles, culture, decision rules)\n- ✅ Reports (custom, scheduled, dashboards)\n- ✅ Settings (preferences, integrations)\n\n**Actions for Customer Zero:**\n\n1. **Connect Real Tools** (one by one)\n   ```\n   Week 1:\n   - Gmail (primary email, calendar)\n   - Slack (team communication)\n   - GitHub (projects, code, releases)\n   - Calendar (meetings, availability)\n   \n   Week 2:\n   - Figma (design work)\n   - Notion (documentation)\n   - HubSpot (leads, sales)\n   - Linear (task management)\n   \n   Week 3:\n   - Salesforce (CRM)\n   - Drive (file storage)\n   - WhatsApp (personal comms)\n   - and more as needed\n   ```\n\n2. **Use the Workbench Naturally**\n   - Work across surfaces as part of daily routine\n   - See how context flows between tools\n   - Notice what information is lost/duplicated\n   - Provide feedback on each surface\n\n3. **Spine Schema Evolves**\n   - As Customer Zero connects Gmail → captures email as Continuity Entity\n   - As they use Slack → captures conversations as Memory\n   - As they view GitHub → captures projects as Spine Nodes\n   - Schema grows organically from actual usage\n\n---\n\n## Phase 3: Spine Schema Enhancement (Week 1-2, Parallel)\n\n### What the Spine Schema Tracks\n\nAs Customer Zero works, the Spine learns:\n\n**Entities:**\n```\nPerson\n  ├─ name, email, role, org\n  ├─ relationships (manages, reports-to, collaborates-with)\n  └─ memory (notes, preferences, history)\n\nOrganization\n  ├─ name, industry, size\n  ├─ teams, departments\n  └─ goals, values, culture\n\nWork Item (Task, Issue, Deal, etc.)\n  ├─ title, status, priority\n  ├─ owner, team, deadline\n  ├─ relationships (blocks, depends-on, related-to)\n  └─ history (created, updated, assigned, closed)\n\nCommunication (Email, Message, Meeting)\n  ├─ participants, timestamp, content\n  ├─ entities mentioned (people, companies, projects)\n  └─ action items extracted\n\nDocument (File, Note, Decision)\n  ├─ content, metadata, versions\n  ├─ ownership, access, sharing\n  └─ relationships (references, citations)\n```\n\n**Relationships:**\n```\nalice works-for company-acme\ncompany-acme has-team engineering\nalice owns task-mobile-app\ntask-mobile-app blocks task-api-gateway\nalice received-email from bob\nemail-12345 mentions company-acme, project-x\n```\n\n**Memory:**\n```\nOrg Memory:\n  • ACME's Q4 goal: 500K ARR\n  • All PRs require 2 reviewers\n  • Deployment: Fridays only\n  • Security: 2FA mandatory\n\nWork Memory:\n  • Alice owns mobile app\n  • Bob leads backend team\n  • Q4 roadmap: auth, payments, analytics\n\nPersonal Memory (Nirmal):\n  • Prefers async communication\n  • Reviews code Friday mornings\n  • Coffee 1:1s every Monday\n```\n\n### Spine Evolution Process\n\n**Week 1:**\n- Customer Zero connects 4 apps (Gmail, Slack, GitHub, Calendar)\n- Spine stores 50+ base entities, 200+ relationships\n- Memory captures first org principles and work patterns\n\n**Week 2:**\n- Customer Zero connects 5+ more apps\n- Spine now tracks 150+ entities, 500+ relationships\n- Memory enriched with work practices, communication patterns\n\n**Week 3:**\n- Full integrations show data normalization\n- Spine handles duplicates, merges, and conflicts\n- Schema validated against real work patterns\n\n### Spine Schema Delivery (to Replit/Backend Team)\n```\nDeliverable: Spine-Schema-v1.0-CustomerZero.json\n├─ Entity Types (20+)\n├─ Relationship Types (40+)\n├─ Memory Scopes (Org, Work, Personal, AI)\n├─ Governance Rules (Access Control)\n└─ Continuity Rules (Entity Linkage)\n\nThis becomes the canonical schema for all future customers.\n```\n\n---\n\n## Phase 4: AI Workbench Builds Its Own Home (Week 2-3, Parallel)\n\n### Why AI Needs Its Own Workbench\n\n- **Not idle**: AI continuously observes, learns, reflects\n- **Daily routines**: Health checks, memory consolidation, recommendations\n- **Persistent memory**: Learnings carry across sessions\n- **Autonomous work**: Drafts, summaries, coordination\n- **Human-separate**: AI operations don't interrupt human work surface\n\n### AI Workbench Surfaces\n\n**AI Observations** (What Twin sees):\n```\nToday's Activity:\n  • 12 emails received (3 action-required)\n  • 4 Slack channels active (2 mentions)\n  • 2 GitHub PRs waiting review\n  • 1 calendar conflict (meeting overlap)\n  • 3 tasks past deadline\n\nPatterns Detected:\n  • Alice: Working late (emails at 11pm)\n  • Bob: High context switching (7 different projects)\n  • Team: Needs API documentation\n```\n\n**AI Memory** (Persistent across sessions):\n```\nLearned Facts:\n  • Deployment always Friday (not Wednesday)\n  • Alice's code style: 2-space indent\n  • Team needs async standup by 9am\n  • Customer X has payment issues (recurring)\n\nRecommendations Prepared:\n  • Move meeting to avoid conflict\n  • Follow up on overdue tasks\n  • Review PRs waiting >2 days\n  • Summarize Slack discussion\n```\n\n**AI Routines** (What Twin does daily):\n```\n6:00 AM:\n  ├─ Review overnight emails\n  ├─ Check Slack for urgent messages\n  ├─ Read new GitHub issues\n  └─ Consolidate overnight facts into memory\n\n8:00 AM (Daily Standup Time):\n  ├─ Prepare team summary\n  ├─ Highlight blockers\n  ├─ Flag deadlines\n  └─ Surface recommendations\n\n5:00 PM (EOD):\n  ├─ Summarize day's activity\n  ├─ Extract learnings\n  ├─ Flag follow-ups\n  └─ Prepare next day preview\n\nOngoing:\n  ├─ Monitor for anomalies\n  ├─ Detect decisions needing approval\n  ├─ Track commitment dates\n  ├─ Build continuity across disconnected tools\n```\n\n**AI Collaboration Points** (When Twin asks for help):\n```\n\"Alice, I noticed 3 PRs waiting your review (>3 days).\nReady to bulk review, or blocked on other work?\"\n\n\"Team: 5 action items due this week, 2 still unstarted.\nShould we adjust timeline or get support?\"\n\n\"Customer support is responding slow (>6 hours).\nShould I draft a faster response template?\"\n```\n\n### AI Implementation References\n\nThe AI should build from reference implementations:\n- Existing Twin session patterns (how context is built)\n- Existing memory consolidation (how facts are extracted)\n- Existing recommendation engine (how options are surfaced)\n- Existing multi-model routing (how Claude/GPT/Gemini are orchestrated)\n\n**AI Workbench Delivery (Week 3):**\n- Separate UI environment for AI operations\n- Daily routine scheduler (morning standup, EOD summary)\n- Memory consolidation service\n- Observation dashboard\n- Human hand-off interface (for approvals, clarifications)\n\n---\n\n## Configuration Model (Surfaces as Features)\n\n### Every Surface is a Separately Built Feature\n\n**Structure:**\n```\nleft-sidebar/\n├─ navigation.tsx (configurable menu)\n│\nworkbench-surfaces/\n├─ dashboard/\n│   ├─ page.tsx\n│   ├─ components/\n│   └─ hooks/\n├─ accounts/\n│   ├─ page.tsx\n│   ├─ components/\n│   └─ hooks/\n├─ contacts/\n│   ├─ page.tsx\n│   ├─ components/\n│   └─ hooks/\n├─ companies/\n│   ├─ page.tsx\n│   ├─ components/\n│   └─ hooks/\n└─ [50+ more surfaces]\n\nsurface-registry/\n├─ registry.ts (defines all surfaces)\n├─ config.ts (which surfaces enabled for which roles)\n└─ hooks.ts (enable/disable, reorder)\n```\n\n### Left Sidebar Configuration\n\n**How it works:**\n```typescript\n// Surface Registry\nconst SURFACES = {\n  dashboard: { label: 'Dashboard', icon: 'home', enabled: true },\n  accounts: { label: 'Accounts', icon: 'user', enabled: true },\n  contacts: { label: 'Contacts', icon: 'users', enabled: true },\n  companies: { label: 'Companies', icon: 'building', enabled: true },\n  opportunities: { label: 'Opportunities', icon: 'briefcase', enabled: true },\n  tasks: { label: 'Tasks', icon: 'checkbox', enabled: true },\n  calendar: { label: 'Calendar', icon: 'calendar', enabled: true },\n  notes: { label: 'Notes', icon: 'notepad', enabled: false }, // disabled by user\n  // ... 50+ more\n}\n\n// Sidebar Configuration (per-user)\nconst sidebarConfig = {\n  order: ['dashboard', 'accounts', 'contacts', 'companies', ...],\n  pinned: ['dashboard', 'calendar'],\n  collapsed: [],\n  favorites: ['opportunities', 'tasks'],\n}\n\n// Enable/disable surfaces\nuseSurfaceConfig()\n  ├─ getSurfaces() → return visible surfaces\n  ├─ toggleSurface(id) → enable/disable\n  ├─ reorderSurfaces([...]) → custom order\n  └─ resetToDefaults() → back to factory\n```\n\n**User Experience:**\n1. Open workbench\n2. Left sidebar shows configurable surfaces\n3. Right-click on surface → \"Hide this surface\"\n4. Click gear icon → \"Configure surfaces\"\n5. Reorder by drag-drop\n6. Each surface is independently functional\n\n---\n\n## Implementation Roadmap\n\n### IMMEDIATE (This Week)\n- ✅ Clean v0 experimental files (`entity-stretch`, `customer-zero-workspace`)\n- ✅ Verify backend contract (all services present)\n- ✅ Deploy Human Workbench (preview or production)\n- ✅ Confirm TypeScript clean (0 errors)\n\n### WEEK 1\n- ✅ Customer Zero begins using workbench\n- ✅ Customer Zero connects first 4 apps (Gmail, Slack, GitHub, Calendar)\n- ✅ Spine ingests data from connected apps\n- ✅ Surfaces tested with real usage patterns\n\n### WEEK 2\n- ✅ Customer Zero connects 5+ more apps\n- ✅ Spine Schema v1.0 documented (from real usage)\n- ✅ AI Workbench begins daily routine observ ations\n- ✅ Memory consolidation starts\n\n### WEEK 3\n- ✅ Full integration suite working\n- ✅ Spine Schema refined based on conflicts/duplicates discovered\n- ✅ AI Workbench collaboration overlay ready\n- ✅ Human + AI working together over shared continuity\n\n### ONGOING\n- Customer Zero provides feedback on each surface\n- Spine Schema evolves with new tool connections\n- AI learns from daily work patterns\n- Surface configuration options expand\n- Continuity becomes invisible infrastructure\n\n---\n\n## What Doesn't Change\n\n✅ **Backend Contract** (All verified present):\n- Auth with password authentication enabled\n- Gateway service bindings (intelligence, connector, knowledge)\n- Twin model route (`/v1/chat/completions`)\n- Knowledge queue consumers + cron jobs\n\n✅ **Real Customer Zero Infrastructure**:\n- Existing tenant: `iw-customer-zero`\n- Existing verification component\n- Existing Spine client seeding\n\n✅ **Frontend Foundation** (Intact):\n- Shell and routing\n- L1 domains (all surfaces)\n- L2 overlay system\n- Real customer-zero infra integration\n\n---\n\n## What Changes\n\n❌ **Focus**: From AI-centric → Human-centric (workbench is PRIMARY)\n\n🔄 **Architecture**: AI moves UNDERNEATH (invisible infrastructure)\n\n📊 **Surfaces**: Each built as separately configured feature (not AI overlay)\n\n🧠 **AI Role**: Has its own workbench (not idle, has daily routines)\n\n🔗 **Memory**: Shared between Human and AI (with boundaries respected)\n\n🌐 **Continuity**: Invisible but always working (the real moat)\n\n---\n\n## Success Metrics\n\n**Phase 1 (Deploy):**\n- ✅ TypeScript clean (0 errors)\n- ✅ Workbench deployable (no compilation issues)\n- ✅ All backend services online\n- ✅ Customer Zero can log in\n\n**Phase 2 (Usage):**\n- ✅ Customer Zero using workbench 30+ min/day\n- ✅ 4+ tools connected and syncing\n- ✅ Context flowing between surfaces\n- ✅ No duplicate information visible\n\n**Phase 3 (Spine):**\n- ✅ Spine Schema v1.0 documented\n- ✅ 150+ entities tracked\n- ✅ 500+ relationships indexed\n- ✅ Memory boundaries enforced\n\n**Phase 4 (AI):**\n- ✅ AI Workbench operational\n- ✅ Daily routines executing\n- ✅ Memory consolidation working\n- ✅ Human-AI collaboration successful\n\n---\n\n## Call to Action\n\n**This Week:**\n1. Clean experimental files (10 min)\n2. Deploy restored workbench (15 min)\n3. Verify TypeScript clean (5 min)\n4. Confirm Customer Zero can access (5 min)\n\n**Next Week:**\n- Customer Zero starts using it\n- Tools start connecting\n- Spine Schema starts evolving\n\n**Long term:**\n- Humans and AI working together\n- Shared memory, respected boundaries\n- Continuity invisible but omnipresent\n- No more \"Stop Being Human APIs\" — you have a unified surface\n\n---\n\n## Documents to Review\n\n**Already Created:**\n- ✅ `UNIVERSAL_CONNECTION_POOL_ARCHITECTURE.md` (Tenant-owned capability pool)\n- ✅ `SPINE_CONNECTION_POOL_ARCHITECTURE.md` (Shared connector pattern)\n\n**To Be Created (By Backend/Replit):**\n- 🔄 Spine Schema v1.0 (from Customer Zero actual usage)\n- 🔄 AI Workbench Reference Implementation\n- 🔄 Surface Registry & Configuration System\n- 🔄 Memory Consolidation Service\n\n---\n\n**Status: READY TO EXECUTE**\n\nHuman Layer Recovery Plan is coherent, actionable, and grounded in existing infrastructure.\nNext step: Clean files → Deploy → Activate Customer Zero → Build from real patterns.\n\n"}