Skip to main content
Status: Phase A implementation starting. Builds on voice mode. Revised after two security and feasibility reviews on November 5, 2026. A notification is easy to miss. A text is harder to miss, and a phone call is hardest. GAIA calls or texts you when something you marked as urgent happens: a scheduled job failed, a task has waited on your approval too long, GAIA itself can’t run, or an agent you allowed to reach you needs you. The call tells you that something needs you and where to look. It never reads out your data. Talking with GAIA on the call comes in a later phase, and only after you key in your PIN. GAIA only contacts numbers in your phone book. Every call and text goes through one check in the daemon that refuses any number not in it. A number gets into the phone book only when someone at this PC types in a code that reached that phone. GAIA never calls emergency services or anyone else. What leaves the PC. A call or text has to cross the phone network, so the provider sees the number, the time, and what is said or written. GAIA keeps that to a fixed sentence per alert type, with no file names, email subjects or agent text. The models stay on the PC. See Privacy. Related: #702 (voice-first parity), the voice plan, the messaging plan (alerts over Telegram and Slack).

Decisions

Options considered and why they lost

Architecture

  • gaia.phone is a plain Python package with no imports from gaia.ui or the daemon’s routes. The daemon hosts it and mounts its router.
  • One send path. PhoneService._place_call and _send_text are the only code that reaches the provider. Each one re-reads the phone book from the store and refuses a number that isn’t verified. The rule engine, the routes and the agent tool all go through raise_alert, never to the provider directly.
  • Escalation runs in the daemon as one asyncio task per open alert. Alert state lives in SQLite (~/.gaia/phone/phone.db), so a daemon restart resumes an open alert rather than losing or repeating it.
  • Outcome by polling. Calls are placed with answering-machine detection (MachineDetection=Enable). GAIA reads the call record every 3 s until it ends. Only answered_by: human counts as reached; voicemail, no-answer, busy, failed and canceled all go on to the next step. A text is read the same way (delivered, undelivered, failed).
  • Reached stops the calls, not the alert. A call a person answered stops further calls and texts for that alert. The alert stays open in the apps until it is opened or marked handled.
  • No double calls after a crash. Before calling, GAIA saves a placing row; it stores the provider’s call ID as soon as the provider returns it. On restart, a placing row with no ID is checked against the provider’s recent calls to that number before anything is redialed.

Alert sources

alert_owner’s reason is stored and shown in the apps. It is never spoken or texted. A scheduled job alerts when its run raises. A job whose agent replies “I couldn’t do it” without raising isn’t a failure to the scheduler and doesn’t alert.

Escalation

Each rule picks its steps:
  1. Notify in the Agent UI and TUI.
  2. Text right away, or when nobody opens the alert within N minutes (default 5).
  3. Call after N more minutes (default 5), or right away for rules marked urgent.
  4. Call again once, two minutes later, to the same number. On iPhone, “Allow repeated calls” lets a second call within three minutes ring through Focus; setup tells you where to turn it on. If you have a second number, the next step calls it.
Opening the alert in either app, or marking it handled, stops every remaining step. Quiet hours hold everything except rules marked urgent. When a limit is reached, the alert stays in the apps and says which limit stopped it.

Phone book

  • Adding a number: you enter it in Settings › Phone (Agent UI) or the phone panel (TUI). GAIA calls it, or texts it if you pick that, and says a 6-digit code. You type the code into the same screen within 10 minutes. Three wrong codes cancel the attempt.
  • Who can add one: neither the agent nor a rule can. When the phone book already has a number, adding another also needs a code sent to an existing number, so someone who controls only the new phone can’t finish it.
  • The phone book is never empty while phone is on. The keys and the first number are one setup step, so phone turns on only once a number is verified. Removing a number needs a code sent to that number. The last number can’t be removed while phone is on; turn phone off first.
  • Changes are announced by a call to the numbers already there (texts may not be approved yet), and the apps show them.
  • Accepted risk: any process running as you can read the daemon’s client token, including an agent’s shell tool once you approve it. The code checks above are what stop such a process from adding its own number; it can’t finish one without a code from a phone already in the book.
  • Verification calls count against the daily limit, at most 3 attempts an hour. The code is sent by call by default, because texts are usually blocked until the number is registered.
  • Format: numbers are stored in E.164 (+15551234567). The phone book refuses short codes, premium-rate prefixes and emergency numbers, before any code is sent.

