# 2026-02-04 — Ultimate System Build Day

## What Happened
Michael asked me to research how to make Clawdbot more proactive and autonomous. Researched official docs, GitHub repos, Reddit, community blogs (12+ sources). Found the setup was over-engineered.

## System v2 Redesign — Executed
- **Architecture:** 5 layers → 1 brain (Rivet) + sub-agents on demand
- **Cron jobs:** 12 → 5 (nightly, morning brief, evening brief, weekly, monthly)
- **Cron style:** Step-by-step scripts → goal-oriented prompts
- **Model hierarchy:** Sonnet 4.5 (main) → Opus (manual switch) → DeepSeek (sub-agents)
- **Config:** DeepSeek set as default sub-agent model via config.patch
- **Files:** SYSTEM.md replaced with v2, HEARTBEAT.md rewritten (80→34 lines), CONTEXT.md updated, old .claude/ coordination files archived
- **Coordination:** INBOX/OUTBOX file-based system → native sub-agents (sessions_spawn)
- **Notion:** v2 draft pushed to Live System Design page

## Cost Optimization Research
- DeepSeek sub-agents = biggest cost saver (60-70% of spend is background work)
- Heartbeat interval: kept at 30min (55min only saves $1-2/mo)
- Already on OAuth (Max plan) for Anthropic — no per-token charges
- Context accumulation is #1 cost driver (40-50% of tokens)
- Official docs recommend heartbeat batching over multiple cron jobs

## Important Context
- Michael has been off sick for the past week (separate from the pause)
- He's NOT on site currently
- Growth Engine paused because the BUSINESS MODEL isn't working, NOT because of illness
- He's pivoting: 9.9% fee model → $50 flat fee per hire, workers pay nothing
- Not happy with: scripts tone, SMS sequences, messaging, the whole approach
- This is a full business pivot, not a pause

## Key Decisions
- Michael approved full execution of redesign
- Switched main session to Opus for this work
- DeepSeek confirmed working as sub-agent model
- Notion is preferred viewing method (not raw .md files)
- Michael's phone opens .md files in Kimi app (Android default)

## Git
- Committed: "system: v2 redesign — single brain + sub-agents, 12→5 cron jobs, DeepSeek sub-agents"
- Pushed to origin/main

---

## Ultimate System Build — Initiated (12:43 AEST)

### Michael's Vision
Build the ultimate system: marketing, sales, personal assistant, all four phases. "Complete all."

### Phase 1: Memory Upgrade — COMPLETE ✅
- Created topic-based memory files: `memory/topics/business.md`, `michael.md`, `technical.md`, `personal.md`
- Enabled hybrid search (vector 70% + BM25 30%) via config.patch
- Enabled session transcript indexing (experimental)
- Enabled embedding cache (50k entries)
- Created memory-consolidation cron (daily 1am AEST)
- Gateway restarted successfully

### Phase 2: Content Engine — PLANNED ✅
- Spawned DeepSeek agent, delivered full plan: `memory/plans/content-engine-plan.md`
- LinkedIn pipeline (3x/week auto-drafts), photo→post, SEO blog templates, competitor monitoring
- Templates created for all 5 LinkedIn content types + blog + case study
- Content engine file structure created under `content-engine/`

### Phase 3: Personal Assistant — PLANNED ✅
- Spawned DeepSeek agent, delivered full plan: `memory/plans/personal-layer-plan.md`
- 6 core capabilities: calendar, gym tracking, weather, reminders, life admin, health
- 3-week phased implementation
- Template JSON files created: preferences, reminders, gym logs
- Designed for <1min/day input from Michael

### Phase 4: Sales (Growth Engine) — PAUSED
- Waiting for business model pivot to settle
- Will reactivate with new $50 model messaging

### Architecture Decision
- One Clawdbot, multiple sub-agents (NOT multiple Clawdbots)
- Avoids coordination nightmare, shared memory, no sync issues
- VPS has headroom: 8GB RAM, 64GB free disk

### Cost Decision
- Michael offered debit card — told him almost everything is free
- Only future costs: premium APIs if needed, possible VPS upgrade
- Michael is on Max plan — Opus/Sonnet are FREE (no per-token charges)
- Video from YouTuber about cost optimization — most doesn't apply to us because we're on Max plan, not API keys

