Inspiration
Phone scams work because the scammer has practiced the call hundreds of times, and the person picking up has practiced it zero times. Fake tax agents, bank "fraud departments": it's always urgency, authority, and secrecy, and it hits seniors and newcomers hardest. Companies run fake phishing emails to train employees, but nobody does that for the people who actually lose their savings. So we built a fire drill for scam calls. Loki, the trickster, calls you so the real one doesn't win.
What it does
Loki is an AI scammer that calls you, on purpose, with your permission.
- Your phone rings and a realistic AI scammer (a fake tax agent, a grandchild in trouble, or a bank "fraud department") works you with real pressure tactics, live.
- A ref scores the call in real time. Reading out a card number or agreeing to buy gift cards is an instant fail. Naming your bank or agreeing to keep it secret is a strike, and three strikes and you're out. An AI judge catches subtler slips and gives credit for good defense, like asking for a badge number.
- The reveal: Loki drops the act, tells you you're safe, and explains the exact tactic that almost worked.
- A live dashboard shows the transcript as it happens, with strikes stamped on the lines that caused them and numbers redacted on screen.
How we built it
- Voice: OpenAI Realtime API (
gpt-realtime-2) over WebRTC in the browser, and Twilio Media Streams for real phone calls. - The ref: a plain JavaScript rules engine handles the dangerous, clear-cut stuff (card numbers, gift cards). An AI judge with structured JSON outputs handles only the gray areas, and it can never end a drill on its own.
- Backend: Node.js and Express, with Server-Sent Events streaming the live transcript and ref calls to the dashboard.
- Frontend: vanilla HTML, CSS, and JS, built accessibility-first for older users. The ref's buzzer and voice run on the Web Audio and Speech APIs.
- Teamwork: three teammates each ran a Claude Code agent in parallel, coordinated by a shared spec where every file had exactly one owner.
Challenges we ran into
- Easy to build, painful to debug. The app came together fast, but figuring out why the ref made a bad call took way longer, and most bugs only showed up when real people talked to it.
- Spoken numbers. We turn speech like "four five one two" into digits to catch card numbers. It worked too well: a birthday said year-first became
19980412and got autofailed as a credit card. Telling dates and card numbers apart is still a work in progress. - Twilio was very difficult. Trial accounts only call verified numbers and play a trial message before our scammer speaks, and ngrok cost us an hour forwarding to the wrong port. We kept a browser-only version as a backup.
Accomplishments that we're proud of
- Type your number, get a call, and survive a convincing scam attempt in under a minute.
- A fair ref: hard rules where mistakes are dangerous, AI only for the gray areas.
- Privacy by design: no audio or transcripts saved, and every number redacted instantly.
- A reveal that teaches instead of shaming.
What we learned
- Realtime voice AI is mostly a latency problem, not a prompt problem.
- Agreeing on shared contracts before coding let three people (and three AI agents) build at the same time.
- Real users break things tests never will. Our birthday bug proved it.
What's next for Loki
- Production: move Loki onto a hosted backend so phone drills work without running on our laptops, with a secure database for opt-ins and drill results. Still no audio or transcripts saved.
- More scenarios: expand beyond our first scams to cover more of the most-reported scams in Canada.
- Scheduled surprise drills: opt in once, choose your drill hours, and Loki calls when you least expect it, like a real scammer would.
Built With
- cloudflare-tunnel
- css3
- dotenv
- elevenlabs
- express.js
- html5
- javascript
- ngrok
- node.js
- openai
- openai-realtime-api
- server-sent-events
- sqlite
- twilio
- web-audio-api
- webrtc
- websockets
- ws