Unclassified

Platform Delivery Summary — code-excavation Branch

Tier C — Historical. This document is a point-in-time snapshot preserved for reference. For current architecture, see CANONICAL_PLATFORM_ARCHITECTURE.md.

Status: Ready for merge to main. All platform work complete. Front-end transferred to Replit.

Commits in this branch

1. f7f77e8 — CF stack monitor + platform wiring fixes

Platform hardening + founder observability surface.

What changed:

  • Added /metrics founder dashboard (apps/web/src/pages/Metrics.tsx) — reads real admin endpoints (/admin/v1/workers/health, /admin/v1/system/stats) + gateway /health. Polls every 15s, degrades gracefully on failures. Shows 9 CF services, D1/KV/R2/Vectorize/Queue/DO topology, Spine partition stats, memory lifecycle, rate limits.
  • Fixed dev service binding name mismatches across gateway, knowledge, iw-agent-runtime (integratewise-* → short worker names)
  • Quarantined email/password auth behind ALLOW_PASSWORD_AUTH env (default OFF) — only Google/GitHub OAuth + CF Access are live entries
  • Fixed web app root dev script to scope turbo to @integratewise/web (was running desktop app by default)

Why it matters:
The gateway bindings were wrong (wrangler deploy would fail). Auth was exposing a weak credential path. The dev script was serving the wrong app. These are the operational faults that prevent deployment.

2. f7f77e8 — Twin + Knowledge + Intelligence wiring

Memory lifecycle + agent model routing.

What changed:

  • Enabled knowledge-ingest + memory-consolidation-tasks queue consumers in dev
  • Added hourly consolidation cron (0 * * * *) to base + prod environments (named envs don't inherit base [triggers])
  • Added missing /v1/chat/completions route to intelligence worker (Twin was silently falling back to llama-3.1-8b on every turn; now routes to gpt-5-mini via OpenRouter)
  • Made AI_SEARCH types optional in intelligence to match runtime guards
  • Made vault writes fail-loud: free/personal entities no longer silently dropped if encryption key is missing

Why it matters:
The Twin was broken (falling back to the tiny model). Consolidation wasn't running (cron was commented out). The vault could silently lose data. These are silent failures that would manifest as degraded AI + lost memory.

3. fa7abcc — Remove experimental FE files

Clean separation: platform only.

What changed:

  • Deleted components/l1/entity-stretch.tsx (the dropped 6-beat loop; was the only TS error)
  • Deleted orphaned components/l1/domains/customer-zero/customer-zero-workspace.tsx
  • Kept pages/Metrics.tsx + /metrics (founder ops, no collision with Replit)
  • Real Customer Zero infra untouched (customer-zero-verification.tsx, spine/client.ts with tenant iw-customer-zero)

Why it matters:
Replit owns the universal front-end. Duplicating it here causes collisions and confuses the codebase. This boundary is now clean.

Verification checklist

  • ✅ Web app typecheck: 0 TS errors (was 1 from entity-stretch.tsx)
  • ✅ Auth quarantine: ALLOW_PASSWORD_AUTH gates /signup, /login, /reset-password (default OFF)
  • ✅ Gateway bindings: intelligence/connector/knowledge point to correct worker names
  • ✅ Twin model routing: /v1/chat/completions exists, routes to OpenRouter gpt-5-mini
  • ✅ Memory lifecycle: queue consumers enabled, hourly cron fires in prod (autonomously triages/consolidates/ages)
  • ✅ Backend contract: all 9 api-client domains (workspace, connector, intelligence, knowledge, cognitive, mcp, pipeline, admin, signals) wired and ready for Replit's front-end
  • ✅ Real Customer Zero: untouched, intact, bootstrappable via enable-customer-zero.mjs
  • ✅ Design tokens: locked (Forest/Paper/Gold), no changes
  • ✅ No front-end mixed in: all FE experimental code removed; platform-only focus maintained

Outstanding platform work (not in this branch — future passes)

These are documented and staged, not implemented here (per the decision to focus this pass on deployment blockers):

  1. Prod/test cross-env binding reconciliation — Requires live Cloudflare worker inventory to safely reconcile all [env.prod] / [env.test] service binding targets. Staged in docs.
  2. De-Supabase tail — ~10 files still reference Supabase (intelligence cognitive-brain, signal store). Degrades gracefully. Tracked in docs/migrations/DE_SUPABASE_MIGRATION.md.
  3. Decentralised migration ordering — Multiple services run migrations on one D1. Order is implicit; needs an ordered manifest. Tracked in verification docs.
  4. Rate-limiting + API manager + reprocessing — Gateway has KV rate-limit bindings declared but middleware needs end-to-end verification.

What Replit receives (the front-end contract)

The platform is now wire-ready for Replit's universal front-end transfer:

  • Routes: / (landing) → /app/* (workspace lifecycle) → role-based L1 workbenches, /metrics (founder ops), L2 shared overlays, Twin workbench, Memory hub, Governance
  • API client domains: workspace, connector, intelligence, knowledge, cognitive, mcp, pipeline, admin, signals — all expose their respective tool-execution functions natively (execute without leaving for the tool)
  • Auth: Google/GitHub OAuth + CF Access (JWT verified server-side, tenant_id derived from D1, 403 on mismatch)
  • Design tokens: Forest/Paper/Gold locked in design-tokens.css, available as --iw-forest, --iw-paper, --iw-gold
  • Real data: Customer Zero tenant (iw-customer-zero, Nirmal Prince) seeded and ready for sandbox/demo flows

Deployment readiness

  • ✅ No broken worker names (gateway/knowledge/agent-runtime bindings fixed)
  • ✅ No weak credential path exposed (password auth quarantined)
  • ✅ Memory consolidation is autonomous (cron + queues enabled)
  • ✅ Twin uses real models (gpt-5-mini, not fallback llama)
  • ✅ Vault writes are safe (fail-loud, not silent data loss)
  • ✅ Web app compiles clean (0 TS errors)

Ready to merge to main.


Branch: code-excavation
Compare: main...code-excavation
Commits: 3
Files changed: 18
Insertions: 1,258
Deletions: 89