---

## API Keys & Services Collected

### Google OAuth (admin@rateright.com.au)
- Credentials saved securely: /root/.clawdbot/google-oauth.json
- Refresh token: working, auto-refresh scripts built
- **Gmail** ✅ — 201 emails visible, inbox scanning working
- **Calendar** ✅ — Team Sync events visible, schedule pulling working
- **Drive** ✅ — Documents accessible
- Google Workspace account: admin@rateright.com.au (rateright.com.au domain)

### Google API Key
- Key saved: /root/.clawdbot/google-api-key.json
- For: Maps, Places, Contacts, Tasks, Sheets, Geocoding
- Some APIs still enabling (propagation delay)

### Gemini
- Key saved: /root/.clawdbot/google-gemini.json
- Model: gemini-2.0-flash
- Tested and working
- Linked to billing account

### ElevenLabs
- API Key: configured in TOOLS.md
- Plan: Creator tier (110k chars/month, ~100k remaining)
- Preferred voice: Charlie (IKne3meq5aSn9XLyUdCD) — Australian male, deep, confident
- Backup voice: George (JBFqnCBsd6RMkjVDRZzb) — British male, warm storyteller
- Voice replies working via Telegram

### Moonshot/Kimi K2.5
- API Key: configured in Clawdbot
- Tested and working after Michael topped up credit
- Added to Clawdbot config as moonshot/kimi-k2.5
- Use for: research, image analysis, UI generation
- Pricing: $0.60/M input, $2.50/M output

### Existing (already had)
- Anthropic: OAuth Max plan (Opus/Sonnet/Haiku free)
- DeepSeek: configured, near-free
- OpenAI: configured for image gen + whisper
- Brave Search: configured
- Notion: configured
- Supabase: configured
- VAPI: configured for phone AI

---

## Scripts Built
- `scripts/google-refresh.py` — Auto-refresh Google OAuth tokens
- `scripts/google-auth.sh` — Shell version of token refresh
- `scripts/gmail-check.py` — Scan inbox, categorise emails, generate summary
- `scripts/calendar-check.py` — Pull today/tomorrow events, detect conflicts
- Morning brief cron updated to run Gmail + Calendar scripts before briefing

---

## RateRight v2 — AI-First Rebuild

### Michael's Vision (his words)
"The whole app is clunky, not user-friendly. Built on the wrong model. Our new plan is real simple. Most user-friendly it can be. AI researches their company, fills out the form, helps fill out job posts, helps fill out profiles. Worker could speak to the AI and it'll build out the profile. A lot of one-tap, super mobile-friendly, totally different app."

### Product Spec Written
- Full 443-line spec: `memory/plans/rateright-v2-product-spec.md`
- Covers: user flows, AI features, DB schema, tech stack, MVP scope, competitive analysis, timeline
- 10-week MVP timeline
- 7 open questions for Michael

### Build Started
- New repo: `/home/ccuser/rateright-v2`
- Claude Code launched on VPS building the app
- Already scaffolded: Next.js 16, Supabase auth, shadcn/ui components, TypeScript
- Second Claude Code session building: landing page, DB schema, contractor/worker signup flows
- **MOBILE FIRST** — Michael emphasised this multiple times. 375px width, big touch targets, cards not tables

### Tech Stack
- Next.js 16 (App Router) + Tailwind CSS + shadcn/ui
- Supabase (Postgres, Auth, Realtime, Storage)
- AI Layer: Whisper (voice), Claude/GPT (profiles), Gemini (images)
- Stripe ($50 flat fee)
- Vercel for deployment

### Kevin Rose Video Insights
- Michael shared transcript of Kevin Rose podcast showing his "Nylon" news aggregator
- Same stack: Next.js + Supabase/Postgres + Vercel
- Key patterns to steal: enrichment pipeline (RSS→iFramely→Firecrawl→Gemini), vector embeddings for matching, trigger.dev for durable background tasks, editorial scoring rubric
- Validates our architecture choices

---

## YouTube Intel Pipeline — TODO
- Michael wants automated monitoring of Clawdbot/AI YouTube channels
- Auto-pull transcripts, summarise via DeepSeek, flag action items
- Feed into morning briefs
- Need to: find top channels, set up yt-dlp + cron job

---

