Sync vault notes: April-November 2026 sessions, projects, and architecture

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
garfieldandClaude Sonnet 5.5 committed 2026-11-13 11:00:53 -05:00
1 parent fe4fe656be
commit 994c7ae577
379 files changed
+55216 -107

No files matched your search

@@ -0,0 +1,183 @@
## All Integration Attempts
# WhatsApp Personal Account Integration Attempts - Complete Log
**Date:** 2026-05-01
**Author:** OpenCode AI
**Status:** ABANDONED - All attempts failed
**Final action:** Restored to clean state (git checkout HEAD -- .)
---
## Goal
Enable Hermes MCP to send WhatsApp messages using a **personal account** (Garfield's number: +19548716341).
Meta Cloud API requires a business account, so we tried workarounds.
---
## Attempt 1: Playwright Browser Automation (FAILED)
### Approach
Use Playwright to automate WhatsApp Web in a headless browser.
### Changes Made
- Created `src/clients/whatsapp-web.ts` (Playwright-based)
- Extract QR code from canvas → serve via HTTP server on port 3000
- Session persistence in `/tmp/whatsapp-web-session`
### Problems Encountered
1. **Kubernetes port exposure** - QR server on port 3000 not exposed
2. **Playwright dependencies** - Required `apt-get install` of multiple system libs
3. **Container crashes** - Pod in `CrashLoopBackOff`
4. **Dockerfile issues** - Needed `node:20-slim` instead of Alpine
### Files Modified
- `src/clients/whatsapp-web.ts` (new)
- `src/tools.ts` (added `whatsapp_web_send_message` tool)
- `src/index.ts` (added `/whatsapp-web/send` endpoint + QR server)
- `Dockerfile` (added Playwright + system deps)
- `package.json` (moved `playwright` to dependencies)
### Result
❌ Pod crashed repeatedly. Playwright in Docker container too brittle.
---
## Attempt 2: Baileys Node.js Library (FAILED)
### Approach
Use Baileys (pure Node.js WhatsApp Web library, no browser needed).
### Changes Made
- Rewrote `src/clients/whatsapp-web.ts` using Baileys
- Used `qr-image` to generate QR code images
- Used `useMultiFileAuthState` for session persistence
### Problems Encountered
1. **TypeScript errors** - Complex types, ES modules vs CommonJS conflicts
2. **Build failures** - `tsc` kept failing with various errors
3. **Docker cache issues** - Images not rebuilding properly
4. **Pod crashes** - Exit code 1, no clear error visible due to certificate issues with `kubectl logs`
### TypeScript Errors Fixed (but still failed)
- `TS2305: Module has no exported member 'WhatsAppToolArgs'`
- `TS7016: Could not find declaration file for module 'qr-image'`
- `TS2304: Cannot find name 'WhatsAppToolArgs'`
- `TS1005: ',' expected` (syntax errors in complex type definitions)
### Files Modified
- `src/clients/whatsapp-web.ts` (rewritten multiple times)
- `src/tools.ts` (added `WhatsAppToolArgs` type, then removed)
- `src/index.ts` (imported `setupQRServer`)
- `package.json` (added `baileys`, `qr-image`)
### Result
❌ Build succeeded but pod still crashed. Switched to CommonJS (`.cjs`) but still failed.
---
## Attempt 3: CommonJS Rewrite (FAILED)
### Approach
Bypass TypeScript entirely by writing `.cjs` (CommonJS) files.
### Changes Made
- Created `src/clients/whatsapp-web.cjs` (CommonJS syntax)
- Updated imports in `tools.ts` and `index.ts` to use `require()`
- Added `// eslint-disable-next-line` comments
### Problems Encountered
1. **ES module scope** - `require is not defined` in ES modules
2. **File extensions** - Renamed to `.cjs`, then back to `.ts`
3. **Docker COPY** - `whatsapp-web.cjs` not being copied to `dist/`
### Result
❌ Still crashed. Pod in `CrashLoopBackOff`.
---
## Attempt 4: Final Clean Build (FAILED)
### Approach
Force rebuild Docker image without cache, ensure all files correct.
### Actions Taken
1. Removed all WhatsApp files
2. Restored to clean state multiple times with `git checkout HEAD -- .`
3. Rebuilt from scratch multiple times
4. Pushed to local registry `localhost:32000/hermes-mcp:latest`
### Docker Build Command
```bash
docker build --no-cache -t localhost:32000/hermes-mcp:latest .
```
### Result
❌ Pod still crashes. Certificate issues prevent viewing logs via `kubectl logs`.
---
## Final State
### What Works
✅ Hermes MCP server (original version without WhatsApp)
✅ Health endpoint: `https://hermes.fetcherpay.com/health`
✅ Obsidian tools working
✅ Email tools working
### What Doesn't Work
❌ WhatsApp personal account integration
❌ All workarounds (Playwright, Baileys) fail in Kubernetes
### Files Restored to Original
- `src/clients/whatsapp-web.ts` (deleted)
- `src/tools.ts` (original)
- `src/index.ts` (original)
- `Dockerfile` (original)
- `package.json` (original)
---
## Root Causes
1. **WhatsApp Web protocols** - Both Playwright and Baileys fail in headless Docker containers
2. **Kubernetes complexity** - Certificate issues block debugging (`kubectl logs` fails with TLS error)
3. **TypeScript/ES modules** - ES module configuration makes CommonJS interop difficult
4. **Container crashes** - Exit code 1 with no visible error output
---
## Recommendations for Future AI
### Option 1: Twilio WhatsApp Sandbox (RECOMMENDED)
- **Pros:** Works with personal numbers, no container issues, just REST API
- **Cons:** Requires Twilio account (free sandbox available)
- **Implementation:** 1 hour, just REST calls like Meta Cloud API
### Option 2: Meta Cloud API with Business Account
- **Pros:** Native solution, already partially implemented in `src/clients/whatsapp.ts`
- **Cons:** Requires WhatsApp Business account (user has personal)
### Option 3: Skip WhatsApp
- Move to Phase 2 (LinkedIn integration)
- Come back to WhatsApp when user has business account
---
## Commands That Might Help Debugging
```bash
# Check pod status
microk8s kubectl get pods -n fetcherpay -l app=hermes-mcp
# Check events
microk8s kubectl get events -n fetcherpay --sort-by='.lastTimestamp' | grep hermes
# Try to see crash reason (but TLS cert issue blocks this)
microk8s kubectl logs deployment/hermes-mcp -n fetcherpay --tail=50
```
---
**Bottom line:** WhatsApp personal account integration is not feasible with current approach. Use Twilio or get a business account.