{"slug":"business/REPOSITORY_ALIGNMENT","title":"Repository Alignment Report","section":"business","sectionLabel":"Business","status":"unclassified","type":"document","path":"business/REPOSITORY_ALIGNMENT.mdx","bytes":7777,"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**Date:** June 30, 2026  \n**Status:** ✅ COMPLETE — Repository cleaned up and aligned  \n**Next Phase:** Multi-frontend wiring (Phase A)\n\n---\n\n## 1. Cleanup Summary\n\n### Archived (52 planning artifacts → `_archive/`)\n\nMoved all phase completion docs, architecture variants, deployment guides, and status files to `_archive/` for historical reference:\n\n- `FINAL_DELIVERY_SUMMARY.md`, `PHASE_*_COMPLETE.md`, `DEPLOYMENT_*.md`, `RECOVERY_PLAN.md`, etc.\n- Reference images (`.v0-*.png`), old capture scripts (`.v0-capture.js`)\n- Backup web app (`apps/web.old/`)\n\n**Result:** Root now contains only essential docs: `README.md`, `CANONICAL_STATE.md`, `ARCHITECTURE_INDEX.md`, `PLATFORM_THESIS.md`.\n\n### Documented Hidden Folders (`.HIDDEN_FOLDERS.md`)\n\n- **Essential:** `.git/`, `.github/`, `.vscode/`, `.vercel/`, `.env*`, `.npmrc`, `.prettier*`\n- **Cache:** `.pnpm-store/`, `.pnpm-home/`, `.turbo/`, `.logs/` (all gitignored, not tracked)\n- **Persistent Memory:** `.iw-memory/`, `.v0-ref/` (preserved for chat continuity)\n- **Deprecated (gitignored, not tracked):** `.claude/`, `.cursor/`, `.kimi/`, `.kiro/`, `.opencode/`\n\n**Result:** Hidden folder strategy documented; deprecated AI contexts no longer committed.\n\n### Commits\n\n- `1573862` — Archived 52 planning artifacts\n- `7a73137` — Documented hidden folders\n\n---\n\n## 2. Frontend App Alignment\n\n### Web App (`apps/web` — `@integratewise/os`)\n\n- **Type:** Next.js 16 (primary OS)\n- **Surface Area:** 98 pages, 67 API routes, 38 view components\n- **Backend Contract:** `lib/bridge/gateway.ts` + `lib/gateway-sdk.ts`\n- **Gateway Usage:** `NEXT_PUBLIC_USE_AI_GATEWAY` config; all projections via Gateway\n- **Status:** ✅ 100% wired to projection-engine via Gateway\n\n### Desktop App (`apps/desktop` — `@integratewise/desktop`)\n\n- **Type:** Electron shell wrapping web app\n- **Renderer:** Loads web app from `http://localhost:3000` (dev) or `https://app.integratewise.ai` (prod)\n- **Backend Contract:** Inherits web app's Gateway calls automatically\n- **Status:** ✅ Thin shell, automatically receives all web app functionality\n\n### Mobile App (`apps/mobile` — `@integratewise/mobile`)\n\n- **Type:** Expo / React Native\n- **Surface Area:** 5+ screens (`signals.tsx`, `index.tsx`, etc.)\n- **Backend Contract:** Currently hardcoded mock data + Supabase auth (separate from Gateway)\n- **Status:** ⚠️ **Not aligned** — zero Gateway calls, needs Phase D implementation\n- **Blocker:** Needs isomorphic client package (`packages/gateway-client`) or BFF layer (`/api/mobile/*`)\n\n### Local Monitor (`apps/local-monitor`)\n\n- **Type:** Node.js file watcher (`chokidar` + `node-fetch`)\n- **Purpose:** Sync IntegrateWise memory folder with backend live\n- **Backend Contract:** Direct HTTP calls (not using SDK)\n- **Status:** ✅ Separate concern, not user-facing\n\n---\n\n## 3. Backend Service Alignment\n\n### Gateway (CF Workers)\n\n- **Route Table:** `/v1/*` → projection-engine, `/api/v1/*` → services, `/api/v1/mobile/*` → (future BFF)\n- **Service Bindings:** 10+ services (govern, intelligence, connector, workflow, spine, etc.)\n- **Status:** ✅ Wired and operational\n\n### Projection Engine (CF Workers)\n\n- **Facades:** 14 total (12 wired to real services + 2 in progress)\n- **Wired (12):**\n  1. `ExecutiveDashboardFacade` → spine + intelligence\n  2. `TwinInterfaceFacade` → spine + intelligence + govern\n  3. `MorningContextFacade` → spine + intelligence + govern\n  4. `Entity360Facade` → spine\n  5. `GovernanceBoardFacade` → govern\n  6. `InboxFacade` → intelligence + govern\n  7. `AccountHealthFacade` → spine + intelligence\n  8. `RenewalForecastFacade` → spine + intelligence + govern\n  9. `MCPConsoleFacade` → mcp-connector\n  10. `WorkflowEditorFacade` → workflow + mcp-connector\n  11. `BrainstormWorkbenchFacade` → spine + intelligence\n  12. (1 more TBD)\n\n- **In Progress (2):** Phase C new facades (pipeline, tam, knowledge, lead-lifecycle)\n- **Status:** ✅ Facade layer operational, service clients extended with missing methods\n\n---\n\n## 4. Alignment Verification Checklist\n\n- ✅ Root directory cleaned (52 planning docs archived)\n- ✅ Hidden folders documented (`.HIDDEN_FOLDERS.md`)\n- ✅ Git configuration aligned (`.gitignore` excludes cache + deprecated contexts)\n- ✅ Web app wired to Gateway (100% coverage)\n- ✅ Desktop app inherits web functionality (thin shell confirmed)\n- ✅ Projection-engine wired to all services (12 facades operational)\n- ✅ Service clients extended with missing methods (IAdaptiveSpineClient, IIntelligenceServiceClient, 3 new clients)\n- ⚠️ Mobile app not yet aligned (pending Phase D decision)\n\n---\n\n## 5. Next Steps (Decision Gates)\n\n### Phase A — Wire 5 Mock Surfaces (ready to start)\n\nSurfaces currently using mock data that have facades ready:\n\n1. `(cs)/accounts` → `account-health`\n2. `(cs)/risks` → `account-health`\n3. `(cs)/war-room` → `inbox`\n4. `(personal)/home` + `today` → `morning-context`\n5. `(ops)/ops` → `workflow-editor`\n\n**Status:** Ready to implement. Requires view component updates to use gateway SDK.\n\n### Phase B — SQL Schema Gaps\n\nSchema tables missing for certain projections:\n\n- `mem_continuity_findings` (severity: C1–C4)\n- `mem_continuity_map` (artifact table)\n- `spine_leads` enum (11 stages)\n\n**Status:** Blocked pending Neon/Supabase schema review.\n\n### Phase C — New Facades\n\n5 new facades for currently unserved surfaces:\n\n- `pipeline` — `/business/pipeline` + `/deals`\n- `tam` — `/cs/tam`\n- `knowledge` — `/personal/knowledge`\n- `lead-lifecycle` — `/leads` + `/sales` (blocked on Phase B schema)\n- `tasks` — wire existing `/api/v1/tasks` endpoint (no facade needed)\n\n**Status:** Ready to design after Phase B schema confirmed.\n\n### Phase D — Mobile Alignment\n\nExpo app needs backend wiring. Two options:\n\n- **Option A:** Isomorphic client package (`packages/gateway-client`) — reuse SDK in React Native\n- **Option B:** BFF layer (`/api/mobile/*` in web app) — proxy Gateway calls with mobile-shaped responses\n\n**Status:** Awaiting decision on approach.\n\n---\n\n## 6. Repository State Summary\n\n| Aspect            | Status         | Notes                                          |\n| ----------------- | -------------- | ---------------------------------------------- |\n| Root directory    | ✅ Clean       | 52 artifacts archived, 6 essential docs remain |\n| Hidden folders    | ✅ Documented  | `.HIDDEN_FOLDERS.md` explains all 28 folders   |\n| Git history       | ✅ Preserved   | All phase work remains in `_archive/`          |\n| Web app           | ✅ Aligned     | 100% wired to Gateway                          |\n| Desktop app       | ✅ Aligned     | Inherits web functionality automatically       |\n| Mobile app        | ⚠️ Pending     | Needs Phase D decision + implementation        |\n| Backend services  | ✅ Aligned     | 12/14 facades wired to services                |\n| Projection engine | ✅ Operational | Service clients extended, facades stable       |\n\n---\n\n## 7. Files to Reference\n\n- **Active Plan:** `v0_plans/strategic-approach.md` — Surface→Projection mapping, gap analysis\n- **Canonical State:** `CANONICAL_STATE.md` — Current architecture lock\n- **Architecture Index:** `ARCHITECTURE_INDEX.md` — System diagram reference\n- **Hidden Folders:** `.HIDDEN_FOLDERS.md` — Folder explanations + cleanup strategy\n- **Persistent Memory:** `v0_memories/` — Chat continuity across sessions\n\n---\n\n**Repository is clean and aligned. Awaiting Phase A approval to proceed with surface wiring.**\n"}