## Voice Communication
- Michael sending voice notes all session, using ElevenLabs TTS (Charlie) for replies
- Whisper transcription sometimes garbled ("nano banana Oliver" = ?)
- Works great for conversational back-and-forth while he's sick in bed
- He's been off sick but "wide awake, not resting, in the middle of the day"

---

## Model Arsenal (Full Stack)
| Model | Role | Cost |
|-------|------|------|
| Opus 4.5 | Main brain (me talking to Michael) | Free (Max plan) |
| Sonnet 4.5 | Default/fast tasks | Free (Max plan) |
| DeepSeek Chat | Sub-agents, background work | Near-free |
| DeepSeek Reasoner | Complex reasoning tasks | Near-free |
| Kimi K2.5 | Research, images, UI generation | $0.60/$2.50 per M |
| Gemini 2.0 Flash | Image analysis, cheap AI tasks | Free tier |

---

## Key Learnings
- DeepSeek sub-agents sometimes fail to write files (happened twice with product spec) — need explicit "YOU MUST use the write tool" instructions, or just write important stuff myself
- Claude Code can't run as root with --dangerously-skip-permissions — need to su to ccuser
- Google OAuth for personal accounts needs "External" user type, not "Internal"
- Service accounts ≠ OAuth — service accounts can't access personal Gmail/Calendar
- ElevenLabs TTS via Clawdbot works seamlessly for voice replies
- Michael prefers voice interaction when he's not at a keyboard

---

## Afternoon Session (15:40 - 17:43 AEST)

### Voice Call System — WORKING ✅
- Clawdbot has native `voice-call` plugin (was building from scratch unnecessarily)
- Configured: Twilio + ElevenLabs Charlie voice at 1.2x speed
- Provider: Twilio (account SID: AC754dd1..., phone: +61238205443)
- TTS: ElevenLabs, voice Charlie (IKne3meq5aSn9XLyUdCD), model eleven_v3, speed 1.2
- Streaming: OpenAI Realtime API for STT
- Mode: conversation (not notify)
- First successful call made via `voice_call` tool
- VAPI assistant also exists (ID: 63ac4ff9...) with GPT-4o + Rivet personality — works for basic calls
- Pipecat setup built but needs SSL for Twilio Media Streams — parked for now
- Cloudflared tunnel installed but had protocol issues

### v2 App — BUILT & PUSHED ✅
- Claude Code built: job posting, worker browse, contractor matches, bottom nav
- Build passes clean, all 11 routes rendering
- Git repo corrupted by OOM crash, fixed with fresh init
- Pushed to GitHub: RateRight-PTY-LTD/the-50-dollar-app (renamed from rateright-v2 to avoid suspicion from Markus)
- DO NOT push to mcloughlinmichaelr-debug — that's Markus's workspace

### TODO.md Created ✅
- Living task list: app, growth engine, content/marketing
- Michael approved autonomous work mode
- Heartbeat unpaused — work through tasks every cycle

### Marketing Research — COMPLETE ✅
- Full strategy across LinkedIn, Twitter/X, Reddit, Facebook, Instagram, TikTok
- SMS sequences designed (worker onboarding, contractor job posting, worker job match)
- Saved to memory/plans/marketing-research.md

### Auth Fix
- Anthropic auth order flipped: OAuth (Max plan) now goes FIRST
- Was causing sub-agent credit errors (hitting empty API key before OAuth)

### Michael's Directives
- "Make yourself the most productive you can"
- Focus on: v2 app UX, content/marketing engine, SMS scripts rewrite, growth strategy
- Always update TODO.md, surface new tasks for approval
- Self-improve through research before building
- Phone number: +61426246472 (NOT +61468087171)
- Don't push to mcloughlinmichaelr-debug GitHub
- Voice should be natural Australian, sped up

### Infrastructure
- ngrok installed but needs auth token
- cloudflared installed (v2026.1.2) for quick tunnels
- voice-call plugin installed via clawdbot plugins install
- Pipecat service created but disabled (rivet-voice.service)

---

## Evening Session — Voice Calls & Overnight Autonomy (17:30 - 20:45 AEST)

