clawdbot-workspace/memory/2026-02-03.md

123 lines
6.1 KiB
Markdown

# 2026-02-03 — Session Memory
## Summary
Massive build day. Fixed critical LocalBosses bugs, then went on an MCP server building spree — 4 new MCP servers built from scratch, Reonomy fully integrated, multi-panel thread system shipped, and platform comparison research done.
---
## LocalBosses App — Major Bug Fixes (ALL FIXED)
### Channel Switch Blank Screen (FIXED)
- **Bug:** Switching channels showed blank screen — `activeAppId` wasn't being reset when channel changed
- **Fix:** Added `setActiveAppId(null)` in channel switch handler in `ChatView.tsx`
### Workflow Builder Thread — App Not Updating (FIXED)
- **Root causes (3 things):**
1. **Wrong endpoint:** Thread handler posted to `/api/app-data` but workflow builder iframe polls `/api/workflow-ops` → fixed to POST to correct endpoint
2. **Wrong postMessage type:** Was `"mcp_app_data"` but builder listens for `"workflow_ops"` → fixed
3. **Iframe remounting:** `appRefreshKey` in iframe key incremented every stream chunk, causing repeated full reloads → removed from key, builder stays mounted and receives data via polling/postMessage
- **Prompt fix:** Workflow builder thread now uses SAME `WORKFLOW_JSON_PROMPT` as main chat (not generic APP_DATA)
- **Key learning:** Sonnet reliably follows WORKFLOW_JSON format but NOT the generic APP_DATA format
### Thread Persistence (FIXED)
- **Bug:** Closing/switching threads lost all work (workflow data, messages)
- **Fix:** Added localStorage persistence to `useThreadChat.ts`
- Threads serialize to `localStorage` under key `"lb-threads"`
- Persist on: create, skip, stream-complete, finally, destroy
- Restore on module init (with Date object reconstruction)
- Re-opening a workflow builder thread pushes saved data to `/api/workflow-ops`
- Loading state resets on restore (no stuck spinners)
### Thread System — Architecture
- `useThreadChat.ts` — handles thread-specific chat with app data parsing + localStorage persistence
- `ChatView.tsx` — manages thread panel, app iframe, toolbar
- Chat route (`/api/chat/route.ts`) — adds thread context to system prompt
- Data flow: AI response → stream parser strips hidden blocks → POST to correct endpoint → iframe picks up via polling/postMessage
---
## New MCP Servers Built (4 servers today)
### CloseBot MCP Server (NEW)
- **Location:** `closebot-mcp/`
- **119 tools** across 14 modules, 4,656 lines TypeScript
- **8 tool groups:** Bot Management (18), Configuration (30), Agency & Billing (18), Analytics (14), Library & KB (11), Source Mgmt (9), Bot Testing (7), Lead Mgmt (6)
- **6 rich UI apps:** Bot Dashboard, Analytics Dashboard, Test Console, Lead Manager, Library Manager, Leaderboard
- Added to LocalBosses under BUSINESS OPS
### Meta Ads MCP Server (NEW)
- **Location:** `meta-ads-mcp/`
- **~55 tools** across 11 categories, 10,400+ lines TypeScript, 30 source files
- **11 visual MCP apps:** Dashboard, Performance Grid, Creative Preview, Audience Builder, Funnel Analyzer, Spend Tracker, A/B Test Results, Heatmap, Ad Library Browser, Campaign Wizard, Account Health
- Full MCP annotations, lazy loading (Tier 1/2), OAuth + rate limiter + cache
- Added to LocalBosses under new MARKETING category
### Google Console MCP Server (NEW)
- **Location:** `google-console-mcp/`
- **22 tools** across 6 categories
- **5 visual MCP apps:** Dashboard, Quick Wins, URL Health, Cannibalization, Content Decay
- Lazy loading (4 gateway tools always on, rest via `discover_tools`)
- Added to LocalBosses under MARKETING category
### Twilio MCP Server (integrated)
- **54 tools**, 19 MCP apps
- Added to LocalBosses under BUSINESS OPS
- Needs Twilio credentials for live testing
---
## Multi-Panel Thread System (NEW FEATURE)
- **Sub-agent built it** — clean compile, production ready
- **4-6 threads open simultaneously** — flex layout, equal space per panel
- **Cross-channel persistence** — threads survive channel switches, show source channel name
- **Close vs Delete** — X hides panel (data preserved in localStorage), trash destroys thread
- **80% max viewport** for panels, min 280px per panel
- **Toolbar highlights all open apps** (Set<string> instead of single active)
- **Files modified:** types.ts, useThreadChat.ts, ChatView.tsx, McpAppToolbar.tsx
---
## Reonomy Integration (COMPLETE)
- Channel added to LocalBosses channels.ts
- 3 MCP apps built: Search Builder, Results Viewer, Dashboard
- App names registered in appNames.ts
- reonomy-api dependencies installed, TypeScript compiles clean
- Also did browser-based Reonomy property search (580 properties filtered)
---
## Other Work
- **Platform Comparison Chart** — Created Cloudflare Workers vs Linux VM vs Mac Mini comparison for OpenClaw deployment, shared in Discord
- **Learning Guide** — Sent Jake's comprehensive learning guide via iMessage to a contact
- **Competitor Research** — Debugged API key issues (expired Anthropic key in .env.local)
---
## LocalBosses Channel Architecture (Current)
- **BUSINESS OPS:** #general, #automations, #crm, #google-ads, #competitor-research, #twilio
- **MARKETING:** #google-console, #meta-ads
- **TOOLS:** #templates, #nodes
- **SYSTEM:** #health
---
## Missing App HTML Files (ALL BUILT — 29/29)
- **Google Ads:** 7/7 files → `/mcp-diagrams/google-ads-mcp/dist/app-ui/`
- **Twilio:** 19/19 files → `/twilio-mcp/dist/app-ui/`
- **Reonomy:** 3/3 files → `/reonomy-mcp/dist/app-ui/`
- Style: dark theme (bg #0d1117, accent #ff6d5a), self-contained HTML, demo data
---
## TODO (Carried Forward)
- **Thread app expansion:** Jake wants the app iframe to expand/cover the top section once it has real generated data
- **Reonomy route.ts mapping:** Need to add reonomy-mcp to APP_DIRS and APP_NAME_MAP in route.ts files
- **"Error: Load failed" on first request:** Chat API route takes ~10-15s to compile on first POST (Turbopack lazy compile) — need warm-up request or loading state
- **SongSense:** Still queued — hasn't started yet (was supposed to be top priority)
- **MCP servers live testing:** 30+ servers built but none tested against real APIs
## Server Notes
- Dev server: `nohup npx next dev --hostname 0.0.0.0 --port 3000``192.168.0.25:3000`
- Next.js 16.1.6 with Turbopack
- Log file: `/tmp/localbosses-dev.log`