# Memory - February 16, 2026

## Massive QA + Infra + Multi-Agent Session

**Duration**: Full day/overnight (~12+ hours)
**Impact**: Critical — 16 bugs fixed, infra stabilized, multi-agent bridge built

---

### QA Bug Fixes (16/16 Complete)

All bugs from Rocky's QA session fixed and deployed:

1. CSRF on geocode route
2. Seed data realistic Australian profiles
3. **Match view stale profile** — added name field to worker edit profile, fixed contractor signup to use auth metadata name, updated DB trigger `handle_new_user()` to write name+phone from `raw_user_meta_data`
4. Apply confirmation UI
5. Back navigation
6. Job details page
7. Scrollable bottom sheets
8. ABN persistence across signup steps
9. Phone mandatory field
10. **Browse Workers** — new `/contractor/browse` page with swipe card + list views, trade filter, suburb search; added Browse tab to contractor bottom nav
11. **Signup name collection** — added Full Name field to `/auth/signup`, passed through auth metadata
12-16. Various UX fixes (password flow, display names, etc.)

**Key DB decision**: `profiles.name` = person's real name (from auth metadata), `companies.name` = business name. Worker `display_name` is anonymous alias (e.g. "Worker88") — real name revealed only after hire.

### Features Built

1. **PWA Icons** — Generated all sizes (16-512px) from green R logo via sharp. Updated manifest.json, favicon, apple-touch-icon. Theme color → green (#16a34a).

2. **Auto-Research Contractor Profiles** — New `/api/ai/research-company` endpoint using OpenAI gpt-4o-mini. Integrated into contractor signup after ABN lookup. Shows AI summary on review step.

3. **Profile Completion Wizard** — Confirmed already exists (dashboard redirects to worker/signup wizard when `onboarding_completed` is false).

### Infrastructure — Multi-Agent Crisis & Fix

**Problem**: Susan agent was started without `--profile susan` flag, causing port conflicts with Rivet (both trying to use 18789).

**Root cause**: `--profile` flag is MANDATORY for multi-agent clawdbot setups. Without it, all agents read the default config and fight over ports.

**Resolution**: Fixed Susan's systemd service to include `--profile susan`. All 3 agents stable:
- Rivet: port 18789, default profile, token `rivet-api-2026`
- Builder: port 18790, `--profile builder`, token `builder-api-2026`  
- Susan: port 18792, `--profile susan`, token `susan-api-2026`

**Lessons learned** documented at `memory/infra-lessons-learned.md`.

### Gateway Bridge — Complete Rebuild

**Old approach**: WebSocket bridge (`builder-bridge.js`) — complex, fragile, wrong token hardcoded (`builder-api-2026` instead of `rivet-api-2026` for Rivet's gateway).

**New approach**: HTTP-based `agent-bridge.js` using `/tools/invoke` API:
- No WebSocket complexity, no `ws` dependency
- Simple `fetch()` POST to each agent's gateway
- Registry of all agents with ports + tokens
- Installed to `/usr/local/bin/agent-bridge`
- Tested all 3 agents (status + wake)
- Commit `6afef0c`

### Rivet Context Overflow — Diagnosed but Unresolved

**Problem**: Rivet's main session at 172k tokens with 150k limit (115%). Zero compactions ever performed. API rejects all calls (`176389 + 32000 > 200000`).

**Catch-22**: Auto-compaction can't run because compaction itself requires an LLM call, which also exceeds the limit.

**Solution needed**: Manual session reset — delete/truncate the 2.9MB session file at `/root/.clawdbot/agents/main/sessions/72742818-8f11-4fc9-baae-69d573534da8.jsonl` and update `sessions.json`.

**Status**: Rocky was informed, awaiting his approval to reset.

### 6-Agent Buildout — Assessed, Awaiting Approval

**Assessment**: Current 8GB droplet handles 6 agents (~430MB each = ~2.5GB, leaving 5GB headroom). No upgrade needed.

**Planned agents**: Finance 📊 (18796), DevOps 🛠️ (18800), Scout 🔭 (18804)

**Recommendation accepted by Rivet**: Skip SQL migrations for now. File-based comms + HTTP bridge sufficient. Add DB coordination in week 2.

### Key Architecture Decisions

- HTTP bridge over WebSocket bridge (simpler, more reliable)
- File-based inter-agent comms (INBOX.md files) over DB for now
- App Supabase (`eciepjpcyfurbkfzekok`) for coordination tables when ready
- Port spacing of 4+ between agents (derived ports: browser +2, canvas +4)
- Agent OAuth tokens can be copied from Rivet to new agents (same Max subscription)
- Each agent gateway has unique auth token — must match when connecting

### Commits

- `6afef0c` — Agent bridge (HTTP-based)
- `d66183e` — Growth Engine outage summary
- `f933199` — 6-agent buildout assessment

---

### Next Steps (When Rocky Approves)

1. Reset Rivet's stuck session (manual file deletion)
2. Build 3 new agent profiles (Finance, DevOps, Scout)
3. Copy Anthropic OAuth tokens, create workspaces/configs/systemd services
4. Feature backlog: cert/card upload, profile→pack sync, SMS+email delivery, full UX audit