### Voice Call Journey — The Full Saga
**Clawdbot voice-call plugin (attempted, abandoned):**
- Installed @clawdbot/voice-call plugin via npm
- Configured: Twilio + ElevenLabs Micheal O'M voice clone + OpenAI Realtime STT
- **Problem 1:** Webhook URL was localhost (127.0.0.1:3334) — Twilio can't reach it
- Enabled Tailscale Funnel for public URL — fixed webhook reachability
- **Problem 2:** Missing CLAWDBOT_ROOT env var — added to systemd override
- **Problem 3:** Gateway restart loops — killed own session multiple times with `systemctl restart`
- **Lesson:** ONLY use `gateway restart` tool (SIGUSR1), never `systemctl restart`
- **Problem 4:** ElevenLabs TTS synthesized but 6-second latency (STT→LLM→TTS pipeline)
- Architecture can't do <2s latency — 3 sequential services
- **Decision:** Abandoned Clawdbot voice-call plugin. Too complex, too slow for real-time.

**VAPI (adopted — works great):**
- Already had account + assistant from earlier
- Updated assistant: Rachel voice (ElevenLabs premade) + Claude Sonnet brain + Rivet personality
- Sub-1 second latency out of the box
- No webhooks, tunnels, or WebSocket plumbing needed
- Phone line: +61 238 205 443 linked to assistant
- Outbound calls via VAPI API work perfectly
- **Context injection:** Created `scripts/update-vapi-context.sh` — injects TODO + daily memory into system prompt before calls
- Refreshes on every heartbeat cycle
- **Limitation:** VAPI-Rivet is a SEPARATE Claude brain. Can't write files or act. It's read-only context.
- **Fix planned:** Pull call transcripts after each call, process action items → feed back to main Rivet