The call (phase A)

  1. Ring. Caller ID shows your Twilio number. Setup has you save it as a contact, with Emergency Bypass on iPhone, or as a starred contact allowed through Do Not Disturb on Android.
  2. Answer. GAIA says its fixed sentence twice and hangs up. On a trial account, Twilio first plays its own trial notice and asks you to press a key.
  3. Voicemail. The same sentence, which has nothing private in it.

Talking on the call (phase B)

  • Host: the Agent UI server, which owns the chat pipeline and mobile access’s tunnel. The daemon’s phone service places the call with a script that connects a live audio stream to wss://<tunnel>/api/phone/stream. The UI server checks the call’s one-time token with the daemon, then runs the turns there. Needs mobile access to be on and the Agent UI server running; without them, a call is the fixed sentence only.
  • The stream carries 8 kHz µ-law audio both ways and the digits you press.
  • PIN first. GAIA asks for your PIN on the keypad. Until you enter it, the call has only that alert’s own record: no files, web, memory, shell or email tools. Three wrong PINs end the call and alert you in the apps.
  • After the PIN, it is voice mode over the phone with the same spoken-reply contract. Approvals aren’t taken on a call; GAIA says that you need to be at the PC.
  • The stream is accepted only with the one-time token in that call’s script, and only while that call is live.
  • Calls are saved to the call log with their transcript.

Calling GAIA (phase C)

You call GAIA’s number from a number in your phone book. Caller ID can be faked, so GAIA always asks for the PIN first. Three wrong PINs block that caller for an hour and alert you.

Setup

Settings › Phone in the Agent UI, and /phone in the TUI. You never use a command line:
  1. Explain. What calls are for, the cost (about $1.15 a month for a US number and about 1.4¢ a minute, Twilio list price, November 2026), and that calls and texts cross the phone network.
  2. Account. Sign up at Twilio (linked). On a trial, verify your own number in the Twilio console too; a trial can call only numbers verified there.
  3. Keys. Paste the Account SID and Auth Token, then the Twilio number calls come from. GAIA checks them against the account at once and shows the provider’s own error if one fails.
  4. Phone book. Add your number with the code check.
  5. Rules. Turn each source on, choose its steps, quiet hours and limits.
  6. Test. A button sends a test alert through every step it would use.
Use a dedicated Twilio account or subaccount. GAIA can’t narrow what the Auth Token allows, so whoever has it could use the account. Keep the balance low, turn off auto-recharge, and limit calling to your own country in Twilio’s geo permissions. Setup says this on the keys step.

Texts

  • US: carriers block texts from numbers that aren’t registered. A toll-free number needs toll-free verification; a local number needs 10DLC registration as a sole proprietor. Twilio advises against starting toll-free verification on a trial, so texts may not work until the account is upgraded. Setup shows texts as “Not approved yet” until a test text is delivered.
  • Canada and other countries follow the provider’s own rules; Canada has no 10DLC.
  • Calls work while texts wait for approval.

Failure states

Every failure shows in the phone settings, and on the alert itself when it happens during one. No failure quietly becomes a different channel.

Privacy

  • What the provider sees: your number, GAIA’s number, the time, the call length, and the fixed sentence. For talking on a call (phase B), also the audio, which travels over the phone network unencrypted once it leaves the provider.
  • What never leaves the PC: files, email, task output, agent text, the call log and the transcript.
  • The apps say this on the setup’s first screen.

Test strategy

  • Unit: the phone book (E.164 checks, refused prefixes, code expiry and attempts, the second-number rule), the send path refusing unverified numbers, limits and their reset, cooldown merging, quiet hours across midnight, escalation timing and stopping, restart resuming open alerts.
  • Contract: Twilio request shapes (form fields, Twiml, basic auth, the account path) against a fake Twilio HTTP server, and the status values GAIA maps from.
  • Security: an agent tool call with a phone number in its reason, a rule pointing at an unknown number, a code submitted through the agent’s token, a flood of alerts against the limits.
  • Apps: Settings › Phone and /phone screens in every state with the Simulated provider, with screenshots.
  • Real: one real call and text with a Twilio account before each release candidate.

Delivery sequence

Out of scope and open questions

  • Email-sender alerts wait for DKIM/DMARC checks on the sender.
  • A PC that is off. An alert that the PC went offline has to come from somewhere else.
  • Contacting anyone but you.
  • Arabic. The fixed sentences are translated; Twilio’s voice for Arabic is checked before it ships.