Voice-to-Brain

Phone calls create wiki pages via Twilio + OpenAI Realtime API. Call a number, talk, and a structured page appears with transcript, entity detection, and wiki context.

Architecture

Caller (phone) → Twilio WebSocket (g711_ulaw) → voice-server.ts → OpenAI Realtime API
  ↕ qmd query (caller context injection)
  → Post-call: raw/calls/{date}-call-{caller}.md

The voice server bridges Twilio's audio stream to OpenAI's Realtime API. Before each call, it queries the wiki via qmd for context about the caller. After the call, it writes a meeting page with the full transcript. Source: scripts/voice-server.ts; recipes/voice-to-brain.md

Usage

npx tsx scripts/voice-server.ts                   # start on port 8765
npx tsx scripts/voice-server.ts --port 9000       # custom port

Requires: OPENAI_API_KEY, TWILIO_ACCOUNT_SID, TWILIO_AUTH_TOKEN, and an ngrok tunnel pointing to the voice server port.

Features

  • Wiki context injection - queries qmd with caller info before connecting, so the assistant knows who's calling and has relevant context
  • Server-side VAD - voice activity detection for natural turn-taking
  • 20-turn history cap - prevents context bloat in long calls
  • Post-call pages - transcript + attendee info + wiki context at call time

Setup

  1. Set up ngrok tunnel (recipes/ngrok-tunnel.md)
  2. Buy a Twilio phone number (~$1-2/mo)
  3. Set Twilio voice webhook to https://YOUR-DOMAIN/voice
  4. Start the voice server
  5. Call the number

Full setup guide: recipes/voice-to-brain.md

Cost

~$15-25/mo total: Twilio number ($1-2/mo) + voice minutes ($0.01/min) + OpenAI Realtime (input $0.06/min, output $0.24/min) + ngrok ($8/mo shared with MCP).


Timeline