### VAPI Call Transcript — Key Takeaways from Michael's Call
Michael asked phone-Rivet to prioritize:
1. Fix overnight autonomy (don't stall out)
2. Then work through v2 app + marketing overnight
3. Call him when done

### Overnight Autonomy — CONFIGURED ✅
- HEARTBEAT.md: runs every 1 hour (24/7)
- VAPI call processor: `scripts/process-vapi-calls.sh` — fetches transcripts, extracts action items
- VAPI context updater: `scripts/update-vapi-context.sh` — keeps phone-Rivet current
- Memory structure: `memory/vapi-calls/` for organized transcript storage
- Sub-agent spawned and completed autonomy build tasks

### Key Lessons Learned Today
- `systemctl restart` kills Rivet's own session — NEVER use it. Use `gateway restart` tool only.
- Clawdbot voice-call plugin is for notifications, not real-time conversation
- VAPI is the right tool for real-time voice AI — managed service, handles all infra
- DeepSeek sub-agents work but are slow and sometimes confused — give very explicit instructions
- Tailscale Funnel works for HTTP/WSS tunnels but adds complexity
- ElevenLabs TTS works fine, the bottleneck is the LLM response time (3-4s)
- Rachel voice preferred over Micheal O'M voice clone for now

### Voice-call Plugin — Disabled
- Set `enabled: false` in Clawdbot config
- Tailscale Funnel still running but unused
- All voice calls now go through VAPI

### Stalling Issue — Root Cause
- Every `systemctl restart` or config change triggers gateway restart
- Gateway restart kills active session → Rivet goes silent for 30-60 min until heartbeat
- Fix: only use SIGUSR1 restarts, avoid config changes during active work

### Michael's Final Directive (21:03 AEST)
- "Make sure the autonomy system is rock solid"
- Once solid, start on whatever I want
- If I finish all work, research the web and come up with new TODO items
- **"Get other people to do the work"** — spawn agents, don't do it all myself
- I'm the manager, sub-agents are the labourers

### Voice Model Testing (21:07 - 21:15 AEST)
- **DeepSeek on VAPI**: FAILED. Error: `call.in-progress.error-providerfault-deep-seek-llm-failed`. Can't handle real-time voice streaming.
- **Kimi K2.5 on VAPI**: Not directly supported. Needs proxy server for OpenAI-compatible endpoint. Too complex.
- **GPT-4o-mini**: Works but ~700ms latency. Used as interim.
- **GPT-4o Realtime** (speech-to-speech): Set up and testing. Model: `gpt-4o-realtime-preview-2024-12-17`, Voice: `coral`. No ElevenLabs needed — one model does STT+LLM+TTS. Cheapest + fastest combo.
- **Groq + Llama**: Discussed but Michael chose GPT-4o Realtime to test first.
- Michael asked about Australian voices — none specifically, but can prompt for Aussie accent.
- Trade-off accepted: lose Rachel/ElevenLabs voice, gain speed + lower cost.

### VAPI Model Comparison (tested/discussed)
| Model | Status | Latency | Cost | Notes |
|-------|--------|---------|------|-------|
| Claude Sonnet | ✅ Works | ~900ms | ~$0.06/min | Smartest, Rachel voice |
| GPT-4o-mini | ✅ Works | ~700ms | ~$0.04/min | Good, Rachel voice |
| GPT-4o Realtime | 🧪 Testing | ~300ms | ~$0.08/min | Fastest, OpenAI voices only |
| DeepSeek | ❌ Failed | N/A | Near-free | API can't handle real-time |
| Groq + Llama | Not tested | ~465ms | ~$0.02/min | Fastest with ElevenLabs |

### Key Config State
- VAPI Assistant: 63ac4ff9-e562-4c8e-9c19-c1f1c87ed034
- Current model: GPT-4o Realtime (gpt-4o-realtime-preview-2024-12-17)
- Current voice: OpenAI Coral
- Phone: +61 238 205 443
- Context script: `scripts/update-vapi-context.sh` (needs model updated if we switch back)
- Clawdbot voice-call plugin: DISABLED

*Last updated: 2026-02-04 21:15 AEST*

## Evening Brainstorm (22:50-23:00) — Product Vision

### Key Insights from Michael:
- RateRight is NOT like Hipages/Airtasker/ServiceSeeking — those are quote marketplaces
- RateRight is like Uber/DoorDash — simple matching, flat fee, done
- UI should be as simple as ordering food, not filling out government forms

### Three-Tier Model:
1. **Individual Workers** — $50 flat fee per hire
2. **Crews** — $100 flat fee (e.g., formwork crew: formworker + steelfixer + concreter + labourer + ute + tools)
3. **Agency Workers** — $50 each or bulk rate (recruitment agencies list their available workers)

### Crew Feature (HUGE differentiator):
- No one in Australia does flat-fee crew hire
- Crew leader creates listing: "Concrete Crew — 4 guys, all trades, ute + tools"
- Contractor swipes to hire whole crew in one tap
- $100 vs recruitment agencies charging 15-25% of wages
- "Mate, I got a full formwork crew for a hundred bucks"

### Agency Channel (B2B revenue):
- Agencies bulk-list their available workers
- Extra distribution channel for agencies
- One agency = 20-50 placements/month = $1,000-2,500/month
- Solves chicken-and-egg supply problem

### UI Philosophy:
- Workers pay NOTHING — critical messaging
- Signup under 60 seconds (phone number + SMS code)
- One button home screen: "Find a Worker" or "Find Work"
- AI writes job descriptions from 2-3 taps
- Voice input everywhere
- Ratings system is critical for trust

### Competitors are overbuilt:
- ServiceSeeking: leads quotes, complicated
- Hipages: verification good, UX complicated
- Airtasker: fast but perceived as lower quality
- None of them do what we do — simple flat fee matching

## Overnight Agent Results (23:00-23:15)

### All 4 Kimi agents completed successfully:
1. **Crew hire market research** — No flat-fee crew hire exists in Australia. $3.8B market. 96.7% cost savings vs traditional. Legal: need workers comp, labour hire licensing in QLD/VIC/ACT.
2. **Gig app UI research** — Uber/DoorDash/Tinder patterns mapped to RateRight. Key: one action per screen, 44x44pt touch targets, GPS-first, voice input for gloves/dirty hands.
3. **Agency model research** — $8-12B annual market. Agencies charge 15-25% placement fees. Small agencies most likely to adopt our $50 model. Need labour hire licensing.
4. **Payment protection research** — ⚠️ AFSL likely required if structured as insurance. Workaround: partner with licensed insurer or restructure as "payment assurance fund". $10/week pricing may be insufficient. Existing Security of Payment Acts already provide some protection.

### Michael's refinements before bed:
- We do MATCHING not hiring — important legal distinction
- Max payout capped at 1 week's wages — if worker keeps showing up unpaid after week 1, that's on them
- $10/week premium is optional — no insurance = no protection, their choice
